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
9614ddb5
Commit
9614ddb5
authored
Jun 18, 2012
by
Hans Leidekker
Committed by
Alexandre Julliard
Jun 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Add query tests.
parent
c2a27a38
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
167 additions
and
0 deletions
+167
-0
configure
configure
+1
-0
configure.ac
configure.ac
+1
-0
Makefile.in
dlls/wbemprox/tests/Makefile.in
+7
-0
query.c
dlls/wbemprox/tests/query.c
+158
-0
No files found.
configure
View file @
9614ddb5
...
...
@@ -15524,6 +15524,7 @@ wine_fn_config_dll vwin32.vxd enable_win16
wine_fn_config_dll w32skrnl enable_win16
wine_fn_config_dll w32sys.dll16 enable_win16
wine_fn_config_dll wbemprox enable_wbemprox
wine_fn_config_test dlls/wbemprox/tests wbemprox_test
wine_fn_config_dll wer enable_wer implib
wine_fn_config_test dlls/wer/tests wer_test
wine_fn_config_dll wevtapi enable_wevtapi
...
...
configure.ac
View file @
9614ddb5
...
...
@@ -2940,6 +2940,7 @@ WINE_CONFIG_DLL(vwin32.vxd,enable_win16)
WINE_CONFIG_DLL(w32skrnl,enable_win16)
WINE_CONFIG_DLL(w32sys.dll16,enable_win16)
WINE_CONFIG_DLL(wbemprox)
WINE_CONFIG_TEST(dlls/wbemprox/tests)
WINE_CONFIG_DLL(wer,,[implib])
WINE_CONFIG_TEST(dlls/wer/tests)
WINE_CONFIG_DLL(wevtapi)
...
...
dlls/wbemprox/tests/Makefile.in
0 → 100644
View file @
9614ddb5
TESTDLL
=
wbemprox.dll
IMPORTS
=
uuid oleaut32 ole32
C_SRCS
=
\
query.c
@MAKE_TEST_RULES@
dlls/wbemprox/tests/query.c
0 → 100644
View file @
9614ddb5
/*
* Copyright 2012 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include <stdio.h>
#include "windows.h"
#include "ocidl.h"
#include "initguid.h"
#include "objidl.h"
#include "wbemcli.h"
#include "wine/test.h"
static
const
WCHAR
wqlW
[]
=
{
'w'
,
'q'
,
'l'
,
0
};
static
HRESULT
exec_query
(
IWbemServices
*
services
,
const
WCHAR
*
str
,
IEnumWbemClassObject
**
result
)
{
static
const
WCHAR
captionW
[]
=
{
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
descriptionW
[]
=
{
'D'
,
'e'
,
's'
,
'c'
,
'r'
,
'i'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
HRESULT
hr
;
IWbemClassObject
*
obj
;
BSTR
wql
=
SysAllocString
(
wqlW
),
query
=
SysAllocString
(
str
);
LONG
flags
=
WBEM_FLAG_RETURN_IMMEDIATELY
|
WBEM_FLAG_FORWARD_ONLY
;
ULONG
count
;
hr
=
IWbemServices_ExecQuery
(
services
,
wql
,
query
,
flags
,
NULL
,
result
);
if
(
hr
==
S_OK
)
{
trace
(
"%s
\n
"
,
wine_dbgstr_w
(
str
));
for
(;;)
{
VARIANT
var
;
IEnumWbemClassObject_Next
(
*
result
,
WBEM_INFINITE
,
1
,
&
obj
,
&
count
);
if
(
!
count
)
break
;
if
(
IWbemClassObject_Get
(
obj
,
captionW
,
0
,
&
var
,
NULL
,
NULL
)
==
WBEM_S_NO_ERROR
)
{
trace
(
"caption: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
}
if
(
IWbemClassObject_Get
(
obj
,
descriptionW
,
0
,
&
var
,
NULL
,
NULL
)
==
WBEM_S_NO_ERROR
)
{
trace
(
"description: %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
var
)));
VariantClear
(
&
var
);
}
IWbemClassObject_Release
(
obj
);
}
}
SysFreeString
(
wql
);
SysFreeString
(
query
);
return
hr
;
}
static
void
test_select
(
void
)
{
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'
,
' '
,
'W'
,
'i'
,
'n'
,
'3'
,
'2'
,
'_'
,
'Q'
,
'u'
,
'i'
,
'c'
,
'k'
,
'F'
,
'i'
,
'x'
,
'E'
,
'n'
,
'g'
,
'i'
,
'n'
,
'e'
,
'e'
,
'r'
,
'i'
,
'n'
,
'g'
,
0
};
static
const
WCHAR
query2
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'W'
,
'i'
,
'n'
,
'3'
,
'2'
,
'_'
,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,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
' '
,
'W'
,
'H'
,
'E'
,
'R'
,
'E'
,
' '
,
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
' '
,
'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
);
hr
=
IWbemServices_ExecQuery
(
services
,
NULL
,
query
,
0
,
NULL
,
&
result
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"query failed %08x
\n
"
,
hr
);
hr
=
IWbemServices_ExecQuery
(
services
,
wql
,
NULL
,
0
,
NULL
,
&
result
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"query failed %08x
\n
"
,
hr
);
hr
=
IWbemServices_ExecQuery
(
services
,
sql
,
query
,
0
,
NULL
,
&
result
);
ok
(
hr
==
WBEM_E_INVALID_QUERY_TYPE
,
"query failed %08x
\n
"
,
hr
);
hr
=
IWbemServices_ExecQuery
(
services
,
sql
,
NULL
,
0
,
NULL
,
&
result
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"query failed %08x
\n
"
,
hr
);
for
(
i
=
0
;
i
<
sizeof
(
test
)
/
sizeof
(
test
[
0
]);
i
++
)
{
hr
=
exec_query
(
services
,
test
[
i
],
&
result
);
ok
(
hr
==
S_OK
,
"query %u failed: %08x
\n
"
,
i
,
hr
);
if
(
result
)
IEnumWbemClassObject_Release
(
result
);
}
IWbemServices_Release
(
services
);
IWbemLocator_Release
(
locator
);
SysFreeString
(
path
);
SysFreeString
(
wql
);
SysFreeString
(
sql
);
SysFreeString
(
query
);
}
START_TEST
(
query
)
{
CoInitialize
(
NULL
);
CoInitializeSecurity
(
NULL
,
-
1
,
NULL
,
NULL
,
RPC_C_AUTHN_LEVEL_DEFAULT
,
RPC_C_IMP_LEVEL_IMPERSONATE
,
NULL
,
EOAC_NONE
,
NULL
);
test_select
();
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