Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ce28a5f2
Commit
ce28a5f2
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 IGameStatistics::SetStatistic.
parent
35692e40
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
15 deletions
+55
-15
gamestatistics.c
dlls/gameux/gamestatistics.c
+42
-2
gamestatistics.c
dlls/gameux/tests/gamestatistics.c
+13
-13
No files found.
dlls/gameux/gamestatistics.c
View file @
ce28a5f2
...
...
@@ -251,8 +251,48 @@ static HRESULT WINAPI GameStatisticsImpl_SetStatistic(
LPCWSTR
name
,
LPCWSTR
value
)
{
FIXME
(
"stub
\n
"
);
return
E_NOTIMPL
;
HRESULT
hr
=
S_OK
;
DWORD
dwNameLen
,
dwValueLen
;
GameStatisticsImpl
*
This
=
impl_from_IGameStatistics
(
iface
);
TRACE
(
"(%p, %d, %d, %s, %s)
\n
"
,
This
,
categoryIndex
,
statIndex
,
debugstr_w
(
name
),
debugstr_w
(
value
));
if
(
!
name
)
return
S_FALSE
;
if
(
categoryIndex
>=
MAX_CATEGORIES
||
statIndex
>=
MAX_STATS_PER_CATEGORY
)
return
E_INVALIDARG
;
dwNameLen
=
lstrlenW
(
name
);
if
(
dwNameLen
>
MAX_NAME_LENGTH
)
{
hr
=
S_FALSE
;
dwNameLen
=
MAX_NAME_LENGTH
;
}
lstrcpynW
(
This
->
stats
.
categories
[
categoryIndex
].
stats
[
statIndex
].
sName
,
name
,
dwNameLen
+
1
);
if
(
value
)
{
dwValueLen
=
lstrlenW
(
value
);
if
(
dwValueLen
>
MAX_VALUE_LENGTH
)
{
hr
=
S_FALSE
;
dwValueLen
=
MAX_VALUE_LENGTH
;
}
lstrcpynW
(
This
->
stats
.
categories
[
categoryIndex
].
stats
[
statIndex
].
sValue
,
value
,
dwValueLen
+
1
);
}
else
/* Windows allows to pass NULL as value */
This
->
stats
.
categories
[
categoryIndex
].
stats
[
statIndex
].
sValue
[
0
]
=
0
;
return
hr
;
}
static
HRESULT
WINAPI
GameStatisticsImpl_Save
(
...
...
dlls/gameux/tests/gamestatistics.c
View file @
ce28a5f2
...
...
@@ -292,39 +292,39 @@ static void test_gamestatisticsmgr( void )
/* check what happen if any string is NULL */
hr
=
IGameStatistics_SetStatistic
(
gs
,
0
,
0
,
NULL
,
sValue00
);
todo_wine
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
hr
=
IGameStatistics_SetStatistic
(
gs
,
0
,
0
,
sStatistic00
,
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
/* check what happen if any string is too long */
sTooLongString
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
uMaxNameLength
+
2
));
memset
(
sTooLongString
,
'a'
,
sizeof
(
WCHAR
)
*
(
uMaxNameLength
+
1
));
sTooLongString
[
uMaxNameLength
+
1
]
=
0
;
hr
=
IGameStatistics_SetStatistic
(
gs
,
0
,
0
,
sTooLongString
,
sValue00
);
todo_wine
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
CoTaskMemFree
(
sTooLongString
);
sTooLongString
=
CoTaskMemAlloc
(
sizeof
(
WCHAR
)
*
(
uMaxValueLength
+
2
));
memset
(
sTooLongString
,
'a'
,
sizeof
(
WCHAR
)
*
(
uMaxValueLength
+
1
));
sTooLongString
[
uMaxValueLength
+
1
]
=
0
;
hr
=
IGameStatistics_SetStatistic
(
gs
,
0
,
0
,
sStatistic00
,
sTooLongString
);
todo_wine
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
ok
(
hr
==
S_FALSE
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
CoTaskMemFree
(
sTooLongString
);
/* check what happen on too big index of category or statistic */
hr
=
IGameStatistics_SetStatistic
(
gs
,
wMaxCategories
,
0
,
sStatistic00
,
sValue00
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
hr
=
IGameStatistics_SetStatistic
(
gs
,
0
,
wMaxStatsPerCategory
,
sStatistic00
,
sValue00
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
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
));
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
));
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
));
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
));
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
));
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
));
ok
(
hr
==
E_INVALIDARG
,
"setting statistic returned unexpected value: 0x%x)
\n
"
,
hr
);
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
));
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
));
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
));
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
));
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
));
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
));
ok
(
_isFileExists
(
lpStatisticsFile
)
==
FALSE
,
"statistics file %s already exists
\n
"
,
wine_dbgstr_w
(
lpStatisticsFile
));
...
...
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