Re: additional dxdiagn functions
Rob Crittenden <[email protected]>
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Message-ID | <[email protected]> |
Here is a newer patch that has an additional feature. In Windows you can fetch a container one node at a time (fetch root->a, then a->b, then a->b->c) or you can fetch c directly by requesting "a.b.c". This new patch allows this. It is a little ugly because there doesn't seem to be a strtokW() function so I have to use a strchrW() and some add'l string manipulation instead. BTW, I'm also testing this with the BugReport.exe that ships with Max Payne 2. It was here that I found a request for "DxDiag_DirectSound.DxDiag_SoundDevices" that wasn't working properly. I wonder how whether it's worth it to add some boilerplate values to builtin_containers_dx9 to beef up the output of this program. In any case, make_builtins.py is a bit limiting because of the way it names variables. It doesn't support duplicate Container names. A patch for that may be forthcoming if there is interest. rob On Wed, 31 Dec 2003, Rob Crittenden wrote: > Ok, both unified diffs attached. > > rob > > On Wed, 31 Dec 2003, David Hammerton wrote: > > Hi Rob, > > > > Thanks for that! > > > > However - perhaps you could send the diff again as a unified diff (as > > well as your previous email). > > > > Unified diffs, created with 'cvs diff -u blah' instead of 'cvs diff > > blah' give more context to the changes. > > > > I'll review this on monday and commit it. > > > > Thanks again, and good work. > > > > David > > > > -- > > David Hammerton > > WineX developer > > TransGaming Technologies > > Bus: +1 416 979 9900 x329 > > Fax: +1 416 979 9908 > > [email protected] > > http://www.transgaming.com > > *Let the Games Begin* > > > > On 31-Dec-03, at 11:18 AM, Rob Crittenden wrote: > > > > > <container.diff> > > > _______________________________________________ winex-devel mailing list [email protected] http://lists.transgaming.org/cgi-bin/mailman/listinfo/winex-devel
container.diff2
(text/plain, 5.8 KB)
Index: container.c
===================================================================
RCS file: /cvsroot/winex/dlls/dxdiagn/container.c,v
retrieving revision 1.4
diff -u -r1.4 container.c
--- container.c 22 Sep 2003 16:53:35 -0000 1.4
+++ container.c 3 Jan 2004 04:37:08 -0000
@@ -13,6 +13,7 @@
#include "wine/debug.h"
#include "winerror.h"
#include "oleauto.h"
+#include "wine/unicode.h"
#include "dxdiag.h"
#include "dxdiagn_private.h"
@@ -23,6 +24,9 @@
*/
DEFAULT_DEBUG_CHANNEL(dxdiagn);
+static HRESULT WINAPI DxDiagContainer_GetOneChild(PDXDIAGCONTAINER iface,
+ LPCWSTR pwszContainer,
+ IDxDiagContainer **ppInstance);
ICOM_VTABLE(IDxDiagContainer) dxDiagContainerVT;
@@ -60,11 +64,58 @@
return --This->ref; /* don't free us, static resource */
}
+/* Handle multi-level requests and return the container for the lowest level
+ * container. For example, return for the request
+ * "DxDiag_DirectSound.DxDiag_SoundDevices" return the container for
+ * DxDiag_SoundDevices.
+ */
HRESULT WINAPI DxDiagContainer_GetChildContainer(PDXDIAGCONTAINER iface,
LPCWSTR pwszContainer,
IDxDiagContainer **ppInstance)
{
ICOM_THIS(IDxDiagContainerImpl, iface);
+ IDxDiagContainer *tmpContainer;
+ LPWSTR tmpStr;
+ WCHAR *s;
+ INT len;
+ HRESULT hr;
+
+ TRACE("(%p)->(%s, %p)\n", iface, debugstr_w(pwszContainer), ppInstance);
+
+ len = strlenW(pwszContainer) + 1;
+
+ tmpContainer = (IDxDiagContainer *)This;
+ tmpStr = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
+ lstrcpynW(tmpStr, pwszContainer, len);
+
+ tmpContainer = (IDxDiagContainer *)This;
+
+ s = strchrW(tmpStr, '.');
+ while (s != NULL) {
+ *s = '\0';
+ hr = DxDiagContainer_GetOneChild(tmpContainer, tmpStr, &tmpContainer);
+ if (!SUCCEEDED(hr))
+ goto done;
+ *s++;
+ len = strlenW(s) + 1;
+ lstrcpynW(tmpStr, s, len);
+ s = strchrW(tmpStr, '.');
+ }
+
+ // Whatever is left over is the last child node and the one we want
+ hr = DxDiagContainer_GetOneChild(tmpContainer, tmpStr, ppInstance);
+
+done:
+ HeapFree(GetProcessHeap(), 0, tmpStr);
+
+ return hr;
+}
+
+HRESULT WINAPI DxDiagContainer_GetOneChild(PDXDIAGCONTAINER iface,
+ LPCWSTR pwszContainer,
+ IDxDiagContainer **ppInstance)
+{
+ ICOM_THIS(IDxDiagContainerImpl, iface);
Container_SubContainer *childContainer;
int i;
@@ -88,6 +139,45 @@
return S_OK;
}
+HRESULT WINAPI DxDiagContainer_GetNumberOfChildContainers(
+ PDXDIAGCONTAINER iface,
+ DWORD *pdwCount)
+{
+ ICOM_THIS(IDxDiagContainerImpl, iface);
+ Container_SubContainer *childContainer;
+ int i;
+
+ i = 0;
+ do
+ {
+ childContainer = &This->scContainers[i];
+ i++;
+ } while (childContainer->pwszContainerName);
+
+ *pdwCount = i - 1;
+
+ TRACE("(%p)->(%ld)\n", iface, *pdwCount);
+
+ return S_OK;
+}
+
+HRESULT WINAPI DxDiagContainer_EnumChildContainerNames(PDXDIAGCONTAINER iface,
+ DWORD dwIndex,
+ LPWSTR pwszContainer,
+ DWORD cchContainer)
+{
+ ICOM_THIS(IDxDiagContainerImpl, iface);
+ Container_SubContainer *childContainer;
+
+ childContainer = &This->scContainers[dwIndex];
+
+ lstrcpynW(pwszContainer, childContainer->pwszContainerName, cchContainer);
+
+ TRACE("(%p)->(%s)\n", iface, debugstr_w(childContainer->pwszContainerName));
+
+ return S_OK;
+}
+
/*
* There are 4 VARIANT property types.
* The property name contains a hungarian notation prefix.
@@ -147,17 +237,55 @@
return S_OK;
}
+HRESULT WINAPI DxDiagContainer_GetNumberOfProps(PDXDIAGCONTAINER iface,
+ DWORD *pdwCount)
+{
+ ICOM_THIS(IDxDiagContainerImpl, iface);
+ Container_Property *property;
+ int i;
+
+ i = 0;
+ do
+ {
+ property = &This->pProperties[i];
+ i++;
+ } while (property->pwszPropName);
+
+ *pdwCount = i - 1;
+
+ TRACE("(%p)->(%ld)\n", iface, *pdwCount);
+
+ return S_OK;
+}
+
+HRESULT WINAPI DxDiagContainer_EnumPropNames(PDXDIAGCONTAINER iface,
+ DWORD dwIndex,
+ LPWSTR pwszPropName,
+ DWORD cchPropName)
+{
+ ICOM_THIS(IDxDiagContainerImpl, iface);
+ Container_Property *property;
+
+ property = &This->pProperties[dwIndex];
+
+ lstrcpynW(pwszPropName, property->pwszPropName, cchPropName);
+
+ TRACE("(%p)->(%s)\n", iface, debugstr_w(property->pwszPropName));
+
+ return S_OK;
+}
+
ICOM_VTABLE(IDxDiagContainer) dxDiagContainerVT =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
DxDiagContainer_QueryInterface,
DxDiagContainer_AddRef,
DxDiagContainer_Release,
- (void*)0xdead0004, /* GetNumberOfChildContainers */
- (void*)0xdead0005, /* EnumChildContainerNames */
+ DxDiagContainer_GetNumberOfChildContainers,
+ DxDiagContainer_EnumChildContainerNames,
DxDiagContainer_GetChildContainer,
- (void*)0xdead0007, /* GetNumberOfProps */
- (void*)0xdead0008, /* EnumProps */
+ DxDiagContainer_GetNumberOfProps,
+ DxDiagContainer_EnumPropNames,
DxDiagContainer_GetProp
};