-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
86 changed files
with
7,629 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pragma once | ||
|
||
int Dispatch_NTDLL_Start(void); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#include <windows.h> | ||
#include <ntsecapi.h> | ||
|
||
#include "./Dispatch_NTDLL_LdrLoadDll.h" | ||
#include "../Common/DebugLog.h" | ||
#include "./HookHelp.h" | ||
|
||
|
||
|
||
// | ||
//Global | ||
// | ||
__pfnLdrLoadDll pfnLdrLoadDll = NULL; | ||
|
||
|
||
|
||
// | ||
//Dispatch_NTDLL_LdrLoadDll Functions | ||
// | ||
NTSTATUS | ||
NTAPI | ||
OnLdrLoadDll( | ||
IN PWCHAR PathToFile OPTIONAL, | ||
IN ULONG Flags OPTIONAL, | ||
IN PUNICODE_STRING ModuleFileName, | ||
OUT PHANDLE ModuleHandle ) | ||
{ | ||
NTSTATUS nRet; | ||
|
||
DWORD dwRetAddr = 0; | ||
__asm | ||
{ | ||
mov eax, [ebp+4]; | ||
sub eax, 5; | ||
mov dwRetAddr, eax; | ||
} | ||
if( IsBypassCaller(dwRetAddr) ) | ||
{ | ||
nRet = pfnLdrLoadDll( | ||
PathToFile, | ||
Flags, | ||
ModuleFileName, | ||
ModuleHandle | ||
); | ||
} | ||
|
||
nRet = pfnLdrLoadDll( | ||
PathToFile, | ||
Flags, | ||
ModuleFileName, | ||
ModuleHandle | ||
); | ||
|
||
// __try | ||
// { | ||
//#ifdef Dbg | ||
// WCHAR szDebugString[512] = {0}; | ||
// wsprintf( | ||
// szDebugString, | ||
// L"PathToFile=[%s]\r\nBuffer of ModuleFileName=[%s]", | ||
// PathToFile, | ||
// ModuleFileName->Buffer); | ||
// DebugLog(DbgInfo,szDebugString); | ||
//#endif | ||
// | ||
//#ifdef Dbg | ||
// DebugLog(DbgInfo,L"Called"); | ||
//#endif | ||
// } | ||
// __except(EXCEPTION_EXECUTE_HANDLER) | ||
// { | ||
// } | ||
|
||
return nRet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
typedef NTSTATUS (NTAPI * __pfnLdrLoadDll) | ||
( | ||
IN PWCHAR PathToFile OPTIONAL, | ||
IN ULONG Flags OPTIONAL, | ||
IN PUNICODE_STRING ModuleFileName, | ||
OUT PHANDLE ModuleHandle ); | ||
|
||
extern __pfnLdrLoadDll pfnLdrLoadDll; | ||
|
||
NTSTATUS | ||
NTAPI | ||
OnLdrLoadDll( | ||
IN PWCHAR PathToFile OPTIONAL, | ||
IN ULONG Flags OPTIONAL, | ||
IN PUNICODE_STRING ModuleFileName, | ||
OUT PHANDLE ModuleHandle ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <windows.h> | ||
#include <ntsecapi.h> | ||
|
||
#include "./Dispatch_NTDLL_LdrUnloadDll.h" | ||
#include "../Common/DebugLog.h" | ||
#include "./HookHelp.h" | ||
|
||
|
||
|
||
// | ||
//Global | ||
// | ||
__pfnLdrUnloadDll pfnLdrUnloadDll = NULL; | ||
|
||
|
||
|
||
// | ||
//Dispatch_NTDLL_LdrUnloadDll Functions | ||
// | ||
NTSTATUS | ||
NTAPI | ||
OnLdrUnloadDll( | ||
IN HANDLE ModuleHandle ) | ||
{ | ||
NTSTATUS nRet; | ||
|
||
DWORD dwRetAddr = 0; | ||
__asm | ||
{ | ||
mov eax, [ebp+4]; | ||
sub eax, 5; | ||
mov dwRetAddr, eax; | ||
} | ||
if( IsBypassCaller(dwRetAddr) ) | ||
{ | ||
nRet = pfnLdrUnloadDll( | ||
ModuleHandle | ||
); | ||
|
||
return nRet; | ||
} | ||
|
||
nRet = pfnLdrUnloadDll( | ||
ModuleHandle | ||
); | ||
|
||
//#ifdef Dbg | ||
// DebugLog(DbgInfo,L"Called"); | ||
//#endif | ||
|
||
return nRet; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#pragma once | ||
|
||
typedef NTSTATUS (NTAPI * __pfnLdrUnloadDll) | ||
( IN HANDLE ModuleHandle ); | ||
|
||
extern __pfnLdrUnloadDll pfnLdrUnloadDll; | ||
|
||
NTSTATUS | ||
NTAPI | ||
OnLdrUnloadDll( | ||
IN HANDLE ModuleHandle ); |
Oops, something went wrong.