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.

84 lines
2.3 KiB

  1. //
  2. // IEAKENG.CPP
  3. //
  4. #include "precomp.h"
  5. // prototype declarations
  6. // global variables
  7. HINSTANCE g_hInst;
  8. HINSTANCE g_hDLLInst;
  9. DWORD g_dwPlatformId = PLATFORM_WIN32;
  10. BOOL g_fRunningOnNT;
  11. BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD dwReason, LPVOID)
  12. {
  13. switch (dwReason)
  14. {
  15. case DLL_PROCESS_ATTACH:
  16. {
  17. OSVERSIONINFOA osviA;
  18. // The DLL is being loaded for the first time by a given process.
  19. // Perform per-process initialization here. If the initialization
  20. // is successful, return TRUE; if unsuccessful, return FALSE.
  21. // Initialize the global variable holding the hinstance.
  22. g_hDLLInst = hDLLInst;
  23. g_hInst = LoadLibrary(TEXT("ieakui.dll"));
  24. if (g_hInst == NULL)
  25. {
  26. TCHAR szTitle[MAX_PATH],
  27. szMsg[MAX_PATH];
  28. LoadString(g_hDLLInst, IDS_ENGINE_TITLE, szTitle, ARRAYSIZE(szTitle));
  29. LoadString(g_hDLLInst, IDS_IEAKUI_LOADERROR, szMsg, ARRAYSIZE(szMsg));
  30. MessageBox(NULL, szMsg, szTitle, MB_OK | MB_SETFOREGROUND);
  31. return FALSE;
  32. }
  33. osviA.dwOSVersionInfoSize = sizeof(osviA);
  34. GetVersionExA(&osviA);
  35. if (VER_PLATFORM_WIN32_NT == osviA.dwPlatformId)
  36. g_fRunningOnNT = TRUE;
  37. DisableThreadLibraryCalls(g_hInst);
  38. break;
  39. }
  40. case DLL_PROCESS_DETACH:
  41. // The DLL is being unloaded by a given process. Do any
  42. // per-process clean up here, such as undoing what was done in
  43. // DLL_PROCESS_ATTACH. The return value is ignored.
  44. if(g_hInst)
  45. FreeLibrary(g_hInst);
  46. break;
  47. case DLL_THREAD_ATTACH:
  48. // A thread is being created in a process that has already loaded
  49. // this DLL. Perform any per-thread initialization here. The
  50. // return value is ignored.
  51. // Initialize the global variable holding the hinstance.
  52. // NOTE: this is probably taken care of already by DLL_PROCESS_ATTACH.
  53. g_hDLLInst = hDLLInst;
  54. break;
  55. case DLL_THREAD_DETACH:
  56. // A thread is exiting cleanly in a process that has already
  57. // loaded this DLL. Perform any per-thread clean up here. The
  58. // return value is ignored.
  59. break;
  60. }
  61. return TRUE;
  62. }