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.

106 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. crash.cpp
  5. Abstract:
  6. Debugger extension to debug triage dump file.
  7. Author:
  8. Matthew D Hendel (math) 15-April-2002
  9. --*/
  10. #include "pch.h"
  11. #include <dbgeng.h>
  12. #include <initguid.h>
  13. #include <idedump.h>
  14. typedef struct _ATAPI_DUMP_RECORD {
  15. ULONG Count;
  16. ATAPI_DUMP_PDO_INFO PdoRecords[4];
  17. } ATAPI_DUMP_RECORD, *PATAPI_DUMP_RECORD;
  18. NTSTATUS
  19. GetAtapiDumpRecord(
  20. IN IDebugDataSpaces3* DataSpaces,
  21. OUT PATAPI_DUMP_RECORD DumpRecord
  22. )
  23. /*++
  24. Routine Description:
  25. Get the ATAPI dump record structure from the dump file.
  26. Arguments:
  27. DebugSpaces - Supplies IDebugDataSpaces2 interface.
  28. DumpRecord - Supplies pointer to the dump record buffer that will be
  29. filled in by the client.
  30. Return Value:
  31. NTSTATUS code
  32. --*/
  33. {
  34. HRESULT Hr;
  35. ULONG Count;
  36. if (DataSpaces == NULL) {
  37. return E_INVALIDARG;
  38. }
  39. RtlZeroMemory (DumpRecord->PdoRecords, sizeof (ATAPI_DUMP_PDO_INFO) * 4);
  40. Hr = DataSpaces->ReadTagged ((LPGUID)&ATAPI_DUMP_ID,
  41. 0,
  42. DumpRecord->PdoRecords,
  43. sizeof (ATAPI_DUMP_PDO_INFO) * 4,
  44. NULL);
  45. if (Hr != S_OK) {
  46. return Hr;
  47. }
  48. //
  49. // Count the entries in the crash record.
  50. //
  51. Count = 0;
  52. while (DumpRecord->PdoRecords[Count].Version == ATAPI_DUMP_RECORD_VERSION) {
  53. Count++;
  54. }
  55. if (Count == 0) {
  56. return E_FAIL;
  57. }
  58. DumpRecord->Count = Count;
  59. return S_OK;
  60. }
  61. extern IDebugDataSpaces3* DebugDataSpaces;
  62. DECLARE_API (test)
  63. {
  64. ATAPI_DUMP_RECORD DumpRecord;
  65. GetAtapiDumpRecord (DebugDataSpaces, &DumpRecord);
  66. return S_OK;
  67. }