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.

132 lines
2.1 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1993 - 1999
  3. Module Name:
  4. kdexts.c
  5. Abstract:
  6. This file contains the generic routines and initialization code
  7. for the kernel debugger extensions dll.
  8. Author:
  9. Environment:
  10. User Mode
  11. --*/
  12. #include "pch.h"
  13. #include <ntverp.h>
  14. //
  15. // Globals
  16. //
  17. EXT_API_VERSION ApiVersion = {
  18. (VER_PRODUCTVERSION_W >> 8),
  19. (VER_PRODUCTVERSION_W & 0xff),
  20. EXT_API_VERSION_NUMBER,
  21. 0
  22. };
  23. WINDBG_EXTENSION_APIS ExtensionApis;
  24. IDebugDataSpaces3* DebugDataSpaces;
  25. //
  26. // Routines
  27. //
  28. #if 0
  29. DllInit(
  30. HANDLE hModule,
  31. DWORD dwReason,
  32. DWORD dwReserved
  33. )
  34. {
  35. switch (dwReason) {
  36. case DLL_THREAD_ATTACH:
  37. break;
  38. case DLL_THREAD_DETACH:
  39. break;
  40. case DLL_PROCESS_DETACH:
  41. break;
  42. case DLL_PROCESS_ATTACH:
  43. break;
  44. }
  45. return TRUE;
  46. }
  47. #endif
  48. EXTERN_C
  49. HRESULT
  50. CALLBACK
  51. DebugExtensionInitialize(
  52. PULONG Version,
  53. PULONG Flags
  54. )
  55. {
  56. HRESULT Hr;
  57. IDebugClient* DebugClient;
  58. IDebugControl* DebugControl;
  59. *Version = DEBUG_EXTENSION_VERSION (1, 0);
  60. *Flags = 0;
  61. Hr = DebugCreate (__uuidof(IDebugClient),
  62. (PVOID*)&DebugClient);
  63. if (Hr != S_OK) {
  64. return Hr;
  65. }
  66. Hr = DebugClient->QueryInterface(__uuidof(IDebugControl),
  67. (PVOID*)&DebugControl);
  68. if (Hr != S_OK) {
  69. return Hr;
  70. }
  71. ExtensionApis.nSize = sizeof (ExtensionApis);
  72. Hr = DebugControl->GetWindbgExtensionApis64 (&ExtensionApis);
  73. if (Hr != S_OK) {
  74. return Hr;
  75. }
  76. Hr = DebugClient->QueryInterface (__uuidof (IDebugDataSpaces3),
  77. (PVOID*) &DebugDataSpaces);
  78. DebugControl->Release();
  79. DebugClient->Release();
  80. return S_OK;
  81. }
  82. EXTERN_C
  83. HRESULT
  84. CALLBACK
  85. DebugExtensionUninitialize(
  86. )
  87. {
  88. if (DebugDataSpaces != NULL) {
  89. DebugDataSpaces->Release();
  90. DebugDataSpaces = NULL;
  91. }
  92. return S_OK;
  93. }