HRESULT CWIAPropertyManager::DeletePropertyData(__in PWIA_PROPERTY_INFO_DATA pInfo) { HRESULT hr = E_INVALIDARG; if (pInfo) { // // delete any allocated LISTS // if (pInfo->wpi.lAccessFlags & WIA_PROP_LIST) { if(pInfo->pv.vt & VT_I4) { WIAS_TRACE((g_hInst,"Freeing LONG List for %d",pInfo->pid)); if (pInfo->wpi.ValidVal.List.pList) { LocalFree(pInfo->wpi.ValidVal.List.pList); pInfo->wpi.ValidVal.List.pList = NULL; } } if(pInfo->pv.vt & VT_CLSID) { WIAS_TRACE((g_hInst,"Freeing GUID List for %d",pInfo->pid)); if (pInfo->wpi.ValidVal.ListGuid.pList) { LocalFree(pInfo->wpi.ValidVal.ListGuid.pList); pInfo->wpi.ValidVal.ListGuid.pList = NULL; } } } // // free any allocated BSTRS // if (pInfo->pv.vt == VT_BSTR) { SysFreeString(pInfo->pv.bstrVal); pInfo->pv.bstrVal = NULL; } // // delete any allocated GUIDS // if (pInfo->pv.vt == VT_CLSID) { delete pInfo->pv.puuid; pInfo->pv.puuid = NULL; } hr = S_OK; } return hr; }
void CWIACapabilityManager::Destroy() { WIAS_TRACE((g_hInst,"Array contents")); for(INT i = 0; i < m_CapabilityArray.Size(); i++) { FreeCapability(&m_CapabilityArray[i],TRUE); } m_CapabilityArray.Destroy(); }
HRESULT CWiaDriver::GetCapabilities( _Out_ PSTI_USD_CAPS pDevCaps) { HRESULT hr = S_OK; WIAEX_TRACE_BEGIN; if (!pDevCaps) { hr = E_INVALIDARG; WIAEX_ERROR((g_hInst, "Invalid parameter, hr = 0x%08X",hr)); } if (SUCCEEDED(hr)) { // // The sample driver supports device notifications (required), known also as interrupt events. // Polling (optional) it is not needed so STI_GENCAP_POLLING_NEEDED is not reported here: // memset(pDevCaps, 0, sizeof(STI_USD_CAPS)); pDevCaps->dwVersion = STI_VERSION_3; pDevCaps->dwGenericCaps = STI_GENCAP_WIA | STI_USD_GENCAP_NATIVE_PUSHSUPPORT | STI_GENCAP_NOTIFICATIONS; WIAS_TRACE((g_hInst, "Device capabilities: 0x%08X", pDevCaps->dwGenericCaps)); } if (FAILED(hr)) { m_hrLastEdviceError = hr; } WIAEX_TRACE((g_hInst, "IStiUSD::GetCapabilities 0x%08X", hr)); return hr; }
HRESULT CWiaDriver::DeviceReset() { WIAS_TRACE((g_hInst, "IStiUSD::DeviceReset 0x%08X", S_OK)); return S_OK; }
HRESULT CWiaDriver::GetStatus( _Inout_ PSTI_DEVICE_STATUS pDevStatus) { HRESULT hr = S_OK; if (!pDevStatus) { hr = E_INVALIDARG; WIAEX_ERROR((g_hInst, "Invalid parameter, hr = 0x%08X",hr)); } // // A driver may be requested to report one or both of the following: // // STI_DEVSTATUS_EVENTS_STATE - The driver should fill in the dwEventHandlingState member // STI_DEVSTATUS_ONLINE_STATE - The driver should fill in the dwOnlineState member // // In this case STI_DEVSTATUS_EVENTS_STATE is not expected nor supported as this driver // does not support polling events (if the driver previously set the STI_GENCAP_POLLING_NEEDED // flag in the device's STI_DEV_CAPS structure, the IStiUSD::GetStatus method is the means // by which the Event Monitor determines if a still image device event has occurred; // the Event Monitor will call the method, specifying STI_DEVSTATUS_EVENT_STATE // in the supplied STI_DEVICE_STATUS structure; the driver must poll the device // and set STI_EVENTHANDLING_PENDING if an event has occurred) // // If the caller specifies STI_DEVSTATUS_ONLINE_STATE in the supplied // STI_DEVICE_STATUS structure, the driver should set the appropriate flag // in the STI_DEVICE_STATUS structure's dwOnlineState member. // if (SUCCEEDED(hr)) { pDevStatus->dwOnlineState = 0; pDevStatus->dwHardwareStatusCode = 0; pDevStatus->dwEventHandlingState = 0; // // STI_DEVSTATUS_ONLINE_STATE: // if (pDevStatus->StatusMask & STI_DEVSTATUS_ONLINE_STATE) { // // This sample driver is always online and ready: // pDevStatus->dwOnlineState = STI_ONLINESTATE_OPERATIONAL; } // // STI_DEVSTATUS_EVENTS_STATE: // else if (pDevStatus->StatusMask & STI_DEVSTATUS_EVENTS_STATE) { // // Polled events are not supported so we don't have to return anyting here: // pDevStatus->dwEventHandlingState &= ~STI_EVENTHANDLING_PENDING; } } if (FAILED(hr)) { m_hrLastEdviceError = hr; } WIAS_TRACE((g_hInst, "IStiUSD::GetStatus 0x%08X", hr)); return hr; }