Mariusz Pluciński : gameux: Add storing Title registry value.
Alexandre Julliard
julliard at winehq.org
Thu Sep 9 13:56:51 CDT 2010
Module: wine
Branch: master
Commit: 3c68877bc5c20e61ffa34b3d0e999be6a1ea9638
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3c68877bc5c20e61ffa34b3d0e999be6a1ea9638
Author: Mariusz Pluciński <vshader at gmail.com>
Date: Tue Sep 7 16:05:25 2010 +0200
gameux: Add storing Title registry value.
---
dlls/gameux/gameexplorer.c | 80 ++++++++++++++++++++++++++++++++++++++
dlls/gameux/gameux_private.h | 1 +
dlls/gameux/tests/gameexplorer.c | 2 +-
3 files changed, 82 insertions(+), 1 deletions(-)
diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c
index a4c37a7..f792333 100644
--- a/dlls/gameux/gameexplorer.c
+++ b/dlls/gameux/gameexplorer.c
@@ -51,6 +51,7 @@ void GAMEUX_initGameData(struct GAMEUX_GAME_DATA *GameData)
{
GameData->sGDFBinaryPath = NULL;
GameData->sGameInstallDirectory = NULL;
+ GameData->bstrName = NULL;
}
/*******************************************************************************
* GAMEUX_uninitGameData
@@ -61,6 +62,7 @@ void GAMEUX_uninitGameData(struct GAMEUX_GAME_DATA *GameData)
{
HeapFree(GetProcessHeap(), 0, GameData->sGDFBinaryPath);
HeapFree(GetProcessHeap(), 0, GameData->sGameInstallDirectory);
+ SysFreeString(GameData->bstrName);
}
/*******************************************************************************
* GAMEUX_buildGameRegistryPath
@@ -196,6 +198,7 @@ static HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
* ApplicationId guidApplicationId
* ConfigApplicationPath sGameInstallDirectory
* ConfigGDFBinaryPath sGDFBinaryPath
+ * Title bstrName
*
*/
static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
@@ -206,6 +209,8 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
{'C','o','n','f','i','g','A','p','p','l','i','c','a','t','i','o','n','P','a','t','h',0};
static const WCHAR sConfigGDFBinaryPath[] =
{'C','o','n','f','i','g','G','D','F','B','i','n','a','r','y','P','a','t','h',0};
+ static const WCHAR sTitle[] =
+ {'T','i','t','l','e',0};
HRESULT hr, hr2;
LPWSTR lpRegistryKey;
@@ -241,6 +246,11 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
REG_SZ, (LPBYTE)(sGameApplicationId),
(lstrlenW(sGameApplicationId)+1)*sizeof(WCHAR)));
+ if(SUCCEEDED(hr))
+ hr = HRESULT_FROM_WIN32(RegSetValueExW(hKey, sTitle, 0,
+ REG_SZ, (LPBYTE)(GameData->bstrName),
+ (lstrlenW(GameData->bstrName)+1)*sizeof(WCHAR)));
+
RegCloseKey(hKey);
if(FAILED(hr))
@@ -258,6 +268,43 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
return hr;
}
/*******************************************************************************
+ * GAMEUX_ProcessGameDefinitionElement
+ *
+ * Helper function, parses single element from Game Definition
+ *
+ * Parameters:
+ * lpXMLElement [I] game definition element
+ * GameData [O] structure, where parsed
+ * data will be stored
+ */
+static HRESULT GAMEUX_ProcessGameDefinitionElement(
+ IXMLDOMElement *element,
+ struct GAMEUX_GAME_DATA *GameData)
+{
+ static const WCHAR sName[] =
+ {'N','a','m','e',0};
+
+ HRESULT hr;
+ BSTR bstrElementName;
+
+ TRACE("(%p, %p)\n", element, GameData);
+
+ hr = IXMLDOMElement_get_nodeName(element, &bstrElementName);
+ if(SUCCEEDED(hr))
+ {
+ /* check element name */
+ if(lstrcmpW(bstrElementName, sName) == 0)
+ hr = IXMLDOMElement_get_text(element, &GameData->bstrName);
+
+ else
+ FIXME("entry %s in Game Definition File not yet supported\n", debugstr_w(bstrElementName));
+
+ SysFreeString(bstrElementName);
+ }
+
+ return hr;
+}
+/*******************************************************************************
* GAMEUX_ParseGameDefinition
*
* Helper function, loads data from given XML element into fields of GAME_DATA
@@ -277,6 +324,9 @@ static HRESULT GAMEUX_ParseGameDefinition(
HRESULT hr = S_OK;
BSTR bstrAttribute;
VARIANT variant;
+ IXMLDOMNodeList *childrenList;
+ IXMLDOMNode *nextNode;
+ IXMLDOMElement *nextElement;
TRACE("(%p, %p)\n", gdElement, GameData);
@@ -295,6 +345,36 @@ static HRESULT GAMEUX_ParseGameDefinition(
SysFreeString(bstrAttribute);
+ /* browse subnodes */
+ if(SUCCEEDED(hr))
+ hr = IXMLDOMElement_get_childNodes(gdElement, &childrenList);
+
+ if(SUCCEEDED(hr))
+ {
+ do
+ {
+ hr = IXMLDOMNodeList_nextNode(childrenList, &nextNode);
+
+ if(hr == S_OK)
+ {
+ hr = IXMLDOMNode_QueryInterface(nextNode, &IID_IXMLDOMElement,
+ (LPVOID*)&nextElement);
+
+ if(SUCCEEDED(hr))
+ {
+ hr = GAMEUX_ProcessGameDefinitionElement(nextElement, GameData);
+ IXMLDOMElement_Release(nextElement);
+ }
+
+ IXMLDOMElement_Release(nextNode);
+ }
+ }
+ while(hr == S_OK);
+ hr = S_OK;
+
+ IXMLDOMNodeList_Release(childrenList);
+ }
+
return hr;
}
/*******************************************************************************
diff --git a/dlls/gameux/gameux_private.h b/dlls/gameux/gameux_private.h
index 4beb500..5b6e80d 100644
--- a/dlls/gameux/gameux_private.h
+++ b/dlls/gameux/gameux_private.h
@@ -42,6 +42,7 @@ struct GAMEUX_GAME_DATA
GAME_INSTALL_SCOPE installScope;/* game's installation scope */
GUID guidInstanceId; /* game installation instance identifier */
GUID guidApplicationId; /* game's application identifier */
+ BSTR bstrName; /* game's title */
};
/*******************************************************************************
* GAMEUX_initGameData
diff --git a/dlls/gameux/tests/gameexplorer.c b/dlls/gameux/tests/gameexplorer.c
index 4367ab3..a538d35 100644
--- a/dlls/gameux/tests/gameexplorer.c
+++ b/dlls/gameux/tests/gameexplorer.c
@@ -301,7 +301,7 @@ static void _validateGameRegistryValues(int line,
hr = _validateRegistryValue(hKey, keyPath, sConfigGDFBinaryPath, RRF_RT_REG_SZ, gameExeName);
ok_(__FILE__, line)(hr==S_OK, "failed while checking registry value (error 0x%x)\n", hr);
hr = _validateRegistryValue(hKey, keyPath, sTitle, RRF_RT_REG_SZ, sExampleGame);
- todo_wine ok_(__FILE__, line)(hr==S_OK, "failed while checking registry value (error 0x%x)\n", hr);
+ ok_(__FILE__, line)(hr==S_OK, "failed while checking registry value (error 0x%x)\n", hr);
/* this value exists up from Win7 */
hr = _validateRegistryValue(hKey, keyPath, sDescription, RRF_RT_REG_SZ, sGameDescription);
More information about the wine-cvs
mailing list