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.

113 lines
2.1 KiB

  1. #ifndef __CDDUMP_COMMON_H__
  2. #define __CDDUMP_COMMON_H__
  3. //
  4. // these headers are order-dependent
  5. //
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <assert.h>
  9. #include <windows.h>
  10. #include <devioctl.h>
  11. #include <ntddcdrm.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif // __cplusplus
  15. #define STATUS_SUCCESS ( 0 )
  16. #define RAW_SECTOR_SIZE ( 2352 )
  17. #define SAMPLES_PER_SECTOR ( RAW_SECTOR_SIZE / sizeof(SAMPLE) )
  18. #define REDBOOK_INACCURACY ( 75 )
  19. #define TRY
  20. #define LEAVE goto __label;
  21. #define FINALLY __label:
  22. ////////////////////////////////////////////////////////////////////////////////
  23. #define LBA_TO_MSF(Lba,Minutes,Seconds,Frames) \
  24. { \
  25. (Minutes) = (UCHAR)(Lba / (60 * 75)); \
  26. (Seconds) = (UCHAR)((Lba % (60 * 75)) / 75); \
  27. (Frames) = (UCHAR)((Lba % (60 * 75)) % 75); \
  28. }
  29. #define MSF_TO_LBA(Minutes,Seconds,Frames) \
  30. (ULONG)((60 * 75 * (Minutes) ) + (75 * (Seconds)) + ((Frames) - 150))
  31. ////////////////////////////////////////////////////////////////////////////////
  32. typedef struct _SAMPLE {
  33. union {
  34. UCHAR Data[4];
  35. struct {
  36. SHORT Left;
  37. SHORT Right;
  38. };
  39. };
  40. ULONG32 AsUlong32;
  41. } SAMPLE, *PSAMPLE;
  42. ////////////////////////////////////////////////////////////////////////////////
  43. PCDROM_TOC
  44. CddumpGetToc(
  45. HANDLE device
  46. );
  47. ULONG
  48. CDDB_ID(
  49. PCDROM_TOC toc
  50. );
  51. ULONG32
  52. CddumpDumpLba(
  53. HANDLE CdromHandle,
  54. HANDLE OutHandle,
  55. ULONG StartAddress,
  56. ULONG EndAddress
  57. );
  58. ULONG32
  59. DumpWavHeader(
  60. HANDLE OutFile,
  61. ULONG32 Samples,
  62. ULONG32 SamplesPerSecond,
  63. USHORT Channels,
  64. USHORT BitsPerSample
  65. );
  66. VOID
  67. ReadWavHeader(
  68. HANDLE InFile
  69. );
  70. #if DBG
  71. extern LONG DebugLevel;
  72. #define DebugPrint(x) CddumpDebugPrint x
  73. VOID
  74. __cdecl
  75. CddumpDebugPrint(
  76. LONG DebugPrintLevel,
  77. PCHAR DebugMessage,
  78. ...
  79. );
  80. #else
  81. #define DebugPrint
  82. #endif
  83. ////////////////////////////////////////////////////////////////////////////////
  84. #ifdef __cplusplus
  85. }
  86. #endif // __cplusplus
  87. #endif // __CDDUMP_COMMON_H__