Skip to content

Commit b7dff62

Browse files
committed
Add report log for loaded winmm
1 parent 1300a16 commit b7dff62

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Client/core/Core.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,36 @@ CLocalization* g_pLocalization = NULL;
2020

2121
HINSTANCE g_hModule = NULL;
2222

23+
void AddLoaderProxyReport()
24+
{
25+
HMODULE loaderHandle = nullptr;
26+
DWORD loaderSource = 0;
27+
HMODULE (*mtasaGetLibraryHandle)() = nullptr;
28+
DWORD (*mtasaGetLibrarySource)() = nullptr;
29+
30+
if (HMODULE mtasa = LoadLibraryW(L"mtasa.dll"))
31+
{
32+
mtasaGetLibraryHandle = reinterpret_cast<decltype(mtasaGetLibraryHandle)>(GetProcAddress(mtasa, "mtasaGetLibraryHandle"));
33+
mtasaGetLibrarySource = reinterpret_cast<decltype(mtasaGetLibrarySource)>(GetProcAddress(mtasa, "mtasaGetLibrarySource"));
34+
35+
if (mtasaGetLibraryHandle)
36+
loaderHandle = mtasaGetLibraryHandle();
37+
38+
if (mtasaGetLibrarySource)
39+
loaderSource = mtasaGetLibrarySource();
40+
41+
FreeLibrary(mtasa);
42+
}
43+
44+
HMODULE winmm = LoadLibraryW(L"winmm.dll");
45+
46+
if (winmm)
47+
FreeLibrary(winmm);
48+
49+
AddReportLog(7120, SString("winmm.dll @%lu %08X=%08X [h:%08X, s:%08X]", loaderSource, reinterpret_cast<DWORD>(loaderHandle), reinterpret_cast<DWORD>(winmm),
50+
reinterpret_cast<DWORD>(mtasaGetLibraryHandle), reinterpret_cast<DWORD>(mtasaGetLibrarySource)));
51+
}
52+
2353
int WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, PVOID pvNothing)
2454
{
2555
CFilePathTranslator FileTranslator;
@@ -49,6 +79,8 @@ int WINAPI DllMain(HINSTANCE hModule, DWORD dwReason, PVOID pvNothing)
4979
// http://msdn.microsoft.com/en-us/library/ms682586%28VS.85%29.aspx
5080
SetDllDirectory(CalcMTASAPath("MTA"));
5181

82+
AddLoaderProxyReport();
83+
5284
g_hModule = hModule;
5385
g_pCore = new CCore;
5486

0 commit comments

Comments
 (0)