Skip to content
This repository was archived by the owner on Jun 25, 2022. It is now read-only.

Commit 364f34e

Browse files
committed
fix windows dllmain
1 parent 62c9a54 commit 364f34e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/pytson.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ void unixDllMain() {
2222
#define PATH_LEN 256
2323

2424
BOOL DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID /*lpReserved*/) {
25-
wchar_t path[MAXPATH];
25+
wchar_t path[PATH_LEN];
2626
switch (ul_reason_for_call) {
2727
case DLL_PROCESS_ATTACH:
28-
if (GetModuleFileName(hModule, path, PATH_LEN) != 0) {
28+
if (GetModuleFileName(hModule, path, PATH_LEN) != 0)
2929
loadVersion(QString::fromWCharArray(path));
30-
return;
31-
}
30+
else setVersion("unknown");
3231

33-
setVersion("unkown");
3432
break;
3533
case DLL_PROCESS_DETACH:
3634
freeVersion();
3735
break;
3836
default:
3937
break;
4038
}
39+
40+
return TRUE;
4141
}
4242

4343
#endif

src/pytson.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#endif
2121

2222
#ifdef WIN32
23+
#include <windows.h>
2324
BOOL DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved);
2425
void freeVersion();
2526
#else

0 commit comments

Comments
 (0)