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
9548eb79
Commit
9548eb79
authored
Jan 17, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmiutils: Implement IWbemPath::RemoveNamespaceAt.
parent
53919294
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
8 deletions
+96
-8
path.c
dlls/wmiutils/path.c
+15
-3
path.c
dlls/wmiutils/tests/path.c
+81
-5
No files found.
dlls/wmiutils/path.c
View file @
9548eb79
...
...
@@ -525,10 +525,22 @@ static HRESULT WINAPI path_GetNamespaceAt(
static
HRESULT
WINAPI
path_RemoveNamespaceAt
(
IWbemPath
*
iface
,
ULONG
uInde
x
)
ULONG
id
x
)
{
FIXME
(
"%p, %u
\n
"
,
iface
,
uIndex
);
return
E_NOTIMPL
;
struct
path
*
path
=
impl_from_IWbemPath
(
iface
);
TRACE
(
"%p, %u
\n
"
,
iface
,
idx
);
if
(
idx
>=
path
->
num_namespaces
)
return
WBEM_E_INVALID_PARAMETER
;
heap_free
(
path
->
namespaces
[
idx
]
);
while
(
idx
<
path
->
num_namespaces
-
1
)
{
path
->
namespaces
[
idx
]
=
path
->
namespaces
[
idx
+
1
];
path
->
len_namespaces
[
idx
]
=
path
->
len_namespaces
[
idx
+
1
];
idx
++
;
}
path
->
num_namespaces
--
;
return
S_OK
;
}
static
HRESULT
WINAPI
path_RemoveAllNamespaces
(
...
...
dlls/wmiutils/tests/path.c
View file @
9548eb79
...
...
@@ -586,6 +586,10 @@ static void test_IWbemPath_GetNamespaceAt(void)
static
void
test_IWbemPath_RemoveAllNamespaces
(
void
)
{
static
const
ULONGLONG
expected_flags
=
WBEMPATH_INFO_ANON_LOCAL_MACHINE
|
WBEMPATH_INFO_IS_INST_REF
|
WBEMPATH_INFO_HAS_SUBSCOPES
|
WBEMPATH_INFO_V2_COMPLIANT
|
WBEMPATH_INFO_CIM_COMPLIANT
|
WBEMPATH_INFO_PATH_HAD_SERVER
;
IWbemPath
*
path
;
WCHAR
buf
[
16
];
ULONG
len
;
...
...
@@ -603,9 +607,7 @@ static void test_IWbemPath_RemoveAllNamespaces(void)
flags
=
0
;
hr
=
IWbemPath_GetInfo
(
path
,
0
,
&
flags
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
flags
==
(
WBEMPATH_INFO_ANON_LOCAL_MACHINE
|
WBEMPATH_INFO_IS_INST_REF
|
WBEMPATH_INFO_HAS_SUBSCOPES
|
WBEMPATH_INFO_V2_COMPLIANT
|
WBEMPATH_INFO_CIM_COMPLIANT
|
WBEMPATH_INFO_PATH_HAD_SERVER
),
ok
(
flags
==
expected_flags
,
"got %lx%08lx
\n
"
,
(
unsigned
long
)(
flags
>>
32
),
(
unsigned
long
)
flags
);
hr
=
IWbemPath_RemoveAllNamespaces
(
path
);
...
...
@@ -614,11 +616,84 @@ static void test_IWbemPath_RemoveAllNamespaces(void)
flags
=
0
;
hr
=
IWbemPath_GetInfo
(
path
,
0
,
&
flags
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
flags
==
(
WBEMPATH_INFO_ANON_LOCAL_MACHINE
|
WBEMPATH_INFO_IS_INST_REF
|
ok
(
flags
==
expected_flags
,
"got %lx%08lx
\n
"
,
(
unsigned
long
)(
flags
>>
32
),
(
unsigned
long
)
flags
);
buf
[
0
]
=
0
;
len
=
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
hr
=
IWbemPath_GetNamespaceAt
(
path
,
0
,
&
len
,
buf
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"got %08x
\n
"
,
hr
);
IWbemPath_Release
(
path
);
}
static
void
test_IWbemPath_RemoveNamespaceAt
(
void
)
{
static
const
ULONGLONG
expected_flags
=
WBEMPATH_INFO_ANON_LOCAL_MACHINE
|
WBEMPATH_INFO_IS_INST_REF
|
WBEMPATH_INFO_HAS_SUBSCOPES
|
WBEMPATH_INFO_V2_COMPLIANT
|
WBEMPATH_INFO_CIM_COMPLIANT
|
WBEMPATH_INFO_PATH_HAD_SERVER
),
WBEMPATH_INFO_CIM_COMPLIANT
|
WBEMPATH_INFO_PATH_HAD_SERVER
;
static
const
WCHAR
cimv2W
[]
=
{
'c'
,
'i'
,
'm'
,
'v'
,
'2'
,
0
};
IWbemPath
*
path
;
WCHAR
buf
[
16
];
ULONG
len
,
count
;
ULONGLONG
flags
;
HRESULT
hr
;
if
(
!
(
path
=
create_path
()))
return
;
hr
=
IWbemPath_RemoveNamespaceAt
(
path
,
0
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"got %08x
\n
"
,
hr
);
hr
=
IWbemPath_SetText
(
path
,
WBEMPATH_CREATE_ACCEPT_ALL
,
path17
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
flags
=
0
;
hr
=
IWbemPath_GetInfo
(
path
,
0
,
&
flags
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
flags
==
expected_flags
,
"got %lx%08lx
\n
"
,
(
unsigned
long
)(
flags
>>
32
),
(
unsigned
long
)
flags
);
count
=
0xdeadbeef
;
hr
=
IWbemPath_GetNamespaceCount
(
path
,
&
count
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
count
==
2
,
"got %u
\n
"
,
count
);
hr
=
IWbemPath_RemoveNamespaceAt
(
path
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
flags
=
0
;
hr
=
IWbemPath_GetInfo
(
path
,
0
,
&
flags
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
flags
==
expected_flags
,
"got %lx%08lx
\n
"
,
(
unsigned
long
)(
flags
>>
32
),
(
unsigned
long
)
flags
);
count
=
0xdeadbeef
;
hr
=
IWbemPath_GetNamespaceCount
(
path
,
&
count
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
count
==
1
,
"got %u
\n
"
,
count
);
buf
[
0
]
=
0
;
len
=
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
hr
=
IWbemPath_GetNamespaceAt
(
path
,
0
,
&
len
,
buf
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
lstrcmpW
(
buf
,
cimv2W
),
"unexpected buffer contents %s
\n
"
,
wine_dbgstr_w
(
buf
)
);
ok
(
len
==
lstrlenW
(
cimv2W
)
+
1
,
"unexpected length %u
\n
"
,
len
);
hr
=
IWbemPath_RemoveNamespaceAt
(
path
,
0
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
flags
=
0
;
hr
=
IWbemPath_GetInfo
(
path
,
0
,
&
flags
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
flags
==
expected_flags
,
"got %lx%08lx
\n
"
,
(
unsigned
long
)(
flags
>>
32
),
(
unsigned
long
)
flags
);
count
=
0xdeadbeef
;
hr
=
IWbemPath_GetNamespaceCount
(
path
,
&
count
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
!
count
,
"got %u
\n
"
,
count
);
buf
[
0
]
=
0
;
len
=
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
hr
=
IWbemPath_GetNamespaceAt
(
path
,
0
,
&
len
,
buf
);
...
...
@@ -640,6 +715,7 @@ START_TEST (path)
test_IWbemPath_SetServer
();
test_IWbemPath_GetNamespaceAt
();
test_IWbemPath_RemoveAllNamespaces
();
test_IWbemPath_RemoveNamespaceAt
();
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