Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.02.06;
Скачать: CL | DM;

Вниз

CreateProcessWithLogonW   Найти похожие ветки 

 
ПЛОВ ©   (2004-12-14 11:26) [0]

CreateProcessWithLogonW - подскажите, где взять?


 
Игорь Шевченко ©   (2004-12-14 11:28) [1]

В AdvApi32.dll

unit HSAdvApi;

interface
uses
 Windows;

function CreateProcessWithLogonW (const lpUsername : PWideChar;
 const lpDomain : PWideChar; const lpPassword : PWideChar;
 dwLogonFlags : DWORD; const lpApplicationName : PWideChar;
 lpCommandLine : PWideChar; dwCreationFlags : DWORD;
 lpEnvironment : Pointer; const lpCurrentDirectory : PWideChar;
 lpStartupInfo : PStartupInfo;
 lpProcessInfo : PProcessInformation) : Boolean; stdcall;

const
 LOGON_WITH_PROFILE = $00000001;
 LOGON_NETCREDENTIALS_ONLY = $00000002;
 LOGON_ZERO_PASSWORD_BUFFER = $80000000;

implementation
uses
 SysUtils;

{ ADVAPI32.DLL functions }
type
 TCreateProcessWithLogonW =
   function (const lpUsername : PWideChar;
 const lpDomain : PWideChar; const lpPassword : PWideChar;
 dwLogonFlags : DWORD; const lpApplicationName : PWideChar;
 lpCommandLine : PWideChar; dwCreationFlags : DWORD;
 lpEnvironment : Pointer; const lpCurrentDirectory : PWideChar;
 lpStartupInfo : PStartupInfo;
 lpProcessInfo : PProcessInformation) : Boolean; stdcall;

const
 DllName = "advapi32.dll";

var
 DllHandle : THandle;
 _CreateProcessWithLogonW : TCreateProcessWithLogonW;

function InitLib : Boolean;
begin
 if DllHandle = 0 then
   if Win32Platform = VER_PLATFORM_WIN32_NT then begin
     DllHandle := LoadLibrary(DllName);
     if DllHandle <> 0 then begin
       @_CreateProcessWithLogonW := GetProcAddress(DllHandle,
         "CreateProcessWithLogonW");
     end;
   end;
 Result := (DllHandle <> 0);
end;

function NotImplementedBool : Boolean;
begin
 SetLastError (ERROR_CALL_NOT_IMPLEMENTED);
 Result := false;
end;

function CreateProcessWithLogonW (const lpUsername : PWideChar;
 const lpDomain : PWideChar; const lpPassword : PWideChar;
 dwLogonFlags : DWORD; const lpApplicationName : PWideChar;
 lpCommandLine : PWideChar; dwCreationFlags : DWORD;
 lpEnvironment : Pointer; const lpCurrentDirectory : PWideChar;
 lpStartupInfo : PStartupInfo;
 lpProcessInfo : PProcessInformation) : Boolean; stdcall;
begin
 if InitLib and Assigned(_CreateProcessWithLogonW) then
   Result := _CreateProcessWithLogonW(lpUsername, lpDomain, lpPassword,
     dwLogonFlags, lpApplicationName, lpCommandLine, dwCreationFlags,
     lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInfo)
 else
   Result := NotImplementedBool;
end;

initialization
finalization
 if DllHandle <> 0 then
   FreeLibrary(DllHandle);
end.


 
ПЛОВ ©   (2004-12-14 11:31) [2]

Огромное спасибо!



Страницы: 1 вся ветка

Текущий архив: 2005.02.06;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.042 c
14-1105507076
sapsi
2005-01-12 08:17
2005.02.06
У нас появятся Силиконовые долины?


4-1103111498
Пат
2004-12-15 14:51
2005.02.06
Как мне скопировать весь текст из FindWindowEX( SysListView32 )


4-1103130861
Alex____
2004-12-15 20:14
2005.02.06
Подсчет опираций процессора


1-1106592101
ALex17
2005-01-24 21:41
2005.02.06
Как добавить фаил EXCEL в масив?


14-1106102595
Думкин
2005-01-19 05:43
2005.02.06
С Днем Рождения! 19 января