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
c99e0fbc
Commit
c99e0fbc
authored
Feb 01, 2011
by
Andrew Nguyen
Committed by
Alexandre Julliard
Feb 01, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dxdiagn: Simplify the root container initialization.
parent
8c331e33
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
52 deletions
+119
-52
provider.c
dlls/dxdiagn/provider.c
+40
-52
container.c
dlls/dxdiagn/tests/container.c
+79
-0
No files found.
dlls/dxdiagn/provider.c
View file @
c99e0fbc
...
...
@@ -756,70 +756,58 @@ out_show_filters:
}
static
HRESULT
DXDiag_InitRootDXDiagContainer
(
IDxDiagContainer
*
pRootCont
)
{
HRESULT
hr
=
S_OK
;
static
const
WCHAR
DxDiag_SystemInfo
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
static
const
WCHAR
DxDiag_SystemDevices
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_LogicalDisks
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'L'
,
'o'
,
'g'
,
'i'
,
'c'
,
'a'
,
'l'
,
'D'
,
'i'
,
's'
,
'k'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectXFiles
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'X'
,
'F'
,
'i'
,
'l'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DisplayDevices
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectSound
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'S'
,
'o'
,
'u'
,
'n'
,
'd'
,
0
};
static
const
WCHAR
DxDiag_DirectMusic
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'M'
,
'u'
,
's'
,
'i'
,
'c'
,
0
};
static
const
WCHAR
DxDiag_DirectInput
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'I'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
WCHAR
DxDiag_DirectPlay
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'P'
,
'l'
,
'a'
,
'y'
,
0
};
static
const
WCHAR
DxDiag_SystemDevices
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectXFiles
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'X'
,
'F'
,
'i'
,
'l'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectShowFilters
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'S'
,
'h'
,
'o'
,
'w'
,
'F'
,
'i'
,
'l'
,
't'
,
'e'
,
'r'
,
's'
,
0
};
IDxDiagContainer
*
pSubCont
=
NULL
;
TRACE
(
"(%p)
\n
"
,
pRootCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagSystemInfoContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_SystemInfo
,
pSubCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagSystemDevicesContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_SystemDevices
,
pSubCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagLogicalDisksContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_LogicalDisks
,
pSubCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectXFilesContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectXFiles
,
pSubCont
);
static
const
WCHAR
DxDiag_LogicalDisks
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'L'
,
'o'
,
'g'
,
'i'
,
'c'
,
'a'
,
'l'
,
'D'
,
'i'
,
's'
,
'k'
,
's'
,
0
};
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDisplayContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DisplayDevices
,
pSubCont
);
static
const
struct
{
const
WCHAR
*
name
;
HRESULT
(
*
initfunc
)(
IDxDiagContainer
*
);
}
containers
[]
=
{
{
DxDiag_SystemInfo
,
DXDiag_InitDXDiagSystemInfoContainer
},
{
DxDiag_DisplayDevices
,
DXDiag_InitDXDiagDisplayContainer
},
{
DxDiag_DirectSound
,
DXDiag_InitDXDiagDirectSoundContainer
},
{
DxDiag_DirectMusic
,
DXDiag_InitDXDiagDirectMusicContainer
},
{
DxDiag_DirectInput
,
DXDiag_InitDXDiagDirectInputContainer
},
{
DxDiag_DirectPlay
,
DXDiag_InitDXDiagDirectPlayContainer
},
{
DxDiag_SystemDevices
,
DXDiag_InitDXDiagSystemDevicesContainer
},
{
DxDiag_DirectXFiles
,
DXDiag_InitDXDiagDirectXFilesContainer
},
{
DxDiag_DirectShowFilters
,
DXDiag_InitDXDiagDirectShowFiltersContainer
},
{
DxDiag_LogicalDisks
,
DXDiag_InitDXDiagLogicalDisksContainer
},
};
size_t
index
;
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectSoundContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectSound
,
pSubCont
);
TRACE
(
"(%p)
\n
"
,
pRootCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectMusicContainer
(
pSubCont
)
;
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectMusic
,
pSubCont
)
;
for
(
index
=
0
;
index
<
sizeof
(
containers
)
/
sizeof
(
containers
[
0
]);
index
++
)
{
IDxDiagContainer
*
pSubCont
;
HRESULT
hr
;
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectInputContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectInput
,
pSubCont
);
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectPlayContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectPlay
,
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
containers
[
index
].
name
,
pSubCont
);
if
(
FAILED
(
hr
))
{
IDxDiagContainer_Release
(
pSubCont
);
return
hr
;
}
hr
=
DXDiag_CreateDXDiagContainer
(
&
IID_IDxDiagContainer
,
(
void
**
)
&
pSubCont
);
if
(
FAILED
(
hr
))
{
return
hr
;
}
hr
=
DXDiag_InitDXDiagDirectShowFiltersContainer
(
pSubCont
);
hr
=
IDxDiagContainerImpl_AddChildContainer
(
pRootCont
,
DxDiag_DirectShowFilters
,
pSubCont
);
/* The return value is ignored for now. */
containers
[
index
].
initfunc
(
pSubCont
);
}
return
hr
;
return
S_OK
;
}
dlls/dxdiagn/tests/container.c
View file @
c99e0fbc
...
...
@@ -656,6 +656,83 @@ cleanup:
IDxDiagProvider_Release
(
pddp
);
}
static
void
test_root_children
(
void
)
{
static
const
WCHAR
DxDiag_SystemInfo
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'I'
,
'n'
,
'f'
,
'o'
,
0
};
static
const
WCHAR
DxDiag_DisplayDevices
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
's'
,
'p'
,
'l'
,
'a'
,
'y'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectSound
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'S'
,
'o'
,
'u'
,
'n'
,
'd'
,
0
};
static
const
WCHAR
DxDiag_DirectMusic
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'M'
,
'u'
,
's'
,
'i'
,
'c'
,
0
};
static
const
WCHAR
DxDiag_DirectInput
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'I'
,
'n'
,
'p'
,
'u'
,
't'
,
0
};
static
const
WCHAR
DxDiag_DirectPlay
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'P'
,
'l'
,
'a'
,
'y'
,
0
};
static
const
WCHAR
DxDiag_SystemDevices
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectXFiles
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'X'
,
'F'
,
'i'
,
'l'
,
'e'
,
's'
,
0
};
static
const
WCHAR
DxDiag_DirectShowFilters
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'D'
,
'i'
,
'r'
,
'e'
,
'c'
,
't'
,
'S'
,
'h'
,
'o'
,
'w'
,
'F'
,
'i'
,
'l'
,
't'
,
'e'
,
'r'
,
's'
,
0
};
static
const
WCHAR
DxDiag_LogicalDisks
[]
=
{
'D'
,
'x'
,
'D'
,
'i'
,
'a'
,
'g'
,
'_'
,
'L'
,
'o'
,
'g'
,
'i'
,
'c'
,
'a'
,
'l'
,
'D'
,
'i'
,
's'
,
'k'
,
's'
,
0
};
HRESULT
hr
;
DWORD
count
,
index
;
static
const
WCHAR
*
root_children
[]
=
{
DxDiag_SystemInfo
,
DxDiag_DisplayDevices
,
DxDiag_DirectSound
,
DxDiag_DirectMusic
,
DxDiag_DirectInput
,
DxDiag_DirectPlay
,
DxDiag_SystemDevices
,
DxDiag_DirectXFiles
,
DxDiag_DirectShowFilters
,
DxDiag_LogicalDisks
};
if
(
!
create_root_IDxDiagContainer
())
{
skip
(
"Unable to create the root IDxDiagContainer
\n
"
);
return
;
}
/* Verify the identity and ordering of the root container's children. */
hr
=
IDxDiagContainer_GetNumberOfChildContainers
(
pddc
,
&
count
);
ok
(
hr
==
S_OK
,
"Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
skip
(
"IDxDiagContainer::GetNumberOfChildContainers failed
\n
"
);
goto
cleanup
;
}
ok
(
count
==
sizeof
(
root_children
)
/
sizeof
(
root_children
[
0
]),
"Got unexpected count %u for the number of child containers
\n
"
,
count
);
if
(
count
!=
sizeof
(
root_children
)
/
sizeof
(
root_children
[
0
]))
{
skip
(
"Received unexpected number of child containers
\n
"
);
goto
cleanup
;
}
for
(
index
=
0
;
index
<=
count
;
index
++
)
{
WCHAR
container
[
256
];
hr
=
IDxDiagContainer_EnumChildContainerNames
(
pddc
,
index
,
container
,
sizeof
(
container
)
/
sizeof
(
WCHAR
));
if
(
hr
==
E_INVALIDARG
)
{
ok
(
index
==
count
,
"Expected IDxDiagContainer::EnumChildContainerNames to return "
"E_INVALIDARG on the last index %u
\n
"
,
count
);
break
;
}
else
if
(
hr
==
S_OK
)
{
ok
(
!
lstrcmpW
(
container
,
root_children
[
index
]),
"Expected container %s for index %u, got %s
\n
"
,
wine_dbgstr_w
(
root_children
[
index
]),
index
,
wine_dbgstr_w
(
container
));
}
else
{
ok
(
0
,
"IDxDiagContainer::EnumChildContainerNames unexpectedly returned 0x%08x
\n
"
,
hr
);
break
;
}
}
cleanup:
IDxDiagContainer_Release
(
pddc
);
IDxDiagProvider_Release
(
pddp
);
}
START_TEST
(
container
)
{
CoInitialize
(
NULL
);
...
...
@@ -666,5 +743,7 @@ START_TEST(container)
test_dot_parsing
();
test_EnumPropNames
();
test_GetProp
();
test_root_children
();
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