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
84ceddf8
Commit
84ceddf8
authored
Oct 12, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Add tests for the standard registry provider.
parent
71fbae96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
152 additions
and
25 deletions
+152
-25
query.c
dlls/wbemprox/tests/query.c
+152
-25
No files found.
dlls/wbemprox/tests/query.c
View file @
84ceddf8
...
...
@@ -67,9 +67,8 @@ static HRESULT exec_query( IWbemServices *services, const WCHAR *str, IEnumWbemC
return
hr
;
}
static
void
test_select
(
void
)
static
void
test_select
(
IWbemServices
*
services
)
{
static
const
WCHAR
cimv2W
[]
=
{
'R'
,
'O'
,
'O'
,
'T'
,
'\\'
,
'C'
,
'I'
,
'M'
,
'V'
,
'2'
,
0
};
static
const
WCHAR
sqlW
[]
=
{
'S'
,
'Q'
,
'L'
,
0
};
static
const
WCHAR
query1
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'H'
,
'O'
,
'T'
,
'F'
,
'I'
,
'X'
,
'I'
,
'D'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
...
...
@@ -93,31 +92,12 @@ static void test_select(void)
'L'
,
'I'
,
'K'
,
'E'
,
' '
,
'\''
,
'%'
,
'%'
,
'R'
,
'E'
,
'G'
,
'E'
,
'D'
,
'I'
,
'T'
,
'%'
,
'\''
,
0
};
static
const
WCHAR
*
test
[]
=
{
query1
,
query2
,
query3
,
query4
,
query5
,
query6
,
query7
};
HRESULT
hr
;
IWbemLocator
*
locator
;
IWbemServices
*
services
;
IEnumWbemClassObject
*
result
;
BSTR
path
=
SysAllocString
(
cimv2W
);
BSTR
wql
=
SysAllocString
(
wqlW
);
BSTR
sql
=
SysAllocString
(
sqlW
);
BSTR
query
=
SysAllocString
(
query1
);
UINT
i
;
hr
=
CoCreateInstance
(
&
CLSID_WbemLocator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWbemLocator
,
(
void
**
)
&
locator
);
if
(
hr
!=
S_OK
)
{
win_skip
(
"can't create instance of WbemLocator
\n
"
);
return
;
}
ok
(
hr
==
S_OK
,
"failed to create IWbemLocator interface %08x
\n
"
,
hr
);
hr
=
IWbemLocator_ConnectServer
(
locator
,
path
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
,
&
services
);
ok
(
hr
==
S_OK
,
"failed to get IWbemServices interface %08x
\n
"
,
hr
);
hr
=
CoSetProxyBlanket
(
(
IUnknown
*
)
services
,
RPC_C_AUTHN_WINNT
,
RPC_C_AUTHZ_NONE
,
NULL
,
RPC_C_AUTHN_LEVEL_CALL
,
RPC_C_IMP_LEVEL_IMPERSONATE
,
NULL
,
EOAC_NONE
);
ok
(
hr
==
S_OK
,
"failed to set proxy blanket %08x
\n
"
,
hr
);
hr
=
IWbemServices_ExecQuery
(
services
,
NULL
,
NULL
,
0
,
NULL
,
&
result
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"query failed %08x
\n
"
,
hr
);
...
...
@@ -140,19 +120,166 @@ static void test_select(void)
if
(
result
)
IEnumWbemClassObject_Release
(
result
);
}
IWbemServices_Release
(
services
);
IWbemLocator_Release
(
locator
);
SysFreeString
(
path
);
SysFreeString
(
wql
);
SysFreeString
(
sql
);
SysFreeString
(
query
);
}
static
void
test_StdRegProv
(
IWbemServices
*
services
)
{
static
const
WCHAR
enumkeyW
[]
=
{
'E'
,
'n'
,
'u'
,
'm'
,
'K'
,
'e'
,
'y'
,
0
};
static
const
WCHAR
enumvaluesW
[]
=
{
'E'
,
'n'
,
'u'
,
'm'
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
's'
,
0
};
static
const
WCHAR
stdregprovW
[]
=
{
'S'
,
't'
,
'd'
,
'R'
,
'e'
,
'g'
,
'P'
,
'r'
,
'o'
,
'v'
,
0
};
static
const
WCHAR
defkeyW
[]
=
{
'h'
,
'D'
,
'e'
,
'f'
,
'K'
,
'e'
,
'y'
,
0
};
static
const
WCHAR
subkeynameW
[]
=
{
's'
,
'S'
,
'u'
,
'b'
,
'K'
,
'e'
,
'y'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
returnvalueW
[]
=
{
'R'
,
'e'
,
't'
,
'u'
,
'r'
,
'n'
,
'V'
,
'a'
,
'l'
,
'u'
,
'e'
,
0
};
static
const
WCHAR
namesW
[]
=
{
's'
,
'N'
,
'a'
,
'm'
,
'e'
,
's'
,
0
};
static
const
WCHAR
typesW
[]
=
{
'T'
,
'y'
,
'p'
,
'e'
,
's'
,
0
};
static
const
WCHAR
windowsW
[]
=
{
'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'
,
0
};
BSTR
class
=
SysAllocString
(
stdregprovW
),
method
;
IWbemClassObject
*
reg
,
*
sig_in
,
*
sig_out
,
*
in
,
*
out
;
VARIANT
defkey
,
subkey
,
retval
,
names
,
types
;
CIMTYPE
type
;
HRESULT
hr
;
hr
=
IWbemServices_GetObject
(
services
,
class
,
0
,
NULL
,
&
reg
,
NULL
);
if
(
hr
!=
S_OK
)
{
win_skip
(
"StdRegProv not available
\n
"
);
return
;
}
hr
=
IWbemClassObject_GetMethod
(
reg
,
enumkeyW
,
0
,
&
sig_in
,
&
sig_out
);
ok
(
hr
==
S_OK
,
"failed to get EnumKey method %08x
\n
"
,
hr
);
hr
=
IWbemClassObject_SpawnInstance
(
sig_in
,
0
,
&
in
);
ok
(
hr
==
S_OK
,
"failed to spawn instance %08x
\n
"
,
hr
);
V_VT
(
&
defkey
)
=
VT_I4
;
V_I4
(
&
defkey
)
=
0x80000002
;
hr
=
IWbemClassObject_Put
(
in
,
defkeyW
,
0
,
&
defkey
,
0
);
ok
(
hr
==
S_OK
,
"failed to set root %08x
\n
"
,
hr
);
V_VT
(
&
subkey
)
=
VT_BSTR
;
V_BSTR
(
&
subkey
)
=
SysAllocString
(
windowsW
);
hr
=
IWbemClassObject_Put
(
in
,
subkeynameW
,
0
,
&
subkey
,
0
);
ok
(
hr
==
S_OK
,
"failed to set subkey %08x
\n
"
,
hr
);
out
=
NULL
;
method
=
SysAllocString
(
enumkeyW
);
hr
=
IWbemServices_ExecMethod
(
services
,
class
,
method
,
0
,
NULL
,
in
,
&
out
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to execute method %08x
\n
"
,
hr
);
SysFreeString
(
method
);
type
=
0xdeadbeef
;
VariantInit
(
&
retval
);
hr
=
IWbemClassObject_Get
(
out
,
returnvalueW
,
0
,
&
retval
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get return value %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
retval
)
==
VT_I4
,
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
retval
)
);
ok
(
!
V_I4
(
&
retval
),
"unexpected error %u
\n
"
,
V_UI4
(
&
retval
)
);
ok
(
type
==
CIM_UINT32
,
"unexpected type 0x%x
\n
"
,
type
);
type
=
0xdeadbeef
;
VariantInit
(
&
names
);
hr
=
IWbemClassObject_Get
(
out
,
namesW
,
0
,
&
names
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get names %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
names
)
==
(
VT_BSTR
|
VT_ARRAY
),
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
names
)
);
ok
(
type
==
(
CIM_STRING
|
CIM_FLAG_ARRAY
),
"unexpected type 0x%x
\n
"
,
type
);
VariantClear
(
&
names
);
VariantClear
(
&
subkey
);
IWbemClassObject_Release
(
in
);
IWbemClassObject_Release
(
out
);
IWbemClassObject_Release
(
sig_in
);
IWbemClassObject_Release
(
sig_out
);
hr
=
IWbemClassObject_GetMethod
(
reg
,
enumvaluesW
,
0
,
&
sig_in
,
&
sig_out
);
ok
(
hr
==
S_OK
,
"failed to get EnumValues method %08x
\n
"
,
hr
);
hr
=
IWbemClassObject_SpawnInstance
(
sig_in
,
0
,
&
in
);
ok
(
hr
==
S_OK
,
"failed to spawn instance %08x
\n
"
,
hr
);
V_VT
(
&
defkey
)
=
VT_I4
;
V_I4
(
&
defkey
)
=
0x80000002
;
hr
=
IWbemClassObject_Put
(
in
,
defkeyW
,
0
,
&
defkey
,
0
);
ok
(
hr
==
S_OK
,
"failed to set root %08x
\n
"
,
hr
);
V_VT
(
&
subkey
)
=
VT_BSTR
;
V_BSTR
(
&
subkey
)
=
SysAllocString
(
windowsW
);
hr
=
IWbemClassObject_Put
(
in
,
subkeynameW
,
0
,
&
subkey
,
0
);
ok
(
hr
==
S_OK
,
"failed to set subkey %08x
\n
"
,
hr
);
out
=
NULL
;
method
=
SysAllocString
(
enumvaluesW
);
hr
=
IWbemServices_ExecMethod
(
services
,
class
,
method
,
0
,
NULL
,
in
,
&
out
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to execute method %08x
\n
"
,
hr
);
SysFreeString
(
method
);
type
=
0xdeadbeef
;
VariantInit
(
&
retval
);
hr
=
IWbemClassObject_Get
(
out
,
returnvalueW
,
0
,
&
retval
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get return value %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
retval
)
==
VT_I4
,
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
retval
)
);
ok
(
!
V_I4
(
&
retval
),
"unexpected error %u
\n
"
,
V_I4
(
&
retval
)
);
ok
(
type
==
CIM_UINT32
,
"unexpected type 0x%x
\n
"
,
type
);
type
=
0xdeadbeef
;
VariantInit
(
&
names
);
hr
=
IWbemClassObject_Get
(
out
,
namesW
,
0
,
&
names
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get names %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
names
)
==
(
VT_BSTR
|
VT_ARRAY
),
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
names
)
);
ok
(
type
==
(
CIM_STRING
|
CIM_FLAG_ARRAY
),
"unexpected type 0x%x
\n
"
,
type
);
type
=
0xdeadbeef
;
VariantInit
(
&
types
);
hr
=
IWbemClassObject_Get
(
out
,
typesW
,
0
,
&
types
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get names %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
types
)
==
(
VT_I4
|
VT_ARRAY
),
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
types
)
);
ok
(
type
==
(
CIM_SINT32
|
CIM_FLAG_ARRAY
),
"unexpected type 0x%x
\n
"
,
type
);
VariantClear
(
&
types
);
VariantClear
(
&
names
);
VariantClear
(
&
subkey
);
IWbemClassObject_Release
(
in
);
IWbemClassObject_Release
(
out
);
IWbemClassObject_Release
(
sig_in
);
IWbemClassObject_Release
(
sig_out
);
IWbemClassObject_Release
(
reg
);
SysFreeString
(
class
);
}
START_TEST
(
query
)
{
static
const
WCHAR
cimv2W
[]
=
{
'R'
,
'O'
,
'O'
,
'T'
,
'\\'
,
'C'
,
'I'
,
'M'
,
'V'
,
'2'
,
0
};
BSTR
path
=
SysAllocString
(
cimv2W
);
IWbemLocator
*
locator
;
IWbemServices
*
services
;
HRESULT
hr
;
CoInitialize
(
NULL
);
CoInitializeSecurity
(
NULL
,
-
1
,
NULL
,
NULL
,
RPC_C_AUTHN_LEVEL_DEFAULT
,
RPC_C_IMP_LEVEL_IMPERSONATE
,
NULL
,
EOAC_NONE
,
NULL
);
test_select
();
hr
=
CoCreateInstance
(
&
CLSID_WbemLocator
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IWbemLocator
,
(
void
**
)
&
locator
);
if
(
hr
!=
S_OK
)
{
win_skip
(
"can't create instance of WbemLocator
\n
"
);
return
;
}
hr
=
IWbemLocator_ConnectServer
(
locator
,
path
,
NULL
,
NULL
,
NULL
,
0
,
NULL
,
NULL
,
&
services
);
ok
(
hr
==
S_OK
,
"failed to get IWbemServices interface %08x
\n
"
,
hr
);
hr
=
CoSetProxyBlanket
(
(
IUnknown
*
)
services
,
RPC_C_AUTHN_WINNT
,
RPC_C_AUTHZ_NONE
,
NULL
,
RPC_C_AUTHN_LEVEL_CALL
,
RPC_C_IMP_LEVEL_IMPERSONATE
,
NULL
,
EOAC_NONE
);
ok
(
hr
==
S_OK
,
"failed to set proxy blanket %08x
\n
"
,
hr
);
test_select
(
services
);
test_StdRegProv
(
services
);
SysFreeString
(
path
);
IWbemServices_Release
(
services
);
IWbemLocator_Release
(
locator
);
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