Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CreateProcessWithLogonW(
- lpUsername,
- lpDomain,
- lpPassword:PWideChar;
- dwLogonFlags:dword;
- lpApplicationName: PWideChar;
- lpCommandLine: PWideChar;
- dwCreationFlags: DWORD;
- lpEnvironment: Pointer;
- lpCurrentDirectory: PWideChar;
- const lpStartupInfo: tSTARTUPINFO;
- var lpProcessInformation: TProcessInformation
- ): BOOL; stdcall; external 'advapi32.dll';
- procedure TFcatPer.ImhuellaDblClick(Sender: TObject);
- var
- f:textfile;
- l:string;
- hToken: THandle;
- pi: TProcessInformation;
- si: TStartupInfo;
- begin
- if fileexists(Flogin.ExeHuella) then
- begin
- try
- visible:=false;
- // ExecNewProcess(Flogin.ExeHuella,true);
- // Runas('Administrador', 'samba', Flogin.ExeHuella+' a');
- // RunAsAdmin(self.Handle,Flogin.ExeHuella,'a');
- // RunAsAdmin(self.Handle,Flogin.ExeHuella,'a User Name=Administrador;Password=samba');
- ZeroMemory(@pi, SizeOf(pi));
- ZeroMemory(@si, SizeOf(si));
- si.cb:=SizeOf(TStartupInfo);
- if LogonUser('Administrador', 'GPOLN', 'samba' , LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT, hToken) then
- begin
- visible:=false;
- if not (CreateProcessWithLogonW('Administrador','GPOLN','samba',0,nil,
- 'C:\Archivos de programa\GPOLN\Huellas\GPOLN.AFIS.exe a',0,
- nil,nil,si, pi)) then
- ShowMessage('Error')
- else
- WaitForSingleObject(pi.hProcess, INFINITE);
- visible:=true;
- end;
- i am tested Logon User and CreteProcessWithLogonW with user: Administrador/samba and osbaldojacobo/osbaldo
- with Administrator/samba, wont work,not run the program with user: osbaldojacobo/osbaldo too wont work, but run the program but without Administrator privileges;
- thx
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement