diff options
| author | Adonais Romero González <[email protected]> | 2023-02-03 14:36:05 -0800 |
|---|---|---|
| committer | Adonais Romero González <[email protected]> | 2023-02-03 14:36:05 -0800 |
| commit | c0174c77c5dbed96d4e537c08b1504cd6b9a3134 (patch) | |
| tree | 36dbbe54aee9cd4f381975a5d0c6eea75bfb956f /general | |
| parent | 520c37087776a198544ab9b721d802dd30864736 (diff) | |
| parent | 07779ee84973f2f63a1f2ced6377463b1c01baaf (diff) | |
Merge branch 'main' into develop-2302-merge
Diffstat (limited to 'general')
119 files changed, 62 insertions, 13090 deletions
diff --git a/general/PLX9x5x/sys/pci9x5x.inx b/general/PLX9x5x/sys/pci9x5x.inx Binary files differindex 675a2a2c..2446271e 100644 --- a/general/PLX9x5x/sys/pci9x5x.inx +++ b/general/PLX9x5x/sys/pci9x5x.inx diff --git a/general/SimpleMediaSource/README.md b/general/SimpleMediaSource/README.md index 4467f16b..baa17a30 100644 --- a/general/SimpleMediaSource/README.md +++ b/general/SimpleMediaSource/README.md @@ -27,6 +27,11 @@ For more information, see the accompanying documentation at [Frame Server Custom 1. Deploy the driver package with the following command: - `devcon dp_add SimpleMediaSourceDriver.inf` + `devgen /add /bus ROOT /hardwareid root\SimpleMediaSource` + `pnputil /add-driver SimpleMediaSourceDriver.inf /install` -1. In Device Manager, locate **SimpleMediaSource Capture Source**, under the Camera category. Open the Microsoft Camera App, switch cameras if necessary until the camera is streaming from the SimpleMediaSource. You should see a scrolling black and white gradient. +1. Verify installation with Device Manager, locate **SimpleMediaSource Capture Source**, under the Camera category. If device does not appear there, check %windir%\inf\setupapi.dev.log for installation logs. The device instance ID will be available as the output of the devgen command and can be used as input to pnputil to determine status of the device. + + `pnputil /enum-devices /instanceid "<InstanceID of SimpleMediaSource>" /deviceids /services /stack /drivers` + +1. Open the Microsoft Camera App, switch cameras if necessary until the camera is streaming from the SimpleMediaSource. You should see a scrolling black and white gradient. diff --git a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf Binary files differindex dabb3237..e2d228fe 100644 --- a/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf +++ b/general/SimpleMediaSource/SimpleMediaSourceDriver/SimpleMediaSourceDriver.inf diff --git a/general/echo/kmdf/driver/AutoSync/echo.inx b/general/echo/kmdf/driver/AutoSync/echo.inx Binary files differindex 43ff49d2..970462a3 100644 --- a/general/echo/kmdf/driver/AutoSync/echo.inx +++ b/general/echo/kmdf/driver/AutoSync/echo.inx diff --git a/general/echo/kmdf/driver/DriverSync/echo_2.inx b/general/echo/kmdf/driver/DriverSync/echo_2.inx Binary files differindex f4ece1a7..bb73b485 100644 --- a/general/echo/kmdf/driver/DriverSync/echo_2.inx +++ b/general/echo/kmdf/driver/DriverSync/echo_2.inx diff --git a/general/echo/umdf/Comsup.cpp b/general/echo/umdf/Comsup.cpp deleted file mode 100644 index fd298470..00000000 --- a/general/echo/umdf/Comsup.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.cpp - -Abstract: - - This module contains implementations for the functions and methods - used for providing COM support. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" - -#include "comsup.tmh" - -// -// Implementation of CUnknown methods. -// - -CUnknown::CUnknown( - VOID - ) : m_ReferenceCount(1) -/*++ - - Routine Description: - - Constructor for an instance of the CUnknown class. This simply initializes - the reference count of the object to 1. The caller is expected to - call Release() if it wants to delete the object once it has been allocated. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - // do nothing. -} - -HRESULT -STDMETHODCALLTYPE -CUnknown::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method provides the basic support for query interface on CUnknown. - If the interface requested is IUnknown it references the object and - returns an interface pointer. Otherwise it returns an error. - - Arguments: - - InterfaceId - the IID being requested - - Object - a location to store the interface pointer to return. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IUnknown))) - { - *Object = QueryIUnknown(); - return S_OK; - } - else - { - *Object = NULL; - return E_NOINTERFACE; - } -} - -IUnknown * -CUnknown::QueryIUnknown( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IUnknown interface. - - This allows other methods to convert a CUnknown pointer into an IUnknown - pointer without a typecast and without calling QueryInterface and dealing - with the return value. - - Arguments: - - None - - Return Value: - - A pointer to the object's IUnknown interface. - ---*/ -{ - AddRef(); - return static_cast<IUnknown *>(this); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::AddRef( - VOID - ) -/*++ - - Routine Description: - - This method adds one to the object's reference count. - - Arguments: - - None - - Return Value: - - The new reference count. The caller should only use this for debugging - as the object's actual reference count can change while the caller - examines the return value. - ---*/ -{ - return InterlockedIncrement(&m_ReferenceCount); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::Release( - VOID - ) -/*++ - - Routine Description: - - This method subtracts one to the object's reference count. If the count - goes to zero, this method deletes the object. - - Arguments: - - None - - Return Value: - - The new reference count. If the caller uses this value it should only be - to check for zero (i.e. this call caused or will cause deletion) or - non-zero (i.e. some other call may have caused deletion, but this one - didn't). - ---*/ -{ - ULONG count = InterlockedDecrement(&m_ReferenceCount); - - if (count == 0) - { - delete this; - } - return count; -} - -// -// Implementation of CClassFactory methods. -// - -// -// Define storage for the factory's static lock count variable. -// - -LONG CClassFactory::s_LockCount = 0; - -IClassFactory * -CClassFactory::QueryIClassFactory( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IClassFactory interface. - - This allows other methods to convert a CClassFactory pointer into an - IClassFactory pointer without a typecast and without dealing with the - return value QueryInterface. - - Arguments: - - None - - Return Value: - - A referenced pointer to the object's IClassFactory interface. - ---*/ -{ - AddRef(); - return static_cast<IClassFactory *>(this); -} - -HRESULT -CClassFactory::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method attempts to retrieve the requested interface from the object. - - If the interface is found then the reference count on that interface (and - thus the object itself) is incremented. - - Arguments: - - InterfaceId - the interface the caller is requesting. - - Object - a location to store the interface pointer. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - // - // This class only supports IClassFactory so check for that. - // - - if (IsEqualIID(InterfaceId, __uuidof(IClassFactory))) - { - *Object = QueryIClassFactory(); - return S_OK; - } - else - { - // - // See if the base class supports the interface. - // - - return CUnknown::QueryInterface(InterfaceId, Object); - } -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::CreateInstance( - _In_opt_ IUnknown * /* OuterObject */, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This COM method is the factory routine - it creates instances of the driver - callback class and returns the specified interface on them. - - Arguments: - - OuterObject - only used for aggregation, which our driver callback class - does not support. - - InterfaceId - the interface ID the caller would like to get from our - new object. - - Object - a location to store the referenced interface pointer to the new - object. - - Return Value: - - Status. - ---*/ -{ - HRESULT hr; - - PCMyDriver driver; - - *Object = NULL; - - hr = CMyDriver::CreateInstance(&driver); - - if (SUCCEEDED(hr)) - { - hr = driver->QueryInterface(InterfaceId, Object); - driver->Release(); - } - - return hr; -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::LockServer( - _In_ BOOL Lock - ) -/*++ - - Routine Description: - - This COM method can be used to keep the DLL in memory. However since the - driver's DllCanUnloadNow function always returns false, this has little - effect. Still it tracks the number of lock and unlock operations. - - Arguments: - - Lock - Whether the caller wants to lock or unlock the "server" - - Return Value: - - S_OK - ---*/ -{ - if (Lock) - { - InterlockedIncrement(&s_LockCount); - } - else - { - InterlockedDecrement(&s_LockCount); - } - return S_OK; -} - diff --git a/general/echo/umdf/Comsup.h b/general/echo/umdf/Comsup.h deleted file mode 100644 index b96fd982..00000000 --- a/general/echo/umdf/Comsup.h +++ /dev/null @@ -1,215 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.h - -Abstract: - - This module contains classes and functions use for providing COM support - code. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// Forward type declarations. They are here rather than in internal.h as -// you only need them if you choose to use these support classes. -// - -typedef class CUnknown *PCUnknown; -typedef class CClassFactory *PCClassFactory; - -// -// Base class to implement IUnknown. You can choose to derive your COM -// classes from this class, or simply implement IUnknown in each of your -// classes. -// - -class CUnknown : public IUnknown -{ - -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The reference count for this object. Initialized to 1 in the - // constructor. - // - - LONG m_ReferenceCount; - -// -// Protected data members and methods. These are accessible by the subclasses -// but not by other classes. -// -protected: - - // - // The constructor and destructor are protected to ensure that only the - // subclasses of CUnknown can create and destroy instances. - // - - CUnknown( - VOID - ); - - // - // The destructor MUST be virtual. Since any instance of a CUnknown - // derived class should only be deleted from within CUnknown::Release, - // the destructor MUST be virtual or only CUnknown::~CUnknown will get - // invoked on deletion. - // - // If you see that your CMyDevice specific destructor is never being - // called, make sure you haven't deleted the virtual destructor here. - // - - virtual - ~CUnknown( - VOID - ) - { - // Do nothing - } - -// -// Public Methods. These are accessible by any class. -// -public: - - IUnknown * - QueryIUnknown( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ); - - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ); - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; - -// -// Class factory support class. Create an instance of this from your -// DllGetClassObject method and modify the implementation to create -// an instance of your driver event handler class. -// - -class CClassFactory : public CUnknown, public IClassFactory -{ -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The lock count. This is shared across all instances of IClassFactory - // and can be queried through the public IsLocked method. - // - - static LONG s_LockCount; - -// -// Public Methods. These are accessible by any class. -// -public: - - IClassFactory * - QueryIClassFactory( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // IClassFactory methods. - // - - virtual - HRESULT - STDMETHODCALLTYPE - CreateInstance( - _In_opt_ IUnknown *OuterObject, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - virtual - HRESULT - STDMETHODCALLTYPE - LockServer( - _In_ BOOL Lock - ); -}; diff --git a/general/echo/umdf/Device.cpp b/general/echo/umdf/Device.cpp deleted file mode 100644 index 77110e8e..00000000 --- a/general/echo/umdf/Device.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Device.cpp - -Abstract: - - This module contains the implementation of the sample driver's - device callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "initguid.h" - -#include "device.tmh" - -DEFINE_GUID (GUID_DEVINTERFACE_ECHO, - 0xcdc35b6e, 0xbe4, 0x4936, 0xbf, 0x5f, 0x55, 0x37, 0x38, 0xa, 0x7c, 0x1a); -// {CDC35B6E-0BE4-4936-BF5F-5537380A7C1A} - -HRESULT -CMyDevice::CreateInstance( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit, - _Out_ PCMyDevice *Device - ) -/*++ - - Routine Description: - - This method creates and initializs an instance of the driver's - device callback object. - - Arguments: - - FxDeviceInit - the settings for the device. - - Device - a location to store the referenced pointer to the device object. - - Return Value: - - Status - ---*/ -{ - PCMyDevice device; - HRESULT hr; - - // - // Allocate a new instance of the device class. - // - - device = new CMyDevice(); - - if (NULL == device) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the instance. - // - - hr = device->Initialize(FxDriver, FxDeviceInit); - - if (SUCCEEDED(hr)) - { - *Device = device; - } - else - { - device->Release(); - } - - return hr; -} - -HRESULT -CMyDevice::Initialize( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit - ) -/*++ - - Routine Description: - - This method initializes the device callback object and creates the - partner device object. - - The method should perform any device-specific configuration that: - * could fail (these can't be done in the constructor) - * must be done before the partner object is created -or- - * can be done after the partner object is created and which aren't - influenced by any device-level parameters the parent (the driver - in this case) might set. - - Arguments: - - FxDeviceInit - the settings for this device. - - Return Value: - - status. - ---*/ -{ - IWDFDevice *fxDevice = NULL; - IWDFDeviceInitialize2 *fxDeviceInit2; - HRESULT hr; - - // - // Configure things like the locking model before we go to create our - // partner device. - // - - // - // Set no locking unless you need an automatic callbacks synchronization - // - - FxDeviceInit->SetLockingConstraint(None); - - // - // TODO: If you're writing a filter driver then indicate that here. - // - // FxDeviceInit->SetFilter(); - // - - // - // TODO: Any per-device initialization which must be done before - // creating the partner object. - // - - // - // Create a new FX device object and assign the new callback object to - // handle any device level events that occur. - // - - // - // Set retrieval mode to direct I/O. This needs to be done before the call - // to CreateDevice. - // - hr = FxDeviceInit->QueryInterface(IID_PPV_ARGS(&fxDeviceInit2)); - - if (SUCCEEDED(hr)) - { - // - // WdfDeviceIoBufferedOrDirect for read/write and ioctrl operations. - // UMDF defaults to direct-I/O when the device is not running in a shared - // wudfhost process, and it defaults to buffered-I/O otherwise. Direct I/O - // is not allowed when the device is pooled. - // - // - fxDeviceInit2->SetIoTypePreference(WdfDeviceIoBufferRetrievalDeferred, - WdfDeviceIoBufferedOrDirect, - WdfDeviceIoBufferedOrDirect); - - SAFE_RELEASE(fxDeviceInit2); - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the device). We pass that to - // CreateDevice, which takes its own reference if everything works. - // - { - IUnknown *unknown = this->QueryIUnknown(); - - hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice); - - unknown->Release(); - } - } - - // - // If that succeeded then set our FxDevice member variable. - // - - if (SUCCEEDED(hr)) - { - m_FxDevice = fxDevice; - - // - // Drop the reference we got from CreateDevice. Since this object - // is partnered with the framework object they have the same - // lifespan - there is no need for an additional reference. - // - - fxDevice->Release(); - } - - return hr; -} - -HRESULT -CMyDevice::Configure( - VOID - ) -/*++ - - Routine Description: - - This method is called after the device callback object has been initialized - and returned to the driver. It would setup the device's queues and their - corresponding callback objects. - - Arguments: - - FxDevice - the framework device object for which we're handling events. - - Return Value: - - status - ---*/ -{ - PCMyQueue defaultQueue; - - HRESULT hr; - - hr = CMyQueue::CreateInstance(m_FxDevice, &defaultQueue); - - if (FAILED(hr)) - { - return hr; - } - - hr = defaultQueue->Configure(); - - if (SUCCEEDED(hr)) - { - // - // In case of success store defaultQueue in our member - // The reference is transferred to m_DefaultQueue - // - - m_Queue = defaultQueue; - } - else - { - // - // In case of failure release the reference - // - - defaultQueue->Release(); - } - - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_ECHO, - NULL); - } - - return hr; -} - -HRESULT -CMyDevice::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method is called to get a pointer to one of the object's callback - interfaces. - - Since the sample driver doesn't support any of the device events, this - method simply calls the base class's BaseQueryInterface. - - If the sample is extended to include device event interfaces then this - method must be changed to check the IID and return pointers to them as - appropriate. - - Arguments: - - InterfaceId - the interface being requested - - Object - a location to store the interface pointer if successful - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - HRESULT hr; - - if (IsEqualIID(InterfaceId, __uuidof(IPnpCallbackSelfManagedIo))) { - *Object = QueryIPnpCallbackSelfManagedIo(); - hr = S_OK; - } else { - hr = CUnknown::QueryInterface(InterfaceId, Object); - } - - return hr; -} - -HRESULT -CMyDevice::OnSelfManagedIoInit( - _In_ IWDFDevice * pWdfDevice - ) -/*++ - - Routine Description: - - This method is called to allow driver to initialize any resources - that driver might need to process I/O. - - Echo driver needs a thread to process completions. We initialize - this thread here - - Arguments: - - pWdfDevice - framework device object for which to initialze resources - - Return Value: - - S_OK in case of success - HRESULT correponding to error returned by CreateThread, in case of failure - ---*/ -{ - HRESULT hr = S_OK; - - UNREFERENCED_PARAMETER(pWdfDevice); - - - m_ThreadHandle = CreateThread( NULL, // Default Security Attrib. - 0, // Initial Stack Size, - CMyQueue::CompletionThread, // Thread Func - (LPVOID)m_Queue, // Arg to Thread Func is Queue - 0, // Creation Flags - NULL ); // Don't need the Thread Id. - - if (m_ThreadHandle == NULL) { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - - return hr; -} - -void -CMyDevice::OnSelfManagedIoCleanup( - _In_ IWDFDevice * pWdfDevice - ) -/*++ - - Routine Description: - - This method is called to allow driver to cleanup any resources - that driver allocated to process I/O. - - It is critical that, in this routine driver wait for all of the - threads which it created to exit. Otherwise those threads could - continue to execute when framework unloads the driver which - would lead to a crash. - - Echo driver created a thread to handle completions. We wait for - that thread to exit in this routine - - Arguments: - - pWdfDevice - framework device object for which to cleanup resources - - Return Value: - - None - ---*/ -{ - // - // Kill the thread and - // wait for the thread to die. - // - - UNREFERENCED_PARAMETER(pWdfDevice); - - if (m_ThreadHandle) { - - // - // Ask queue to set terminate flag which will make - // the thread exit - // - m_Queue->SetExitThread(); - - // - // Wait for the thread to exit - // - - WaitForSingleObject(m_ThreadHandle, INFINITE); - - // - // Close the thread handle - // - - CloseHandle(m_ThreadHandle); - m_ThreadHandle = NULL; - } - - // - // Release the reference we took on the queue callback object - // to keep it alive until the thread exits - // - - SAFE_RELEASE(m_Queue); -} - diff --git a/general/echo/umdf/Device.h b/general/echo/umdf/Device.h deleted file mode 100644 index 70147c11..00000000 --- a/general/echo/umdf/Device.h +++ /dev/null @@ -1,217 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Device.h - -Abstract: - - This module contains the type definitions for the UMDF Echo sample - driver's device callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#include "queue.h" - -// -// Class for the iotrace driver. -// - -class CMyDevice : - public CUnknown, - public IPnpCallbackSelfManagedIo -{ - -// -// Private data members. -// -private: - - IWDFDevice *m_FxDevice; - - // - // Completion Thread handle used by queue callback object - // - HANDLE m_ThreadHandle; - - // - // Our queue callback object - // Strong reference - since we pass it to the thread we create - // - CMyQueue *m_Queue; - -// -// Private methods. -// - -private: - - CMyDevice( - VOID - ) - { - m_FxDevice = NULL; - } - - HRESULT - Initialize( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ); - - IPnpCallbackSelfManagedIo * - QueryIPnpCallbackSelfManagedIo( - VOID - ) - { - AddRef(); - return static_cast<IPnpCallbackSelfManagedIo *>(this); - } - - -// -// Public methods -// -public: - - // - // The factory method used to create an instance of this driver. - // - - static - HRESULT - CreateInstance( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit, - _Out_ PCMyDevice *Device - ); - - HRESULT - Configure( - VOID - ); - -// -// COM methods -// -public: - - // - // IUnknown methods. - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // IPnpCallbackSelfManagedIo methods - // - - // - // We implement this interface to create and tear down - // our completion thread - // - // It is critical that we wait for all the threads we create - // to exit during OnSelfManagedIoCleanup, otherwise thread - // may continue to execute when framework unloads the driver, - // leading to a crash - // - // We don't manage any I/O separate from the queue, so apart - // from OnSelfManagedIoInit and OnSelfManagedIoCleanup, other - // methods have token implementations - // - - virtual - void - STDMETHODCALLTYPE - OnSelfManagedIoCleanup( - _In_ IWDFDevice * pWdfDevice - ); - - virtual - void - STDMETHODCALLTYPE - OnSelfManagedIoFlush( - _In_ IWDFDevice * pWdfDevice - ) - { - UNREFERENCED_PARAMETER( pWdfDevice ); - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnSelfManagedIoInit( - _In_ IWDFDevice * pWdfDevice - ); - - virtual - HRESULT - STDMETHODCALLTYPE - OnSelfManagedIoSuspend( - _In_ IWDFDevice * pWdfDevice - ) - { - UNREFERENCED_PARAMETER( pWdfDevice ); - - return S_OK; - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnSelfManagedIoRestart( - _In_ IWDFDevice * pWdfDevice - ) - { - UNREFERENCED_PARAMETER( pWdfDevice ); - - return S_OK; - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnSelfManagedIoStop( - _In_ IWDFDevice * pWdfDevice - ) - { - UNREFERENCED_PARAMETER( pWdfDevice ); - - return S_OK; - } -}; diff --git a/general/echo/umdf/Driver.cpp b/general/echo/umdf/Driver.cpp deleted file mode 100644 index 1428a08a..00000000 --- a/general/echo/umdf/Driver.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Driver.cpp - -Abstract: - - This module contains the implementation of the UMDF Sample's - core driver callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "driver.tmh" - -HRESULT -CMyDriver::CreateInstance( - _Out_ PCMyDriver *Driver - ) -/*++ - - Routine Description: - - This static method is invoked in order to create and initialize a new - instance of the driver class. The caller should arrange for the object - to be released when it is no longer in use. - - Arguments: - - Driver - a location to store a referenced pointer to the new instance - - Return Value: - - S_OK if successful, or error otherwise. - ---*/ -{ - PCMyDriver driver; - HRESULT hr; - - // - // Allocate the callback object. - // - - driver = new CMyDriver(); - - if (NULL == driver) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the callback object. - // - - hr = driver->Initialize(); - - if (SUCCEEDED(hr)) - { - // - // Store a pointer to the new, initialized object in the output - // parameter. - // - - *Driver = driver; - } - else - { - - // - // Release the reference on the driver object to get it to delete - // itself. - // - - driver->Release(); - } - - return hr; -} - -HRESULT -CMyDriver::Initialize( - VOID - ) -/*++ - - Routine Description: - - This method is called to initialize a newly created driver callback object - before it is returned to the creator. Unlike the constructor, the - Initialize method contains operations which could potentially fail. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - return S_OK; -} - -HRESULT -CMyDriver::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Interface - ) -/*++ - - Routine Description: - - This method returns a pointer to the requested interface on the callback - object.. - - Arguments: - - InterfaceId - the IID of the interface to query/reference - - Interface - a location to store the interface pointer. - - Return Value: - - S_OK if the interface is supported. - E_NOINTERFACE if it is not supported. - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry))) - { - *Interface = QueryIDriverEntry(); - return S_OK; - } - else - { - return CUnknown::QueryInterface(InterfaceId, Interface); - } -} - -HRESULT -CMyDriver::OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ) -/*++ - - Routine Description: - - The FX invokes this method when it wants to install our driver on a device - stack. This method creates a device callback object, then calls the Fx - to create an Fx device object and associate the new callback object with - it. - - Arguments: - - FxWdfDriver - the Fx driver object. - - FxDeviceInit - the initialization information for the device. - - Return Value: - - status - ---*/ -{ - HRESULT hr; - - PCMyDevice device = NULL; - - // - // TODO: Do any per-device initialization (reading settings from the - // registry for example) that's necessary before creating your - // device callback object here. Otherwise you can leave such - // initialization to the initialization of the device event - // handler. - // - - // - // Create a new instance of our device callback object - // - - hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device); - - // - // TODO: Change any per-device settings that the object exposes before - // calling Configure to let it complete its initialization. - // - - // - // If that succeeded then call the device's construct method. This - // allows the device to create any queues or other structures that it - // needs now that the corresponding fx device object has been created. - // - - if (SUCCEEDED(hr)) - { - hr = device->Configure(); - } - - // - // Release the reference on the device callback object now that it's been - // associated with an fx device object. - // - - if (NULL != device) - { - device->Release(); - } - - return hr; -} diff --git a/general/echo/umdf/Driver.h b/general/echo/umdf/Driver.h deleted file mode 100644 index 643ea5a5..00000000 --- a/general/echo/umdf/Driver.h +++ /dev/null @@ -1,149 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Driver.h - -Abstract: - - This module contains the type definitions for the UMDF sample's - driver callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// This class handles driver events for the sample. In particular -// it supports the OnDeviceAdd event, which occurs when the driver is called -// to setup per-device handlers for a new device stack. -// - -class CMyDriver : public CUnknown, public IDriverEntry -{ -// -// Private data members. -// -private: - -// -// Private methods. -// -private: - - // - // Returns a refernced pointer to the IDriverEntry interface. - // - - IDriverEntry * - QueryIDriverEntry( - VOID - ) - { - AddRef(); - return static_cast<IDriverEntry*>(this); - } - - HRESULT - Initialize( - VOID - ); - -// -// Public methods -// -public: - - // - // The factory method used to create an instance of this driver. - // - - static - HRESULT - CreateInstance( - _Out_ PCMyDriver *Driver - ); - -// -// COM methods -// -public: - - // - // IDriverEntry methods - // - - virtual - HRESULT - STDMETHODCALLTYPE - OnInitialize( - _In_ IWDFDriver *FxWdfDriver - ) - { - UNREFERENCED_PARAMETER( FxWdfDriver ); - - return S_OK; - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ); - - virtual - VOID - STDMETHODCALLTYPE - OnDeinitialize( - _In_ IWDFDriver *FxWdfDriver - ) - { - UNREFERENCED_PARAMETER( FxWdfDriver ); - - return; - } - - // - // IUnknown methods. - // - // We have to implement basic ones here that redirect to the - // base class becuase of the multiple inheritance. - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; diff --git a/general/echo/umdf/Echo.rc b/general/echo/umdf/Echo.rc deleted file mode 100644 index 2a26d85c..00000000 --- a/general/echo/umdf/Echo.rc +++ /dev/null @@ -1,21 +0,0 @@ -//--------------------------------------------------------------------------- -// Echo.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include <windows.h> -#include <ntverp.h> - -// -// TODO: Change the file description and file names to match your binary. -// - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF Echo User-Mode Driver Sample" -#define VER_INTERNALNAME_STR "UMDFEcho" -#define VER_ORIGINALFILENAME_STR "UMDFEcho.dll" - -#include "common.ver" diff --git a/general/echo/umdf/Queue.cpp b/general/echo/umdf/Queue.cpp deleted file mode 100644 index f366fe31..00000000 --- a/general/echo/umdf/Queue.cpp +++ /dev/null @@ -1,545 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation, All Rights Reserved - -Module Name: - - queue.cpp - -Abstract: - - This file implements the I/O queue interface and performs - the read/write/ioctl operations. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - - -#include "internal.h" - -// -// IUnknown implementation -// - -// -// Queue destructor. -// Free up the buffer, wait for thread to terminate and -// delete critical section. -// - - -CMyQueue::~CMyQueue( - VOID - ) -/*++ - -Routine Description: - - - IUnknown implementation of Release - -Arguments: - - -Return Value: - - ULONG (reference count after Release) - ---*/ -{ - if (m_Buffer) { - delete [] m_Buffer; - } - - if (m_InitCritSec) { - ::DeleteCriticalSection(&m_Crit); - } -} - - -// -// Initialize -HRESULT -CMyQueue::CreateInstance( - _In_ IWDFDevice *FxDevice, - _Out_ PCMyQueue *Queue - ) -/*++ - -Routine Description: - - - CreateInstance creates an instance of the queue object. - -Arguments: - - ppUkwn - OUT parameter is an IUnknown interface to the queue object - -Return Value: - - HRESULT indicating success or failure - ---*/ -{ - CMyQueue *pMyQueue = new CMyQueue; - HRESULT hr; - - if (pMyQueue == NULL) { - return E_OUTOFMEMORY; - } - - hr = pMyQueue->Initialize(FxDevice); - - if (SUCCEEDED(hr)) - { - *Queue = pMyQueue; - } - else - { - pMyQueue->Release(); - } - return hr; -} - -HRESULT -CMyQueue::Initialize( - _In_ IWDFDevice *FxDevice - ) -{ - IWDFIoQueue *fxQueue; - HRESULT hr; - - // - // Initialize the critical section before we continue - // - - if (!InitializeCriticalSectionAndSpinCount(&m_Crit,0x80000400)) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - goto Exit; - } - m_InitCritSec = TRUE; - - // - // Create the framework queue - // - - { - IUnknown *unknown = QueryIUnknown(); - hr = FxDevice->CreateIoQueue(unknown, - TRUE, - WdfIoQueueDispatchSequential, - TRUE, - FALSE, - &fxQueue); - unknown->Release(); - } - - if (FAILED(hr)) - { - goto Exit; - } - - m_FxQueue = fxQueue; - - fxQueue->Release(); - -Exit: - return hr; -} - -HRESULT -STDMETHODCALLTYPE -CMyQueue::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - -Routine Description: - - - Query Interface - -Arguments: - - Follows COM specifications - -Return Value: - - HRESULT indicating success or failure - ---*/ -{ - HRESULT hr; - - - if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackWrite))) { - *Object = QueryIQueueCallbackWrite(); - hr = S_OK; - } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackRead))) { - *Object = QueryIQueueCallbackRead(); - hr = S_OK; - } else if (IsEqualIID(InterfaceId, __uuidof(IQueueCallbackDeviceIoControl))) { - *Object = QueryIQueueCallbackDeviceIoControl(); - hr = S_OK; - } else { - hr = CUnknown::QueryInterface(InterfaceId, Object); - } - - return hr; -} - -VOID -STDMETHODCALLTYPE -CMyQueue::OnDeviceIoControl( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ ULONG ControlCode, - _In_ SIZE_T InputBufferSizeInBytes, - _In_ SIZE_T OutputBufferSizeInBytes - ) -/*++ - -Routine Description: - - - DeviceIoControl dispatch routine - -Arguments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - ControlCode - IO Control Code - InputBufferSizeInBytes - Length of input buffer - OutputBufferSizeInBytes - Length of output buffer - - Always succeeds DeviceIoIoctl -Return Value: - - VOID - ---*/ -{ - - UNREFERENCED_PARAMETER(pWdfQueue); - UNREFERENCED_PARAMETER(ControlCode); - UNREFERENCED_PARAMETER(InputBufferSizeInBytes); - UNREFERENCED_PARAMETER(OutputBufferSizeInBytes); - - pWdfRequest->Complete(S_OK); - return; -} - -VOID -STDMETHODCALLTYPE -CMyQueue::OnWrite( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T BytesToWrite - ) -/*++ - -Routine Description: - - - Write dispatch routine - IQueueCallbackWrite - -Arguments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - BytesToWrite - Length of bytes in the write buffer - - Allocate and copy data to local buffer -Return Value: - - VOID - ---*/ -{ - - HRESULT hr; - IWDFMemory* pRequestMemory = NULL; - IWDFIoRequest2 * pWdfRequest2 = NULL; - - UNREFERENCED_PARAMETER(pWdfQueue); - - // - // Handle Zero length writes. - // - - if (!BytesToWrite) { - pWdfRequest->CompleteWithInformation(S_OK, 0); - return; - } - - if( BytesToWrite > MAX_WRITE_LENGTH ) { - - pWdfRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_MORE_DATA), 0); - return; - } - - // Release previous buffer if set - - if( m_Buffer != NULL ) { - delete [] m_Buffer; - m_Buffer = NULL; - m_Length = 0L; - } - - // Allocate Buffer - - m_Buffer = new UCHAR[BytesToWrite]; - if (m_Buffer == NULL) { - pWdfRequest->Complete(E_OUTOFMEMORY); - m_Length = 0L; - return; - } - - // Get memory object - hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&pWdfRequest2)); - - if (FAILED(hr)) { - goto Exit; - } - - hr = pWdfRequest2->RetrieveInputMemory(&pRequestMemory); - - if (FAILED(hr)) { - goto Exit; - } - - // Copy from memory object to our buffer - - hr = pRequestMemory->CopyToBuffer(0, m_Buffer, BytesToWrite); - - if (FAILED(hr)) { - goto Exit; - } - - // - // Release memory object. - // - SAFE_RELEASE(pRequestMemory); - - // - // Save the information so that we can use it - // to complete the request later. - // - - Lock(); - - m_Length = (ULONG) BytesToWrite; - m_XferredBytes = m_Length; - m_CurrentRequest = pWdfRequest2; - - Unlock(); - -Exit: - - if (FAILED(hr)) { - if (pWdfRequest2) { - pWdfRequest2->CompleteWithInformation(hr, 0); - } - delete [] m_Buffer; - m_Buffer = NULL; - SAFE_RELEASE(pRequestMemory); - } - - // - // This is an early release. pWdfRequest2 will be released, when the request is completed - // - SAFE_RELEASE(pWdfRequest2); - - return; -} - -VOID -STDMETHODCALLTYPE -CMyQueue::OnRead( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T SizeInBytes - ) -/*++ - -Routine Description: - - - Read dispatch routine - IQueueCallbackRead - -Arguments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - SizeInBytes - Length of bytes in the read buffer - - Copy available data into the read buffer -Return Value: - - VOID - ---*/ -{ - IWDFMemory* pRequestMemory = NULL; - IWDFIoRequest2 * pWdfRequest2 = NULL; - HRESULT hr; - - UNREFERENCED_PARAMETER(pWdfQueue); - - // - // Handle Zero length reads. - // - - if (!SizeInBytes) { - pWdfRequest->CompleteWithInformation(S_OK, 0); - return; - } - - if (m_Buffer == NULL) { - pWdfRequest->CompleteWithInformation(HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), SizeInBytes); - return; - } - - if (m_Length < SizeInBytes) { - SizeInBytes = m_Length; - } - - // - // Get memory object - // - - hr = pWdfRequest->QueryInterface(IID_PPV_ARGS(&pWdfRequest2)); - - if (FAILED(hr)) { - goto Exit; - } - - hr = pWdfRequest2->RetrieveOutputMemory(&pRequestMemory ); - - if (FAILED(hr)) { - goto Exit; - } - - // Copy from buffer to memory object - - hr = pRequestMemory->CopyFromBuffer(0, m_Buffer, SizeInBytes); - - if (FAILED(hr)) { - goto Exit; - } - - // - // Release memory object. - // - - SAFE_RELEASE(pRequestMemory); - - // - // Save the information so that we can use it - // to complete the request later. - // - - Lock(); - - m_CurrentRequest = pWdfRequest2; - m_XferredBytes = SizeInBytes; - - Unlock(); - -Exit: - - if (FAILED(hr)) { - if (pWdfRequest2) { - pWdfRequest2->CompleteWithInformation(hr, 0); - } - SAFE_RELEASE(pRequestMemory); - } - - // - // This is an early release. pWdfRequest2 will be released, when the request is completed - // - SAFE_RELEASE(pWdfRequest2); - - return; -} - -DWORD -CMyQueue::CompletionThread( - PVOID ThreadParameter - ) -/*++ - -Routine Description: - - - This routine is called from the thread started to complete - I/O requests. It sleeps for TIMER_PERIOD and then completes - the current request. Note that it has to release the lock - before it calls the request complete method. - -Arguments: - - ThreadParameter - This is a pointer to the Queue object. - -Return Value: - - VOID - ---*/ -{ - CMyQueue *pQueue = (CMyQueue *)ThreadParameter; - IWDFIoRequest2 *request; - SIZE_T bytesXferred = 0; - - for (;;) { - - // - // Block for a fixed time and then complete the request. - // - - Sleep(TIMER_PERIOD); - - pQueue->Lock(); - - // - // Process the current request. - // - - request = pQueue->m_CurrentRequest; - - if (request) { - bytesXferred = pQueue->m_XferredBytes; - } - - // - // Reset values. - // - - pQueue->m_CurrentRequest = NULL; - pQueue->m_XferredBytes = 0; - - - pQueue->Unlock(); - - if (request) { - request->CompleteWithInformation(S_OK, bytesXferred); - } - - // - // If thread needs to be terminated - // - - if (pQueue->m_ExitThread) { - ExitThread(0); - } - - } - -} diff --git a/general/echo/umdf/Queue.h b/general/echo/umdf/Queue.h deleted file mode 100644 index c4b28c97..00000000 --- a/general/echo/umdf/Queue.h +++ /dev/null @@ -1,213 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation, All Rights Reserved - -Module Name: - - queue.h - -Abstract: - - This file defines the queue callback interface. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// Set max write length for testing -#define MAX_WRITE_LENGTH (40*1024) - -// Set timer period in ms -#define TIMER_PERIOD 100 - -// -// Queue Callback Object. -// - -class CMyQueue : - public IQueueCallbackDeviceIoControl, - public IQueueCallbackRead, - public IQueueCallbackWrite, - public CUnknown -{ - PVOID m_Buffer; // Current buffer - ULONG m_Length; // Length of the buffer - SIZE_T m_XferredBytes; // Amount of bytes transferred for the current request - IWDFIoRequest2 *m_CurrentRequest; // Current request - CRITICAL_SECTION m_Crit; // Lock to protect updates to CMyQueue fields - BOOLEAN m_ExitThread; // If TRUE Terminate thread. - BOOLEAN m_InitCritSec; // If TRUE lock initialized - - IWDFIoQueue *m_FxQueue; - - CMyQueue() : - m_Buffer(NULL), - m_Length (0), - m_CurrentRequest(NULL), - m_XferredBytes(0), - m_ExitThread(FALSE), - m_InitCritSec(FALSE), - m_FxQueue(NULL) - { - } - - virtual ~CMyQueue(); - - _Acquires_lock_(this->m_Crit) - __inline - void - Lock( - ) - { - ::EnterCriticalSection(&m_Crit); - } - - _Releases_lock_(this->m_Crit) - __inline - void - Unlock( - ) - { - ::LeaveCriticalSection(&m_Crit); - } - - HRESULT - Initialize( - _In_ IWDFDevice *FxDevice - ); - -public: - - // - // Completion thread routine. - // - - static DWORD CompletionThread( PVOID ThreadParameter); - - // - // Sets the flag to make thread exit - // - - void - SetExitThread() - { - m_ExitThread = TRUE; - } - - static - HRESULT - CreateInstance( - _In_ IWDFDevice *FxDevice, - _Out_ PCMyQueue *Queue - ); - - HRESULT - Configure( - VOID - ) - { - return S_OK; - } - - - IQueueCallbackDeviceIoControl * - QueryIQueueCallbackDeviceIoControl( - VOID - ) - { - AddRef(); - return static_cast<IQueueCallbackDeviceIoControl *>(this); - } - - IQueueCallbackRead * - QueryIQueueCallbackRead( - VOID - ) - { - AddRef(); - return static_cast<IQueueCallbackRead *>(this); - } - - IQueueCallbackWrite * - QueryIQueueCallbackWrite( - VOID - ) - { - AddRef(); - return static_cast<IQueueCallbackWrite *>(this); - } - - // - // IUnknown - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) { - return CUnknown::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) { - return CUnknown::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // Wdf Callbacks - // - - // IQueueCallbackDeviceIoControl - // - virtual - VOID - STDMETHODCALLTYPE - OnDeviceIoControl( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ ULONG ControlCode, - _In_ SIZE_T InputBufferSizeInBytes, - _In_ SIZE_T OutputBufferSizeInBytes - ); - - // IQueueCallbackWrite - // - virtual - VOID - STDMETHODCALLTYPE - OnWrite( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T NumOfBytesToWrite - ); - - // IQueueCallbackRead - // - virtual - VOID - STDMETHODCALLTYPE - OnRead( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T NumOfBytesToRead - ); -}; diff --git a/general/echo/umdf/README.md b/general/echo/umdf/README.md deleted file mode 100644 index 241e633d..00000000 --- a/general/echo/umdf/README.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# 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. - -It also demonstrates the use of a default Serial Dispatch I/O Queue, its request start events, cancellation event, and synchronizing with another thread. The preferred I/O retrieval mode is set to Direct I/O. So, whenever a request is received by the framework, UMDF looks at the size of the buffer and determines, whether it should copy the buffer (if the length is less than 2 full pages) or map it (if the length is greater or equal to 2 full pages). - -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 - -[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2) - -## Testing - -To test the Echo driver, you can run echoapp.exe which is built from \\echo\\exe. - -First install the device as described above. Then run echoapp.exe. - -```cmd -D:\>echoapp /? -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 -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 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 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 - -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 - -- 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 - -- This file lists the functions that the driver DLL exports. - -internal.h - -- This is the main header file for this driver. - -Driver.cpp and Driver.h - -- DriverEntry and events on the driver object. - -Device.cpp and Device.h - -- The Events on the device object. - -Queue.cpp and Queue.h - -- Contains Events on the I/O Queue Objects. - -Echo.rc - -- Resource file for the driver. - -WUDFEchoDriver.inx - -- File that describes the installation of this driver. The build process converts this into an INF file. - -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/umdf/WUDFEchoDriver.inx b/general/echo/umdf/WUDFEchoDriver.inx Binary files differdeleted file mode 100644 index cf8acb0d..00000000 --- a/general/echo/umdf/WUDFEchoDriver.inx +++ /dev/null diff --git a/general/echo/umdf/WUDFEchoDriver.vcxproj b/general/echo/umdf/WUDFEchoDriver.vcxproj deleted file mode 100644 index 1de35ce7..00000000 --- a/general/echo/umdf/WUDFEchoDriver.vcxproj +++ /dev/null @@ -1,262 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{13CC3E04-E27E-4E44-90DE-CFBED92D7130}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{9838DCDC-C817-4EA5-B7E8-B3F97F2B138A}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp; queue.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </ClCompile> - <OtherWpp Include="Echo.rc"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </OtherWpp> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>WUDFEchoDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>WUDFEchoDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>WUDFEchoDriver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>WUDFEchoDriver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemGroup> - <ResourceCompile Include="Echo.rc" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inx" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters b/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters deleted file mode 100644 index 8a23705a..00000000 --- a/general/echo/umdf/WUDFEchoDriver.vcxproj.Filters +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{CF73CF52-2BA2-434D-8E38-8F730D54F150}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{6D44B960-AD87-4EA1-80E4-D63DF6914D51}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{9542D238-C8CE-44BC-9307-50CEDCCA5F25}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{D77C3549-2C94-49EB-909E-54EB79474A98}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="comsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="device.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="dllsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="driver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="queue.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <None Include="exports.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="Echo.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/echo/umdf/dllsup.cpp b/general/echo/umdf/dllsup.cpp deleted file mode 100644 index e7200a28..00000000 --- a/general/echo/umdf/dllsup.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - dllsup.cpp - -Abstract: - - This module contains the implementation of the UMDF Echo Sample - Driver's entry point and its exported functions for providing COM support. - - This module can be copied without modification to a new UMDF driver. It - depends on some of the code in comsup.cpp & comsup.h to handle DLL - registration and creating the first class factory. - - This module is dependent on the following defines: - - MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing - tracing. For example the echo driver uses - L"Microsoft\\UMDF\\Echo" - - MYDRIVER_CLASS_ID - A GUID encoded in struct format used to - initialize the driver's ClassID. - - These are defined in internal.h for the sample. If you choose - to use a different primary include file, you should ensure they are - defined there as well. - -Environment: - - WDF User-Mode Driver Framework (WDF:UMDF) - ---*/ - -#include "internal.h" -#include "dllsup.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -BOOL -WINAPI -DllMain( - HINSTANCE ModuleHandle, - DWORD Reason, - PVOID /* Reserved */ - ) -/*++ - - Routine Description: - - This is the entry point and exit point for the I/O trace driver. This - does very little as the I/O trace driver has minimal global data. - - This method initializes tracing. - - Arguments: - - ModuleHandle - the DLL handle for this module. - - Reason - the reason this entry point was called. - - Reserved - unused - - Return Value: - - TRUE - ---*/ -{ - - UNREFERENCED_PARAMETER(ModuleHandle); - - if (DLL_PROCESS_ATTACH == Reason) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - } - else if (DLL_PROCESS_DETACH == Reason) - { - // - // Cleanup tracing. - // - - WPP_CLEANUP(); - } - - return TRUE; -} - -HRESULT -STDAPICALLTYPE -DllGetClassObject( - _In_ REFCLSID ClassId, - _In_ REFIID InterfaceId, - _Outptr_ LPVOID *Interface - ) -/*++ - - Routine Description: - - This routine is called by COM in order to instantiate the - driver callback object and do an initial query interface on it. - - This method only creates an instance of the driver's class factory, as this - is the minimum required to support UMDF. - - Arguments: - - ClassId - the CLSID of the object being "gotten" - - InterfaceId - the interface the caller wants from that object. - - Interface - a location to store the referenced interface pointer - - Return Value: - - S_OK if the function succeeds or error indicating the cause of the - failure. - ---*/ -{ - PCClassFactory factory; - - HRESULT hr = S_OK; - - *Interface = NULL; - - // - // If the CLSID doesn't match that of our "coclass" (defined in the IDL - // file) then we can't create the object the caller wants. This may - // indicate that the COM registration is incorrect, and another CLSID - // is referencing this drvier. - // - - if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Called to create instance of unrecognized class (%!GUID!)", - &ClassId - ); - - return CLASS_E_CLASSNOTAVAILABLE; - } - - // - // Create an instance of the class factory for the caller. - // - - factory = new CClassFactory(); - - if (NULL == factory) - { - hr = E_OUTOFMEMORY; - } - - // - // Query the object we created for the interface the caller wants. After - // that we release the object. This will drive the reference count to - // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed). - // In the later case the object is automatically deleted. - // - - if (SUCCEEDED(hr)) - { - hr = factory->QueryInterface(InterfaceId, Interface); - factory->Release(); - } - - return hr; -} diff --git a/general/echo/umdf/echo.sln b/general/echo/umdf/echo.sln deleted file mode 100644 index cc459eea..00000000 --- a/general/echo/umdf/echo.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFEchoDriver", "WUDFEchoDriver.vcxproj", "{13CC3E04-E27E-4E44-90DE-CFBED92D7130}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|Win32.ActiveCfg = Debug|Win32 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|Win32.Build.0 = Debug|Win32 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|Win32.ActiveCfg = Release|Win32 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|Win32.Build.0 = Release|Win32 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|x64.ActiveCfg = Debug|x64 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Debug|x64.Build.0 = Debug|x64 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|x64.ActiveCfg = Release|x64 - {13CC3E04-E27E-4E44-90DE-CFBED92D7130}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/general/echo/umdf/echodriver.ctl b/general/echo/umdf/echodriver.ctl deleted file mode 100644 index a0ce2089..00000000 --- a/general/echo/umdf/echodriver.ctl +++ /dev/null @@ -1 +0,0 @@ -d93fb470-afb1-4af8-860e-75f726c66f6b WudfEchoDriverTraceGuid diff --git a/general/echo/umdf/exports.def b/general/echo/umdf/exports.def deleted file mode 100644 index ec564639..00000000 --- a/general/echo/umdf/exports.def +++ /dev/null @@ -1,10 +0,0 @@ -; Echo.def : Declares the module parameters. - -; -; TODO: Change the library name here to match your binary name. -; - -LIBRARY "WUDFEchoDriver.DLL" - -EXPORTS - DllGetClassObject PRIVATE diff --git a/general/echo/umdf/internal.h b/general/echo/umdf/internal.h deleted file mode 100644 index 8e5c2d60..00000000 --- a/general/echo/umdf/internal.h +++ /dev/null @@ -1,114 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the UMDF Echo - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Forward definitions of classes in the other header files. -// - -typedef class CMyDriver *PCMyDriver; -typedef class CMyDevice *PCMyDevice; -typedef class CMyQueue *PCMyQueue; - -// -// Define the tracing flags. -// -// TODO: Choose a different trace control GUID -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - MyDriverTraceControl, (d93fb470,afb1,4af8,860e,75f726c66f6b), \ - \ - WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && \ - WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// end_wpp -// - -// -// Driver specific #defines -// -// TODO: Change these values to be appropriate for your driver. -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\Echo" -#define MYDRIVER_CLASS_ID {0x7ab7dcf5, 0xd1d4, 0x4085, {0x95, 0x47, 0x1d, 0xb9, 0x68, 0xcc, 0xa7, 0x20}} - -// -// Include the type specific headers. -// - -#include "comsup.h" -#include "driver.h" -#include "device.h" -#include "queue.h" - -__forceinline -#ifdef _PREFAST_ -__declspec(noreturn) -#endif -VOID -WdfTestNoReturn( - VOID - ) -{ - // do nothing. -} - -#define WUDF_TEST_DRIVER_ASSERT(p) \ -{ \ - if ( !(p) ) \ - { \ - DebugBreak(); \ - WdfTestNoReturn(); \ - } \ -} - -#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }} diff --git a/general/echo/umdf2/driver/AutoSync/echoum.inx b/general/echo/umdf2/driver/AutoSync/echoum.inx Binary files differindex d15e4413..ccfe6a7e 100644 --- a/general/echo/umdf2/driver/AutoSync/echoum.inx +++ b/general/echo/umdf2/driver/AutoSync/echoum.inx diff --git a/general/echo/umdfSocketEcho/Driver/Connection.cpp b/general/echo/umdfSocketEcho/Driver/Connection.cpp deleted file mode 100644 index e28d0c56..00000000 --- a/general/echo/umdfSocketEcho/Driver/Connection.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - Connection.cpp - -Abstract: - - Module for the socket connection specfic routines in the driver. - Makes Connection to the server given server host and port address. - -Environment: - - User mode only - - ---*/ - -#include "internal.h" -#include "connection.tmh" - - -CConnection::CConnection() -/*++ - -Routine Description: - - Constructor for connection object - -Arguments: - - None - -Return Value: - - VOID - ---*/ -{ - - // Initialize the socket member as Invalid - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - m_socket = INVALID_SOCKET; -} - -HRESULT -CConnection::Connect( - IN IWDFDevice *pDevice - ) -/*++ - -Routine Description: - - This routine is for the initialization of the connection object associated with - the File Object . It is invoked from the dispatch OnCreateFile on the default - queue callback of the driver. It socket connection to the client. - -Arguments: - - pDevice = Wdf Device Object - -Return Value: - - S_OK if success , error HRESULT otherwise - ---*/ -{ - - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - HRESULT hr = S_OK; - - addrinfoW* info = NULL ; - - PWSTR hostStr = NULL; - - PWSTR portStr = NULL; - - // - // Reads the host and port strings stored in the device context. - // - - DeviceContext *pContext = NULL; - - hr = pDevice->RetrieveContext((void**)&pContext); - - if ( FAILED(hr) ) - { - - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: unable to retrieve context from wdf device object %!hresult!", - hr - ); - goto Clean0; - - } - - hostStr = pContext->hostStr; - - portStr = pContext->portStr; - - // - // lookup hostname with addrinfo hints; - // - - addrinfoW hints; - - ZeroMemory(&hints,sizeof(hints)); - - hints.ai_family = AF_INET; - - hints.ai_socktype = SOCK_STREAM; - - hints.ai_protocol = IPPROTO_TCP; - - int n = GetAddrInfoW(hostStr, portStr, &hints, &info); - - if (n != 0) - { - DWORD err = WSAGetLastError(); - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to find address/port of host %!winerr!", - err - ); - hr = HRESULT_FROM_WIN32(err); - goto Clean0; - } - - // - // Create a socket with this infomation recvd in getaddrinfo - // - m_socket = socket(info->ai_family,info->ai_socktype,info->ai_protocol); - - if (m_socket == INVALID_SOCKET) - { - DWORD err = WSAGetLastError(); - - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to create socket %!winerr!", - err - ); - - hr = HRESULT_FROM_WIN32(err); - - goto Clean0; - } - - // - // If that succeeds , proceed to connect to the socket - // - - - ATLASSERT(info->ai_addrlen <= 0x7fffffff); - - int nret = connect(m_socket,info->ai_addr,(int)info->ai_addrlen); - - if (nret == SOCKET_ERROR) - { - DWORD err = WSAGetLastError(); - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to connect to host %!winerr!", - err - ); - hr = HRESULT_FROM_WIN32(err); - - goto Clean0; - } - - -Clean0: - - if (info != NULL) - { - FreeAddrInfoW(info); - - } - - if (FAILED(hr) && m_socket != INVALID_SOCKET) - { - closesocket(m_socket); - m_socket = INVALID_SOCKET; - } - - return hr; - -} - -HANDLE -CConnection::GetSocketHandle( - ) -/*++ - -Routine Description: - - Function returns the socket handle associated with this connection object - -Arguments: - - None - -Return Value: - - Socket handle if valid socket - INVALID_HANDLE_VALUE otherwise - ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - if ( INVALID_SOCKET != m_socket ) - { - return (HANDLE)m_socket ; - } - else - { - return INVALID_HANDLE_VALUE; - } - -} - - -VOID -CConnection::Close() -/*++ - -Routine Description: - - Closes the socket connection to the server associated with this connection object - -Arguments: - - None - -Return Value: - - None ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - if (m_socket != INVALID_SOCKET) - { - closesocket(m_socket); - m_socket = INVALID_SOCKET; - } - -} diff --git a/general/echo/umdfSocketEcho/Driver/FileContext.h b/general/echo/umdfSocketEcho/Driver/FileContext.h deleted file mode 100644 index dbdda2e4..00000000 --- a/general/echo/umdfSocketEcho/Driver/FileContext.h +++ /dev/null @@ -1,30 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - filecontext.h - -Abstract: - - This header file defines the structure type for file context associated with the file object - -Environment: - - user mode only - -Revision History: - ---*/ - - -#pragma once - -typedef struct _FileContext -{ - CConnection *pConnection ; - - CComPtr<IWDFIoTarget> pFileTarget; - -}FileContext; diff --git a/general/echo/umdfSocketEcho/Driver/Queue.cpp b/general/echo/umdfSocketEcho/Driver/Queue.cpp deleted file mode 100644 index 242925d4..00000000 --- a/general/echo/umdfSocketEcho/Driver/Queue.cpp +++ /dev/null @@ -1,580 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - queue.cpp - -Abstract: - - This file implements the I/O queue interface and performs - the read/write/ioctl operations. - -Environment: - - user mode only - -Revision History: - ---*/ - -#include "internal.h" - -#include "queue.tmh" - -CMyQueue::CMyQueue( - ) : - m_FxQueue(NULL), - m_Device(NULL) -{ -} - -// -// Queue destructor. -// - -CMyQueue::~CMyQueue( - VOID - ) -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); -} - -// -// Initialize -// - -HRESULT -CMyQueue::Initialize( - _In_ CMyDevice * Device - ) -/*++ - -Routine Description: - - Queue Initialize helper routine. - This routine will Create a default parallel queue associated with the Fx device object - and pass the IUnknown for this queue - -Aruments: - Device - Device object pointer - -Return Value: - - S_OK if Initialize succeeds - ---*/ -{ - - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - CComPtr<IWDFIoQueue> fxQueue; - - HRESULT hr; - - m_Device = Device; - - // - // Create the I/O Queue object. - // - - { - CComPtr<IUnknown> pUnk; - - HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk); - - WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI)); - - hr = m_Device->GetFxDevice()->CreateIoQueue( - pUnk, - TRUE, - WdfIoQueueDispatchParallel, - TRUE, - FALSE, - &fxQueue - ); - } - - if (FAILED(hr)) - { - Trace( - TRACE_LEVEL_ERROR, - "Failed to initialize driver queue %!hresult!", - hr - ); - goto Exit; - } - - m_FxQueue = fxQueue; - - -Exit: - - return hr; -} - -HRESULT -CMyQueue::Configure( - VOID - ) -/*++ - -Routine Description: - - Queue configuration function . - It is called after queue object has been succesfully initialized. - -Aruments: - - NONE - - Return Value: - - S_OK if succeeds. - ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - HRESULT hr = S_OK; - - return hr; -} - - -STDMETHODIMP_(void) -CMyQueue::OnCreateFile( - _In_ IWDFIoQueue* pWdfQueue, - _In_ IWDFIoRequest* pWdfRequest, - _In_ IWDFFile* pWdfFileObject - ) - -/*++ - -Routine Description: - - Create callback from the framework for this default parallel queue - - The create request will create a socket connection , create a file i/o target associated - with the socket handle for this connection and store in the file object context. - -Aruments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - pWdfFileObject - WDF file object for this create - - Return Value: - - VOID - ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - HRESULT hr = S_OK; - - CComPtr<IWDFFileHandleTargetFactory> spFileHandleTargetFactory; - - CComPtr<IWDFIoTarget> pFileTarget; - - CComPtr<IWDFDevice> pDevice; - - HANDLE SocketHandle = NULL; - - pWdfQueue->GetDevice(&pDevice); - - FileContext *pContext = NULL; - - // - // Create new connection object - // - - CConnection *pConnection = new CConnection(); - - if (NULL == pConnection ) - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Could not create connection object %!hresult!", - hr - ); - goto Exit; - } - - // - // Connect to the socket server - // - - hr = pConnection->Connect(pDevice); - - if (FAILED(hr)) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Could not connect %!hresult!", - hr - ); - - goto Exit; - - } - - // - // If that succeeds, get socket handle for the connection - // - - if ( NULL == (SocketHandle = pConnection->GetSocketHandle()) ) - { - hr = E_FAIL; - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to obtain valid Socket Handle %!hresult!", - hr - ); - goto Exit; - } - - // - // Create file context for this file object - // - - pContext = new FileContext; - - if (NULL == pContext) - { - hr = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Could not create file context %!hresult!", - hr - ); - goto Exit; - - } - - // - // QI for IWDFFileHandleTargetFactory from the framework device object. - // Note UmdfDispatcher in Wdf Section in the Inf - // - - hr = pDevice->QueryInterface(IID_PPV_ARGS(&spFileHandleTargetFactory)); - - if (FAILED(hr)) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to obtain target factory for creating FileHandle based I/O target %!hresult!", - hr - ); - goto Exit; - } - - // - // If that succeeds, Create a File Handle I/O Target and associate the socket handle with this target - // - - hr = spFileHandleTargetFactory->CreateFileHandleTarget(SocketHandle ,&pFileTarget); - - if (FAILED(hr)) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to create framework I/O target %!hresult!", - hr - ); - goto Exit; - } - - - pContext->pFileTarget = pFileTarget; - - pContext->pConnection = pConnection; - - hr = pWdfFileObject->AssignContext(NULL,(void*)pContext); - - if (FAILED(hr)) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Unable to Assign Context to this File Object %!hresult!", - hr - ); - goto Exit; - } - - - -Exit: - - if (FAILED(hr)) - { - - if ( pFileTarget ) - { - pFileTarget->DeleteWdfObject(); - } - - if (pConnection != NULL) - { - delete pConnection; - pConnection = NULL; - } - - if (pContext != NULL) - { - delete pContext; - pContext = NULL; - } - - } - - pWdfRequest->Complete(hr); - -} - - -STDMETHODIMP_ (void) -CMyQueue::OnWrite( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T BytesToWrite - ) -/*++ - -Routine Description: - - Write callback from the framework for this default parallel queue - - The write request needs to be sent to the file handle i/o target associated with this fileobject - -Aruments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - BytesToWrite - Lenth of bytes in the write buffer - - Return Value: - - VOID - ---*/ -{ - UNREFERENCED_PARAMETER(pWdfQueue); - UNREFERENCED_PARAMETER(BytesToWrite); - - // Call helper function to send request to i/o target - - SendRequestToFileTarget(pWdfRequest); - - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - return; -} - -STDMETHODIMP_ (void) -CMyQueue::OnRead( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T BytesToRead - ) -/*++ - -Routine Description: - - Read callback from the framework for this default parallel queue - - The read request needs to be sent to the file handle i/o target associated with this fileobject - -Aruments: - - pWdfQueue - Framework Queue instance - pWdfRequest - Framework Request instance - BytesToRead - Lenth of bytes in the read buffer - - -Return Value: - - VOID - ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - UNREFERENCED_PARAMETER(pWdfQueue); - UNREFERENCED_PARAMETER(BytesToRead); - - // - // Call helper function to send request to i/o target - // - - SendRequestToFileTarget(pWdfRequest); - - return; -} - -STDMETHODIMP_(void) -CMyQueue::OnCompletion( - _In_ IWDFIoRequest* pWdfRequest, - _In_ IWDFIoTarget* pTarget, - _In_ IWDFRequestCompletionParams* pCompletionParams, - _In_ void* pContext -) -/*++ - -Routine Description: - - This routine is invoked when the request is completed by the lower stack location, - in this case the win32 i/o target associated with the file object of this request - - - Arguments: - - pWdfRequest - wdf request - pTarget - wdf target to which request was earlier sent - pCompletionParams - wdf request completion parameters - pContext - Context information , if any - - -Return Value: - - None ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - UNREFERENCED_PARAMETER(pTarget); - UNREFERENCED_PARAMETER(pContext); - - // Complete request from the driver - pWdfRequest->CompleteWithInformation( - pCompletionParams->GetCompletionStatus(), - pCompletionParams->GetInformation()); -} - -VOID -CMyQueue::SendRequestToFileTarget( - _In_ IWDFIoRequest* pWdfRequest -) -/*++ - -Routine Description: - - This is a helper functiom to send R/W requests to the win32 file i/o target - associated with the socket connection for this request. - First, filecontext is retrieved which has the file i/o target where this request needs to be sent. - - -Arguments: - - pWdfRequest - wdf request - -Return Value: - - None - ---*/ -{ - - HRESULT hr; - - FileContext *pContext = NULL; - CComPtr<IWDFFile> pWdfFile = NULL; - - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - // - // Get the file object for this request - // - - pWdfRequest->GetFileObject(&pWdfFile); - - // - // Retrieve Context from file object - // - - hr = pWdfFile->RetrieveContext((void**)&pContext); - - if (pContext == NULL) - { - if ( SUCCEEDED(hr) ) - { - hr = E_FAIL; - Trace(TRACE_LEVEL_ERROR, - " No Context associated with this file object %!hresult!", - hr); - } - goto Exit; - } - - // - // If that succeeds, set completion callback for the request - // - pWdfRequest->SetCompletionCallback(CComQIPtr<IRequestCallbackRequestCompletion>(this), - NULL); - - // - // Do not modify the request, format using current type - // - - pWdfRequest->FormatUsingCurrentType(); - - // - // Send the request to the win32 i/o target . This was created in OnCreateFile - // - - hr = pWdfRequest->Send(pContext->pFileTarget, - 0, - 0); -Exit: - - if (FAILED(hr)) - { - Trace(TRACE_LEVEL_ERROR, - "Could not send request to i/o target %!hresult!", - hr); - pWdfRequest->Complete(hr); - } - - return ; -} - -STDMETHODIMP_(void) -CMyQueue::OnCleanup( - _In_ IWDFObject* /*pWdfObject*/ - ) -{ - // - // CMyQueue has a reference to framework device object via m_FxQueue. - // Framework queue object has a reference to CMyQueue object via the callbacks. - // This leads to circular reference and both the objects can't be destroyed until this circular reference is broken. - // To break the circular reference we release the reference to the framework queue object here in OnCleanup. - // - m_FxQueue = NULL; -} diff --git a/general/echo/umdfSocketEcho/Driver/Queue.h b/general/echo/umdfSocketEcho/Driver/Queue.h deleted file mode 100644 index 952e1e0d..00000000 --- a/general/echo/umdfSocketEcho/Driver/Queue.h +++ /dev/null @@ -1,83 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - queue.h - -Abstract: - - This file defines the queue callback interface. - -Environment: - - user mode only - -Revision History: - ---*/ - -#pragma once - -// -// Queue Callback Object. -// - -class ATL_NO_VTABLE CMyQueue : - public CComObjectRootEx<CComMultiThreadModel>, - public IQueueCallbackCreate, - public IQueueCallbackRead, - public IQueueCallbackWrite, - public IRequestCallbackRequestCompletion, - public IObjectCleanup -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyQueue) - -BEGIN_COM_MAP(CMyQueue) - COM_INTERFACE_ENTRY(IQueueCallbackCreate) - COM_INTERFACE_ENTRY(IQueueCallbackRead) - COM_INTERFACE_ENTRY(IQueueCallbackWrite) - COM_INTERFACE_ENTRY(IRequestCallbackRequestCompletion) - COM_INTERFACE_ENTRY(IObjectCleanup) -END_COM_MAP() - -public: - //IQueueCallbackRead - STDMETHOD_(void,OnRead)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWdfRequest,_In_ SIZE_T NumOfBytesToRead); - - //IQueueCallbackWrite - STDMETHOD_(void,OnWrite)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWdfRequest,_In_ SIZE_T NumOfBytesToWrite); - - //IQueueCallbackCreate - STDMETHOD_(void,OnCreateFile)(_In_ IWDFIoQueue* pWdfQueue,_In_ IWDFIoRequest* pWDFRequest,_In_ IWDFFile* pWdfFileObject); - - // IRequestCallbackRequestCompletion - STDMETHOD_(void,OnCompletion)(_In_ IWDFIoRequest* pWdfRequest,_In_ IWDFIoTarget* pTarget,_In_ IWDFRequestCompletionParams* pCompletionParams,_In_ void* pContext); - - //IObjectCleanup - STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject); - -public: - CMyQueue(); - ~CMyQueue(); - - STDMETHOD(Initialize)(_In_ CMyDevice * Device); - - HRESULT - Configure( - ); - -private: - CComPtr<IWDFIoQueue> m_FxQueue; - - // - // Unreferenced pointer to the parent device. - // - - CMyDevice * m_Device; - - VOID SendRequestToFileTarget( _In_ IWDFIoRequest* pWdfRequest); -}; diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx b/general/echo/umdfSocketEcho/Driver/SocketEcho.inx Binary files differdeleted file mode 100644 index b1475187..00000000 --- a/general/echo/umdfSocketEcho/Driver/SocketEcho.inx +++ /dev/null diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.rc b/general/echo/umdfSocketEcho/Driver/SocketEcho.rc deleted file mode 100644 index cc27b15f..00000000 --- a/general/echo/umdfSocketEcho/Driver/SocketEcho.rc +++ /dev/null @@ -1,21 +0,0 @@ -//--------------------------------------------------------------------------- -// Skeleton.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include <windows.h> -#include <ntverp.h> - -// -// TODO: Change the file description and file names to match your binary. -// - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF Sample WUDF SocketEcho Driver" -#define VER_INTERNALNAME_STR "SocketEcho" -#define VER_ORIGINALFILENAME_STR "SocketEcho.dll" - -#include "common.ver" diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj b/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj deleted file mode 100644 index 652dd875..00000000 --- a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj +++ /dev/null @@ -1,251 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{353E2F22-BD87-47F3-A211-90DE8D583D26}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR> - <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{CE6B3D79-4604-4FAC-8A53-20B7000101FD}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include="dllsup.cpp; driver.cpp; device.cpp; queue.cpp; connection.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </ClCompile> - <OtherWpp Include="SocketEcho.rc"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </OtherWpp> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>SocketEcho</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>SocketEcho</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>SocketEcho</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>SocketEcho</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\shlwapi.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\Ws2_32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemGroup> - <ResourceCompile Include="SocketEcho.rc" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inx" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters b/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters deleted file mode 100644 index 1c5cadc5..00000000 --- a/general/echo/umdfSocketEcho/Driver/SocketEcho.vcxproj.Filters +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{76642063-E1CB-43C5-8493-5F651D92F60C}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{4AB44AAB-2BDE-4DA4-A128-40382366A9F5}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{005AFEBA-780E-49DC-BCB8-4163463DE6D5}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{FDF16DEE-FA54-49E3-BC76-FCFD47F8BF37}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="connection.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="device.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="dllsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="driver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="queue.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <None Include="exports.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="SocketEcho.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/echo/umdfSocketEcho/Driver/connection.h b/general/echo/umdfSocketEcho/Driver/connection.h deleted file mode 100644 index 2b7e23c6..00000000 --- a/general/echo/umdfSocketEcho/Driver/connection.h +++ /dev/null @@ -1,32 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - Connection.h - -Abstract: - - Header file for the socketecho connection class - -Environment: - - User mode only - - ---*/ -#pragma once - -class CConnection -{ -public: - CConnection(); - HRESULT Connect(IN IWDFDevice *pDevice); - VOID Close(); - HANDLE GetSocketHandle( ); - -private: - SOCKET m_socket; -}; - diff --git a/general/echo/umdfSocketEcho/Driver/device.cpp b/general/echo/umdfSocketEcho/Driver/device.cpp deleted file mode 100644 index 9c3e4db1..00000000 --- a/general/echo/umdfSocketEcho/Driver/device.cpp +++ /dev/null @@ -1,469 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Device.cpp - -Abstract: - - This module contains the implementation of the UMDF socketecho sample - driver's device callback object. - - It does not implement either of the PNP interfaces so once the device - is setup, it won't ever get any callbacks until the device is removed. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "device.tmh" - -const GUID GUID_DEVINTERFACE_SOCKETECHO = - {0xcdc35b6e, 0xbe4, 0x4936, { 0xbf, 0x5f, 0x55, 0x37, 0x38, 0xa, 0x7c, 0x1a }}; - - -HRESULT -CMyDevice::Initialize( - _In_ IWDFDriver* FxDriver, - _In_ IWDFDeviceInitialize* FxDeviceInit - ) -/*++ - - Routine Description: - - This method initializes the device callback object and creates the - partner device object. - - The method should perform any device-specific configuration that: - * could fail (these can't be done in the constructor) - * must be done before the partner object is created -or- - * can be done after the partner object is created and which aren't - influenced by any device-level parameters the parent (the driver - in this case) might set. - - Arguments: - - FxDeviceInit - the settings for this device. - FxDriver - IWDF Driver for this device. - - Return Value: - - status. - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!"); - - CComPtr<IWDFDevice> fxDevice; - HRESULT hr; - BOOL bFilter = FALSE; - - // - // Configure things like the locking model before we go to create our - // partner device. - // - - // - // Set the locking model - // - - FxDeviceInit->SetLockingConstraint(None); - - // - // Mark filter if we are a filter - // - - if (bFilter) - { - FxDeviceInit->SetFilter(); - } - - // - // TODO: Any per-device initialization which must be done before - // creating the partner object. - // - - // - // Create a new FX device object and assign the new callback object to - // handle any device level events that occur. - // - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the device). We pass that to - // CreateDevice, which takes its own reference if everything works. - // - - CComPtr<IUnknown> pUnk; - HRESULT hrQI = this->QueryInterface(__uuidof(IUnknown),(void**)&pUnk); - WUDF_SAMPLE_DRIVER_ASSERT(SUCCEEDED(hrQI)); - - hr = FxDriver->CreateDevice(FxDeviceInit, pUnk, &fxDevice); - - // - // If that succeeded then set our FxDevice member variable. - // - - if (SUCCEEDED(hr)) - { - m_FxDevice = fxDevice; - } - - return hr; -} - -HRESULT -CMyDevice::Configure( - VOID - ) -/*++ - - Routine Description: - - This method is called after the device callback object has been initialized - and returned to the driver. It would setup the device's queues and their - corresponding callback objects. - - Arguments: - - None - - Return Value: - - status - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!"); - - HRESULT hr; - CComObject<CMyQueue> * defaultQueue = NULL; - - // - // Create a new instance of our queue callback object - // - hr = CComObject<CMyQueue>::CreateInstance(&defaultQueue); - - if (SUCCEEDED(hr)) - { - defaultQueue->AddRef(); - hr = defaultQueue->Initialize(this); - } - - if (SUCCEEDED(hr)) - { - hr = defaultQueue->Configure(); - } - - // - // Create and Enable Device Interface for this device. - // - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_SOCKETECHO, - NULL); - } - if (SUCCEEDED(hr)) - { - hr = m_FxDevice->AssignDeviceInterfaceState(&GUID_DEVINTERFACE_SOCKETECHO, - NULL, - TRUE); - } - - if (SUCCEEDED(hr)) - { - hr = ReadAndAssignPropertyStoreValue(); - } - - // - // Release the reference we took on the queue callback object. - // The framework took its own references on the object's callback interfaces - // when we called m_FxDevice->CreateIoQueue, and will manage the object's lifetime. - // - SAFE_RELEASE(defaultQueue); - - return hr; -} - -STDMETHODIMP_(void) -CMyDevice::OnCloseFile( - _In_ IWDFFile* pWdfFileObject - ) -/*++ - - Routine Description: - - This method is called when an app closes the file handle to this device. - This will free the context memory associated with this file object, close - the connection object associated with this file object and delete the file - handle i/o target object associated with this file object. - - Arguments: - - pWdfFileObject - the framework file object for which close is handled. - - Return Value: - - None - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!"); - - HRESULT hr = S_OK ; - FileContext *pContext = NULL; - - hr = pWdfFileObject->RetrieveContext((void**)&pContext); - - if (SUCCEEDED(hr) && (pContext != NULL ) ) - { - pContext->pConnection->Close(); - pContext->pFileTarget->DeleteWdfObject(); - - delete pContext->pConnection; - delete pContext; - } - - return ; -} - - -STDMETHODIMP_(void) -CMyDevice::OnCleanupFile( - _In_ IWDFFile* pWdfFileObject - ) -/*++ - - Routine Description: - - This method is when app with open handle device terminates. - - Arguments: - - pWdfFileObject - the framework file object for which close is handled. - - Return Value: - - None - ---*/ -{ - UNREFERENCED_PARAMETER(pWdfFileObject); -} - -STDMETHODIMP_(void) -CMyDevice::OnCleanup( - _In_ IWDFObject* pWdfObject - ) -/*++ - - Routine Description: - - This device callback method is invoked by the framework when the WdfObject - is about to be released by the framework. This will free the context memory - associated with the device object. - - Arguments: - - pWdfObject - the framework device object for which OnCleanup. - - Return Value: - - None - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!"); - - HRESULT hr ; - DeviceContext *pContext = NULL; - - WUDF_SAMPLE_DRIVER_ASSERT(pWdfObject == m_FxDevice); - - hr = pWdfObject->RetrieveContext((void**)&pContext); - - if (SUCCEEDED(hr) && (pContext != NULL)) - { - // hostStr is allocated through StrDup, and thus need be freed through LocalFree - // - if (pContext->hostStr != NULL) - { - LocalFree( pContext->hostStr ); - } - - if (pContext->portStr != NULL) - { - LocalFree( pContext->portStr ); - } - - delete pContext; - } -// -//CMyDevice has a reference to framework device object via m_Device. -//Framework device object has a reference to CMyDevice object via the callbacks. -//This leads to circular reference and both the objects can't be destroyed until this circular reference is broken. -//To break the circular reference we release the reference to the framework device object here in OnCleanup. - - m_FxDevice = NULL; -} - -HRESULT -CMyDevice::ReadAndAssignPropertyStoreValue( - VOID - ) -/*++ - - Routine Description: - Helper function for reading property store values and storing them in the - device level context. - - Arguments: - - pWdfFileObject - the framework file object for which close is handled. - - Return Value: - - None - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION, "%!FUNC!"); - - CComPtr<IWDFNamedPropertyStore> pPropStore; - WDF_PROPERTY_STORE_DISPOSITION disposition; - PROPVARIANT val; - HRESULT hr ; - - PropVariantInit(&val); - - DeviceContext *pContext = new DeviceContext; - if (pContext == NULL) - { - hr = E_OUTOFMEMORY; - Trace(TRACE_LEVEL_ERROR, - L"ERROR: Could not create device context object %!hresult!", - hr); - - goto CleanUp; - } - - pContext->hostStr = NULL; - pContext->portStr = NULL; - - // - // Retreive property store for reading drivers custom settings as specified - // in the INF - // - hr = m_FxDevice->RetrieveDevicePropertyStore(L"SocketEcho", - WdfPropertyStoreNormal, - &pPropStore, - &disposition); - if (FAILED(hr)) - { - Trace(TRACE_LEVEL_ERROR, - "Failed to retrieve device property store for reading custom " - "settings as specified in the INF %!hresult!", - hr); - - goto CleanUp; - } - - // - // Get the key for this device with Named value "host" - // - hr = pPropStore->GetNamedValue(L"Host", &val); - if (FAILED(hr)) - { - Trace(TRACE_LEVEL_ERROR, - "Failed to get \"Host\" key value %!hresult!", - hr); - - goto CleanUp; - } - - if (val.vt != VT_LPWSTR) - { - hr = HRESULT_FROM_WIN32(ERROR_BAD_CONFIGURATION); - Trace(TRACE_LEVEL_ERROR, - "Unexpected string format for value in \"Host\" key %!hresult!", - hr); - - goto CleanUp; - } - - pContext->hostStr = StrDup(val.pwszVal); - - // - // Clear property variant for reading next key - // - PropVariantClear(&val); - - // - // Get the key for this device with Named value "Port" - // - hr = pPropStore->GetNamedValue(L"Port", &val); - if (FAILED(hr)) - { - Trace(TRACE_LEVEL_ERROR, - "Failed to get \"Port\" key value %!hresult!", - hr); - - goto CleanUp; - } - - if (val.vt != VT_LPWSTR) - { - hr = HRESULT_FROM_WIN32(ERROR_BAD_CONFIGURATION); - Trace(TRACE_LEVEL_ERROR, - "Unexpected string format for value in \"Port\" key %!hresult!", - hr); - - goto CleanUp; - } - - pContext->portStr = StrDup(val.pwszVal); - - hr = m_FxDevice->AssignContext(NULL, (void*)pContext); - if (FAILED(hr)) - { - Trace(TRACE_LEVEL_ERROR, - "Failed to assign property store value to device %!hresult!", - hr); - - // - // Fall through to clean up and exit ... - // - } - -CleanUp: - - PropVariantClear(&val); - - if (FAILED(hr)) - { - if (pContext != NULL) - { - // hostStr is allocated through StrDup, and thus need be freed through LocalFree - // - if (pContext->hostStr != NULL) - { - LocalFree( pContext->hostStr ); - } - - if (pContext->portStr != NULL) - { - LocalFree( pContext->portStr ); - } - - delete pContext; - } - } - - return hr; -} - diff --git a/general/echo/umdfSocketEcho/Driver/device.h b/general/echo/umdfSocketEcho/Driver/device.h deleted file mode 100644 index 176f10e6..00000000 --- a/general/echo/umdfSocketEcho/Driver/device.h +++ /dev/null @@ -1,70 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Device.h - -Abstract: - - This module contains the type definitions for the UMDF Skeleton sample - driver's device callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// Class for the iotrace driver. -// - -class ATL_NO_VTABLE CMyDevice : - public CComObjectRootEx<CComMultiThreadModel>, - public IFileCallbackCleanup, - public IFileCallbackClose, - public IObjectCleanup -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyDevice) - -BEGIN_COM_MAP(CMyDevice) - COM_INTERFACE_ENTRY(IFileCallbackCleanup) - COM_INTERFACE_ENTRY(IFileCallbackClose) - COM_INTERFACE_ENTRY(IObjectCleanup) -END_COM_MAP() - -public: - - //IFileCallbackCleanup - STDMETHOD_(void,OnCleanupFile)(_In_ IWDFFile* pWdfFileObject); - //IFileCallbackClose - STDMETHOD_(void,OnCloseFile)(_In_ IWDFFile* pWdfFileObject); - //IObjectCleanup - STDMETHOD_(void,OnCleanup)(_In_ IWDFObject* pWdfObject); - -public: - - STDMETHOD(Initialize)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit); - - HRESULT - Configure( - ); - - IWDFDevice * - GetFxDevice( - ) - { - return m_FxDevice; - } - -private: - CComPtr<IWDFDevice> m_FxDevice; - HRESULT ReadAndAssignPropertyStoreValue(); - -}; diff --git a/general/echo/umdfSocketEcho/Driver/devicecontext.h b/general/echo/umdfSocketEcho/Driver/devicecontext.h deleted file mode 100644 index 2bf10d2e..00000000 --- a/general/echo/umdfSocketEcho/Driver/devicecontext.h +++ /dev/null @@ -1,32 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - devicecontext.h - -Abstract: - - This header file defines the structure type for device context associated with the device object - -Environment: - - user mode only - -Revision History: - ---*/ - - -#pragma once - - -typedef struct _DeviceContext -{ - PWSTR hostStr; - - PWSTR portStr; - -}DeviceContext; - diff --git a/general/echo/umdfSocketEcho/Driver/dllsup.cpp b/general/echo/umdfSocketEcho/Driver/dllsup.cpp deleted file mode 100644 index 5ec3eb33..00000000 --- a/general/echo/umdfSocketEcho/Driver/dllsup.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - dllsup.cpp - -Abstract: - - This module contains the implementation of the UMDF Socktecho Sample - Driver's entry point and its exported functions for providing COM support. - - This module can be copied without modification to a new UMDF driver. It - depends on some of the code in comsup.cpp & comsup.h to handle DLL - registration and creating the first class factory. - - This module is dependent on the following defines: - - MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing - tracing. For example the socktecho uses - L"Microsoft\\UMDF\\Socketecho" - - MYDRIVER_CLASS_ID - A GUID encoded in struct format used to - initialize the driver's ClassID. - - These are defined in internal.h for the sample. If you choose - to use a different primary include file, you should ensure they are - defined there as well. - -Environment: - - WDF User-Mode Driver Framework (WDF:UMDF) - ---*/ - -#include "internal.h" -#include "dllsup.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -class CSocketEchoModule : public CAtlDllModuleT< CSocketEchoModule > -{ -}; - - -OBJECT_ENTRY_AUTO(CLSID_MyDriverCoClass, CMyDriver) - - -CSocketEchoModule _AtlModule; - -BOOL -WINAPI -DllMain( - HINSTANCE ModuleHandle, - DWORD Reason, - PVOID Reserved - ) -/*++ - - Routine Description: - - This is the entry point and exit point for the I/O trace driver. This - does very little as the I/O trace driver has minimal global data. - - This method initializes tracing. - - Arguments: - - ModuleHandle - the DLL handle for this module. - - Reason - the reason this entry point was called. - - Reserved - unused - - Return Value: - - TRUE - ---*/ -{ - - UNREFERENCED_PARAMETER( ModuleHandle ); - - if (DLL_PROCESS_ATTACH == Reason) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - - } - else if (DLL_PROCESS_DETACH == Reason) - { - // - // Cleanup tracing. - // - - WPP_CLEANUP(); - } - - return _AtlModule.DllMain(Reason, Reserved); -; -} - -_Check_return_ -STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv) -{ - return _AtlModule.DllGetClassObject(rclsid, riid, ppv); -} diff --git a/general/echo/umdfSocketEcho/Driver/driver.cpp b/general/echo/umdfSocketEcho/Driver/driver.cpp deleted file mode 100644 index 4f93691c..00000000 --- a/general/echo/umdfSocketEcho/Driver/driver.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Driver.cpp - -Abstract: - - This module contains the implementation of the UMDF Socketecho Sample's - core driver callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "driver.tmh" - -STDMETHODIMP -CMyDriver::OnInitialize( - _In_ IWDFDriver* pWdfDriver - ) - - -/*++ - - Routine Description: - - This routine is invoked by the framework at driver load . - This method will invoke the Winsock Library for using - Winsock API in this driver. - - Arguments: - - pWdfDriver - Framework driver object - - Return Value: - - S_OK if successful, or error otherwise. - ---*/ - -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - UNREFERENCED_PARAMETER(pWdfDriver); - - WORD sockVersion; - WSADATA wsaData; - - sockVersion = MAKEWORD(2, 0); - - int result = WSAStartup(sockVersion, &wsaData); - - if (result != 0) - { - DWORD err = WSAGetLastError(); - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Failed to initialize Winsock 2.0 %!winerr!", - err - ); - return HRESULT_FROM_WIN32(err); - } - - return S_OK; -} - -STDMETHODIMP_(void) -CMyDriver::OnDeinitialize( - _In_ IWDFDriver* pWdfDriver - ) - -/*++ - Routine Description: - - The FX invokes this method when it unloads the driver. - This routine will Cleanup Winsock library - - Arguments: - - pWdfDriver - the Fx driver object. - - Return Value: - - None - - - --*/ - -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - UNREFERENCED_PARAMETER(pWdfDriver); - - WSACleanup(); -} - -STDMETHODIMP -CMyDriver::OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ) -/*++ - - Routine Description: - - The FX invokes this method when it wants to install our driver on a device - stack. This method creates a device callback object, then calls the Fx - to create an Fx device object and associate the new callback object with - it. - - Arguments: - - FxWdfDriver - the Fx driver object. - - FxDeviceInit - the initialization information for the device. - - Return Value: - - status - ---*/ -{ - Trace( - TRACE_LEVEL_INFORMATION, - "%!FUNC!" - ); - - HRESULT hr; - - CComObject<CMyDevice> * device = NULL; - - // - // Create a new instance of our device callback object - // - - hr = CComObject<CMyDevice>::CreateInstance(&device); - - if (SUCCEEDED(hr)) - { - device->AddRef(); - hr = device->Initialize(FxWdfDriver, FxDeviceInit); - } - - // - // If that succeeded then call the device's configure method. This - // allows the device to create any queues or other structures that it - // needs now that the corresponding fx device object has been created. - // - - if (SUCCEEDED(hr)) - { - hr = device->Configure(); - } - - // - // Release the reference we took on the device callback object. - // The framework took its own references on the object's callback interfaces - // when we called FxWdfDriver->CreateDevice, and will manage the object's lifetime. - // - SAFE_RELEASE(device); - - return hr; -} diff --git a/general/echo/umdfSocketEcho/Driver/driver.h b/general/echo/umdfSocketEcho/Driver/driver.h deleted file mode 100644 index 6affa20f..00000000 --- a/general/echo/umdfSocketEcho/Driver/driver.h +++ /dev/null @@ -1,53 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Driver.h - -Abstract: - - This module contains the type definitions for the UMDF Socketecho sample's - driver callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// This class handles driver events for the socktecho sample. In particular -// it supports the OnDeviceAdd event, which occurs when the driver is called -// to setup per-device handlers for a new device stack. -// - -extern const GUID CLSID_MyDriverCoClass; - -class ATL_NO_VTABLE CMyDriver : - public CComObjectRootEx<CComMultiThreadModel>, - public CComCoClass<CMyDriver, &CLSID_MyDriverCoClass>, - public IDriverEntry -{ -public: - -DECLARE_NOT_AGGREGATABLE(CMyDriver) - -DECLARE_CLASSFACTORY(); - -DECLARE_NO_REGISTRY(); - -BEGIN_COM_MAP(CMyDriver) - COM_INTERFACE_ENTRY(IDriverEntry) -END_COM_MAP() - -public: - // IDriverEntry - STDMETHOD(OnInitialize)(_In_ IWDFDriver* pWdfDriver); - STDMETHOD(OnDeviceAdd)(_In_ IWDFDriver* pWdfDriver, _In_ IWDFDeviceInitialize* pWdfDeviceInit); - STDMETHOD_(void,OnDeinitialize)(_In_ IWDFDriver* pWdfDriver); -}; - diff --git a/general/echo/umdfSocketEcho/Driver/exports.def b/general/echo/umdfSocketEcho/Driver/exports.def deleted file mode 100644 index 2c0b7d49..00000000 --- a/general/echo/umdfSocketEcho/Driver/exports.def +++ /dev/null @@ -1,6 +0,0 @@ -; Socketecho.def : Declares the module parameters. - -LIBRARY "SocketEcho" - -EXPORTS - DllGetClassObject PRIVATE diff --git a/general/echo/umdfSocketEcho/Driver/internal.h b/general/echo/umdfSocketEcho/Driver/internal.h deleted file mode 100644 index a7875468..00000000 --- a/general/echo/umdfSocketEcho/Driver/internal.h +++ /dev/null @@ -1,117 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the UMDF Socketecho sample - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the winsock headers before any other windows headers. -// -#include <winsock2.h> -#include <ws2tcpip.h> - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Define the tracing flags. -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - MyDriverTraceControl, (64316518,DFE2,42B6,8786,4995E5EC435), \ - \ - WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && \ - WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// end_wpp -// - -// -// Driver specific #defines -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\SocketEcho" -#define MYDRIVER_CLASS_ID { 0x83B87D35, 0x76B8, 0x4920, {0xB4, 0x3C, 0x3B, 0xDE, 0x6B, 0x0E, 0xC5, 0xB8} } - -#ifndef SAFE_RELEASE -#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }} -#endif - -__forceinline -#ifdef _PREFAST_ -__declspec(noreturn) -#endif -VOID -WdfTestNoReturn( - VOID - ) -{ - // do nothing. -} - -#define WUDF_SAMPLE_DRIVER_ASSERT(p) \ -{ \ - if ( !(p) ) \ - { \ - DebugBreak(); \ - WdfTestNoReturn(); \ - } \ -} - -// -// Include the type specific headers. -// -#include <atlbase.h> -#include <atlcom.h> - -#include "connection.h" -#include "filecontext.h" -#include "devicecontext.h" -#include "driver.h" -#include "device.h" -#include "queue.h" - -_Analysis_mode_(_Analysis_operator_new_null_) - diff --git a/general/echo/umdfSocketEcho/Exe/internal.h b/general/echo/umdfSocketEcho/Exe/internal.h deleted file mode 100644 index ff1cd863..00000000 --- a/general/echo/umdfSocketEcho/Exe/internal.h +++ /dev/null @@ -1,18 +0,0 @@ -// internal.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include <driverspecs.h> -_Analysis_mode_(_Analysis_code_type_user_code_); -#include <winsock2.h> -#include <ws2tcpip.h> -#include <windows.h> -#include <stdio.h> -#include <stdlib.h> -#include <strsafe.h> -#include <setupapi.h> - -#include "socketechoserver.h" diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp b/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp deleted file mode 100644 index bfe5f546..00000000 --- a/general/echo/umdfSocketEcho/Exe/socketechoserver.cpp +++ /dev/null @@ -1,512 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - socketserver.cpp - -Abstract: - - A simple socket server application that listens on a specified port and echoes back data - received. - -Environment: - - User Mode - ---*/ - -#include "internal.h" - - -DWORD -Run( - LPVOID lpThreadParameter - ) - /*++ - -Routine Description: - - This routine is invoked for each thread created for a new connection accepted by the server. - The rcv and send to socket happen in this thread routine. - - -Arguments: - - lpThreadParameter , The Thread parameter which contains socket information - -Return Value: - - Thread Exit Code - - ---*/ -{ - #define DeleteBufferExitThread(dwExitCode) \ - delete[] buffer; \ - buffer = NULL; \ - ExitThread(dwExitCode); - - #define DeleteBufferReturn(dwExitCode) \ - delete[] buffer; \ - buffer = NULL; \ - return dwExitCode; - - int count =0; - - char *buffer = new char[DATA_LENGTH]; - if (NULL == buffer) - { - ExitThread(1); - } - - DWORD Event; - - // - // Look at socket information from thread arg. - // - - - CEchoServer *pThreadData = (CEchoServer*)lpThreadParameter; - if (pThreadData==NULL) - { - DeleteBufferExitThread(1); - } - - SOCKET sClient = pThreadData->m_socket; - HANDLE NetworkEvent = pThreadData->m_NetworkEvent; - WSANETWORKEVENTS NetworkEvents; - printf("Client Start: 0x%Ix\n", sClient); - int actual = 0; - for(;;) - { - if ((Event = WSAWaitForMultipleEvents( - 1, - &NetworkEvent, - FALSE, - WSA_INFINITE, - FALSE)) == WSA_WAIT_FAILED) - { - printf("WSAWaitForMultipleEvents failed with error %d\n", WSAGetLastError()); - DeleteBufferReturn(0); - } - - if (WSAEnumNetworkEvents(sClient ,NetworkEvent, &NetworkEvents) == SOCKET_ERROR) - { - printf("WSAEnumNetworkEvents failed with error %d\n", WSAGetLastError()); - DeleteBufferReturn(0); - } - - if (NetworkEvents.lNetworkEvents & FD_READ) - { - if (NetworkEvents.lNetworkEvents & FD_READ && NetworkEvents.iErrorCode[FD_READ_BIT] != 0) - { - printf("FD_READ failed with error %d\n", NetworkEvents.iErrorCode[FD_READ_BIT]); - } - else - { - - actual = recv(sClient,buffer,DATA_LENGTH*sizeof(char),0); - // - // socket connection has been reset ,so bail out . - // - if (actual == 0 || actual == WSAECONNRESET ) - { - printf(" Could not get data , Error : 0x%lx \n",WSAGetLastError()); - break; // socket shut-down - - } - printf("FD_READ read buffer on client 0x%Ix with length %d \n",sClient,actual); - count = send(sClient, (const char*)buffer,actual,0); - if ( count == SOCKET_ERROR ) - { - if ( WSAGetLastError()== WSAEWOULDBLOCK ) - { - printf(" Could not send data as resource is unavaliable , do not retry until next Write event \n"); - } - else - { - printf(" Could not send data , Error : 0x%lx \n",WSAGetLastError()); - break; - } - } - else - { - printf("FD_WRITE write buffer on client 0x%Ix with length %d \n",sClient,count); - } - } - } - // - // if there is a write network event and there is data to write , write that - // - if (NetworkEvents.lNetworkEvents & FD_WRITE) - { - if (NetworkEvents.lNetworkEvents & FD_WRITE && NetworkEvents.iErrorCode[FD_WRITE_BIT] != 0) - { - printf("FD_WRITE failed with error %d\n", NetworkEvents.iErrorCode[FD_WRITE_BIT]); - } - else - { - count = send(sClient, (const char*)buffer,actual,0); - if ( count == SOCKET_ERROR ) - { - if ( WSAGetLastError()== WSAEWOULDBLOCK ) - { - printf(" Could not send data as resource is unavaliable , do not retry until next Write event "); - } - else - { - printf(" Could not send data , Error : 0x%lx \n",WSAGetLastError()); - break; - } - } - else - { - printf("FD_WRITE write buffer on client 0x%Ix with length %d \n",sClient,count); - } - actual = 0; - } - } - if (NetworkEvents.lNetworkEvents & FD_CLOSE) - { - shutdown(sClient,FD_READ|FD_WRITE); - printf(" recived a close from client : 0x%Ix \n",sClient); - closesocket(sClient); - DeleteBufferExitThread(0); - } - } - - DeleteBufferReturn(1); - -} - -CEchoServer::CEchoServer( - SOCKET socketclient - ) -/*++ - -Routine Description: - - This is the constructor routine for CEchoServer class. This is called for each instance of new - connection accepted by the server . - -Arguments: - - Socket received from the accept - -Return Value: - - None . - ---*/ -{ - m_socket = socketclient; - m_NetworkEvent = WSACreateEvent(); - printf("socket created : 0x%Ix \n", m_socket); - -} - -void -CEchoServer::Start() -/*++ - -Routine Description: - - This routine is to Start the thread which will rcv and send the data recieved on this instance of socket connection. - - -Arguments: - - None. - -Return Value: - - None. ---*/ -{ - - - if(WSAEventSelect( - m_socket, - m_NetworkEvent, - FD_READ|FD_WRITE|FD_CLOSE)== SOCKET_ERROR) - { - printf("Error in Event Select,Cannot start Server thread for this socket \n"); - closesocket(m_socket); - goto Exit; - } -// -// Create thread to read/write data to this socket -// - - HANDLE hRunThread = CreateThread( - NULL, // Default Security Attrib. - 0, // Initial Stack Size, - (LPTHREAD_START_ROUTINE) Run, // Thread Func - this, // Arg to Thread Func. - 0, // Creation Flags - NULL // Don't need the Thread Id. - ); - if (NULL == hRunThread) - { - printf(" Could not create socket server run thread : 0x%lx \n", GetLastError()); - closesocket(m_socket); - goto Exit; - } - -Exit: - - return ; - } - -void -SocketServerMain( - _In_ unsigned short uPort - ) -/*++ - -Routine Description: - - This routine is the main entry for the app when the app is configured to - be a socket server. - It creates a a listening socket for incoming conenctions. - - -Arguments: - - uPort - Port Number that the socket server binds to - -Return Value: - - None. ---*/ -{ - - - SOCKET ListenSocket; - int iResult; - #pragma warning( suppress: 24002 ) // suppress warning for IPv6 ,currently IPv4 specific - sockaddr_in service ; - - // Initialize Winsock 2.2 - WSADATA wsaData; - iResult = WSAStartup(MAKEWORD(2,2), &wsaData); - if ( NO_ERROR != iResult ) - { - printf("Error at WSAStartup() \n"); - goto Exit; - } - // - // Create a SOCKET for listening for incoming connection requests. - // - ListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if ( INVALID_SOCKET == ListenSocket) - { - printf("Error at socket(): %ld\n ", WSAGetLastError()); - goto Cleanup; - } - // The sockaddr_in structure specifies the address family, - // IP address, and port for the socket that is being bound. - service.sin_family = AF_INET; - // - // Suppress overflow warning. - // inet_pton is annotated to write sizeof(IN6_ADDR) bytes to pAddrBuf, - // but it only writes sizeof(IN_ADDR) bytes when Family is AF_INET (IPv4). - // https://msdn.microsoft.com/en-us/library/windows/desktop/cc805844(v=vs.85).aspx - // - #pragma warning( suppress: 26000 ) - iResult = inet_pton(AF_INET, "127.0.0.1", &service.sin_addr); - if (iResult != 1) - { - printf("Error at inet_pton(): %ld\n ", WSAGetLastError()); - closesocket(ListenSocket); - goto Cleanup; - } - service.sin_port = htons(uPort); - if (SOCKET_ERROR == bind( - ListenSocket, - (SOCKADDR*) &service, - sizeof(service) ) ) - { - printf("bind() failed. \n"); - closesocket(ListenSocket); - goto Cleanup; - } - - // - // Listen for incoming connection requests - // on the created socket upto MAX_CONNECTIONS - // - if ( SOCKET_ERROR == listen( - ListenSocket, - MAX_CONNECTIONS ) ) - { - printf("Error listening on socket.\n"); - } - printf("Listening on socket...\n"); - - // - // Set Socket RCVBUF and SNDBUF size to DATA_LENGTH , so large requests are not fragmented . - // - int iOptVal; - int iOptLen = sizeof(int); - - if (getsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR) - { - printf("SO_RCVBUF value: %ld\n", iOptVal); - } - iOptVal = DATA_LENGTH; - iOptLen = sizeof(int); - if (setsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, iOptLen) != SOCKET_ERROR) - { - printf("Set SO_RCVBUF: ON\n"); - } - iOptLen = sizeof(int); - if (getsockopt(ListenSocket, SOL_SOCKET, SO_RCVBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR) - { - printf("SO_RCVBUF Value: %ld\n", iOptVal); - } - iOptLen = sizeof(int); - if (getsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR) - { - printf("SO_SNDBUF value: %ld\n", iOptVal); - } - iOptVal = DATA_LENGTH; - iOptLen = sizeof(int); - if (setsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, iOptLen) != SOCKET_ERROR) - { - printf("Set SO_SNDBUF: ON\n"); - } - iOptLen = sizeof(int); - if (getsockopt(ListenSocket, SOL_SOCKET, SO_SNDBUF, (char*)&iOptVal, &iOptLen) != SOCKET_ERROR) - { - printf("SO_SNDBUF Value: %ld\n", iOptVal); - } - -// -// Loop the server to start accepting connections from clients on this socket -// - - for(;;) - { - CEchoServer *client = new CEchoServer(accept(ListenSocket,NULL,NULL)); - - if (client) - { - printf("Client connected.\n"); - client->Start(); // Start receiving/sending data on the socket - } - } - -Cleanup: - // - // Invoke Winsock Cleanup - // - - WSACleanup(); - - Exit: - return; - -} -void -Usage() - -/*++ - -Routine Description: - - This routine is invoked to display the usage of this application - -Arguments: - - None. - -Return Value: - - None . ---*/ - -{ - printf("\n\n Usage: \n"); - printf(" ------ \n\n"); - printf(" socketechoapp Display Usage \n"); - printf(" socketechoapp -h Display Usage\n"); - printf(" socketechoapp -p Start the app as server listening on default port\n"); - printf(" socketechoapp -p [port#] Start the app as server listening on this port \n"); - - - -} - - -/* */ -void __cdecl -main( - _In_ int argc, - _In_reads_(argc) char* argv[] - ) - -/*++ - -Routine Description: - - - -Arguments: - - None. - -Return Value: - - None. ---*/ -{ - unsigned short argIndex = 1 ; - unsigned short uPort = DEFAULT_PORT_ADDRESS ; - - - if (argc < 2) - { - Usage(); - goto Exit; - } - -// -// look at second arg and check for either -h which indicates user asked for help in Usage -// of this commandline -// - - if (!strcmp(*(argv+argIndex),"-h")) - { - Usage(); - goto Exit; - } -// -// check if its -p and proceed with otherwise show usage -// - else if (!strcmp(*(argv+argIndex),"-p")) - { - // - // look at third arg, which should be the port# - // - if ( ++argIndex < argc ) - { - uPort = (unsigned short)atoi(*(argv+(argIndex))); - } - SocketServerMain(uPort); - - } - else - { - Usage(); - goto Exit; - } - -Exit: - return; - -} - - diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.h b/general/echo/umdfSocketEcho/Exe/socketechoserver.h deleted file mode 100644 index f71bc48b..00000000 --- a/general/echo/umdfSocketEcho/Exe/socketechoserver.h +++ /dev/null @@ -1,48 +0,0 @@ -/*++ - -Copyright (c) Microsoft Corporation. All rights reserved. - -Module Name: - - sockechoserver.h - -Abstract: - - Header file for the socket server module of the socketecho application - -Environment: - - User mode only - ---*/ - -#pragma once - - -#define MAX_CONNECTIONS 5 -#define DEFAULT_PORT_ADDRESS 6000 -#define DATA_LENGTH 1024*40 - -void -SocketServerMain( - _In_ unsigned short uPort - ); - - // - // Class definition for CEchoServer Class - // -class CEchoServer -{ - - public: - - SOCKET m_socket; - HANDLE m_NetworkEvent; - - - - CEchoServer(SOCKET socketclient); - void Start(); - -}; - diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj b/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj deleted file mode 100644 index e226bb5c..00000000 --- a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj +++ /dev/null @@ -1,190 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{70A0F94B-0D04-4AB4-A653-733AC0210EBC}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{0C41C62B-B1D0-4A46-B431-6DA1A153FDC0}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType /> - <PlatformToolset>WindowsApplicationForDrivers10.0</PlatformToolset> - <ConfigurationType>Application</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>socketechoserver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>socketechoserver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>socketechoserver</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>socketechoserver</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </ResourceCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </ResourceCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </ResourceCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);user32.lib;Ws2_32.lib</AdditionalDependencies> - </Link> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </ResourceCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(DDK_INC_PATH)</AdditionalIncludeDirectories> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="socketechoserver.cpp" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters b/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters deleted file mode 100644 index daed19de..00000000 --- a/general/echo/umdfSocketEcho/Exe/socketechoserver.vcxproj.Filters +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{6F82EFE8-0818-4BAE-A52F-C72D9E63CAD6}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{448C5D48-4FD2-4DA5-964C-3EF201A3ED31}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{439980EC-B0F0-45A7-AF18-E832E564F57D}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="socketechoserver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/echo/umdfSocketEcho/README.md b/general/echo/umdfSocketEcho/README.md deleted file mode 100644 index d4a6077f..00000000 --- a/general/echo/umdfSocketEcho/README.md +++ /dev/null @@ -1,146 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to use UMDF version 1 to write a driver and demonstrates best practices." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# 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 - -[User-Mode Driver Framework](https://docs.microsoft.com/windows-hardware/drivers/wdf/getting-started-with-umdf-version-2) - -## 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::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 - -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](https://docs.microsoft.com/windows-hardware/drivers/develop/deploying-a-driver-to-a-test-computer). Alternatively, you can install the sample from the command line. - -To test this sample, you must have a test computer. This test computer can be a second computer or, if necessary, your development computer. - -To install the UMDF Echo sample driver from the command line, do the following: - -1. Copy the driver binary and the socketecho.inf file to a directory on your test computer (for example, C:\\ socketechoSample.) - -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](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` - - You can find DevCon.exe in the \\tools directory of the WDK (for example, \\tools\\devcon\\i386\\devcon.exe). - -To update the socketecho driver after you make any changes, do the following: - -1. Increment the version number in the INF file. This change is not necessary, but it will help ensure that Plug and Play (PnP) selects your new driver as a better match for the device. - -1. Copy the updated driver binary and the socketecho.inf file to a directory on your test computer (for example, C:\\ socketechoSample.) - -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 update socketecho.inf WUDF\\socketecho` - -To test this sample drivers on a checked operating system that you have installed (in contrast to the standard retail installations), you must modify the INF file to use the checked version of the UMDF co-installer. That is, you must do the following: - -1. In the INX file, replace all occurrences of WudfUpdate\_*MMmmmm*.dll with WudfUpdate\_*MMmmmm*\_chk.dll. - -1. Copy the WudfUpdate\_*MMmmmm*\_chk.dll file from the \\redist\\wdf\\\<architecture\> directory to your driver package instead of WudfUpdate\_*MMmmmm*.dll. - -1. If WdfCoinstaller*MMmmmm*.dll or WinUsbCoinstaller.dll is included in your driver package, repeat step 1 and step 2 for them. - -## 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. - -First, you must install the device as described earlier. Then, run socketechoserver.exe from a Command Prompt window. - -`D:\\\>socketechoserver -h` - -## Usage - -socketechoserver 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 - -Listening on socket... -``` - -In another Command Prompt window, run echoapp.exe. - -```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 - -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] -> 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 - -**Dllsup.cpp**: The DLL support code that provides the DLL's entry point and the single required export (DllGetClassObject). diff --git a/general/echo/umdfSocketEcho/Test.txt b/general/echo/umdfSocketEcho/Test.txt deleted file mode 100644 index 5ae50e29..00000000 --- a/general/echo/umdfSocketEcho/Test.txt +++ /dev/null @@ -1 +0,0 @@ -Testing git hub actions. diff --git a/general/echo/umdfSocketEcho/umdfsocketecho.sln b/general/echo/umdfSocketEcho/umdfsocketecho.sln deleted file mode 100644 index 775550f5..00000000 --- a/general/echo/umdfSocketEcho/umdfsocketecho.sln +++ /dev/null @@ -1,46 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driver", "Driver", "{5926AA26-ED89-4B86-ADD3-6415A17996DF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Exe", "Exe", "{17E8DD65-7DC7-4D59-96A0-52A20C036403}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SocketEcho", "Driver\SocketEcho.vcxproj", "{353E2F22-BD87-47F3-A211-90DE8D583D26}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "socketechoserver", "Exe\socketechoserver.vcxproj", "{70A0F94B-0D04-4AB4-A653-733AC0210EBC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|Win32.ActiveCfg = Debug|Win32 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|Win32.Build.0 = Debug|Win32 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|Win32.ActiveCfg = Release|Win32 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|Win32.Build.0 = Release|Win32 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|x64.ActiveCfg = Debug|x64 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Debug|x64.Build.0 = Debug|x64 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|x64.ActiveCfg = Release|x64 - {353E2F22-BD87-47F3-A211-90DE8D583D26}.Release|x64.Build.0 = Release|x64 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|Win32.ActiveCfg = Debug|Win32 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|Win32.Build.0 = Debug|Win32 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|Win32.ActiveCfg = Release|Win32 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|Win32.Build.0 = Release|Win32 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|x64.ActiveCfg = Debug|x64 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Debug|x64.Build.0 = Debug|x64 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|x64.ActiveCfg = Release|x64 - {70A0F94B-0D04-4AB4-A653-733AC0210EBC}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {353E2F22-BD87-47F3-A211-90DE8D583D26} = {5926AA26-ED89-4B86-ADD3-6415A17996DF} - {70A0F94B-0D04-4AB4-A653-733AC0210EBC} = {17E8DD65-7DC7-4D59-96A0-52A20C036403} - EndGlobalSection -EndGlobal diff --git a/general/pcidrv/kmdf/genpci.inx b/general/pcidrv/kmdf/genpci.inx Binary files differindex b10b695a..db6e5c55 100644 --- a/general/pcidrv/kmdf/genpci.inx +++ b/general/pcidrv/kmdf/genpci.inx diff --git a/general/toaster/toastDrv/Package/package.VcxProj b/general/toaster/toastDrv/Package/package.VcxProj index 572e08b5..85af0a9a 100644 --- a/general/toaster/toastDrv/Package/package.VcxProj +++ b/general/toaster/toastDrv/Package/package.VcxProj @@ -40,12 +40,6 @@ <ProjectReference Include="..\kmdf\toastmon\wdftoastmon.vcxproj"> <Project>{D15FD911-F2DA-4644-8142-6D22756AD287}</Project> </ProjectReference> - <ProjectReference Include="..\umdf\func\WUDFToaster.vcxproj"> - <Project>{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}</Project> - </ProjectReference> - <ProjectReference Include="..\umdf\Toastmon\WUDFToastMon.vcxproj"> - <Project>{F575419D-099B-4DA0-B80C-88D766DD7542}</Project> - </ProjectReference> </ItemGroup> <PropertyGroup Label="PropertySheets"> <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> diff --git a/general/toaster/toastDrv/README.md b/general/toaster/toastDrv/README.md index fc84c39d..4c5b52bc 100644 --- a/general/toaster/toastDrv/README.md +++ b/general/toaster/toastDrv/README.md @@ -10,7 +10,7 @@ products: # Toaster Sample Driver -The Toaster collection is an iterative series of samples that demonstrate fundamental aspects of Windows driver development for both Kernel-Mode Driver Framework (KMDF) and User-Mode Driver Framework (UMDF) version 1. +The Toaster collection is an iterative series of samples that demonstrate fundamental aspects of Windows driver development for both Kernel-Mode Driver Framework (KMDF). All the samples work with a hypothetical toaster bus, over which toaster devices can be connected to a PC. @@ -76,89 +76,3 @@ As an alternative to building the Toaster sample in Visual Studio, you can build For more information about using MSBuild to build a driver package, see [Building a Driver with Visual Studio and the WDK](https://docs.microsoft.com/windows-hardware/drivers/develop/building-a-driver). -## UMDF Toaster File Manifest - -### WUDFToaster.idl - -Component Interface file - -### WUDFToaster.cpp - -DLL Support code - provides the DLL's entry point as well as the DllGetClassObject export. - -### WUDFToaster.def - -This file lists the functions that the driver DLL exports. - -### stdafx.h - -This is the main header file for the sample driver. - -### driver.cpp and driver.h (WUDFToaster) - -Definition and implementation of the IDriverEntry callbacks in CDriver class. - -### device.cpp and device.h (WUDFToaster) - -Definition and implementation of various interfaces and their callbacks in CDevice class. Add your PnP and Power interfaces specific for your hardware. - -### queue.cpp and queue.h - -Definition and implementation of the base queue callback class (CQueue). IQueueCallbackDevicekIoControl, IQueueCallbackRead and IQueueCallBackWrite callbacks are implemented to handle I/O control requests. - -### WUDFToaster.rc - -This file defines resource information for the WUDF Toaster sample driver. - -### WUDFToaster.inf - -Sample INF for installing the sample WUDF Toaster driver under the Toaster class of devices. - -### WUDFtoaster.ctl, internal.h - -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. - -## Toastmon File Manifest - -### comsup.cpp and comsup.h - -Boilerplate COM Support code - specifically base classes which provide implementations for the standard COM interfaces IUnknown and IClassFactory which are used throughout the 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 - -Boilerplate 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 - -This file lists the functions that the driver DLL exports. - -### internal.h - -This is the main header file for the ToastMon driver - -### driver.cpp and driver.h (Toastmon) - -Definition and implementation of the driver callback class for the ToastMon sample. - -### device.cpp and device.h (Toastmon) - -Definition and implementation of the device callback class for the ToastMon sample. This is mostly boilerplate, but also registers for RemoteInterface Arrival notifications. When a RemoteInterface arrival callback occurs, it calls CreateRemoteInterface and creates a CMyRemoteTarget callback object to handle I/O on that RemoteInterface. - -### RemoteTarget.cpp and RemoteTarget.h - -Definition and implementation of the remote target callback class for the ToastMon sample. - -### list.h - -Doubly-linked-list code - -### ToastMon.rc - -This file defines resource information for the ToastMon sample driver. - -### UMDFToastMon.inf - -Sample INF for installing the Skeleton driver to control a root enumerated device with a hardware ID of UMDFSamples\\ToastMon diff --git a/general/toaster/toastDrv/exe/notify/notify.c b/general/toaster/toastDrv/exe/notify/notify.c index 3362ce3d..15e5a615 100644 --- a/general/toaster/toastDrv/exe/notify/notify.c +++ b/general/toaster/toastDrv/exe/notify/notify.c @@ -35,7 +35,7 @@ Revision History: // Annotation to indicate to prefast that this is nondriver user-mode code. // #include <DriverSpecs.h> -_Analysis_mode_(_Analysis_code_type_user_code_) +_Analysis_mode_(_Analysis_code_type_user_code_) #include <windows.h> #include <stdlib.h> @@ -494,7 +494,7 @@ HandleDeviceInterfaceChange( if(!GetDeviceDescription(dip->dbcc_name, - (PBYTE)deviceInfo->DeviceName, + deviceInfo->DeviceName, sizeof(deviceInfo->DeviceName), &deviceInfo->SerialNo)) { MessageBox(hWnd, TEXT("GetDeviceDescription failed"), TEXT("Error!"), MB_OK); @@ -783,7 +783,7 @@ EnumExistingDevices( // Get the device details such as friendly name and SerialNo // if(!GetDeviceDescription(deviceInterfaceDetailData->DevicePath, - (PBYTE)deviceInfo->DeviceName, + deviceInfo->DeviceName, sizeof(deviceInfo->DeviceName), &deviceInfo->SerialNo)){ goto Error; @@ -873,7 +873,7 @@ BOOLEAN Cleanup(HWND hWnd) BOOL GetDeviceDescription( _In_ LPTSTR DevPath, - _Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer, + _Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer, _In_ ULONG OutBufferLen, _In_ PULONG SerialNo ) @@ -917,14 +917,14 @@ GetDeviceDescription( if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData, SPDRP_FRIENDLYNAME, &dwRegType, - OutBuffer, + (PBYTE) OutBuffer, OutBufferLen, NULL)) { if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData, SPDRP_DEVICEDESC, &dwRegType, - OutBuffer, + (PBYTE) OutBuffer, OutBufferLen, NULL)){ goto Error; diff --git a/general/toaster/toastDrv/exe/notify/notify.h b/general/toaster/toastDrv/exe/notify/notify.h index 98db2918..7bddb547 100644 --- a/general/toaster/toastDrv/exe/notify/notify.h +++ b/general/toaster/toastDrv/exe/notify/notify.h @@ -154,7 +154,7 @@ BOOLEAN Cleanup( BOOL GetDeviceDescription( _In_ LPTSTR DevPath, - _Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer, + _Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer, _In_ ULONG OutBufferLen, _In_ PULONG SerialNo ); diff --git a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx Binary files differindex 55f07bda..912596fd 100644 --- a/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx +++ b/general/toaster/toastDrv/kmdf/bus/dynamic/dynambus.inx diff --git a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx Binary files differindex 544c87ed..76cab06a 100644 --- a/general/toaster/toastDrv/kmdf/bus/static/statbus.inx +++ b/general/toaster/toastDrv/kmdf/bus/static/statbus.inx diff --git a/general/toaster/toastDrv/kmdf/filter/filter.inx b/general/toaster/toastDrv/kmdf/filter/filter.inx Binary files differindex a8538010..7958ef4d 100644 --- a/general/toaster/toastDrv/kmdf/filter/filter.inx +++ b/general/toaster/toastDrv/kmdf/filter/filter.inx diff --git a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx Binary files differindex 1b81d480..4b7f091f 100644 --- a/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx +++ b/general/toaster/toastDrv/kmdf/func/featured/wdffeatured.inx diff --git a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx Binary files differindex aac79307..46fcb3d4 100644 --- a/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx +++ b/general/toaster/toastDrv/kmdf/func/simple/wdfsimple.inx diff --git a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx Binary files differindex a63a6c5c..2986b5e4 100644 --- a/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx +++ b/general/toaster/toastDrv/kmdf/toastmon/wdftoastmon.inx diff --git a/general/toaster/toastDrv/toaster.sln b/general/toaster/toastDrv/toaster.sln index 0d1c2e6c..551f7a75 100644 --- a/general/toaster/toastDrv/toaster.sln +++ b/general/toaster/toastDrv/toaster.sln @@ -37,12 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Bus", "Bus", "{320825A6-82C EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Dynamic", "Dynamic", "{4A994F2B-05BD-4CED-9157-45B29777740D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Toastmon", "Toastmon", "{16ECEF20-C217-4477-8C88-E8A231CC23B8}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umdf", "Umdf", "{82276D55-C8B4-4C84-98FE-83F10C898FA0}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Func", "Func", "{9BEE50D5-9D78-4CA3-A535-75904B21C448}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "package", "Package\package.VcxProj", "{30FFB863-CECC-4E27-85F1-8DAC2256FC2F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WmiToast", "exe\wmi\WmiToast.vcxproj", "{869C08D1-A32F-49C7-9831-2ADB52F241B6}" @@ -67,10 +61,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "StatBus", "kmdf\bus\static\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dynambus", "kmdf\bus\dynamic\dynambus.vcxproj", "{E5E1F492-05BB-45A3-B09F-F643DC1C6B03}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFToastMon", "umdf\Toastmon\WUDFToastMon.vcxproj", "{F575419D-099B-4DA0-B80C-88D766DD7542}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WUDFToaster", "umdf\func\WUDFToaster.vcxproj", "{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -175,22 +165,6 @@ Global {E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Debug|x64.Build.0 = Debug|x64 {E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Release|x64.ActiveCfg = Release|x64 {E5E1F492-05BB-45A3-B09F-F643DC1C6B03}.Release|x64.Build.0 = Release|x64 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|Win32.ActiveCfg = Debug|Win32 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|Win32.Build.0 = Debug|Win32 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|Win32.ActiveCfg = Release|Win32 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|Win32.Build.0 = Release|Win32 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|x64.ActiveCfg = Debug|x64 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Debug|x64.Build.0 = Debug|x64 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|x64.ActiveCfg = Release|x64 - {F575419D-099B-4DA0-B80C-88D766DD7542}.Release|x64.Build.0 = Release|x64 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|Win32.ActiveCfg = Debug|Win32 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|Win32.Build.0 = Debug|Win32 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|Win32.ActiveCfg = Release|Win32 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|Win32.Build.0 = Release|Win32 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|x64.ActiveCfg = Debug|x64 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Debug|x64.Build.0 = Debug|x64 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|x64.ActiveCfg = Release|x64 - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -208,8 +182,6 @@ Global {B39F6628-73BA-4AC3-863A-EA20892F1EFD} = {9577224D-E994-4E6E-BE11-FF456B8A4D46} {6C6E0C23-5B37-4BBB-8909-435078D49364} = {A69FDC71-8327-494A-9840-CF684E74965C} {E5E1F492-05BB-45A3-B09F-F643DC1C6B03} = {4A994F2B-05BD-4CED-9157-45B29777740D} - {F575419D-099B-4DA0-B80C-88D766DD7542} = {16ECEF20-C217-4477-8C88-E8A231CC23B8} - {3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F} = {9BEE50D5-9D78-4CA3-A535-75904B21C448} {C1205C19-4601-4DF6-A222-91CC30C12284} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0} {26B8AB05-2BE2-4266-AB19-BA912C0ACFA1} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0} {D2F3C374-F164-4E08-A5FE-F902972C57F9} = {B1177A9B-61C5-4747-B40A-9F36D83CE9A0} @@ -224,7 +196,5 @@ Global {A69FDC71-8327-494A-9840-CF684E74965C} = {320825A6-82C4-42DE-91A3-EE5994B74EC3} {320825A6-82C4-42DE-91A3-EE5994B74EC3} = {57D2095B-0A01-4F4C-A5D8-50F40DC155D0} {4A994F2B-05BD-4CED-9157-45B29777740D} = {320825A6-82C4-42DE-91A3-EE5994B74EC3} - {16ECEF20-C217-4477-8C88-E8A231CC23B8} = {82276D55-C8B4-4C84-98FE-83F10C898FA0} - {9BEE50D5-9D78-4CA3-A535-75904B21C448} = {82276D55-C8B4-4C84-98FE-83F10C898FA0} EndGlobalSection EndGlobal diff --git a/general/toaster/toastDrv/umdf/Toastmon/Device.cpp b/general/toaster/toastDrv/umdf/Toastmon/Device.cpp deleted file mode 100644 index 5b2bde41..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/Device.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Device.cpp - -Abstract: - - This module contains the implementation of the UMDF sample driver's - device callback object. - - This sample demonstrates how to register for PnP event notification - for an interface class, and how to handle arrival events. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "device.tmh" - -HRESULT -CMyDevice::CreateInstance( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit, - _Out_ PCMyDevice * MyDevice - ) -/*++ - - Routine Description: - - This method creates and initializs an instance of the driver's - device callback object. - - Arguments: - - FxDeviceInit - the settings for the device. - - MyDevice - a location to store the referenced pointer to the device object. - - Return Value: - - Status - ---*/ -{ - PCMyDevice myDevice; - HRESULT hr; - - // - // Allocate a new instance of the device class. - // - - myDevice = new CMyDevice(); - - if (NULL == myDevice) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the instance. - // - - hr = myDevice->Initialize(FxDriver, FxDeviceInit); - - if (SUCCEEDED(hr)) - { - *MyDevice = myDevice; - } - else - { - myDevice->Release(); - } - - return hr; -} - -HRESULT -CMyDevice::Initialize( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit - ) -/*++ - - Routine Description: - - This method initializes the device callback object and creates the - partner device object. - - Then it registers for toaster device notifications. - - - Arguments: - - FxDeviceInit - the settings for this device. - - Return Value: - - status. - ---*/ -{ - CComPtr<IWDFDevice> fxDevice; - HRESULT hr; - - // - // Save a weak reference to the Fx driver object. We'll need it to create - // CMyRemoteTarget objects. - // - - m_FxDriver = FxDriver; - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the device). We pass that to - // CreateDevice, which takes its own reference if everything works. - // - - { - IUnknown *unknown = this->QueryIUnknown(); - - // - // Create a new FX device object and assign the new callback object to - // handle any device level events that occur. - // - hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice); - - unknown->Release(); - } - - // - // If that succeeded then set our FxDevice member variable. - // - - CComPtr<IWDFDevice2> fxDevice2; - if (SUCCEEDED(hr)) - { - // - // Q.I. for the latest version of this interface. - // - hr = fxDevice->QueryInterface(IID_PPV_ARGS(&fxDevice2)); - } - - if (SUCCEEDED(hr)) - { - // - // Store a weak reference to the IWDFDevice2 interface. Since this object - // is partnered with the framework object they have the same lifespan - - // there is no need for an additional reference. - // - - m_FxDevice = fxDevice2; - } - - return hr; -} - -HRESULT -CMyDevice::Configure( - VOID - ) -/*++ - - Routine Description: - - This method is called after the device callback object has been initialized - and returned to the driver. - - Return Value: - - status - ---*/ -{ - HRESULT hr = S_OK; - - // - // Register for TOASTER device interface change notification. - // We will get OnRemoteInterfaceArrival() calls when a remote toaster - // device is started. - // - // Arrival notification will be sent for all existing and future toaster - // devices. - // - // The framework will take care of unregistration when the device unloads. - // - hr = m_FxDevice->RegisterRemoteInterfaceNotification(&GUID_DEVINTERFACE_TOASTER, - true); - - return hr; -} - - -HRESULT -CMyDevice::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method is called to get a pointer to one of the object's callback - interfaces. - - Arguments: - - InterfaceId - the interface being requested - - Object - a location to store the interface pointer if successful - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - HRESULT hr; - - if(IsEqualIID(InterfaceId, __uuidof(IPnpCallbackRemoteInterfaceNotification))) - { - *Object = QueryIPnpCallbackRemoteInterfaceNotification(); - hr = S_OK; - } - else - { - hr = CUnknown::QueryInterface(InterfaceId, Object); - } - - return hr; -} - -// -// IPnpCallbackRemoteInterfaceNotification -// - -void -STDMETHODCALLTYPE -CMyDevice::OnRemoteInterfaceArrival( - _In_ IWDFRemoteInterfaceInitialize * FxRemoteInterfaceInit - ) -/*++ - - Routine Description: - - This method is called by the framework when a new remote interface has come - online. These calls will only occur one at a time. - - Arguments: - - FxRemoteInterfaceInit - An identifier for the remote interface. - ---*/ -{ - HRESULT hr = S_OK; - - - // - // Create a new FX remote interface object and assign a NULL callback - // object since we don't care to handle any remote interface level events - // that occur. - // - - CComPtr<IWDFRemoteInterface> fxRemoteInterface; - - hr = m_FxDevice->CreateRemoteInterface(FxRemoteInterfaceInit, - NULL, - &fxRemoteInterface); - - // - // Create an instance of CMyRemoteTarget which will open the remote device - // and post I/O requests to it. - // - - PCMyRemoteTarget myRemoteTarget = NULL; - if (SUCCEEDED(hr)) - { - hr = CMyRemoteTarget::CreateInstance(this, - m_FxDriver, - m_FxDevice, - fxRemoteInterface, - &myRemoteTarget); - } - - if (SUCCEEDED(hr)) - { - if (myRemoteTarget != NULL) - { - // - // Add to our list - // - InsertHeadList(&m_MyRemoteTargets, &myRemoteTarget->m_Entry); - - // - // Release, since framework will keep a reference - // - myRemoteTarget->Release(); - } - } - - if (FAILED(hr)) - { - if (fxRemoteInterface != NULL) - { - // - // We failed to create the CMyRemoteTarget, delete the - // RemoteInterface object - // - fxRemoteInterface->DeleteWdfObject(); - } - } -} - diff --git a/general/toaster/toastDrv/umdf/Toastmon/Device.h b/general/toaster/toastDrv/umdf/Toastmon/Device.h deleted file mode 100644 index c457a8da..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/Device.h +++ /dev/null @@ -1,162 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Device.h - -Abstract: - - This module contains the type definitions for the UMDF sample - driver's device callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once -#include "initguid.h" - - -//{781EF630-72B2-11d2-B852-00C04FAD5171} -DEFINE_GUID(GUID_DEVINTERFACE_TOASTER, 0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71); - - -// -// Class for the sample device. -// - -class CMyDevice : public CUnknown, - public IPnpCallbackRemoteInterfaceNotification -{ - // - // Private data members. - // -private: - - // - // Weak reference to the WDF device object. - // - - IWDFDevice2 *m_FxDevice; - - // - // Weak reference to the WDF driver object - // - - IWDFDriver *m_FxDriver; - - // - // Head of remote target list - // - - LIST_ENTRY m_MyRemoteTargets; - - // - // Private methods. - // -private: - - // - // Protected methods - // -protected: - CMyDevice( - VOID - ) : - m_FxDevice(NULL), - m_FxDriver(NULL) - { - InitializeListHead(&m_MyRemoteTargets); - } - - HRESULT - Initialize( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit - ); - - // - // Public methods - // -public: - - // - // The factory method used to create an instance of this driver. - // - static - HRESULT - CreateInstance( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit, - _Out_ PCMyDevice * MyDevice - ); - - HRESULT - Configure( - VOID - ); - - ~CMyDevice( - VOID - ) - { - ATLASSERT(IsListEmpty(&m_MyRemoteTargets)); - } - - // - // COM methods - // -public: - - // - // IUnknown methods. - // - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // IPnpCallbackRemoteInterfaceNotification - // - void - STDMETHODCALLTYPE - OnRemoteInterfaceArrival( - _In_ IWDFRemoteInterfaceInitialize * FxRemoteInterfaceInit - ); - IPnpCallbackRemoteInterfaceNotification * - QueryIPnpCallbackRemoteInterfaceNotification( - VOID - ) - { - AddRef(); - return static_cast<IPnpCallbackRemoteInterfaceNotification*>(this); - } - -}; diff --git a/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp b/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp deleted file mode 100644 index adf74dc0..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/Driver.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Driver.cpp - -Abstract: - - This module contains the implementation of the UMDF Sample's - core driver callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "driver.tmh" - -HRESULT -CMyDriver::CreateInstance( - _Out_ PCMyDriver * MyDriver - ) -/*++ - - Routine Description: - - This static method is invoked in order to create and initialize a new - instance of the driver class. The caller should arrange for the object - to be released when it is no longer in use. - - Arguments: - - MyDriver - a location to store a referenced pointer to the new instance - - Return Value: - - S_OK if successful, or error otherwise. - ---*/ -{ - PCMyDriver myDriver; - HRESULT hr; - - // - // Allocate the callback object. - // - - myDriver = new CMyDriver(); - - if (NULL == myDriver) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the callback object. - // - - hr = myDriver->Initialize(); - - if (SUCCEEDED(hr)) - { - // - // Store a pointer to the new, initialized object in the output - // parameter. - // - - *MyDriver = myDriver; - } - else - { - - // - // Release the reference on the driver object to get it to delete - // itself. - // - - myDriver->Release(); - } - - return hr; -} - -HRESULT -CMyDriver::Initialize( - VOID - ) -/*++ - - Routine Description: - - This method is called to initialize a newly created driver callback object - before it is returned to the creator. Unlike the constructor, the - Initialize method contains operations which could potentially fail. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - return S_OK; -} - -HRESULT -CMyDriver::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Interface - ) -/*++ - - Routine Description: - - This method returns a pointer to the requested interface on the callback - object. - - Arguments: - - InterfaceId - the IID of the interface to query/reference - - Interface - a location to store the interface pointer. - - Return Value: - - S_OK if the interface is supported. - E_NOINTERFACE if it is not supported. - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry))) - { - *Interface = QueryIDriverEntry(); - return S_OK; - } - else - { - return CUnknown::QueryInterface(InterfaceId, Interface); - } -} - -HRESULT -CMyDriver::OnDeviceAdd( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ) -/*++ - - Routine Description: - - The FX invokes this method when it wants to install our driver on a device - stack. This method creates a device callback object, then calls the Fx - to create an Fx device object and associate the new callback object with - it. - - Arguments: - - FxWdfDriver - the Fx driver object. - - FxDeviceInit - the initialization information for the device. - - Return Value: - - status - ---*/ -{ - PCMyDevice myDevice = NULL; - - HRESULT hr; - - // - // Create a new instance of our device callback object - // - - hr = CMyDevice::CreateInstance(FxDriver, FxDeviceInit, &myDevice); - - // - // If that succeeded then call the device's construct method. This - // allows the device to create any queues or other structures that it - // needs now that the corresponding fx device object has been created. - // - - if (SUCCEEDED(hr)) - { - hr = myDevice->Configure(); - } - - // - // Release the reference on the device callback object now that it's been - // associated with an fx device object. - // - - if (NULL != myDevice) - { - myDevice->Release(); - } - - return hr; -} diff --git a/general/toaster/toastDrv/umdf/Toastmon/Driver.h b/general/toaster/toastDrv/umdf/Toastmon/Driver.h deleted file mode 100644 index aecb9765..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/Driver.h +++ /dev/null @@ -1,146 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Driver.h - -Abstract: - - This module contains the type definitions for the UMDF sample's - driver callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - - -// -// This class handles driver events for the sample. In particular -// it supports the OnDeviceAdd event, which occurs when the driver is called -// to setup per-device handlers for a new device stack. -// - -class CMyDriver : public CUnknown, - public IDriverEntry -{ - // - // Private data members. - // -private: - - // - // Private methods. - // -private: - - // - // Returns a referenced pointer to the IDriverEntry interface. - // - IDriverEntry * - QueryIDriverEntry( - VOID - ) - { - AddRef(); - return static_cast<IDriverEntry*>(this); - } - - HRESULT - Initialize( - VOID - ); - -// -// Public methods -// -public: - - // - // The factory method used to create an instance of this driver. - // - - static - HRESULT - CreateInstance( - _Out_ PCMyDriver * MyDriver - ); - - // - // COM methods - // -public: - - // - // IDriverEntry methods - // - - virtual - HRESULT - STDMETHODCALLTYPE - OnInitialize( - _In_ IWDFDriver * /* FxDriver */ - ) - { - return S_OK; - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnDeviceAdd( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit - ); - - virtual - VOID - STDMETHODCALLTYPE - OnDeinitialize( - _In_ IWDFDriver * /* FxDriver */ - ) - { - return; - } - - // - // IUnknown methods. - // - // We have to implement basic ones here that redirect to the - // base class because of the multiple inheritance. - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; diff --git a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp b/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp deleted file mode 100644 index 88ea7f8a..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.cpp +++ /dev/null @@ -1,538 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - RemoteTarget.cpp - -Abstract: - - This module contains the implementation of the UMDF sample driver's - remote interface and remote target callback object. - - This sample demonstrates how to open the remote target and register - and respond to device change notification. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "remotetarget.tmh" - - -DWORD WINAPI _ThreadProc( - _In_ LPVOID lpParameter - ) -{ - CMyRemoteTarget *MyRemoteTarget = (CMyRemoteTarget*)lpParameter; - - return MyRemoteTarget->ThreadProc(); -} - -HRESULT -CMyRemoteTarget::CreateInstance( - _In_ CMyDevice * MyDevice, - _In_ IWDFDriver * FxDriver, - _In_ IWDFDevice2 * FxDevice, - _In_ IWDFRemoteInterface * FxRemoteInterface, - _Out_ PCMyRemoteTarget * MyRemoteTarget - ) -/*++ - - Routine Description: - - This method creates and initializs an instance of the driver's - remote target callback object. - - Arguments: - - FxRemoteInterfaceInit - An identifier that specifies the remote toaster device. - - MyDevice - a location to store the referenced pointer to the device object. - - Return Value: - - Status - ---*/ -{ - PCMyRemoteTarget myRemoteTarget; - HRESULT hr; - - // - // Allocate a new instance of the remote target class. - // - - myRemoteTarget = new CMyRemoteTarget(); - - if (NULL == myRemoteTarget) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the instance. - // - - hr = myRemoteTarget->Initialize(MyDevice, - FxDriver, - FxDevice, - FxRemoteInterface); - - if (SUCCEEDED(hr)) - { - *MyRemoteTarget = myRemoteTarget; - } - else - { - myRemoteTarget->Release(); - } - - return hr; -} - -HRESULT -CMyRemoteTarget::Initialize( - _In_ CMyDevice * MyDevice, - _In_ IWDFDriver * FxDriver, - _In_ IWDFDevice2 * FxDevice, - _In_ IWDFRemoteInterface * FxRemoteInterface - ) -/*++ - - Routine Description: - - This method initializes the remote target callback object and creates - the partner remote target object. - - Arguments: - - FxRemoteInterface - the identifier for the remote toaster device. - - Return Value: - - status. - ---*/ -{ - HRESULT hr; - - CComPtr<IWDFIoRequest> fxWriteRequest; - CComPtr<IWDFIoRequest> fxReadRequest; - - // - // Save a weak reference to the class that created us - // so we can notify it when we get removed - // - - m_MyDevice = MyDevice; - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the CMyRemoteTarget). We pass that - // to the various Create* calls, which take their own reference if - // everything works. - // - - IUnknown * unknown = this->QueryIUnknown(); - - - // - // Create a new FX remote target object and assign the new callback - // object to handle any remote target level events that occur. - // - hr = FxDevice->CreateRemoteTarget(unknown, - FxRemoteInterface, - &m_FxTarget); - - if (SUCCEEDED(hr)) - { - // - // Open and start the remote target. Note that this sample doesn't - // perform any impersonation, so we're running as "Local Service" - // since that is what UMDF driver runs as. - // - // Make sure that your Toaster devices all have security ACLs that - // permit "Local Service" to access the device. The Win7 toaster - // sample driver INFs have been updated for this. However, if you - // had previously installed pre-Win7 versions of the Toaster sample - // driver, the security settings will not be updated by a new driver - // install, unless the Toaster device class key is deleted. - // - - hr = m_FxTarget->OpenRemoteInterface(FxRemoteInterface, - NULL, - GENERIC_READ | GENERIC_WRITE, - NULL); - } - - if (SUCCEEDED(hr)) - { - // - // Create a new FX request object and assign the new callback - // object to handle any request level events that occur. - // - hr = FxDevice->CreateRequest(unknown, - FxRemoteInterface, - &fxWriteRequest); - } - - if (SUCCEEDED(hr)) - { - // - // We want to save the newer IWDFIoRequest2 interface instead. - // - hr = fxWriteRequest->QueryInterface(IID_PPV_ARGS(&m_FxWriteRequest)); - } - - if (SUCCEEDED(hr)) - { - // - // Create a buffer for the write request - // - hr = FxDriver->CreateWdfMemory(WRITE_BUF_SIZE, - NULL, - FxRemoteInterface, - &m_FxWriteMemory); - } - - if (SUCCEEDED(hr)) - { - // - // Create a new FX remote target object and assign the new callback - // object to handle any remote target level events that occur. - // - hr = FxDevice->CreateRequest(unknown, - FxRemoteInterface, - &fxReadRequest); - } - - if (SUCCEEDED(hr)) - { - // - // We want to save the newer IWDFIoRequest2 interface instead. - // - hr = fxReadRequest->QueryInterface(IID_PPV_ARGS(&m_FxReadRequest)); - } - - if (SUCCEEDED(hr)) - { - // - // Create a buffer for the read request - // - hr = FxDriver->CreateWdfMemory(READ_BUF_SIZE, - NULL, - FxRemoteInterface, - &m_FxReadMemory); - } - - if (SUCCEEDED(hr)) - { - // - // Create/Start the thread which will post I/O requests to the remote - // target. - // - // NOTE: This would not be a typical driver pattern. Normally, your - // driver would receive some I/O from another caller and you'd - // use this I/O as a trigger to post I/O to the remote target. - // You may choose to forward the request directly with no changes, - // modify the request before sending, or create an entirely - // separate request. - // - m_hThread = CreateThread(NULL, - 0, - _ThreadProc, - this, - 0, - NULL); - - if (m_hThread == NULL) - { - hr = HRESULT_FROM_WIN32(GetLastError()); - } - } - - unknown->Release(); - - return hr; -} - -DWORD WINAPI CMyRemoteTarget::ThreadProc( - VOID - ) -/*++ - - Routine Description: - - This method is the main loop for a thread that posts I/O requests to - the remote target. The main loop continues until the remote target - is deleted, which happens in the Dispose() method. - ---*/ -{ - BOOL bContinue = TRUE; - - while(bContinue) - { - Sleep(100); - - switch(m_FxTarget->GetState()) - { - case WdfIoTargetStarted: - PostIoRequests(); - break; - - case WdfIoTargetClosedForQueryRemove: - break; - - case WdfIoTargetClosed: - case WdfIoTargetDeleted: - default: - bContinue = false; - break; - } - } - - return 0; -} - -void -CMyRemoteTarget::PostIoRequests( - VOID - ) -{ - HRESULT hr; - - if (!m_WriteInProgress) - { - // - // Mark that the request has been sent, so we don't try to send - // again before the completion routine runs. - // - m_WriteInProgress = true; - - hr = m_FxTarget->FormatRequestForWrite(m_FxWriteRequest, - NULL, - m_FxWriteMemory, - 0, - 0); - - if (SUCCEEDED(hr)) - { - m_FxWriteRequest->SetCompletionCallback(this, NULL); - - hr = m_FxWriteRequest->Send(m_FxTarget, 0, 0); - } - - if (FAILED(hr)) - { - m_WriteInProgress = false; - } - } - - if (!m_ReadInProgress) - { - // - // Mark that the request has been sent, so we don't try to send - // again before the completion routine runs. - // - m_ReadInProgress = true; - - hr = m_FxTarget->FormatRequestForRead(m_FxReadRequest, - NULL, - m_FxReadMemory, - 0, - 0); - - if (SUCCEEDED(hr)) - { - m_FxReadRequest->SetCompletionCallback(this, NULL); - - hr = m_FxReadRequest->Send(m_FxTarget, 0, 0); - } - - if (FAILED(hr)) - { - m_ReadInProgress = true; - } - } -} - -HRESULT -CMyRemoteTarget::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID * Object - ) -/*++ - - Routine Description: - - This method is called to get a pointer to one of the object's callback - interfaces. - - Arguments: - - InterfaceId - the interface being requested - - Object - a location to store the interface pointer if successful - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - HRESULT hr; - - if(IsEqualIID(InterfaceId, __uuidof(IRequestCallbackRequestCompletion))) - { - *Object = QueryIRequestCallbackRequestCompletion(); - hr = S_OK; - } - else if(IsEqualIID(InterfaceId, __uuidof(IRemoteTargetCallbackRemoval))) - { - *Object = QueryIRemoteTargetCallbackRemoval(); - hr = S_OK; - } - else if(IsEqualIID(InterfaceId, __uuidof(IObjectCleanup))) - { - *Object = QueryIObjectCleanup(); - hr = S_OK; - } - else - { - hr = CUnknown::QueryInterface(InterfaceId, Object); - } - - return hr; -} - -// -// IRequestCallbackRequestCompletion -// -void -STDMETHODCALLTYPE -CMyRemoteTarget::OnCompletion( - _In_ IWDFIoRequest * FxRequest, - _In_ IWDFIoTarget * /* FxTarget */, - _In_ IWDFRequestCompletionParams * /* Params */, - _In_ void* /* Context */ - ) -{ - IWDFRequestCompletionParams * CompletionParams; - - FxRequest->GetCompletionParams(&CompletionParams); - - if (CompletionParams->GetCompletedRequestType() == WdfRequestRead) - { - m_FxReadRequest->Reuse(E_FAIL); - m_ReadInProgress = false; - } - if (CompletionParams->GetCompletedRequestType() == WdfRequestWrite) - { - m_FxWriteRequest->Reuse(E_FAIL); - m_WriteInProgress = false; - } - - CompletionParams->Release(); -} - -// -// IRemoteTargetCallbackRemoval -// -BOOL -STDMETHODCALLTYPE -CMyRemoteTarget::OnRemoteTargetQueryRemove( - _In_ IWDFRemoteTarget * /* FxTarget */ - ) -{ - m_FxTarget->CloseForQueryRemove(); - - // - // Return FALSE if you want to VETO the Query - // - - return TRUE; -} - -VOID -STDMETHODCALLTYPE -CMyRemoteTarget::OnRemoteTargetRemoveCanceled( - _In_ IWDFRemoteTarget * /* FxTarget */ - ) -{ - if (FAILED(m_FxTarget->Reopen())) - { - m_FxTarget->Close(); - } -} - -VOID -STDMETHODCALLTYPE -CMyRemoteTarget::OnRemoteTargetRemoveComplete( - _In_ IWDFRemoteTarget * /* FxTarget */ - ) -{ - // - // The remote device has been removed, so we close the target for good. - // The rest of cleanup will occur when the framework handles the removal - // of the RemoteInterface - // - - m_FxTarget->Close(); -} - - -// -// IObjectCleanup -// - -void -STDMETHODCALLTYPE -CMyRemoteTarget::OnCleanup( - _In_ IWDFObject * /* FxObject */ - ) -{ - if (m_hThread != NULL) - { - if (m_FxTarget->GetState() != WdfIoTargetClosed) - { - // - // Close the target if it's still open. - // - // If the target has already gone through RemoveComplete, it should - // already be closed. - // - // If the Target interface is disabled without the device being - // removed, the target will still be open until now. - // - // If the ToastMon device itself is removed while a target is - // still active, we'll now close it. - // - m_FxTarget->Close(); - } - - // - // Wait for the Thread to complete - // - WaitForSingleObject(m_hThread, INFINITE); - - CloseHandle(m_hThread); - - m_hThread = NULL; - - // - // Remove ourselves from the list of Remote Targets - // - RemoveEntryList(&m_Entry); - } - - m_FxTarget = NULL; - m_FxWriteRequest = NULL; - m_FxReadRequest = NULL; -} - diff --git a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h b/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h deleted file mode 100644 index 15d91dad..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/RemoteTarget.h +++ /dev/null @@ -1,228 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - RemoteTarget.h - -Abstract: - - This module contains the type definitions for the UMDF sample - driver's remote target callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - - -#define READ_BUF_SIZE 100 -#define WRITE_BUF_SIZE 120 - - -class CMyRemoteTarget : public CUnknown, - public IRequestCallbackRequestCompletion, - public IRemoteTargetCallbackRemoval, - public IObjectCleanup -{ - // - // Public data members. - // -public: - - // - // This is the Entry for the list of Remote Targets. - // The List head is held by CMyDevice. - // - LIST_ENTRY m_Entry; - - - // - // Private data members. - // -private: - - CMyDevice * m_MyDevice; // Weak reference - - // - // The handle for a thread to post I/O requests to the remote target - // - HANDLE m_hThread; - - CComPtr<IWDFRemoteTarget> m_FxTarget; - - bool m_WriteInProgress; - CComPtr<IWDFIoRequest2> m_FxWriteRequest; - CComPtr<IWDFMemory> m_FxWriteMemory; - - bool m_ReadInProgress; - CComPtr<IWDFIoRequest2> m_FxReadRequest; - CComPtr<IWDFMemory> m_FxReadMemory; - - // - // Private methods. - // -private: - - void - PostIoRequests( - VOID - ); - - // - // Protected methods - // -protected: - - CMyRemoteTarget( - VOID - ) : - m_MyDevice(NULL), - m_hThread(NULL), - m_WriteInProgress(false), - m_ReadInProgress(false) - - { - } - - HRESULT - Initialize( - _In_ CMyDevice * MyDevice, - _In_ IWDFDriver * FxDriver, - _In_ IWDFDevice2 * FxDevice, - _In_ IWDFRemoteInterface * FxRemoteInterface - ); - - // - // Public methods - // -public: - - // - // The factory method used to create an instance of this driver. - // - static - HRESULT - CreateInstance( - _In_ CMyDevice * MyDevice, - _In_ IWDFDriver * FxDriver, - _In_ IWDFDevice2 * FxDevice, - _In_ IWDFRemoteInterface * FxRemoteInterface, - _Out_ PCMyRemoteTarget * MyRemoteTarget - ); - - ~CMyRemoteTarget( - VOID - ) - { - } - - DWORD WINAPI - ThreadProc( - VOID - ); - - // - // COM methods - // -public: - - // - // IUnknown methods. - // - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID * Object - ); - - // - // IRequestCallbackRequestCompletion - // - void - STDMETHODCALLTYPE - OnCompletion( - _In_ IWDFIoRequest * FxRequest, - _In_ IWDFIoTarget * /* FxTarget */, - _In_ IWDFRequestCompletionParams * /* Params */, - _In_ void* /* Context */ - ); - IRequestCallbackRequestCompletion * - QueryIRequestCallbackRequestCompletion( - VOID - ) - { - AddRef(); - return static_cast<IRequestCallbackRequestCompletion*>(this); - } - - // - // IRemoteTargetCallbackRemoval - // - BOOL - STDMETHODCALLTYPE - OnRemoteTargetQueryRemove( - _In_ IWDFRemoteTarget * /* FxTarget */ - ); - VOID - STDMETHODCALLTYPE - OnRemoteTargetRemoveCanceled( - _In_ IWDFRemoteTarget * /* FxTarget */ - ); - VOID - STDMETHODCALLTYPE - OnRemoteTargetRemoveComplete( - _In_ IWDFRemoteTarget * /* FxTarget */ - ); - IRemoteTargetCallbackRemoval * - QueryIRemoteTargetCallbackRemoval( - VOID - ) - { - AddRef(); - return static_cast<IRemoteTargetCallbackRemoval*>(this); - } - - // - // IObjectCleanup - // - void - STDMETHODCALLTYPE - OnCleanup( - _In_ IWDFObject* /* FxObject */ - ); - IObjectCleanup * - QueryIObjectCleanup( - VOID - ) - { - AddRef(); - return static_cast<IObjectCleanup*>(this); - } - -}; diff --git a/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc b/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc deleted file mode 100644 index 57983bbc..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/ToastMon.rc +++ /dev/null @@ -1,21 +0,0 @@ -//--------------------------------------------------------------------------- -// ToastMon.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include <windows.h> -#include <ntverp.h> - -// -// TODO: Change the file description and file names to match your binary. -// - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF ToastMon User-Mode Driver Sample" -#define VER_INTERNALNAME_STR "ToastMon" -#define VER_ORIGINALFILENAME_STR "ToastMon.dll" - -#include "common.ver" diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx Binary files differdeleted file mode 100644 index 245b304e..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.inx +++ /dev/null diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj deleted file mode 100644 index 3648d85f..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj +++ /dev/null @@ -1,285 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{F575419D-099B-4DA0-B80C-88D766DD7542}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR> - <SupportsPackaging>false</SupportsPackaging> - <RequiresPackageProject>true</RequiresPackageProject> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{439EDE87-12DD-4F6D-8C22-A8AC9DAEF4B2}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include="comsup.cpp; dllsup.cpp; driver.cpp; device.cpp; remotetarget.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </ClCompile> - <Inf Include="WUDFToastMon.inx"> - <Architecture>$(InfArch)</Architecture> - <SpecifyArchitecture>true</SpecifyArchitecture> - <CopyOutput>.\$(IntDir)\WUDFToastMon.inf</CopyOutput> - </Inf> - <OtherWpp Include="ToastMon.rc"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </OtherWpp> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>WUDFToastMon</TargetName> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>WUDFToastMon</TargetName> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>WUDFToastMon</TargetName> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>WUDFToastMon</TargetName> - <UseOfAtl>Dynamic</UseOfAtl> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib;$(SDK_LIB_PATH)\oleaut32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ResourceCompile Include="ToastMon.rc" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters b/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters deleted file mode 100644 index 890e83d6..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/WUDFToastMon.vcxproj.Filters +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{FDA736D6-A855-4CED-9C9E-B6FF707C26E1}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{03AC1F65-1B83-4D8E-9D06-DF35B5085EA7}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{E8FFB961-9B2B-4A4A-8F75-5F933AF32C60}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{C6C8B61F-CD41-4ACB-AC13-2E7A02CC94A0}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="comsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="device.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="dllsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="driver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="remotetarget.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <None Include="exports.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="ToastMon.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp b/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp deleted file mode 100644 index fd298470..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/comsup.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.cpp - -Abstract: - - This module contains implementations for the functions and methods - used for providing COM support. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" - -#include "comsup.tmh" - -// -// Implementation of CUnknown methods. -// - -CUnknown::CUnknown( - VOID - ) : m_ReferenceCount(1) -/*++ - - Routine Description: - - Constructor for an instance of the CUnknown class. This simply initializes - the reference count of the object to 1. The caller is expected to - call Release() if it wants to delete the object once it has been allocated. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - // do nothing. -} - -HRESULT -STDMETHODCALLTYPE -CUnknown::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method provides the basic support for query interface on CUnknown. - If the interface requested is IUnknown it references the object and - returns an interface pointer. Otherwise it returns an error. - - Arguments: - - InterfaceId - the IID being requested - - Object - a location to store the interface pointer to return. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IUnknown))) - { - *Object = QueryIUnknown(); - return S_OK; - } - else - { - *Object = NULL; - return E_NOINTERFACE; - } -} - -IUnknown * -CUnknown::QueryIUnknown( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IUnknown interface. - - This allows other methods to convert a CUnknown pointer into an IUnknown - pointer without a typecast and without calling QueryInterface and dealing - with the return value. - - Arguments: - - None - - Return Value: - - A pointer to the object's IUnknown interface. - ---*/ -{ - AddRef(); - return static_cast<IUnknown *>(this); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::AddRef( - VOID - ) -/*++ - - Routine Description: - - This method adds one to the object's reference count. - - Arguments: - - None - - Return Value: - - The new reference count. The caller should only use this for debugging - as the object's actual reference count can change while the caller - examines the return value. - ---*/ -{ - return InterlockedIncrement(&m_ReferenceCount); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::Release( - VOID - ) -/*++ - - Routine Description: - - This method subtracts one to the object's reference count. If the count - goes to zero, this method deletes the object. - - Arguments: - - None - - Return Value: - - The new reference count. If the caller uses this value it should only be - to check for zero (i.e. this call caused or will cause deletion) or - non-zero (i.e. some other call may have caused deletion, but this one - didn't). - ---*/ -{ - ULONG count = InterlockedDecrement(&m_ReferenceCount); - - if (count == 0) - { - delete this; - } - return count; -} - -// -// Implementation of CClassFactory methods. -// - -// -// Define storage for the factory's static lock count variable. -// - -LONG CClassFactory::s_LockCount = 0; - -IClassFactory * -CClassFactory::QueryIClassFactory( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IClassFactory interface. - - This allows other methods to convert a CClassFactory pointer into an - IClassFactory pointer without a typecast and without dealing with the - return value QueryInterface. - - Arguments: - - None - - Return Value: - - A referenced pointer to the object's IClassFactory interface. - ---*/ -{ - AddRef(); - return static_cast<IClassFactory *>(this); -} - -HRESULT -CClassFactory::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method attempts to retrieve the requested interface from the object. - - If the interface is found then the reference count on that interface (and - thus the object itself) is incremented. - - Arguments: - - InterfaceId - the interface the caller is requesting. - - Object - a location to store the interface pointer. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - // - // This class only supports IClassFactory so check for that. - // - - if (IsEqualIID(InterfaceId, __uuidof(IClassFactory))) - { - *Object = QueryIClassFactory(); - return S_OK; - } - else - { - // - // See if the base class supports the interface. - // - - return CUnknown::QueryInterface(InterfaceId, Object); - } -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::CreateInstance( - _In_opt_ IUnknown * /* OuterObject */, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This COM method is the factory routine - it creates instances of the driver - callback class and returns the specified interface on them. - - Arguments: - - OuterObject - only used for aggregation, which our driver callback class - does not support. - - InterfaceId - the interface ID the caller would like to get from our - new object. - - Object - a location to store the referenced interface pointer to the new - object. - - Return Value: - - Status. - ---*/ -{ - HRESULT hr; - - PCMyDriver driver; - - *Object = NULL; - - hr = CMyDriver::CreateInstance(&driver); - - if (SUCCEEDED(hr)) - { - hr = driver->QueryInterface(InterfaceId, Object); - driver->Release(); - } - - return hr; -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::LockServer( - _In_ BOOL Lock - ) -/*++ - - Routine Description: - - This COM method can be used to keep the DLL in memory. However since the - driver's DllCanUnloadNow function always returns false, this has little - effect. Still it tracks the number of lock and unlock operations. - - Arguments: - - Lock - Whether the caller wants to lock or unlock the "server" - - Return Value: - - S_OK - ---*/ -{ - if (Lock) - { - InterlockedIncrement(&s_LockCount); - } - else - { - InterlockedDecrement(&s_LockCount); - } - return S_OK; -} - diff --git a/general/toaster/toastDrv/umdf/Toastmon/comsup.h b/general/toaster/toastDrv/umdf/Toastmon/comsup.h deleted file mode 100644 index b96fd982..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/comsup.h +++ /dev/null @@ -1,215 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.h - -Abstract: - - This module contains classes and functions use for providing COM support - code. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// Forward type declarations. They are here rather than in internal.h as -// you only need them if you choose to use these support classes. -// - -typedef class CUnknown *PCUnknown; -typedef class CClassFactory *PCClassFactory; - -// -// Base class to implement IUnknown. You can choose to derive your COM -// classes from this class, or simply implement IUnknown in each of your -// classes. -// - -class CUnknown : public IUnknown -{ - -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The reference count for this object. Initialized to 1 in the - // constructor. - // - - LONG m_ReferenceCount; - -// -// Protected data members and methods. These are accessible by the subclasses -// but not by other classes. -// -protected: - - // - // The constructor and destructor are protected to ensure that only the - // subclasses of CUnknown can create and destroy instances. - // - - CUnknown( - VOID - ); - - // - // The destructor MUST be virtual. Since any instance of a CUnknown - // derived class should only be deleted from within CUnknown::Release, - // the destructor MUST be virtual or only CUnknown::~CUnknown will get - // invoked on deletion. - // - // If you see that your CMyDevice specific destructor is never being - // called, make sure you haven't deleted the virtual destructor here. - // - - virtual - ~CUnknown( - VOID - ) - { - // Do nothing - } - -// -// Public Methods. These are accessible by any class. -// -public: - - IUnknown * - QueryIUnknown( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ); - - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ); - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; - -// -// Class factory support class. Create an instance of this from your -// DllGetClassObject method and modify the implementation to create -// an instance of your driver event handler class. -// - -class CClassFactory : public CUnknown, public IClassFactory -{ -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The lock count. This is shared across all instances of IClassFactory - // and can be queried through the public IsLocked method. - // - - static LONG s_LockCount; - -// -// Public Methods. These are accessible by any class. -// -public: - - IClassFactory * - QueryIClassFactory( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // IClassFactory methods. - // - - virtual - HRESULT - STDMETHODCALLTYPE - CreateInstance( - _In_opt_ IUnknown *OuterObject, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - virtual - HRESULT - STDMETHODCALLTYPE - LockServer( - _In_ BOOL Lock - ); -}; diff --git a/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp b/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp deleted file mode 100644 index 8b4b5426..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/dllsup.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - dllsup.cpp - -Abstract: - - This module contains the implementation of the UMDF Sample - Driver's entry point and its exported functions for providing COM support. - - This module can be copied without modification to a new UMDF driver. It - depends on some of the code in comsup.cpp & comsup.h to handle DLL - registration and creating the first class factory. - - This module is dependent on the following defines: - - MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing - tracing. See internal.h for definition. - - MYDRIVER_CLASS_ID - A GUID encoded in struct format used to - initialize the driver's ClassID. - - These are defined in internal.h for the sample. If you choose - to use a different primary include file, you should ensure they are - defined there as well. - -Environment: - - WDF User-Mode Driver Framework (WDF:UMDF) - ---*/ - -#include "internal.h" -#include "dllsup.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -BOOL -WINAPI -DllMain( - HINSTANCE ModuleHandle, - DWORD Reason, - PVOID /* Reserved */ - ) -/*++ - - Routine Description: - - This is the entry point and exit point for the I/O trace driver. This - does very little as the I/O trace driver has minimal global data. - - This method initializes tracing. - - Arguments: - - ModuleHandle - the DLL handle for this module. - - Reason - the reason this entry point was called. - - Reserved - unused - - Return Value: - - TRUE - ---*/ -{ - if (DLL_PROCESS_ATTACH == Reason) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - - DisableThreadLibraryCalls(ModuleHandle); - } - else if (DLL_PROCESS_DETACH == Reason) - { - // - // Cleanup tracing. - // - - WPP_CLEANUP(); - } - - return TRUE; -} - -HRESULT -STDAPICALLTYPE -DllGetClassObject( - _In_ REFCLSID ClassId, - _In_ REFIID InterfaceId, - _Outptr_ LPVOID *Interface - ) -/*++ - - Routine Description: - - This routine is called by COM in order to instantiate the - driver callback object and do an initial query interface on it. - - This method only creates an instance of the driver's class factory, as this - is the minimum required to support UMDF. - - Arguments: - - ClassId - the CLSID of the object being "gotten" - - InterfaceId - the interface the caller wants from that object. - - Interface - a location to store the referenced interface pointer - - Return Value: - - S_OK if the function succeeds or error indicating the cause of the - failure. - ---*/ -{ - PCClassFactory factory; - - HRESULT hr = S_OK; - - *Interface = NULL; - - // - // If the CLSID doesn't match that of our "coclass" (defined in the IDL - // file) then we can't create the object the caller wants. This may - // indicate that the COM registration is incorrect, and another CLSID - // is referencing this drvier. - // - - if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Called to create instance of unrecognized class (%!GUID!)", - &ClassId - ); - - return CLASS_E_CLASSNOTAVAILABLE; - } - - // - // Create an instance of the class factory for the caller. - // - - factory = new CClassFactory(); - - if (NULL == factory) - { - hr = E_OUTOFMEMORY; - } - - // - // Query the object we created for the interface the caller wants. After - // that we release the object. This will drive the reference count to - // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed). - // In the later case the object is automatically deleted. - // - - if (SUCCEEDED(hr)) - { - hr = factory->QueryInterface(InterfaceId, Interface); - factory->Release(); - } - - return hr; -} diff --git a/general/toaster/toastDrv/umdf/Toastmon/exports.def b/general/toaster/toastDrv/umdf/Toastmon/exports.def deleted file mode 100644 index f8ac59f6..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/exports.def +++ /dev/null @@ -1,4 +0,0 @@ -; Exports.def : Declares the module parameters. - -EXPORTS - DllGetClassObject PRIVATE diff --git a/general/toaster/toastDrv/umdf/Toastmon/internal.h b/general/toaster/toastDrv/umdf/Toastmon/internal.h deleted file mode 100644 index 5a8fc9e2..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/internal.h +++ /dev/null @@ -1,109 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Include ATL to provide basic COM support. -// - -#define _ATL_FREE_THREADED -#define _ATL_NO_AUTOMATIC_NAMESPACE - -#include <atlbase.h> -#include <atlcom.h> - -using namespace ATL; - -extern CComModule _Module; -// -// Forward definitions of classes in the other header files. -// - -typedef class CMyDriver *PCMyDriver; -typedef class CMyDevice *PCMyDevice; -typedef class CMyRemoteTarget *PCMyRemoteTarget; - -// -// Define the tracing flags. -// -// TODO: Choose a different trace control GUID -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - MyDriverTraceControl, (dee2c67c,6328,48d9,876b,64682c4e9e9b), \ - \ - WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && \ - WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// end_wpp -// - -// -// Driver specific #defines -// -// TODO: Change these values to be appropriate for your driver. -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\ToastMon" -#define MYDRIVER_CLASS_ID { 0x8d4ec202, 0x1076, 0x4895, {0xa0, 0x72, 0x29, 0x7d, 0xa8, 0x8e, 0x60, 0x05} } - -// -// Include simple doubly-linked list macros -// -#include "list.h" - -// -// Include the type specific headers. -// - -#include "comsup.h" -#include "driver.h" -#include "remotetarget.h" -#include "device.h" diff --git a/general/toaster/toastDrv/umdf/Toastmon/list.h b/general/toaster/toastDrv/umdf/Toastmon/list.h deleted file mode 100644 index 38d0b1e9..00000000 --- a/general/toaster/toastDrv/umdf/Toastmon/list.h +++ /dev/null @@ -1,77 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - list.h - -Abstract: - - This module contains doubly linked list macros - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - - -FORCEINLINE -VOID -InitializeListHead( - IN PLIST_ENTRY ListHead - ) -{ - ListHead->Flink = ListHead->Blink = ListHead; -} - -FORCEINLINE -BOOLEAN -RemoveEntryList( - IN PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - PLIST_ENTRY Flink; - - Flink = Entry->Flink; - Blink = Entry->Blink; - Blink->Flink = Flink; - Flink->Blink = Blink; - return (BOOLEAN)(Flink == Blink); -} - -FORCEINLINE -VOID -InsertHeadList( - IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Flink; - - Flink = ListHead->Flink; - Entry->Flink = Flink; - Entry->Blink = ListHead; - Flink->Blink = Entry; - ListHead->Flink = Entry; -} - -FORCEINLINE -VOID -InsertTailList( - IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY Entry - ) -{ - PLIST_ENTRY Blink; - - Blink = ListHead->Blink; - Entry->Flink = ListHead; - Entry->Blink = Blink; - Blink->Flink = Entry; - ListHead->Blink = Entry; -} diff --git a/general/toaster/toastDrv/umdf/func/Device.cpp b/general/toaster/toastDrv/umdf/func/Device.cpp deleted file mode 100644 index eaf0a545..00000000 --- a/general/toaster/toastDrv/umdf/func/Device.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Device.cpp - - Abstract: - - This file contains the device callback object implementation. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ -#include "stdafx.h" -#include "Device.h" - -#include "internal.h" -#include "device.tmh" - -HRESULT -CDevice::QueryInterface( - _In_ REFIID riid, - _Out_ LPVOID* ppvObject - ) -/*++ - -Routine Description: - - The framework calls this function to determine which callback - interfaces we support. - -Arguments: - - riid - GUID for a given callback interface. - ppvObject - We set this pointer to our object if we support the - interface indicated by riid. - -Return Value: - - HRESULT S_OK - Interface is supported. - ---*/ -{ - if (ppvObject == NULL) - { - return E_INVALIDARG; - } - - *ppvObject = NULL; - - if ( riid == _uuidof(IUnknown) ) - { - *ppvObject = static_cast<IPnpCallbackHardware*>(this); - } - else if ( riid == _uuidof(IPnpCallbackHardware) ) - { - *ppvObject = static_cast<IPnpCallbackHardware *>(this); - } - else - { - return E_NOINTERFACE; - } - - this->AddRef(); - - return S_OK; -} - - -ULONG CDevice::AddRef() -/*++ - -Routine Description: - - Increments the ref count on this object. - -Arguments: - - None. - -Return Value: - - ULONG - new ref count. - ---*/ -{ - LONG cRefs = InterlockedIncrement( &m_cRefs ); - - return cRefs; -} - - -_At_(this, __drv_freesMem(object)) -ULONG CDevice::Release() -/*++ - -Routine Description: - - Decrements the ref count on this object. - -Arguments: - - None. - -Return Value: - - ULONG - new ref count. - ---*/ -{ - LONG cRefs; - - cRefs = InterlockedDecrement( &m_cRefs ); - - if( 0 == cRefs ) - { - delete this; - } - - return cRefs; -} - - -HRESULT -CDevice::OnPrepareHardware( - _In_ IWDFDevice* pDevice) -/*++ - -Routine Description: - - The framework calls this function after IDriverEntry::OnDeviceAdd - returns and before the device enters the working power state. - This callback prepares the device and the driver to enter the working - state after enumeration. - -Arguments: - - pWdfDevice - A pointer to the IWDFDevice interface for the device - object of the device to make accessible. - -Return Value: - - S_OK in case of success - HRESULT correponding to one of the error codes that are defined in Winerror.h. - ---*/ -{ - PWSTR deviceName = NULL; - DWORD deviceNameCch = 0; - - HRESULT hr; - - Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!"); - - // - // Get the device name. - // Get the length to allocate first - // - - hr = pDevice->RetrieveDeviceName(NULL, &deviceNameCch); - - // - // Allocate the buffer - // - - if (SUCCEEDED(hr)) - { - deviceName = new WCHAR[deviceNameCch]; - - if (deviceName == NULL) - { - hr = E_OUTOFMEMORY; - } - } - - // - // Get the actual name - // - - if (SUCCEEDED(hr)) - { - hr = pDevice->RetrieveDeviceName(deviceName, &deviceNameCch); - - } - - // - // Do your hardware operations here - // - - delete[] deviceName; - - return hr; -} - -HRESULT -CDevice::OnReleaseHardware( - _In_ IWDFDevice* /*pDevice*/) -/*++ - -Routine Description: - - This routine is invoked when the device is being removed or stopped - It releases all resources allocated for this device. The framework - calls this callback after the device exits from the working power - state but before its queues are purged. - - -Arguments: - - pWdfDevice - A pointer to the IWDFDevice interface for the device object - of the device that is no longer accessible. - - -Return Value: - HRESULT - Always succeeds. ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!"); - - return S_OK; -} - - - diff --git a/general/toaster/toastDrv/umdf/func/Device.h b/general/toaster/toastDrv/umdf/func/Device.h deleted file mode 100644 index 4bb68dc7..00000000 --- a/general/toaster/toastDrv/umdf/func/Device.h +++ /dev/null @@ -1,78 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Device.h - - Abstract: - - This file contains the class definition for device callback object. - - Environment: - - Windows User-Mode Driver Framework (UMDF) - ---*/ - -#pragma once -#include "resource.h" -#include "WUDFToaster.h" - -// -// To inform the framework about the callbacks we are interested in, we -// simply derive from the desired set of interfaces. -// -class CDevice : public IPnpCallbackHardware -{ -public: - CDevice() : m_cRefs(0) - { - } - - -public: - - // - // Static method that creates a device callback object. - // - static HRESULT CreateInstance(_Out_ IUnknown ** ppUnkwn) - { - *ppUnkwn = NULL; - -#pragma warning( suppress : 6014 )// PFD ISSUE: counted memory locks - CDevice *pMyDevice = new CDevice(); - - if (NULL == pMyDevice) - { - return E_OUTOFMEMORY; - } - - return (pMyDevice->QueryInterface( __uuidof(IUnknown), (void **) ppUnkwn )); - } - - // - // IUnknown - // - virtual HRESULT __stdcall QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObject); - virtual ULONG __stdcall AddRef(); - _At_(this, __drv_freesMem(object)) - virtual ULONG __stdcall Release(); - - - // IPnpCallbackHardware - // - virtual HRESULT __stdcall OnPrepareHardware(_In_ IWDFDevice* pDevice); - virtual HRESULT __stdcall OnReleaseHardware(_In_ IWDFDevice* pDevice); - - // - // TODO: Add your interfaces here - // - -private: - - LONG m_cRefs; - -}; - diff --git a/general/toaster/toastDrv/umdf/func/Driver.cpp b/general/toaster/toastDrv/umdf/func/Driver.cpp deleted file mode 100644 index 053217b9..00000000 --- a/general/toaster/toastDrv/umdf/func/Driver.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Driver.cpp - - Abstract: - - This file contains the implementation for the driver object. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "stdafx.h" -#include "Driver.h" -#include "Device.h" -#include "Queue.h" - -#include "internal.h" -#include "driver.tmh" - -//Idle setting for the Toaster device -#define IDLEWAKE_TIMEOUT_MSEC 6000 - - -HRESULT -CDriver::OnDeviceAdd( - _In_ IWDFDriver* pDriver, - _In_ IWDFDeviceInitialize* pDeviceInit - ) -/*++ - -Routine Description: - - The framework calls this function when a device is being added to - the driver stack. - -Arguments: - - IWDFDriver - Framework interface. The driver uses this - interface to create device objects. - IWDFDeviceInitialize - Framework interface. The driver uses this - interface to set device parameters before - creating the device obeject. - -Return Value: - - HRESULT S_OK - Device added successfully - ---*/ -{ - IUnknown *pDeviceCallback = NULL; - IWDFDevice *pIWDFDevice = NULL; - IWDFDevice2 *pIWDFDevice2 = NULL; - IUnknown *pIUnkQueue = NULL; - - // - // UMDF Toaster is a function driver so set is as the power policy owner (PPO) - // - pDeviceInit->SetPowerPolicyOwnership(TRUE); - - // - // Create our device callback object. - // - HRESULT hr = CDevice::CreateInstance(&pDeviceCallback); - - // - // Ask the framework to create a device object for us. - // We pass in the callback object and device init object - // as creation parameters. - // - if (SUCCEEDED(hr)) - { - hr = pDriver->CreateDevice(pDeviceInit, - pDeviceCallback, - &pIWDFDevice); - } - - // - // Create the queue callback object. - // - - if (SUCCEEDED(hr)) - { - hr = CQueue::CreateInstance(&pIUnkQueue); - } - - // - // Configure the default queue. We pass in our queue callback - // object to inform the framework about the callbacks we want. - // - - if (SUCCEEDED(hr)) - { - IWDFIoQueue * pDefaultQueue = NULL; - hr = pIWDFDevice->CreateIoQueue( - pIUnkQueue, - TRUE, // bDefaultQueue - WdfIoQueueDispatchParallel, - TRUE, // bPowerManaged - FALSE, // bAllowZeroLengthRequests - &pDefaultQueue); - SAFE_RELEASE(pDefaultQueue); - } - - // - // Enable the device interface. - // - - if (SUCCEEDED(hr)) - { - hr = pIWDFDevice->CreateDeviceInterface(&GUID_DEVINTERFACE_TOASTER, - NULL); - } - - // - // IWDFDevice2 interface is an extension of IWDFDevice interface that enables - // Idle and Wake support. - // - - // - // Get a pointer to IWDFDevice2 interface - // - - if (SUCCEEDED(hr)) - { - hr = pIWDFDevice->QueryInterface(__uuidof(IWDFDevice2), (void**) &pIWDFDevice2); - } - - // - // Since this is a virtual device we tell the framework that we cannot wake - // ourself if we sleep in S0. Only way the device can be brought to D0 is if - // the device recieves an I/O from the system. - // - - if (SUCCEEDED(hr)) - { - - hr = pIWDFDevice2->AssignS0IdleSettings( - IdleCannotWakeFromS0, - PowerDeviceD3, //the lowest-powered device sleeping state - IDLEWAKE_TIMEOUT_MSEC, //idle timeout - IdleAllowUserControl, //user can control the device's idle behavior. - WdfTrue); - - } - - // - // TODO: Add the Idle and Wake suupport specific for your hardware - // - - SAFE_RELEASE(pDeviceCallback); - SAFE_RELEASE(pIWDFDevice); - SAFE_RELEASE(pIWDFDevice2); - SAFE_RELEASE(pIUnkQueue); - - return hr; -} - -VOID -CDriver::OnDeinitialize( - _In_ IWDFDriver * /* pDriver */ - ) -/*++ - -Routine Description: - - The framework calls this function just before de-initializing itself. All - WDF framework resources should be released by driver before returning from this call. - -Arguments: - -Return Value: - ---*/ -{ - return ; -} - -HRESULT -CDriver::OnInitialize( - _In_ IWDFDriver * /* pDriver */ - ) -/*++ - -Routine Description: - - The framework calls this function just after loading the driver. The driver can - perform any global, device independent intialization in this routine. - -Arguments: - -Return Value: - ---*/ -{ - return S_OK; -} - - diff --git a/general/toaster/toastDrv/umdf/func/Driver.h b/general/toaster/toastDrv/umdf/func/Driver.h deleted file mode 100644 index b60cffb5..00000000 --- a/general/toaster/toastDrv/umdf/func/Driver.h +++ /dev/null @@ -1,59 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Driver.h - - Abstract: - - This file contains the class definition for the driver object. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once -#include "resource.h" -#include "WUDFToaster.h" - -class ATL_NO_VTABLE CDriver : - public CComObjectRootEx<CComMultiThreadModel>, - public CComCoClass<CDriver, &CLSID_WUDFToaster>, - public IDriverEntry -{ -public: - CDriver() - { - } - - DECLARE_REGISTRY_RESOURCEID(IDR_TOASTERDRIVER) - DECLARE_NOT_AGGREGATABLE(CDriver) - - // - // The driver object suppports the IDriverEntry interface. - // - BEGIN_COM_MAP(CDriver) - COM_INTERFACE_ENTRY(IDriverEntry) - END_COM_MAP() - -public: - // - // IDriverEntry - // - STDMETHOD (OnDeviceAdd)( - _In_ IWDFDriver *pDriver, - _In_ IWDFDeviceInitialize *pDeviceInit - ); - STDMETHOD (OnInitialize)( - _In_ IWDFDriver* pDriver - ); - STDMETHOD_ (void, OnDeinitialize)( - _In_ IWDFDriver* pDriver - ); -}; - -OBJECT_ENTRY_AUTO(__uuidof(WUDFToaster), CDriver) diff --git a/general/toaster/toastDrv/umdf/func/Queue.cpp b/general/toaster/toastDrv/umdf/func/Queue.cpp deleted file mode 100644 index dec296a0..00000000 --- a/general/toaster/toastDrv/umdf/func/Queue.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Queue.cpp - - Abstract: - - This file contains the queue callback object implementation. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "stdafx.h" -#include "Queue.h" -#include <devioctl.h> -#include <public.h> - - -#include "internal.h" -#include "queue.tmh" - -HRESULT -CQueue::QueryInterface( - _In_ REFIID riid, - _Out_ LPVOID* ppvObject - ) -/*++ - -Routine Description: - - The framework calls this function to determine which callback - interfaces we support. - -Arguments: - - riid - GUID for a given callback interface. - ppvObject - We set this pointer to our object if we support the - interface indicated by riid. - -Return Value: - - HRESULT S_OK - Interface is supported. - ---*/ -{ - if (ppvObject == NULL) - { - return E_INVALIDARG; - } - *ppvObject = NULL; - - if ( riid == _uuidof(IUnknown) ) - { - *ppvObject = static_cast<IQueueCallbackDeviceIoControl *> (this); - } - else if ( riid == _uuidof(IQueueCallbackDeviceIoControl) ) - { - *ppvObject = static_cast<IQueueCallbackDeviceIoControl *>(this); - } - else if ( riid == _uuidof(IQueueCallbackRead) ) - { - *ppvObject = static_cast<IQueueCallbackRead *>(this); - } - else if ( riid == _uuidof(IQueueCallbackWrite) ) - { - *ppvObject = static_cast<IQueueCallbackWrite *>(this); - } - else - { - return E_NOINTERFACE; - } - - this->AddRef(); - - return S_OK; -} - - - -ULONG CQueue::AddRef() -/*++ - -Routine Description: - - Increments the ref count on this object. - -Arguments: - - None. - -Return Value: - - ULONG - new ref count. - ---*/ -{ - LONG cRefs = InterlockedIncrement( &m_cRefs ); - return cRefs; -} - -_At_(this, __drv_freesMem(object)) -ULONG CQueue::Release() -/*++ - -Routine Description: - - Decrements the ref count on this object. - -Arguments: - - None. - -Return Value: - - ULONG - new ref count. - ---*/ -{ - LONG cRefs; - - cRefs = InterlockedDecrement( &m_cRefs ); - - if( 0 == cRefs ) - { - delete this; - } - - return cRefs; -} - - -void -CQueue::OnDeviceIoControl( - _In_ IWDFIoQueue* pQueue, - _In_ IWDFIoRequest* pRequest, - _In_ ULONG ControlCode, - _In_ SIZE_T /*InputBufferSizeInBytes*/, - _In_ SIZE_T /*OutputBufferSizeInBytes*/ - ) -/*++ - -Routine Description: - - The framework calls this function when somone has called - DeviceIoControl on the device. - -Arguments: - -Return Value: - None - ---*/ -{ - HRESULT hr = S_OK; - IWDFDevice *pDevice = NULL; - - Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!"); - - // - // Retrieve the queue's parent device object - // - pQueue->GetDevice(&pDevice); - - WUDF_TEST_DRIVER_ASSERT(pDevice); - - switch (ControlCode) - { - case IOCTL_TOASTER_DONT_DISPLAY_IN_UI_DEVICE: - - // - // This is just an example on how to hide your device in the - // device manager. Please remove your code when you adapt this - // sample for your hardware. - // - pDevice->SetPnpState(WdfPnpStateDontDisplayInUI, WdfTrue); - pDevice->CommitPnpState(); - - break; - - default: - hr = E_FAIL; //invalid request - - Trace(TRACE_LEVEL_ERROR,"%!FUNC! Invalid IOCTL %!hresult!",hr); - } - pRequest->Complete(hr); - - return; -} - -void -CQueue::OnRead( - _In_ IWDFIoQueue* /* pQueue */, - _In_ IWDFIoRequest* pRequest, - _In_ SIZE_T SizeInBytes - ) -/*++ - -Routine Description: - - - Read dispatch routine - IQueueCallbackRead - -Arguments: - - pQueue - Framework Queue instance - pRequest - Framework Request instance - SizeInBytes - Length of bytes in the read buffer - - Copy available data into the read buffer - -Return Value: - None. - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!"); - - // - // No need to check for zero-length reads. - // - // The framework queue is created with the flag bAllowZeroLengthRequests = FALSE. - // FALSE indicates that the framework completes zero-length I/O requests instead - // of putting them in the I/O queue. - // - - // - // TODO: Put your Read request processing here - // - - pRequest->CompleteWithInformation(S_OK, SizeInBytes); - - return; - -} - -void -CQueue::OnWrite( - _In_ IWDFIoQueue * /* pQueue */, - _In_ IWDFIoRequest * pRequest, - _In_ SIZE_T BytesToWrite - ) -/*++ - -Routine Description: - - Write dispatch routine - IQueueCallbackWrite - -Arguments: - - pQueue - Framework Queue instance - pRequest - Framework Request instance - BytesToWrite - Length of bytes in the write buffer - - Allocate and copy data to local buffer - -Return Value: - None. - ---*/ -{ - Trace(TRACE_LEVEL_INFORMATION,"%!FUNC!"); - - // - // No need to check for zero-length writes. - // - - // - // TODO: Put your Write request processing here - // - - pRequest->CompleteWithInformation(S_OK, BytesToWrite); - - return; -} - diff --git a/general/toaster/toastDrv/umdf/func/Queue.h b/general/toaster/toastDrv/umdf/func/Queue.h deleted file mode 100644 index 6668ac35..00000000 --- a/general/toaster/toastDrv/umdf/func/Queue.h +++ /dev/null @@ -1,96 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - Queue.h - - Abstract: - - This file contains the class definition for the queue - callback object. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once -#include "WUDFToaster.h" - -class CQueue : - public IQueueCallbackDeviceIoControl, - public IQueueCallbackRead, - public IQueueCallbackWrite -{ - public: - - CQueue() : m_cRefs(0) - { - } - - public: - - // - // Static method that creates a queue callback object. - // - static HRESULT CreateInstance(_Out_ IUnknown **ppUkwn) - { - *ppUkwn = NULL; - -#pragma warning( suppress : 6014 )// PFD ISSUE: counted memory locks - CQueue *pMyQueue = new CQueue(); - - if (NULL == pMyQueue) - { - return E_OUTOFMEMORY; - } - return (pMyQueue->QueryInterface(__uuidof(IUnknown), (void **)ppUkwn )); - } - - // - // IUnknown - // - virtual HRESULT __stdcall QueryInterface(_In_ REFIID riid, _Out_ LPVOID* ppvObject); - virtual ULONG __stdcall AddRef(); - _At_(this, __drv_freesMem(object)) - virtual ULONG __stdcall Release(); - - // - // IQueueCallbackDeviceIoControl - // - virtual void __stdcall OnDeviceIoControl( - _In_ IWDFIoQueue* pQueue, - _In_ IWDFIoRequest* pRequest, - _In_ ULONG ControlCode, - _In_ SIZE_T InputBufferSizeInBytes, - _In_ SIZE_T OutputBufferSizeInBytes - ); - - // - // IQueueCallbackRead - // - virtual void __stdcall OnRead( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T NumOfBytesToRead - ); - - // - // IQueueCallbackWrite - // - virtual void __stdcall OnWrite( - _In_ IWDFIoQueue *pWdfQueue, - _In_ IWDFIoRequest *pWdfRequest, - _In_ SIZE_T NumOfBytesToWrite - ); - - // - // TODO: Add your interfaces here - // - - private: - LONG m_cRefs; -}; diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp b/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp deleted file mode 100644 index fd66163d..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - WUDFToaster.cpp - - Abstract: - - Implementation of DLL Exports. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "stdafx.h" -#include "resource.h" - -#include "WUDFToaster.h" - -#include "internal.h" -#include "WUDFToaster.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -class CToasterDriverModule : public CAtlDllModuleT< CToasterDriverModule > -{ -public : - DECLARE_LIBID(LIBID_WUDFToasterLib) -}; - -CToasterDriverModule _AtlModule; - -// DLL Entry Point -extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -{ - hInstance; - - if(dwReason == DLL_PROCESS_ATTACH) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - } - else if(dwReason == DLL_PROCESS_DETACH) - { - // - // Cleanup tracing. - // - - WPP_CLEANUP(); - } - - return _AtlModule.DllMain(dwReason, lpReserved); -} - -// Returns a class factory to create an object of the requested type -_Check_return_ -STDAPI DllGetClassObject(_In_ REFCLSID rclsid, _In_ REFIID riid, _Outptr_ LPVOID* ppv) -{ - return _AtlModule.DllGetClassObject(rclsid, riid, ppv); -} - -// Used to determine whether the DLL can be unloaded by OLE -STDAPI DllCanUnloadNow(void) -{ - return _AtlModule.DllCanUnloadNow(); -} - -// DllRegisterServer - Adds entries to the system registry -STDAPI DllRegisterServer(void) -{ - // registers object, typelib and all interfaces in typelib - HRESULT hr = _AtlModule.DllRegisterServer(); - return hr; -} - -// DllUnregisterServer - Removes entries from the system registry -STDAPI DllUnregisterServer(void) -{ - HRESULT hr = _AtlModule.DllUnregisterServer(); - return hr; -} diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl b/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl deleted file mode 100644 index cfcbb866..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.ctl +++ /dev/null @@ -1,2 +0,0 @@ -9B6DE419-5658-46c9-A358-54FDEBB6B89D WudfToasterTraceGuid - diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.def b/general/toaster/toastDrv/umdf/func/WUDFToaster.def deleted file mode 100644 index 4aa746ad..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.def +++ /dev/null @@ -1,6 +0,0 @@ -; WUDFToaster.def : Declares the module parameters. - -LIBRARY "WUDFToaster.DLL" - -EXPORTS - DllGetClassObject PRIVATE diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.idl b/general/toaster/toastDrv/umdf/func/WUDFToaster.idl deleted file mode 100644 index da21b41e..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.idl +++ /dev/null @@ -1,40 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - WUDFToaster.idl - - Abstract: - - Definition of the WUDF Toaster sample's COM class - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -import "oaidl.idl"; -import "ocidl.idl"; -import "wudfddi.idl"; - -[ - uuid(04170C5A-388E-410f-9BAA-E7724196AD17), - version(1.0), - helpstring("WUDF Toaster Driver 1.0 Type Library") -] -library WUDFToasterLib -{ - importlib("stdole2.tlb"); - [ - uuid(5ED5997F-FAED-4a35-BA74-FCF7B43AEBA7), - helpstring("WudfToaster Class") - ] - coclass WUDFToaster - { - [default] interface IDriverEntry; - }; -}; - diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx b/general/toaster/toastDrv/umdf/func/WUDFToaster.inx Binary files differdeleted file mode 100644 index e804dcff..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.inx +++ /dev/null diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.rc b/general/toaster/toastDrv/umdf/func/WUDFToaster.rc deleted file mode 100644 index 74453a02..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.rc +++ /dev/null @@ -1,22 +0,0 @@ -//--------------------------------------------------------------------------- -// Skeleton.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include <windows.h> -#include <ntverp.h> -#include "resource.h" - -// -// TODO: Change the file description and file names to match your binary. -// - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF User-Mode Toaster Driver Sample" -#define VER_INTERNALNAME_STR "WUDFToaster" -#define VER_ORIGINALFILENAME_STR "WUDFToaster.dll" - -#include "common.ver" diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj b/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj deleted file mode 100644 index e9c01e32..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj +++ /dev/null @@ -1,338 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{3A32C2D4-D40F-4DB8-9F25-ABB21CEB7C7F}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR> - <SupportsPackaging>false</SupportsPackaging> - <RequiresPackageProject>true</RequiresPackageProject> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{8FD6D25D-F593-45DB-AF96-6F358E01587B}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include=".\$(IntDir)\WUDFToaster_i.c"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </ClCompile> - <ClCompile Include="WUDFToaster.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Use</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <ClCompile Include="stdafx.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Use</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <ClCompile Include="Driver.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Use</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <ClCompile Include="Device.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Use</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <ClCompile Include="Queue.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Use</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <Inf Include="WUDFToaster.inx"> - <Architecture>$(InfArch)</Architecture> - <SpecifyArchitecture>true</SpecifyArchitecture> - <Verbose>true</Verbose> - <CopyOutput>.\$(IntDir)\WUDFToaster.inf</CopyOutput> - </Inf> - <OtherWpp Include="WUDFToaster.rc; WUDFTOaster.idl"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </OtherWpp> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>WUDFToaster</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>WUDFToaster</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>WUDFToaster</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>WUDFToaster</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - <PreprocessorDefinitions Condition="!('$(UseDebugLibraries)'=='false')">%(PreprocessorDefinitions);DEBUG</PreprocessorDefinitions> - </ResourceCompile> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </Midl> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </Midl> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </Midl> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ResourceCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </ResourceCompile> - <ClCompile> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Midl> - <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);.;.\$(IntDir);..\..\inc</AdditionalIncludeDirectories> - </Midl> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\ole32.lib;$(SDK_LIB_PATH)\oleaut32.lib;$(SDK_LIB_PATH)\uuid.lib;$(SDK_LIB_PATH)\user32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>WUDFToaster.def</ModuleDefinitionFile> - </Link> - </ItemDefinitionGroup> - <ItemGroup> - <ClCompile Include="stdAfxsrc.cpp"> - <AdditionalIncludeDirectories>;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreCompiledHeaderFile>stdAfx.h</PreCompiledHeaderFile> - <PreCompiledHeader>Create</PreCompiledHeader> - <PreCompiledHeaderOutputFile>$(IntDir)\stdafx.pch</PreCompiledHeaderOutputFile> - </ClCompile> - <Midl Include="WUDFTOaster.idl" /> - <ResourceCompile Include="WUDFToaster.rc" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inf" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters b/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters deleted file mode 100644 index b64202cf..00000000 --- a/general/toaster/toastDrv/umdf/func/WUDFToaster.vcxproj.Filters +++ /dev/null @@ -1,55 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{9ACEB224-90E2-40F2-838C-9F279873D314}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{150AE92E-5F8C-4B90-B7BE-352ECA0434CD}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{BBE5A5E9-E1F7-47E7-91B7-111A3D0BAE2A}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{CCF62242-AF1C-424F-942F-E11D79A0EF79}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include=".\Debug\\WUDFToaster_i.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="Device.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="Driver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="Queue.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="stdafx.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="stdAfxsrc.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="WUDFToaster.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <Midl Include="WUDFTOaster.idl"> - <Filter>Source Files</Filter> - </Midl> - <None Include="WUDFToaster.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="WUDFToaster.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/toaster/toastDrv/umdf/func/internal.h b/general/toaster/toastDrv/umdf/func/internal.h deleted file mode 100644 index 1a098a19..00000000 --- a/general/toaster/toastDrv/umdf/func/internal.h +++ /dev/null @@ -1,114 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the UMDF Toaster - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Forward definitions of classes in the other header files. -// - -typedef class CDriver *PCDriver; -typedef class CDevice *PCDevice; -typedef class CQueue *PCQueue; - -// -// Define the tracing flags. -// -// TODO: Choose a different trace control GUID -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - MyDriverTraceControl, (9B6DE419,5658,46c9,A358,54FDEBB6B89D), \ - \ - WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && \ - WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// end_wpp -// - -// -// Driver specific #defines -// -// TODO: Change these values to be appropriate for your driver. -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\WUDF\\Toaster" -#define MYDRIVER_CLASS_ID {0x7ab7dcf5, 0xd1d4, 0x4085, {0x95, 0x47, 0x1d, 0xb9, 0x68, 0xcc, 0xa7, 0x20}} - -// -// Include the type specific headers. -// - -#include "driver.h" -#include "device.h" -#include "queue.h" - -__forceinline -#ifdef _PREFAST_ -__declspec(noreturn) -#endif -VOID -WdfTestNoReturn( - VOID - ) -{ - // do nothing. -} - -#define WUDF_TEST_DRIVER_ASSERT(p) \ -{ \ - if ( !(p) ) \ - { \ - DebugBreak(); \ - WdfTestNoReturn(); \ - } \ -} - - - diff --git a/general/toaster/toastDrv/umdf/func/resource.h b/general/toaster/toastDrv/umdf/func/resource.h deleted file mode 100644 index 800c5a81..00000000 --- a/general/toaster/toastDrv/umdf/func/resource.h +++ /dev/null @@ -1,13 +0,0 @@ -#define IDS_PROJNAME 100 -#define IDR_TOASTERDRIVER 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 201 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 105 -#endif -#endif diff --git a/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp b/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp deleted file mode 100644 index 15f34744..00000000 --- a/general/toaster/toastDrv/umdf/func/stdAfxsrc.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "stdAfx.h"
\ No newline at end of file diff --git a/general/toaster/toastDrv/umdf/func/stdafx.cpp b/general/toaster/toastDrv/umdf/func/stdafx.cpp deleted file mode 100644 index 16521f2a..00000000 --- a/general/toaster/toastDrv/umdf/func/stdafx.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - stdafx.cpp - - Abstract: - - This is used to build the precompiled header. - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - - -#include "stdafx.h" - -#include "initguid.h" - -DEFINE_GUID (GUID_DEVINTERFACE_TOASTER, - 0x781EF630, 0x72B2, 0x11d2, 0xB8, 0x52, 0x00, 0xC0, 0x4F, 0xAD, 0x51, 0x71); -//{781EF630-72B2-11d2-B852-00C04FAD5171} - diff --git a/general/toaster/toastDrv/umdf/func/stdafx.h b/general/toaster/toastDrv/umdf/func/stdafx.h deleted file mode 100644 index 7e432496..00000000 --- a/general/toaster/toastDrv/umdf/func/stdafx.h +++ /dev/null @@ -1,47 +0,0 @@ -/*++ - - Copyright (c) Microsoft Corporation, All Rights Reserved - - Module Name: - - stdafx.h - - Abstract: - - Include file for standard system include filesor project specific - include files that are used frequently, but are changed infrequently - - Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - - -#pragma once - -#ifndef STRICT -#define STRICT -#endif - - -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0501 // Windows XP and newer. -#endif - -#define _ATL_FREE_THREADED -#define _ATL_NO_AUTOMATIC_NAMESPACE - -// turns off ATL's hiding of some common and often safely ignored warning messages -#define _ATL_ALL_WARNINGS - -#define SAFE_RELEASE(p) {if ((p)) { (p)->Release(); (p) = NULL; }} - -#include "resource.h" -#include <atlbase.h> -#include <atlcom.h> - -extern const GUID GUID_DEVINTERFACE_TOASTER; - -using namespace ATL; - diff --git a/general/toaster/toastpkg/inf/toastpkg.inf b/general/toaster/toastpkg/inf/toastpkg.inf index f7e45bd9..21d376de 100644 --- a/general/toaster/toastpkg/inf/toastpkg.inf +++ b/general/toaster/toastpkg/inf/toastpkg.inf @@ -18,6 +18,9 @@ ; This is a mutlios INF file. Same INF file cab be used on ; x86 and amd64 platforms. ; +; Important: +; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809 +; ;--*/ [Version] Signature="$WINDOWS NT$" @@ -27,12 +30,25 @@ Provider=%ProviderName% DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat CatalogFile.NTAMD64 = tstamd64.cat -PnpLockdown=1 +PnpLockdown = 1 [DestinationDirs] -DefaultDestDir = 12 +DefaultDestDir = 13 CoInstaller_CopyFiles = 11 +[SourceDisksNames.x86] +1 = %DiskId1%, toastpkg.tag,,\i386 + +[SourceDisksNames.ia64] +1 = %DiskId1%, toastpkg.tag,,\ia64 + +[SourceDisksNames.amd64] +1 = %DiskId1%, toastpkg.tag,,\amd64 + +[SourceDisksFiles] +toaster.sys = 1,, +tostrco2.dll = 1,, + ; ================= Class section ===================== [ClassInstall32] @@ -78,9 +94,9 @@ AddService = toaster, %SPSVCINST_ASSOCSERVICE%, toaster_Service_Inst [toaster_Service_Inst] DisplayName = %toaster.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER -StartType = 3 ; SERVICE_DEMAND_START +StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %12%\toaster.sys +ServiceBinary = %13%\toaster.sys ;-------------- Coinstaller installation @@ -99,16 +115,6 @@ HKR,,CoInstallers32,0x00010000,"tostrco2.dll,ToasterCoInstaller" ; located (so it can launch value-added setup programs). OriginalInfSourcePath = %1% -[SourceDisksNames.x86] -1 = %DiskId1%, toastpkg.tag,,\i386 - -[SourceDisksNames.amd64] -1 = %DiskId1%, toastpkg.tag,,\amd64 - -[SourceDisksFiles] -toaster.sys = 1,, -tostrco2.dll = 1,, - [Strings] SPSVCINST_ASSOCSERVICE= 0x00000002 ProviderName = "TODO-Set-Provider" diff --git a/general/toaster/toastpkg/toastcd/toastpkg.inf b/general/toaster/toastpkg/toastcd/toastpkg.inf index f7e45bd9..21d376de 100644 --- a/general/toaster/toastpkg/toastcd/toastpkg.inf +++ b/general/toaster/toastpkg/toastcd/toastpkg.inf @@ -18,6 +18,9 @@ ; This is a mutlios INF file. Same INF file cab be used on ; x86 and amd64 platforms. ; +; Important: +; This INF depends on features for the Driver Store DIRIDs which are available starting Windows 10 1809 +; ;--*/ [Version] Signature="$WINDOWS NT$" @@ -27,12 +30,25 @@ Provider=%ProviderName% DriverVer=09/21/2006,6.0.5736.1 CatalogFile.NTx86 = tostx86.cat CatalogFile.NTAMD64 = tstamd64.cat -PnpLockdown=1 +PnpLockdown = 1 [DestinationDirs] -DefaultDestDir = 12 +DefaultDestDir = 13 CoInstaller_CopyFiles = 11 +[SourceDisksNames.x86] +1 = %DiskId1%, toastpkg.tag,,\i386 + +[SourceDisksNames.ia64] +1 = %DiskId1%, toastpkg.tag,,\ia64 + +[SourceDisksNames.amd64] +1 = %DiskId1%, toastpkg.tag,,\amd64 + +[SourceDisksFiles] +toaster.sys = 1,, +tostrco2.dll = 1,, + ; ================= Class section ===================== [ClassInstall32] @@ -78,9 +94,9 @@ AddService = toaster, %SPSVCINST_ASSOCSERVICE%, toaster_Service_Inst [toaster_Service_Inst] DisplayName = %toaster.SVCDESC% ServiceType = 1 ; SERVICE_KERNEL_DRIVER -StartType = 3 ; SERVICE_DEMAND_START +StartType = 3 ; SERVICE_DEMAND_START ErrorControl = 1 ; SERVICE_ERROR_NORMAL -ServiceBinary = %12%\toaster.sys +ServiceBinary = %13%\toaster.sys ;-------------- Coinstaller installation @@ -99,16 +115,6 @@ HKR,,CoInstallers32,0x00010000,"tostrco2.dll,ToasterCoInstaller" ; located (so it can launch value-added setup programs). OriginalInfSourcePath = %1% -[SourceDisksNames.x86] -1 = %DiskId1%, toastpkg.tag,,\i386 - -[SourceDisksNames.amd64] -1 = %DiskId1%, toastpkg.tag,,\amd64 - -[SourceDisksFiles] -toaster.sys = 1,, -tostrco2.dll = 1,, - [Strings] SPSVCINST_ASSOCSERVICE= 0x00000002 ProviderName = "TODO-Set-Provider" diff --git a/general/toaster/umdf2/exe/notify/notify.c b/general/toaster/umdf2/exe/notify/notify.c index 3362ce3d..15e5a615 100644 --- a/general/toaster/umdf2/exe/notify/notify.c +++ b/general/toaster/umdf2/exe/notify/notify.c @@ -35,7 +35,7 @@ Revision History: // Annotation to indicate to prefast that this is nondriver user-mode code. // #include <DriverSpecs.h> -_Analysis_mode_(_Analysis_code_type_user_code_) +_Analysis_mode_(_Analysis_code_type_user_code_) #include <windows.h> #include <stdlib.h> @@ -494,7 +494,7 @@ HandleDeviceInterfaceChange( if(!GetDeviceDescription(dip->dbcc_name, - (PBYTE)deviceInfo->DeviceName, + deviceInfo->DeviceName, sizeof(deviceInfo->DeviceName), &deviceInfo->SerialNo)) { MessageBox(hWnd, TEXT("GetDeviceDescription failed"), TEXT("Error!"), MB_OK); @@ -783,7 +783,7 @@ EnumExistingDevices( // Get the device details such as friendly name and SerialNo // if(!GetDeviceDescription(deviceInterfaceDetailData->DevicePath, - (PBYTE)deviceInfo->DeviceName, + deviceInfo->DeviceName, sizeof(deviceInfo->DeviceName), &deviceInfo->SerialNo)){ goto Error; @@ -873,7 +873,7 @@ BOOLEAN Cleanup(HWND hWnd) BOOL GetDeviceDescription( _In_ LPTSTR DevPath, - _Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer, + _Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer, _In_ ULONG OutBufferLen, _In_ PULONG SerialNo ) @@ -917,14 +917,14 @@ GetDeviceDescription( if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData, SPDRP_FRIENDLYNAME, &dwRegType, - OutBuffer, + (PBYTE) OutBuffer, OutBufferLen, NULL)) { if(!SetupDiGetDeviceRegistryProperty(hardwareDeviceInfo, &deviceInfoData, SPDRP_DEVICEDESC, &dwRegType, - OutBuffer, + (PBYTE) OutBuffer, OutBufferLen, NULL)){ goto Error; diff --git a/general/toaster/umdf2/exe/notify/notify.h b/general/toaster/umdf2/exe/notify/notify.h index 98db2918..7bddb547 100644 --- a/general/toaster/umdf2/exe/notify/notify.h +++ b/general/toaster/umdf2/exe/notify/notify.h @@ -154,7 +154,7 @@ BOOLEAN Cleanup( BOOL GetDeviceDescription( _In_ LPTSTR DevPath, - _Out_writes_bytes_(OutBufferLen) PBYTE OutBuffer, + _Out_writes_bytes_(OutBufferLen) PTSTR OutBuffer, _In_ ULONG OutBufferLen, _In_ PULONG SerialNo ); diff --git a/general/toaster/umdf2/filter/generic/filterum.inx b/general/toaster/umdf2/filter/generic/filterum.inx Binary files differindex 4de6d127..db5e7a28 100644 --- a/general/toaster/umdf2/filter/generic/filterum.inx +++ b/general/toaster/umdf2/filter/generic/filterum.inx diff --git a/general/toaster/umdf2/func/featured/wdffeaturedum.inx b/general/toaster/umdf2/func/featured/wdffeaturedum.inx Binary files differindex c4e79f13..2c251ffd 100644 --- a/general/toaster/umdf2/func/featured/wdffeaturedum.inx +++ b/general/toaster/umdf2/func/featured/wdffeaturedum.inx diff --git a/general/toaster/umdf2/func/simple/wdfsimpleum.inx b/general/toaster/umdf2/func/simple/wdfsimpleum.inx Binary files differindex 44252e4e..8f28fbaa 100644 --- a/general/toaster/umdf2/func/simple/wdfsimpleum.inx +++ b/general/toaster/umdf2/func/simple/wdfsimpleum.inx diff --git a/general/umdfSkeleton/README.md b/general/umdfSkeleton/README.md deleted file mode 100644 index 59a5f25b..00000000 --- a/general/umdfSkeleton/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -page_type: sample -description: "Demonstrates how to use UDMF to write a minimal driver." -languages: -- cpp -products: -- windows -- windows-wdk ---- - -# UMDF Driver Skeleton Sample (UMDF Version 1) - -This sample demonstrates how to use version 1 of the User-Mode Driver Framework to write a minimal driver. - -The Skeleton driver will successfully load on a device (either root enumerated or a real hardware device) but does not support any I/O operations. diff --git a/general/umdfSkeleton/Skeleton.rc b/general/umdfSkeleton/Skeleton.rc deleted file mode 100644 index b6ecda7f..00000000 --- a/general/umdfSkeleton/Skeleton.rc +++ /dev/null @@ -1,21 +0,0 @@ -//--------------------------------------------------------------------------- -// Skeleton.rc -// -// Copyright (c) Microsoft Corporation, All Rights Reserved -//--------------------------------------------------------------------------- - - -#include <windows.h> -#include <ntverp.h> - -// -// TODO: Change the file description and file names to match your binary. -// - -#define VER_FILETYPE VFT_DLL -#define VER_FILESUBTYPE VFT_UNKNOWN -#define VER_FILEDESCRIPTION_STR "WDF:UMDF Skeleton User-Mode Driver Sample" -#define VER_INTERNALNAME_STR "UMDFSkeleton" -#define VER_ORIGINALFILENAME_STR "UMDFSkeleton.dll" - -#include "common.ver" diff --git a/general/umdfSkeleton/UMDFSkeleton.vcxproj b/general/umdfSkeleton/UMDFSkeleton.vcxproj deleted file mode 100644 index 86f13834..00000000 --- a/general/umdfSkeleton/UMDFSkeleton.vcxproj +++ /dev/null @@ -1,265 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Debug|x64"> - <Configuration>Debug</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|x64"> - <Configuration>Release</Configuration> - <Platform>x64</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectGuid>{6C720AF2-E419-4BA6-927C-607BE3E771F1}</ProjectGuid> - <RootNamespace>$(MSBuildProjectName)</RootNamespace> - <UMDF_VERSION_MAJOR>1</UMDF_VERSION_MAJOR> - <KMDF_VERSION_MAJOR>1</KMDF_VERSION_MAJOR> - <UMDF_VERSION_MINOR>9</UMDF_VERSION_MINOR> - <KMDF_VERSION_MINOR>9</KMDF_VERSION_MINOR> - <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <SampleGuid>{B7203DC7-2002-4983-AB0B-E567DC6BD66C}</SampleGuid> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>False</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetVersion>Windows10</TargetVersion> - <UseDebugLibraries>True</UseDebugLibraries> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - <DriverType>UMDF</DriverType> - <PlatformToolset>WindowsUserModeDriver10.0</PlatformToolset> - <ConfigurationType>DynamicLibrary</ConfigurationType> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <PropertyGroup> - <OutDir>$(IntDir)</OutDir> - </PropertyGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" /> - </ImportGroup> - <ItemGroup Label="WrappedTaskItems"> - <ClCompile Include="dllsup.cpp; comsup.cpp; driver.cpp; device.cpp"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </ClCompile> - <OtherWpp Include="Skeleton.rc"> - <WppEnabled>true</WppEnabled> - <WppDllMacro>true</WppDllMacro> - <WppScanConfigurationData>internal.h</WppScanConfigurationData> - </OtherWpp> - </ItemGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <TargetName>UMDFSkeleton</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <TargetName>UMDFSkeleton</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <TargetName>UMDFSkeleton</TargetName> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <TargetName>UMDFSkeleton</TargetName> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ClCompile> - <Midl> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </Midl> - <ResourceCompile> - <PreprocessorDefinitions>%(PreprocessorDefinitions);_UNICODE;UNICODE</PreprocessorDefinitions> - </ResourceCompile> - </ItemDefinitionGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <WIN32_WINNT_VERSION>0x0A00</WIN32_WINNT_VERSION> - <NTDDI_VERSION>0x0A000000</NTDDI_VERSION> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <Link> - <EntryPointSymbol Condition="'$(Platform)'=='win32'">_DllMainCRTStartup@12</EntryPointSymbol> - <EntryPointSymbol Condition="'$(Platform)'!='win32'">_DllMainCRTStartup</EntryPointSymbol> - </Link> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <TreatWarningAsError>true</TreatWarningAsError> - <WarningLevel>Level4</WarningLevel> - <ExceptionHandling> - </ExceptionHandling> - </ClCompile> - <Link> - <AdditionalDependencies>%(AdditionalDependencies);$(SDK_LIB_PATH)\strsafe.lib;$(SDK_LIB_PATH)\kernel32.lib;$(SDK_LIB_PATH)\advapi32.lib</AdditionalDependencies> - <ModuleDefinitionFile>exports.def</ModuleDefinitionFile> - </Link> - <DriverSign> - <FileDigestAlgorithm>sha256</FileDigestAlgorithm> - </DriverSign> - </ItemDefinitionGroup> - <ItemGroup> - <ResourceCompile Include="Skeleton.rc" /> - </ItemGroup> - <ItemGroup> - <Inf Exclude="@(Inf)" Include="*.inx" /> - <FilesToPackage Include="$(TargetPath)" Condition="'$(ConfigurationType)'=='Driver' or '$(ConfigurationType)'=='DynamicLibrary'" /> - </ItemGroup> - <ItemGroup> - <None Exclude="@(None)" Include="*.txt;*.htm;*.html" /> - <None Exclude="@(None)" Include="*.ico;*.cur;*.bmp;*.dlg;*.rct;*.gif;*.jpg;*.jpeg;*.wav;*.jpe;*.tiff;*.tif;*.png;*.rc2" /> - <None Exclude="@(None)" Include="*.def;*.bat;*.hpj;*.asmx" /> - </ItemGroup> - <ItemGroup> - <ClInclude Exclude="@(ClInclude)" Include="*.h;*.hpp;*.hxx;*.hm;*.inl;*.xsd" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> -</Project>
\ No newline at end of file diff --git a/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters b/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters deleted file mode 100644 index 7da6c076..00000000 --- a/general/umdfSkeleton/UMDFSkeleton.vcxproj.Filters +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx;*</Extensions> - <UniqueIdentifier>{B6F807E5-006F-4FBD-BB35-CC706D5CB468}</UniqueIdentifier> - </Filter> - <Filter Include="Header Files"> - <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> - <UniqueIdentifier>{66714BFC-1D46-4D92-A154-1C6DFF39E4D4}</UniqueIdentifier> - </Filter> - <Filter Include="Resource Files"> - <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms;man;xml</Extensions> - <UniqueIdentifier>{B398CF71-A6A3-49C5-A7EC-47876A953477}</UniqueIdentifier> - </Filter> - <Filter Include="Driver Files"> - <Extensions>inf;inv;inx;mof;mc;</Extensions> - <UniqueIdentifier>{1A124126-5375-4543-880D-28113FEF151C}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <ClCompile Include="comsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="device.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="dllsup.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="driver.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <None Include="exports.def"> - <Filter>Source Files</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="Skeleton.rc"> - <Filter>Resource Files</Filter> - </ResourceCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/general/umdfSkeleton/UMDFSkeleton_OSR.inx b/general/umdfSkeleton/UMDFSkeleton_OSR.inx Binary files differdeleted file mode 100644 index 9729eee7..00000000 --- a/general/umdfSkeleton/UMDFSkeleton_OSR.inx +++ /dev/null diff --git a/general/umdfSkeleton/UMDFSkeleton_Root.inx b/general/umdfSkeleton/UMDFSkeleton_Root.inx Binary files differdeleted file mode 100644 index abb05491..00000000 --- a/general/umdfSkeleton/UMDFSkeleton_Root.inx +++ /dev/null diff --git a/general/umdfSkeleton/comsup.cpp b/general/umdfSkeleton/comsup.cpp deleted file mode 100644 index fd298470..00000000 --- a/general/umdfSkeleton/comsup.cpp +++ /dev/null @@ -1,344 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.cpp - -Abstract: - - This module contains implementations for the functions and methods - used for providing COM support. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" - -#include "comsup.tmh" - -// -// Implementation of CUnknown methods. -// - -CUnknown::CUnknown( - VOID - ) : m_ReferenceCount(1) -/*++ - - Routine Description: - - Constructor for an instance of the CUnknown class. This simply initializes - the reference count of the object to 1. The caller is expected to - call Release() if it wants to delete the object once it has been allocated. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - // do nothing. -} - -HRESULT -STDMETHODCALLTYPE -CUnknown::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method provides the basic support for query interface on CUnknown. - If the interface requested is IUnknown it references the object and - returns an interface pointer. Otherwise it returns an error. - - Arguments: - - InterfaceId - the IID being requested - - Object - a location to store the interface pointer to return. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IUnknown))) - { - *Object = QueryIUnknown(); - return S_OK; - } - else - { - *Object = NULL; - return E_NOINTERFACE; - } -} - -IUnknown * -CUnknown::QueryIUnknown( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IUnknown interface. - - This allows other methods to convert a CUnknown pointer into an IUnknown - pointer without a typecast and without calling QueryInterface and dealing - with the return value. - - Arguments: - - None - - Return Value: - - A pointer to the object's IUnknown interface. - ---*/ -{ - AddRef(); - return static_cast<IUnknown *>(this); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::AddRef( - VOID - ) -/*++ - - Routine Description: - - This method adds one to the object's reference count. - - Arguments: - - None - - Return Value: - - The new reference count. The caller should only use this for debugging - as the object's actual reference count can change while the caller - examines the return value. - ---*/ -{ - return InterlockedIncrement(&m_ReferenceCount); -} - -ULONG -STDMETHODCALLTYPE -CUnknown::Release( - VOID - ) -/*++ - - Routine Description: - - This method subtracts one to the object's reference count. If the count - goes to zero, this method deletes the object. - - Arguments: - - None - - Return Value: - - The new reference count. If the caller uses this value it should only be - to check for zero (i.e. this call caused or will cause deletion) or - non-zero (i.e. some other call may have caused deletion, but this one - didn't). - ---*/ -{ - ULONG count = InterlockedDecrement(&m_ReferenceCount); - - if (count == 0) - { - delete this; - } - return count; -} - -// -// Implementation of CClassFactory methods. -// - -// -// Define storage for the factory's static lock count variable. -// - -LONG CClassFactory::s_LockCount = 0; - -IClassFactory * -CClassFactory::QueryIClassFactory( - VOID - ) -/*++ - - Routine Description: - - This helper method references the object and returns a pointer to the - object's IClassFactory interface. - - This allows other methods to convert a CClassFactory pointer into an - IClassFactory pointer without a typecast and without dealing with the - return value QueryInterface. - - Arguments: - - None - - Return Value: - - A referenced pointer to the object's IClassFactory interface. - ---*/ -{ - AddRef(); - return static_cast<IClassFactory *>(this); -} - -HRESULT -CClassFactory::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method attempts to retrieve the requested interface from the object. - - If the interface is found then the reference count on that interface (and - thus the object itself) is incremented. - - Arguments: - - InterfaceId - the interface the caller is requesting. - - Object - a location to store the interface pointer. - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - // - // This class only supports IClassFactory so check for that. - // - - if (IsEqualIID(InterfaceId, __uuidof(IClassFactory))) - { - *Object = QueryIClassFactory(); - return S_OK; - } - else - { - // - // See if the base class supports the interface. - // - - return CUnknown::QueryInterface(InterfaceId, Object); - } -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::CreateInstance( - _In_opt_ IUnknown * /* OuterObject */, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This COM method is the factory routine - it creates instances of the driver - callback class and returns the specified interface on them. - - Arguments: - - OuterObject - only used for aggregation, which our driver callback class - does not support. - - InterfaceId - the interface ID the caller would like to get from our - new object. - - Object - a location to store the referenced interface pointer to the new - object. - - Return Value: - - Status. - ---*/ -{ - HRESULT hr; - - PCMyDriver driver; - - *Object = NULL; - - hr = CMyDriver::CreateInstance(&driver); - - if (SUCCEEDED(hr)) - { - hr = driver->QueryInterface(InterfaceId, Object); - driver->Release(); - } - - return hr; -} - -HRESULT -STDMETHODCALLTYPE -CClassFactory::LockServer( - _In_ BOOL Lock - ) -/*++ - - Routine Description: - - This COM method can be used to keep the DLL in memory. However since the - driver's DllCanUnloadNow function always returns false, this has little - effect. Still it tracks the number of lock and unlock operations. - - Arguments: - - Lock - Whether the caller wants to lock or unlock the "server" - - Return Value: - - S_OK - ---*/ -{ - if (Lock) - { - InterlockedIncrement(&s_LockCount); - } - else - { - InterlockedDecrement(&s_LockCount); - } - return S_OK; -} - diff --git a/general/umdfSkeleton/comsup.h b/general/umdfSkeleton/comsup.h deleted file mode 100644 index 5472338c..00000000 --- a/general/umdfSkeleton/comsup.h +++ /dev/null @@ -1,215 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - ComSup.h - -Abstract: - - This module contains classes and functions use for providing COM support - code. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// Forward type declarations. They are here rather than in internal.h as -// you only need them if you choose to use these support classes. -// - -typedef class CUnknown *PCUnknown; -typedef class CClassFactory *PCClassFactory; - -// -// Base class to implement IUnknown. You can choose to derive your COM -// classes from this class, or simply implement IUnknown in each of your -// classes. -// - -class CUnknown : public IUnknown -{ - -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The reference count for this object. Initialized to 1 in the - // constructor. - // - - LONG m_ReferenceCount; - -// -// Protected data members and methods. These are accessible by the subclasses -// but not by other classes. -// -protected: - - // - // The constructor and destructor are protected to ensure that only the - // subclasses of CUnknown can create and destroy instances. - // - - CUnknown( - VOID - ); - - // - // The destructor MUST be virtual. Since any instance of a CUnknown - // derived class should only be deleted from within CUnknown::Release, - // the destructor MUST be virtual or only CUnknown::~CUnknown will get - // invoked on deletion. - // - // If you see that your CMyDevice specific destructor is never being - // called, make sure you haven't deleted the virtual destructor here. - // - - virtual - ~CUnknown( - VOID - ) - { - // Do nothing - } - -// -// Public Methods. These are accessible by any class. -// -public: - - IUnknown * - QueryIUnknown( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ); - - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ); - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; - -// -// Class factory support class. Create an instance of this from your -// DllGetClassObject method and modify the implementation to create -// an instance of your driver event handler class. -// - -class CClassFactory : public CUnknown, public IClassFactory -{ -// -// Private data members and methods. These are only accessible by the methods -// of this class. -// -private: - - // - // The lock count. This is shared across all instances of IClassFactory - // and can be queried through the public IsLocked method. - // - - static LONG s_LockCount; - -// -// Public Methods. These are accessible by any class. -// -public: - - IClassFactory * - QueryIClassFactory( - VOID - ); - -// -// COM Methods. -// -public: - - // - // IUnknown methods - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - // - // IClassFactory methods. - // - - virtual - HRESULT - STDMETHODCALLTYPE - CreateInstance( - _In_opt_ IUnknown *OuterObject, - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - - virtual - HRESULT - STDMETHODCALLTYPE - LockServer( - _In_ BOOL Lock - ); -}; diff --git a/general/umdfSkeleton/device.cpp b/general/umdfSkeleton/device.cpp deleted file mode 100644 index 677f39e6..00000000 --- a/general/umdfSkeleton/device.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Device.cpp - -Abstract: - - This module contains the implementation of the UMDF Skeleton sample driver's - device callback object. - - The skeleton sample device does very little. It does not implement either - of the PNP interfaces so once the device is setup, it won't ever get any - callbacks until the device is removed. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "device.tmh" - -HRESULT -CMyDevice::CreateInstance( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit, - _Out_ PCMyDevice *Device - ) -/*++ - - Routine Description: - - This method creates and initializs an instance of the skeleton driver's - device callback object. - - Arguments: - - FxDeviceInit - the settings for the device. - - Device - a location to store the referenced pointer to the device object. - - Return Value: - - Status - ---*/ -{ - PCMyDevice device; - HRESULT hr; - - // - // Allocate a new instance of the device class. - // - - device = new CMyDevice(); - - if (NULL == device) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the instance. - // - - hr = device->Initialize(FxDriver, FxDeviceInit); - - if (SUCCEEDED(hr)) - { - *Device = device; - } - else - { - device->Release(); - } - - return hr; -} - -HRESULT -CMyDevice::Initialize( - _In_ IWDFDriver * FxDriver, - _In_ IWDFDeviceInitialize * FxDeviceInit - ) -/*++ - - Routine Description: - - This method initializes the device callback object and creates the - partner device object. - - The method should perform any device-specific configuration that: - * could fail (these can't be done in the constructor) - * must be done before the partner object is created -or- - * can be done after the partner object is created and which aren't - influenced by any device-level parameters the parent (the driver - in this case) might set. - - Arguments: - - FxDeviceInit - the settings for this device. - - Return Value: - - status. - ---*/ -{ - IWDFDevice *fxDevice; - HRESULT hr; - - // - // Configure things like the locking model before we go to create our - // partner device. - // - - // - // Set no locking unless you need an automatic callbacks synchronization - // - - FxDeviceInit->SetLockingConstraint(None); - - // - // TODO: If you're writing a filter driver then indicate that here. - // - // FxDeviceInit->SetFilter(); - // - - // - // TODO: Any per-device initialization which must be done before - // creating the partner object. - // - - // - // Create a new FX device object and assign the new callback object to - // handle any device level events that occur. - // - - // - // QueryIUnknown references the IUnknown interface that it returns - // (which is the same as referencing the device). We pass that to - // CreateDevice, which takes its own reference if everything works. - // - - { - IUnknown *unknown = this->QueryIUnknown(); - - hr = FxDriver->CreateDevice(FxDeviceInit, unknown, &fxDevice); - - unknown->Release(); - } - - // - // If that succeeded then set our FxDevice member variable. - // - - if (SUCCEEDED(hr)) - { - m_FxDevice = fxDevice; - - // - // Drop the reference we got from CreateDevice. Since this object - // is partnered with the framework object they have the same - // lifespan - there is no need for an additional reference. - // - - fxDevice->Release(); - } - - return hr; -} - -HRESULT -CMyDevice::Configure( - VOID - ) -/*++ - - Routine Description: - - This method is called after the device callback object has been initialized - and returned to the driver. It would setup the device's queues and their - corresponding callback objects. - - Arguments: - - FxDevice - the framework device object for which we're handling events. - - Return Value: - - status - ---*/ -{ - // - // TODO: Setup your device queues and I/O forwarding. - // - - return S_OK; -} - -HRESULT -CMyDevice::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ) -/*++ - - Routine Description: - - This method is called to get a pointer to one of the object's callback - interfaces. - - Since the skeleton driver doesn't support any of the device events, this - method simply calls the base class's BaseQueryInterface. - - If the skeleton is extended to include device event interfaces then this - method must be changed to check the IID and return pointers to them as - appropriate. - - Arguments: - - InterfaceId - the interface being requested - - Object - a location to store the interface pointer if successful - - Return Value: - - S_OK or E_NOINTERFACE - ---*/ -{ - return CUnknown::QueryInterface(InterfaceId, Object); -} diff --git a/general/umdfSkeleton/device.h b/general/umdfSkeleton/device.h deleted file mode 100644 index d5e1baa6..00000000 --- a/general/umdfSkeleton/device.h +++ /dev/null @@ -1,115 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Device.h - -Abstract: - - This module contains the type definitions for the UMDF Skeleton sample - driver's device callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// Class for the iotrace driver. -// - -class CMyDevice : public CUnknown -{ - -// -// Private data members. -// -private: - - IWDFDevice *m_FxDevice; - -// -// Private methods. -// - -private: - - CMyDevice( - VOID - ) - { - m_FxDevice = NULL; - } - - HRESULT - Initialize( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ); - -// -// Public methods -// -public: - - // - // The factory method used to create an instance of this driver. - // - - static - HRESULT - CreateInstance( - _In_ IWDFDriver *FxDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit, - _Out_ PCMyDevice *Device - ); - - HRESULT - Configure( - VOID - ); - -// -// COM methods -// -public: - - // - // IUnknown methods. - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); - -}; diff --git a/general/umdfSkeleton/dllsup.cpp b/general/umdfSkeleton/dllsup.cpp deleted file mode 100644 index 3a59f303..00000000 --- a/general/umdfSkeleton/dllsup.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - dllsup.cpp - -Abstract: - - This module contains the implementation of the UMDF Skeleton Sample - Driver's entry point and its exported functions for providing COM support. - - This module can be copied without modification to a new UMDF driver. It - depends on some of the code in comsup.cpp & comsup.h to handle DLL - registration and creating the first class factory. - - This module is dependent on the following defines: - - MYDRIVER_TRACING_ID - A wide string passed to WPP when initializing - tracing. For example the skeleton uses - L"Microsoft\\UMDF\\Skeleton" - - MYDRIVER_CLASS_ID - A GUID encoded in struct format used to - initialize the driver's ClassID. - - These are defined in internal.h for the sample. If you choose - to use a different primary include file, you should ensure they are - defined there as well. - -Environment: - - WDF User-Mode Driver Framework (WDF:UMDF) - ---*/ - -#include "internal.h" -#include "dllsup.tmh" - -const GUID CLSID_MyDriverCoClass = MYDRIVER_CLASS_ID; - -BOOL -WINAPI -DllMain( - HINSTANCE ModuleHandle, - DWORD Reason, - PVOID /* Reserved */ - ) -/*++ - - Routine Description: - - This is the entry point and exit point for the I/O trace driver. This - does very little as the I/O trace driver has minimal global data. - - This method initializes tracing. - - Arguments: - - ModuleHandle - the DLL handle for this module. - - Reason - the reason this entry point was called. - - Reserved - unused - - Return Value: - - TRUE - ---*/ -{ - - UNREFERENCED_PARAMETER( ModuleHandle ); - - if (DLL_PROCESS_ATTACH == Reason) - { - // - // Initialize tracing. - // - - WPP_INIT_TRACING(MYDRIVER_TRACING_ID); - - } - else if (DLL_PROCESS_DETACH == Reason) - { - // - // Cleanup tracing. - // - - WPP_CLEANUP(); - } - - return TRUE; -} - -HRESULT -STDAPICALLTYPE -DllGetClassObject( - _In_ REFCLSID ClassId, - _In_ REFIID InterfaceId, - _Outptr_ LPVOID *Interface - ) -/*++ - - Routine Description: - - This routine is called by COM in order to instantiate the - driver callback object and do an initial query interface on it. - - This method only creates an instance of the driver's class factory, as this - is the minimum required to support UMDF. - - Arguments: - - ClassId - the CLSID of the object being "gotten" - - InterfaceId - the interface the caller wants from that object. - - Interface - a location to store the referenced interface pointer - - Return Value: - - S_OK if the function succeeds or error indicating the cause of the - failure. - ---*/ -{ - PCClassFactory factory; - - HRESULT hr = S_OK; - - *Interface = NULL; - - // - // If the CLSID doesn't match that of our "coclass" (defined in the IDL - // file) then we can't create the object the caller wants. This may - // indicate that the COM registration is incorrect, and another CLSID - // is referencing this drvier. - // - - if (IsEqualCLSID(ClassId, CLSID_MyDriverCoClass) == false) - { - Trace( - TRACE_LEVEL_ERROR, - L"ERROR: Called to create instance of unrecognized class (%!GUID!)", - &ClassId - ); - - return CLASS_E_CLASSNOTAVAILABLE; - } - - // - // Create an instance of the class factory for the caller. - // - - factory = new CClassFactory(); - - if (NULL == factory) - { - hr = E_OUTOFMEMORY; - } - - // - // Query the object we created for the interface the caller wants. After - // that we release the object. This will drive the reference count to - // 1 (if the QI succeeded an referenced the object) or 0 (if the QI failed). - // In the later case the object is automatically deleted. - // - - if (SUCCEEDED(hr)) - { - hr = factory->QueryInterface(InterfaceId, Interface); - factory->Release(); - } - - return hr; -} diff --git a/general/umdfSkeleton/driver.cpp b/general/umdfSkeleton/driver.cpp deleted file mode 100644 index 2061ec2d..00000000 --- a/general/umdfSkeleton/driver.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved. - -Module Name: - - Driver.cpp - -Abstract: - - This module contains the implementation of the UMDF Skeleton Sample's - core driver callback object. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#include "internal.h" -#include "driver.tmh" - -HRESULT -CMyDriver::CreateInstance( - _Out_ PCMyDriver *Driver - ) -/*++ - - Routine Description: - - This static method is invoked in order to create and initialize a new - instance of the driver class. The caller should arrange for the object - to be released when it is no longer in use. - - Arguments: - - Driver - a location to store a referenced pointer to the new instance - - Return Value: - - S_OK if successful, or error otherwise. - ---*/ -{ - PCMyDriver driver; - HRESULT hr; - - // - // Allocate the callback object. - // - - driver = new CMyDriver(); - - if (NULL == driver) - { - return E_OUTOFMEMORY; - } - - // - // Initialize the callback object. - // - - hr = driver->Initialize(); - - if (SUCCEEDED(hr)) - { - // - // Store a pointer to the new, initialized object in the output - // parameter. - // - - *Driver = driver; - } - else - { - - // - // Release the reference on the driver object to get it to delete - // itself. - // - - driver->Release(); - } - - return hr; -} - -HRESULT -CMyDriver::Initialize( - VOID - ) -/*++ - - Routine Description: - - This method is called to initialize a newly created driver callback object - before it is returned to the creator. Unlike the constructor, the - Initialize method contains operations which could potentially fail. - - Arguments: - - None - - Return Value: - - None - ---*/ -{ - return S_OK; -} - -HRESULT -CMyDriver::QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Interface - ) -/*++ - - Routine Description: - - This method returns a pointer to the requested interface on the callback - object.. - - Arguments: - - InterfaceId - the IID of the interface to query/reference - - Interface - a location to store the interface pointer. - - Return Value: - - S_OK if the interface is supported. - E_NOINTERFACE if it is not supported. - ---*/ -{ - if (IsEqualIID(InterfaceId, __uuidof(IDriverEntry))) - { - *Interface = QueryIDriverEntry(); - return S_OK; - } - else - { - return CUnknown::QueryInterface(InterfaceId, Interface); - } -} - -HRESULT -CMyDriver::OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ) -/*++ - - Routine Description: - - The FX invokes this method when it wants to install our driver on a device - stack. This method creates a device callback object, then calls the Fx - to create an Fx device object and associate the new callback object with - it. - - Arguments: - - FxWdfDriver - the Fx driver object. - - FxDeviceInit - the initialization information for the device. - - Return Value: - - status - ---*/ -{ - HRESULT hr; - - PCMyDevice device = NULL; - - // - // TODO: Do any per-device initialization (reading settings from the - // registry for example) that's necessary before creating your - // device callback object here. Otherwise you can leave such - // initialization to the initialization of the device event - // handler. - // - - // - // Create a new instance of our device callback object - // - - hr = CMyDevice::CreateInstance(FxWdfDriver, FxDeviceInit, &device); - - // - // TODO: Change any per-device settings that the object exposes before - // calling Configure to let it complete its initialization. - // - - // - // If that succeeded then call the device's construct method. This - // allows the device to create any queues or other structures that it - // needs now that the corresponding fx device object has been created. - // - - if (SUCCEEDED(hr)) - { - hr = device->Configure(); - } - - // - // Release the reference on the device callback object now that it's been - // associated with an fx device object. - // - - if (NULL != device) - { - device->Release(); - } - - return hr; -} diff --git a/general/umdfSkeleton/driver.h b/general/umdfSkeleton/driver.h deleted file mode 100644 index c5664ac0..00000000 --- a/general/umdfSkeleton/driver.h +++ /dev/null @@ -1,149 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Driver.h - -Abstract: - - This module contains the type definitions for the UMDF Skeleton sample's - driver callback class. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -// -// This class handles driver events for the skeleton sample. In particular -// it supports the OnDeviceAdd event, which occurs when the driver is called -// to setup per-device handlers for a new device stack. -// - -class CMyDriver : public CUnknown, public IDriverEntry -{ -// -// Private data members. -// -private: - -// -// Private methods. -// -private: - - // - // Returns a refernced pointer to the IDriverEntry interface. - // - - IDriverEntry * - QueryIDriverEntry( - VOID - ) - { - AddRef(); - return static_cast<IDriverEntry*>(this); - } - - HRESULT - Initialize( - VOID - ); - -// -// Public methods -// -public: - - // - // The factory method used to create an instance of this driver. - // - - static - HRESULT - CreateInstance( - _Out_ PCMyDriver *Driver - ); - -// -// COM methods -// -public: - - // - // IDriverEntry methods - // - - virtual - HRESULT - STDMETHODCALLTYPE - OnInitialize( - _In_ IWDFDriver *FxWdfDriver - ) - { - UNREFERENCED_PARAMETER( FxWdfDriver ); - - return S_OK; - } - - virtual - HRESULT - STDMETHODCALLTYPE - OnDeviceAdd( - _In_ IWDFDriver *FxWdfDriver, - _In_ IWDFDeviceInitialize *FxDeviceInit - ); - - virtual - VOID - STDMETHODCALLTYPE - OnDeinitialize( - _In_ IWDFDriver *FxWdfDriver - ) - { - UNREFERENCED_PARAMETER( FxWdfDriver ); - - return; - } - - // - // IUnknown methods. - // - // We have to implement basic ones here that redirect to the - // base class becuase of the multiple inheritance. - // - - virtual - ULONG - STDMETHODCALLTYPE - AddRef( - VOID - ) - { - return __super::AddRef(); - } - - _At_(this, __drv_freesMem(object)) - virtual - ULONG - STDMETHODCALLTYPE - Release( - VOID - ) - { - return __super::Release(); - } - - virtual - HRESULT - STDMETHODCALLTYPE - QueryInterface( - _In_ REFIID InterfaceId, - _Out_ PVOID *Object - ); -}; diff --git a/general/umdfSkeleton/exports.def b/general/umdfSkeleton/exports.def deleted file mode 100644 index a1ab223c..00000000 --- a/general/umdfSkeleton/exports.def +++ /dev/null @@ -1,10 +0,0 @@ -; Skeleton.def : Declares the module parameters. - -; -; TODO: Change the library name here to match your binary name. -; - -LIBRARY "UMDFSkeleton.DLL" - -EXPORTS - DllGetClassObject PRIVATE diff --git a/general/umdfSkeleton/internal.h b/general/umdfSkeleton/internal.h deleted file mode 100644 index bd8c3c6d..00000000 --- a/general/umdfSkeleton/internal.h +++ /dev/null @@ -1,90 +0,0 @@ -/*++ - -Copyright (C) Microsoft Corporation, All Rights Reserved - -Module Name: - - Internal.h - -Abstract: - - This module contains the local type definitions for the UMDF Skeleton - driver sample. - -Environment: - - Windows User-Mode Driver Framework (WUDF) - ---*/ - -#pragma once - -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0])) -#endif - -// -// Include the WUDF DDI -// - -#include "wudfddi.h" - -// -// Use specstrings for in/out annotation of function parameters. -// - -#include "specstrings.h" - -// -// Forward definitions of classes in the other header files. -// - -typedef class CMyDriver *PCMyDriver; -typedef class CMyDevice *PCMyDevice; - -// -// Define the tracing flags. -// -// TODO: Choose a different trace control GUID -// - -#define WPP_CONTROL_GUIDS \ - WPP_DEFINE_CONTROL_GUID( \ - MyDriverTraceControl, (e7541cdd,30e8,4b50,aeb0,51927330ae64), \ - \ - WPP_DEFINE_BIT(MYDRIVER_ALL_INFO) \ - ) - -#define WPP_FLAG_LEVEL_LOGGER(flag, level) \ - WPP_LEVEL_LOGGER(flag) - -#define WPP_FLAG_LEVEL_ENABLED(flag, level) \ - (WPP_LEVEL_ENABLED(flag) && \ - WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) - -// -// This comment block is scanned by the trace preprocessor to define our -// Trace function. -// -// begin_wpp config -// FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); -// end_wpp -// - -// -// Driver specific #defines -// -// TODO: Change these values to be appropriate for your driver. -// - -#define MYDRIVER_TRACING_ID L"Microsoft\\UMDF\\Skeleton" -#define MYDRIVER_CLASS_ID { 0xd4112073, 0xd09b, 0x458f, { 0xa5, 0xaa, 0x35, 0xef, 0x21, 0xee, 0xf5, 0xde } } - - -// -// Include the type specific headers. -// - -#include "comsup.h" -#include "driver.h" -#include "device.h" diff --git a/general/umdfSkeleton/umdfSkeleton.sln b/general/umdfSkeleton/umdfSkeleton.sln deleted file mode 100644 index c8432e90..00000000 --- a/general/umdfSkeleton/umdfSkeleton.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0 -MinimumVisualStudioVersion = 12.0 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UMDFSkeleton", "UMDFSkeleton.vcxproj", "{6C720AF2-E419-4BA6-927C-607BE3E771F1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|Win32.Build.0 = Debug|Win32 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|Win32.ActiveCfg = Release|Win32 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|Win32.Build.0 = Release|Win32 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|x64.ActiveCfg = Debug|x64 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Debug|x64.Build.0 = Debug|x64 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|x64.ActiveCfg = Release|x64 - {6C720AF2-E419-4BA6-927C-607BE3E771F1}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal |
