Fill provider with some empty containers.

This commit is contained in:
Raphael Junqueira 2005-11-03 11:34:28 +00:00 committed by Alexandre Julliard
parent 32d5240178
commit af983e4d86
2 changed files with 196 additions and 23 deletions

View File

@ -108,27 +108,61 @@ HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAINER ifa
return E_INVALIDARG;
}
HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pwszContainer, IDxDiagContainer** ppInstance) {
HRESULT WINAPI IDxDiagContainerImpl_GetChildContainerInternal(PDXDIAGCONTAINER iface, LPCWSTR pwszContainer, IDxDiagContainer** ppInstance) {
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
IDxDiagContainerImpl_SubContainer* p = NULL;
p = This->subContainers;
while (NULL != p) {
if (0 == lstrcmpW(p->contName, pwszContainer)) {
*ppInstance = (PDXDIAGCONTAINER)p->pCont;
return S_OK;
}
p = p->next;
}
return E_INVALIDARG;
}
HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pwszContainer, IDxDiagContainer** ppInstance) {
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
IDxDiagContainer* pContainer = NULL;
LPWSTR tmp, orig_tmp;
INT tmp_len;
WCHAR* cur;
HRESULT hr = E_INVALIDARG;
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pwszContainer), ppInstance);
if (NULL == ppInstance || NULL == pwszContainer) {
return E_INVALIDARG;
}
p = This->subContainers;
while (NULL != p) {
if (0 == lstrcmpW(p->contName, pwszContainer)) {
IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)p->pCont, &IID_IDxDiagContainer, (void**) ppInstance);
/*TRACE"(%p) returns %p\n", iface, *ppInstance);*/
return S_OK;
}
p = p->next;
pContainer = (PDXDIAGCONTAINER) This;
tmp_len = strlenW(pwszContainer) + 1;
orig_tmp = tmp = HeapAlloc(GetProcessHeap(), 0, tmp_len * sizeof(WCHAR));
if (NULL == tmp) return E_FAIL;
lstrcpynW(tmp, pwszContainer, tmp_len);
cur = strchrW(tmp, '.');
while (NULL != cur) {
*cur = '\0'; /* cut tmp string to '.' */
hr = IDxDiagContainerImpl_GetChildContainerInternal(pContainer, tmp, &pContainer);
if (!SUCCEEDED(hr) || NULL == pContainer)
goto on_error;
*cur++; /* go after '.' (just replaced by \0) */
tmp = cur;
cur = strchrW(tmp, '.');
}
return E_INVALIDARG;
hr = IDxDiagContainerImpl_GetChildContainerInternal(pContainer, tmp, ppInstance);
if (SUCCEEDED(hr)) {
IDxDiagContainerImpl_AddRef((PDXDIAGCONTAINER)*ppInstance);
}
on_error:
HeapFree(GetProcessHeap(), 0, orig_tmp);
return hr;
}
HRESULT WINAPI IDxDiagContainerImpl_GetNumberOfProps(PDXDIAGCONTAINER iface, DWORD* pdwCount) {

View File

@ -129,30 +129,169 @@ HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, R
return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER)provider, riid, ppobj);
}
HRESULT DXDiag_InitRootDXDiagContainer(IDxDiagContainer* pRootCont) {
static const WCHAR DxDiag_SystemInfo[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
HRESULT DXDiag_InitDXDiagSystemInfoContainer(IDxDiagContainer* pSubCont) {
HRESULT hr = S_OK;
static const WCHAR dwDirectXVersionMajor[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','a','j','o','r',0};
static const WCHAR dwDirectXVersionMinor[] = {'d','w','D','i','r','e','c','t','X','V','e','r','s','i','o','n','M','i','n','o','r',0};
static const WCHAR szDirectXVersionLetter[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','e','t','t','e','r',0};
static const WCHAR szDirectXVersionLetter_v[] = {'c',0};
IDxDiagContainer* pSubCont = NULL;
static const WCHAR bDebug[] = {'b','D','e','b','u','g',0};
static const WCHAR szDirectXVersionEnglish[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','E','n','g','l','i','s','h',0};
static const WCHAR szDirectXVersionEnglish_v[] = {'4','.','0','9','.','0','0','0','0','.','0','9','0','4',0};
static const WCHAR szDirectXVersionLongEnglish[] = {'s','z','D','i','r','e','c','t','X','V','e','r','s','i','o','n','L','o','n','g','E','n','g','l','i','s','h',0};
static const WCHAR szDirectXVersionLongEnglish_v[] = {'=',' ','"','D','i','r','e','c','t','X',' ','9','.','0','c',' ','(','4','.','0','9','.','0','0','0','0','.','0','9','0','4',')',0};
/*static const WCHAR szDxDiagVersion[] = {'s','z','D','x','D','i','a','g','V','e','r','s','i','o','n',0};*/
/*szWindowsDir*/
/*szWindowsDir*/
/*"dwOSMajorVersion"*/
/*"dwOSMinorVersion"*/
/*"dwOSBuildNumber"*/
/*"dwOSPlatformID"*/
VARIANT v;
HRESULT hr = S_OK;
TRACE("(%p)\n", pRootCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) {
return hr;
}
V_VT(&v) = VT_UI4; V_UI4(&v) = 9;
hr = IDxDiagContainerImpl_AddProp(pSubCont, dwDirectXVersionMajor, &v);
V_VT(&v) = VT_UI4; V_UI4(&v) = 0;
hr = IDxDiagContainerImpl_AddProp(pSubCont, dwDirectXVersionMinor, &v);
V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(szDirectXVersionLetter_v);
hr = IDxDiagContainerImpl_AddProp(pSubCont, szDirectXVersionLetter, &v);
V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(szDirectXVersionEnglish_v);
hr = IDxDiagContainerImpl_AddProp(pSubCont, szDirectXVersionEnglish, &v);
V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(szDirectXVersionLongEnglish);
hr = IDxDiagContainerImpl_AddProp(pSubCont, szDirectXVersionLongEnglish_v, &v);
V_VT(&v) = VT_BOOL; V_BOOL(&v) = FALSE;
hr = IDxDiagContainerImpl_AddProp(pSubCont, bDebug, &v);
return hr;
}
HRESULT DXDiag_InitDXDiagSystemDevicesContainer(IDxDiagContainer* pSubCont) {
HRESULT hr = S_OK;
/*
static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
static const WCHAR szDeviceID[] = {'s','z','D','e','v','i','c','e','I','D',0};
VARIANT v;
IDxDiagContainer* pDeviceSubCont = NULL;
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDeviceSubCont);
if (FAILED(hr)) { return hr; }
V_VT(pvarProp) = VT_BSTR;
V_BSTR(pvarProp) = SysAllocString(property->psz);
hr = IDxDiagContainerImpl_AddProp(pDeviceSubCont, szDescription, &v);
V_VT(pvarProp) = VT_BSTR;
V_BSTR(pvarProp) = SysAllocString(property->psz);
hr = IDxDiagContainerImpl_AddProp(pDeviceSubCont, szDeviceID, &v);
hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, "", pDeviceSubCont);
*/
return hr;
}
HRESULT DXDiag_InitDXDiagLogicalDisksContainer(IDxDiagContainer* pSubCont) {
HRESULT hr = S_OK;
/*
static const WCHAR szDriveLetter[] = {'s','z','D','r','i','v','e','L','e','t','t','e','r',0};
static const WCHAR szFreeSpace[] = {'s','z','F','r','e','e','S','p','a','c','e',0};
static const WCHAR szMaxSpace[] = {'s','z','M','a','x','S','p','a','c','e',0};
static const WCHAR szFileSystem[] = {'s','z','F','i','l','e','S','y','s','t','e','m',0};
static const WCHAR szModel[] = {'s','z','M','o','d','e','l',0};
static const WCHAR szPNPDeviceID[] = {'s','z','P','N','P','D','e','v','i','c','e','I','D',0};
static const WCHAR dwHardDriveIndex[] = {'d','w','H','a','r','d','D','r','i','v','e','I','n','d','e','x',0};
VARIANT v;
IDxDiagContainer* pDiskSubCont = NULL;
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pDiskSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, "" , pDiskSubCont);
*/
return hr;
}
HRESULT DXDiag_InitDXDiagDirectXFilesContainer(IDxDiagContainer* pSubCont) {
HRESULT hr = S_OK;
/*
static const WCHAR szName[] = {'s','z','N','a','m','e',0};
static const WCHAR szVersion[] = {'s','z','V','e','r','s','i','o','n',0};
VARIANT v;
*/
return hr;
}
HRESULT DXDiag_InitDXDiagDirectSoundContainer(IDxDiagContainer* pSubCont) {
HRESULT hr = S_OK;
static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
static const WCHAR DxDiag_SoundCaptureDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e','D','e','v','i','c','e','s',0};
IDxDiagContainer* pSubSubCont = NULL;
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, DxDiag_SoundDevices, pSubSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pSubCont, DxDiag_SoundCaptureDevices, pSubSubCont);
return hr;
}
HRESULT DXDiag_InitRootDXDiagContainer(IDxDiagContainer* pRootCont) {
HRESULT hr = S_OK;
static const WCHAR DxDiag_SystemInfo[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
static const WCHAR DxDiag_SystemDevices[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','D','e','v','i','c','e','s',0};
static const WCHAR DxDiag_LogicalDisks[] = {'D','x','D','i','a','g','_','L','o','g','i','c','a','l','D','i','s','k','s',0};
static const WCHAR DxDiag_DirectXFiles[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','X','F','i','l','e','s',0};
static const WCHAR DxDiag_DisplayDevices[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0};
static const WCHAR DxDiag_DirectSound[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d',0};
static const WCHAR DxDiag_DirectMusic[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','M','u','s','i','c',0};
static const WCHAR DxDiag_DirectInput[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','I','n','p','u','t',0};
static const WCHAR DxDiag_DirectPlay[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','P','l','a','y',0};
static const WCHAR DxDiag_DirectShowFilters[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','h','o','w','F','i','l','t','e','r','s',0};
IDxDiagContainer* pSubCont = NULL;
TRACE("(%p)\n", pRootCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = DXDiag_InitDXDiagSystemInfoContainer(pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_SystemInfo, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = DXDiag_InitDXDiagSystemDevicesContainer(pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_SystemDevices, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = DXDiag_InitDXDiagLogicalDisksContainer(pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_LogicalDisks, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = DXDiag_InitDXDiagDirectXFilesContainer(pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectXFiles, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DisplayDevices, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = DXDiag_InitDXDiagDirectSoundContainer(pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectSound, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectMusic, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectInput, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectPlay, pSubCont);
hr = DXDiag_CreateDXDiagContainer(&IID_IDxDiagContainer, (void**) &pSubCont);
if (FAILED(hr)) { return hr; }
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_DirectShowFilters, pSubCont);
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_SystemInfo, pSubCont);
return hr;
}