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.

166 lines
3.3 KiB

  1. /*
  2. */
  3. //#include "sptlib.h"
  4. #include <windows.h> // sdk
  5. #include <devioctl.h> // sdk
  6. #include <ntddscsi.h> // sdk
  7. #include <ntddcdrm.h>
  8. #include <ntddmmc.h>
  9. #include <ntddcdvd.h>
  10. typedef struct _HACK_FLAGS {
  11. ULONG TestBurn : 1;
  12. ULONG IgnoreModePageErrors : 1;
  13. ULONG Reserved : 30;
  14. } HACK_FLAGS, *PHACK_FLAGS;
  15. // just don't want to pass more than this as a flag.
  16. // if this ever fires, make the above a pointer....
  17. C_ASSERT(sizeof(HACK_FLAGS) == sizeof(ULONG));
  18. #define CDROM_CUE_SHEET_ADDRESS_START_TIME 0x01
  19. #define CDROM_CUE_SHEET_ADDRESS_CATALOG_CODE 0x02
  20. #define CDROM_CUE_SHEET_ADDRESS_ISRC_CODE 0x03
  21. #define CDROM_CUE_SHEET_DATA_FORM_AUDIO 0x00 // 2352 bytes per sector
  22. // 0x01 - audio w/zero data bytes?
  23. #define CDROM_CUE_SHEET_DATA_FORM_MODE1 0x01 // 2048 bytes per sector
  24. typedef struct _CDVD_BUFFER_CAPACITY {
  25. UCHAR DataLength[2];
  26. UCHAR Reserved[2];
  27. UCHAR TotalLength[4];
  28. UCHAR BlankLength[4];
  29. } CDVD_BUFFER_CAPACITY, *PCDVD_BUFFER_CAPACITY;
  30. typedef struct _CDVD_WRITE_PARAMETERS_PAGE {
  31. UCHAR PageCode : 6; // 0x05
  32. UCHAR Reserved : 1;
  33. UCHAR PSBit : 1;
  34. UCHAR PageLength; // 0x32
  35. UCHAR WriteType : 4;
  36. UCHAR TestWrite : 1;
  37. UCHAR LinkSizeValid : 1;
  38. UCHAR BufferUnderrunFreeEnabled : 1;
  39. UCHAR Reserved2 : 1;
  40. UCHAR TrackMode : 4;
  41. UCHAR Copy : 1;
  42. UCHAR FixedPacket : 1;
  43. UCHAR MultiSession :2;
  44. UCHAR DataBlockType : 4;
  45. UCHAR Reserved3 : 4;
  46. UCHAR LinkSize;
  47. UCHAR Reserved4;
  48. UCHAR HostApplicationCode : 7;
  49. UCHAR Reserved5 : 1;
  50. UCHAR SessionFormat;
  51. UCHAR Reserved6;
  52. UCHAR PacketSize[4];
  53. UCHAR AudioPauseLength[2];
  54. UCHAR Reserved7 : 7;
  55. UCHAR MediaCatalogNumberValid : 1;
  56. UCHAR MediaCatalogNumber[13];
  57. UCHAR MediaCatalogNumberZero;
  58. UCHAR MediaCatalogNumberAFrame;
  59. UCHAR Reserved8 : 7;
  60. UCHAR ISRCValid : 1;
  61. UCHAR ISRCCountry[2];
  62. UCHAR ISRCOwner[3];
  63. UCHAR ISRCRecordingYear[2];
  64. UCHAR ISRCSerialNumber[5];
  65. UCHAR ISRCZero;
  66. UCHAR ISRCAFrame;
  67. UCHAR ISRCReserved;
  68. UCHAR SubHeaderData[4];
  69. UCHAR Data[0];
  70. } CDVD_WRITE_PARAMETERS_PAGE, *PCDVD_WRITE_PARAMETERS_PAGE;
  71. DWORD
  72. BurnCommand(
  73. IN HANDLE CdromHandle,
  74. IN HANDLE IsoImageHandle,
  75. IN HACK_FLAGS HackFlags
  76. );
  77. BOOLEAN
  78. BurnThisSession(
  79. IN HANDLE CdromHandle,
  80. IN HANDLE IsoImageHandle,
  81. IN LONG NumberOfBlocks,
  82. IN LONG FirstLba
  83. );
  84. BOOLEAN
  85. CloseSession(
  86. IN HANDLE CdromHandle
  87. );
  88. BOOLEAN
  89. CloseTrack(
  90. IN HANDLE CdromHandle,
  91. IN LONG Track
  92. );
  93. BOOLEAN
  94. GetNextWritableAddress(
  95. IN HANDLE CdromHandle,
  96. IN UCHAR Track,
  97. OUT PLONG NextWritableAddress,
  98. OUT PLONG AvailableBlocks
  99. );
  100. VOID
  101. PrintBuffer(
  102. IN PVOID Buffer,
  103. IN DWORD Size
  104. );
  105. BOOLEAN
  106. SendOptimumPowerCalibration(
  107. IN HANDLE CdromHandle
  108. );
  109. BOOLEAN
  110. SendStartStopUnit(
  111. IN HANDLE CdromHandle,
  112. IN BOOLEAN Start,
  113. IN BOOLEAN Eject
  114. );
  115. BOOLEAN
  116. SetRecordingSpeed(
  117. IN HANDLE CdromHandle,
  118. IN DWORD Speed
  119. );
  120. BOOLEAN
  121. SetWriteModePage(
  122. IN HANDLE CdromHandle,
  123. IN BOOLEAN TestBurn,
  124. IN UCHAR WriteType,
  125. IN UCHAR MultiSession,
  126. IN UCHAR DataBlockType,
  127. IN UCHAR SessionFormat
  128. );
  129. BOOLEAN
  130. VerifyBlankMedia(
  131. IN HANDLE CdromHandle
  132. );
  133. BOOLEAN
  134. VerifyIsoImage(
  135. IN HANDLE IsoImageHandle,
  136. OUT PLONG NumberOfBlocks
  137. );