2 * Gameux library private header
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 extern HRESULT
GameExplorer_create(IUnknown
* pUnkOuter
, IUnknown
**ppObj
);
22 extern HRESULT
GameStatistics_create(IUnknown
* pUnkOuter
, IUnknown
**ppObj
);
24 /*******************************************************************************
25 * Helper functions and structures
27 * These are helper function and structures, which are used widely in gameux
28 * implementation. Details about usage and place of implementation is
29 * in description of each function/strucutre.
32 /*******************************************************************************
33 * struct GAMEUX_GAME_DATA
35 * Structure which contains data about single game. It is used to transfer
36 * data inside of gameux module in various places.
38 struct GAMEUX_GAME_DATA
40 LPWSTR sGDFBinaryPath
; /* path to binary containing GDF */
41 LPWSTR sGameInstallDirectory
; /* directory passed to AddGame/InstallGame methods */
42 GAME_INSTALL_SCOPE installScope
;/* game's installation scope */
43 GUID guidInstanceId
; /* game installation instance identifier */
44 GUID guidApplicationId
; /* game's application identifier */
45 BSTR bstrName
; /* game's title */
46 BSTR bstrDescription
; /* game's description */
48 /*******************************************************************************
51 * Initializes GAME_DATA structure fields with proper values. Should be
52 * called always before first usage of this structure. Implemented in gameexplorer.c
55 * GameData [I/O] pointer to structure to initialize
57 void GAMEUX_initGameData(struct GAMEUX_GAME_DATA
*GameData
);
58 /*******************************************************************************
59 * GAMEUX_uninitGameData
61 * Properly frees all data stored or pointed by fields of GAME_DATA structure.
62 * Should be called before freeing this structure. Implemented in gameexplorer.c
65 * GameData [I/O] pointer to structure to uninitialize
67 void GAMEUX_uninitGameData(struct GAMEUX_GAME_DATA
*GameData
);
68 /*******************************************************************************
71 * Helper function. Registers game associated with given GDF binary in
72 * Game Explorer. Implemented in gameexplorer.c
75 * sGDFBinaryPath [I] path to binary containing GDF file in
77 * sGameInstallDirectory [I] path to directory, where game installed
79 * installScope [I] scope of game installation
80 * pInstanceID [I/O] pointer to game instance identifier.
81 * If pointing to GUID_NULL, then new
82 * identifier will be generated automatically
83 * and returned via this parameter
85 HRESULT WINAPI
GAMEUX_RegisterGame(LPCWSTR sGDFBinaryPath
,
86 LPCWSTR sGameInstallDirectory
,
87 GAME_INSTALL_SCOPE installScope
,
89 /*******************************************************************************
90 * GAMEUX_FindGameInstanceId
92 * Helper function. Searches for instance identifier of given game in given
93 * installation scope. Implemented in gameexplorer.c
96 * sGDFBinaryPath [I] path to binary containing GDF
97 * installScope [I] game install scope to search in
98 * pInstanceId [O] instance identifier of given game
101 * S_OK id was returned properly
102 * S_FALSE id was not found in the registry
103 * E_OUTOFMEMORY problem while memory allocation
105 HRESULT
GAMEUX_FindGameInstanceId(
106 LPCWSTR sGDFBinaryPath
,
107 GAME_INSTALL_SCOPE installScope
,
109 /*******************************************************************************
110 * GAMEUX_buildGameRegistryPath
112 * Helper function, builds registry path to key, where game's data are stored.
113 * Implemented in gameexplorer.c
116 * installScope [I] the scope which was used in AddGame/InstallGame call
117 * gameInstanceId [I] game instance GUID. If NULL, then only
118 * path to scope will be returned
119 * lpRegistryPath [O] pointer which will receive address to string
120 * containing expected registry path. Path
121 * is relative to HKLM registry key. It
122 * must be freed by calling HeapFree(GetProcessHeap(), 0, ...)
124 * Name of game's registry key always follows patterns below:
125 * When game is installed for current user only (installScope is GIS_CURRENT_USER):
126 * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
127 * GameUX\[user's security ID]\[game instance ID]
129 * When game is installed for all users (installScope is GIS_ALL_USERS):
130 * HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\
131 * GameUX\Games\[game instance ID]
135 HRESULT
GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope
,
136 LPCGUID gameInstanceId
,
137 LPWSTR
* lpRegistryPath
);