在官网转了一天还没找到,只得到下面的源码。看不太明,望高手指点下??
只知道DllCall("kernel32.dll", "long", "FindFirstFileA")是查找文件的#RequireAdmin
$res = _FileExists("C:\WINDOWS\System32\Drivers\*.sys")
Msgbox(0, "Result", $res)
Exit
Func _FileExists($sFileName)
Local $INVALID_HANDLE_VALUE = 0xFFFFFFFF
Local $sWIN32_FIND_DATA = "dword;dword[2];dword[2];dword[2];dword;dword;dword;dword"
If @Unicode Then
$sWIN32_FIND_DATA &= ";byte[520];byte[28]"
Else
$sWIN32_FIND_DATA &= ";char[260];char[14]"
EndIf
Local $stWFD = DllStructCreate($sWIN32_FIND_DATA)
Local $stFileName
If @Unicode Then
$stFileName = DllStructCreate("byte[520]")
Else
$stFileName = DllStructCreate("byte[260]")
EndIf
DllStructSetData($stFileName, 1, $sFileName)
Local $stOldVal = DllStructCreate("dword")
If @ProcessorArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", _
"ptr", DllStructGetPtr($stOldVal))
Local $hFile = DllCall("kernel32.dll", "long", "FindFirstFileA", _
"ptr", DllStructGetPtr($stFileName), _
"ptr", DllStructGetPtr($stWFD))
If @ProcessorArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection ", _
"ptr", DllStructGetPtr($stOldVal))
If $hFile[0] = $INVALID_HANDLE_VALUE Then Return 0
Msgbox(0, "Result", $hFile[0])
DllCall("kernel32.dll", "int", "FindClose", _
"hwnd", $hFile[0])
Return 1
EndFunc
|