#!perl use strict; use Win32::API; my $user="username"; my $pass="password"; print createProcessWithLogon('notepad.exe',$user,$pass); exit; ############### sub createProcessWithLogon{ my $program=shift; my $username=shift; my $password=shift; my $LOGON_NETCREDENTIALS_ONLY = 0x2; my $CREATE_NEW_CONSOLE = 0x10; my $CreateProcessWithLogon = new Win32::API('advapi32.dll', 'Creat +eProcessWithLogonW', ['P','P','P','P','P','P','P','P','P','P','P'],'N +') || return $^E; print "calling[$program,$username,$password]\n"; #Set Flag my $dwFlags = 1; # STARTF_USESHOWWINDOW $dwFlags |= 0x100; # STARTF_USESTDHANDLES otherwise we inherit t +he parents handles on 98 # SW_HIDE=0 SW_SHOWNORMAL=1 SW_SHOWMINIMIZED=2 my $show=1; my $si = pack("LLLLLLLLLLLL SS LLLL",68,0,0,0,0,0,0,0,0,0,0,$dwFla +gs,$show,0,0,-1,-1,-1); my $processinfo = pack("LLLL",0,0,0,0); my $num=$CreateProcessWithLogon->Call( $username, #lpUsername undef, #lpDomain $password, #lpPassword $LOGON_NETCREDENTIALS_ONLY, #dwLogonFlags, "hello", #lpApplicationName $program, #lpCommandLine $CREATE_NEW_CONSOLE, #dwLogonFlags, undef, #lpEnvironment ".", #lpCurrentDirectory $si, #lpStartupInfo $processinfo #lpProcessInfo ) || return "Bad Call - $^E"; return $num; }
-------------------------------
Need a good Perl friendly Host Provider?
http://www.dreamhost.com
In reply to Win32::API and CreateProcessWithLogonW by slloyd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |