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.

71 lines
2.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: main.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. #include "global.hxx"
  11. #include <dbgdef.h>
  12. #pragma warning (disable: 4201) // nameless struct/union
  13. #pragma warning (disable: 4514) // remove inline functions
  14. #pragma warning (disable: 4127) // conditional expression is constant
  15. //#include <wchar.h>
  16. HMODULE HmodRichEdit = NULL;
  17. HINSTANCE HinstDll;
  18. BOOL FIsWin95 = TRUE;
  19. BOOL fRichedit20Exists = FALSE;
  20. //
  21. // Generic DLL Main function, we need to get our own hinstance handle.
  22. //
  23. // We don't need to get thread attaches however.
  24. extern "C" BOOL WINAPI TrustUIDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID pvReserved);
  25. extern "C" BOOL WINAPI Wizard_DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/);
  26. BOOL WINAPI DllMain(HANDLE hInst, ULONG ulReason, LPVOID)
  27. {
  28. BOOL fResult=FALSE;
  29. switch( ulReason ) {
  30. case DLL_PROCESS_ATTACH:
  31. HinstDll = (HINSTANCE) hInst;
  32. // Kill all thread attach and detach messages
  33. DisableThreadLibraryCalls(HinstDll);
  34. // Are we running in Win95 or something equally bad
  35. FIsWin95 = IsWin95();
  36. // check for richedit 2.0's existence
  37. fRichedit20Exists = CheckRichedit20Exists();
  38. break;
  39. case DLL_PROCESS_DETACH:
  40. // If the rich edit dll was loaded, then unload it now
  41. if (HmodRichEdit != NULL) {
  42. FreeLibrary(HmodRichEdit);
  43. }
  44. break;
  45. }
  46. fResult=TrustUIDllMain((HINSTANCE)hInst, ulReason, NULL);
  47. fResult=fResult && (Wizard_DllMain((HINSTANCE)hInst, ulReason, NULL));
  48. fResult=fResult && (ProtectUI_DllMain((HINSTANCE)hInst, ulReason, NULL));
  49. return fResult;
  50. }