Thema: Delphi Winlogon, Welcome Screen

Einzelnen Beitrag anzeigen

Benutzerbild von stOrM
stOrM

Registriert seit: 7. Jun 2003
Ort: Mülheim an der Ruhr
434 Beiträge
 
Delphi 10.3 Rio
 
#8

Re: Winlogon, Welcome Screen

  Alt 13. Mai 2008, 22:05
Yo da bin ich nochmal, ich verzweifel langsam!

Vielleicht drehen wir das ganze nochmal ein wenig zurück, sofern noch interesse besteht, ich hänge mal am Schluß meines Fragekataloges den Quelltext der DLL mit rein...

Folgendes hat sich geändert, ich versuche jetzt nicht mehr direkt, auf den Winlogon zu zeichnen, dass klappt irgendwie mal überhaupt nicht, keine Ahnung wie Kaspersky das gemacht hat, aber ich vermute mal das der KAV Dienst dabei behilflich ist...

Ich verfolge da einen anderen Ansatz, nämlich den, den du (Dezipaitor) erwähnt hattest, ein Fenster transparent zu machen und so einen, pseudo gezeichneten Text auf den Winlogon erscheinen zu lassen.

Dafür hatte ich die Idee in meiner Winlogon Notification Package (was für ein Name!) über CreateProcess bei Logon / Logoff eine executeable aufzurufen, diese könnte dann das unsichtbare Fenster mit text usw enthalten...

Problem 1:
Ich bin jetzt mittlerweile soweit, das die exe aufgerufen wird bei jedem Logon / Logoff nur da gibt es ein extremes Problem...
Sie wird ausgeführt nachdem der User sich mittels Password authentifiziert hat, soll heissen, nach Eingabe des Passwords im Winlogon erscheint mein Fenster auf dem "normalen" User Desktop, was natürlich extrem dumm ist, sie sollte eigentlich im Winlogon ausgeführt werden... Ich vermute mal wenn ich dich richtig verstanden habe "Dezipaitor" dann liegt das daran, das meine exe keine Systemrechte hat????

Dann wäre da folgende Frage, gibt es die Möglichkeit in meiner DLL mittels CreateProcess einer exe diese Rechte zu geben, wenn ja währe ich extrem fröhlich, wenn man dafür ein Beispiel hätte...

Das Problen an der ganzen Sache ist, ich möchte keinen Dienst schreiben dafür, wobei dort ebenfalls das gleiche Problem wäre, CreateProcess mit Systemrecht...

Vielleicht schaust Du bitte nochmals über meine DLL eventuell weisst Du ja was falsch ist?
Ich glaube der CreateProcess Teil war sogar von dir??

Delphi-Quellcode:
library swxLogonNotify;

uses
  SysUtils,
  Classes,
  Windows,
  JwaWindows,
  JwsclStrings;

type
  TFnMsgeCallback = function (bVerbose: Boolean; lpMessage: PWideChar): Cardinal; stdcall;

TWlxNotificationInfo = record
    Size: Cardinal;
    Flags: Cardinal;
    UserName: PWideChar;
    Domain: PWideChar;
    WindowStation: PWideChar;
    Token: Cardinal;
    Desktop: Cardinal;
    StatusCallback: TFnMsgeCallback;
  end;
  PWlxNotificationInfo = ^TWlxNotificationInfo;

{$R *.res}

procedure StartApp(const App, Parameters, CurDir : TJwString);
var
  StartupInfo: {$IFDEF UNICODE}TStartupInfoW{$ELSE}TStartupInfoA{$ENDIF};
  ProcInfo : TProcessInformation;
  pEnv : Pointer;
  pCurDir,
  pCmdLine : TJwPChar;
begin

  ZeroMemory(@StartupInfo, sizeof(StartupInfo));
  StartupInfo.cb := SizeOf(StartupInfo);
  StartupInfo.lpDesktop := 'winsta0\default';
  CreateEnvironmentBlock(@pEnv, 0, true);
  try
    if Length(Parameters) > 0 then
      pCmdLine := TJwPChar('"'+App+'" ' + Parameters)
    else
      pCmdLine := TJwPChar('"'+App+'" ');
    pCurDir := Nil;
    if Length(CurDir) > 0 then
      pCurDir := TJwPChar(CurDir);
   if not

{$IFDEF UNICODE}CreateProcessW{$ELSE}CreateProcessA{$ENDIF}(

    TJwPChar(App),//__in_opt LPCTSTR lpApplicationName,
    pCmdLine, //__inout_opt LPTSTR lpCommandLine,
    nil,//__in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes,
    nil,//__in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes,
    true,//__in BOOL bInheritHandles,
    CREATE_NEW_CONSOLE or CREATE_UNICODE_ENVIRONMENT,//__in DWORD dwCreationFlags,
    pEnv,//__in_opt LPVOID lpEnvironment,
   pCurDir,//__in_opt LPCTSTR lpCurrentDirectory,
    StartupInfo,//__in LPSTARTUPINFO lpStartupInfo,
    ProcInfo,//__out LPPROCESS_INFORMATION lpProcessInformation
  ) then
   raiseLastOsError;

  finally
    DestroyEnvironmentBlock(pEnv);
  end;
  CloseHandle(ProcInfo.hProcess);
  CloseHandle(ProcInfo.hThread);
end;

procedure StartupHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure LogonHandler(Info: PWlxNotificationInfo); stdcall;
begin
  StartApp('c:\windows\system32\storm.exe', '', '');
end;

procedure StartShellHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure LockHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure UnLockHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure StartScreenSaverHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure StopScreenSaverHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure LogoffHandler(Info: PWlxNotificationInfo); stdcall;
begin
  StartApp('c:\windows\system32\storm.exe', '', '');
end;

procedure ShutdownHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure DisconnectHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure ReconnectHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;

procedure PostShellHandler(Info: PWlxNotificationInfo); stdcall;
begin

end;



//Nachfolgender Bereich verdunkelt mit das Hirn, brauch ich den unbedingt???

procedure EntryPointProc(reason: integer);
begin
  case reason of
    DLL_PROCESS_ATTACH: //1
      begin
        DisableThreadLibraryCalls(hInstance);
      end;
    DLL_THREAD_ATTACH: //2
      begin

      end;
    DLL_PROCESS_DETACH: //3
      begin

      end;
    DLL_THREAD_DETACH: //0
      begin

      end;
  end;

end;

exports
  StartupHandler,
  LogonHandler,
  StartShellHandler,
  LockHandler,
  UnLockHandler,
  StartScreenSaverHandler,
  StopScreenSaverHandler,
  LogoffHandler,
  ShutdownHandler,
  DisconnectHandler,
  ReconnectHandler,
  PostShellHandler;

begin
  DllProc := @EntryPointProc;
  DllProc(DLL_PROCESS_ATTACH);
end.
Vielen Dank!
Marc
  Mit Zitat antworten Zitat