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
2c9a5900
Commit
2c9a5900
authored
Mar 14, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Mar 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxdiagn: Fix return and output behavior of IDxDiagContainer::EnumChildContainerNames.
parent
5801d60a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
8 deletions
+56
-8
container.c
dlls/dxdiagn/container.c
+7
-8
container.c
dlls/dxdiagn/tests/container.c
+49
-0
No files found.
dlls/dxdiagn/container.c
View file @
2c9a5900
...
...
@@ -88,16 +88,13 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAI
IDxDiagContainerImpl
*
This
=
(
IDxDiagContainerImpl
*
)
iface
;
IDxDiagContainerImpl_SubContainer
*
p
=
NULL
;
DWORD
i
=
0
;
TRACE
(
"(%p, %u, %s, %u)
\n
"
,
iface
,
dwIndex
,
debugstr_w
(
pwszContainer
),
cchContainer
);
if
(
NULL
==
pwszContainer
)
{
TRACE
(
"(%p, %u, %p, %u)
\n
"
,
iface
,
dwIndex
,
pwszContainer
,
cchContainer
);
if
(
NULL
==
pwszContainer
||
0
==
cchContainer
)
{
return
E_INVALIDARG
;
}
if
(
256
>
cchContainer
)
{
return
DXDIAG_E_INSUFFICIENT_BUFFER
;
}
p
=
This
->
subContainers
;
while
(
NULL
!=
p
)
{
if
(
dwIndex
==
i
)
{
...
...
@@ -109,7 +106,9 @@ static HRESULT WINAPI IDxDiagContainerImpl_EnumChildContainerNames(PDXDIAGCONTAI
}
p
=
p
->
next
;
++
i
;
}
}
*
pwszContainer
=
'\0'
;
return
E_INVALIDARG
;
}
...
...
dlls/dxdiagn/tests/container.c
View file @
2c9a5900
...
...
@@ -99,10 +99,59 @@ static void test_GetNumberOfProps(void)
IDxDiagProvider_Release
(
pddp
);
}
static
void
test_EnumChildContainerNames
(
void
)
{
HRESULT
hr
;
WCHAR
container
[
256
];
static
const
WCHAR
testW
[]
=
{
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
zerotestW
[]
=
{
0
,
'e'
,
's'
,
't'
,
0
};
if
(
!
create_root_IDxDiagContainer
())
{
skip
(
"Unable to create the root IDxDiagContainer
\n
"
);
return
;
}
/* Test various combinations of invalid parameters. */
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
0
,
NULL
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x
\n
"
,
hr
);
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
0
,
NULL
,
sizeof
(
container
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
E_INVALIDARG
,
"Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x
\n
"
,
hr
);
/* Test the conditions in which the output buffer can be modified. */
memcpy
(
container
,
testW
,
sizeof
(
testW
));
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
0
,
container
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x
\n
"
,
hr
);
ok
(
!
memcmp
(
container
,
testW
,
sizeof
(
testW
)),
"Expected the container buffer to be untouched, got %s
\n
"
,
wine_dbgstr_w
(
container
));
memcpy
(
container
,
testW
,
sizeof
(
testW
));
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
~
0
,
container
,
0
);
ok
(
hr
==
E_INVALIDARG
,
"Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x
\n
"
,
hr
);
ok
(
!
memcmp
(
container
,
testW
,
sizeof
(
testW
)),
"Expected the container buffer to be untouched, got %s
\n
"
,
wine_dbgstr_w
(
container
));
memcpy
(
container
,
testW
,
sizeof
(
testW
));
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
~
0
,
container
,
sizeof
(
container
)
/
sizeof
(
WCHAR
));
ok
(
hr
==
E_INVALIDARG
,
"Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x
\n
"
,
hr
);
ok
(
!
memcmp
(
container
,
zerotestW
,
sizeof
(
zerotestW
)),
"Expected the container buffer string to be empty, got %s
\n
"
,
wine_dbgstr_w
(
container
));
IDxDiagContainer_Release
(
pddc
);
IDxDiagProvider_Release
(
pddp
);
}
START_TEST
(
container
)
{
CoInitialize
(
NULL
);
test_GetNumberOfChildContainers
();
test_GetNumberOfProps
();
test_EnumChildContainerNames
();
CoUninitialize
();
}
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