diff options
| author | Barry Golden <[email protected]> | 2019-09-16 14:04:28 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2019-09-16 14:04:28 -0700 |
| commit | f064dfb2d92ac3f1f4344d435e4690e4339b5025 (patch) | |
| tree | a807973e6c0bd9e2c92b3b8cf7ecb5f9e63c28d2 /general/echo | |
| parent | db43355fe49c4bec3dbb5f84c271e15dc914ce72 (diff) | |
Update README.md (#417)84625846248462384622846218462084619846188461784616846158461484613846128461184610846098460884607846068460584604
Diffstat (limited to 'general/echo')
| -rw-r--r-- | general/echo/kmdf/README.md | 48 | ||||
| -rw-r--r-- | general/echo/umdf/README.md | 53 | ||||
| -rw-r--r-- | general/echo/umdf2/README.md | 46 | ||||
| -rw-r--r-- | general/echo/umdfSocketEcho/README.md | 84 |
4 files changed, 70 insertions, 161 deletions
diff --git a/general/echo/kmdf/README.md b/general/echo/kmdf/README.md index 2358f650..2118e3e5 100644 --- a/general/echo/kmdf/README.md +++ b/general/echo/kmdf/README.md @@ -8,17 +8,6 @@ products: - windows-wdk --- - - -<!--- - name: KMDF Echo Sample - platform: KMDF - language: cpp - category: General WDF - description: Demonstrates how to use a sequential queue to serialize read and write requests presented to the driver. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617706 ----> - # KMDF Echo Sample The ECHO (KMDF) sample demonstrates how to use a sequential queue to serialize read and write requests presented to the driver. @@ -31,7 +20,7 @@ This sample builds a Universal Windows Driver. It uses only APIs and DDIs that a ## Related technologies -[Kernel-Mode Driver Framework](http://msdn.microsoft.com/en-us/library/windows/hardware/ff544396) +[Kernel-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/kernel/) ## Code Tour @@ -53,48 +42,29 @@ Since the queue is a sequential queue, only one request is outstanding in the dr **Usage:** -Echoapp.exe --- Send single write and read request synchronously +- Echoapp.exe --- Send single write and read request synchronously -Echoapp.exe -Async --- Send 100 reads and writes asynchronously +- Echoapp.exe -Async --- Send 100 reads and writes asynchronously Exit the app anytime by pressing Ctrl-C ## File Manifest -File - -Description - -Echo.htm - -Documentation for this sample (this file). - -***(The AutoSync and DriverSync versions of the sample each have their own version of the following files)*** +> [!NOTE] +> The AutoSync and DriverSync versions of the sample each have their own version of the following files: Driver.h, Driver.c -DriverEntry and Events on the Driver Object. +- DriverEntry and Events on the Driver Object. Device.h, Device.c -Events on the Device Object. +- Events on the Device Object. Queue.h, Queue.c -Contains Events on the I/O Queue Objects. +- Contains Events on the I/O Queue Objects. Echo.inx -File that describes the installation of this driver. The build process converts this into an INF file. - -Makefile.inc - -A makefile that defines custom build actions. This includes the conversion of the .INX file into a .INF file - -Makefile - -This file merely redirects to the real makefile that is shared by all the driver components of the Windows NT DDK. - -Sources - -Generic file that lists source files and all the build options. +- File that describes the installation of this driver. The build process converts this into an INF file. diff --git a/general/echo/umdf/README.md b/general/echo/umdf/README.md index 745482aa..241e633d 100644 --- a/general/echo/umdf/README.md +++ b/general/echo/umdf/README.md @@ -8,17 +8,6 @@ products: - windows-wdk --- - - -<!--- - name: Echo Sample (UMDF Version 1) - platform: UMDF1 - language: cpp - category: General WDF - description: Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617707 ----> - # Echo Sample (UMDF Version 1) This sample demonstrates how to use User-Mode Driver Framework (UMDF) version 1 to write a driver and demonstrates best practices. @@ -27,13 +16,11 @@ It also demonstrates the use of a default Serial Dispatch I/O Queue, its request This sample driver is a minimal driver meant to demonstrate the usage of the User-Mode Driver Framework. It is not intended for use in a production environment. -Related technologies --------------------- +## Related technologies -[User-Mode Driver Framework](http://msdn.microsoft.com/en-us/library/windows/hardware/ff560456) +[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2) -Testing -------- +## Testing To test the Echo driver, you can run echoapp.exe which is built from \\echo\\exe. @@ -45,14 +32,14 @@ Usage: Echoapp.exe --- Send single write and read request synchronously Echoapp.exe -Async --- Send 100 reads and writes asynchronously Exit the app anytime by pressing Ctrl-C - + D:\>echoapp DevicePath: \\?\root#sample#0000#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a} Opened device successfully 512 Pattern Bytes Written successfully 512 Pattern Bytes Read successfully Pattern Verified successfully - + D:\>echoapp -Async DevicePath: \\?\root#sample#0000#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a} Opened device successfully @@ -84,52 +71,50 @@ Number of bytes written by request number 11 is 1024 Note that the reads and writes are performed by independent threads in the echo test application. As a result the order of the output may not exactly match what you see above. -File Manifest -------------- +## File Manifest -**comsup.cpp & comsup.h** +comsup.cpp and comsup.h - COM Support code - specifically base classes which provide implementations for the standard COM interfaces IUnknown and IClassFactory which are used throughout this sample. + - The implementation of IClassFactory is designed to create instances of the CMyDriver class. If you should change the name of your base driver class, you would also need to modify this file. -**dllsup.cpp** +dllsup.cpp - DLL Support code - provides the DLL's entry point as well as the single required export (DllGetClassObject). + - These depend on comsup.cpp to perform the necessary class creation. -**exports.def** +exports.def - This file lists the functions that the driver DLL exports. -**internal.h** +internal.h - This is the main header file for this driver. -**Driver.cpp and Driver.h** +Driver.cpp and Driver.h - DriverEntry and events on the driver object. -**Device.cpp and Device.h** +Device.cpp and Device.h - The Events on the device object. -**Queue.cpp and Queue.h** +Queue.cpp and Queue.h - Contains Events on the I/O Queue Objects. -**Echo.rc** +Echo.rc - Resource file for the driver. -**WUDFEchoDriver.inx** +WUDFEchoDriver.inx - File that describes the installation of this driver. The build process converts this into an INF file. -**makefile.inc** - -- A makefile that defines custom build actions. This includes the conversion of the .INX - -**echodriver.ctl** +echodriver.ctl - This file lists the WPP trace control GUID(s) for the sample driver. This file can be used with the tracelog command's -guid flag to enable the collection of these trace events within an established trace session. + - These GUIDs must remain in sync with the trace control GUIDs defined in internal.h. diff --git a/general/echo/umdf2/README.md b/general/echo/umdf2/README.md index ae812ab8..b5f1d461 100644 --- a/general/echo/umdf2/README.md +++ b/general/echo/umdf2/README.md @@ -8,17 +8,6 @@ products: - windows-wdk --- - - -<!--- - name: Echo Sample (UMDF Version 2) - platform: UMDF2 - language: cpp - category: General WDF - description: Demonstrates how to use UMDF 2 to write a driver and to employ best practices. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617708 ----> - # Echo Sample (UMDF Version 2) The ECHO (UMDF version 2) sample demonstrates how to use a sequential queue to serialize read and write requests presented to the driver. @@ -29,28 +18,25 @@ It also shows how to synchronize execution of these events with other asynchrono This sample builds a Universal Windows Driver. It uses only APIs and DDIs that are included in OneCoreUAP. -Related technologies --------------------- +## Related technologies + +[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2) -[User-Mode Driver Framework](http://msdn.microsoft.com/en-us/library/windows/hardware/ff560456) +## Build the sample with Visual Studio -Open the driver solution in Visual Studio ------------------------------------------ +### Open the driver solution in Visual Studio In Microsoft Visual Studio, open the solution file (umdf2echo.sln). Choose **Solution Explorer** from the **View** menu. In Solution Explorer, you can see one solution that contains three projects. There is a driver project (Driver-\>AutoSync-\>echo), an application project (Exe-\>echoapp), and a package project named **package** (lower case). -Set the configuration and platform in Visual Studio ---------------------------------------------------- +### Set the configuration and platform in Visual Studio In Visual Studio, in Solution Explorer, right click **Solution**, and choose **Configuration Manager**. Set the configuration and the platform. Make sure that the configuration and platform are the same for both the driver project and the package project. Do not check the **Deploy** boxes. -Locate the built driver package -------------------------------- +### Locate the built driver package In File Explorer, navigate to the folder that contains your built driver package. The location of this folder varies depending on what you set for configuration and platform. -Run the sample --------------- +## Run the sample The computer where you install the driver is called the *target computer* or the *test computer*. Typically this is a separate computer from where you develop and build the driver package. The computer where you develop and build the driver is called the *host computer*. @@ -58,20 +44,23 @@ The process of moving the driver package to the target computer and installing t ### Automatic deployment (root enumerated) -Before you automatically deploy a driver, you must provision the target computer. For instructions, see [Configuring a Computer for Driver Deployment, Testing, and Debugging](http://msdn.microsoft.com/en-us/library/windows/hardware/). +Before you automatically deploy a driver, you must provision the target computer. For instructions, see [Provision a computer for driver deployment and testing](https://docs.microsoft.com/windows-hardware/drivers/gettingstarted/provision-a-target-computer-wdk-8-1). 1. On the host computer, in Visual Studio, in Solution Explorer, right click **package** (lower case), and choose **Properties**. Navigate to **Configuration Properties \> Driver Install \> Deployment**. + 1. Check **Enable deployment**, and check **Remove previous driver versions before deployment**. For **Target Computer Name**, select the name of a target computer that you provisioned previously. Select **Hardware ID Driver Update**, and enter **root\\ECHO** for the hardware ID. Click **OK**. + 1. On the **Build** menu, choose **Build Solution**. ### Manual deployment (root enumerated) -Before you manually deploy a driver, you must turn on test signing and install a certificate on the target computer. You also need to copy the [DevCon](http://msdn.microsoft.com/en-us/library/windows/hardware/ff544707) tool to the target computer. For instructions, see [Preparing a Computer for Manual Driver Deployment](https://docs.microsoft.com/en-us/windows-hardware/drivers/develop/preparing-a-computer-for-manual-driver-deployment). +Before you manually deploy a driver, you must turn on test signing and install a certificate on the target computer. You also need to copy the [DevCon](https://docs.microsoft.com/windows-hardware/drivers/devtest/devcon) tool to the target computer. For instructions, see [Preparing a Computer for Manual Driver Deployment](https://docs.microsoft.com/windows-hardware/drivers/develop/preparing-a-computer-for-manual-driver-deployment). 1. Copy all of the files in your driver package to a folder on the target computer (for example, c:\\umdf2echoPkg). + 1. On the target computer, open a Command Prompt window as Administrator. Navigate to your driver package folder, and enter the following command: - **devcon install echoum.inf root\\ECHO** + `devcon install echoum.inf root\\ECHO` ### View the root enumerated driver in Device Manager @@ -79,11 +68,10 @@ On the target computer, in a Command Prompt window, enter **devmgmt** to open De In Device Manager, on the **View** menu, choose **Devices by connection**. Locate **Sample WDF ECHO Driver** as a child of the root node of the device tree. -Build the sample using MSBuild ------------------------------- +## Build the sample using MSBuild As an alternative to building the driver sample in Visual Studio, you can build it in a Visual Studio Command Prompt window. In Visual Studio, on the **Tools** menu, choose **Visual Studio Command Prompt**. In the Visual Studio Command Prompt window, navigate to the folder that has the solution file, umdf2echo.sln. Use the MSBuild command to build the solution. Here is an example: -**msbuild /p:configuration="Release" /p:platform="Win32" umdf2echo.sln** +`msbuild /p:configuration="Release" /p:platform="Win32" umdf2echo.sln` -For more information about using MSBuild to build a driver package, see [Building a Driver](http://msdn.microsoft.com/en-us/library/windows/hardware/ff554644). +For more information about using MSBuild to build a driver package, see [MSBuild primer for WDK developers](https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/msbuild-primer-for-wdk-developers). diff --git a/general/echo/umdfSocketEcho/README.md b/general/echo/umdfSocketEcho/README.md index 38107cec..724e251e 100644 --- a/general/echo/umdfSocketEcho/README.md +++ b/general/echo/umdfSocketEcho/README.md @@ -8,39 +8,27 @@ products: - windows-wdk --- - - -<!--- - name: UMDF SocketEcho Sample (UMDF Version 1) - platform: UMDF1 - language: cpp - category: General WDF - description: Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices. - samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=617709 ----> - # UMDF SocketEcho Sample (UMDF Version 1) The UMDF SocketEcho sample demonstrates how to use the User-Mode Driver Framework (UMDF) to write a driver and demonstrates best practices. This sample also demonstrates how to use a default parallel dispatch I/O queue, use a Microsoft Win32 dispatcher, and handle a socket handle by using a Win32 file I/O target. -Related technologies --------------------- +## Related technologies -[User-Mode Driver Framework](http://msdn.microsoft.com/en-us/library/windows/hardware/ff560456) +[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2) -Code Tour ---------- +## Code Tour This sample driver is a minimal driver that is intended to demonstrate how to use UMDF. It is not intended for use in a production environment. -- **CMyDriver::OnInitialize** in **driver.cpp** is called by the framework when the driver loads. This method initiates use of the Winsock Library. +- **CMyDriver::OnInitialize** in **driver.cpp** is called by the framework when the driver loads. This method initiates use of the Winsock Library. + - **CMyDriver::OnDeviceAdd** in **driver.cpp** is called by the framework to install the driver on a device stack. OnDeviceAdd creates a device callback object, and then calls IWDFDriver::CreateDevice to create an framework device object and to associate the device callback object with the framework device object. + - **CMyQueue::OnCreateFile** in **queue.cpp** is called by the framework to create a socket connection, create a file i/o target that is associated with the socket handle for this connection, and store the socket handle in the file object context. -Installation ------------- +## Installation In Visual Studio, you can press F5 to build the sample and then deploy it to a target machine. For more information, see [Deploying a Driver to a Test Computer](http://msdn.microsoft.com/en-us/library/windows/hardware/hh454834). Alternatively, you can install the sample from the command line. @@ -52,11 +40,12 @@ To install the UMDF Echo sample driver from the command line, do the following: 1. Copy the UMDF coinstaller, WUDFUpdate\_*MMmmmm*.dll, from the \\redist\\wdf\\\<architecture\> directory to the same directory (for example, C:\\socketechoSample). - **Note** You can obtain redistributable framework updates by downloading the *wdfcoinstaller.msi* package from [WDK 8 Redistributable Components](http://go.microsoft.com/fwlink/p/?LinkID=226396). This package performs a silent install into the directory of your Windows Driver Kit (WDK) installation. You will see no confirmation that the installation has completed. You can verify that the redistributables have been installed on top of the WDK by ensuring there is a redist\\wdf directory under the root directory of the WDK, %ProgramFiles(x86)%\\Windows Kits\\8.0. + > [!NOTE] + > You can obtain redistributable framework updates by downloading the *wdfcoinstaller.msi* package from [WDK 8 Redistributable Components](https://go.microsoft.com/fwlink/p/?LinkID=253170). This package performs a silent install into the directory of your Windows Driver Kit (WDK) installation. You will see no confirmation that the installation has completed. You can verify that the redistributables have been installed on top of the WDK by ensuring there is a redist\\wdf directory under the root directory of the WDK, %ProgramFiles(x86)%\\Windows Kits\\8.0. 1. Navigate to the directory that contains the INF file and binaries (for example, cd /d c:\\socketechoSample), and run DevCon.exe as follows: - `devcon.exe install socketecho.inf WUDF\\socketecho` + `devcon.exe install socketecho.inf WUDF\\socketecho` You can find DevCon.exe in the \\tools directory of the WDK (for example, \\tools\\devcon\\i386\\devcon.exe). @@ -78,8 +67,7 @@ To test this sample drivers on a checked operating system that you have installe 1. If WdfCoinstaller*MMmmmm*.dll or WinUsbCoinstaller.dll is included in your driver package, repeat step 1 and step 2 for them. -Testing -------- +## Testing To test the SocketEcho driver, you can run socketechoserver.exe, which is built from the \\echo\\umdfSocketEcho\\Exe directory, and echoapp.exe, which is built from the Kernel-Mode Driver Framework (KMDF) samples in the \\echo\\kmdf directory. @@ -87,94 +75,72 @@ First, you must install the device as described earlier. Then, run socketechoser `D:\\\>socketechoserver -h` -Usage ------- +## Usage -```cmd -socketechoserver Display Usage +socketechoserver usage -socketechoserver -h Display Usage +```cmd +D:\>socketechoserver -h socketechoserver -p Start the app as server listening on default port - socketechoserver -p [port\#] Start the app as server listening on this port -D:\\\>socketechoserver -p +D:\>socketechoserver -p Listening on socket... +``` In another Command Prompt window, run echoapp.exe. -D:\\\>echoapp +```cmd +D:\>echoapp DevicePath: \\\\?\\root\#sample\#0000\#{ e5e65b0c-82c8-4689-96d4-f77837971990} Opened device successfully 512 Pattern Bytes Written successfully - 512 Pattern Bytes Read successfully Pattern Verified successfully -D:\\\>echoapp -Async +D:\>echoapp -Async -DevicePath: \\\\?\\root\#sample\#0000\#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a} +DevicePath: \\?\root\#sample\#0000\#{cdc35b6e-0be4-4936-bf5f-5537380a7c1a} Opened device successfully Starting AsyncIo Number of bytes written by request number 0 is 1024 - Number of bytes read by request number 0 is 1024 - +Number of bytes written by request number 1 is 1024 Number of bytes read by request number 1 is 1024 - Number of bytes written by request number 2 is 1024 - Number of bytes read by request number 2 is 1024 - Number of bytes written by request number 3 is 1024 - Number of bytes read by request number 3 is 1024 - Number of bytes written by request number 4 is 1024 - Number of bytes read by request number 4 is 1024 - Number of bytes written by request number 5 is 1024 - Number of bytes read by request number 5 is 1024 - Number of bytes written by request number 6 is 1024 - Number of bytes read by request number 6 is 1024 - Number of bytes written by request number 7 is 1024 - Number of bytes read by request number 7 is 1024 - Number of bytes written by request number 8 is 1024 - Number of bytes read by request number 8 is 1024 - Number of bytes written by request number 9 is 1024 - Number of bytes read by request number 9 is 1024 - Number of bytes written by request number 10 is 1024 - Number of bytes read by request number 10 is 1024 - Number of bytes written by request number 11 is 1024 - ... ``` -Note that independent threads perform the reads and writes in the echo test application. As a result, the order of the output might not exactly match what you see in the preceding output. +> [!NOTE] +> Independent threads perform the reads and writes in the echo test application. As a result, the order of the output might not exactly match what you see in the preceding output example. -File Manifest -------------- +## File Manifest **Dllsup.cpp**: The DLL support code that provides the DLL's entry point and the single required export (DllGetClassObject). |
