-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdllmain.cpp
More file actions
39 lines (32 loc) · 1012 Bytes
/
Copy pathdllmain.cpp
File metadata and controls
39 lines (32 loc) · 1012 Bytes
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
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
#include "Gmapi.h"
gm::CGMAPI* gmapi = nullptr;
BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
// 应对 vs 内联 sprintf 导致 d3d8.lib 找不到 _sprintf 的问题
char f__kInline[1];
sprintf(f__kInline, "");
DWORD result = 0;
gmapi = gm::CGMAPI::Create(&result);
// Check the initialization
if (result == gm::GMAPI_INITIALIZATION_FAILED)
{
MessageBox(NULL, L"Unable to initialize GMAPI.", NULL, MB_SYSTEMMODAL | MB_ICONERROR);
return FALSE;
}
}
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
gm::CGMAPI::Destroy();
break;
}
return TRUE;
}