AGB  ·  Datenschutz  ·  Impressum  







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

How unhook LdrLoadDll function?

Ein Thema von flashcoder · begonnen am 16. Dez 2017 · letzter Beitrag vom 17. Dez 2017
Antwort Antwort
Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.419 Beiträge
 
Delphi 12 Athens
 
#1

AW: How unhook LdrLoadDll function?

  Alt 16. Dez 2017, 23:21
HOOK overwrites a few bytes, so what do you have to do to undo?

Save old content and write back.
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#2

AW: How unhook LdrLoadDll function?

  Alt 16. Dez 2017, 23:35
HOOK overwrites a few bytes, so what do you have to do to undo?

Save old content and write back.
How?

could be:

Code:
Unhook(@NewLdrLoadDll, GetProcAddress(GetModuleHandle('ntdll.dll'), 'LdrLoadDll'));
?
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.419 Beiträge
 
Delphi 12 Athens
 
#3

AW: How unhook LdrLoadDll function?

  Alt 16. Dez 2017, 23:59
Zitat:
pbyte(target)^ := $E9;
Assignments can also be read out.
variable := pbyte(target)^;
Ein Therapeut entspricht 1024 Gigapeut.
  Mit Zitat antworten Zitat
flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#4

AW: How unhook LdrLoadDll function?

  Alt 17. Dez 2017, 00:14
Zitat:
pbyte(target)^ := $E9;
Assignments can also be read out.
variable := pbyte(target)^;

Like this:

Code:
procedure Unhook(hookedfunc, oldfunc: pointer);
var
  jmpto: DWORD;
  OldProtect: Cardinal;
begin
  jmpto := DWORD(oldfunc) - DWORD(hookedfunc) - 5;
  VirtualProtect(hookedfunc, 5, PAGE_EXECUTE_READWRITE, @OldProtect);
  hookedfunc := pbyte(oldfunc)^;
  pdword(DWORD(hookedfunc) + 1)^ := jmpto;
end;
Usage:

Code:
Unhook(@NewLdrLoadDll, GetProcAddress(GetModuleHandle('ntdll.dll'), 'LdrLoadDll'));
right?

Geändert von flashcoder (17. Dez 2017 um 02:17 Uhr)
  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 17:46 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