Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
84aa9b91
Commit
84aa9b91
authored
Mar 16, 2021
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Mar 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux: Use wide-char string literals.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
23d899c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
92 deletions
+32
-92
gameexplorer.c
dlls/gameux/gameexplorer.c
+16
-51
gamestatistics.c
dlls/gameux/gamestatistics.c
+16
-41
No files found.
dlls/gameux/gameexplorer.c
View file @
84aa9b91
...
@@ -80,12 +80,6 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -80,12 +80,6 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
LPCGUID
gameInstanceId
,
LPCGUID
gameInstanceId
,
LPWSTR
*
lpRegistryPath
)
LPWSTR
*
lpRegistryPath
)
{
{
static
const
WCHAR
sGameUxRegistryPath
[]
=
{
'S'
,
'O'
,
'F'
,
'T'
,
'W'
,
'A'
,
'R'
,
'E'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'G'
,
'a'
,
'm'
,
'e'
,
'U'
,
'X'
,
0
};
static
const
WCHAR
sGames
[]
=
{
'G'
,
'a'
,
'm'
,
'e'
,
's'
,
0
};
static
const
WCHAR
sBackslash
[]
=
{
'\\'
,
0
};
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
HANDLE
hToken
=
NULL
;
HANDLE
hToken
=
NULL
;
PTOKEN_USER
pTokenUser
=
NULL
;
PTOKEN_USER
pTokenUser
=
NULL
;
...
@@ -99,8 +93,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -99,8 +93,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
/* this will make freeing it easier for user */
/* this will make freeing it easier for user */
*
lpRegistryPath
=
NULL
;
*
lpRegistryPath
=
NULL
;
lstrcpyW
(
sRegistryPath
,
sGameUxRegistryPath
);
lstrcpyW
(
sRegistryPath
,
L"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
GameUX
\\
"
);
lstrcatW
(
sRegistryPath
,
sBackslash
);
if
(
installScope
==
GIS_CURRENT_USER
)
if
(
installScope
==
GIS_CURRENT_USER
)
{
{
...
@@ -141,7 +134,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -141,7 +134,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
}
}
else
if
(
installScope
==
GIS_ALL_USERS
)
else
if
(
installScope
==
GIS_ALL_USERS
)
/* build registry path without SID */
/* build registry path without SID */
lstrcatW
(
sRegistryPath
,
sGames
);
lstrcatW
(
sRegistryPath
,
L"Games"
);
else
else
hr
=
E_INVALIDARG
;
hr
=
E_INVALIDARG
;
...
@@ -153,7 +146,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -153,7 +146,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
lstrcatW
(
sRegistryPath
,
sBackslash
);
lstrcatW
(
sRegistryPath
,
L"
\\
"
);
lstrcatW
(
sRegistryPath
,
sInstanceId
);
lstrcatW
(
sRegistryPath
,
sInstanceId
);
}
}
}
}
...
@@ -197,17 +190,6 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
...
@@ -197,17 +190,6 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
*/
*/
static
HRESULT
GAMEUX_WriteRegistryRecord
(
struct
GAMEUX_GAME_DATA
*
GameData
)
static
HRESULT
GAMEUX_WriteRegistryRecord
(
struct
GAMEUX_GAME_DATA
*
GameData
)
{
{
static
const
WCHAR
sApplicationId
[]
=
{
'A'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'I'
,
'd'
,
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
};
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
sTitle
[]
=
{
'T'
,
'i'
,
't'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
sDescription
[]
=
{
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
HRESULT
hr
,
hr2
;
HRESULT
hr
,
hr2
;
LPWSTR
lpRegistryKey
;
LPWSTR
lpRegistryKey
;
HKEY
hKey
;
HKEY
hKey
;
...
@@ -228,27 +210,27 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
...
@@ -228,27 +210,27 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
/* write game data to registry key */
/* write game data to registry key */
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
sConfigApplicationPath
,
0
,
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
L"ConfigApplicationPath"
,
0
,
REG_SZ
,
(
LPBYTE
)(
GameData
->
sGameInstallDirectory
),
REG_SZ
,
(
LPBYTE
)(
GameData
->
sGameInstallDirectory
),
(
lstrlenW
(
GameData
->
sGameInstallDirectory
)
+
1
)
*
sizeof
(
WCHAR
)));
(
lstrlenW
(
GameData
->
sGameInstallDirectory
)
+
1
)
*
sizeof
(
WCHAR
)));
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
sConfigGDFBinaryPath
,
0
,
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
L"ConfigGDFBinaryPath"
,
0
,
REG_SZ
,
(
LPBYTE
)(
GameData
->
sGDFBinaryPath
),
REG_SZ
,
(
LPBYTE
)(
GameData
->
sGDFBinaryPath
),
(
lstrlenW
(
GameData
->
sGDFBinaryPath
)
+
1
)
*
sizeof
(
WCHAR
)));
(
lstrlenW
(
GameData
->
sGDFBinaryPath
)
+
1
)
*
sizeof
(
WCHAR
)));
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
sApplicationId
,
0
,
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
L"ApplicationId"
,
0
,
REG_SZ
,
(
LPBYTE
)(
sGameApplicationId
),
REG_SZ
,
(
LPBYTE
)(
sGameApplicationId
),
(
lstrlenW
(
sGameApplicationId
)
+
1
)
*
sizeof
(
WCHAR
)));
(
lstrlenW
(
sGameApplicationId
)
+
1
)
*
sizeof
(
WCHAR
)));
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
sTitle
,
0
,
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
L"Title"
,
0
,
REG_SZ
,
(
LPBYTE
)(
GameData
->
bstrName
),
REG_SZ
,
(
LPBYTE
)(
GameData
->
bstrName
),
(
lstrlenW
(
GameData
->
bstrName
)
+
1
)
*
sizeof
(
WCHAR
)));
(
lstrlenW
(
GameData
->
bstrName
)
+
1
)
*
sizeof
(
WCHAR
)));
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
sDescription
,
0
,
hr
=
HRESULT_FROM_WIN32
(
RegSetValueExW
(
hKey
,
L"Description"
,
0
,
REG_SZ
,
(
LPBYTE
)(
GameData
->
bstrDescription
?
GameData
->
bstrDescription
:
GameData
->
bstrName
),
REG_SZ
,
(
LPBYTE
)(
GameData
->
bstrDescription
?
GameData
->
bstrDescription
:
GameData
->
bstrName
),
(
lstrlenW
(
GameData
->
bstrDescription
?
GameData
->
bstrDescription
:
GameData
->
bstrName
)
+
1
)
*
sizeof
(
WCHAR
)));
(
lstrlenW
(
GameData
->
bstrDescription
?
GameData
->
bstrDescription
:
GameData
->
bstrName
)
+
1
)
*
sizeof
(
WCHAR
)));
...
@@ -282,11 +264,6 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
...
@@ -282,11 +264,6 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
IXMLDOMElement
*
element
,
IXMLDOMElement
*
element
,
struct
GAMEUX_GAME_DATA
*
GameData
)
struct
GAMEUX_GAME_DATA
*
GameData
)
{
{
static
const
WCHAR
sName
[]
=
{
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
sDescription
[]
=
{
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
BSTR
bstrElementName
;
BSTR
bstrElementName
;
...
@@ -296,10 +273,10 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
...
@@ -296,10 +273,10 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
/* check element name */
/* check element name */
if
(
lstrcmpW
(
bstrElementName
,
sName
)
==
0
)
if
(
lstrcmpW
(
bstrElementName
,
L"Name"
)
==
0
)
hr
=
IXMLDOMElement_get_text
(
element
,
&
GameData
->
bstrName
);
hr
=
IXMLDOMElement_get_text
(
element
,
&
GameData
->
bstrName
);
else
if
(
lstrcmpW
(
bstrElementName
,
sDescription
)
==
0
)
else
if
(
lstrcmpW
(
bstrElementName
,
L"Description"
)
==
0
)
hr
=
IXMLDOMElement_get_text
(
element
,
&
GameData
->
bstrDescription
);
hr
=
IXMLDOMElement_get_text
(
element
,
&
GameData
->
bstrDescription
);
else
else
...
@@ -323,7 +300,6 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
...
@@ -323,7 +300,6 @@ static HRESULT GAMEUX_ProcessGameDefinitionElement(
*/
*/
static
HRESULT
GAMEUX_ParseGameDefinition
(
IXMLDOMElement
*
gamedef
,
struct
GAMEUX_GAME_DATA
*
game_data
)
static
HRESULT
GAMEUX_ParseGameDefinition
(
IXMLDOMElement
*
gamedef
,
struct
GAMEUX_GAME_DATA
*
game_data
)
{
{
static
const
WCHAR
gameidW
[]
=
{
'g'
,
'a'
,
'm'
,
'e'
,
'I'
,
'D'
,
0
};
IXMLDOMNodeList
*
props
;
IXMLDOMNodeList
*
props
;
VARIANT
var
;
VARIANT
var
;
HRESULT
hr
;
HRESULT
hr
;
...
@@ -331,7 +307,7 @@ static HRESULT GAMEUX_ParseGameDefinition(IXMLDOMElement *gamedef, struct GAMEUX
...
@@ -331,7 +307,7 @@ static HRESULT GAMEUX_ParseGameDefinition(IXMLDOMElement *gamedef, struct GAMEUX
TRACE
(
"(%p, %p)
\n
"
,
gamedef
,
game_data
);
TRACE
(
"(%p, %p)
\n
"
,
gamedef
,
game_data
);
attr
=
SysAllocString
(
gameidW
);
attr
=
SysAllocString
(
L"gameID"
);
if
(
!
attr
)
if
(
!
attr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -397,9 +373,6 @@ static DWORD WINAPI GAMEUX_ParseGDFBinary(void *thread_param)
...
@@ -397,9 +373,6 @@ static DWORD WINAPI GAMEUX_ParseGDFBinary(void *thread_param)
{
{
struct
parse_gdf_thread_param
*
ctx
=
thread_param
;
struct
parse_gdf_thread_param
*
ctx
=
thread_param
;
struct
GAMEUX_GAME_DATA
*
GameData
=
ctx
->
GameData
;
struct
GAMEUX_GAME_DATA
*
GameData
=
ctx
->
GameData
;
static
const
WCHAR
sRes
[]
=
{
'r'
,
'e'
,
's'
,
':'
,
'/'
,
'/'
,
0
};
static
const
WCHAR
sDATA
[]
=
{
'D'
,
'A'
,
'T'
,
'A'
,
0
};
static
const
WCHAR
sSlash
[]
=
{
'/'
,
0
};
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
WCHAR
sResourcePath
[
MAX_PATH
];
WCHAR
sResourcePath
[
MAX_PATH
];
...
@@ -412,11 +385,9 @@ static DWORD WINAPI GAMEUX_ParseGDFBinary(void *thread_param)
...
@@ -412,11 +385,9 @@ static DWORD WINAPI GAMEUX_ParseGDFBinary(void *thread_param)
TRACE
(
"(%p)->sGDFBinaryPath = %s
\n
"
,
GameData
,
debugstr_w
(
GameData
->
sGDFBinaryPath
));
TRACE
(
"(%p)->sGDFBinaryPath = %s
\n
"
,
GameData
,
debugstr_w
(
GameData
->
sGDFBinaryPath
));
/* prepare path to GDF, using res:// prefix */
/* prepare path to GDF, using res:// prefix */
lstrcpyW
(
sResourcePath
,
sRes
);
lstrcpyW
(
sResourcePath
,
L"res://"
);
lstrcatW
(
sResourcePath
,
GameData
->
sGDFBinaryPath
);
lstrcatW
(
sResourcePath
,
GameData
->
sGDFBinaryPath
);
lstrcatW
(
sResourcePath
,
sSlash
);
lstrcatW
(
sResourcePath
,
L"/DATA/"
);
lstrcatW
(
sResourcePath
,
sDATA
);
lstrcatW
(
sResourcePath
,
sSlash
);
lstrcatW
(
sResourcePath
,
ID_GDF_XML_STR
);
lstrcatW
(
sResourcePath
,
ID_GDF_XML_STR
);
CoInitialize
(
NULL
);
CoInitialize
(
NULL
);
...
@@ -662,9 +633,6 @@ static HRESULT GAMEUX_LoadRegistryString(HKEY hRootKey,
...
@@ -662,9 +633,6 @@ static HRESULT GAMEUX_LoadRegistryString(HKEY hRootKey,
* Helper function, updates stored data about game with given InstanceID
* Helper function, updates stored data about game with given InstanceID
*/
*/
static
HRESULT
GAMEUX_UpdateGame
(
LPGUID
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
;
HRESULT
hr
;
GAME_INSTALL_SCOPE
installScope
;
GAME_INSTALL_SCOPE
installScope
;
LPWSTR
lpRegistryPath
;
LPWSTR
lpRegistryPath
;
...
@@ -697,11 +665,11 @@ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) {
...
@@ -697,11 +665,11 @@ static HRESULT GAMEUX_UpdateGame(LPGUID InstanceID) {
/* first, read required data about game */
/* first, read required data about game */
hr
=
GAMEUX_LoadRegistryString
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
hr
=
GAMEUX_LoadRegistryString
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
sConfigGDFBinaryPath
,
&
lpGDFBinaryPath
);
L"ConfigGDFBinaryPath"
,
&
lpGDFBinaryPath
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
GAMEUX_LoadRegistryString
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
hr
=
GAMEUX_LoadRegistryString
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
sConfigApplicationPath
,
&
lpGameInstallDirectory
);
L"ConfigApplicationPath"
,
&
lpGameInstallDirectory
);
/* now remove currently existing registry key */
/* now remove currently existing registry key */
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
...
@@ -730,9 +698,6 @@ HRESULT GAMEUX_FindGameInstanceId(
...
@@ -730,9 +698,6 @@ HRESULT GAMEUX_FindGameInstanceId(
GAME_INSTALL_SCOPE
installScope
,
GAME_INSTALL_SCOPE
installScope
,
GUID
*
pInstanceId
)
GUID
*
pInstanceId
)
{
{
static
const
WCHAR
sConfigGDFBinaryPath
[]
=
{
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'G'
,
'D'
,
'F'
,
'B'
,
'i'
,
'n'
,
'a'
,
'r'
,
'y'
,
'P'
,
'a'
,
't'
,
'h'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
BOOL
found
=
FALSE
;
BOOL
found
=
FALSE
;
LPWSTR
lpRegistryPath
=
NULL
;
LPWSTR
lpRegistryPath
=
NULL
;
...
@@ -769,7 +734,7 @@ HRESULT GAMEUX_FindGameInstanceId(
...
@@ -769,7 +734,7 @@ HRESULT GAMEUX_FindGameInstanceId(
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
hr
=
GAMEUX_LoadRegistryString
(
hRootKey
,
lpName
,
hr
=
GAMEUX_LoadRegistryString
(
hRootKey
,
lpName
,
sConfigGDFBinaryPath
,
&
lpValue
);
L"ConfigGDFBinaryPath"
,
&
lpValue
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
...
...
dlls/gameux/gamestatistics.c
View file @
84aa9b91
...
@@ -102,13 +102,6 @@ static HRESULT GAMEUX_createStatsDirectory(LPCWSTR lpFilePath)
...
@@ -102,13 +102,6 @@ static HRESULT GAMEUX_createStatsDirectory(LPCWSTR lpFilePath)
*/
*/
static
HRESULT
GAMEUX_updateStatisticsFile
(
struct
GAMEUX_STATS
*
stats
)
static
HRESULT
GAMEUX_updateStatisticsFile
(
struct
GAMEUX_STATS
*
stats
)
{
{
static
const
WCHAR
sStatistics
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
's'
,
't'
,
'i'
,
'c'
,
's'
,
0
};
static
const
WCHAR
sCategory
[]
=
{
'C'
,
'a'
,
't'
,
'e'
,
'g'
,
'o'
,
'r'
,
'y'
,
0
};
static
const
WCHAR
sIndex
[]
=
{
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
sStatistic
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
's'
,
't'
,
'i'
,
'c'
,
0
};
static
const
WCHAR
sName
[]
=
{
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
sValue
[]
=
{
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
IXMLDOMDocument
*
document
=
NULL
;
IXMLDOMDocument
*
document
=
NULL
;
IXMLDOMElement
*
root
=
NULL
,
*
statisticsElement
=
NULL
;
IXMLDOMElement
*
root
=
NULL
,
*
statisticsElement
=
NULL
;
...
@@ -131,7 +124,7 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats)
...
@@ -131,7 +124,7 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrStatistics
=
SysAllocString
(
sStatistics
);
bstrStatistics
=
SysAllocString
(
L"Statistics"
);
if
(
!
bstrStatistics
)
if
(
!
bstrStatistics
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
...
@@ -141,35 +134,35 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats)
...
@@ -141,35 +134,35 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrCategory
=
SysAllocString
(
sCategory
);
bstrCategory
=
SysAllocString
(
L"Category"
);
if
(
!
bstrCategory
)
if
(
!
bstrCategory
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrIndex
=
SysAllocString
(
sIndex
);
bstrIndex
=
SysAllocString
(
L"Index"
);
if
(
!
bstrIndex
)
if
(
!
bstrIndex
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrStatistic
=
SysAllocString
(
sStatistic
);
bstrStatistic
=
SysAllocString
(
L"Statistic"
);
if
(
!
bstrStatistic
)
if
(
!
bstrStatistic
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrName
=
SysAllocString
(
sName
);
bstrName
=
SysAllocString
(
L"Name"
);
if
(
!
bstrName
)
if
(
!
bstrName
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrValue
=
SysAllocString
(
sValue
);
bstrValue
=
SysAllocString
(
L"Value"
);
if
(
!
bstrValue
)
if
(
!
bstrValue
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
...
@@ -318,24 +311,17 @@ static HRESULT GAMEUX_buildStatisticsFilePath(
...
@@ -318,24 +311,17 @@ static HRESULT GAMEUX_buildStatisticsFilePath(
LPCWSTR
lpApplicationId
,
LPCWSTR
lpApplicationId
,
LPWSTR
lpStatisticsFile
)
LPWSTR
lpStatisticsFile
)
{
{
static
const
WCHAR
sBackslash
[]
=
{
'\\'
,
0
};
static
const
WCHAR
sStatisticsDir
[]
=
{
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'G'
,
'a'
,
'm'
,
'e'
,
'E'
,
'x'
,
'p'
,
'l'
,
'o'
,
'r'
,
'e'
,
'r'
,
'\\'
,
'G'
,
'a'
,
'm'
,
'e'
,
'S'
,
't'
,
'a'
,
't'
,
'i'
,
's'
,
't'
,
'i'
,
'c'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
sDotGamestats
[]
=
{
'.'
,
'g'
,
'a'
,
'm'
,
'e'
,
's'
,
't'
,
'a'
,
't'
,
's'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
lpStatisticsFile
);
hr
=
SHGetFolderPathW
(
NULL
,
CSIDL_LOCAL_APPDATA
,
NULL
,
SHGFP_TYPE_CURRENT
,
lpStatisticsFile
);
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
lstrcatW
(
lpStatisticsFile
,
sStatisticsDir
);
lstrcatW
(
lpStatisticsFile
,
L"
\\
Microsoft
\\
Windows
\\
GameExplorer
\\
GameStatistics
\\
"
);
lstrcatW
(
lpStatisticsFile
,
lpApplicationId
);
lstrcatW
(
lpStatisticsFile
,
lpApplicationId
);
lstrcatW
(
lpStatisticsFile
,
sBackslash
);
lstrcatW
(
lpStatisticsFile
,
L"
\\
"
);
lstrcatW
(
lpStatisticsFile
,
lpApplicationId
);
lstrcatW
(
lpStatisticsFile
,
lpApplicationId
);
lstrcatW
(
lpStatisticsFile
,
sDotGamestats
);
lstrcatW
(
lpStatisticsFile
,
L".gamestats"
);
}
}
return
hr
;
return
hr
;
...
@@ -357,9 +343,6 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
...
@@ -357,9 +343,6 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
LPCWSTR
GDFBinaryPath
,
LPCWSTR
GDFBinaryPath
,
LPWSTR
lpApplicationId
)
LPWSTR
lpApplicationId
)
{
{
static
const
WCHAR
sApplicationId
[]
=
{
'A'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'I'
,
'd'
,
0
};
HRESULT
hr
;
HRESULT
hr
;
GAME_INSTALL_SCOPE
installScope
;
GAME_INSTALL_SCOPE
installScope
;
GUID
instanceId
;
GUID
instanceId
;
...
@@ -393,8 +376,7 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
...
@@ -393,8 +376,7 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
hr
=
HRESULT_FROM_WIN32
(
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
hr
=
HRESULT_FROM_WIN32
(
RegOpenKeyExW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
0
,
KEY_READ
|
KEY_WOW64_64KEY
,
&
hKey
));
lpRegistryPath
,
0
,
KEY_READ
|
KEY_WOW64_64KEY
,
&
hKey
));
if
(
SUCCEEDED
(
hr
))
{
if
(
SUCCEEDED
(
hr
))
{
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
hKey
,
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
hKey
,
NULL
,
L"ApplicationId"
,
RRF_RT_REG_SZ
,
NULL
,
sApplicationId
,
RRF_RT_REG_SZ
,
NULL
,
lpApplicationId
,
&
dwLength
));
NULL
,
lpApplicationId
,
&
dwLength
));
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
}
}
...
@@ -416,13 +398,6 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
...
@@ -416,13 +398,6 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
*/
*/
static
HRESULT
GAMEUX_loadStatisticsFromFile
(
struct
GAMEUX_STATS
*
data
)
static
HRESULT
GAMEUX_loadStatisticsFromFile
(
struct
GAMEUX_STATS
*
data
)
{
{
static
const
WCHAR
sStatistics
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
's'
,
't'
,
'i'
,
'c'
,
's'
,
0
};
static
const
WCHAR
sCategory
[]
=
{
'C'
,
'a'
,
't'
,
'e'
,
'g'
,
'o'
,
'r'
,
'y'
,
0
};
static
const
WCHAR
sIndex
[]
=
{
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
0
};
static
const
WCHAR
sStatistic
[]
=
{
'S'
,
't'
,
'a'
,
't'
,
'i'
,
's'
,
't'
,
'i'
,
'c'
,
0
};
static
const
WCHAR
sName
[]
=
{
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
sValue
[]
=
{
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
IXMLDOMDocument
*
document
=
NULL
;
IXMLDOMDocument
*
document
=
NULL
;
IXMLDOMElement
*
root
=
NULL
,
*
categoryElement
=
NULL
,
*
statisticElement
=
NULL
;
IXMLDOMElement
*
root
=
NULL
,
*
categoryElement
=
NULL
,
*
statisticElement
=
NULL
;
...
@@ -446,42 +421,42 @@ static HRESULT GAMEUX_loadStatisticsFromFile(struct GAMEUX_STATS *data)
...
@@ -446,42 +421,42 @@ static HRESULT GAMEUX_loadStatisticsFromFile(struct GAMEUX_STATS *data)
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrStatistics
=
SysAllocString
(
sStatistics
);
bstrStatistics
=
SysAllocString
(
L"Statistics"
);
if
(
!
bstrStatistics
)
if
(
!
bstrStatistics
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrCategory
=
SysAllocString
(
sCategory
);
bstrCategory
=
SysAllocString
(
L"Category"
);
if
(
!
bstrCategory
)
if
(
!
bstrCategory
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrIndex
=
SysAllocString
(
sIndex
);
bstrIndex
=
SysAllocString
(
L"Index"
);
if
(
!
bstrIndex
)
if
(
!
bstrIndex
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrStatistic
=
SysAllocString
(
sStatistic
);
bstrStatistic
=
SysAllocString
(
L"Statistic"
);
if
(
!
bstrStatistic
)
if
(
!
bstrStatistic
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrName
=
SysAllocString
(
sName
);
bstrName
=
SysAllocString
(
L"Name"
);
if
(
!
bstrName
)
if
(
!
bstrName
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
{
{
bstrValue
=
SysAllocString
(
sValue
);
bstrValue
=
SysAllocString
(
L"Value"
);
if
(
!
bstrValue
)
if
(
!
bstrValue
)
hr
=
E_OUTOFMEMORY
;
hr
=
E_OUTOFMEMORY
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment