Source code of Windows XP (NT5)
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.

47 lines
1000 B

  1. /*
  2. File libmain.c
  3. Contains lib main for mprapi.dll
  4. Paul Mayfield, 5/7/98
  5. */
  6. #include <windows.h>
  7. #include "sdolib.h"
  8. extern CRITICAL_SECTION DsrLock;
  9. extern CRITICAL_SECTION CfgLock;
  10. //
  11. // Standard Win32 lib main function gets called
  12. // as processes and threads attach and detach.
  13. //
  14. // Returns TRUE if successfull, false otherwise
  15. //
  16. BOOL MprLibMain(
  17. IN HANDLE hinstDll,
  18. IN DWORD fdwReason,
  19. IN LPVOID lpReserved)
  20. {
  21. switch (fdwReason) {
  22. case DLL_PROCESS_ATTACH:
  23. try {
  24. InitializeCriticalSection(&DsrLock);
  25. InitializeCriticalSection(&CfgLock);
  26. }
  27. except (EXCEPTION_EXECUTE_HANDLER) {
  28. return FALSE;
  29. }
  30. DisableThreadLibraryCalls(hinstDll);
  31. break;
  32. case DLL_PROCESS_DETACH:
  33. DeleteCriticalSection(&DsrLock);
  34. DeleteCriticalSection(&CfgLock);
  35. break;
  36. }
  37. return TRUE;
  38. }