MCPcopy Create free account
hub / github.com/Rat431/ColdAPI_Steam / DllMain

Function DllMain

src/ColdAPI_Steam/dllmain.cpp:10–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8char SteamModule[MAX_PATH] = { 0 };
9HMODULE SteamApimod = 0;
10BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
11{
12 if (ul_reason_for_call == DLL_PROCESS_ATTACH)
13 {
14 SteamApimod = hModule;
15 char myfile[MAX_PATH] = { 0 };
16 GetModuleFileNameA(hModule, myfile, MAX_PATH);
17 int size = lstrlenA(myfile);
18 for (int i = size; i > 0; i--) {
19 if (myfile[i] == '\\') {
20 lstrcpyA(SteamModule, &myfile[i + 1]);
21 RtlFillMemory(&myfile[i + 1], (size - i) + 1, NULL);
22 break;
23
24 }
25 }
26 // Check if the steam_appid file or INI might be in the main module directory one
27 char FileoNe[MAX_PATH] = { 0 };
28 lstrcpyA(FileoNe, myfile);
29 lstrcatA(FileoNe, "ColdAPI.ini");
30 if (GetFileAttributesA(FileoNe) == INVALID_FILE_ATTRIBUTES) {
31 ZeroMemory(FileoNe, sizeof(FileoNe));
32 lstrcpyA(FileoNe, myfile);
33 lstrcatA(FileoNe, STEAMAPPID);
34 if (GetFileAttributesA(FileoNe) == INVALID_FILE_ATTRIBUTES) {
35 ZeroMemory(myfile, MAX_PATH);
36 GetCurrentDirectoryA(MAX_PATH, myfile);
37 lstrcatA(myfile, "\\");
38 }
39 }
40 lstrcpyA(Steamapipath, myfile);
41 ColdAPI_InitAndShutDown::ColdClientInitializzation();
42 }
43 return TRUE;
44}
45

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected