-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathstorpor8.c
2044 lines (1762 loc) · 78.3 KB
/
storpor8.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#undef __STDC_WANT_SECURE_LIB__
#define __STDC_WANT_SECURE_LIB__ 0
//#define STORPORT_W8
#include <ntddk.h>
#include "common.h"
#include "wrk2003.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _STORPORT_FUNCTION_CODE_W10 {
///////////////////////////////////////////
// Windows 2003
ExtFunctionAllocatePool,
ExtFunctionFreePool,
ExtFunctionAllocateMdl,
ExtFunctionFreeMdl,
ExtFunctionBuildMdlForNonPagedPool,
ExtFunctionGetSystemAddress,
ExtFunctionGetOriginalMdl,
ExtFunctionCompleteServiceIrp,
ExtFunctionGetDeviceObjects,
ExtFunctionBuildScatterGatherList,
ExtFunctionPutScatterGatherList,
///////////////////////////////////////////
// Vista
ExtFunctionAcquireMSISpinLock,
ExtFunctionReleaseMSISpinLock,
ExtFunctionGetMessageInterruptInformation,
ExtFunctionInitializePerformanceOptimizations,
ExtFunctionGetStartIoPerformanceParameters,
///////////////////////////////////////////
// Windows 7
ExtFunctionLogSystemEvent,
ExtFunctionGetCurrentProcessorNumber,
ExtFunctionGetActiveGroupCount,
ExtFunctionGetGroupAffinity,
ExtFunctionGetActiveNodeCount,
ExtFunctionGetNodeAffinity,
ExtFunctionGetHighestNodeNumber,
ExtFunctionGetLogicalProcessorRelationship,
ExtFunctionAllocateContiguousMemorySpecifyCacheNode,
ExtFunctionFreeContiguousMemorySpecifyCache, // 25
///////////////////////////////////////////
// Windows 8
ExtFunctionSetPowerSettingNotificationGuids, // +
ExtFunctionInvokeAcpiMethod, // +
ExtFunctionGetRequestInfo,
ExtFunctionInitializeWorker,
ExtFunctionQueueWorkItem,
ExtFunctionFreeWorker,
ExtFunctionInitializeTimer, // +
ExtFunctionRequestTimer, // +
ExtFunctionFreeTimer, // +
ExtFunctionInitializeSListHead,
ExtFunctionInterlockedFlushSList,
ExtFunctionInterlockedPopEntrySList,
ExtFunctionInterlockedPushEntrySList,
ExtFunctionQueryDepthSList,
ExtFunctionGetActivityId, // +
ExtFunctionGetSystemPortNumber,
ExtFunctionGetDataInBufferMdl,
ExtFunctionGetDataInBufferSystemAddress,
ExtFunctionGetDataInBufferScatterGatherList,
ExtFunctionMarkDumpMemory, // +
ExtFunctionSetUnitAttributes, // +
ExtFunctionQueryPerformanceCounter, // +
ExtFunctionInitializePoFxPower, // +
ExtFunctionPoFxActivateComponent, // +
ExtFunctionPoFxIdleComponent, // +
ExtFunctionPoFxSetComponentLatency, // +
ExtFunctionPoFxSetComponentResidency, // +
ExtFunctionPoFxPowerControl, // +
ExtFunctionFlushDataBufferMdl,
ExtFunctionDeviceOperationAllowed, // +
///////////////////////////////////////////
// Windows 8.1
ExtFunctionGetProcessorIndexFromNumber, // 56 - available in Win7
ExtFunctionPoFxSetIdleTimeout,
ExtFunctionMiniportEtwEvent2,
ExtFunctionMiniportEtwEvent4,
ExtFunctionMiniportEtwEvent8,
ExtFunctionCurrentOsInstallationUpgrade,
///////////////////////////////////////////
// Windows 10
ExtFunctionRegistryReadAdapterKey,
ExtFunctionRegistryWriteAdapterKey,
ExtFunctionSetAdapterBusType,
ExtFunctionPoFxRegisterPerfStates,
ExtFunctionPoFxSetPerfState,
ExtFunctionGetD3ColdSupport, // 67
ExtFunctionInitializeRpmb,
ExtFunctionAllocateHmb,
ExtFunctionFreeHmb,
ExtFunctionPropagateIrpExtension,
ExtFunctionInterlockedInsertHeadList,
ExtFunctionInterlockedInsertTailList,
ExtFunctionInterlockedRemoveHeadList,
ExtFunctionInitializeSpinlock,
ExtFunctionGetPfns,
ExtFunctionInitializeCryptoEngine,
ExtFunctionGetRequestCryptoInfo,
ExtFunctionMiniportTelemetry
} STORPORT_FUNCTION_CODE, *PSTORPORT_FUNCTION_CODE;
#define STOR_STATUS_SUCCESS (0x00000000L)
#define STOR_STATUS_UNSUCCESSFUL (0xC1000001L)
#define STOR_STATUS_NOT_IMPLEMENTED (0xC1000002L)
#define STOR_STATUS_INSUFFICIENT_RESOURCES (0xC1000003L)
#define STOR_STATUS_BUFFER_TOO_SMALL (0xC1000004L)
#define STOR_STATUS_ACCESS_DENIED (0xC1000005L)
#define STOR_STATUS_INVALID_PARAMETER (0xC1000006L)
#define STOR_STATUS_INVALID_DEVICE_REQUEST (0xC1000007L)
#define STOR_STATUS_INVALID_IRQL (0xC1000008L)
#define STOR_STATUS_INVALID_DEVICE_STATE (0xC1000009L)
#define STOR_STATUS_INVALID_BUFFER_SIZE (0xC100000AL)
#define STOR_STATUS_UNSUPPORTED_VERSION (0xC100000BL)
#define STOR_STATUS_BUSY (0xC100000CL)
#define IOCTL_ACPI_ASYNC_EVAL_METHOD \
CTL_CODE(FILE_DEVICE_ACPI, 0, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
///////////////////////////////////////////
// storport.lib
ULONG
StorPortInitialize (
PVOID Argument1,
PVOID Argument2,
struct _HW_INITIALIZATION_DATA *HwInitializationData,
PVOID HwContext );
BOOLEAN
StorPortRegistryRead (
PVOID HwDeviceExtension,
PUCHAR ValueName,
ULONG Global,
ULONG Type,
PUCHAR Buffer,
PULONG BufferLength );
ULONG
StorPortExtendedFunction (
STORPORT_FUNCTION_CODE FunctionCode,
PVOID HwDeviceExtension,
... );
// storport.lib
///////////////////////////////////////////
enum _STOR_SYNCHRONIZATION_MODEL
{
StorSynchronizeHalfDuplex = 0,
StorSynchronizeFullDuplex = 1
};
enum _INTERRUPT_SYNCHRONIZATION_MODE
{
InterruptSupportNone = 0,
InterruptSynchronizeAll = 1,
InterruptSynchronizePerMessage = 2
};
enum _RAID_OBJECT_TYPE
{
RaidUnknownObject = -1,
RaidAdapterObject = 0,
RaidUnitObject = 1,
RaidDriverObject = 2
};
enum _DEVICE_STATE
{
DeviceStateNotPresent = 0,
DeviceStateWorking = 1,
DeviceStateStopped = 2,
DeviceStatePendingStop = 3,
DeviceStatePendingRemove = 4,
DeviceStateSurpriseRemoval = 5,
DeviceStateDeleted = 6,
DeviceStateDisabled = 7,
DeviceStateNoResource = 8
};
typedef struct _STOR_SCSI_ADDRESS
{
unsigned char PathId;
unsigned char TargetId;
unsigned char Lun;
unsigned char Reserved;
} STOR_SCSI_ADDRESS;
typedef struct _ACCESS_RANGE // Size=0x10
{
union _LARGE_INTEGER RangeStart; // Offset=0x0 Size=0x8
unsigned long RangeLength; // Offset=0x8 Size=0x4
unsigned char RangeInMemory; // Offset=0xc Size=0x1
unsigned char __endalign[3]; // Offset=0xd Size=0x3
} ACCESS_RANGE;
#if defined(_X86_)
typedef struct _STOR_ADDR_BTL8// Size=0xc
{
unsigned short Type;// Offset=0x0 Size=0x2
unsigned short Port;// Offset=0x2 Size=0x2
unsigned long AddressLength;// Offset=0x4 Size=0x4
unsigned char Path;// Offset=0x8 Size=0x1
unsigned char Target;// Offset=0x9 Size=0x1
unsigned char Lun;// Offset=0xa Size=0x1
unsigned char Reserved;// Offset=0xb Size=0x1
} STOR_ADDR_BTL8, *PSTOR_ADDR_BTL8;
typedef struct _STOR_ADDRESS// Size=0xc
{
unsigned short Type;// Offset=0x0 Size=0x2
unsigned short Port;// Offset=0x2 Size=0x2
unsigned long AddressLength;// Offset=0x4 Size=0x4
unsigned char AddressData[1];// Offset=0x8 Size=0x1
} STOR_ADDRESS, *PSTOR_ADDRESS;
typedef struct _STOR_LOCKED_LIST // Size=0x10
{
KSPIN_LOCK Lock; // Offset=0x0 Size=0x4
struct _LIST_ENTRY List; // Offset=0x4 Size=0x8
unsigned long Count; // Offset=0xc Size=0x4
} STOR_LOCKED_LIST;
typedef struct _STOR_DICTIONARY // Size=0x1c
{
unsigned long EntryCount; // Offset=0x0 Size=0x4
unsigned long MaxEntryCount; // Offset=0x4 Size=0x4
enum _POOL_TYPE PoolType; // Offset=0x8 Size=0x4
struct _LIST_ENTRY *Entries; // Offset=0xc Size=0x4
void *(*GetKeyRoutine)(struct _LIST_ENTRY *);// Offset=0x10 Size=0x4
long (*CompareKeyRoutine)(void *, void *); // Offset=0x14 Size=0x4
unsigned long (*HashKeyRoutine)(void *); // Offset=0x18 Size=0x4
} STOR_DICTIONARY;
typedef struct _RAID_RESOURCE_LIST // Size=0x8
{
struct _CM_RESOURCE_LIST *AllocatedResources; // Offset=0x0 Size=0x4
struct _CM_RESOURCE_LIST *TranslatedResources; // Offset=0x4 Size=0x4
} RAID_RESOURCE_LIST;
typedef struct _MEMORY_REGION // Size=0x18
{
unsigned char *VirtualBase; // Offset=0x0 Size=0x4
unsigned char __align0[4]; // Offset=0x4 Size=0x4
PHYSICAL_ADDRESS PhysicalBase; // Offset=0x8 Size=0x8
unsigned long Length; // Offset=0x10 Size=0x4
unsigned char __endalign[4]; // Offset=0x14 Size=0x4
} MEMORY_REGION;
typedef struct _RAID_BUS_INTERFACE // Size=0x24
{
unsigned char Initialized; // Offset=0x0 Size=0x1
unsigned char __align0[3]; // Offset=0x1 Size=0x3
struct _BUS_INTERFACE_STANDARD Interface; // Offset=0x4 Size=0x20
} RAID_BUS_INTERFACE;
#ifndef STORPORT_W8
///////////////////////////////////////////////////////////////////
// Win7 storport //
typedef struct _RAID_POWER_STATE // Size=0xc
{
enum _SYSTEM_POWER_STATE SystemState; // Offset=0x0 Size=0x4
enum _DEVICE_POWER_STATE DeviceState; // Offset=0x4 Size=0x4
unsigned char SystemPoweringDown; // Offset=0x8 Size=0x1
unsigned char __endalign[3]; // Offset=0x9 Size=0x3
} RAID_POWER_STATE;
typedef struct _PORT_CONFIGURATION_INFORMATION // Size=0xc0
{
unsigned long Length;// Offset=0x0 Size=0x4
unsigned long SystemIoBusNumber;// Offset=0x4 Size=0x4
enum _INTERFACE_TYPE AdapterInterfaceType;// Offset=0x8 Size=0x4
unsigned long BusInterruptLevel;// Offset=0xc Size=0x4
unsigned long BusInterruptVector;// Offset=0x10 Size=0x4
enum _KINTERRUPT_MODE InterruptMode;// Offset=0x14 Size=0x4
unsigned long MaximumTransferLength;// Offset=0x18 Size=0x4
unsigned long NumberOfPhysicalBreaks;// Offset=0x1c Size=0x4
unsigned long DmaChannel;// Offset=0x20 Size=0x4
unsigned long DmaPort;// Offset=0x24 Size=0x4
enum _DMA_WIDTH DmaWidth;// Offset=0x28 Size=0x4
enum _DMA_SPEED DmaSpeed;// Offset=0x2c Size=0x4
unsigned long AlignmentMask;// Offset=0x30 Size=0x4
unsigned long NumberOfAccessRanges;// Offset=0x34 Size=0x4
ACCESS_RANGE (*AccessRanges)[];// Offset=0x38 Size=0x4
void *Reserved;// Offset=0x3c Size=0x4
unsigned char NumberOfBuses;// Offset=0x40 Size=0x1
char InitiatorBusId[8];// Offset=0x41 Size=0x8
unsigned char ScatterGather;// Offset=0x49 Size=0x1
unsigned char Master;// Offset=0x4a Size=0x1
unsigned char CachesData;// Offset=0x4b Size=0x1
unsigned char AdapterScansDown;// Offset=0x4c Size=0x1
unsigned char AtdiskPrimaryClaimed;// Offset=0x4d Size=0x1
unsigned char AtdiskSecondaryClaimed;// Offset=0x4e Size=0x1
unsigned char Dma32BitAddresses;// Offset=0x4f Size=0x1
unsigned char DemandMode;// Offset=0x50 Size=0x1
unsigned char MapBuffers;// Offset=0x51 Size=0x1
unsigned char NeedPhysicalAddresses;// Offset=0x52 Size=0x1
unsigned char TaggedQueuing;// Offset=0x53 Size=0x1
unsigned char AutoRequestSense;// Offset=0x54 Size=0x1
unsigned char MultipleRequestPerLu;// Offset=0x55 Size=0x1
unsigned char ReceiveEvent;// Offset=0x56 Size=0x1
unsigned char RealModeInitialized;// Offset=0x57 Size=0x1
unsigned char BufferAccessScsiPortControlled;// Offset=0x58 Size=0x1
unsigned char MaximumNumberOfTargets;// Offset=0x59 Size=0x1
unsigned char ReservedUchars[2];// Offset=0x5a Size=0x2
unsigned long SlotNumber;// Offset=0x5c Size=0x4
unsigned long BusInterruptLevel2;// Offset=0x60 Size=0x4
unsigned long BusInterruptVector2;// Offset=0x64 Size=0x4
enum _KINTERRUPT_MODE InterruptMode2;// Offset=0x68 Size=0x4
unsigned long DmaChannel2;// Offset=0x6c Size=0x4
unsigned long DmaPort2;// Offset=0x70 Size=0x4
enum _DMA_WIDTH DmaWidth2;// Offset=0x74 Size=0x4
enum _DMA_SPEED DmaSpeed2;// Offset=0x78 Size=0x4
unsigned long DeviceExtensionSize;// Offset=0x7c Size=0x4
unsigned long SpecificLuExtensionSize;// Offset=0x80 Size=0x4
unsigned long SrbExtensionSize;// Offset=0x84 Size=0x4
unsigned char Dma64BitAddresses;// Offset=0x88 Size=0x1
unsigned char ResetTargetSupported;// Offset=0x89 Size=0x1
unsigned char MaximumNumberOfLogicalUnits;// Offset=0x8a Size=0x1
unsigned char WmiDataProvider;// Offset=0x8b Size=0x1
enum _STOR_SYNCHRONIZATION_MODEL SynchronizationModel;// Offset=0x8c Size=0x4
unsigned char ( *HwMSInterruptRoutine)(void *,unsigned long );// Offset=0x90 Size=0x4
enum _INTERRUPT_SYNCHRONIZATION_MODE InterruptSynchronizationMode;// Offset=0x94 Size=0x4
struct _MEMORY_REGION DumpRegion;// Offset=0x98 Size=0x18
unsigned long RequestedDumpBufferSize;// Offset=0xb0 Size=0x4
unsigned char VirtualDevice;// Offset=0xb4 Size=0x1
unsigned char __align0[3];// Offset=0xb5 Size=0x3
unsigned long ExtendedFlags1;// Offset=0xb8 Size=0x4
unsigned long MaxNumberOfIO;// Offset=0xbc Size=0x4
} PORT_CONFIGURATION_INFORMATION;
struct _unnamed_tag1 // Size=0x1
{
unsigned char InFindAdapter:1;// Offset=0x0 Size=0x1 BitOffset=0x0 BitSize=0x1
unsigned char IsVirtual:1;// Offset=0x0 Size=0x1 BitOffset=0x1 BitSize=0x1
};
typedef struct _RAID_MINIPORT // Size=0xd8
{
struct _RAID_ADAPTER_EXTENSION *Adapter; // Offset=0x0 Size=0x4
unsigned char __align0[4]; // Offset=0x4 Size=0x4
struct _PORT_CONFIGURATION_INFORMATION PortConfiguration; // Offset=0x8 Size=0xc0
struct _HW_INITIALIZATION_DATA *HwInitializationData; // Offset=0xc8 Size=0x4
struct _RAID_HW_DEVICE_EXT *PrivateDeviceExt; // Offset=0xcc Size=0x4
struct _unnamed_tag1 Flags; // Offset=0xd0 Size=0x1
unsigned char __endalign[7]; // Offset=0xd1 Size=0x7
} RAID_MINIPORT;
struct _unnamed_tag3// Size=0x4
{
unsigned char InitializedMiniport:1;// Offset=0x0 Size=0x1 BitOffset=0x0 BitSize=0x1
unsigned char WmiMiniPortInitialized:1;// Offset=0x0 Size=0x1 BitOffset=0x1 BitSize=0x1
unsigned char WmiInitialized:1;// Offset=0x0 Size=0x1 BitOffset=0x2 BitSize=0x1
unsigned char BusInterfaceInternal:1;// Offset=0x0 Size=0x1 BitOffset=0x3 BitSize=0x1
unsigned char InHwInitialize:1;// Offset=0x0 Size=0x1 BitOffset=0x4 BitSize=0x1
unsigned char IdlePowerManagementEnabled:1;// Offset=0x0 Size=0x1 BitOffset=0x5 BitSize=0x1
unsigned char QueryAccessAlignmentEnabled:1;// Offset=0x0 Size=0x1 BitOffset=0x6 BitSize=0x1
unsigned char InvalidateBusRelations;// Offset=0x1 Size=0x1
unsigned char RescanBus;// Offset=0x2 Size=0x1
unsigned char InterruptsEnabled;// Offset=0x3 Size=0x1
};
typedef struct _RAID_ADAPTER_EXTENSION // Size=0x5e0
{
enum _RAID_OBJECT_TYPE ObjectType;// Offset=0x0 Size=0x4
struct _DEVICE_OBJECT *DeviceObject;// Offset=0x4 Size=0x4
struct _RAID_DRIVER_EXTENSION *Driver;// Offset=0x8 Size=0x4
struct _DEVICE_OBJECT *LowerDeviceObject;// Offset=0xc Size=0x4
struct _DEVICE_OBJECT *PhysicalDeviceObject;// Offset=0x10 Size=0x4
struct _UNICODE_STRING DeviceName;// Offset=0x14 Size=0x8
unsigned long PortNumber;// Offset=0x1c Size=0x4
struct _LIST_ENTRY NextAdapter;// Offset=0x20 Size=0x8
unsigned long SlowLock;// Offset=0x28 Size=0x4
enum _DEVICE_STATE DeviceState;// Offset=0x2c Size=0x4
unsigned long PagingPathCount;// Offset=0x30 Size=0x4
unsigned long CrashDumpPathCount;// Offset=0x34 Size=0x4
unsigned long HiberPathCount;// Offset=0x38 Size=0x4
struct _unnamed_tag3 Flags;// Offset=0x3c Size=0x4
struct _STOR_LOCKED_LIST UnitList;// Offset=0x40 Size=0x10
struct _STOR_DICTIONARY UnitDictionary;// Offset=0x50 Size=0x1c
struct _STOR_LOCKED_LIST ZombieList;// Offset=0x6c Size=0x10
unsigned char __align0[4];// Offset=0x7c Size=0x4
union _SLIST_HEADER CompletedList;// Offset=0x80 Size=0x8
struct _EX_RUNDOWN_REF_CACHE_AWARE *RemoveLock;// Offset=0x88 Size=0x4
struct _RAID_POWER_STATE Power;// Offset=0x8c Size=0xc
struct _RAID_RESOURCE_LIST ResourceList;// Offset=0x98 Size=0x8
struct _RAID_MINIPORT Miniport;// Offset=0xa0 Size=0xd8
struct _RAID_BUS_INTERFACE Bus;// Offset=0x178 Size=0x24
struct _KINTERRUPT *Interrupt;// Offset=0x19c Size=0x4
unsigned long InterruptIrql;// Offset=0x1a0 Size=0x4
unsigned long InterruptVersion;// Offset=0x1a4 Size=0x4
unsigned long StartIoLock;// Offset=0x1a8 Size=0x4
enum _STOR_SYNCHRONIZATION_MODEL IoModel;// Offset=0x1ac Size=0x4
// ...
} RAID_ADAPTER_EXTENSION, *PRAID_ADAPTER_EXTENSION;
#pragma warning(push)
#pragma warning(disable:4200) // HwDeviceExtension[] warning
typedef struct _RAID_HW_DEVICE_EXT // Size=0x4
{
struct _RAID_MINIPORT *Miniport; // Offset=0x0 Size=0x4
unsigned char HwDeviceExtension[]; // Offset=0x4
} RAID_HW_DEVICE_EXT;
#pragma warning(pop)
typedef struct _RAID_UNIT_EXTENSION // Size=0x2a0
{
enum _RAID_OBJECT_TYPE ObjectType;// Offset=0x0 Size=0x4
struct _DEVICE_OBJECT *DeviceObject;// Offset=0x4 Size=0x4
struct _RAID_ADAPTER_EXTENSION *Adapter;// Offset=0x8 Size=0x4
unsigned long SlowLock;// Offset=0xc Size=0x4
enum _DEVICE_STATE DeviceState;// Offset=0x10 Size=0x4
struct _LIST_ENTRY NextUnit;// Offset=0x14 Size=0x8
struct _LIST_ENTRY UnitTableLink;// Offset=0x1c Size=0x8
struct _STOR_SCSI_ADDRESS Address;// Offset=0x24 Size=0x4
//...
} RAID_UNIT_EXTENSION, *PRAID_UNIT_EXTENSION;
typedef struct _STOR_TIMER_CONTEXT // Size=0x60
{
RAID_ADAPTER_EXTENSION *Adapter; // Offset=0x0 Size=0x4
unsigned char __align0[4]; // Offset=0x4 Size=0x4
KTIMER Timer; // Offset=0x8 Size=0x28
KDPC TimerDpc; // Offset=0x30 Size=0x20
void (*Callback)(void *, void *); // Offset=0x50 Size=0x4
void *CallbackContext; // Offset=0x54 Size=0x4
IO_WORKITEM *FreeTimerWorkItem; // Offset=0x58 Size=0x4
unsigned char __endalign[4]; // Offset=0x5c Size=0x4
} STOR_TIMER_CONTEXT;
#endif
#else // x64
typedef struct _STOR_ADDR_BTL8// Size=0x10
{
unsigned short Type;// Offset=0x0 Size=0x2
unsigned short Port;// Offset=0x2 Size=0x2
unsigned long AddressLength;// Offset=0x4 Size=0x4
unsigned char Path;// Offset=0x8 Size=0x1
unsigned char Target;// Offset=0x9 Size=0x1
unsigned char Lun;// Offset=0xa Size=0x1
unsigned char Reserved;// Offset=0xb Size=0x1
unsigned char __endalign[4];// Offset=0xc Size=0x4
} STOR_ADDR_BTL8, *PSTOR_ADDR_BTL8;
typedef struct _STOR_ADDRESS// Size=0x10
{
unsigned short Type;// Offset=0x0 Size=0x2
unsigned short Port;// Offset=0x2 Size=0x2
unsigned long AddressLength;// Offset=0x4 Size=0x4
unsigned char AddressData[1];// Offset=0x8 Size=0x1
unsigned char __endalign[7];// Offset=0x9 Size=0x7
} STOR_ADDRESS, *PSTOR_ADDRESS;
typedef struct _STOR_LOCKED_LIST // Size=0x20
{
unsigned long long Lock; // Offset=0x0 Size=0x8
struct _LIST_ENTRY List; // Offset=0x8 Size=0x10
unsigned long Count; // Offset=0x18 Size=0x4
unsigned char __endalign[4]; // Offset=0x1c Size=0x4
} STOR_LOCKED_LIST;
typedef struct _STOR_DICTIONARY // Size=0x30
{
unsigned long EntryCount; // Offset=0x0 Size=0x4
unsigned long MaxEntryCount; // Offset=0x4 Size=0x4
enum _POOL_TYPE PoolType; // Offset=0x8 Size=0x4
unsigned char __align0[4]; // Offset=0xc Size=0x4
struct _LIST_ENTRY *Entries; // Offset=0x10 Size=0x8
void *(*GetKeyRoutine)(struct _LIST_ENTRY *); // Offset=0x18 Size=0x8
long (*CompareKeyRoutine)(void *, void *); // Offset=0x20 Size=0x8
unsigned long (*HashKeyRoutine)(void *); // Offset=0x28 Size=0x8
} STOR_DICTIONARY;
typedef struct _RAID_RESOURCE_LIST // Size=0x10
{
struct _CM_RESOURCE_LIST *AllocatedResources; // Offset=0x0 Size=0x8
struct _CM_RESOURCE_LIST *TranslatedResources; // Offset=0x8 Size=0x8
} RAID_RESOURCE_LIST;
typedef struct _MEMORY_REGION // Size=0x18
{
unsigned char *VirtualBase; // Offset=0x0 Size=0x8
union _LARGE_INTEGER PhysicalBase; // Offset=0x8 Size=0x8
unsigned long Length; // Offset=0x10 Size=0x4
unsigned char __endalign[4]; // Offset=0x14 Size=0x4
} MEMORY_REGION;
typedef struct _RAID_BUS_INTERFACE // Size=0x48
{
unsigned char Initialized; // Offset=0x0 Size=0x1
unsigned char __align0[7]; // Offset=0x1 Size=0x7
struct _BUS_INTERFACE_STANDARD Interface; // Offset=0x8 Size=0x40
} RAID_BUS_INTERFACE;
#ifndef STORPORT_W8
///////////////////////////////////////////////////////////////////
// Win7 storport //
typedef struct _RAID_POWER_STATE // Size=0xc
{
enum _SYSTEM_POWER_STATE SystemState; // Offset=0x0 Size=0x4
enum _DEVICE_POWER_STATE DeviceState; // Offset=0x4 Size=0x4
unsigned char SystemPoweringDown; // Offset=0x8 Size=0x1
unsigned char __endalign[3]; // Offset=0x9 Size=0x3
} RAID_POWER_STATE;
typedef struct _PORT_CONFIGURATION_INFORMATION// Size=0xd0
{
unsigned long Length;// Offset=0x0 Size=0x4
unsigned long SystemIoBusNumber;// Offset=0x4 Size=0x4
enum _INTERFACE_TYPE AdapterInterfaceType;// Offset=0x8 Size=0x4
unsigned long BusInterruptLevel;// Offset=0xc Size=0x4
unsigned long BusInterruptVector;// Offset=0x10 Size=0x4
enum _KINTERRUPT_MODE InterruptMode;// Offset=0x14 Size=0x4
unsigned long MaximumTransferLength;// Offset=0x18 Size=0x4
unsigned long NumberOfPhysicalBreaks;// Offset=0x1c Size=0x4
unsigned long DmaChannel;// Offset=0x20 Size=0x4
unsigned long DmaPort;// Offset=0x24 Size=0x4
enum _DMA_WIDTH DmaWidth;// Offset=0x28 Size=0x4
enum _DMA_SPEED DmaSpeed;// Offset=0x2c Size=0x4
unsigned long AlignmentMask;// Offset=0x30 Size=0x4
unsigned long NumberOfAccessRanges;// Offset=0x34 Size=0x4
ACCESS_RANGE (*AccessRanges)[];// Offset=0x38 Size=0x8
void *Reserved;// Offset=0x40 Size=0x8
unsigned char NumberOfBuses;// Offset=0x48 Size=0x1
char InitiatorBusId[8];// Offset=0x49 Size=0x8
unsigned char ScatterGather;// Offset=0x51 Size=0x1
unsigned char Master;// Offset=0x52 Size=0x1
unsigned char CachesData;// Offset=0x53 Size=0x1
unsigned char AdapterScansDown;// Offset=0x54 Size=0x1
unsigned char AtdiskPrimaryClaimed;// Offset=0x55 Size=0x1
unsigned char AtdiskSecondaryClaimed;// Offset=0x56 Size=0x1
unsigned char Dma32BitAddresses;// Offset=0x57 Size=0x1
unsigned char DemandMode;// Offset=0x58 Size=0x1
unsigned char MapBuffers;// Offset=0x59 Size=0x1
unsigned char NeedPhysicalAddresses;// Offset=0x5a Size=0x1
unsigned char TaggedQueuing;// Offset=0x5b Size=0x1
unsigned char AutoRequestSense;// Offset=0x5c Size=0x1
unsigned char MultipleRequestPerLu;// Offset=0x5d Size=0x1
unsigned char ReceiveEvent;// Offset=0x5e Size=0x1
unsigned char RealModeInitialized;// Offset=0x5f Size=0x1
unsigned char BufferAccessScsiPortControlled;// Offset=0x60 Size=0x1
unsigned char MaximumNumberOfTargets;// Offset=0x61 Size=0x1
unsigned char ReservedUchars[2];// Offset=0x62 Size=0x2
unsigned long SlotNumber;// Offset=0x64 Size=0x4
unsigned long BusInterruptLevel2;// Offset=0x68 Size=0x4
unsigned long BusInterruptVector2;// Offset=0x6c Size=0x4
enum _KINTERRUPT_MODE InterruptMode2;// Offset=0x70 Size=0x4
unsigned long DmaChannel2;// Offset=0x74 Size=0x4
unsigned long DmaPort2;// Offset=0x78 Size=0x4
enum _DMA_WIDTH DmaWidth2;// Offset=0x7c Size=0x4
enum _DMA_SPEED DmaSpeed2;// Offset=0x80 Size=0x4
unsigned long DeviceExtensionSize;// Offset=0x84 Size=0x4
unsigned long SpecificLuExtensionSize;// Offset=0x88 Size=0x4
unsigned long SrbExtensionSize;// Offset=0x8c Size=0x4
unsigned char Dma64BitAddresses;// Offset=0x90 Size=0x1
unsigned char ResetTargetSupported;// Offset=0x91 Size=0x1
unsigned char MaximumNumberOfLogicalUnits;// Offset=0x92 Size=0x1
unsigned char WmiDataProvider;// Offset=0x93 Size=0x1
enum _STOR_SYNCHRONIZATION_MODEL SynchronizationModel;// Offset=0x94 Size=0x4
unsigned char ( *HwMSInterruptRoutine)(void *,unsigned long );// Offset=0x98 Size=0x8
enum _INTERRUPT_SYNCHRONIZATION_MODE InterruptSynchronizationMode;// Offset=0xa0 Size=0x4
unsigned char __align0[4];// Offset=0xa4 Size=0x4
struct _MEMORY_REGION DumpRegion;// Offset=0xa8 Size=0x18
unsigned long RequestedDumpBufferSize;// Offset=0xc0 Size=0x4
unsigned char VirtualDevice;// Offset=0xc4 Size=0x1
unsigned char __align1[3];// Offset=0xc5 Size=0x3
unsigned long ExtendedFlags1;// Offset=0xc8 Size=0x4
unsigned long MaxNumberOfIO;// Offset=0xcc Size=0x4
} PORT_CONFIGURATION_INFORMATION;
struct _unnamed_tag1// Size=0x1
{
unsigned char InFindAdapter:1;// Offset=0x0 Size=0x1 BitOffset=0x0 BitSize=0x1
};
typedef struct _RAID_MINIPORT// Size=0xf0
{
struct _RAID_ADAPTER_EXTENSION *Adapter;// Offset=0x0 Size=0x8
struct _PORT_CONFIGURATION_INFORMATION PortConfiguration;// Offset=0x8 Size=0xd0
struct _HW_INITIALIZATION_DATA *HwInitializationData;// Offset=0xd8 Size=0x8
struct _RAID_HW_DEVICE_EXT *PrivateDeviceExt;// Offset=0xe0 Size=0x8
struct _unnamed_tag1 Flags;// Offset=0xe8 Size=0x1
unsigned char __endalign[7];// Offset=0xe9 Size=0x7
} RAID_MINIPORT;
struct _unnamed_tag2// Size=0x4
{
unsigned char InitializedMiniport:1;// Offset=0x0 Size=0x1 BitOffset=0x0 BitSize=0x1
unsigned char WmiMiniPortInitialized:1;// Offset=0x0 Size=0x1 BitOffset=0x1 BitSize=0x1
unsigned char WmiInitialized:1;// Offset=0x0 Size=0x1 BitOffset=0x2 BitSize=0x1
unsigned char BusInterfaceInternal:1;// Offset=0x0 Size=0x1 BitOffset=0x3 BitSize=0x1
unsigned char InHwInitialize:1;// Offset=0x0 Size=0x1 BitOffset=0x4 BitSize=0x1
unsigned char IdlePowerManagementEnabled:1;// Offset=0x0 Size=0x1 BitOffset=0x5 BitSize=0x1
unsigned char QueryAccessAlignmentEnabled:1;// Offset=0x0 Size=0x1 BitOffset=0x6 BitSize=0x1
unsigned char InvalidateBusRelations;// Offset=0x1 Size=0x1
unsigned char RescanBus;// Offset=0x2 Size=0x1
unsigned char InterruptsEnabled;// Offset=0x3 Size=0x1
};
typedef struct _RAID_ADAPTER_EXTENSION// Size=0x990
{
enum _RAID_OBJECT_TYPE ObjectType;// Offset=0x0 Size=0x4
unsigned char __align0[4];// Offset=0x4 Size=0x4
struct _DEVICE_OBJECT *DeviceObject;// Offset=0x8 Size=0x8
struct _RAID_DRIVER_EXTENSION *Driver;// Offset=0x10 Size=0x8
struct _DEVICE_OBJECT *LowerDeviceObject;// Offset=0x18 Size=0x8
struct _DEVICE_OBJECT *PhysicalDeviceObject;// Offset=0x20 Size=0x8
struct _UNICODE_STRING DeviceName;// Offset=0x28 Size=0x10
unsigned long PortNumber;// Offset=0x38 Size=0x4
unsigned char __align1[4];// Offset=0x3c Size=0x4
struct _LIST_ENTRY NextAdapter;// Offset=0x40 Size=0x10
unsigned long long SlowLock;// Offset=0x50 Size=0x8
enum _DEVICE_STATE DeviceState;// Offset=0x58 Size=0x4
unsigned long PagingPathCount;// Offset=0x5c Size=0x4
unsigned long CrashDumpPathCount;// Offset=0x60 Size=0x4
unsigned long HiberPathCount;// Offset=0x64 Size=0x4
struct _unnamed_tag2 Flags;// Offset=0x68 Size=0x4
unsigned char __align2[4];// Offset=0x6c Size=0x4
struct _STOR_LOCKED_LIST UnitList;// Offset=0x70 Size=0x20
struct _STOR_DICTIONARY UnitDictionary;// Offset=0x90 Size=0x30
struct _STOR_LOCKED_LIST ZombieList;// Offset=0xc0 Size=0x20
union _SLIST_HEADER CompletedList;// Offset=0xe0 Size=0x10
struct _EX_RUNDOWN_REF_CACHE_AWARE *RemoveLock;// Offset=0xf0 Size=0x8
struct _RAID_POWER_STATE Power;// Offset=0xf8 Size=0xc
unsigned char __align3[4];// Offset=0x104 Size=0x4
struct _RAID_RESOURCE_LIST ResourceList;// Offset=0x108 Size=0x10
struct _RAID_MINIPORT Miniport;// Offset=0x118 Size=0xf0
struct _RAID_BUS_INTERFACE Bus;// Offset=0x208 Size=0x48
struct _KINTERRUPT *Interrupt;// Offset=0x250 Size=0x8
unsigned long InterruptIrql;// Offset=0x258 Size=0x4
unsigned char __align4[4];// Offset=0x25c Size=0x4
unsigned long long StartIoLock;// Offset=0x260 Size=0x8
enum _STOR_SYNCHRONIZATION_MODEL IoModel;// Offset=0x268 Size=0x4
// ...
} RAID_ADAPTER_EXTENSION, *PRAID_ADAPTER_EXTENSION;
#pragma warning(push)
#pragma warning(disable:4200) // HwDeviceExtension[] warning
typedef struct _RAID_HW_DEVICE_EXT// Size=0x8
{
struct _RAID_MINIPORT *Miniport;// Offset=0x0 Size=0x8
unsigned char HwDeviceExtension[]; // Offset=0x8
} RAID_HW_DEVICE_EXT;
#pragma warning(pop)
typedef struct _RAID_UNIT_EXTENSION// Size=0x480
{
enum _RAID_OBJECT_TYPE ObjectType;// Offset=0x0 Size=0x4
unsigned char __align0[4];// Offset=0x4 Size=0x4
struct _DEVICE_OBJECT *DeviceObject;// Offset=0x8 Size=0x8
struct _RAID_ADAPTER_EXTENSION *Adapter;// Offset=0x10 Size=0x8
unsigned long long SlowLock;// Offset=0x18 Size=0x8
enum _DEVICE_STATE DeviceState;// Offset=0x20 Size=0x4
unsigned char __align1[4];// Offset=0x24 Size=0x4
struct _LIST_ENTRY NextUnit;// Offset=0x28 Size=0x10
struct _LIST_ENTRY UnitTableLink;// Offset=0x38 Size=0x10
struct _STOR_SCSI_ADDRESS Address;// Offset=0x48 Size=0x4
//...
} RAID_UNIT_EXTENSION, *PRAID_UNIT_EXTENSION;
#endif
typedef struct _STOR_TIMER_CONTEXT// Size=0xa0
{
struct _RAID_ADAPTER_EXTENSION *Adapter;// Offset=0x0 Size=0x8
struct _KTIMER Timer;// Offset=0x8 Size=0x40
struct _KDPC TimerDpc;// Offset=0x48 Size=0x40
void ( *Callback)(void *,void *);// Offset=0x88 Size=0x8
void *CallbackContext;// Offset=0x90 Size=0x8
struct _IO_WORKITEM *FreeTimerWorkItem;// Offset=0x98 Size=0x8
} STOR_TIMER_CONTEXT;
#endif
#if defined(STORPORT_W8) && defined(_X86_)
///////////////////////////////////////////////////////////////////
// Win8+ storport //
typedef struct _RAID_POWER_STATE// Size=0x10
{
enum _SYSTEM_POWER_STATE SystemState; // Offset=0x0 Size=0x4
enum _DEVICE_POWER_STATE DeviceState; // Offset=0x4 Size=0x4
enum _POWER_ACTION PowerAction; // Offset=0x8 Size=0x4
unsigned char SystemPoweringDown; // Offset=0xc Size=0x1
} RAID_POWER_STATE;
typedef struct _PORT_CONFIGURATION_INFORMATION // Size=0xd0
{
unsigned long Length; // Offset=0x0 Size=0x4
unsigned long SystemIoBusNumber; // Offset=0x4 Size=0x4
enum _INTERFACE_TYPE AdapterInterfaceType; // Offset=0x8 Size=0x4
unsigned long BusInterruptLevel; // Offset=0xc Size=0x4
unsigned long BusInterruptVector; // Offset=0x10 Size=0x4
enum _KINTERRUPT_MODE InterruptMode; // Offset=0x14 Size=0x4
unsigned long MaximumTransferLength; // Offset=0x18 Size=0x4
unsigned long NumberOfPhysicalBreaks; // Offset=0x1c Size=0x4
unsigned long DmaChannel; // Offset=0x20 Size=0x4
unsigned long DmaPort; // Offset=0x24 Size=0x4
enum _DMA_WIDTH DmaWidth; // Offset=0x28 Size=0x4
enum _DMA_SPEED DmaSpeed; // Offset=0x2c Size=0x4
unsigned long AlignmentMask; // Offset=0x30 Size=0x4
unsigned long NumberOfAccessRanges; // Offset=0x34 Size=0x4
ACCESS_RANGE (*AccessRanges)[]; // Offset=0x38 Size=0x4
void *MiniportDumpData; // Offset=0x3c Size=0x4
unsigned char NumberOfBuses; // Offset=0x40 Size=0x1
char InitiatorBusId[8]; // Offset=0x41 Size=0x8
unsigned char ScatterGather; // Offset=0x49 Size=0x1
unsigned char Master; // Offset=0x4a Size=0x1
unsigned char CachesData; // Offset=0x4b Size=0x1
unsigned char AdapterScansDown; // Offset=0x4c Size=0x1
unsigned char AtdiskPrimaryClaimed; // Offset=0x4d Size=0x1
unsigned char AtdiskSecondaryClaimed; // Offset=0x4e Size=0x1
unsigned char Dma32BitAddresses; // Offset=0x4f Size=0x1
unsigned char DemandMode; // Offset=0x50 Size=0x1
unsigned char MapBuffers; // Offset=0x51 Size=0x1
unsigned char NeedPhysicalAddresses; // Offset=0x52 Size=0x1
unsigned char TaggedQueuing; // Offset=0x53 Size=0x1
unsigned char AutoRequestSense; // Offset=0x54 Size=0x1
unsigned char MultipleRequestPerLu; // Offset=0x55 Size=0x1
unsigned char ReceiveEvent; // Offset=0x56 Size=0x1
unsigned char RealModeInitialized; // Offset=0x57 Size=0x1
unsigned char BufferAccessScsiPortControlled; // Offset=0x58 Size=0x1
unsigned char MaximumNumberOfTargets; // Offset=0x59 Size=0x1
unsigned char SrbType; // Offset=0x5a Size=0x1
unsigned char AddressType; // Offset=0x5b Size=0x1
unsigned long SlotNumber; // Offset=0x5c Size=0x4
unsigned long BusInterruptLevel2; // Offset=0x60 Size=0x4
unsigned long BusInterruptVector2; // Offset=0x64 Size=0x4
enum _KINTERRUPT_MODE InterruptMode2; // Offset=0x68 Size=0x4
unsigned long DmaChannel2; // Offset=0x6c Size=0x4
unsigned long DmaPort2; // Offset=0x70 Size=0x4
enum _DMA_WIDTH DmaWidth2; // Offset=0x74 Size=0x4
enum _DMA_SPEED DmaSpeed2; // Offset=0x78 Size=0x4
unsigned long DeviceExtensionSize; // Offset=0x7c Size=0x4
unsigned long SpecificLuExtensionSize; // Offset=0x80 Size=0x4
unsigned long SrbExtensionSize; // Offset=0x84 Size=0x4
unsigned char Dma64BitAddresses; // Offset=0x88 Size=0x1
unsigned char ResetTargetSupported; // Offset=0x89 Size=0x1
unsigned char MaximumNumberOfLogicalUnits; // Offset=0x8a Size=0x1
unsigned char WmiDataProvider; // Offset=0x8b Size=0x1
enum _STOR_SYNCHRONIZATION_MODEL SynchronizationModel; // Offset=0x8c Size=0x4
unsigned char (*HwMSInterruptRoutine)(void *, unsigned long); // Offset=0x90 Size=0x4
enum _INTERRUPT_SYNCHRONIZATION_MODE InterruptSynchronizationMode; // Offset=0x94 Size=0x4
struct _MEMORY_REGION DumpRegion; // Offset=0x98 Size=0x18
unsigned long RequestedDumpBufferSize; // Offset=0xb0 Size=0x4
unsigned char VirtualDevice; // Offset=0xb4 Size=0x1
unsigned char DumpMode; // Offset=0xb5 Size=0x1
//unsigned char __align0[2]; // Offset=0xb6 Size=0x2
unsigned long ExtendedFlags1; // Offset=0xb8 Size=0x4
unsigned long MaxNumberOfIO; // Offset=0xbc Size=0x4
unsigned long MaxIOsPerLun; // Offset=0xc0 Size=0x4
unsigned long InitialLunQueueDepth; // Offset=0xc4 Size=0x4
unsigned long BusResetHoldTime; // Offset=0xc8 Size=0x4
unsigned long FeatureSupport; // Offset=0xcc Size=0x4
} PORT_CONFIGURATION_INFORMATION;
struct _UNIT_CONTROL_LIST // Size=0x10
{
unsigned long MaxControlType; // Offset=0x0 Size=0x4
unsigned char SupportedTypeList[9]; // Offset=0x4 Size=0x9
};
struct _ADAPTER_CONTROL_LIST // Size=0x14
{
unsigned long MaxControlType; // Offset=0x0 Size=0x4
unsigned char SupportedTypeList[14]; // Offset=0x4 Size=0xe
};
typedef struct _RAID_MINIPORT // Size=0x108
{
struct _RAID_ADAPTER_EXTENSION *Adapter; // Offset=0x0 Size=0x4
unsigned char __align0[4]; // Offset=0x4 Size=0x4
struct _PORT_CONFIGURATION_INFORMATION PortConfiguration; // Offset=0x8 Size=0xd0
struct _HW_INITIALIZATION_DATA *HwInitializationData; // Offset=0xd8 Size=0x4
struct _RAID_HW_DEVICE_EXT *PrivateDeviceExt; // Offset=0xdc Size=0x4
unsigned char Flags; // Offset=0xe0 Size=0x1
//unsigned char __align1[3];// Offset=0xe1 Size=0x3
struct _UNIT_CONTROL_LIST UnitControlList; // Offset=0xe4 Size=0x10
struct _ADAPTER_CONTROL_LIST AdapterControlList; // Offset=0xf4 Size=0x14
} RAID_MINIPORT;
typedef struct _RAID_ADAPTER_EXTENSION // Size=0xbc0
{
enum _RAID_OBJECT_TYPE ObjectType; // Offset=0x0 Size=0x4
struct _DEVICE_OBJECT *DeviceObject; // Offset=0x4 Size=0x4
struct _RAID_DRIVER_EXTENSION *Driver; // Offset=0x8 Size=0x4
struct _DEVICE_OBJECT *LowerDeviceObject; // Offset=0xc Size=0x4
struct _DEVICE_OBJECT *PhysicalDeviceObject; // Offset=0x10 Size=0x4
struct _UNICODE_STRING DeviceName; // Offset=0x14 Size=0x8
unsigned long PortNumber; // Offset=0x1c Size=0x4
struct _LIST_ENTRY NextAdapter; // Offset=0x20 Size=0x8
unsigned long SlowLock; // Offset=0x28 Size=0x4
enum _DEVICE_STATE DeviceState; // Offset=0x2c Size=0x4
unsigned long PagingPathCount; // Offset=0x30 Size=0x4
unsigned long CrashDumpPathCount; // Offset=0x34 Size=0x4
unsigned long HiberPathCount; // Offset=0x38 Size=0x4
unsigned char Flags[8]; // Offset=0x3c Size=0x8
struct _STOR_LOCKED_LIST UnitList; // Offset=0x44 Size=0x10
struct _STOR_DICTIONARY UnitDictionary; // Offset=0x54 Size=0x1c
struct _STOR_LOCKED_LIST ZombieList; // Offset=0x70 Size=0x10
union _SLIST_HEADER CompletedList; // Offset=0x80 Size=0x8
struct _SINGLE_LIST_ENTRY *SavedXrbList; // Offset=0x88 Size=0x4
long AdapterDpcRoutineLock; // Offset=0x8c Size=0x4
struct _EX_RUNDOWN_REF_CACHE_AWARE *RemoveLock; // Offset=0x90 Size=0x4
struct _RAID_POWER_STATE Power; // Offset=0x94 Size=0x10
struct _RAID_RESOURCE_LIST ResourceList; // Offset=0xa4 Size=0x8
unsigned char __align1[4]; // Offset=0xac Size=0x4
struct _RAID_MINIPORT Miniport; // Offset=0xb0 Size=0x108
struct _RAID_BUS_INTERFACE Bus; // Offset=0x1b8 Size=0x24
struct _KINTERRUPT *Interrupt; // Offset=0x1dc Size=0x4
unsigned long InterruptIrql; // Offset=0x1e0 Size=0x4
unsigned long InterruptVersion; // Offset=0x1e4 Size=0x4
unsigned long StartIoLock; // Offset=0x1e8 Size=0x4
enum _STOR_SYNCHRONIZATION_MODEL IoModel; // Offset=0x1ec Size=0x4
//...
} RAID_ADAPTER_EXTENSION, *PRAID_ADAPTER_EXTENSION;
typedef struct _RAID_HW_DEVICE_EXT // Size=0x8
{
struct _RAID_MINIPORT *Miniport; // Offset=0x0 Size=0x4
void *Reserved; // Offset=0x4 Size=0x4
unsigned char HwDeviceExtension[]; // Offset=0x8
} RAID_HW_DEVICE_EXT;
typedef struct _RAID_UNIT_EXTENSION // Size=0x2a0
{
enum _RAID_OBJECT_TYPE ObjectType; // Offset=0x0 Size=0x4
struct _DEVICE_OBJECT *DeviceObject; // Offset=0x4 Size=0x4
struct _RAID_ADAPTER_EXTENSION *Adapter; // Offset=0x8 Size=0x4
unsigned long SlowLock; // Offset=0xc Size=0x4
enum _DEVICE_STATE DeviceState; // Offset=0x10 Size=0x4
struct _LIST_ENTRY NextUnit; // Offset=0x14 Size=0x8
struct _LIST_ENTRY UnitTableLink; // Offset=0x1c Size=0x8
union // Size=0xc
{
struct _STOR_ADDR_BTL8 StorAddressBTL8; // Offset=0x24 Size=0xc
struct // Size=0xc
{
unsigned short AddressType; // Offset=0x24 Size=0x2
unsigned short AddressPort; // Offset=0x26 Size=0x2
unsigned long AddressLength; // Offset=0x28 Size=0x4
struct _STOR_SCSI_ADDRESS Address; // Offset=0x2c Size=0x4
};
};
//...
} RAID_UNIT_EXTENSION, *PRAID_UNIT_EXTENSION;
typedef struct _STOR_TIMER_CONTEXT // Size=0x60
{
RAID_ADAPTER_EXTENSION *Adapter; // Offset=0x0 Size=0x4
unsigned char __align0[4]; // Offset=0x4 Size=0x4
KTIMER Timer; // Offset=0x8 Size=0x28
KDPC TimerDpc; // Offset=0x30 Size=0x20
void (*Callback)(void *, void *); // Offset=0x50 Size=0x4
void *CallbackContext; // Offset=0x54 Size=0x4
IO_WORKITEM *FreeTimerWorkItem; // Offset=0x58 Size=0x4
} STOR_TIMER_CONTEXT;
#endif
// Win8+ storport //
///////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
// Static variables
//UNICODE_STRING StorPortInitializeName = RTL_CONSTANT_STRING(L"StorPortInitialize");
//UNICODE_STRING StorPortRegistryReadName = RTL_CONSTANT_STRING(L"StorPortRegistryRead");
//UNICODE_STRING StorPortExtendedFunctionName = RTL_CONSTANT_STRING(L"StorPortExtendedFunction");
// LIST_ENTRY *gPsLoadedModuleList;
static const char* DUMPPREFIX = "dump";
static BOOLEAN gIsWeInitialized = FALSE;
BOOLEAN gDumpMode;
PVOID gScsiPortMoveMemory;
PVOID gScsiPortNotification;
PVOID gStorPortAllocateRegistryBuffer;
PVOID gStorPortBusy;
PVOID gStorPortCompleteRequest;
PVOID gStorPortConvertUlongToPhysicalAddress;
PVOID gStorPortDebugPrint;
PVOID gStorPortDeviceBusy;
PVOID gStorPortDeviceReady;
PVOID gStorPortFreeDeviceBase;
PVOID gStorPortFreeRegistryBuffer;
PVOID gStorPortGetBusData;
PVOID gStorPortGetDeviceBase;
PVOID gStorPortGetLogicalUnit;
PVOID gStorPortGetPhysicalAddress;
PVOID gStorPortGetScatterGatherList;
PVOID gStorPortGetSrb;
PVOID gStorPortGetUncachedExtension;
PVOID gStorPortGetVirtualAddress;
PVOID gStorPortLogError;
PVOID gStorPortMoveMemory;
PVOID gStorPortNotification;
PVOID gStorPortPause;
PVOID gStorPortPauseDevice;
PVOID gStorPortQuerySystemTime;
PVOID gStorPortReadPortBufferUchar;
PVOID gStorPortReadPortBufferUlong;
PVOID gStorPortReadPortBufferUshort;
PVOID gStorPortReadPortUchar;
PVOID gStorPortReadPortUlong;
PVOID gStorPortReadPortUshort;
PVOID gStorPortReadRegisterBufferUchar;
PVOID gStorPortReadRegisterBufferUlong;
PVOID gStorPortReadRegisterBufferUshort;
PVOID gStorPortReadRegisterUchar;
PVOID gStorPortReadRegisterUlong;
PVOID gStorPortReadRegisterUshort;
PVOID gStorPortReady;
PVOID gStorPortRegistryWrite;
PVOID gStorPortResume;
PVOID gStorPortResumeDevice;
PVOID gStorPortSetBusDataByOffset;
PVOID gStorPortSetDeviceQueueDepth;
PVOID gStorPortStallExecution;
PVOID gStorPortSynchronizeAccess;
PVOID gStorPortValidateRange;
PVOID gStorPortWritePortBufferUchar;
PVOID gStorPortWritePortBufferUlong;
PVOID gStorPortWritePortBufferUshort;
PVOID gStorPortWritePortUchar;
PVOID gStorPortWritePortUlong;
PVOID gStorPortWritePortUshort;
PVOID gStorPortWriteRegisterBufferUchar;
PVOID gStorPortWriteRegisterBufferUlong;
PVOID gStorPortWriteRegisterBufferUshort;
PVOID gStorPortWriteRegisterUchar;
PVOID gStorPortWriteRegisterUlong;
PVOID gStorPortWriteRegisterUshort;
ULONG
(*gStorPortInitialize) (
PVOID Argument1,
PVOID Argument2,
struct _HW_INITIALIZATION_DATA *HwInitializationData,
PVOID HwContext );
BOOLEAN
(*gStorPortRegistryRead) (
PVOID HwDeviceExtension,
PUCHAR ValueName,
ULONG Global,
ULONG Type,
PUCHAR Buffer,
PULONG BufferLength );
ULONG
(*gStorPortExtendedFunction) (
STORPORT_FUNCTION_CODE FunctionCode,
PVOID HwDeviceExtension,
ULONG_PTR va1, ULONG_PTR va2, ULONG_PTR va3, ULONG_PTR va4, ULONG_PTR va5, ULONG_PTR va6, ULONG_PTR va7,
ULONG_PTR va8, ULONG_PTR va9, ULONG_PTR va10, ULONG_PTR va11, ULONG_PTR va12, ULONG_PTR va13);
// Static variables
/////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
// Functions
BOOLEAN
isDumpMode(PUNICODE_STRING RegistryPath)
{
ANSI_STRING AnsiString;
PCHAR s;