SfcGetFiles函数 如何写?
2020.08.31回顾问题:答案如下:
#NoTrayIcon#RequireAdmin
#PRE_UseX64 = n
Local $pPF, $FileCount
Local $Buffer, $pFile, $tPFE
If SfcGetFiles($pPF, $FileCount) = 0 Then
For $i = 0 To $FileCount - 1
$tPFE = DllStructCreate('ptr;ptr;ptr;', $pPF + $i * 12)
If Not @error Then
$pFile = DllStructGetData($tPFE, 2)
If $pFile <> 0 Then
$Buffer = DllStructCreate('WCHAR FileName[260]', $pFile)
ConsoleWrite($Buffer.FileName & @CRLF)
EndIf
EndIf
Next
EndIf
Func SfcGetFiles(ByRef $ProtFileData, ByRef $FileCount)
$ProtFileData = 0
$FileCount = 0
Local $dll = DllOpen('Sfcfiles.dll')
Local $ret = DllCall($dll, 'INT', 'SfcGetFiles', 'ptr*', Null, 'LONG*', Null)
If Not @error Then
$ProtFileData = $ret[1]
$FileCount = $ret[2]
Return $ret[0]
EndIf
Return SetError(1, 0, -1)
EndFunc ;==>SfcGetFiles
|