]> FriiDump Source - friidump.git/blob - libfriidump/xbox_ref/scsi_structs.h
PFES-REPO-008: Import FriiDump 0.5.3.5 Project Frankenstein baseline
[friidump.git] / libfriidump / xbox_ref / scsi_structs.h
1 #ifndef SCSI_STRUCTS_H
2 #define SCSI_STRUCTS_H
3
4 #include <windows.h>
5 #include <stdint.h>
6
7 // Force the compiler to NOT add padding bytes
8 #pragma pack(push, 8)
9
10 typedef struct _SCSI_PASS_THROUGH {
11     uint16_t Length;
12     uint8_t  ScsiStatus;
13     uint8_t  PathId;
14     uint8_t  TargetId;
15     uint8_t  Lun;
16     uint8_t  CdbLength;
17     uint8_t  SenseInfoLength;
18     uint8_t  DataIn;
19     uint32_t DataTransferLength;
20     uint32_t TimeOutValue;
21     uint32_t DataBufferOffset;
22     uint32_t SenseInfoOffset;
23     uint8_t  Cdb[16];
24 } SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH;
25
26 typedef struct _SCSI_PASS_THROUGH_DIRECT {
27     uint16_t Length;
28     uint8_t  ScsiStatus;
29     uint8_t  PathId;
30     uint8_t  TargetId;
31     uint8_t  Lun;
32     uint8_t  CdbLength;
33     uint8_t  SenseInfoLength;
34     uint8_t  DataIn;
35     uint32_t DataTransferLength;
36     uint32_t TimeOutValue;
37     void* DataBuffer;
38     uint32_t SenseInfoOffset;
39     uint8_t  Cdb[16];
40 } SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
41
42 typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER {
43     SCSI_PASS_THROUGH_DIRECT Spt;
44     uint32_t Filler;
45     uint8_t  SenseBuf[32]; // Note: Ensure your code uses SenseBuf, not SenseBuffer
46 } SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER;
47
48 #pragma pack(pop)
49
50 // Manually define SCSI constants if headers are missing
51
52 #ifndef IOCTL_SCSI_PASS_THROUGH_DIRECT
53 #define IOCTL_SCSI_PASS_THROUGH_DIRECT 0x4D014
54 #endif
55
56 #ifndef IOCTL_SCSI_PASS_THROUGH
57 #define IOCTL_SCSI_PASS_THROUGH 0x0004D004
58 #endif
59
60 #ifndef SCSI_IOCTL_DATA_OUT
61 #define SCSI_IOCTL_DATA_OUT 0
62 #endif
63
64 #ifndef SCSI_IOCTL_DATA_IN
65 #define SCSI_IOCTL_DATA_IN 1
66 #endif
67
68 #ifndef SCSI_IOCTL_DATA_UNSPECIFIED
69 #define SCSI_IOCTL_DATA_UNSPECIFIED 2
70 #endif
71
72 #ifndef FSCTL_LOCK_VOLUME
73 #define FSCTL_LOCK_VOLUME 0x00090018
74 #endif
75 #ifndef FSCTL_DISMOUNT_VOLUME
76 #define FSCTL_DISMOUNT_VOLUME 0x00090020
77 #endif
78
79 #ifndef FSCTL_UNLOCK_VOLUME
80 #define FSCTL_UNLOCK_VOLUME 0x0009001c
81 #endif
82
83 #endif