Re: Help - I cant get SfcIsFileProtected or SfcGetNextProtectedFile to work.
From: Rob Kennedy (me3_at_privacy.net)
Date: Sun, 11 Apr 2004 15:32:46 -0500
> TPROTECTED_FILE_DATA = packed record
> FileName: array [0..256] of WideChar;
The header you translated this from should have used the MAX_PATH macro
for the character count. You should do the same. (MAX_PATH's current
definition is 260, but that doesn't matter when you get into the habit
of using named constants.)
> FileNumber : DWORD;
> TSfcGetNextProtectedFile = function (Handle: THandle; ProtFileData:
> TPROTECTED_FILE_DATA): Boolean ;
The ProtFileData parameter should be declared as a PProtectedFileData --
a pointer to the structure. As an alternative, you can declare it as a
var or const TProtectedFileData. One way or another, you need to ensure
that a pointer is passed.
The API function is declared as returning a BOOL, which is *not* the
same as Delphi's Boolean. The API type is three bytes wider, and those
three bytes can be very important.
Finally, the API function almost certainly uses the stdcall calling
convention; definitely not Delphi's default register calling convention.
TSfcGetNextProtectedFile = function(RpcHandle: THandle; var
ProtFileData: TProtectedFileData): Bool; stdcall;