Commit 3c68877b authored by Mariusz Pluciński's avatar Mariusz Pluciński Committed by Alexandre Julliard

gameux: Add storing Title registry value.

parent 180ac750
...@@ -51,6 +51,7 @@ void GAMEUX_initGameData(struct GAMEUX_GAME_DATA *GameData) ...@@ -51,6 +51,7 @@ void GAMEUX_initGameData(struct GAMEUX_GAME_DATA *GameData)
{ {
GameData->sGDFBinaryPath = NULL; GameData->sGDFBinaryPath = NULL;
GameData->sGameInstallDirectory = NULL; GameData->sGameInstallDirectory = NULL;
GameData->bstrName = NULL;
} }
/******************************************************************************* /*******************************************************************************
* GAMEUX_uninitGameData * GAMEUX_uninitGameData
...@@ -61,6 +62,7 @@ void GAMEUX_uninitGameData(struct GAMEUX_GAME_DATA *GameData) ...@@ -61,6 +62,7 @@ void GAMEUX_uninitGameData(struct GAMEUX_GAME_DATA *GameData)
{ {
HeapFree(GetProcessHeap(), 0, GameData->sGDFBinaryPath); HeapFree(GetProcessHeap(), 0, GameData->sGDFBinaryPath);
HeapFree(GetProcessHeap(), 0, GameData->sGameInstallDirectory); HeapFree(GetProcessHeap(), 0, GameData->sGameInstallDirectory);
SysFreeString(GameData->bstrName);
} }
/******************************************************************************* /*******************************************************************************
* GAMEUX_buildGameRegistryPath * GAMEUX_buildGameRegistryPath
...@@ -196,6 +198,7 @@ static HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope, ...@@ -196,6 +198,7 @@ static HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
* ApplicationId guidApplicationId * ApplicationId guidApplicationId
* ConfigApplicationPath sGameInstallDirectory * ConfigApplicationPath sGameInstallDirectory
* ConfigGDFBinaryPath sGDFBinaryPath * ConfigGDFBinaryPath sGDFBinaryPath
* Title bstrName
* *
*/ */
static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData) static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
...@@ -206,6 +209,8 @@ 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}; {'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[] = static const WCHAR sConfigGDFBinaryPath[] =
{'C','o','n','f','i','g','G','D','F','B','i','n','a','r','y','P','a','t','h',0}; {'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; HRESULT hr, hr2;
LPWSTR lpRegistryKey; LPWSTR lpRegistryKey;
...@@ -241,6 +246,11 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData) ...@@ -241,6 +246,11 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
REG_SZ, (LPBYTE)(sGameApplicationId), REG_SZ, (LPBYTE)(sGameApplicationId),
(lstrlenW(sGameApplicationId)+1)*sizeof(WCHAR))); (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); RegCloseKey(hKey);
if(FAILED(hr)) if(FAILED(hr))
...@@ -258,6 +268,43 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData) ...@@ -258,6 +268,43 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
return hr; 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 * GAMEUX_ParseGameDefinition
* *
* Helper function, loads data from given XML element into fields of GAME_DATA * Helper function, loads data from given XML element into fields of GAME_DATA
...@@ -277,6 +324,9 @@ static HRESULT GAMEUX_ParseGameDefinition( ...@@ -277,6 +324,9 @@ static HRESULT GAMEUX_ParseGameDefinition(
HRESULT hr = S_OK; HRESULT hr = S_OK;
BSTR bstrAttribute; BSTR bstrAttribute;
VARIANT variant; VARIANT variant;
IXMLDOMNodeList *childrenList;
IXMLDOMNode *nextNode;
IXMLDOMElement *nextElement;
TRACE("(%p, %p)\n", gdElement, GameData); TRACE("(%p, %p)\n", gdElement, GameData);
...@@ -295,6 +345,36 @@ static HRESULT GAMEUX_ParseGameDefinition( ...@@ -295,6 +345,36 @@ static HRESULT GAMEUX_ParseGameDefinition(
SysFreeString(bstrAttribute); 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; return hr;
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -42,6 +42,7 @@ struct GAMEUX_GAME_DATA ...@@ -42,6 +42,7 @@ struct GAMEUX_GAME_DATA
GAME_INSTALL_SCOPE installScope;/* game's installation scope */ GAME_INSTALL_SCOPE installScope;/* game's installation scope */
GUID guidInstanceId; /* game installation instance identifier */ GUID guidInstanceId; /* game installation instance identifier */
GUID guidApplicationId; /* game's application identifier */ GUID guidApplicationId; /* game's application identifier */
BSTR bstrName; /* game's title */
}; };
/******************************************************************************* /*******************************************************************************
* GAMEUX_initGameData * GAMEUX_initGameData
......
...@@ -301,7 +301,7 @@ static void _validateGameRegistryValues(int line, ...@@ -301,7 +301,7 @@ static void _validateGameRegistryValues(int line,
hr = _validateRegistryValue(hKey, keyPath, sConfigGDFBinaryPath, RRF_RT_REG_SZ, gameExeName); 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); 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); 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 */ /* this value exists up from Win7 */
hr = _validateRegistryValue(hKey, keyPath, sDescription, RRF_RT_REG_SZ, sGameDescription); hr = _validateRegistryValue(hKey, keyPath, sDescription, RRF_RT_REG_SZ, sGameDescription);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment