gameux: IGameStatistics::GetMaxNameLength implementation.
[wine.git] / dlls / gameux / tests / gamestatistics.c
blob3904beaced50caa06545e92eed81ba32baeb6c33
1 /*
2 * IGameStatisticsMgr tests
4 * Copyright (C) 2010 Mariusz PluciƄski
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define COBJMACROS
23 #include "shlwapi.h"
24 #include "oleauto.h"
25 #include "shlobj.h"
27 #include "gameux.h"
28 #include "wine/test.h"
30 /*******************************************************************************
31 * utilities
33 static IGameExplorer *ge = NULL;
34 static WCHAR sExeName[MAX_PATH] = {0};
35 static GUID gameInstanceId;
36 static HRESULT WINAPI (*pSHGetFolderPathW)(HWND,int,HANDLE,DWORD,LPWSTR);
37 /*******************************************************************************
38 *_loadDynamicRoutines
40 * Helper function, prepares pointers to system procedures which may be not
41 * available on older operating systems.
43 * Returns:
44 * TRUE procedures were loaded successfully
45 * FALSE procedures were not loaded successfully
47 static BOOL _loadDynamicRoutines(void)
49 HMODULE hModule = LoadLibraryA( "shell32.dll" );
51 pSHGetFolderPathW = (LPVOID)GetProcAddress(hModule, "SHGetFolderPathW");
52 if (!pSHGetFolderPathW) return FALSE;
53 return TRUE;
55 /*******************************************************************************
56 * _registerGame
57 * Registers test suite executable as game in Games Explorer. Required to test
58 * game statistics.
60 static HRESULT _registerGame(void) {
61 HRESULT hr;
62 WCHAR sExePath[MAX_PATH];
63 BSTR bstrExeName, bstrExePath;
64 DWORD dwExeNameLen;
66 /* prepare path to binary */
67 dwExeNameLen = GetModuleFileNameW(NULL, sExeName, sizeof (sExeName) / sizeof (sExeName[0]));
68 hr = (dwExeNameLen!= 0 ? S_OK : E_FAIL);
69 lstrcpynW(sExePath, sExeName, StrRChrW(sExeName, NULL, '\\') - sExeName + 1);
71 bstrExeName = SysAllocString(sExeName);
72 if(!bstrExeName) hr = E_OUTOFMEMORY;
74 bstrExePath = SysAllocString(sExePath);
75 if(!bstrExePath) hr = E_OUTOFMEMORY;
77 if(SUCCEEDED(hr))
79 gameInstanceId = GUID_NULL;
80 hr = CoCreateInstance(&CLSID_GameExplorer, NULL, CLSCTX_INPROC_SERVER,
81 &IID_IGameExplorer, (LPVOID*)&ge);
84 if(SUCCEEDED(hr))
85 hr = IGameExplorer_AddGame(ge, bstrExeName, bstrExePath,
86 GIS_CURRENT_USER, &gameInstanceId);
88 if(FAILED(hr) && ge)
90 IGameExplorer_Release(ge);
91 ge = NULL;
94 SysFreeString(bstrExeName);
95 SysFreeString(bstrExePath);
96 return hr;
98 /*******************************************************************************
99 * _unregisterGame
100 * Unregisters test suite from Games Explorer.
102 static HRESULT _unregisterGame(void) {
103 HRESULT hr;
105 if(!ge) return E_FAIL;
107 hr = IGameExplorer_RemoveGame(ge, gameInstanceId);
109 IGameExplorer_Release(ge);
110 ge = NULL;
112 return hr;
114 /*******************************************************************************
115 * _buildStatisticsFilePath
116 * Creates path to file contaning statistics of game with given id.
118 * Parameters:
119 * guidApplicationId [I] application id of game
120 * lpStatisticsFile [O] pointer where address of
121 * string with path will be
122 * stored. Path must be deallocated
123 * using CoTaskMemFree(...)
125 static HRESULT _buildStatisticsFilePath(LPCGUID guidApplicationId, LPWSTR *lpStatisticsFile)
127 static const WCHAR sBackslash[] = {'\\',0};
128 static const WCHAR sStatisticsDir[] = {'\\','M','i','c','r','o','s','o','f','t',
129 '\\','W','i','n','d','o','w','s','\\','G','a','m','e','E','x','p',
130 'l','o','r','e','r','\\','G','a','m','e','S','t','a','t','i','s',
131 't','i','c','s',0};
132 static const WCHAR sDotGamestats[] = {'.','g','a','m','e','s','t','a','t','s',0};
133 static const DWORD dwGuidLength = 49;
135 HRESULT hr;
136 WCHAR sGuid[dwGuidLength], sPath[MAX_PATH] = {0};
138 hr = pSHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, sPath);
140 if(SUCCEEDED(hr))
141 hr = (StringFromGUID2(guidApplicationId, sGuid, dwGuidLength)!=0 ? S_OK : E_FAIL);
143 if(SUCCEEDED(hr))
145 lstrcatW(sPath, sStatisticsDir);
146 lstrcatW(sPath, sGuid);
147 lstrcatW(sPath, sBackslash);
148 lstrcatW(sPath, sGuid);
149 lstrcatW(sPath, sDotGamestats);
151 *lpStatisticsFile = CoTaskMemAlloc((lstrlenW(sPath)+1)*sizeof(WCHAR));
152 if(!*lpStatisticsFile) hr = E_OUTOFMEMORY;
155 if(SUCCEEDED(hr))
156 lstrcpyW(*lpStatisticsFile, sPath);
158 return hr;
160 /*******************************************************************************
161 * _isFileExist
162 * Checks if given file exists
164 * Parameters:
165 * lpFile [I] path to file
167 * Result:
168 * TRUE file exists
169 * FALSE file does not exist
171 BOOL _isFileExists(LPCWSTR lpFile)
173 HANDLE hFile = CreateFileW(lpFile, GENERIC_READ, 0, NULL,
174 OPEN_EXISTING, 0, NULL);
175 if(hFile == INVALID_HANDLE_VALUE) return FALSE;
176 CloseHandle(hFile);
177 return TRUE;
179 /*******************************************************************************
180 * test routines
182 static void test_create(BOOL* gameStatisticsAvailable)
184 HRESULT hr;
186 IGameStatisticsMgr* gsm = NULL;
187 *gameStatisticsAvailable = FALSE;
189 /* interface available up from Win7 */
190 hr = CoCreateInstance( &CLSID_GameStatistics, NULL, CLSCTX_INPROC_SERVER, &IID_IGameStatisticsMgr, (LPVOID*)&gsm);
191 if(gsm)
193 ok( hr == S_OK, "IGameStatisticsMgr creating failed (result: 0x%08x)\n", hr);
194 *gameStatisticsAvailable = TRUE;
195 IGameStatisticsMgr_Release(gsm);
197 else
198 win_skip("IGameStatisticsMgr cannot be created\n");
200 static void test_gamestatisticsmgr( void )
202 static const GUID guidApplicationId = { 0x17A6558E, 0x60BE, 0x4078, { 0xB6, 0x6F, 0x9C, 0x3A, 0xDA, 0x2A, 0x32, 0xE6 } };
203 static const WCHAR sCategory0[] = {'C','a','t','e','g','o','r','y','0',0};
204 static const WCHAR sCategory1[] = {'C','a','t','e','g','o','r','y','1',0};
205 static const WCHAR sCategory2[] = {'C','a','t','e','g','o','r','y','2',0};
206 static const WCHAR sCategory0a[] = {'C','a','t','e','g','o','r','y','0','a',0};
207 static const WCHAR sStatistic00[] = {'S','t','a','t','i','s','t','i','c','0','0',0};
208 static const WCHAR sStatistic01[] = {'S','t','a','t','i','s','t','i','c','0','1',0};
209 static const WCHAR sStatistic10[] = {'S','t','a','t','i','s','t','i','c','1','0',0};
210 static const WCHAR sStatistic11[] = {'S','t','a','t','i','s','t','i','c','1','1',0};
211 static const WCHAR sStatistic20[] = {'S','t','a','t','i','s','t','i','c','2','0',0};
212 static const WCHAR sStatistic21[] = {'S','t','a','t','i','s','t','i','c','2','1',0};
213 static const WCHAR sValue00[] = {'V','a','l','u','e','0','0',0};
214 static const WCHAR sValue01[] = {'V','a','l','u','e','0','1',0};
215 static const WCHAR sValue10[] = {'V','a','l','u','e','1','0',0};
216 static const WCHAR sValue11[] = {'V','a','l','u','e','1','1',0};
217 static const WCHAR sValue20[] = {'V','a','l','u','e','2','0',0};
218 static const WCHAR sValue21[] = {'V','a','l','u','e','2','1',0};
220 HRESULT hr;
221 DWORD dwOpenResult;
222 LPWSTR lpStatisticsFile = NULL;
223 LPWSTR lpName = NULL, lpValue = NULL, sTooLongString = NULL;
224 UINT uMaxCategoryLength = 0, uMaxNameLength = 0, uMaxValueLength = 0;
225 WORD wMaxStatsPerCategory = 0, wMaxCategories = 0;
227 IGameStatisticsMgr* gsm = NULL;
228 IGameStatistics* gs = NULL;
230 hr = CoCreateInstance( &CLSID_GameStatistics, NULL, CLSCTX_INPROC_SERVER, &IID_IGameStatisticsMgr, (LPVOID*)&gsm);
231 ok(hr == S_OK, "IGameStatisticsMgr creating failed (result false)\n");
233 /* test trying to create interface IGameStatistics using GetGameStatistics method */
235 /* this should fail, cause statistics doesn't yet exists */
236 hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENONLY, &dwOpenResult, &gs);
237 todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "GetGameStatistics returned unexpected value: 0x%08x\n", hr);
239 /* now, allow to create */
240 hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &dwOpenResult, &gs);
241 todo_wine ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%x\n", hr);
242 ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n");
243 if(gs)
245 /* test of limit values returned from interface */
246 hr = IGameStatistics_GetMaxCategoryLength(gs, &uMaxCategoryLength);
247 ok(hr==S_OK, "getting maximum length of category failed\n");
248 ok(uMaxCategoryLength==60, "getting maximum length of category returned invalid value: %d\n", uMaxCategoryLength);
250 hr = IGameStatistics_GetMaxNameLength(gs, &uMaxNameLength);
251 ok(hr==S_OK, "getting maximum name length failed\n");
252 ok(uMaxNameLength==30, "getting maximum name length returned invalid value: %d\n", uMaxNameLength);
254 hr = IGameStatistics_GetMaxValueLength(gs, &uMaxValueLength);
255 todo_wine ok(hr==S_OK, "getting maximum value length failed\n");
256 todo_wine ok(uMaxValueLength==30, "getting maximum value length returned invalid value: %d\n", uMaxValueLength);
258 hr = IGameStatistics_GetMaxCategories(gs, &wMaxCategories);
259 todo_wine ok(hr==S_OK, "getting maximum number of categories failed\n");
260 todo_wine ok(wMaxCategories==10, "getting maximum number of categories returned invalid value: %d\n", wMaxCategories);
262 hr = IGameStatistics_GetMaxStatsPerCategory(gs, &wMaxStatsPerCategory);
263 todo_wine ok(hr==S_OK, "getting maximum number of statistics per category failed\n");
264 todo_wine ok(wMaxStatsPerCategory==10, "getting maximum number of statistics per category returned invalid value: %d\n", wMaxStatsPerCategory);
266 /* create name of statistics file */
267 hr = _buildStatisticsFilePath(&guidApplicationId, &lpStatisticsFile);
268 ok(SUCCEEDED(hr), "cannot build path to game statistics (error 0x%x)\n", hr);
269 trace("statistics file path: %s\n", wine_dbgstr_w(lpStatisticsFile));
270 ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s already exists\n", wine_dbgstr_w(lpStatisticsFile));
272 /* write sample statistics */
273 hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, NULL);
274 todo_wine ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%x\n", hr);
276 hr = IGameStatistics_SetCategoryTitle(gs, wMaxCategories, sCategory0);
277 todo_wine ok(hr==E_INVALIDARG, "setting category title invalid value: 0x%x\n", hr);
279 /* check what happen if string is too long */
280 sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxCategoryLength+2));
281 memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxCategoryLength+1));
282 sTooLongString[uMaxCategoryLength+1]=0;
284 /* when string is too long, Windows returns S_FALSE, but saves string (stripped to expected number of characters) */
285 hr = IGameStatistics_SetCategoryTitle(gs, 0, sTooLongString);
286 todo_wine ok(hr==S_FALSE, "setting category title invalid result: 0x%x\n", hr);
287 CoTaskMemFree(sTooLongString);
289 todo_wine ok(IGameStatistics_SetCategoryTitle(gs, 0, sCategory0)==S_OK, "setting category title failed: %s\n", wine_dbgstr_w(sCategory0));
290 todo_wine ok(IGameStatistics_SetCategoryTitle(gs, 1, sCategory1)==S_OK, "setting category title failed: %s\n", wine_dbgstr_w(sCategory1));
291 todo_wine ok(IGameStatistics_SetCategoryTitle(gs, 2, sCategory2)==S_OK, "setting category title failed: %s\n", wine_dbgstr_w(sCategory1));
293 /* check what happen if any string is NULL */
294 hr = IGameStatistics_SetStatistic(gs, 0, 0, NULL, sValue00);
295 todo_wine ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr);
297 hr = IGameStatistics_SetStatistic(gs, 0, 0, sStatistic00, NULL);
298 todo_wine ok(hr == S_OK, "setting statistic returned unexpected value: 0x%x)\n", hr);
300 /* check what happen if any string is too long */
301 sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxNameLength+2));
302 memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxNameLength+1));
303 sTooLongString[uMaxNameLength+1]=0;
304 hr = IGameStatistics_SetStatistic(gs, 0, 0, sTooLongString, sValue00);
305 todo_wine ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr);
306 CoTaskMemFree(sTooLongString);
308 sTooLongString = CoTaskMemAlloc(sizeof(WCHAR)*(uMaxValueLength+2));
309 memset(sTooLongString, 'a', sizeof(WCHAR)*(uMaxValueLength+1));
310 sTooLongString[uMaxValueLength+1]=0;
311 hr = IGameStatistics_SetStatistic(gs, 0, 0, sStatistic00, sTooLongString);
312 todo_wine ok(hr == S_FALSE, "setting statistic returned unexpected value: 0x%x)\n", hr);
313 CoTaskMemFree(sTooLongString);
315 /* check what happen on too big index of category or statistic */
316 hr = IGameStatistics_SetStatistic(gs, wMaxCategories, 0, sStatistic00, sValue00);
317 todo_wine ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%x)\n", hr);
319 hr = IGameStatistics_SetStatistic(gs, 0, wMaxStatsPerCategory, sStatistic00, sValue00);
320 todo_wine ok(hr == E_INVALIDARG, "setting statistic returned unexpected value: 0x%x)\n", hr);
322 todo_wine ok(IGameStatistics_SetStatistic(gs, 0, 0, sStatistic00, sValue00)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic00), wine_dbgstr_w(sValue00));
323 todo_wine ok(IGameStatistics_SetStatistic(gs, 0, 1, sStatistic01, sValue01)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic01), wine_dbgstr_w(sValue01));
324 todo_wine ok(IGameStatistics_SetStatistic(gs, 1, 0, sStatistic10, sValue10)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic10), wine_dbgstr_w(sValue10));
325 todo_wine ok(IGameStatistics_SetStatistic(gs, 1, 1, sStatistic11, sValue11)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic11), wine_dbgstr_w(sValue11));
326 todo_wine ok(IGameStatistics_SetStatistic(gs, 2, 0, sStatistic20, sValue20)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic20), wine_dbgstr_w(sValue20));
327 todo_wine ok(IGameStatistics_SetStatistic(gs, 2, 1, sStatistic21, sValue21)==S_OK, "setting statistic failed: name=%s, value=%s\n", wine_dbgstr_w(sStatistic21), wine_dbgstr_w(sValue21));
329 ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s already exists\n", wine_dbgstr_w(lpStatisticsFile));
331 todo_wine ok(IGameStatistics_Save(gs, FALSE)==S_OK, "statistic saving failed\n");
333 todo_wine ok(_isFileExists(lpStatisticsFile) == TRUE, "statistics file %s does not exists\n", wine_dbgstr_w(lpStatisticsFile));
335 /* this value should not be stored in storage, we need it only to test is it not saved */
336 todo_wine ok(IGameStatistics_SetCategoryTitle(gs, 0, sCategory0a)==S_OK, "setting category title failed: %s\n", wine_dbgstr_w(sCategory0a));
338 hr = IGameStatistics_Release(gs);
339 ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%08x\n", hr);
341 /* try to read written statisticd */
342 hr = IGameStatisticsMgr_GetGameStatistics(gsm, sExeName, GAMESTATS_OPEN_OPENORCREATE, &dwOpenResult, &gs);
343 todo_wine ok(SUCCEEDED(hr), "GetGameStatistics returned error: 0x%08x\n", hr);
344 todo_wine ok(dwOpenResult == GAMESTATS_OPEN_OPENED, "GetGameStatistics returned invalid open result: 0x%x\n", dwOpenResult);
345 ok(gs!=NULL, "GetGameStatistics did not return valid interface pointer\n");
347 /* verify values with these which we stored before*/
348 hr = IGameStatistics_GetCategoryTitle(gs, 0, &lpName);
349 todo_wine ok(hr == S_OK, "getting category title failed\n");
350 todo_wine ok(lstrcmpW(lpName, sCategory0)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
351 CoTaskMemFree(lpName);
353 hr = IGameStatistics_GetCategoryTitle(gs, 1, &lpName);
354 todo_wine ok(hr == S_OK, "getting category title failed\n");
355 todo_wine ok(lstrcmpW(lpName, sCategory1)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
356 CoTaskMemFree(lpName);
358 hr = IGameStatistics_GetCategoryTitle(gs, 2, &lpName);
359 todo_wine ok(hr == S_OK, "getting category title failed\n");
360 todo_wine ok(lstrcmpW(lpName, sCategory2)==0, "getting category title returned invalid string (%s)\n", wine_dbgstr_w(lpName));
361 CoTaskMemFree(lpName);
363 /* check result if category doesn't exists */
364 hr = IGameStatistics_GetCategoryTitle(gs, 3, &lpName);
365 todo_wine ok(hr == S_OK, "getting category title failed\n");
366 ok(lpName == NULL, "getting category title failed\n");
367 CoTaskMemFree(lpName);
369 hr = IGameStatistics_GetStatistic(gs, 0, 0, &lpName, &lpValue);
370 todo_wine ok(hr == S_OK, "getting statistic failed\n");
371 todo_wine ok(lstrcmpW(lpName, sStatistic00)==0, "getting statistic returned invalid name\n");
372 todo_wine ok(lstrcmpW(lpValue, sValue00)==0, "getting statistic returned invalid value\n");
373 CoTaskMemFree(lpName);
374 CoTaskMemFree(lpValue);
376 hr = IGameStatistics_GetStatistic(gs, 0, 1, &lpName, &lpValue);
377 todo_wine ok(hr == S_OK, "getting statistic failed\n");
378 todo_wine ok(lstrcmpW(lpName, sStatistic01)==0, "getting statistic returned invalid name\n");
379 todo_wine ok(lstrcmpW(lpValue, sValue01)==0, "getting statistic returned invalid value\n");
380 CoTaskMemFree(lpName);
381 CoTaskMemFree(lpValue);
383 hr = IGameStatistics_GetStatistic(gs, 1, 0, &lpName, &lpValue);
384 todo_wine ok(hr == S_OK, "getting statistic failed\n");
385 todo_wine ok(lstrcmpW(lpName, sStatistic10)==0, "getting statistic returned invalid name\n");
386 todo_wine ok(lstrcmpW(lpValue, sValue10)==0, "getting statistic returned invalid value\n");
387 CoTaskMemFree(lpName);
388 CoTaskMemFree(lpValue);
390 hr = IGameStatistics_GetStatistic(gs, 1, 1, &lpName, &lpValue);
391 todo_wine ok(hr == S_OK, "getting statistic failed\n");
392 todo_wine ok(lstrcmpW(lpName, sStatistic11)==0, "getting statistic returned invalid name\n");
393 todo_wine ok(lstrcmpW(lpValue, sValue11)==0, "getting statistic returned invalid value\n");
394 CoTaskMemFree(lpName);
395 CoTaskMemFree(lpValue);
397 hr = IGameStatistics_GetStatistic(gs, 2, 0, &lpName, &lpValue);
398 todo_wine ok(hr == S_OK, "getting statistic failed\n");
399 todo_wine ok(lstrcmpW(lpName, sStatistic20)==0, "getting statistic returned invalid name\n");
400 todo_wine ok(lstrcmpW(lpValue, sValue20)==0, "getting statistic returned invalid value\n");
401 CoTaskMemFree(lpName);
402 CoTaskMemFree(lpValue);
404 hr = IGameStatistics_GetStatistic(gs, 2, 1, &lpName, &lpValue);
405 todo_wine ok(hr == S_OK, "getting statistic failed\n");
406 todo_wine ok(lstrcmpW(lpName, sStatistic21)==0, "getting statistic returned invalid name\n");
407 todo_wine ok(lstrcmpW(lpValue, sValue21)==0, "getting statistic returned invalid value\n");
408 CoTaskMemFree(lpName);
409 CoTaskMemFree(lpValue);
411 hr = IGameStatistics_Release(gs);
412 ok(SUCCEEDED(hr), "releasing IGameStatistics returned error: 0x%x\n", hr);
414 /* test of removing game statistics from underlying storage */
415 todo_wine ok(_isFileExists(lpStatisticsFile) == TRUE, "statistics file %s does not exists\n", wine_dbgstr_w(lpStatisticsFile));
416 hr = IGameStatisticsMgr_RemoveGameStatistics(gsm, sExeName);
417 todo_wine ok(SUCCEEDED(hr), "cannot remove game statistics, error: 0x%x\n", hr);
418 ok(_isFileExists(lpStatisticsFile) == FALSE, "statistics file %s still exists\n", wine_dbgstr_w(lpStatisticsFile));
421 hr = IGameStatisticsMgr_Release(gsm);
422 ok(SUCCEEDED(hr), "releasing IGameStatisticsMgr returned error: 0x%x\n", hr);
424 CoTaskMemFree(lpStatisticsFile);
427 START_TEST(gamestatistics)
429 HRESULT hr;
430 BOOL gameStatisticsAvailable;
432 if(_loadDynamicRoutines())
434 hr = CoInitialize( NULL );
435 ok( hr == S_OK, "failed to init COM\n");
437 test_create(&gameStatisticsAvailable);
439 if(gameStatisticsAvailable)
441 hr = _registerGame();
442 ok( hr == S_OK, "cannot register game in Game Explorer (error: 0x%x)\n", hr);
444 test_gamestatisticsmgr();
446 hr = _unregisterGame();
447 ok( hr == S_OK, "cannot unregister game from Game Explorer (error: 0x%x)\n", hr);
450 CoUninitialize();
452 else
453 /* this is not a failure, because a procedure loaded by address
454 * is always available on systems which has gameux.dll */
455 win_skip("too old system, cannot load required dynamic procedures\n");