AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Inject my Dll from a Service

Ein Thema von randy_dom · begonnen am 30. Apr 2012 · letzter Beitrag vom 1. Mai 2012
Antwort Antwort
randy_dom

Registriert seit: 28. Apr 2008
17 Beiträge
 
#1

Inject my Dll from a Service

  Alt 30. Apr 2012, 19:20
Hi ,i've these Functions declared in my Dll , i'm focusing on
StartHook and StopHook , if i use them in a standalone Application all goes well .
But the problem is when using them in a Service i don't get any result there's no Hook .

Delphi-Quellcode:
function HookProc(code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  Result := CallNextHookEx(Code, code, wParam, lParam)
end;
procedure StartHook; stdcall;
begin
  HookHandle := SetWindowsHookEx(WH_GETMESSAGE, HookProc, hInstance, 0);
end;

procedure StopHook; stdcall;
begin
  UnhookWindowsHookEx(HookHandle);
end;
The issue is only with Vista and up .
  Mit Zitat antworten Zitat
Benutzerbild von sx2008
sx2008

Registriert seit: 15. Feb 2008
Ort: Baden-Württemberg
2.332 Beiträge
 
Delphi 2007 Professional
 
#2

AW: Inject my Dll from a Service

  Alt 30. Apr 2012, 20:21
You should allow the service to interact with your desktop.
Starting with Vista services by default are not allowed to interact with the desktop or any window on the desktop.

http://lostechies.com/keithdahlby/20...t-localsystem/
  Mit Zitat antworten Zitat
randy_dom

Registriert seit: 28. Apr 2008
17 Beiträge
 
#3

AW: Inject my Dll from a Service

  Alt 30. Apr 2012, 21:50
You should allow the service to interact with your desktop.
Starting with Vista services by default are not allowed to interact with the desktop or any window on the desktop.
Thank you sx2008 , is there any Fixes or suggestions to this please ?
  Mit Zitat antworten Zitat
Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#4

AW: Inject my Dll from a Service

  Alt 30. Apr 2012, 23:38
Interactive services are not longer allowed. If you only want to inject your dll, you should loop through all processes and use WriteProcessMemory() and CreateRemoteThread() to call LoadLibrary() in the remote context.

As an alternative way, you could use the AppInit_DLLs registry value.
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat
randy_dom

Registriert seit: 28. Apr 2008
17 Beiträge
 
#5

AW: Inject my Dll from a Service

  Alt 30. Apr 2012, 23:59
thank you Zacherl , The problem is that i'm using PIP commutation between the service and another App, so the App will ask the service to HOOK/UNHOOK (a) target Process(s).

So please is there any fix to this or even another alternative .

thank you
  Mit Zitat antworten Zitat
Benutzerbild von Assarbad
Assarbad

Registriert seit: 8. Okt 2010
Ort: Frankfurt am Main
1.234 Beiträge
 
#6

AW: Inject my Dll from a Service

  Alt 1. Mai 2012, 04:39
thank you Zacherl , The problem is that i'm using PIP commutation between the service and another App, so the App will ask the service to HOOK/UNHOOK (a) target Process(s).

So please is there any fix to this or even another alternative .
Zacherl already gave you the only method that would work with active session 0 separation. Otherwise you'd always need some agent running in the same session (strictly speaking on the desktop) inside which the process to be hooked resides.
Oliver
"... aber vertrauen Sie uns, die Physik stimmt." (Prof. Harald Lesch)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:55 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz