Версия для печати темы

Нажмите сюда для просмотра этой темы в обычном формате

Форум «Всё о Паскале» _ Делфи _ CMD от имени админа

Автор: GrabbeR 11.05.2013 2:59

Мужики, есть код для открытия файла от имени другого юзера (в моем случае администратора). Работает на ура, но! как в УЖЕ открытой консоли выполнить команду? Например: net user noob password

Код

function CreateProcessWithLogonW(user:pwidechar; domain:pwidechar;
   passw:pwidechar; flags: DWORD; lpApplicationName: PwideChar; lpCommandLine: PwideChar;
   dwCreationFlags: DWORD; lpEnvironment: Pointer;
   lpCurrentDirectory: PWideChar; const lpStartupInfo: TStartupInfo;
   var lpProcessInformation: TProcessInformation): BOOL; stdcall;external 'advapi32.dll' name 'CreateProcessWithLogonW';

var
     si: TSTARTUPINFO;
     pif: PROCESS_INFORMATION;
begin
   si.cb := SizeOf(tstartupinfo);
   si.dwFlags  := STARTF_USESHOWWINDOW;
   si.wShowWindow := SW_SHOWDEFAULT;
   si.lpReserved := nil;
   si.lpDesktop := nil;
   si.lpTitle := nil;

   CreateProcessWithLogonW('Admin', nil, '12345', 0,
     'cmd.exe',nil,0, nil, nil, si, pif);

Автор: nishaknapp 16.01.2023 7:26

Why not settling on games that is fun and at the same time your earning. Well it'll make suspense because the game is well but dude just try it and it gave me hope while pandemic is real rn. https://magazines2day.com/slot-games-or-table-games/