#include <stdlib.h>
#include <winsock2.h>
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
HANDLE main_inst;
HWND main_wnd;
extern int traceOnPanic;
+extern void afsd_DbgBreakAllocInit();
+extern void afsd_DbgBreakAdd(DWORD requestNumber);
+
/*
* Notifier function for use by osi_panic
*/
{
MSG msg;
- if (!InitClass(hInstance))
+ afsd_SetUnhandledExceptionFilter();
+
+#ifdef _DEBUG
+ afsd_DbgBreakAllocInit();
+ _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF /* | _CRTDBG_CHECK_ALWAYS_DF */ | _CRTDBG_CHECK_CRT_DF | _CRTDBG_DELAY_FREE_MEM_DF );
+ if (lpCmdLine)
+ {
+ char *allocRequest = strtok(lpCmdLine, " \t");
+ while (allocRequest)
+ {
+ afsd_DbgBreakAdd(atoi(allocRequest));
+ allocRequest = strtok(NULL, " \t");
+ }
+ }
+#endif
+
+ if (!InitClass(hInstance))
return (FALSE);
if (!InitInstance(hInstance, nCmdShow))
HWND hWnd;
HDC hDC;
TEXTMETRIC textmetric;
- RECT rect;
INT nLineHeight;
- long code;
+ long code;
char *reason;
/* remember this, since it is a useful thing for some of the Windows
if (!hWnd)
return (FALSE);
-
/* lookup text dimensions */
hDC = GetDC(hWnd);
GetTextMetrics(hDC, &textmetric);
main_rect.right = GetDeviceCaps(hDC, HORZRES);
main_rect.top = GetDeviceCaps(hDC, LOGPIXELSY) / 4; /* 1/4 inch */
ReleaseDC(hWnd, hDC);
- main_rect.bottom = rect.top + nLineHeight;
+ main_rect.bottom = main_rect.top + nLineHeight;
osi_InitPanic(afsd_notifier);