修复无法正确卸载dll

This commit is contained in:
hugy 2023-02-21 16:24:39 +08:00
parent 04e7967236
commit 861a04e7a0
4 changed files with 10 additions and 1 deletions

View File

@ -701,7 +701,7 @@ int http_start(int port) {
#endif
kHttpRuning = true;
kHttpThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)http_server,
(LPVOID)port, NULL, 0);
(LPVOID)port, NULL, 0);
return 0;
}

View File

@ -135,4 +135,11 @@ BOOL FindOrCreateDirectoryW(const wchar_t *path) {
return false;
}
return true;
}
void CloseConsole(){
fclose(stdin);
fclose(stdout);
fclose(stderr);
FreeConsole();
}

View File

@ -53,6 +53,7 @@ std::string Wstring2String(std::wstring wstr);
/// @return
BOOL FindOrCreateDirectoryW(const wchar_t *path);
void CloseConsole();
template <typename T1, typename T2>
std::vector<T1> split(T1 str, T2 letter) {

View File

@ -16,6 +16,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call,
break;
}
case DLL_PROCESS_DETACH: {
CloseConsole();
http_close();
break;
}