From 24f280dc4a700f00f5fbb8f13815b941620adb8e Mon Sep 17 00:00:00 2001 From: zlockard Date: Wed, 31 Jan 2024 13:45:54 -0800 Subject: 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 Co-authored-by: Jakob Lichtenberg (170957) --- wpd/WpdServiceSampleDriver/WpdService.cpp | 132 ------------------------------ 1 file changed, 132 deletions(-) delete mode 100644 wpd/WpdServiceSampleDriver/WpdService.cpp (limited to 'wpd/WpdServiceSampleDriver/WpdService.cpp') diff --git a/wpd/WpdServiceSampleDriver/WpdService.cpp b/wpd/WpdServiceSampleDriver/WpdService.cpp deleted file mode 100644 index 4a255b0b..00000000 --- a/wpd/WpdServiceSampleDriver/WpdService.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "stdafx.h" - -#include "WpdService.tmh" - -WpdService::WpdService() : m_pContactsService(NULL) -{ -} - -WpdService::~WpdService() -{ - -} - -HRESULT WpdService::Initialize(_In_ FakeDevice* pDevice) -{ - if (pDevice == NULL) - { - return E_POINTER; - } - m_pContactsService = pDevice->GetContactsService(); - m_ServiceMethods.Initialize(m_pContactsService); - m_ServiceCapabilities.Initialize(m_pContactsService); - return S_OK; -} - -HRESULT WpdService::DispatchWpdMessage( - _In_ REFPROPERTYKEY Command, - _In_ IPortableDeviceValues* pParams, - _In_ IPortableDeviceValues* pResults) -{ - HRESULT hr = S_OK; - LPWSTR pszRequestFilename = NULL; - - // Get the request filename to process the service message - hr = pParams->GetStringValue(PRIVATE_SAMPLE_DRIVER_REQUEST_FILENAME, &pszRequestFilename); - if (FAILED(hr)) - { - hr = E_INVALIDARG; - CHECK_HR(hr, "Failed to get the required requested filename"); - } - - if (hr == S_OK) - { - hr = CheckRequestFilename(pszRequestFilename); - CHECK_HR(hr, "Unknown request filename %ws received", pszRequestFilename); - } - - if (hr == S_OK) - { - if (Command.fmtid == WPD_CATEGORY_SERVICE_CAPABILITIES) - { - hr = m_ServiceCapabilities.DispatchWpdMessage(Command, pParams, pResults); - } - else if (IsEqualPropertyKey(Command, WPD_COMMAND_SERVICE_METHODS_START_INVOKE)) - { - hr = m_ServiceMethods.OnStartInvoke(pParams, pResults); - } - else if (IsEqualPropertyKey(Command, WPD_COMMAND_SERVICE_METHODS_END_INVOKE)) - { - hr = m_ServiceMethods.OnEndInvoke(pParams, pResults); - } - else if (IsEqualPropertyKey(Command, WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE)) - { - hr = m_ServiceMethods.OnCancelInvoke(pParams, pResults); - } - else if (IsEqualPropertyKey(Command, WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID)) - { - hr = OnGetServiceObjectID(pszRequestFilename, pParams, pResults); - } - else - { - hr = E_NOTIMPL; - CHECK_HR(hr, "Unknown command %ws.%d received",CComBSTR(Command.fmtid), Command.pid); - } - } - - CoTaskMemFree(pszRequestFilename); - - return hr; -} - -/** - * This method is called when we receive a WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID - * command. - * - * The parameters sent to us are: - * None - * - * The driver should: - * - Return the objectID associated with the filename. - * - */ -HRESULT WpdService::OnGetServiceObjectID( - _In_ LPCWSTR pszRequestFilename, - _In_ IPortableDeviceValues* pParams, - _In_ IPortableDeviceValues* pResults) -{ - HRESULT hr = S_OK; - - if((pParams == NULL) || - (pResults == NULL)) - { - hr = E_POINTER; - CHECK_HR(hr, "Cannot have NULL parameter"); - return hr; - } - - // For simplicity, the request filename is the same as the service object ID - hr = pResults->SetStringValue(WPD_PROPERTY_SERVICE_OBJECT_ID, pszRequestFilename); - CHECK_HR(hr, "Failed to set WPD_PROPERTY_COMMON_OBJECT_IDS"); - - return hr; -} - -HRESULT WpdService::CheckRequestFilename( - _In_ LPCWSTR pszRequestFilename) -{ - HRESULT hr = HRESULT_FROM_WIN32(ERROR_NOT_FOUND); - CAtlStringW strRequestFilename = pszRequestFilename; - - // For simplicity, the request filename happens to be the same as the service object ID - if (strRequestFilename.CompareNoCase(m_pContactsService->GetRequestFilename()) == 0) - { - hr = S_OK; - } - else - { - CHECK_HR(hr, "Unknown request filename %ws received", pszRequestFilename); - } - - return hr; -} -- cgit v1.3.1