It seems my DLL is causing problems when mIRC is shutting down - until 7.14 simply closing mIRC was not a big deal, now with 7.15 it crashes.
The DLL internally creates a few HICONs that are cleaned on quit, aswell as a WndProc redirect to get certain stuff, other than the memory-mapped file to communicate with mIRC:
__declspec(dllexport) int __stdcall DllMain(HINSTANCE hInstance, unsigned int reason, LPVOID lpvReserved) {
if (reason == DLL_PROCESS_ATTACH) {
//TODO: check GetLastError and use mIRC{number} in case
ghFileMap = CreateFileMapping(INVALID_HANDLE_VALUE, 0, PAGE_READWRITE, 0, 4096, L"mIRC");
ghFileView = MapViewOfFile(ghFileMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
//ChangeWindowMessageFilter(WM_COMMAND, MSGFLT_ADD);
}
else if (reason == DLL_PROCESS_DETACH) {
if (ghFileView)
UnmapViewOfFile(ghFileView);
if (ghFileMap)
CloseHandle(ghFileMap);
SetWindowLong(mircHwnd, GWL_WNDPROC, (LONG)mircWndProc);
for (std::vector<THUMBBUTTON>::iterator it = _buttons.begin(); it != _buttons.end(); it++)
if (it->hIcon)
DestroyIcon(it->hIcon);
}
return 1;
}
__declspec(dllexport) int __stdcall UnloadDll(int mTimeout) {
if (mTimeout == 1)
return 0;
return 1;
}
That code hasn't changed since 7.14, and it also happens on a clean install.
I don't have any other DLLs loaded, so I'm not sure whether my DLL, my DLL_PROCESS_DETACH code or something else is at fault.
Any ideas on that?