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

gameux: IGameExplorer::RemoveGame implementation.

parent 9b7347b6
......@@ -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(
......
......@@ -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 */
......
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