找回密码
 加入
搜索
查看: 3622|回复: 5

[系统综合] Delphi 代码如何转换成 Au3(GetSfcFiles API )[已解决]

[复制链接]
发表于 2010-5-10 11:17:17 | 显示全部楼层 |阅读模式
本帖最后由 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[0..0] 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^[i].wcsFilePath)); 
end.
请熟悉这方面的高手帮忙一下,谢谢
发表于 2010-5-10 13:18:09 | 显示全部楼层
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 = 0  to $filecount -1  Step 1
        $filepath=DllStructGetData($stru_list,"wcsFilePath")
        write($filepath)
Next

Func _GetsTru_sfclist()
        Local $ListStr
        $ListStr="wcsFileNameInDllCache;wcsFilePath;wcsWhatEverInfFile"
        Return DllStructCreate($ListStr)
EndFunc

评分

参与人数 1金钱 +30 贡献 +5 收起 理由
asionwu + 30 + 5 谢谢!我试试去

查看全部评分

发表于 2010-5-10 13:37:06 | 显示全部楼层
修正下
DllCall($DllFileName,"DWORD","sfcGetfiles","Ptr",$hWnd_sfclist,"int",$filecount)
发表于 2010-5-10 14:58:27 | 显示全部楼层
看不懂噶。。。看来楼上确实高手
发表于 2010-6-6 23:40:21 | 显示全部楼层
无法看懂哦,看来得加紧练功啊
发表于 2022-3-31 18:41:12 | 显示全部楼层
目测2楼的代码并不正确,这个api的调用有点不太友好。以前玩xp封装的时候,也曾为这个api苦恼了一段时间。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-4 11:57 , Processed in 0.097917 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表