mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[DDK] Import missing files required for newer storage class drivers
The files are synched with WDK 10.0.19041.0 CORE-17129
This commit is contained in:
parent
5e242c5566
commit
f0ffda34da
3 changed files with 1785 additions and 0 deletions
1414
sdk/include/ddk/srbhelper.h
Normal file
1414
sdk/include/ddk/srbhelper.h
Normal file
File diff suppressed because it is too large
Load diff
241
sdk/include/ddk/storduid.h
Normal file
241
sdk/include/ddk/storduid.h
Normal file
|
@ -0,0 +1,241 @@
|
||||||
|
#ifndef _STORDUID_H_
|
||||||
|
#define _STORDUID_H_
|
||||||
|
|
||||||
|
typedef enum _DUID_MATCH_STATUS
|
||||||
|
{
|
||||||
|
DuidExactMatch = 0,
|
||||||
|
DuidSubIdMatch,
|
||||||
|
DuidNoMatch,
|
||||||
|
DuidErrorGeneral = 100,
|
||||||
|
DuidErrorMissingDuid,
|
||||||
|
DuidErrorVersionMismatch,
|
||||||
|
DuidErrorInvalidDuid,
|
||||||
|
DuidErrorInvalidDeviceIdDescSize,
|
||||||
|
DuidErrorInvalidDeviceDescSize,
|
||||||
|
DuidErrorInvalidLayoutSigSize,
|
||||||
|
DuidErrorInvalidLayoutSigVersion,
|
||||||
|
DuidErrorMaximum
|
||||||
|
} DUID_MATCH_STATUS;
|
||||||
|
|
||||||
|
#define DUID_VERSION_1 1
|
||||||
|
|
||||||
|
#define DUID_HARDWARE_IDS_ONLY 0
|
||||||
|
#define DUID_INCLUDE_SOFTWARE_IDS 1
|
||||||
|
|
||||||
|
#define DUID_MATCH_ERROR(_duid_status) ((_duid_status) >= DuidErrorGeneral ? TRUE : FALSE)
|
||||||
|
#define DUID_MATCH_SUCCESS(_duid_status) ((_duid_status) < DuidErrorGeneral ? TRUE : FALSE)
|
||||||
|
|
||||||
|
typedef struct _STORAGE_DEVICE_UNIQUE_IDENTIFIER
|
||||||
|
{
|
||||||
|
ULONG Version;
|
||||||
|
ULONG Size;
|
||||||
|
ULONG StorageDeviceIdOffset;
|
||||||
|
ULONG StorageDeviceOffset;
|
||||||
|
ULONG DriveLayoutSignatureOffset;
|
||||||
|
} STORAGE_DEVICE_UNIQUE_IDENTIFIER, *PSTORAGE_DEVICE_UNIQUE_IDENTIFIER;
|
||||||
|
|
||||||
|
typedef struct _STORAGE_DEVICE_LAYOUT_SIGNATURE
|
||||||
|
{
|
||||||
|
ULONG Version;
|
||||||
|
ULONG Size;
|
||||||
|
BOOLEAN Mbr;
|
||||||
|
union {
|
||||||
|
ULONG MbrSignature;
|
||||||
|
GUID GptDiskId;
|
||||||
|
} DeviceSpecific;
|
||||||
|
} STORAGE_DEVICE_LAYOUT_SIGNATURE, *PSTORAGE_DEVICE_LAYOUT_SIGNATURE;
|
||||||
|
|
||||||
|
inline
|
||||||
|
DUID_MATCH_STATUS
|
||||||
|
CompareStorageDuids(
|
||||||
|
_In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1,
|
||||||
|
_In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid2);
|
||||||
|
|
||||||
|
inline
|
||||||
|
DUID_MATCH_STATUS
|
||||||
|
CompareStorageDuids(
|
||||||
|
_In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid1,
|
||||||
|
_In_ PSTORAGE_DEVICE_UNIQUE_IDENTIFIER Duid2)
|
||||||
|
{
|
||||||
|
if (!Duid1 || !Duid2)
|
||||||
|
{
|
||||||
|
return DuidErrorMissingDuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->Size < sizeof(STORAGE_DEVICE_UNIQUE_IDENTIFIER) ||
|
||||||
|
Duid2->Size < sizeof(STORAGE_DEVICE_UNIQUE_IDENTIFIER))
|
||||||
|
{
|
||||||
|
return DuidErrorGeneral;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->Version != DUID_VERSION_1 || Duid2->Version != DUID_VERSION_1)
|
||||||
|
{
|
||||||
|
return DuidErrorVersionMismatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->StorageDeviceIdOffset == 0 && Duid1->StorageDeviceOffset == 0 &&
|
||||||
|
Duid1->DriveLayoutSignatureOffset == 0)
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidDuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid2->StorageDeviceIdOffset == 0 && Duid2->StorageDeviceOffset == 0 &&
|
||||||
|
Duid2->DriveLayoutSignatureOffset == 0)
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidDuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->Size == Duid2->Size)
|
||||||
|
{
|
||||||
|
if (memcmp(Duid1, Duid2, Duid1->Size) == 0)
|
||||||
|
{
|
||||||
|
return DuidExactMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->StorageDeviceIdOffset && Duid2->StorageDeviceIdOffset)
|
||||||
|
{
|
||||||
|
PSTORAGE_DEVICE_ID_DESCRIPTOR idDesc1;
|
||||||
|
PSTORAGE_DEVICE_ID_DESCRIPTOR idDesc2;
|
||||||
|
|
||||||
|
PSTORAGE_IDENTIFIER ident1;
|
||||||
|
PSTORAGE_IDENTIFIER ident2;
|
||||||
|
|
||||||
|
ULONG idx1;
|
||||||
|
ULONG idx2;
|
||||||
|
|
||||||
|
idDesc1 = (PSTORAGE_DEVICE_ID_DESCRIPTOR)((PUCHAR)Duid1 + Duid1->StorageDeviceIdOffset);
|
||||||
|
idDesc2 = (PSTORAGE_DEVICE_ID_DESCRIPTOR)((PUCHAR)Duid2 + Duid2->StorageDeviceIdOffset);
|
||||||
|
|
||||||
|
if (idDesc1->Size < sizeof(STORAGE_DEVICE_ID_DESCRIPTOR) ||
|
||||||
|
idDesc2->Size < sizeof(STORAGE_DEVICE_ID_DESCRIPTOR))
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidDeviceIdDescSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (idDesc1->Size == idDesc2->Size)
|
||||||
|
{
|
||||||
|
if (memcmp(idDesc1, idDesc2, idDesc1->Size) == 0)
|
||||||
|
{
|
||||||
|
return DuidSubIdMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ident1 = (PSTORAGE_IDENTIFIER)(idDesc1->Identifiers);
|
||||||
|
|
||||||
|
for (idx1 = 0; idx1 < idDesc1->NumberOfIdentifiers; idx1++)
|
||||||
|
{
|
||||||
|
if ((ident1->Type == StorageIdTypeScsiNameString || ident1->Type == StorageIdTypeFCPHName ||
|
||||||
|
ident1->Type == StorageIdTypeEUI64 || ident1->Type == StorageIdTypeVendorId) &&
|
||||||
|
(ident1->Association == StorageIdAssocPort) &&
|
||||||
|
(ident1->CodeSet == StorageIdCodeSetUtf8 || ident1->CodeSet == StorageIdCodeSetAscii ||
|
||||||
|
ident1->CodeSet == StorageIdCodeSetBinary))
|
||||||
|
{
|
||||||
|
ident2 = (PSTORAGE_IDENTIFIER)(idDesc2->Identifiers);
|
||||||
|
|
||||||
|
for (idx2 = 0; idx2 < idDesc2->NumberOfIdentifiers; idx2++)
|
||||||
|
{
|
||||||
|
if (ident1->Type == ident2->Type && ident1->Association == ident2->Association &&
|
||||||
|
ident1->CodeSet == ident2->CodeSet &&
|
||||||
|
ident1->IdentifierSize == ident2->IdentifierSize &&
|
||||||
|
(memcmp(ident1->Identifier, ident2->Identifier, ident1->IdentifierSize) == 0))
|
||||||
|
{
|
||||||
|
return DuidSubIdMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
ident2 = (PSTORAGE_IDENTIFIER)((PUCHAR)ident2 + ident2->NextOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ident1 = (PSTORAGE_IDENTIFIER)((PUCHAR)ident1 + ident1->NextOffset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->StorageDeviceOffset && Duid2->StorageDeviceOffset)
|
||||||
|
{
|
||||||
|
PSTORAGE_DEVICE_DESCRIPTOR desc1;
|
||||||
|
PSTORAGE_DEVICE_DESCRIPTOR desc2;
|
||||||
|
|
||||||
|
desc1 = (PSTORAGE_DEVICE_DESCRIPTOR)((PUCHAR)Duid1 + Duid1->StorageDeviceOffset);
|
||||||
|
desc2 = (PSTORAGE_DEVICE_DESCRIPTOR)((PUCHAR)Duid2 + Duid2->StorageDeviceOffset);
|
||||||
|
|
||||||
|
if (desc1->Size < sizeof(STORAGE_DEVICE_DESCRIPTOR) ||
|
||||||
|
desc2->Size < sizeof(STORAGE_DEVICE_DESCRIPTOR))
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidDeviceDescSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desc1->Size == desc2->Size)
|
||||||
|
{
|
||||||
|
if (memcmp(desc1, desc2, desc1->Size) == 0)
|
||||||
|
{
|
||||||
|
return DuidSubIdMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desc1->SerialNumberOffset && desc2->SerialNumberOffset)
|
||||||
|
{
|
||||||
|
const char *string1;
|
||||||
|
const char *string2;
|
||||||
|
|
||||||
|
string1 = (const char *)((PUCHAR)desc1 + desc1->SerialNumberOffset);
|
||||||
|
string2 = (const char *)((PUCHAR)desc2 + desc2->SerialNumberOffset);
|
||||||
|
|
||||||
|
if (strcmp(string1, string2) == 0)
|
||||||
|
{
|
||||||
|
if (desc1->VendorIdOffset && desc2->VendorIdOffset)
|
||||||
|
{
|
||||||
|
string1 = (const char *)((PUCHAR)desc1 + desc1->VendorIdOffset);
|
||||||
|
string2 = (const char *)((PUCHAR)desc2 + desc2->VendorIdOffset);
|
||||||
|
|
||||||
|
if (strcmp(string1, string2) != 0)
|
||||||
|
{
|
||||||
|
return DuidNoMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (desc1->ProductIdOffset && desc2->ProductIdOffset)
|
||||||
|
{
|
||||||
|
string1 = (const char *)((PUCHAR)desc1 + desc1->ProductIdOffset);
|
||||||
|
string2 = (const char *)((PUCHAR)desc2 + desc2->ProductIdOffset);
|
||||||
|
|
||||||
|
if (strcmp(string1, string2) != 0)
|
||||||
|
{
|
||||||
|
return DuidNoMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DuidSubIdMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Duid1->DriveLayoutSignatureOffset && Duid2->DriveLayoutSignatureOffset)
|
||||||
|
{
|
||||||
|
PSTORAGE_DEVICE_LAYOUT_SIGNATURE sig1;
|
||||||
|
PSTORAGE_DEVICE_LAYOUT_SIGNATURE sig2;
|
||||||
|
|
||||||
|
sig1 = (PSTORAGE_DEVICE_LAYOUT_SIGNATURE)((PUCHAR)Duid1 + Duid1->DriveLayoutSignatureOffset);
|
||||||
|
sig2 = (PSTORAGE_DEVICE_LAYOUT_SIGNATURE)((PUCHAR)Duid2 + Duid2->DriveLayoutSignatureOffset);
|
||||||
|
|
||||||
|
if (sig1->Version != DUID_VERSION_1 && sig2->Version != DUID_VERSION_1)
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidLayoutSigVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sig1->Size < sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE) ||
|
||||||
|
sig2->Size < sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE))
|
||||||
|
{
|
||||||
|
return DuidErrorInvalidLayoutSigSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (memcmp(sig1, sig2, sizeof(STORAGE_DEVICE_LAYOUT_SIGNATURE)) == 0)
|
||||||
|
{
|
||||||
|
return DuidSubIdMatch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return DuidNoMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* _STORDUID_H_ */
|
130
sdk/include/ddk/storswtr.h
Normal file
130
sdk/include/ddk/storswtr.h
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
#ifndef _STORSWTR_H_
|
||||||
|
#define _STORSWTR_H_
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#ifdef TRACE_LEVEL_FATAL
|
||||||
|
#undef TRACE_LEVEL_FATAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRACE_LEVEL_ERROR
|
||||||
|
#undef TRACE_LEVEL_ERROR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRACE_LEVEL_WARNING
|
||||||
|
#undef TRACE_LEVEL_WARNING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRACE_LEVEL_INFORMATION
|
||||||
|
#undef TRACE_LEVEL_INFORMATION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TRACE_LEVEL_VERBOSE
|
||||||
|
#undef TRACE_LEVEL_VERBOSE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define TRACE_LEVEL_FATAL 1
|
||||||
|
#define TRACE_LEVEL_ERROR 2
|
||||||
|
#define TRACE_LEVEL_WARNING 3
|
||||||
|
#define TRACE_LEVEL_INFORMATION 4
|
||||||
|
#define TRACE_LEVEL_VERBOSE 5
|
||||||
|
|
||||||
|
// if defined, uses KdPrint instead of WMI tracing
|
||||||
|
#ifndef DEBUG_USE_KDPRINT
|
||||||
|
|
||||||
|
#define WPP_NORMAL_FLAGS WPP_DEFINE_BIT(TRACE_FLAG_GENERAL) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_PNP) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_POWER) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_RW) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_IOCTL) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_QUEUE) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_WMI) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_TIMER) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_INIT) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_LOCK) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_DEBUG1) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_DEBUG2) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_MCN) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_ISR) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_ENUM) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_LOGOTEST) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_DUMP) \
|
||||||
|
WPP_DEFINE_BIT(TRACE_FLAG_SCSI)
|
||||||
|
|
||||||
|
#define WPP_CONTROL_GUIDS_NORMAL_FLAGS(_GUID) \
|
||||||
|
WPP_DEFINE_CONTROL_GUID(wppCtlGuid, _GUID, WPP_NORMAL_FLAGS)
|
||||||
|
|
||||||
|
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \
|
||||||
|
(WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl)
|
||||||
|
#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) WPP_LEVEL_LOGGER(flags)
|
||||||
|
|
||||||
|
#define DEBUG_USE_WPP
|
||||||
|
|
||||||
|
#else // DEBUG_USE_KDPRINT
|
||||||
|
|
||||||
|
#ifdef DEBUG_USE_WPP
|
||||||
|
#undef DEBUG_USE_WPP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WPP_INIT_TRACING
|
||||||
|
#undef WPP_INIT_TRACING
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WPP_CLEANUP
|
||||||
|
#undef WPP_CLEANUP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WPP_INIT_TRACING(_DRIVER, _REGISTRY)
|
||||||
|
#define WPP_CLEANUP(_DRIVER)
|
||||||
|
|
||||||
|
typedef enum _DEBUG_FLAGS {
|
||||||
|
TRACE_FLAG_GENERAL = 0,
|
||||||
|
TRACE_FLAG_PNP,
|
||||||
|
TRACE_FLAG_POWER,
|
||||||
|
TRACE_FLAG_RW,
|
||||||
|
TRACE_FLAG_IOCTL,
|
||||||
|
TRACE_FLAG_QUEUE,
|
||||||
|
TRACE_FLAG_WMI,
|
||||||
|
TRACE_FLAG_TIMER,
|
||||||
|
TRACE_FLAG_INIT,
|
||||||
|
TRACE_FLAG_LOCK,
|
||||||
|
TRACE_FLAG_DEBUG1,
|
||||||
|
TRACE_FLAG_DEBUG2,
|
||||||
|
TRACE_FLAG_MCN,
|
||||||
|
TRACE_FLAG_ISR,
|
||||||
|
TRACE_FLAG_ENUM,
|
||||||
|
TRACE_FLAG_LOGOTEST,
|
||||||
|
TRACE_FLAG_DUMP,
|
||||||
|
TRACE_FLAG_SCSI
|
||||||
|
} DEBUG_FLAGS, *PDEBUG_FLAGS;
|
||||||
|
|
||||||
|
#if DBG && (NTDDI_VERSION >= NTDDI_WINXP)
|
||||||
|
|
||||||
|
#define TracePrint(x) StorDebugPrint x
|
||||||
|
|
||||||
|
#if DEBUG_MAIN_SOURCE
|
||||||
|
|
||||||
|
void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
UNREFERENCED_PARAMETER(DebugPrintFlags);
|
||||||
|
va_start(ap, DebugMessage);
|
||||||
|
vDbgPrintEx(DEBUG_COMP_ID, DebugPrintLevel, DebugMessage, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
void StorDebugPrint(int DebugPrintLevel, DEBUG_FLAGS DebugPrintFlags, PCCHAR DebugMessage, ...);
|
||||||
|
|
||||||
|
#endif // DEBUG_MAIN_SOURCE
|
||||||
|
|
||||||
|
#else // DBG && (NTDDI_VERSION >= NTDDI_WINXP)
|
||||||
|
|
||||||
|
#define TracePrint(x)
|
||||||
|
|
||||||
|
#endif // DBG && (NTDDI_VERSION >= NTDDI_WINXP)
|
||||||
|
|
||||||
|
#endif // DEBUG_USE_KDPRINT
|
||||||
|
|
||||||
|
#endif // _STORSWTR_H_
|
Loading…
Add table
Add a link
Reference in a new issue