高手帮改改CreateProcessWithLogon 调用的代码
是想达到这个贴中的效果:http://leifree.spaces.live.com/blog/cns!f196f89a9a9a915!257.entry<<用管理员身份后台运行程序的VB代码>>
这个是原型
;CreateProcessWithLogon Lib "advapi32" Alias "
;CreateProcessWithLogonW (ByVal lpUsername As Long, ByVal lpDomain As Long, ByVal lpPassword As Long, ByVal dwLogonFlags As Long, ByVal lpApplicationName As Long,ByVal lpCommandLine As Long, ByVal dwCreationFlags As Long, ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, lpStartupInfo As STARTUPINFO, lpProcessInfo As PROCESS_INFORMATION) As Long
$str="dword cb;ptr lpReserved;ptrlpDesktop;dword dwX;dword dwY;dword dxXSize;DWORD dwYSize;DWORD dwXCountChars;DWORD dwYCountChars;DWORD dwFillAttribute;DWORD dwFlags; dword wShowWindow;dword cbReserved2;ushort lpReserved2;hwnd hStdInput; hwnd hStdOutput;hwnd hStdError;"
$a = DllStructCreate($str)
if @error Then
MsgBox(0,"","Error in DllStructCreate " & @error);
exit
endif
$result = DllCall("advapi32.dll", "int", "CreateProcessWithLogonW", "long", ptr($strUsername), "str", "domain", "str", "test1", "long", 1,"str","notepad.exe","str","","long",0,"str","",ptr($a),s)
[ 本帖最后由 lus5d 于 2008-9-4 14:26 编辑 ] 垃圾代码,居然还用cmd!
runas/runasset已经差不多了。
[ 本帖最后由 asdf 于 2008-9-4 17:34 编辑 ]
页:
[1]