Delphi 代码如何转换成 Au3(GetSfcFiles API )[已解决]
本帖最后由 asionwu 于 2010-5-10 16:28 编辑这个是 Delphi 调用GetSfcFiles API 的代码program GetSfcFiles_Sample;
{$APPTYPE CONSOLE}
uses
Windows;
type
TSfcList = record
wcsFileNameInDllCache: PWideChar; // Name of the file in DllCache
wcsFilePath: PWideChar; // Path of the protected file
wcsWhatEverInfFile: PWideChar; // Name of some INF file ... unknown meaning
end;
TSfcListArray = array of TSfcList;
PSfcListArray = ^TSfcListArray;
function SfcGetFiles(
var lpNamelist: PSfcListArray;
var lpNumEntries: DWORD
): DWORD; stdcall; external 'sfcfiles.dll';
(* Call and then iterate through the array with wide strings NumEntries times. *)
var
namelist:PSfcListArray;
i, num:DWORD;
begin
{ This crappy example simply dumps all SFC protected files to the console }
if SfcGetFiles(namelist, num)=ERROR_SUCCESS then
for i:=0 to num-1 do
Writeln(String(namelist^.wcsFilePath));
end.请熟悉这方面的高手帮忙一下,谢谢 Const $DllFileName=@ScriptDir & "\sfcfiles.dll"
Global $hWnd_sfclist,$filecount
$stru_list=_GetsTru_sfclist()
$hWnd_sfclist=DllStructGetPtr($stru_list)
$result = DllCall($DllFileName,"DWORD","sfcGetfiles","HANDLE",$hWnd_sfclist,"int",$filecount)
For $i = 0to $filecount -1Step 1
$filepath=DllStructGetData($stru_list,"wcsFilePath")
write($filepath)
Next
Func _GetsTru_sfclist()
Local $ListStr
$ListStr="wcsFileNameInDllCache;wcsFilePath;wcsWhatEverInfFile"
Return DllStructCreate($ListStr)
EndFunc 修正下
DllCall($DllFileName,"DWORD","sfcGetfiles","Ptr",$hWnd_sfclist,"int",$filecount) 看不懂噶。。。看来楼上确实高手 无法看懂哦,看来得加紧练功啊 目测2楼的代码并不正确,这个api的调用有点不太友好。以前玩xp封装的时候,也曾为这个api苦恼了一段时间。
页:
[1]