Leaked source code of windows server 2003
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.
 
 
 
 
 
 

55 lines
1.3 KiB

/*
File libmain.c
Contains lib main for mprapi.dll
Paul Mayfield, 5/7/98
*/
#include <windows.h>
#include "sdolib.h"
extern CRITICAL_SECTION DsrLock;
extern CRITICAL_SECTION CfgLock;
//
// Standard Win32 lib main function gets called
// as processes and threads attach and detach.
//
// Returns TRUE if successfull, false otherwise
//
BOOL MprLibMain(
IN HANDLE hinstDll,
IN DWORD fdwReason,
IN LPVOID lpReserved)
{
static BOOL DsrLockInitialized;
static BOOL CfgLockInitialized;
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
try {
InitializeCriticalSection(&DsrLock);
DsrLockInitialized = TRUE;
InitializeCriticalSection(&CfgLock);
CfgLockInitialized = TRUE;
}
except (EXCEPTION_EXECUTE_HANDLER) {
return FALSE;
}
DisableThreadLibraryCalls(hinstDll);
break;
case DLL_PROCESS_DETACH:
if (DsrLockInitialized)
DeleteCriticalSection(&DsrLock);
if (CfgLockInitialized)
DeleteCriticalSection(&CfgLock);
break;
}
return TRUE;
}