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.

183 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1993 Microsoft Corporation
  3. Module Name:
  4. globals.c
  5. Abstract:
  6. This module implements all global variables used in dbghelp.dll
  7. Author:
  8. Pat Styles (patst) 14-July-2000
  9. Revision History:
  10. --*/
  11. #include <private.h>
  12. #include <symbols.h>
  13. #include <globals.h>
  14. GLOBALS g =
  15. {
  16. // HANDLE hinst
  17. // initialized in DllMain
  18. 0,
  19. // HANDLE hHeap
  20. 0,
  21. // DWORD tlsIndex
  22. (DWORD)-1,
  23. #ifdef IMAGEHLP_HEAP_DEBUG
  24. // LIST_ENTRY HeapHeader
  25. {NULL, NULL},
  26. // ULONG TotalMemory
  27. 0,
  28. // ULONG TotalAllocs
  29. 0,
  30. #endif
  31. // OSVERSIONINFO OSVerInfo
  32. // initialized in DllMain
  33. {0, 0, 0, 0, 0, ""},
  34. // API_VERSION ApiVersion
  35. {
  36. (VER_PRODUCTVERSION_W >> 8),
  37. (VER_PRODUCTVERSION_W & 0xff),
  38. API_VERSION_NUMBER,
  39. 0
  40. },
  41. // API_VERSION AppVersion
  42. // DON'T UPDATE THE FOLLOWING VERSION NUMBER!!!!
  43. //
  44. // If the app does not call ImagehlpApiVersionEx, always assume
  45. // that it is for NT 4.0.
  46. {4, 0, 5, 0},
  47. // ULONG MachineType;
  48. 0,
  49. #ifdef BUILD_DBGHELP
  50. // HINSTANCE hSrv
  51. 0,
  52. // CHAR szSrvName
  53. "",
  54. // LPSTR szSrvParams
  55. NULL,
  56. // PSYMBOLSERVERPROC fnSymbolServer
  57. NULL,
  58. // PSYMBOLSERVERCLOSEPROC fnSymbolServerClose
  59. NULL,
  60. // PSYMBOLSERVERSETOPTIONSPROC fnSymbolServerSetOptions
  61. NULL,
  62. // DWORD cProcessList
  63. 0,
  64. // LIST_ENTRY ProcessList
  65. {NULL, NULL},
  66. // BOOL SymInitialized
  67. FALSE,
  68. // DWORD SymOptions
  69. SYMOPT_UNDNAME,
  70. // ULONG LastSymLoadError
  71. 0,
  72. // char DebugModule[MAX_SYM_NAME + 1];
  73. "",
  74. // PREAD_PROCESS_MEMORY_ROUTINE ImagepUserReadMemory32
  75. NULL,
  76. // PFUNCTION_TABLE_ACCESS_ROUTINE ImagepUserFunctionTableAccess32
  77. NULL,
  78. // PGET_MODULE_BASE_ROUTINE ImagepUserGetModuleBase32
  79. NULL,
  80. // PTRANSLATE_ADDRESS_ROUTINE ImagepUserTranslateAddress32
  81. NULL,
  82. #endif
  83. };
  84. #ifdef BUILD_DBGHELP
  85. void
  86. tlsInit(PTLS ptls)
  87. {
  88. ZeroMemory(ptls, sizeof(TLS));
  89. }
  90. PTLS
  91. GetTlsPtr(void)
  92. {
  93. PTLS ptls = (PTLS)TlsGetValue(g.tlsIndex);
  94. if (!ptls) {
  95. ptls = (PTLS)MemAlloc(sizeof(TLS));
  96. if (ptls) {
  97. TlsSetValue(g.tlsIndex, ptls);
  98. tlsInit(ptls);
  99. }
  100. }
  101. assert(ptls);
  102. if (!ptls) {
  103. static TLS sos_tls;
  104. ptls = &sos_tls;
  105. }
  106. return ptls;
  107. }
  108. #endif // #ifdef BUILD_DBGHELP