Skip to content

Commit 89971a3

Browse files
[CDFS][FLOPPY_NEW] Simplify unsupported NT6.2+ workarounds (reactos#2956)
1 parent 5201472 commit 89971a3

File tree

2 files changed

+14
-85
lines changed

2 files changed

+14
-85
lines changed

drivers/filesystems/cdfs/cdprocs.h

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ Module Name:
5555
#pragma warning( pop )
5656
#endif
5757

58+
#ifdef __REACTOS__
59+
// Downgrade unsupported NT6.2+ features.
60+
#undef MdlMappingNoExecute
61+
#define MdlMappingNoExecute 0
62+
#define NonPagedPoolNx NonPagedPool
63+
#define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
64+
#endif
65+
5866
//**** x86 compiler bug ****
5967

6068
#if defined(_M_IX86)
@@ -372,7 +380,6 @@ CdHijackIrpAndFlushDevice (
372380
// );
373381
//
374382

375-
#ifndef __REACTOS__
376383
#define CdMapUserBuffer(IC, UB) { \
377384
*(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \
378385
(IC)->Irp->UserBuffer : \
@@ -382,18 +389,6 @@ CdHijackIrpAndFlushDevice (
382389
} \
383390
}
384391

385-
#else
386-
#define CdMapUserBuffer(IC, UB) { \
387-
*(UB) = (PVOID) ( ((IC)->Irp->MdlAddress == NULL) ? \
388-
(IC)->Irp->UserBuffer : \
389-
(MmGetSystemAddressForMdlSafe( (IC)->Irp->MdlAddress, NormalPagePriority))); \
390-
if (NULL == *(UB)) { \
391-
CdRaiseStatus( (IC), STATUS_INSUFFICIENT_RESOURCES); \
392-
} \
393-
}
394-
395-
#endif
396-
397392

398393
#define CdLockUserBuffer(IC,BL,OP) { \
399394
if ((IC)->Irp->MdlAddress == NULL) { \
@@ -1383,13 +1378,8 @@ CdProcessToc (
13831378
//
13841379

13851380
#define CdPagedPool PagedPool
1386-
#ifndef __REACTOS__
13871381
#define CdNonPagedPool NonPagedPoolNx
13881382
#define CdNonPagedPoolCacheAligned NonPagedPoolNxCacheAligned
1389-
#else
1390-
#define CdNonPagedPool NonPagedPool
1391-
#define CdNonPagedPoolCacheAligned NonPagedPoolCacheAligned
1392-
#endif
13931383

13941384

13951385
//

drivers/storage/floppy_new/floppy.c

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ Revision History:
4646
#include <ntstrsafe.h>
4747
#include <intsafe.h>
4848

49+
#ifdef __REACTOS__
50+
// Downgrade unsupported NT6.2+ features.
51+
#define NonPagedPoolNx NonPagedPool
52+
#define NonPagedPoolNxCacheAligned NonPagedPoolCacheAligned
53+
#endif
54+
4955
#define MODE_DATA_SIZE 192
5056
#define SCSI_FLOPPY_TIMEOUT 20
5157
#define SFLOPPY_SRB_LIST_SIZE 4
@@ -834,11 +840,7 @@ ScsiFlopInitDevice(
834840
// Allocate request sense buffer.
835841
//
836842

837-
#ifndef __REACTOS__
838843
senseData = ExAllocatePool(NonPagedPoolNxCacheAligned, SENSE_BUFFER_SIZE);
839-
#else
840-
senseData = ExAllocatePool(NonPagedPoolCacheAligned, SENSE_BUFFER_SIZE);
841-
#endif
842844

843845
if (senseData == NULL) {
844846

@@ -1160,11 +1162,7 @@ Return Value:
11601162
//
11611163
Irp->IoStatus.Information = 0;
11621164

1163-
#ifndef __REACTOS__
11641165
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
1165-
#else
1166-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
1167-
#endif
11681166

11691167
if (srb == NULL) {
11701168

@@ -1530,11 +1528,7 @@ Return Value:
15301528
// Determine if the device is writable.
15311529
//
15321530

1533-
#ifndef __REACTOS__
15341531
modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE);
1535-
#else
1536-
modeData = ExAllocatePool(NonPagedPoolCacheAligned, MODE_DATA_SIZE);
1537-
#endif
15381532

15391533
if (modeData == NULL) {
15401534
status = STATUS_INSUFFICIENT_RESOURCES;
@@ -1845,20 +1839,12 @@ Return Value:
18451839
// Allocate a Srb for the read command.
18461840
//
18471841

1848-
#ifndef __REACTOS__
18491842
readData = ExAllocatePool(NonPagedPoolNx, geometry->BytesPerSector);
1850-
#else
1851-
readData = ExAllocatePool(NonPagedPool, geometry->BytesPerSector);
1852-
#endif
18531843
if (readData == NULL) {
18541844
return STATUS_NO_MEMORY;
18551845
}
18561846

1857-
#ifndef __REACTOS__
18581847
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
1859-
#else
1860-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
1861-
#endif
18621848

18631849
if (srb == NULL) {
18641850

@@ -1948,11 +1934,7 @@ Return Value:
19481934
return(diskData->DriveType);
19491935
}
19501936

1951-
#ifndef __REACTOS__
19521937
modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE);
1953-
#else
1954-
modeData = ExAllocatePool(NonPagedPoolCacheAligned, MODE_DATA_SIZE);
1955-
#endif
19561938

19571939
if (modeData == NULL) {
19581940
return(DRIVE_TYPE_NONE);
@@ -2217,11 +2199,7 @@ Return Value:
22172199

22182200
PAGED_CODE();
22192201

2220-
#ifndef __REACTOS__
22212202
modeData = ExAllocatePool(NonPagedPoolNxCacheAligned, MODE_DATA_SIZE);
2222-
#else
2223-
modeData = ExAllocatePool(NonPagedPoolCacheAligned, MODE_DATA_SIZE);
2224-
#endif
22252203

22262204
if (modeData == NULL) {
22272205
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -2320,11 +2298,7 @@ Return Value:
23202298
// Allocate a Srb for the format command.
23212299
//
23222300

2323-
#ifndef __REACTOS__
23242301
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
2325-
#else
2326-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
2327-
#endif
23282302

23292303
if (srb == NULL) {
23302304

@@ -2384,11 +2358,7 @@ Return Value:
23842358
// Allocate a Srb for the format command.
23852359
//
23862360

2387-
#ifndef __REACTOS__
23882361
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
2389-
#else
2390-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
2391-
#endif
23922362

23932363
if (srb == NULL) {
23942364
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -2514,13 +2484,8 @@ Return Value:
25142484

25152485
DebugPrint((2,"Sending SCSIOP_START_STOP_UNIT\n"));
25162486

2517-
#ifndef __REACTOS__
25182487
context = ExAllocatePool(NonPagedPoolNx,
25192488
sizeof(COMPLETION_CONTEXT));
2520-
#else
2521-
context = ExAllocatePool(NonPagedPool,
2522-
sizeof(COMPLETION_CONTEXT));
2523-
#endif
25242489

25252490
if (context == NULL) {
25262491

@@ -2599,11 +2564,7 @@ Return Value:
25992564
context = NULL;
26002565

26012566
if (!overFlow) {
2602-
#ifndef __REACTOS__
26032567
context = ExAllocatePool(NonPagedPoolNx, sizeNeeded);
2604-
#else
2605-
context = ExAllocatePool(NonPagedPool, sizeNeeded);
2606-
#endif
26072568
}
26082569

26092570
if (context == NULL) {
@@ -2765,11 +2726,7 @@ Return Value:
27652726
driveMediaConstants->SectorsPerTrack *
27662727
driveMediaConstants->BytesPerSector;
27672728

2768-
#ifndef __REACTOS__
27692729
buffer = ExAllocatePool(NonPagedPoolNxCacheAligned, length);
2770-
#else
2771-
buffer = ExAllocatePool(NonPagedPoolCacheAligned, length);
2772-
#endif
27732730

27742731
if (buffer == NULL) {
27752732
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -3051,11 +3008,7 @@ Return Value:
30513008

30523009
// Allocate an SRB for the SCSIOP_READ_FORMATTED_CAPACITY request
30533010
//
3054-
#ifndef __REACTOS__
30553011
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
3056-
#else
3057-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
3058-
#endif
30593012

30603013
if (srb == NULL)
30613014
{
@@ -3071,11 +3024,7 @@ Return Value:
30713024

30723025
ASSERT(dataTransferLength < 0x100);
30733026

3074-
#ifndef __REACTOS__
30753027
dataBuffer = ExAllocatePool(NonPagedPoolNx, dataTransferLength);
3076-
#else
3077-
dataBuffer = ExAllocatePool(NonPagedPool, dataTransferLength);
3078-
#endif
30793028

30803029
if (dataBuffer == NULL)
30813030
{
@@ -3425,11 +3374,7 @@ Return Value:
34253374

34263375
// Allocate an SRB for the SCSIOP_FORMAT_UNIT request
34273376
//
3428-
#ifndef __REACTOS__
34293377
srb = ExAllocatePool(NonPagedPoolNx, SCSI_REQUEST_BLOCK_SIZE);
3430-
#else
3431-
srb = ExAllocatePool(NonPagedPool, SCSI_REQUEST_BLOCK_SIZE);
3432-
#endif
34333378

34343379
if (srb == NULL)
34353380
{
@@ -3438,13 +3383,8 @@ Return Value:
34383383

34393384
// Allocate a transfer buffer for the SCSIOP_FORMAT_UNIT parameter list
34403385
//
3441-
#ifndef __REACTOS__
34423386
parameterList = ExAllocatePool(NonPagedPoolNx,
34433387
sizeof(FORMAT_UNIT_PARAMETER_LIST));
3444-
#else
3445-
parameterList = ExAllocatePool(NonPagedPool,
3446-
sizeof(FORMAT_UNIT_PARAMETER_LIST));
3447-
#endif
34483388

34493389
if (parameterList == NULL)
34503390
{
@@ -3573,4 +3513,3 @@ Return Value:
35733513

35743514
return status;
35753515
}
3576-

0 commit comments

Comments
 (0)