Module: wine Branch: master Commit: bb9a6ea2b05e79319ae4ed563f9147c7a27bbc22 URL: http://source.winehq.org/git/wine.git/?a=commit;h=bb9a6ea2b05e79319ae4ed563f...
Author: Mariusz Pluciński vshader@gmail.com Date: Tue Sep 7 16:08:39 2010 +0200
gameux: IGameExplorer::RemoveGame implementation.
---
dlls/gameux/gameexplorer.c | 33 +++++++++++++++++++++++++++++++-- dlls/gameux/tests/gameexplorer.c | 8 ++++---- 2 files changed, 35 insertions(+), 6 deletions(-)
diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c index deb6475..aabadcd 100644 --- a/dlls/gameux/gameexplorer.c +++ b/dlls/gameux/gameexplorer.c @@ -480,6 +480,36 @@ static HRESULT GAMEUX_ParseGDFBinary(struct GAMEUX_GAME_DATA *GameData)
return hr; } +/******************************************************************* + * GAMEUX_RemoveRegistryRecord + * + * Helper function, removes registry key associated with given game instance + */ +static HRESULT GAMEUX_RemoveRegistryRecord(GUID* pInstanceID) +{ + HRESULT hr; + LPWSTR lpRegistryPath = NULL; + TRACE("(%s)\n", debugstr_guid(pInstanceID)); + + /* first, check is game installed for all users */ + hr = GAMEUX_buildGameRegistryPath(GIS_ALL_USERS, pInstanceID, &lpRegistryPath); + if(SUCCEEDED(hr)) + hr = HRESULT_FROM_WIN32(RegDeleteKeyExW(HKEY_LOCAL_MACHINE, lpRegistryPath, 0, 0)); + + HeapFree(GetProcessHeap(), 0, lpRegistryPath); + + /* if not, check current user */ + if(FAILED(hr)) + { + hr = GAMEUX_buildGameRegistryPath(GIS_CURRENT_USER, pInstanceID, &lpRegistryPath); + if(SUCCEEDED(hr)) + hr = HRESULT_FROM_WIN32(RegDeleteKeyExW(HKEY_LOCAL_MACHINE, lpRegistryPath, 0, 0)); + + HeapFree(GetProcessHeap(), 0, lpRegistryPath); + } + + return hr; +} /******************************************************************************* * GAMEUX_RegisterGame * @@ -628,8 +658,7 @@ static HRESULT WINAPI GameExplorerImpl_RemoveGame( GameExplorerImpl *This = impl_from_IGameExplorer(iface);
TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID)); - FIXME("stub\n"); - return E_NOTIMPL; + return GAMEUX_RemoveRegistryRecord(&instanceID); }
static HRESULT WINAPI GameExplorerImpl_UpdateGame( diff --git a/dlls/gameux/tests/gameexplorer.c b/dlls/gameux/tests/gameexplorer.c index d01783d..3e86239 100644 --- a/dlls/gameux/tests/gameexplorer.c +++ b/dlls/gameux/tests/gameexplorer.c @@ -446,10 +446,10 @@ static void test_add_remove_game(void) _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, TRUE);
hr = IGameExplorer_RemoveGame(ge, guid); - todo_wine ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); + ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); }
- todo_wine _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, FALSE); + _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, FALSE);
/* try to register game with empty guid */ @@ -464,10 +464,10 @@ static void test_add_remove_game(void) _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, TRUE);
hr = IGameExplorer_RemoveGame(ge, guid); - todo_wine ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); + ok(SUCCEEDED(hr), "IGameExplorer::RemoveGame failed (error 0x%08x)\n", hr); }
- todo_wine _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, FALSE); + _validateGameRegistryKey(__LINE__, GIS_CURRENT_USER, &guid, &applicationId, sExePath, sExeName, FALSE); }
/* free allocated resources */