gameux: Add partial implementation of IGameStatisticsMgr::GetGameStatistics.
This commit is contained in:
parent
7c798a4a7d
commit
23efe79289
|
@ -69,29 +69,9 @@ void GAMEUX_uninitGameData(struct GAMEUX_GAME_DATA *GameData)
|
|||
/*******************************************************************************
|
||||
* GAMEUX_buildGameRegistryPath
|
||||
*
|
||||
* Helper function, builds registry path to key, where game's data are stored
|
||||
*
|
||||
* Parameters:
|
||||
* installScope [I] the scope which was used in AddGame/InstallGame call
|
||||
* gameInstanceId [I] game instance GUID. If NULL, then only
|
||||
* path to scope will be returned
|
||||
* lpRegistryPath [O] pointer which will receive address to string
|
||||
* containing expected registry path. Path
|
||||
* is relative to HKLM registry key. It
|
||||
* must be freed by calling HeapFree(GetProcessHeap(), 0, ...)
|
||||
*
|
||||
* Name of game's registry key always follows patterns below:
|
||||
* When game is installed for current user only (installScope is GIS_CURRENT_USER):
|
||||
* HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
|
||||
* GameUX\[user's security ID]\[game instance ID]
|
||||
*
|
||||
* When game is installed for all users (installScope is GIS_ALL_USERS):
|
||||
* HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
|
||||
* GameUX\Games\[game instance ID]
|
||||
*
|
||||
*
|
||||
* Internal helper function. Description available in gameux_private.h file
|
||||
*/
|
||||
static HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
|
||||
HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
|
||||
LPCGUID gameInstanceId,
|
||||
LPWSTR* lpRegistryPath)
|
||||
{
|
||||
|
@ -697,20 +677,9 @@ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) {
|
|||
/*******************************************************************************
|
||||
* GAMEUX_FindGameInstanceId
|
||||
*
|
||||
* Helper funtion. Searches for instance identifier of given game in given
|
||||
* installation scope.
|
||||
*
|
||||
* Parameters:
|
||||
* sGDFBinaryPath [I] path to binary containing GDF
|
||||
* installScope [I] game install scope to search in
|
||||
* pInstanceId [O] instance identifier of given game
|
||||
*
|
||||
* Returns:
|
||||
* S_OK id was returned properly
|
||||
* S_FALSE id was not found in the registry
|
||||
* E_OUTOFMEMORY problem while memory allocation
|
||||
* Internal helper function. Description available in gameux_private.h file
|
||||
*/
|
||||
static HRESULT GAMEUX_FindGameInstanceId(
|
||||
HRESULT GAMEUX_FindGameInstanceId(
|
||||
LPCWSTR sGDFBinaryPath,
|
||||
GAME_INSTALL_SCOPE installScope,
|
||||
GUID* pInstanceId)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "winreg.h"
|
||||
|
||||
#include "gameux.h"
|
||||
#include "gameux_private.h"
|
||||
|
@ -107,8 +108,55 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
|
|||
GAMESTATS_OPEN_RESULT *pOpenResult,
|
||||
IGameStatistics **ppiStats)
|
||||
{
|
||||
FIXME("stub (%p, %s, 0x%x, %p, %p)\n", iface, debugstr_w(GDFBinaryPath), openType, pOpenResult, ppiStats);
|
||||
return E_NOTIMPL;
|
||||
static const WCHAR sApplicationId[] =
|
||||
{'A','p','p','l','i','c','a','t','i','o','n','I','d',0};
|
||||
|
||||
HRESULT hr;
|
||||
GUID instanceId;
|
||||
LPWSTR lpRegistryPath = NULL;
|
||||
WCHAR lpApplicationId[49];
|
||||
DWORD dwLength = sizeof(lpApplicationId);
|
||||
GAME_INSTALL_SCOPE installScope;
|
||||
|
||||
TRACE("(%p, %s, 0x%x, %p, %p)\n", iface, debugstr_w(GDFBinaryPath), openType, pOpenResult, ppiStats);
|
||||
|
||||
if(!GDFBinaryPath)
|
||||
return E_INVALIDARG;
|
||||
|
||||
installScope = GIS_CURRENT_USER;
|
||||
hr = GAMEUX_FindGameInstanceId(GDFBinaryPath, installScope, &instanceId);
|
||||
|
||||
if(hr == S_FALSE)
|
||||
{
|
||||
installScope = GIS_ALL_USERS;
|
||||
hr = GAMEUX_FindGameInstanceId(GDFBinaryPath, installScope, &instanceId);
|
||||
}
|
||||
|
||||
if(hr == S_FALSE)
|
||||
/* game not registered, so statistics cannot be used */
|
||||
hr = E_FAIL;
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
/* game is registered, let's read it's application id from registry */
|
||||
hr = GAMEUX_buildGameRegistryPath(installScope, &instanceId, &lpRegistryPath);
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
hr = HRESULT_FROM_WIN32(RegGetValueW(HKEY_LOCAL_MACHINE,
|
||||
lpRegistryPath, sApplicationId, RRF_RT_REG_SZ,
|
||||
NULL, lpApplicationId, &dwLength));
|
||||
}
|
||||
|
||||
if(SUCCEEDED(hr))
|
||||
{
|
||||
TRACE("found app id: %s\n", debugstr_w(lpApplicationId));
|
||||
FIXME("creating instance of IGameStatistics not yet implemented\n");
|
||||
hr = E_NOTIMPL;
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpRegistryPath);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_RemoveGameStatistics(
|
||||
|
|
|
@ -86,3 +86,52 @@ HRESULT WINAPI GAMEUX_RegisterGame(LPCWSTR sGDFBinaryPath,
|
|||
LPCWSTR sGameInstallDirectory,
|
||||
GAME_INSTALL_SCOPE installScope,
|
||||
GUID *pInstanceID);
|
||||
/*******************************************************************************
|
||||
* GAMEUX_FindGameInstanceId
|
||||
*
|
||||
* Helper funtion. Searches for instance identifier of given game in given
|
||||
* installation scope. Implemented in gameexplorer.c
|
||||
*
|
||||
* Parameters:
|
||||
* sGDFBinaryPath [I] path to binary containing GDF
|
||||
* installScope [I] game install scope to search in
|
||||
* pInstanceId [O] instance identifier of given game
|
||||
*
|
||||
* Returns:
|
||||
* S_OK id was returned properly
|
||||
* S_FALSE id was not found in the registry
|
||||
* E_OUTOFMEMORY problem while memory allocation
|
||||
*/
|
||||
HRESULT GAMEUX_FindGameInstanceId(
|
||||
LPCWSTR sGDFBinaryPath,
|
||||
GAME_INSTALL_SCOPE installScope,
|
||||
GUID* pInstanceId);
|
||||
/*******************************************************************************
|
||||
* GAMEUX_buildGameRegistryPath
|
||||
*
|
||||
* Helper function, builds registry path to key, where game's data are stored.
|
||||
* Implemented in gameexplorer.c
|
||||
*
|
||||
* Parameters:
|
||||
* installScope [I] the scope which was used in AddGame/InstallGame call
|
||||
* gameInstanceId [I] game instance GUID. If NULL, then only
|
||||
* path to scope will be returned
|
||||
* lpRegistryPath [O] pointer which will receive address to string
|
||||
* containing expected registry path. Path
|
||||
* is relative to HKLM registry key. It
|
||||
* must be freed by calling HeapFree(GetProcessHeap(), 0, ...)
|
||||
*
|
||||
* Name of game's registry key always follows patterns below:
|
||||
* When game is installed for current user only (installScope is GIS_CURRENT_USER):
|
||||
* HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
|
||||
* GameUX\[user's security ID]\[game instance ID]
|
||||
*
|
||||
* When game is installed for all users (installScope is GIS_ALL_USERS):
|
||||
* HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
|
||||
* GameUX\Games\[game instance ID]
|
||||
*
|
||||
*
|
||||
*/
|
||||
HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
|
||||
LPCGUID gameInstanceId,
|
||||
LPWSTR* lpRegistryPath);
|
||||
|
|
Loading…
Reference in New Issue