You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
158 lines
2.9 KiB
158 lines
2.9 KiB
/*++
|
|
|
|
Copyright (c) 1998-2000 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
main.cxx
|
|
|
|
Abstract:
|
|
|
|
Main entry points for the perf lib dll.
|
|
|
|
Author:
|
|
|
|
Emily Kruglick (EmilyK) 11-Sep-2000
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#include "precomp.h"
|
|
|
|
//
|
|
// global variables
|
|
//
|
|
|
|
// debug support
|
|
DECLARE_DEBUG_PRINTS_OBJECT();
|
|
DECLARE_DEBUG_VARIABLE();
|
|
|
|
extern CRITICAL_SECTION g_IISMemManagerCriticalSection;
|
|
extern PERF_SM_MANAGER* g_pIISMemManager;
|
|
extern LONG g_IISNumberInitialized;
|
|
extern HANDLE g_hWASProcessWait;
|
|
|
|
|
|
/***************************************************************************++
|
|
|
|
Routine Description:
|
|
|
|
The dll entry point. Used to set up debug libraries, etc.
|
|
|
|
Arguments:
|
|
|
|
DllHandle - The dll module handle for this dll. Does not need to be
|
|
closed.
|
|
|
|
Reason - The dll notification reason.
|
|
|
|
pReserved - Reserved, not used.
|
|
|
|
Return Value:
|
|
|
|
BOOL
|
|
|
|
--***************************************************************************/
|
|
|
|
extern "C"
|
|
BOOL
|
|
WINAPI
|
|
DllMain(
|
|
HINSTANCE DllHandle,
|
|
DWORD Reason,
|
|
LPVOID pReserved
|
|
)
|
|
{
|
|
|
|
BOOL Success = TRUE;
|
|
HRESULT hr = S_OK;
|
|
|
|
UNREFERENCED_PARAMETER( pReserved );
|
|
|
|
switch ( Reason )
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
CREATE_DEBUG_PRINT_OBJECT( WEB_ADMIN_SERVICE_NAME_A );
|
|
|
|
LOAD_DEBUG_FLAGS_FROM_REG_STR( REGISTRY_KEY_W3SVC_PARAMETERS_A, 0 );
|
|
|
|
Success = VALID_DEBUG_PRINT_OBJECT();
|
|
|
|
if ( ! Success )
|
|
{
|
|
DBGPRINTF((
|
|
DBG_CONTEXT,
|
|
"Debug print object is not valid\n"
|
|
));
|
|
|
|
goto exit;
|
|
}
|
|
|
|
|
|
Success = DisableThreadLibraryCalls( DllHandle );
|
|
|
|
if ( ! Success )
|
|
{
|
|
hr = HRESULT_FROM_WIN32( GetLastError() );
|
|
|
|
DPERROR((
|
|
DBG_CONTEXT,
|
|
hr,
|
|
"Disabling thread library calls failed\n"
|
|
));
|
|
|
|
goto exit;
|
|
}
|
|
|
|
InitializeCriticalSection( &g_IISMemManagerCriticalSection );
|
|
|
|
g_IISNumberInitialized = 0;
|
|
|
|
g_pIISMemManager = NULL;
|
|
|
|
g_hWASProcessWait = NULL;
|
|
|
|
break;
|
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
if ( g_hWASProcessWait != NULL )
|
|
{
|
|
if ( !UnregisterWait( g_hWASProcessWait ) )
|
|
{
|
|
DPERROR((
|
|
DBG_CONTEXT,
|
|
HRESULT_FROM_WIN32(GetLastError()),
|
|
"Could not unregister the old process wait handle \n"
|
|
));
|
|
|
|
}
|
|
|
|
g_hWASProcessWait = NULL;
|
|
}
|
|
|
|
// DBG_ASSERT ( g_pIISMemManager == NULL );
|
|
|
|
DeleteCriticalSection ( &g_IISMemManagerCriticalSection );
|
|
|
|
DELETE_DEBUG_PRINT_OBJECT();
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
exit:
|
|
|
|
return Success;
|
|
|
|
} // DllMain
|
|
|
|
|