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.

135 lines
2.3 KiB

  1. /*
  2. * dllinit.cpp - Initialization and termination routines.
  3. */
  4. /* Headers
  5. **********/
  6. #include "project.hpp"
  7. #pragma hdrstop
  8. #include "autodial.hpp"
  9. #include "inetcpl.h"
  10. #include "init.h"
  11. #ifdef _X86_
  12. BOOL g_bRunningOnNT = FALSE;
  13. #endif
  14. /* Module Prototypes
  15. ********************/
  16. PRIVATE_CODE BOOL MyAttachProcess(HMODULE hmod);
  17. PRIVATE_CODE BOOL MyDetachProcess(HMODULE hmod);
  18. /* Global Variables
  19. *******************/
  20. #pragma data_seg(DATA_SEG_READ_ONLY)
  21. /* serialization control structure */
  22. PUBLIC_DATA CSERIALCONTROL g_cserctrl =
  23. {
  24. MyAttachProcess,
  25. MyDetachProcess,
  26. NULL,
  27. NULL
  28. };
  29. #pragma data_seg()
  30. #ifdef DEBUG
  31. #pragma data_seg(DATA_SEG_READ_ONLY)
  32. /* .ini file name and section used by inifile.c!SetIniSwitches() */
  33. PUBLIC_DATA PCSTR g_pcszIniFile = "ohare.ini";
  34. PUBLIC_DATA PCSTR g_pcszIniSection = "URLDebugOptions";
  35. /* module name used by debspew.c!SpewOut() */
  36. PUBLIC_DATA PCSTR g_pcszSpewModule = "URL";
  37. #pragma data_seg()
  38. #endif
  39. /***************************** Private Functions *****************************/
  40. #pragma warning(disable:4100) /* "unreferenced formal parameter" warning */
  41. PRIVATE_CODE BOOL MyAttachProcess(HMODULE hmod)
  42. {
  43. BOOL bResult;
  44. ASSERT(IS_VALID_HANDLE(hmod, MODULE));
  45. DebugEntry(MyAttachProcess);
  46. bResult = (InitDataObjectModule());
  47. #ifdef _X86_
  48. // Remember whether we're running on NT or not
  49. g_bRunningOnNT = (0 == (GetVersion() & 0x80000000));
  50. #endif
  51. #ifndef DEBUG
  52. // We don't need to get called on DLL_THREAD_ATTACH, etc. This
  53. // is for perf gains.
  54. DisableThreadLibraryCalls(hmod);
  55. #endif
  56. ASSERT(NULL == g_cserctrl.AttachThread &&
  57. NULL == g_cserctrl.DetachThread);
  58. DebugExitBOOL(MyAttachProcess, bResult);
  59. return(bResult);
  60. }
  61. PRIVATE_CODE BOOL MyDetachProcess(HMODULE hmod)
  62. {
  63. BOOL bResult = TRUE;
  64. ASSERT(IS_VALID_HANDLE(hmod, MODULE));
  65. DebugEntry(MyDetachProcess);
  66. ExitInternetCPLModule();
  67. ExitDataObjectModule();
  68. DebugExitBOOL(MyDetachProcess, bResult);
  69. return(bResult);
  70. }
  71. #pragma warning(default:4100) /* "unreferenced formal parameter" warning */
  72. /****************************** Public Functions *****************************/
  73. #ifdef DEBUG
  74. PUBLIC_CODE BOOL SetAllIniSwitches(void)
  75. {
  76. BOOL bResult;
  77. bResult = SetDebugModuleIniSwitches();
  78. bResult = SetSerialModuleIniSwitches() && bResult;
  79. return(bResult);
  80. }
  81. #endif