/******************************************************************************* * GAMEUX_UpdateGame * * Helper function, updates stored data about game with given InstanceID */ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) { 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 sConfigApplicationPath[] = {'C','o','n','f','i','g','A','p','p','l','i','c','a','t','i','o','n','P','a','t','h',0}; HRESULT hr; GAME_INSTALL_SCOPE installScope; LPWSTR lpRegistryPath; LPWSTR lpGDFBinaryPath; TRACE("(%s)\n", debugstr_guid(InstanceID)); /* first, check is game exists in CURRENT_USER scope */ installScope = GIS_CURRENT_USER; hr = GAMEUX_IsGameKeyExist(installScope, InstanceID, &lpRegistryPath); if(hr == S_FALSE) { /* game not found in CURRENT_USER scope, let's check in ALL_USERS */ installScope = GIS_ALL_USERS; hr = GAMEUX_IsGameKeyExist(installScope, InstanceID, &lpRegistryPath); } if(hr == S_FALSE) /* still not found? let's inform user that game does not exists */ hr = HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); if(SUCCEEDED(hr)) { WCHAR *lpGameInstallDirectory = NULL; /* game found, its registry path is in lpRegistryPath and install * scope in installScope */ TRACE("game found in registry (path %s), updating\n", debugstr_w(lpRegistryPath)); /* first, read required data about game */ hr = GAMEUX_LoadRegistryString(HKEY_LOCAL_MACHINE, lpRegistryPath, sConfigGDFBinaryPath, &lpGDFBinaryPath); if(SUCCEEDED(hr)) hr = GAMEUX_LoadRegistryString(HKEY_LOCAL_MACHINE, lpRegistryPath, sConfigApplicationPath, &lpGameInstallDirectory); /* now remove currently existing registry key */ if(SUCCEEDED(hr)) hr = GAMEUX_RemoveRegistryRecord(InstanceID); /* and add it again, it will cause in reparsing of whole GDF */ if(SUCCEEDED(hr)) hr = GAMEUX_RegisterGame(lpGDFBinaryPath, lpGameInstallDirectory, installScope, InstanceID); HeapFree(GetProcessHeap(), 0, lpGDFBinaryPath); HeapFree(GetProcessHeap(), 0, lpGameInstallDirectory); } HeapFree(GetProcessHeap(), 0, lpRegistryPath); TRACE("returning 0x%x\n", hr); return hr; }
static HRESULT WINAPI GameExplorerImpl_RemoveGame( IGameExplorer *iface, GUID instanceID) { GameExplorerImpl *This = impl_from_IGameExplorer(iface); TRACE("(%p, %s)\n", This, debugstr_guid(&instanceID)); return GAMEUX_RemoveRegistryRecord(&instanceID); }
static HRESULT WINAPI GameExplorer2Impl_UninstallGame( IGameExplorer2 *iface, LPCWSTR binaryGDFPath) { HRESULT hr; GUID instanceId; GameExplorerImpl *This = impl_from_IGameExplorer2(iface); TRACE("(%p, %s)\n", This, debugstr_w(binaryGDFPath)); if(!binaryGDFPath) return E_INVALIDARG; hr = GAMEUX_FindGameInstanceId(binaryGDFPath, GIS_CURRENT_USER, &instanceId); if(hr == S_FALSE) hr = GAMEUX_FindGameInstanceId(binaryGDFPath, GIS_ALL_USERS, &instanceId); if(hr == S_OK) hr = GAMEUX_RemoveRegistryRecord(&instanceId); return hr; }