summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Mao <[email protected]>2017-03-15 15:52:15 -0700
committerWei Mao <[email protected]>2017-03-15 15:52:15 -0700
commit81bc1aeafa758d1e71af85f37804f1ea0c7ef5ce (patch)
tree805017eabbc02e8152704512692fab234ef63784
parent80cc22cbdea1de8d21eb406bf351a916ca2c4b43 (diff)
Fix issue #51 PLX9x5x.sln - missing PLxEvtIoDeviceControl function
-rw-r--r--general/PLX9x5x/sys/Control.c105
-rw-r--r--general/PLX9x5x/sys/Pci9x5x.vcxproj12
2 files changed, 116 insertions, 1 deletions
diff --git a/general/PLX9x5x/sys/Control.c b/general/PLX9x5x/sys/Control.c
new file mode 100644
index 00000000..c8caba71
--- /dev/null
+++ b/general/PLX9x5x/sys/Control.c
@@ -0,0 +1,105 @@
+/*++
+
+Copyright (c) Microsoft Corporation. All rights reserved.
+
+ THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
+ KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
+ PURPOSE.
+
+Module Name:
+
+ Control.c
+
+Abstract:
+
+ This module implements the driver's IOCTL handler.
+
+Environment:
+
+ Kernel mode
+
+--*/
+
+#include "precomp.h"
+
+#include "Control.tmh"
+
+
+//-----------------------------------------------------------------------------
+//
+//-----------------------------------------------------------------------------
+VOID
+PLxEvtIoDeviceControl(
+ _In_ WDFQUEUE Queue,
+ _In_ WDFREQUEST Request,
+ _In_ size_t OutputBufferLength,
+ _In_ size_t InputBufferLength,
+ _In_ ULONG IoControlCode
+ )
+/*++
+
+Routine Description:
+
+ Called by the framework as soon as it receives a Device I/O request.
+
+ Note that this callback may run concurrently to the read and write
+ queues' callbacks. This is acceptable in the context of this sample,
+ because the companion application runs Read/Write requests and IOCTL
+ requests sequentially, but your project might require some form of
+ synchronization.
+
+Arguments:
+
+ Queue - Handle to the IOCTL Queue
+ Request - Handle to the IOCTL request
+ OutputBufferLength - Length of request's output buffer
+ InputBufferLength - Length of request's input buffer
+ IoControlCode - The IOCTL associated with the request
+
+Return Value:
+
+--*/
+{
+ NTSTATUS status;
+ WDFDEVICE device;
+ PDEVICE_EXTENSION devExt;
+ PUCHAR outBuffer;
+
+ UNREFERENCED_PARAMETER(InputBufferLength);
+ UNREFERENCED_PARAMETER(OutputBufferLength);
+
+ device = WdfIoQueueGetDevice(Queue);
+ devExt = PLxGetDeviceContext(device);
+
+ switch (IoControlCode) {
+ case IOCTL_PLX9X5X_TOGGLE_SINGLE_TRANSFER:
+ status = WdfRequestRetrieveOutputBuffer(Request,
+ sizeof(*outBuffer),
+ &outBuffer,
+ NULL);
+ if (!NT_SUCCESS(status)) {
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "WdfRequestRetrieveOutputBuffer failed %!STATUS!",
+ status);
+ break;
+ }
+
+ devExt->RequireSingleTransfer = !devExt->RequireSingleTransfer;
+ *outBuffer = (UCHAR)devExt->RequireSingleTransfer;
+
+ WdfRequestSetInformation(Request, (ULONG_PTR)sizeof(*outBuffer));
+ break;
+
+ default:
+ status = STATUS_INVALID_DEVICE_REQUEST;
+ TraceEvents(TRACE_LEVEL_ERROR, DBG_IOCTL,
+ "Unknown IOCTL 0x%x %!STATUS!",
+ IoControlCode,
+ status);
+ break;
+ }
+
+ WdfRequestComplete(Request, status);
+}
+
diff --git a/general/PLX9x5x/sys/Pci9x5x.vcxproj b/general/PLX9x5x/sys/Pci9x5x.vcxproj
index 6c79841e..c422c342 100644
--- a/general/PLX9x5x/sys/Pci9x5x.vcxproj
+++ b/general/PLX9x5x/sys/Pci9x5x.vcxproj
@@ -22,7 +22,7 @@
<ProjectGuid>{501DB362-22B7-4447-9F0B-690EE0F83CF3}</ProjectGuid>
<RootNamespace>$(MSBuildProjectName)</RootNamespace>
<KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR>
- <KMDF_VERSION_MINOR>9</KMDF_VERSION_MINOR>
+ <KMDF_VERSION_MINOR>19</KMDF_VERSION_MINOR>
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition="'$(Platform)' == ''">Win32</Platform>
<SampleGuid>{01A592F9-DDED-4EDB-B96A-3B9061461BE3}</SampleGuid>
@@ -127,6 +127,16 @@
<PreCompiledHeader>Use</PreCompiledHeader>
<PreCompiledHeaderOutputFile>$(IntDir)\precomp.pch</PreCompiledHeaderOutputFile>
</ClCompile>
+ <ClCompile Include="Control.c">
+ <WppEnabled>true</WppEnabled>
+ <WppKernelMode>true</WppKernelMode>
+ <WppTraceFunction>TraceEvents(LEVEL,FLAGS,MSG,...)</WppTraceFunction>
+ <WppGenerateUsingTemplateFile>{km-WdfDefault.tpl}*.tmh</WppGenerateUsingTemplateFile>
+ <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <PreCompiledHeaderFile>precomp.h</PreCompiledHeaderFile>
+ <PreCompiledHeader>Use</PreCompiledHeader>
+ <PreCompiledHeaderOutputFile>$(IntDir)\precomp.pch</PreCompiledHeaderOutputFile>
+ </ClCompile>
<OtherWpp Include="Pci9656.rc">
<WppEnabled>true</WppEnabled>
<WppKernelMode>true</WppKernelMode>