X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2FWINNT%2Fafsd%2Fafsd.c;h=8e29f678e7b4f4c08a4c12a7197ac74ebafbc7c8;hp=752d1c94a3643ad21f15c253797743adc44cdd9b;hb=c46ebfb07e99ff4d0758de6d1f8aabe215b6934d;hpb=87c10e8d7f05dbbdf12ee9e8651dcec07e08af3f diff --git a/src/WINNT/afsd/afsd.c b/src/WINNT/afsd/afsd.c index 752d1c9..8e29f67 100644 --- a/src/WINNT/afsd/afsd.c +++ b/src/WINNT/afsd/afsd.c @@ -1,11 +1,12 @@ -/* - * Copyright (C) 1998, 1989 Transarc Corporation - All rights reserved - * - * (C) COPYRIGHT IBM CORPORATION 1987, 1988 - * LICENSED MATERIALS - PROPERTY OF IBM - * - * +/* + * Copyright 2000, International Business Machines Corporation and others. + * All Rights Reserved. + * + * This software has been released under the terms of the IBM Public + * License. For details, see the LICENSE file in the top-level source + * directory or online at http://www.openafs.org/dl/license10.html */ + #include #include @@ -20,6 +21,9 @@ #include #include +#ifdef _DEBUG +#include +#endif HANDLE main_inst; HWND main_wnd; @@ -29,6 +33,9 @@ osi_log_t *afsd_logp; extern int traceOnPanic; +extern void afsd_DbgBreakAllocInit(); +extern void afsd_DbgBreakAdd(DWORD requestNumber); + /* * Notifier function for use by osi_panic */ @@ -68,7 +75,23 @@ int WINAPI WinMain( { 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)) @@ -110,9 +133,8 @@ BOOL InitInstance( 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 @@ -137,7 +159,6 @@ BOOL InitInstance( if (!hWnd) return (FALSE); - /* lookup text dimensions */ hDC = GetDC(hWnd); GetTextMetrics(hDC, &textmetric); @@ -147,7 +168,7 @@ BOOL InitInstance( 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);