Skip to content

Commit d8f3220

Browse files
committed
updated readme/exmaple header
1 parent dd64958 commit d8f3220

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

Injection.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ enum class LAUNCH_METHOD
5858
LM_NtCreateThreadEx,
5959
LM_HijackThread,
6060
LM_SetWindowsHookEx,
61-
LM_QueueUserAPC
61+
LM_QueueUserAPC,
62+
LM_KernelCallback
6263
};
6364

6465
//ansi version of the info structure:
@@ -129,13 +130,15 @@ struct HookInfo
129130
//Manual mapping options:
130131
#define INJ_MM_CLEAN_DATA_DIR 0x00010000 //removes data from the dlls PE header, ignored if INJ_MM_SET_PAGE_PROTECTIONS is set
131132
#define INJ_MM_RESOLVE_IMPORTS 0x00020000 //resolves dll imports
132-
#define INJ_MM_RESOLVE_DELAY_IMPORTS 0x00040000 //resolves delayed imports
133-
#define INJ_MM_EXECUTE_TLS 0x00080000 //executes TLS callbacks and initializes static TLS data
133+
#define INJ_MM_RESOLVE_DELAY_IMPORTS 0x00040000 //resolves delayed imports
134+
#define INJ_MM_EXECUTE_TLS 0x00080000 //executes TLS callbacks and initializes static TLS data
134135
#define INJ_MM_ENABLE_EXCEPTIONS 0x00100000 //enables exception handling
135136
#define INJ_MM_SET_PAGE_PROTECTIONS 0x00200000 //sets page protections based on section characteristics, if set INJ_MM_CLEAN_DATA_DIR will be ignored
136137
#define INJ_MM_INIT_SECURITY_COOKIE 0x00400000 //initializes security cookie for buffer overrun protection
137-
#define INJ_MM_RUN_DLL_MAIN 0x00800000 //executes DllMain
138-
//this option induces INJ_MM_RESOLVE_IMPORTS
138+
#define INJ_MM_RUN_DLL_MAIN 0x00800000 //executes DllMain
139+
//this option induces INJ_MM_RESOLVE_IMPORTS
140+
#define INJ_MM_RUN_UNDER_LDR_LOCK 0x01000000 //runs the DllMain under the loader lock
141+
#define INJ_MM_SHIFT_MODULE_BASE 0x02000000 //shifts the module base by a random offset
139142

140143
#define MM_DEFAULT (INJ_MM_RESOLVE_IMPORTS | INJ_MM_RESOLVE_DELAY_IMPORTS | INJ_MM_INIT_SECURITY_COOKIE | INJ_MM_EXECUTE_TLS | INJ_MM_ENABLE_EXCEPTIONS | INJ_MM_RUN_DLL_MAIN | INJ_MM_SET_PAGE_PROTECTIONS)
141144

@@ -149,8 +152,11 @@ using f_GetVersionA = HRESULT(__stdcall *)(char * out, size_t cb_size);
149152
using f_GetVersionW = HRESULT(__stdcall *)(wchar_t * out, size_t cb_size);
150153

151154
using f_GetSymbolState = DWORD(__stdcall *)();
155+
using f_GetImportState = DWORD(__stdcall *)();
152156

153157
using f_GetDownloadProgress = float(__stdcall *)(bool bWoW64);
158+
using f_StartDownload = void(__stdcall *)();
159+
using f_InterruptDownload = void(__stdcall *)();
154160

155161
using f_raw_print_callback = void(__stdcall *)(const char * szText);
156162
using f_SetRawPrintCallback = DWORD(__stdcall *)(f_raw_print_callback callback);

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Session seperation can be bypassed with all methods.
2020
- Thread hijacking
2121
- SetWindowsHookEx
2222
- QueueUserAPC
23+
- KernelCallback
2324

2425
### Manual mapping features:
2526

@@ -30,6 +31,9 @@ Session seperation can be bypassed with all methods.
3031
- SEH support
3132
- TLS initialization
3233
- Security cookie initalization
34+
- Loader Lock
35+
- Shift image
36+
- Clean datadirectories
3337

3438
### Additional features:
3539

@@ -46,9 +50,9 @@ Session seperation can be bypassed with all methods.
4650

4751
You can easily use mapper by including the compiled binaries in your project. Check the provided Injection.h header for more information.
4852
Make sure you have the compiled binaries in the working directory of your program.
49-
On first run the injection module will download pdb files for the native (and when run on x64 the wow64) version of the ntdll.dll to resolve symbol addresses.
50-
The injector can only function if that process is finished. The injection module exports GetSymbolState which will return INJ_ERROR_SUCCESS (0) if the pdb download and resolving of all required addresses is completed.
51-
Additionally GetDownloadProgress can be used to determine the progress of the download as percentage.
53+
On first run the injection module has to download PDB files for the native (and when run on x64 the wow64) version of the ntdll.dll to resolve symbol addresses. Use the exported StartDownload function to begin the download.
54+
The injector can only function if the downloads are finished. The injection module exports GetSymbolState and GetImportState which will return INJ_ERROR_SUCCESS (0) if the PDB download and resolving of all required addresses is completed.
55+
Additionally GetDownloadProgress can be used to determine the progress of the download as percentage. If the injection module is to be unloaded during the download process call InterruptDownload or there's a chance that the dll will deadlock your process.
5256

5357
```cpp
5458

@@ -58,12 +62,21 @@ HINSTANCE hInjectionMod = LoadLibrary(GH_INJ_MOD_NAME);
5862

5963
auto InjectA = (f_InjectA)GetProcAddress(hInjectionMod, "InjectA");
6064
auto GetSymbolState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetSymbolState");
65+
auto GetImportState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetImportState");
66+
auto StartDownload = (f_StartDownload)GetProcAddress(hInjectionMod, "StartDownload");
67+
68+
StartDownload();
6169

6270
while (GetSymbolState() != 0)
6371
{
6472
Sleep(10);
6573
}
6674

75+
while (GetImportState() != 0)
76+
{
77+
Sleep(10);
78+
}
79+
6780
DWORD TargetProcessId;
6881

6982
INJECTIONDATAA data =

0 commit comments

Comments
 (0)