|
[ de_c0der @ 27.01.2007. 16:02 ] @
| Za pocetak zelim samo proslijedit pozive koji dolaze mom DLL-u MSgina.dll-u i to sam napravio al kad se winlogon starta prilikom boota javlja:
The logon user interface DLL c:\putanja do dlla\gina.dll failed to load!
I to je to.. natrag na restart, evo koda:
Code:
library Project1;
uses
SysUtils,
Classes, Windows;
type HANDLE=THandle;
LONG=LongInt;
LUID = record
LowPart: DWORD;
HighPart: LONG;
end;
PLuid = ^LUID;
PWSTR = PWideChar;
WLX_MPR_NOTIFY_INFO = record
pszUserName, pszDomain, pszPassword,
pszOldPassword:PWSTR;
end;
const gina='Msgina.dll';
function GWlxNegotiate(dwWinlogonVersion: DWORD; out dwDllVersion: DWORD): BOOL; stdcall; external gina name 'WlxNegotiate'
function GWlxInitialize(lpWinsta: LPWSTR; hWlx: HANDLE; pvReserved: pointer; pWinlogonFunctions: pointer; out WlxContext: pointer): BOOL; stdcall; external gina name'WlxInitialize';
procedure GWlxDisplaySASNotice(pWlxContext: pointer); stdcall; external gina name 'WlxDisplaySASNotice';
function GWlxLoggedOutSAS(pWlxContext: pointer; dwSasType: DWORD; pAuthenticationId: PLUID; pLogonSid: PSID; var pdwOptions: DWORD; var phToken: HANDLE; var pNprNotifyInfo: WlX_MPR_NOTIFY_INFO; out pProfile: pointer): integer; stdcall; external gina name 'WlxLoggedOutSAS';
function GWlxActivateUserShell(pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall; external gina name 'WlxActivateUserShell';
function GWlxLoggedOnSAS(pWlxContext: pointer; dwSasType: DWORD; pReserved: pointer): integer; stdcall; external gina name 'WlxLoggedOnSAS';
procedure GWlxDisplayLockedNotice(pWlxContext: pointer); stdcall; external gina name 'WlxDisplayLockedNotice';
function GWlxWkstaLockedSAS(pWlxContext: pointer; dwSasType: DWORD): integer; stdcall; external gina name'WlxWkstaLockedSAS';
function GWlxIsLockOk(pWlxContext: pointer): BOOL; stdcall; external gina name 'WlxIsLockOk';
function GWlxIsLogoffOk(pWlxContext: pointer): BOOL; stdcall; external gina name 'WlxIsLogoffOk';
procedure GWlxLogoff(pWlxContext: pointer); stdcall; external gina name'WlxLogoff';
procedure GWlxShutdown(pWlxContext: pointer; ShutdownType: DWORD); stdcall; external gina name 'WlxShutdown';
function GWlxScreenSaverNotify(pWlxContext: pointer; var pSecure: BOOL): BOOL; stdcall; external gina name'WlxScreenSaverNotify';
function GWlxStartApplication(pWlxContext: pointer; pszDesktopName: PWideChar; pEnvironment: pointer; pszCmdLine: PWideChar): BOOL; stdcall; external gina name'WlxStartApplication';
function GWlxNetworkProviderLoad(pWlxContext: pointer; var pNprNotifyInfo: WLX_MPR_NOTIFY_INFO): BOOL; stdcall; external gina name'WlxNetworkProviderLoad';
function GWlxDisplayStatusMessage(pWlxContext: pointer; hDesktop: HDESK; dwOptions: DWORD; pTitle: PWideChar; pMessage: PWideChar): BOOL; stdcall; external gina name 'WlxDisplayStatusMessage';
function GWlxGetStatusMessage(pWlxContext: pointer; var pdwOptions: DWORD; pMessage: PWideChar; dwBufferSize: DWORD): BOOL; stdcall; external gina name'WlxGetStatusMessage';
function GWlxRemoveStatusMessage(pWlxContext: pointer): BOOL; stdcall; external gina name 'RemoveStatusMessage';
function GWlxGetConsoleSwitchCredentials(pWlxContext: pointer; pCredInfo: pointer): BOOL; stdcall; external gina name 'WlxGetConsoleSwitchCredentials';
procedure GWlxReconnectNotify(pWlxContext: pointer); stdcall; external gina name 'WlxReconnectNotify';
procedure GWlxDisconnectNotify(pWlxContext: pointer); stdcall; external gina name 'WlxDisconnectNotify';
//Definicija mojih fja
function WlxNegotiate(dwWinlogonVersion: DWORD; out dwDllVersion: DWORD): BOOL; stdcall;
begin
Result:=GWlxNegotiate(dwWinlogonVersion,dwDllVersion);
end;
function WlxInitialize(lpWinsta: LPWSTR; hWlx: HANDLE; pvReserved: pointer; pWinlogonFunctions: pointer; out WlxContext: pointer): BOOL; stdcall;
begin
Result:=GWlxInitialize(lpWinsta,hWlx,pvReserved,pWinlogonFunctions,WlxContext);
end;
procedure WlxDisplaySASNotice(pWlxContext: pointer); stdcall;
begin
GWlxDisplaySASNotice(pWlxContext);
end;
function WlxLoggedOutSAS(pWlxContext: pointer; dwSasType: DWORD; pAuthenticationId: PLUID; pLogonSid: PSID; var pdwOptions: DWORD; var phToken: HANDLE; var pNprNotifyInfo: WlX_MPR_NOTIFY_INFO; out pProfile: pointer): integer; stdcall;
begin
Result:=GWlxLoggedOutSAS(pWlxContext,dwSasType,pAuthenticationId,pLogonSid,pdwOptions,phToken,pNprNotifyInfo,pProfile);
end;
function WlxActivateUserShell(pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall;
begin
Result:=GWlxActivateUserShell(pWlxContext,pszDesktopName,pszMprLogonScript,pEnvironment);
end;
function WlxLoggedOnSAS(pWlxContext: pointer; dwSasType: DWORD; pReserved: pointer): integer; stdcall;
begin
Result:=GWlxLoggedOnSAS(pWlxContext,dwSasType,pReserved);
end;
procedure WlxDisplayLockedNotice(pWlxContext: pointer); stdcall;
begin
GWlxDisplayLockedNotice(pWlxContext);
end;
function WlxWkstaLockedSAS(pWlxContext: pointer; dwSasType: DWORD): integer; stdcall;
begin
Result:=GWlxWkstaLockedSAS(pWlxContext,dwSasType);
end;
function WlxIsLockOk(pWlxContext: pointer): BOOL; stdcall;
begin
Result:=GWlxIsLockOk(pWlxContext);
end;
function WlxIsLogoffOk(pWlxContext: pointer): BOOL; stdcall;
begin
Result:=GWlxIsLogoffOk(pWlxContext);
end;
procedure WlxLogoff(pWlxContext: pointer); stdcall;
begin
GWlxLogoff(pWlxContext);
end;
procedure WlxShutdown(pWlxContext: pointer; ShutdownType: DWORD); stdcall;
begin
GWlxShutdown(pWlxContext,ShutdownType);
end;
function WlxScreenSaverNotify(pWlxContext: pointer; var pSecure: BOOL): BOOL; stdcall;
begin
Result:=GWlxScreenSaverNotify(pWlxContext,pSecure);
end;
function WlxStartApplication(pWlxContext: pointer; pszDesktopName: PWideChar; pEnvironment: pointer; pszCmdLine: PWideChar): BOOL; stdcall;
begin
Result:=GWlxStartApplication(pWlxContext,pszDesktopName,pEnvironment,pszCmdLine);
end;
function WlxNetworkProviderLoad(pWlxContext: pointer; var pNprNotifyInfo: WLX_MPR_NOTIFY_INFO): BOOL;stdcall;
begin
Result:=GWlxNetworkProviderLoad(pWlxContext,pNprNotifyInfo);
end;
function WlxDisplayStatusMessage(pWlxContext: pointer; hDesktop: HDESK; dwOptions: DWORD; pTitle: PWideChar; pMessage: PWideChar): BOOL; stdcall;
begin
Result:=GWlxDisplayStatusMessage(pWlxContext,hDesktop,dwOptions,pTitle,pMessage);
end;
function WlxGetStatusMessage(pWlxContext: pointer; var pdwOptions: DWORD; pMessage: PWideChar; dwBufferSize: DWORD): BOOL; stdcall;
begin
Result:=GWlxGetStatusMessage(pWlxContext,pdwOptions,pMessage,dwBufferSize);
end;
function WlxRemoveStatusMessage(pWlxContext: pointer): BOOL;stdcall;
begin
Result:=GWlxRemoveStatusMessage(pWlxContext);
end;
function WlxGetConsoleSwitchCredentials(pWlxContext: pointer; pCredInfo: pointer): BOOL; stdcall;
begin
Result:=GWlxGetConsoleSwitchCredentials(pWlxContext,pCredInfo)
end;
procedure WlxReconnectNotify(pWlxContext: pointer); stdcall;
begin
GWlxReconnectNotify(pWlxContext);
end;
procedure WlxDisconnectNotify(pWlxContext: pointer); stdcall;
begin
GWlxDisconnectNotify(pWlxContext);
end;
exports
WlxNegotiate,
WlxInitialize,
WlxDisplaySASNotice,
WlxLoggedOutSAS,
WlxActivateUserShell,
WlxLoggedOnSAS,
WlxDisplayLockedNotice,
WlxWkstaLockedSAS,
WlxIsLockOk,
WlxIsLogoffOk,
WlxLogoff,
WlxShutdown,
WlxScreenSaverNotify,
WlxStartApplication,
WlxNetworkProviderLoad,
WlxDisplayStatusMessage,
WlxGetStatusMessage,
WlxRemoveStatusMessage,
WlxGetConsoleSwitchCredentials,
WlxReconnectNotify,
WlxDisconnectNotify;
begin
end.
|
[ savkic @ 27.01.2007. 16:12 ] @
> Za pocetak zelim samo proslijedit pozive koji dolaze mom DLL-u MSgina.dll-u i to sam napravio al kad se winlogon starta prilikom boota javlja:
U okviru Jedi projekta postoji primer GINA stuba, pogledaj.
[ de_c0der @ 27.01.2007. 19:37 ] @
Da, vidim..sad radi, al nisam siguran DAL bas MORA taj .dll bit DINAMICKI koristen il moze i staticki kao iz mog gornjeg primjera.. i jos me nesto nervira, a to je sto se tada jos drajveri ne inicijaliziraju pa svaki messagebox i sl sranja su old-windows style, kako to promijenit?
Opcenito da vidim da nema gotovo nikakve dokumentacije o pravljenju gine, osim 2 stranica sa MSDN magazina... evo prepravljenja verzija (koja radi) ako ce kom trebat:
Code:
library Project1;
uses
SysUtils,
Classes, Windows, WinWlx;
type HANDLE=THandle;
LONG=LongInt;
LUID = record
LowPart: DWORD;
HighPart: LONG;
end;
PLuid = ^LUID;
PWSTR = PWideChar;
WLX_MPR_NOTIFY_INFO = record
pszUserName, pszDomain, pszPassword,
pszOldPassword:PWSTR;
end;
const REALGINA_PATH = 'MSGINA.DLL';
GINASTUB_VERSION = WLX_VERSION_1_3;
var
pfWlxNegotiate: TFNWlxNegotiate;
pfWlxInitialize: TFNWlxInitialize;
pfWlxDisplaySASNotice: TFNWlxDisplaySASNotice;
pfWlxLoggedOutSAS: TFNWlxLoggedOutSAS;
pfWlxActivateUserShell: TFNWlxActivateUserShell;
pfWlxLoggedOnSAS: TFNWlxLoggedOnSAS;
pfWlxDisplayLockedNotice: TFNWlxDisplayLockedNotice;
pfWlxWkstaLockedSAS: TFNWlxWkstaLockedSAS;
pfWlxIsLockOk: TFNWlxIsLockOk;
pfWlxIsLogoffOk: TFNWlxIsLogoffOk;
pfWlxLogoff: TFNWlxLogoff;
pfWlxShutdown: TFNWlxShutdown;
pfWlxStartApplication: TFNWlxStartApplication = nil;
pfWlxScreenSaverNotify: TFNWlxScreenSaverNotify = nil;
pfWlxNetworkProviderLoad: TFNWlxNetworkProviderLoad = nil;
pfWlxDisplayStatusMessage: TFNWlxDisplayStatusMessage = nil;
pfWlxGetStatusMessage: TFNWlxGetStatusMessage = nil;
pfWlxRemoveStatusMessage: TFNWlxRemoveStatusMessage = nil;
function MyInitialize (hDll: HMODULE; dwWlxVersion: DWORD): Boolean;
begin
Result := False;
pfWlxInitialize :=
GetProcAddress(hDll, 'WlxInitialize');
pfWlxDisplaySASNotice :=
GetProcAddress(hDll, 'WlxDisplaySASNotice');
pfWlxLoggedOutSAS :=
GetProcAddress(hDll, 'WlxLoggedOutSAS');
pfWlxActivateUserShell :=
GetProcAddress(hDll, 'WlxActivateUserShell');
pfWlxLoggedOnSAS :=
GetProcAddress(hDll, 'WlxLoggedOnSAS');
pfWlxDisplayLockedNotice :=
GetProcAddress(hDll, 'WlxDisplayLockedNotice');
pfWlxIsLockOk :=
GetProcAddress(hDll, 'WlxIsLockOk');
pfWlxWkstaLockedSAS :=
GetProcAddress(hDll, 'WlxWkstaLockedSAS');
pfWlxIsLogoffOk :=
GetProcAddress(hDll, 'WlxIsLogoffOk');
pfWlxLogoff :=
GetProcAddress(hDll, 'WlxLogoff');
pfWlxShutdown :=
GetProcAddress(hDll, 'WlxShutdown');
if Assigned(pfWlxInitialize) and
Assigned(pfWlxDisplaySASNotice) and
Assigned(pfWlxLoggedOutSAS) and
Assigned(pfWlxActivateUserShell) and
Assigned(pfWlxLoggedOnSAS) and
Assigned(pfWlxDisplayLockedNotice) and
Assigned(pfWlxIsLockOk) and
Assigned(pfWlxWkstaLockedSAS) and
Assigned(pfWlxIsLogoffOk) and
Assigned(pfWlxLogoff) and
Assigned(pfWlxShutdown) then
begin
Result := True;
{ Load functions for version 1.1 as necessary. }
if (dwWlxVersion >= WLX_VERSION_1_1) then
begin
pfWlxStartApplication := GetProcAddress(hDll, 'WlxStartApplication');
pfWlxScreenSaverNotify := GetProcAddress(hDll, 'WlxScreenSaverNotify');
Result := Assigned(pfWlxStartApplication) and
Assigned(pfWlxScreenSaverNotify);
end;
{ Load functions for version 1.3 as necessary. }
if Result and (dwWlxVersion >= WLX_VERSION_1_3) then
begin
pfWlxNetworkProviderLoad :=
GetProcAddress(hDll, 'WlxNetworkProviderLoad');
pfWlxDisplayStatusMessage :=
GetProcAddress(hDll, 'WlxDisplayStatusMessage');
pfWlxGetStatusMessage :=
GetProcAddress(hDll, 'WlxGetStatusMessage');
pfWlxRemoveStatusMessage :=
GetProcAddress(hDll, 'WlxRemoveStatusMessage');
Result := Assigned(pfWlxNetworkProviderLoad) and
Assigned(pfWlxDisplayStatusMessage) and
Assigned(pfWlxGetStatusMessage) and
Assigned(pfWlxRemoveStatusMessage);
end;
{ Load functions for newer version here... }
end;
end;
//Definicija mojih fja
function WlxNegotiate(dwWinlogonVersion: DWORD; out pdwDllVersion: DWORD): BOOL; stdcall;
var hDll: HMODULE;
dwWlxVersion: DWORD;
begin
MessageBox(0,'Negotiate poruka je pozvana','Info',0);
Result := False;
dwWlxVersion := GINASTUB_VERSION;
{ Load MSGINA.DLL. }
hDll := LoadLibrary(REALGINA_PATH);
if hDll <> 0 then
begin
{ Get pointers to WlxNegotiate function in the real MSGINA. }
pfWlxNegotiate := GetProcAddress(hDll, 'WlxNegotiate');
if Assigned(pfWlxNegotiate) then
begin
{ Handle older version of Winlogon. }
if (dwWinlogonVersion < dwWlxVersion) then
begin
dwWlxVersion := dwWinlogonVersion;
end;
{ Negotiate with MSGINA for version that we can support. }
if pfWlxNegotiate(dwWlxVersion, @dwWlxVersion) then
begin
{ Load the rest of the WLX functions from the real MSGINA. }
if MyInitialize(hDll, dwWlxVersion) then
begin
{ Inform Winlogon which version to use. }
pdwDllVersion := dwWlxVersion;
Result := True;
end;
end;
end;
end;
end;
function WlxInitialize(lpWinsta: LPWSTR; hWlx: HANDLE; pvReserved: pointer; pWinlogonFunctions: pointer; out WlxContext: pointer): BOOL; stdcall;
begin
MessageBox(0,'Evo ga :)','Pozdrav',0);
Result:=pfWlxInitialize(lpWinsta,hWlx,pvReserved,pWinlogonFunctions,WlxContext);
end;
procedure WlxDisplaySASNotice(pWlxContext: pointer); stdcall;
begin
pfWlxDisplaySASNotice(pWlxContext);
end;
function WlxLoggedOutSAS(pWlxContext: Pointer; dwSasType: DWORD;
pAuthenticationId: PLargeInteger; pLogonSid: PSID; pdwOptions: PDWORD;
phToken: PHandle; pMprNotifyInfo: PWlxMprNotifyInfo; out pProfile: Pointer
): Integer; stdcall;
begin
Result:=pfWlxLoggedOutSAS(pWlxContext,dwSasType,pAuthenticationId,pLogonSid,pdwOptions,phToken,pMprNotifyInfo,pProfile);
end;
function WlxActivateUserShell(pWlxContext: pointer; pszDesktopName: PWideChar; pszMprLogonScript: PWideChar; pEnvironment: pointer): BOOL; stdcall;
begin
Result:=pfWlxActivateUserShell(pWlxContext,pszDesktopName,pszMprLogonScript,pEnvironment);
end;
function WlxLoggedOnSAS(pWlxContext: pointer; dwSasType: DWORD; pReserved: pointer): integer; stdcall;
begin
Result:=pfWlxLoggedOnSAS(pWlxContext,dwSasType,pReserved);
end;
procedure WlxDisplayLockedNotice(pWlxContext: pointer); stdcall;
begin
pfWlxDisplayLockedNotice(pWlxContext);
end;
function WlxWkstaLockedSAS(pWlxContext: pointer; dwSasType: DWORD): integer; stdcall;
begin
Result:=pfWlxWkstaLockedSAS(pWlxContext,dwSasType);
end;
function WlxIsLockOk(pWlxContext: pointer): BOOL; stdcall;
begin
Result:=pfWlxIsLockOk(pWlxContext);
end;
function WlxIsLogoffOk(pWlxContext: pointer): BOOL; stdcall;
begin
Result:=pfWlxIsLogoffOk(pWlxContext);
end;
procedure WlxLogoff(pWlxContext: pointer); stdcall;
begin
pfWlxLogoff(pWlxContext);
end;
procedure WlxShutdown(pWlxContext: pointer; ShutdownType: DWORD); stdcall;
begin
pfWlxShutdown(pWlxContext,ShutdownType);
end;
function WlxScreenSaverNotify(pWlxContext: pointer; var pSecure: BOOL): BOOL; stdcall;
begin
Result:=pfWlxScreenSaverNotify(pWlxContext,pSecure);
end;
function WlxStartApplication(pWlxContext: pointer; pszDesktopName: PWideChar; pEnvironment: pointer; pszCmdLine: PWideChar): BOOL; stdcall;
begin
Result:=pfWlxStartApplication(pWlxContext,pszDesktopName,pEnvironment,pszCmdLine);
end;
function WlxNetworkProviderLoad(pWlxContext: Pointer;
pNprNotifyInfo: PWlxMprNotifyInfo): BOOL; stdcall;
begin
Result := pfWlxNetworkProviderLoad(pWlxContext, pNprNotifyInfo);
end;
function WlxDisplayStatusMessage(pWlxContext: pointer; hDesktop: HDESK; dwOptions: DWORD; pTitle: PWideChar; pMessage: PWideChar): BOOL; stdcall;
begin
Result:=pfWlxDisplayStatusMessage(pWlxContext,hDesktop,dwOptions,pTitle,pMessage);
end;
function WlxGetStatusMessage(pWlxContext: pointer; var pdwOptions: DWORD; pMessage: PWideChar; dwBufferSize: DWORD): BOOL; stdcall;
begin
Result:=pfWlxGetStatusMessage(pWlxContext,pdwOptions,pMessage,dwBufferSize);
end;
function WlxRemoveStatusMessage(pWlxContext: pointer): BOOL;stdcall;
begin
Result:=pfWlxRemoveStatusMessage(pWlxContext);
end;
exports
WlxNegotiate,
WlxInitialize,
WlxDisplaySASNotice,
WlxLoggedOutSAS,
WlxActivateUserShell,
WlxLoggedOnSAS,
WlxDisplayLockedNotice,
WlxWkstaLockedSAS,
WlxIsLockOk,
WlxIsLogoffOk,
WlxLogoff,
WlxShutdown,
WlxScreenSaverNotify,
WlxStartApplication,
WlxNetworkProviderLoad,
WlxDisplayStatusMessage,
WlxGetStatusMessage,
WlxRemoveStatusMessage;
begin
end.
E sad, ovo je lako bilo, al kako da od nule sam ju iskucam i da bude funkcionalna.. HMMMMMMMMM, dal ima tko kakvu dokumentaciju??
poz i thx
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.
|