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.

93 lines
2.5 KiB

  1. /*++
  2. Copyright (c) 1990-2002 Microsoft Corporation
  3. Module Name:
  4. dump.c
  5. Abstract:
  6. This module supplies support for non destructive building a mini-dump file.
  7. Author:
  8. Erick Smith (ericks), Oleg Kagan (olegk), Jun. 2002
  9. Environment:
  10. kernel mode only
  11. Revision History:
  12. --*/
  13. #include "videoprt.h"
  14. #include "gdisup.h"
  15. #define TRIAGE_DUMP_DATA_SIZE (TRIAGE_DUMP_SIZE - sizeof(ULONG))
  16. ULONG
  17. pVpAppendSecondaryMinidumpData(
  18. PVOID pvSecondaryData,
  19. ULONG ulSecondaryDataSize,
  20. PVOID pvDump
  21. )
  22. /*++
  23. Routine Description:
  24. Adds precollected video driver specific data
  25. Arguments:
  26. pvDump - points to the begiinig of the dump buffer
  27. pvSecondaryDumpData - points to the secondary data buffer
  28. ulSecondaryDataSize - size of the secondary data buffer
  29. Return Value:
  30. Resulting length of the minidump
  31. --*/
  32. {
  33. PMEMORY_DUMP pDump = (PMEMORY_DUMP)pvDump;
  34. ULONG_PTR DumpDataEnd = (ULONG_PTR)pDump + TRIAGE_DUMP_DATA_SIZE;
  35. PDUMP_HEADER pdh = &(pDump->Header);
  36. PVOID pBuffer = (PVOID)((ULONG_PTR)pvDump + TRIAGE_DUMP_SIZE);
  37. PDUMP_BLOB_FILE_HEADER BlobFileHdr = (PDUMP_BLOB_FILE_HEADER)(pBuffer);
  38. PDUMP_BLOB_HEADER BlobHdr = (PDUMP_BLOB_HEADER)(BlobFileHdr + 1);
  39. if (!pvDump) return 0;
  40. if (pvSecondaryData && ulSecondaryDataSize) {
  41. ASSERT(ulSecondaryDataSize <= MAX_SECONDARY_DUMP_SIZE);
  42. if (ulSecondaryDataSize > MAX_SECONDARY_DUMP_SIZE)
  43. ulSecondaryDataSize = MAX_SECONDARY_DUMP_SIZE;
  44. pdh->RequiredDumpSpace.QuadPart = TRIAGE_DUMP_SIZE +
  45. ulSecondaryDataSize /*+ // XXX olegk - uncomment it for longhorn
  46. sizeof(DUMP_BLOB_HEADER) +
  47. sizeof(DUMP_BLOB_FILE_HEADER)*/;
  48. BlobFileHdr->Signature1 = DUMP_BLOB_SIGNATURE1;
  49. BlobFileHdr->Signature2 = DUMP_BLOB_SIGNATURE2;
  50. BlobFileHdr->HeaderSize = sizeof(*BlobFileHdr);
  51. BlobFileHdr->BuildNumber = NtBuildNumber;
  52. BlobHdr->HeaderSize = sizeof(*BlobHdr);
  53. BlobHdr->Tag = VpBugcheckGUID;
  54. BlobHdr->PrePad = 0;
  55. BlobHdr->PostPad = MAX_SECONDARY_DUMP_SIZE - ulSecondaryDataSize;
  56. BlobHdr->DataSize = ulSecondaryDataSize;
  57. RtlCopyMemory((PVOID)(BlobHdr + 1), pvSecondaryData, ulSecondaryDataSize);
  58. }
  59. return (ULONG)pdh->RequiredDumpSpace.QuadPart;
  60. }