![]() |
madCodeHook: UninjectLibrary verursacht Neustart
moin allerseits!
Ich verwende die madCodeHook Unit (madshi) für ein kleines Projekt, das "Shell_NotifyIcon" systemweit hooken soll. Prozessweit klappt alles reibungslos. Das Hooken funktioniert zwar auch systemweit, aber sobald ich UninjectLibrary aufrufe, wird mein PC ohne Vorwarnung neugestartet, d.h. Bildschirm wird schwarz und zack isser wieder am booten. DLL:
Delphi-Quellcode:
MainAPP:
library DBXHookDLL;
uses Windows,SysUtils, Classes, ShellApi, madRemote, madCodeHook, madStrings, Dialogs; var Shell_NotifyIconNext : function (dwMessage: DWord; lpdata: PNOTIFYICONDATA): Boolean; stdcall; const {$EXTERNALSYM NIM_SETFOCUS} NIM_SETFOCUS = $00000003; {$EXTERNALSYM NIM_SETVERSION} NIM_SETVERSION = $00000004; function Shell_NotifyIconCallback(dwMessage: DWord; lpdata: PNOTIFYICONDATA): Boolean; stdcall; var MyLog: TStringList; begin try MyLog:=TStringList.Create(); if dwMessage = NIM_ADD then MyLog.Add('NIM_ADD'); if dwMessage = NIM_DELETE then MyLog.Add('NIM_DELETE'); if dwMessage = NIM_MODIFY then MyLog.Add('NIM_MODIFY'); if dwMessage = NIM_SETFOCUS then MyLog.Add('NIM_SETFOCUS'); if dwMessage = NIM_SETVERSION then MyLog.Add('NIM_SETVERSION'); MyLog.SaveToFile('C:\DBXHookDLLLog.txt'); //Die Datei wird erstellt und es steht //je nach Aktion dann auch NIM_ADD usw. drin MyLog.Destroy(); except on E: Exception do begin end; //Was auch immer für Exceptions //auftreten - ich will keine sehen :-) (Habs auch ohne getestet: //bringt mich nicht weiter...) end; result := Shell_NotifyIconNext(dwMessage,lpdata); end; begin HookAPI('shell32.dll', 'Shell_NotifyIcon', @Shell_NotifyIconCallback, @Shell_NotifyIconNext); end.
Delphi-Quellcode:
Was mach ich falsch?
unit uMain;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, madCodeHook; type TForm1 = class(TForm) Button3: TButton; procedure Button3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button3Click(Sender: TObject); begin InjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES, 'DBXHookDll.dll'); MessageBox(0, 'Active...', 'Hook is active...', MB_ICONINFORMATION); UninjectLibrary(ALL_SESSIONS or SYSTEM_PROCESSES, 'DBXHookDll.dll'); //shutdown end; end. Ist mein zweiter Versuch mit Code Hooking, also seid nachsichtig mit mir :-) Danke im voraus :-) |
Re: madCodeHook: UninjectLibrary verursacht Neustart
also soweit ich weiß, sollte man grundsätzlich kein vcl inner hook dll verwenden, des weiteren glaube ich fragst du am besten mal bei madshi im forum nach, der antwortet eigentlich relativ schnell immer.
|
Re: madCodeHook: UninjectLibrary verursacht Neustart
Oh, hab das Forum ganz übersehen ^^ Vielleicht werd ich da fündig. Danke :-)
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz