HRESULT STDMETHODCALLTYPE IDeskDisplayAdapter_QueryInterface(PDESKDISPLAYADAPTER This, REFIID iid, PVOID *pvObject) { *pvObject = NULL; if (IsEqualIID(iid, &IID_IShellPropSheetExt) || IsEqualIID(iid, &IID_IUnknown)) { *pvObject = impl_to_interface(This, IShellPropSheetExt); } else if (IsEqualIID(iid, &IID_IShellExtInit)) { *pvObject = impl_to_interface(This, IShellExtInit); } else if (IsEqualIID(iid, &IID_IClassFactory)) { *pvObject = impl_to_interface(This, IClassFactory); } else { DPRINT1("IDeskDisplayAdapter::QueryInterface(%p,%p): E_NOINTERFACE\n", iid, pvObject); return E_NOINTERFACE; } IDeskDisplayAdapter_AddRef(This); return S_OK; }
static __inline HRESULT CRegKeySecurity_fnQueryInterface(PCRegKeySecurity obj, REFIID iid, PVOID *pvObject) { PVOID pvObj = NULL; if (IsEqualGUID(iid, &IID_IRegKeySecurity)) { pvObj = (PVOID)impl_to_interface(obj, ISecurityInformation); } #if REGEDIT_IMPLEMENT_ISECURITYINFORMATION2 else if (IsEqualGUID(iid, &IID_IRegKeySecurity2)) { pvObj = (PVOID)impl_to_interface(obj, ISecurityInformation2); } #endif else if (IsEqualGUID(iid, &IID_IEffectivePermission)) { pvObj = (PVOID)impl_to_interface(obj, IEffectivePermission); } else if (IsEqualGUID(iid, &IID_ISecurityObjectTypeInfo)) { pvObj = (PVOID)impl_to_interface(obj, ISecurityObjectTypeInfo); } if (pvObj == NULL) { return E_NOINTERFACE; } *pvObject = pvObj; CRegKeySecurity_fnAddRef(obj); return S_OK; }
static IBindStatusCallback * CreateBindStatusCallback(void) { CBindStatusCallback *This; This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This)); if (This == NULL) return NULL; This->lpIBindStatusCallbackVtbl = &vtblIBindStatusCallback; This->ref = 1; return impl_to_interface(This, IBindStatusCallback); }
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo) { PCDevSettings This; This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (This != NULL) { This->lpIDataObjectVtbl = &vtblIDataObject; This->ref = 1; if (SUCCEEDED(pCDevSettings_Initialize(This, DisplayDeviceInfo))) { return impl_to_interface(This, IDataObject); } CDevSettings_Release(impl_to_interface(This, IDataObject)); } return NULL; }
static HRESULT STDMETHODCALLTYPE CBindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID iid, PVOID *pvObject) { CBindStatusCallback *This = interface_to_impl(iface, IBindStatusCallback); *pvObject = NULL; if (IsEqualIID(iid, &IID_IBindStatusCallback) || IsEqualIID(iid, &IID_IUnknown)) { *pvObject = impl_to_interface(This, IBindStatusCallback); } else return E_NOINTERFACE; CBindStatusCallback_AddRef(iface); return S_OK; }
static HRESULT STDMETHODCALLTYPE CDevSettings_QueryInterface(IDataObject* iface, REFIID riid, void** ppvObject) { PCDevSettings This = impl_from_IDataObject(iface); *ppvObject = NULL; if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDataObject)) { *ppvObject = (PVOID)impl_to_interface(This, IDataObject); return S_OK; } else { DPRINT1("CDevSettings::QueryInterface: Queried unknown interface\n"); } return E_NOINTERFACE; }
static VOID pCDevSettings_InitializeExtInterface(PCDevSettings This) { PDESK_EXT_INTERFACE Interface = &This->ExtInterface; HKEY hKeyDev; ZeroMemory(Interface, sizeof(*Interface)); Interface->cbSize = sizeof(*Interface); /* Initialize the callback table */ Interface->Context = impl_to_interface(This, IDataObject); Interface->EnumAllModes = CDevSettings_EnumAllModes; Interface->SetCurrentMode = CDevSettings_SetCurrentMode; Interface->GetCurrentMode = CDevSettings_GetCurrentMode; Interface->SetPruningMode = CDevSettings_SetPruningMode; Interface->GetPruningMode = CDevSettings_GetPruningMode; /* Read the HardwareInformation.* values from the registry key */ hKeyDev = pCDevSettings_OpenDeviceKey(This, TRUE); if (hKeyDev != NULL) { DWORD dwType, dwMemSize = 0; DWORD dwSize = sizeof(dwMemSize); if (RegQueryValueEx(hKeyDev, TEXT("HardwareInformation.MemorySize"), NULL, &dwType, (PBYTE)&dwMemSize, &dwSize) == ERROR_SUCCESS && (dwType == REG_BINARY || dwType == REG_DWORD) && dwSize == sizeof(dwMemSize)) { dwMemSize /= 1024; if (dwMemSize > 1024) { dwMemSize /= 1024; if (dwMemSize > 1024) { wsprintf(Interface->MemorySize, _T("%u GB"), dwMemSize / 1024); } else { wsprintf(Interface->MemorySize, _T("%u MB"), dwMemSize); } } else { wsprintf(Interface->MemorySize, _T("%u KB"), dwMemSize); } } pCDevSettings_ReadHardwareInfo(hKeyDev, TEXT("HardwareInformation.ChipType"), Interface->ChipType); pCDevSettings_ReadHardwareInfo(hKeyDev, TEXT("HardwareInformation.DacType"), Interface->DacType); pCDevSettings_ReadHardwareInfo(hKeyDev, TEXT("HardwareInformation.AdapterString"), Interface->AdapterString); pCDevSettings_ReadHardwareInfo(hKeyDev, TEXT("HardwareInformation.BiosString"), Interface->BiosString); RegCloseKey(hKeyDev); } }