Вверх ↑
Ответов: 578
Рейтинг: 14
#1: 2013-12-17 14:46:38 ЛС | профиль | цитата
[b]andrestudio[/b], вообще перестало запускаться
Add(InlineCode,6306845,511,147){
WorkPoints=#71:doRunAsExt=запуск программы от учётной записи, имя файла *.exe в потоке|
EventPoints=#21:onLog=Вывод сообщений|
DataPoints=#14:UserName=Логин|15:Password=Пароль|12:Domain=Домен|21:CommandLine=Параметры|
Code=#15:unit HiAsmUnit;|0:|9:interface|0:|30:uses kol,windows, Share,Debug;|0:|48:function CreateProcessWithLogonW(user:pwidechar;|50: domain:pwidechar;|50: passw:pwidechar; |47: flags: DWORD; |62: lpApplicationName: PwideChar;|58: lpCommandLine: PwideChar;|57: dwCreationFlags: DWORD; |56: lpEnvironment: Pointer;|64: lpCurrentDirectory: PWideChar; |67: const lpStartupInfo: TStartupInfo;|120: var lpProcessInformation: TProcessInformation): BOOL; stdcall; external 'advapi32.dll';|0:|77:function runas(username, password, domain, strline, command: string): string;|0:|4:type|28: THiAsmClass = class(TDebug)|10: private|0:|9: public|23: //Command: string;|59: UserName,Password,Domain,CommandLine,onLog :THI_Event;|50: procedure doRunAsExt(var dt:TData; idx:word);|5: end;|0:|14:implementation|0:|77:function runas(username, password, domain, strline, command: string): string;|3:var|19: si: tstartupinfo;|26: pi: tprocessinformation;|72: puser, ppass, pdomain, pprogram, pcomandline: array [0..255] of wchar;|19: lasterror: dword;|23: resultstring: string;|5:begin|30: zeromemory(@si, sizeof(si));|20: si.cb:=sizeof(si);|30: zeromemory(@pi, sizeof(pi));|0:|41: stringtowidechar(username, puser, 255);|41: stringtowidechar(password, ppass, 255);|41: stringtowidechar(domain, pdomain, 255);|43: stringtowidechar(command, pprogram, 255);|46: stringtowidechar(strline, pcomandline, 255);|2: |32: createprocesswithlogonw(puser,|34: pdomain,|32: ppass,|50: 1, //logon_with_profile,|35: pprogram,|45: pcomandline, //nil,|76: create_default_error_mode or create_new_console or|78: create_new_process_group or create_separate_wow_vdm,|30: nil,|30: nil,|29: si,|30: pi);|0:|26: lasterror:=getlasterror;|19: case lasterror of|31: 0: resultstring:='success';|39: 86: resultstring:='wrong password';|53: 1326: resultstring:='wrong username or password';|66: 1327: resultstring:='logon failure. user account restriction';|114: 1385: resultstring:='logon failure. the user has not been granted the requested logon type at this computer.';|38: 2: resultstring:='file not found';|37: 5: resultstring:='access denied';|6: else|46: resultstring:='error '+int2str(lasterror);|6: end;|23: result:=resultstring;|4:end;|0:|33:procedure THiAsmClass.doRunAsExt;|53:var login,pass,strdomain,command,strline,log: string;|16: data: TData;|5:begin|26: command := ToString(dt);|40: login := ReadString(data,UserName,'');|40: pass := ReadString(data,Password,'');|43: strdomain := ReadString(data,Domain,'');|46: strline := ReadString(data,CommandLine,'');|57: log := runas(login, pass, strdomain, strline, command);|25: _hi_OnEvent(onLog,log);|4:end;|4:end.|
link(onLog,13433728:doMessage,[])
link(UserName,13421900:Text,[])
link(Password,12880259:Text,[])
link(CommandLine,16469127:Text,[])
}
Add(Button,9513141,420,147)
{
Left=63
Top=63
Data=String(cmd.exe)
link(onClick,6306845:doRunAsExt,[])
}
Add(VisualStrings,13421900,511,42)
{
Lines=#3:123|
}
Add(VisualStrings,12880259,518,70)
{
Lines=#3:123|
}
Add(VisualStrings,16469127,532,105)
{
Lines=#33:/C C:\Windows\system32\appwiz.cpl|
Width=200
}
Add(Message,13433728,567,147)
{
}



карма: 0

0