- some fixes on sub containers support
- add support for properties (VARIANT) - hard coded simple init for root container (getting simple dx9 version checks working)
This commit is contained in:
parent
9572ae764c
commit
db0d0b91e6
|
@ -3,7 +3,7 @@ TOPOBJDIR = ../..
|
||||||
SRCDIR = @srcdir@
|
SRCDIR = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
MODULE = dxdiagn.dll
|
MODULE = dxdiagn.dll
|
||||||
IMPORTS = ole32 user32 advapi32 kernel32
|
IMPORTS = ole32 oleaut32 user32 advapi32 kernel32
|
||||||
EXTRALIBS = -ldxguid -luuid
|
EXTRALIBS = -ldxguid -luuid
|
||||||
|
|
||||||
C_SRCS = \
|
C_SRCS = \
|
||||||
|
|
|
@ -75,9 +75,9 @@ HRESULT WINAPI IDxDiagContainerImpl_GetNumberOfChildContainers(PDXDIAGCONTAINER
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) {
|
HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszContainer, DWORD cchContainer) {
|
||||||
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
IDxDiagContainerImpl_SubContainer* p = NULL;
|
IDxDiagContainerImpl_SubContainer* p = NULL;
|
||||||
DWORD i = 0;
|
DWORD i = 0;
|
||||||
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
|
||||||
|
|
||||||
TRACE("(%p, %lu, %s, %lu)\n", iface, dwIndex, debugstr_w(pwszContainer), cchContainer);
|
TRACE("(%p, %lu, %s, %lu)\n", iface, dwIndex, debugstr_w(pwszContainer), cchContainer);
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAINER ifa
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pwszContainer, IDxDiagContainer** ppInstance) {
|
HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pwszContainer, IDxDiagContainer** ppInstance) {
|
||||||
IDxDiagContainerImpl_SubContainer* p = NULL;
|
|
||||||
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
|
IDxDiagContainerImpl_SubContainer* p = NULL;
|
||||||
|
|
||||||
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pwszContainer), ppInstance);
|
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pwszContainer), ppInstance);
|
||||||
|
|
||||||
|
@ -116,7 +116,8 @@ HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LP
|
||||||
p = This->subContainers;
|
p = This->subContainers;
|
||||||
while (NULL != p) {
|
while (NULL != p) {
|
||||||
if (0 == lstrcmpW(p->contName, pwszContainer)) {
|
if (0 == lstrcmpW(p->contName, pwszContainer)) {
|
||||||
IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)p, &IID_IDxDiagContainer, (void**) ppInstance);
|
IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)p->pCont, &IID_IDxDiagContainer, (void**) ppInstance);
|
||||||
|
/*TRACE"(%p) returns %p\n", iface, *ppInstance);*/
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
p = p->next;
|
p = p->next;
|
||||||
|
@ -126,20 +127,128 @@ HRESULT WINAPI IDxDiagContainerImpl_GetChildContainer(PDXDIAGCONTAINER iface, LP
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDxDiagContainerImpl_GetNumberOfProps(PDXDIAGCONTAINER iface, DWORD* pdwCount) {
|
HRESULT WINAPI IDxDiagContainerImpl_GetNumberOfProps(PDXDIAGCONTAINER iface, DWORD* pdwCount) {
|
||||||
/* IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface; */
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
FIXME("(%p, %p): stub\n", iface, pdwCount);
|
TRACE("(%p)\n", iface);
|
||||||
|
if (NULL == pdwCount) {
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
*pdwCount = This->nProperties;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) {
|
HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName) {
|
||||||
/* IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface; */
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
FIXME("(%p, %lu, %s, %lu): stub\n", iface, dwIndex, debugstr_w(pwszPropName), cchPropName);
|
IDxDiagContainerImpl_Property* p = NULL;
|
||||||
return S_OK;
|
DWORD i = 0;
|
||||||
|
|
||||||
|
FIXME("(%p, %lu, %s, %lu)\n", iface, dwIndex, debugstr_w(pwszPropName), cchPropName);
|
||||||
|
|
||||||
|
if (NULL == pwszPropName) {
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
if (256 > cchPropName) {
|
||||||
|
return DXDIAG_E_INSUFFICIENT_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = This->properties;
|
||||||
|
while (NULL != p) {
|
||||||
|
if (dwIndex == i) {
|
||||||
|
if (cchPropName <= lstrlenW(p->vName)) {
|
||||||
|
return DXDIAG_E_INSUFFICIENT_BUFFER;
|
||||||
|
}
|
||||||
|
lstrcpynW(pwszPropName, p->vName, cchPropName);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
p = p->next;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
return E_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT WINAPI IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pvarProp) {
|
HRESULT WINAPI IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pvarProp) {
|
||||||
/* IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface; */
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
FIXME("(%p, %s, %p): stub\n", iface, debugstr_w(pwszPropName), pvarProp);
|
IDxDiagContainerImpl_Property* p = NULL;
|
||||||
|
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pwszPropName), pvarProp);
|
||||||
|
|
||||||
|
if (NULL == pvarProp || NULL == pwszPropName) {
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = This->properties;
|
||||||
|
while (NULL != p) {
|
||||||
|
if (0 == lstrcmpW(p->vName, pwszPropName)) {
|
||||||
|
VariantCopy(pvarProp, &p->v);
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDxDiagContainerImpl_AddProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pVarProp) {
|
||||||
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
|
IDxDiagContainerImpl_Property* p = NULL;
|
||||||
|
IDxDiagContainerImpl_Property* pNew = NULL;
|
||||||
|
|
||||||
|
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pwszPropName), pVarProp);
|
||||||
|
|
||||||
|
if (NULL == pVarProp || NULL == pwszPropName) {
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
pNew = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagContainerImpl_Property));
|
||||||
|
if (NULL == pNew) {
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
VariantInit(&pNew->v);
|
||||||
|
VariantCopy(&pNew->v, pVarProp);
|
||||||
|
pNew->vName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlenW(pwszPropName) * sizeof(WCHAR));
|
||||||
|
lstrcpyW(pNew->vName, pwszPropName);
|
||||||
|
pNew->next = NULL;
|
||||||
|
|
||||||
|
p = This->properties;
|
||||||
|
if (NULL == p) {
|
||||||
|
This->properties = pNew;
|
||||||
|
} else {
|
||||||
|
while (NULL != p->next) {
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
p->next = pNew;
|
||||||
|
}
|
||||||
|
++This->nProperties;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT WINAPI IDxDiagContainerImpl_AddChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pszContName, PDXDIAGCONTAINER pSubCont) {
|
||||||
|
IDxDiagContainerImpl *This = (IDxDiagContainerImpl *)iface;
|
||||||
|
IDxDiagContainerImpl_SubContainer* p = NULL;
|
||||||
|
IDxDiagContainerImpl_SubContainer* pNew = NULL;
|
||||||
|
|
||||||
|
FIXME("(%p, %s, %p)\n", iface, debugstr_w(pszContName), pSubCont);
|
||||||
|
|
||||||
|
if (NULL == pSubCont || NULL == pszContName) {
|
||||||
|
return E_INVALIDARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
pNew = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDxDiagContainerImpl_SubContainer));
|
||||||
|
if (NULL == pNew) {
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
pNew->pCont = pSubCont;
|
||||||
|
pNew->contName = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lstrlenW(pszContName) * sizeof(WCHAR));
|
||||||
|
lstrcpyW(pNew->contName, pszContName);
|
||||||
|
pNew->next = NULL;
|
||||||
|
|
||||||
|
p = This->subContainers;
|
||||||
|
if (NULL == p) {
|
||||||
|
This->subContainers = pNew;
|
||||||
|
} else {
|
||||||
|
while (NULL != p->next) {
|
||||||
|
p = p->next;
|
||||||
|
}
|
||||||
|
p->next = pNew;
|
||||||
|
}
|
||||||
|
++This->nSubContainers;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,13 @@ typedef struct IDxDiagContainerImpl_SubContainer {
|
||||||
struct IDxDiagContainerImpl_SubContainer* next;
|
struct IDxDiagContainerImpl_SubContainer* next;
|
||||||
} IDxDiagContainerImpl_SubContainer;
|
} IDxDiagContainerImpl_SubContainer;
|
||||||
|
|
||||||
|
typedef struct IDxDiagContainerImpl_Property {
|
||||||
|
LPWSTR vName;
|
||||||
|
VARIANT v;
|
||||||
|
struct IDxDiagContainerImpl_Property* next;
|
||||||
|
} IDxDiagContainerImpl_Property;
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Predeclare the interface implementation structures
|
* Predeclare the interface implementation structures
|
||||||
*/
|
*/
|
||||||
|
@ -90,7 +97,9 @@ struct IDxDiagContainerImpl {
|
||||||
IDxDiagContainerVtbl *lpVtbl;
|
IDxDiagContainerVtbl *lpVtbl;
|
||||||
DWORD ref;
|
DWORD ref;
|
||||||
/* IDxDiagContainer fields */
|
/* IDxDiagContainer fields */
|
||||||
|
IDxDiagContainerImpl_Property* properties;
|
||||||
IDxDiagContainerImpl_SubContainer* subContainers;
|
IDxDiagContainerImpl_SubContainer* subContainers;
|
||||||
|
DWORD nProperties;
|
||||||
DWORD nSubContainers;
|
DWORD nSubContainers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -107,6 +116,10 @@ extern HRESULT WINAPI IDxDiagContainerImpl_GetNumberOfProps(PDXDIAGCONTAINER ifa
|
||||||
extern HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName);
|
extern HRESULT WINAPI IDxDiagContainerImpl_EnumPropNames(PDXDIAGCONTAINER iface, DWORD dwIndex, LPWSTR pwszPropName, DWORD cchPropName);
|
||||||
extern HRESULT WINAPI IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pvarProp);
|
extern HRESULT WINAPI IDxDiagContainerImpl_GetProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pvarProp);
|
||||||
|
|
||||||
|
/** Internal */
|
||||||
|
extern HRESULT WINAPI IDxDiagContainerImpl_AddProp(PDXDIAGCONTAINER iface, LPCWSTR pwszPropName, VARIANT* pVarProp);
|
||||||
|
extern HRESULT WINAPI IDxDiagContainerImpl_AddChildContainer(PDXDIAGCONTAINER iface, LPCWSTR pszContName, PDXDIAGCONTAINER pSubCont);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* factories
|
* factories
|
||||||
*/
|
*/
|
||||||
|
@ -114,6 +127,7 @@ extern HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkO
|
||||||
|
|
||||||
/** internal factory */
|
/** internal factory */
|
||||||
extern HRESULT DXDiag_CreateDXDiagContainer(REFIID riid, LPVOID *ppobj);
|
extern HRESULT DXDiag_CreateDXDiagContainer(REFIID riid, LPVOID *ppobj);
|
||||||
|
extern HRESULT DXDiag_InitRootDXDiagContainer(IDxDiagContainer* pRootCont);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,7 @@ HRESULT WINAPI IDxDiagProviderImpl_GetRootContainer(PDXDIAGPROVIDER iface, IDxDi
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
hr = DXDiag_InitRootDXDiagContainer((PDXDIAGCONTAINER)This->pRootContainer);
|
||||||
}
|
}
|
||||||
return IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)This->pRootContainer, &IID_IDxDiagContainer, (void**) ppInstance);
|
return IDxDiagContainerImpl_QueryInterface((PDXDIAGCONTAINER)This->pRootContainer, &IID_IDxDiagContainer, (void**) ppInstance);
|
||||||
}
|
}
|
||||||
|
@ -122,3 +123,31 @@ HRESULT DXDiag_CreateDXDiagProvider(LPCLASSFACTORY iface, LPUNKNOWN punkOuter, R
|
||||||
provider->ref = 0; /* will be inited with QueryInterface */
|
provider->ref = 0; /* will be inited with QueryInterface */
|
||||||
return IDxDiagProviderImpl_QueryInterface ((PDXDIAGPROVIDER)provider, riid, ppobj);
|
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};
|
||||||
|
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;
|
||||||
|
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);
|
||||||
|
|
||||||
|
hr = IDxDiagContainerImpl_AddChildContainer(pRootCont, DxDiag_SystemInfo, pSubCont);
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue