summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Mao <[email protected]>2017-03-14 10:08:14 -0700
committerWei Mao <[email protected]>2017-03-14 10:08:14 -0700
commitc7113e1789b0ccb579625b6edfd1408bd3981e5d (patch)
tree27148d4c44d3cd2ddd24b69760aa1f49ff29b9aa
parent49bcea929f7eb4a417de16abc8be5d2d172181b7 (diff)
Allow samples to build successfully on RS1 WDK
C/C++ standards specifies that during !if pre-processing, any undefined identifier is replaced with pp-number 0. Thus !if NTDDI >= RS2 is evaluated to true on RS1 DDK, even if NTDDI_RS2 is not defined there
-rw-r--r--usb/kmdf_fx2/driver/Device.c42
-rw-r--r--usb/umdf2_fx2/driver/Device.c32
2 files changed, 37 insertions, 37 deletions
diff --git a/usb/kmdf_fx2/driver/Device.c b/usb/kmdf_fx2/driver/Device.c
index 34aff070..0f3d1349 100644
--- a/usb/kmdf_fx2/driver/Device.c
+++ b/usb/kmdf_fx2/driver/Device.c
@@ -165,22 +165,22 @@ Return Value:
WdfIoQueueDispatchParallel);
ioQueueConfig.EvtIoDeviceControl = OsrFxEvtIoDeviceControl;
-
+
//
- // By default, Static Driver Verifier (SDV) displays a warning if it
- // doesn't find the EvtIoStop callback on a power-managed queue.
- // The 'assume' below causes SDV to suppress this warning. If the driver
+ // By default, Static Driver Verifier (SDV) displays a warning if it
+ // doesn't find the EvtIoStop callback on a power-managed queue.
+ // The 'assume' below causes SDV to suppress this warning. If the driver
// has not explicitly set PowerManaged to WdfFalse, the framework creates
- // power-managed queues when the device is not a filter driver. Normally
+ // power-managed queues when the device is not a filter driver. Normally
// the EvtIoStop is required for power-managed queues, but for this driver
- // it is not needed b/c the driver doesn't hold on to the requests for
- // long time or forward them to other drivers.
+ // it is not needed b/c the driver doesn't hold on to the requests for
+ // long time or forward them to other drivers.
// If the EvtIoStop callback is not implemented, the framework waits for
- // all driver-owned requests to be done before moving in the Dx/sleep
- // states or before removing the device, which is the correct behavior
+ // all driver-owned requests to be done before moving in the Dx/sleep
+ // states or before removing the device, which is the correct behavior
// for this type of driver. If the requests were taking an indeterminate
// amount of time to complete, or if the driver forwarded the requests
- // to a lower driver/another stack, the queue should have an
+ // to a lower driver/another stack, the queue should have an
// EvtIoStop/EvtIoResume.
//
__analysis_assume(ioQueueConfig.EvtIoStop != 0);
@@ -189,7 +189,7 @@ Return Value:
WDF_NO_OBJECT_ATTRIBUTES,
&queue);// pointer to default queue
__analysis_assume(ioQueueConfig.EvtIoStop == 0);
-
+
if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
"WdfIoQueueCreate failed %!STATUS!\n", status);
@@ -308,9 +308,9 @@ Return Value:
goto Error;
}
- //
- // Create the lock that we use to serialize calls to ResetDevice(). As an
- // alternative to using a WDFWAITLOCK to serialize the calls, a sequential
+ //
+ // Create the lock that we use to serialize calls to ResetDevice(). As an
+ // alternative to using a WDFWAITLOCK to serialize the calls, a sequential
// WDFQUEUE can be created and reset IOCTLs would be forwarded to it.
//
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
@@ -368,7 +368,7 @@ Return Value:
"IoSetDeviceInterfacePropertyData failed to set restricted property %!STATUS!\n", status);
goto Error;
}
-#if (NTDDI_VERSION >= NTDDI_WIN10_RS2)
+#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2)
//
// Adding Custom Capability:
@@ -494,7 +494,7 @@ Return Value:
"WdfUsbTargetDeviceCreateWithParameters failed with Status code %!STATUS!\n", status);
return status;
}
-
+
//
// TODO: If you are fetching configuration descriptor from device for
// selecting a configuration or to parse other descriptors, call OsrFxValidateConfigurationDescriptor
@@ -767,7 +767,7 @@ Return Value:
// USBD_ValidateConfigurationDescriptor validates that all descriptors are completely contained within the configuration descriptor buffer.
// It also checks for interface numbers, number of endpoints in an interface etc.
// Please refer to msdn documentation for this function for more information.
- //
+ //
status = USBD_ValidateConfigurationDescriptor( ConfigDesc, BufferLength , ValidationLevel , Offset , POOL_TAG );
if (!(NT_SUCCESS (status)) ){
@@ -776,10 +776,10 @@ Return Value:
//
// TODO: You should validate the correctness of other descriptors which are not taken care by USBD_ValidateConfigurationDescriptor
- // Check that all such descriptors have size >= sizeof(the descriptor they point to)
- // Check for any association between them if required
- //
-
+ // Check that all such descriptors have size >= sizeof(the descriptor they point to)
+ // Check for any association between them if required
+ //
+
return status;
}
diff --git a/usb/umdf2_fx2/driver/Device.c b/usb/umdf2_fx2/driver/Device.c
index 8a6442a6..e7d521e3 100644
--- a/usb/umdf2_fx2/driver/Device.c
+++ b/usb/umdf2_fx2/driver/Device.c
@@ -161,22 +161,22 @@ Return Value:
WdfIoQueueDispatchParallel);
ioQueueConfig.EvtIoDeviceControl = OsrFxEvtIoDeviceControl;
-
+
//
- // By default, Static Driver Verifier (SDV) displays a warning if it
- // doesn't find the EvtIoStop callback on a power-managed queue.
- // The 'assume' below causes SDV to suppress this warning. If the driver
+ // By default, Static Driver Verifier (SDV) displays a warning if it
+ // doesn't find the EvtIoStop callback on a power-managed queue.
+ // The 'assume' below causes SDV to suppress this warning. If the driver
// has not explicitly set PowerManaged to WdfFalse, the framework creates
- // power-managed queues when the device is not a filter driver. Normally
+ // power-managed queues when the device is not a filter driver. Normally
// the EvtIoStop is required for power-managed queues, but for this driver
- // it is not needed b/c the driver doesn't hold on to the requests for
- // long time or forward them to other drivers.
+ // it is not needed b/c the driver doesn't hold on to the requests for
+ // long time or forward them to other drivers.
// If the EvtIoStop callback is not implemented, the framework waits for
- // all driver-owned requests to be done before moving in the Dx/sleep
- // states or before removing the device, which is the correct behavior
+ // all driver-owned requests to be done before moving in the Dx/sleep
+ // states or before removing the device, which is the correct behavior
// for this type of driver. If the requests were taking an indeterminate
// amount of time to complete, or if the driver forwarded the requests
- // to a lower driver/another stack, the queue should have an
+ // to a lower driver/another stack, the queue should have an
// EvtIoStop/EvtIoResume.
//
__analysis_assume(ioQueueConfig.EvtIoStop != 0);
@@ -185,7 +185,7 @@ Return Value:
WDF_NO_OBJECT_ATTRIBUTES,
&queue);// pointer to default queue
__analysis_assume(ioQueueConfig.EvtIoStop == 0);
-
+
if (!NT_SUCCESS(status)) {
TraceEvents(TRACE_LEVEL_ERROR, DBG_PNP,
"WdfIoQueueCreate failed %!STATUS!\n", status);
@@ -304,7 +304,7 @@ Return Value:
goto Error;
}
-#if (NTDDI_VERSION >= NTDDI_WIN10_RS2)
+#if defined(NTDDI_WIN10_RS2) && (NTDDI_VERSION >= NTDDI_WIN10_RS2)
//
// Adding Custom Capability:
//
@@ -335,9 +335,9 @@ Return Value:
}
#endif
- //
- // Create the lock that we use to serialize calls to ResetDevice(). As an
- // alternative to using a WDFWAITLOCK to serialize the calls, a sequential
+ //
+ // Create the lock that we use to serialize calls to ResetDevice(). As an
+ // alternative to using a WDFWAITLOCK to serialize the calls, a sequential
// WDFQUEUE can be created and reset IOCTLs would be forwarded to it.
//
WDF_OBJECT_ATTRIBUTES_INIT(&attributes);
@@ -750,7 +750,7 @@ Return Value:
configParams.Types.SingleInterface.ConfiguredUsbInterface =
usbInterface;
-
+
configParams.Types.SingleInterface.NumberConfiguredPipes =
WdfUsbInterfaceGetNumConfiguredPipes(usbInterface);