本帖最后由 tubaba 于 2022-4-26 09:33 编辑
#AutoIt3Wrapper_Icon= ;图标,支持EXE,DLL,ICO#AutoIt3Wrapper_OutFile= ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_UseX64=n ;使用32位编译
#AutoIt3Wrapper_Res_Comment= ;程序注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion= ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=n ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright= ;版权
#AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable ;执行等级
#AutoIt3Wrapper_Res_SaveSource=y ;保存源代码到资源段
#AutoIt3Wrapper_Run_AU3Check= ;语法检查
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
#AutoIt3Wrapper_run_debug_mode=N
#cs ____________________________________
Au3 版本:
脚本作者:
电子邮件:
QQ/TM:
脚本版本:
脚本功能:
#ce _______________脚本开始_________________
Opt("MustDeclareVars", 0)
;~ #include <WinApi.au3>
;For 'CreateProcessWithLogonW' -> dwLogonFlags
$UserName = 'administrator'
$UserPasswd = 'XXXXXXXXX'
$ProcessName = @ComSpec;替换你要运行的程序全路径 ,参数也可放在这里
Global Const $LOGON_WITH_PROFILE = 0x1
Global Const $LOGON_NETCREDENTIALS_ONLY = 0x2
;For'CreateProcessWithLogonW' -> dwCreationFlags
Global Const $CREATE_DEFAULT_ERROR_MODE = 0x4000000
;Les initialisations
Dim $STARTUPINFO = "", $si = ""
Dim $PROCESS_INFORMATION = "", $pi = ""
;
$STARTUPINFO &= "dword cb;long lpReserved;long lpDesktop;long lpTitle;dword dwX;dword dwY;"
$STARTUPINFO &= "dword dwXSize;dword dwYSize;dword dwXCountChars;dword dwYCountChars;"
$STARTUPINFO &= "dword dwFillAttribute;dword dwFlags;short wShowWindow;short cbReserved2;long lpReserved2;"
$STARTUPINFO &= "long hStdInput;long hStdOutput;long hStdError"
$si = DllStructCreate($STARTUPINFO)
If $si = 0 Then
Msg(@error)
Exit
EndIf
DllStructSetData($si, "cb", DllStructGetSize($si))
$ptrSI = DllStructGetPtr($si)
;~ Msg($ptrSI)
$PROCESS_INFORMATION &= "long hProcess;long hThread;long dwProcessId;long dwThreadId"
$pi = DllStructCreate($PROCESS_INFORMATION)
If $pi = 0 Then
Msg(@error)
Exit
EndIf
$ptrPI = DllStructGetPtr($pi)
;~ Msg($ptrPI)
$tCommandLine = DllStructCreate("wchar[256]")
DllStructSetData($tCommandLine, 1, $ProcessName)
$arrRet = DllCall("advapi32.dll", "long", "CreateProcessWithLogonW", _
"wstr", $UserName, _
"wstr", @ComputerName, _
"wstr", $UserPasswd, _
"dword", $LOGON_WITH_PROFILE, _
"ptr", 0, _
"wstr", $ProcessName, _
"dword", $CREATE_DEFAULT_ERROR_MODE, _
"ptr", 0, _
"ptr", 0, _
"ptr", $ptrSI, _
"ptr", $ptrPI)
If $arrRet[0] = 0 Then
MsgBox(0, "Error in Dllcall", _GetLastError())
Exit
EndIf
If Not @error And $arrRet[0] <> 0 Then
$arrRet = DllCall("kernel32.dll", "int", "CloseHandle", "ptr", DllStructGetPtr($pi, "dwProcessId"))
If Not @error And $arrRet[0] <> 0 Then
Msg("Return of 'CloseHandle' : " & $arrRet[0])
Else
Msg("Error (CloseHandle): " & @error)
Msg("Return of 'CloseHandle' : " & $arrRet[0])
Exit 1
EndIf
Else
Msg("Error (CreateProcessWithLogonW) : " & @error)
Msg("Return of 'CreateProcessWithLogonW' : " & $arrRet[0])
Exit 2
EndIf
Exit 0
;
Func Msg($letexte)
MsgBox(0x43000, "Message...", $letexte)
EndFunc ;==>Msg
Func _GetLastError(Const $_iCallerError = @error, Const $_iCallerExtended = @extended)
Local $aCall = DllCall("kernel32.dll", "dword", "GetLastError")
Return SetError($_iCallerError, $_iCallerExtended, $aCall[0])
EndFunc ;==>_WinAPI_GetLastError
|