question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FDICopy is incorrectly declared

See original GitHub issue

Describe the bug FDICopy inside the Cabinet declarations is not working right now, as the PFNFDINOTIFY does not correspond to what Windows accepts.

What code is involved Fdi.cs, FDICopy and PFNFDINOTIFY.

Expected behavior The function expects two pointers, PFNFDINOTIFY and PFNFDIDECRYPT. As can be seen here, the declaration of the first pointer should actually be something like this:

public delegate IntPtr PFNFDINOTIFY(int fdint, ref FDINOTIFICATION pfdin);

(the first parameter could be an enum FDINOTIFICATIONTYPE).

Right now, PFNFDINOTIFY is actually declared to match PFNFDIDECRYPT which is not named anywhere in Fdi.cs except the docs. Together, the rest should look like this:

public delegate int PFNFDIDECRYPT(ref FDIDECRYPT pfdid);

[DllImport("cabinet.dll", SetLastError = false, ExactSpelling = true, CharSet = CharSet.Ansi)]
public static extern bool FDICopy(HFDI hfdi, string pszCabinet, string pszCabPath, int flags, PFNFDINOTIFY pfnfdin, PFNFDIDECRYPT pfnfdid, IntPtr pvUser);

Edit: More issues have cropped up as I tried to use the API, so I have added them as separate comments. Frankly, I am not surprised there are so many of them, as cabinet.dll is like nothing I have ever seen in WinAPI before.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dahallcommented, Jun 3, 2021

Thanks for validating it. I’ll get it pushed shortly.

1reaction
dahallcommented, Jun 1, 2021

@IllidanS4 I think I’ve addressed all your issues and then fixed a few other things while in there.

  1. Implemented PFNFDINOTIFY as requested along with enum type for first param
  2. Changed incorrect long fields to int and all HFILE references to IntPtr
  3. Changed FDINOTIFICATION.psz2 to an IntPtr. Please let me know if your testing shows I need to attribute all delegates to explicitly be called as __cdecl.
  4. All methods taking ERF now require a ref instance and the marshaled bool field now uses BOOL – a blittable structure defined in my lib that auto converts to bool in use.
Read more comments on GitHub >

github_iconTop Results From Across the Web

FDICopy function (fdi.h) - Win32 apps
The FDICopy function extracts files from cabinets. ... The function should be declared using the FNFDINOTIFY macro. [in] pfnfdid.
Read more >
CAB file API clarification - delphi
1 Answer 1 ... What you're more than likely running into is that FDICopy only reads the cab you passed in. It will...
Read more >
DllCall DllCallbackRegister Crashes The Gui
Hi all, the problem occurs with every dllcall that to do with the Extract Cab file, both Setupapi & AdvPack, here is an...
Read more >
Wine Announcement - This is release 0.9.44 of Wine, a free ...
... places that use the wrong get/release function for DCs. winex11: Properly ... the file list. cabinet: Return the value of GetLastError if...
Read more >
Wine changelog for 1.5.19
... Radar is offset in the upward direction making sampling incorrect. ... the cab path as FDICopy expects it. cabarc: Handle fdintNEXT_CABINET notification ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found