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
5cac9d2c
Commit
5cac9d2c
authored
Sep 26, 2010
by
Mariusz Pluciński
Committed by
Alexandre Julliard
Sep 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gameux: Add implementation of IGameStatisticsMgr::RemoveGameStatistics.
parent
ef3a1ab5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
42 deletions
+76
-42
gamestatistics.c
dlls/gameux/gamestatistics.c
+74
-40
gamestatistics.c
dlls/gameux/tests/gamestatistics.c
+2
-2
No files found.
dlls/gameux/gamestatistics.c
View file @
5cac9d2c
...
...
@@ -183,6 +183,64 @@ static HRESULT GAMEUX_buildStatisticsFilePath(
return
hr
;
}
/*******************************************************************************
* GAMEUX_getAppIdFromGDFPath
*
* Loads application identifier associated with given GDF binary.
* Routine reads identifier from registry, so will fail if game
* is not registered.
*
* Parameters:
* GDFBinaryPath [I] path to gdf binary
* lpApplicationId [O] place to store application id.
* must be at least 49 characters
* to store guid and termination 0
*/
static
HRESULT
GAMEUX_getAppIdFromGDFPath
(
LPCWSTR
GDFBinaryPath
,
LPWSTR
lpApplicationId
)
{
static
const
WCHAR
sApplicationId
[]
=
{
'A'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'I'
,
'd'
,
0
};
HRESULT
hr
;
GAME_INSTALL_SCOPE
installScope
;
GUID
instanceId
;
LPWSTR
lpRegistryPath
;
DWORD
dwLength
=
49
*
sizeof
(
WCHAR
);
/* place for GUID */
TRACE
(
"(%s, %p)
\n
"
,
debugstr_w
(
GDFBinaryPath
),
lpApplicationId
);
if
(
!
GDFBinaryPath
)
return
E_INVALIDARG
;
installScope
=
GIS_CURRENT_USER
;
hr
=
GAMEUX_FindGameInstanceId
(
GDFBinaryPath
,
installScope
,
&
instanceId
);
if
(
hr
==
S_FALSE
)
{
installScope
=
GIS_ALL_USERS
;
hr
=
GAMEUX_FindGameInstanceId
(
GDFBinaryPath
,
installScope
,
&
instanceId
);
}
if
(
hr
==
S_FALSE
)
/* game not registered, so statistics cannot be used */
hr
=
E_FAIL
;
if
(
SUCCEEDED
(
hr
))
/* game is registered, let's read it's application id from registry */
hr
=
GAMEUX_buildGameRegistryPath
(
installScope
,
&
instanceId
,
&
lpRegistryPath
);
if
(
SUCCEEDED
(
hr
))
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
sApplicationId
,
RRF_RT_REG_SZ
,
NULL
,
lpApplicationId
,
&
dwLength
));
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
TRACE
(
"found app id: %s, return: %#x
\n
"
,
debugstr_w
(
lpApplicationId
),
hr
);
return
hr
;
}
/*******************************************************************
* IGameStatistics implementation
*/
...
...
@@ -560,51 +618,16 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
GAMESTATS_OPEN_RESULT
*
pOpenResult
,
IGameStatistics
**
ppiStats
)
{
static
const
WCHAR
sApplicationId
[]
=
{
'A'
,
'p'
,
'p'
,
'l'
,
'i'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'I'
,
'd'
,
0
};
HRESULT
hr
;
GUID
instanceId
;
LPWSTR
lpRegistryPath
=
NULL
;
WCHAR
lpApplicationId
[
49
];
DWORD
dwLength
=
sizeof
(
lpApplicationId
);
GAME_INSTALL_SCOPE
installScope
;
GameStatisticsImpl
*
statisticsImpl
;
TRACE
(
"(%p, %s, 0x%x, %p, %p)
\n
"
,
iface
,
debugstr_w
(
GDFBinaryPath
),
openType
,
pOpenResult
,
ppiStats
);
if
(
!
GDFBinaryPath
)
return
E_INVALIDARG
;
installScope
=
GIS_CURRENT_USER
;
hr
=
GAMEUX_FindGameInstanceId
(
GDFBinaryPath
,
installScope
,
&
instanceId
);
if
(
hr
==
S_FALSE
)
{
installScope
=
GIS_ALL_USERS
;
hr
=
GAMEUX_FindGameInstanceId
(
GDFBinaryPath
,
installScope
,
&
instanceId
);
}
if
(
hr
==
S_FALSE
)
/* game not registered, so statistics cannot be used */
hr
=
E_FAIL
;
hr
=
GAMEUX_getAppIdFromGDFPath
(
GDFBinaryPath
,
lpApplicationId
);
if
(
SUCCEEDED
(
hr
))
/* game is registered, let's read it's application id from registry */
hr
=
GAMEUX_buildGameRegistryPath
(
installScope
,
&
instanceId
,
&
lpRegistryPath
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
HRESULT_FROM_WIN32
(
RegGetValueW
(
HKEY_LOCAL_MACHINE
,
lpRegistryPath
,
sApplicationId
,
RRF_RT_REG_SZ
,
NULL
,
lpApplicationId
,
&
dwLength
));
}
if
(
SUCCEEDED
(
hr
))
{
TRACE
(
"found app id: %s
\n
"
,
debugstr_w
(
lpApplicationId
));
hr
=
create_IGameStatistics
(
&
statisticsImpl
);
}
if
(
SUCCEEDED
(
hr
))
{
...
...
@@ -618,8 +641,6 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_GetGameStatistics(
hr
=
E_NOTIMPL
;
}
HeapFree
(
GetProcessHeap
(),
0
,
lpRegistryPath
);
return
hr
;
}
...
...
@@ -627,8 +648,21 @@ static HRESULT STDMETHODCALLTYPE GameStatisticsMgrImpl_RemoveGameStatistics(
IGameStatisticsMgr
*
iface
,
LPCWSTR
GDFBinaryPath
)
{
FIXME
(
"stub (%p, %s)
\n
"
,
iface
,
debugstr_w
(
GDFBinaryPath
));
return
E_NOTIMPL
;
HRESULT
hr
;
WCHAR
lpApplicationId
[
49
];
WCHAR
sStatsFile
[
MAX_PATH
];
TRACE
(
"(%p, %s)
\n
"
,
iface
,
debugstr_w
(
GDFBinaryPath
));
hr
=
GAMEUX_getAppIdFromGDFPath
(
GDFBinaryPath
,
lpApplicationId
);
if
(
SUCCEEDED
(
hr
))
hr
=
GAMEUX_buildStatisticsFilePath
(
lpApplicationId
,
sStatsFile
);
if
(
SUCCEEDED
(
hr
))
hr
=
(
DeleteFileW
(
sStatsFile
)
==
TRUE
?
S_OK
:
HRESULT_FROM_WIN32
(
GetLastError
()));
return
hr
;
}
static
const
struct
IGameStatisticsMgrVtbl
GameStatisticsMgrImplVtbl
=
...
...
dlls/gameux/tests/gamestatistics.c
View file @
5cac9d2c
...
...
@@ -414,8 +414,8 @@ static void test_gamestatisticsmgr( void )
/* test of removing game statistics from underlying storage */
ok
(
_isFileExists
(
lpStatisticsFile
)
==
TRUE
,
"statistics file %s does not exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
hr
=
IGameStatisticsMgr_RemoveGameStatistics
(
gsm
,
sExeName
);
todo_wine
ok
(
SUCCEEDED
(
hr
),
"cannot remove game statistics, error: 0x%x
\n
"
,
hr
);
todo_wine
ok
(
_isFileExists
(
lpStatisticsFile
)
==
FALSE
,
"statistics file %s still exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
ok
(
SUCCEEDED
(
hr
),
"cannot remove game statistics, error: 0x%x
\n
"
,
hr
);
ok
(
_isFileExists
(
lpStatisticsFile
)
==
FALSE
,
"statistics file %s still exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
}
hr
=
IGameStatisticsMgr_Release
(
gsm
);
...
...
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