Skip to content

Commit 2147112

Browse files
committed
updated information in Injection.h and ReadMe
1 parent acc342b commit 2147112

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

Injection.h

+15-8
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
//auto RestorenjectionFunctions = (f_RestoreInjectionFunctions)GetProcAddress(hInjectionMod, "RestorenjectionFunctions");
1313
//
1414
//Symbol state:
15-
//auto GetSymbolState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetSymbolState");
16-
//auto GetDownloadProgress = (f_GetDownloadProgress)GetProcAddress(hInjectionMod, "GetDownloadProgress");
15+
//auto GetSymbolState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetSymbolState");
16+
//auto GetImportState = (f_GetImportState)GetProcAddress(hInjectionMod, "GetImportState");
17+
//
18+
//Download progress:
19+
//auto GetDownloadProgressEx = (f_GetDownloadProgress)GetProcAddress(hInjectionMod, "GetDownloadProgressEx");
1720

1821
#pragma once
1922

20-
#define GH_INJ_VERSIONW L"4.0"
21-
#define GH_INJ_VERSIONA "4.0"
23+
#define GH_INJ_VERSIONW L"4.6"
24+
#define GH_INJ_VERSIONA "4.6"
2225

2326
#define GH_INJ_MOD_NAME64W L"GH Injector - x64.dll"
2427
#define GH_INJ_MOD_NAME86W L"GH Injector - x86.dll"
@@ -131,18 +134,22 @@ struct HookInfo
131134
//Manual mapping options:
132135
#define INJ_MM_CLEAN_DATA_DIR 0x00010000 //removes data from the dlls PE header, ignored if INJ_MM_SET_PAGE_PROTECTIONS is set
133136
#define INJ_MM_RESOLVE_IMPORTS 0x00020000 //resolves dll imports
134-
#define INJ_MM_RESOLVE_DELAY_IMPORTS 0x00040000 //resolves delayed imports
135-
#define INJ_MM_EXECUTE_TLS 0x00080000 //executes TLS callbacks and initializes static TLS data
137+
#define INJ_MM_RESOLVE_DELAY_IMPORTS 0x00040000 //resolves delayed imports
138+
#define INJ_MM_EXECUTE_TLS 0x00080000 //executes TLS callbacks and initializes static TLS data
136139
#define INJ_MM_ENABLE_EXCEPTIONS 0x00100000 //enables exception handling
137140
#define INJ_MM_SET_PAGE_PROTECTIONS 0x00200000 //sets page protections based on section characteristics, if set INJ_MM_CLEAN_DATA_DIR will be ignored
138141
#define INJ_MM_INIT_SECURITY_COOKIE 0x00400000 //initializes security cookie for buffer overrun protection
139-
#define INJ_MM_RUN_DLL_MAIN 0x00800000 //executes DllMain
142+
#define INJ_MM_RUN_DLL_MAIN 0x00800000 //executes DllMain
140143
//this option induces INJ_MM_RESOLVE_IMPORTS
141144
#define INJ_MM_RUN_UNDER_LDR_LOCK 0x01000000 //runs the DllMain under the loader lock
142145
#define INJ_MM_SHIFT_MODULE_BASE 0x02000000 //shifts the module base by a random offset
143146

144147
#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)
145148

149+
//Arguments for GetDownloadProgressEx
150+
#define PDB_DOWNLOAD_INDEX_NTDLL (int)0 //ntdll pdb download
151+
#define PDB_DOWNLOAD_INDEX_KERNEL32 (int)1 //kernel32 pdb download (Windows 7 only)
152+
146153
using f_InjectA = DWORD(__stdcall*)(INJECTIONDATAA * pData);
147154
using f_InjectW = DWORD(__stdcall*)(INJECTIONDATAW * pData);
148155

@@ -160,4 +167,4 @@ using f_StartDownload = void(__stdcall *)();
160167
using f_InterruptDownload = void(__stdcall *)();
161168

162169
using f_raw_print_callback = void(__stdcall *)(const char * szText);
163-
using f_SetRawPrintCallback = DWORD(__stdcall *)(f_raw_print_callback callback);
170+
using f_SetRawPrintCallback = DWORD(__stdcall *)(f_raw_print_callback callback);

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,23 @@ auto InjectA = (f_InjectA)GetProcAddress(hInjectionMod, "InjectA");
6767
auto GetSymbolState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetSymbolState");
6868
auto GetImportState = (f_GetSymbolState)GetProcAddress(hInjectionMod, "GetImportState");
6969
auto StartDownload = (f_StartDownload)GetProcAddress(hInjectionMod, "StartDownload");
70+
auto GetDownloadProgressEx = (f_GetDownloadProgress)GetProcAddress(hInjectionMod, "GetDownloadProgressEx");
7071

7172
StartDownload();
7273

74+
//since GetSymbolState and GetImportState only return after the downloads are finished checking the download progress is not necessary
75+
while (GetDownloadProgressEx(PDB_DOWNLOAD_INDEX_NTDLL, false) != 1.0f)
76+
{
77+
Sleep(10);
78+
}
79+
80+
#ifdef _WIN64
81+
while (GetDownloadProgressEx(PDB_DOWNLOAD_INDEX_NTDLL, true) != 1.0f)
82+
{
83+
Sleep(10);
84+
}
85+
#endif
86+
7387
while (GetSymbolState() != 0)
7488
{
7589
Sleep(10);

0 commit comments

Comments
 (0)