I did some tests in the meantime, it seems that my redirection of the mIRC WndProc causes the crash...

Code:
__declspec(dllexport) void __stdcall LoadDll(LOADINFO* info) {
  mircHwnd = info->mHwnd;
  info->mKeep = true;
  info->mUnicode = true;

  //redirect mIRC WndProc to ours. 
  //SetWindowsHookEx does not seem to catch the WM_COMMAND messages with THBN_CLICKED
  mircWndProc = (WNDPROC)SetWindowLong(mircHwnd, GWL_WNDPROC, (LONG)WndProc);
}


That part is needed because I add Thumbbar-Buttons on Win7 and need to get the WM_COMMAND message telling me when one of them was clicked.

It works when I call the unregister part by hand before mIRC quits, but it will crash the same way when using on EXIT.
The SetWindowLong call succeeds, but apparently something still wants to call my redirected WndProc after the DLL was unloaded.

Unregistering inside UnloadDll for mTimeout == 2 (shutdown) and returning 0 (do not unload) doesn't help, I guess thats due to the return value only being honored for mTimeout == 1 (10min timeout).

I guess I'll just have to live with it, I'm quitting mIRC anyways, so it shouldnt be a big deal if it crashes by then...unless it forgets my settings, which doesnt seem to be the case.