forked from CaptainFlint/wcx_sii_decrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dllmain.cpp
45 lines (40 loc) · 914 Bytes
/
dllmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
#include "wcx_sii_decrypt.h"
HMODULE hSiiModule = NULL;
BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved)
{
UNREFERENCED_PARAMETER(hModule);
UNREFERENCED_PARAMETER(lpReserved);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
WCHAR path[MAX_PATH];
GetModuleFileName(hModule, path, MAX_PATH);
WCHAR* pos = wcsrchr(path, L'\\');
if (pos != NULL)
*pos = L'\0';
#if defined _M_X64
wcscat_s(path, L"\\SII_Decrypt_64.dll");
#else
wcscat_s(path, L"\\SII_Decrypt_32.dll");
#endif
hSiiModule = LoadLibrary(path);
break;
}
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
{
if (hSiiModule != NULL)
FreeLibrary(hSiiModule);
break;
}
}
return TRUE;
}