diff options
| author | zlockard <[email protected]> | 2024-01-31 13:45:54 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-31 13:45:54 -0800 |
| commit | 24f280dc4a700f00f5fbb8f13815b941620adb8e (patch) | |
| tree | 63243812757e456aadf9fb4cbf07277b1d22eccf /wpd/WpdWudfSampleDriver/Driver.cpp | |
| parent | c657bc76ca6cf64660e12efe2d07a100055d98c0 (diff) | |
Fixes for sample build errors and updates to the execution script to use new build flags (#1078)
* Fixes for sample build errors
* Fix additional sample
* Add additional sample
* Updated comments in Build-Sample.ps1
* Adjusting exclusions.csv to be accurate for GE. Still issues for NI that we need to understand better
* Merge from develop branch
* Merge from develop branch
* Merge from develop branch
* Delete WPD samples
* Separate infverif additional options for old vs new WDK
* Delete WPD samples entry in our CODEOWNERS file
* Fix spelling error
* For 22621 WDK Remove the /samples flag
---------
Co-authored-by: Zac Lockard <[email protected]>
Co-authored-by: Jakob Lichtenberg (170957) <[email protected]>
Diffstat (limited to 'wpd/WpdWudfSampleDriver/Driver.cpp')
| -rw-r--r-- | wpd/WpdWudfSampleDriver/Driver.cpp | 199 |
1 files changed, 0 insertions, 199 deletions
diff --git a/wpd/WpdWudfSampleDriver/Driver.cpp b/wpd/WpdWudfSampleDriver/Driver.cpp deleted file mode 100644 index 49edc789..00000000 --- a/wpd/WpdWudfSampleDriver/Driver.cpp +++ /dev/null @@ -1,199 +0,0 @@ - -#include "stdafx.h" -#include "Driver.h" -#include "Device.h" -#include "Queue.h" - -CDriver::CDriver() -{ - - -} - -// -// The framework call this function when device is detected. This driver -// creates a device callback object and -// -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 - ---*/ -{ - HRESULT hr = S_OK; - CComPtr<IUnknown> pDeviceCallback; - - WpdBaseDriver *pWpdBaseDriver = NULL; - - // - // Create the WPD driver object that handles all WPD messages for this device - // - pWpdBaseDriver = new WpdBaseDriver(); - if(pWpdBaseDriver == NULL) - { - hr = E_OUTOFMEMORY; - } - - if(SUCCEEDED(hr)) - { - // - // Create device callback object - // - hr = CDevice::CreateInstance(pDeviceInit, pWpdBaseDriver, &pDeviceCallback); - } - - // - // This driver has no special power management requirements and so - // we set power policy ownership to UMDF to indicate that UMDF should - // handle powermanagement for us. - // - pDeviceInit->SetPowerPolicyOwnership(FALSE); - - // - // Create WDFDevice. - // - CComPtr<IWDFDevice> pIWDFDevice; - if(SUCCEEDED(hr)) - { - hr = pDriver->CreateDevice( - pDeviceInit, - pDeviceCallback, - &pIWDFDevice); - } - - // - // Assign pWpdBaseDriver to the device object. Each UMDF device requires its own instance of - // a WpdBaseDriver to handle WPD messages. - // - if(SUCCEEDED(hr)) - { - hr = pIWDFDevice->AssignContext(this, (void*)pWpdBaseDriver); - if(SUCCEEDED(hr)) - { - // AddRef the WpdBaseDriver object since it is not stored with the - // device context. - pWpdBaseDriver->AddRef(); - } - } - - // - // Create queue callback object - // - CComPtr<IUnknown> pIUnknown; - if(S_OK == hr) - { - hr = CQueue::CreateInstance(&pIUnknown); - } - - // - // Configure the default queue. - // - if(S_OK == hr) - { - CComPtr<IWDFIoQueue> pDefaultQueue; - hr = pIWDFDevice->CreateIoQueue( - pIUnknown, - TRUE, // bDefaultQueue - WdfIoQueueDispatchSequential, - TRUE, // bPowerManaged - FALSE, // bAllowZeroLengthRequests - &pDefaultQueue); - } - - pDeviceCallback = NULL; - pIWDFDevice = NULL; - - // - // It is fine to release the interface on the callback object. - // The framework has its own refcount on this object and will - // provide an interface when calling into the driver. - // - pIUnknown = NULL; - - // Release the WpdBaseDriver object. If it was successfully added to the device context, - // it was already addref'd above. Releasing it here ensures it will be destroyed if - // an error occured and it could not be added to the device context. - SAFE_RELEASE(pWpdBaseDriver); - - 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: - ---*/ -{ - UNREFERENCED_PARAMETER(pDriver); - 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: - ---*/ -{ - UNREFERENCED_PARAMETER(pDriver); - return S_OK; -} - -STDMETHODIMP_ (void) -CDriver::OnCleanup( - _In_ IWDFObject* pWdfObject - ) -{ - // Release the base driver object - HRESULT hr = S_OK; - WpdBaseDriver* pWpdBaseDriver = NULL; - - hr = pWdfObject->RetrieveContext((void**)&pWpdBaseDriver); - if((hr == S_OK) && (pWpdBaseDriver != NULL)) - { - pWpdBaseDriver->Release(); - pWpdBaseDriver = NULL; - } -} - |
