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
f4597120
Commit
f4597120
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::SetNamespaceAt.
parent
9548eb79
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
125 additions
and
4 deletions
+125
-4
path.c
dlls/wmiutils/path.c
+44
-4
path.c
dlls/wmiutils/tests/path.c
+75
-0
wmiutils_private.h
dlls/wmiutils/wmiutils_private.h
+6
-0
No files found.
dlls/wmiutils/path.c
View file @
f4597120
...
...
@@ -500,11 +500,50 @@ static HRESULT WINAPI path_GetNamespaceCount(
static
HRESULT
WINAPI
path_SetNamespaceAt
(
IWbemPath
*
iface
,
ULONG
uInde
x
,
LPCWSTR
pszN
ame
)
ULONG
id
x
,
LPCWSTR
n
ame
)
{
FIXME
(
"%p, %u, %s
\n
"
,
iface
,
uIndex
,
debugstr_w
(
pszName
));
return
E_NOTIMPL
;
struct
path
*
path
=
impl_from_IWbemPath
(
iface
);
static
const
ULONGLONG
flags
=
WBEMPATH_INFO_V1_COMPLIANT
|
WBEMPATH_INFO_V2_COMPLIANT
|
WBEMPATH_INFO_CIM_COMPLIANT
;
int
i
,
*
tmp_len
;
WCHAR
**
tmp
,
*
new
;
DWORD
size
;
TRACE
(
"%p, %u, %s
\n
"
,
iface
,
idx
,
debugstr_w
(
name
));
if
(
idx
>
path
->
num_namespaces
||
!
name
)
return
WBEM_E_INVALID_PARAMETER
;
if
(
!
(
new
=
strdupW
(
name
)))
return
WBEM_E_OUT_OF_MEMORY
;
size
=
(
path
->
num_namespaces
+
1
)
*
sizeof
(
WCHAR
*
);
if
(
path
->
namespaces
)
tmp
=
heap_realloc
(
path
->
namespaces
,
size
);
else
tmp
=
heap_alloc
(
size
);
if
(
!
tmp
)
{
heap_free
(
new
);
return
WBEM_E_OUT_OF_MEMORY
;
}
path
->
namespaces
=
tmp
;
size
=
(
path
->
num_namespaces
+
1
)
*
sizeof
(
int
);
if
(
path
->
len_namespaces
)
tmp_len
=
heap_realloc
(
path
->
len_namespaces
,
size
);
else
tmp_len
=
heap_alloc
(
size
);
if
(
!
tmp_len
)
{
heap_free
(
new
);
return
WBEM_E_OUT_OF_MEMORY
;
}
path
->
len_namespaces
=
tmp_len
;
for
(
i
=
idx
;
i
<
path
->
num_namespaces
;
i
++
)
{
path
->
namespaces
[
i
+
1
]
=
path
->
namespaces
[
i
];
path
->
len_namespaces
[
i
+
1
]
=
path
->
len_namespaces
[
i
];
}
path
->
namespaces
[
idx
]
=
new
;
path
->
len_namespaces
[
idx
]
=
strlenW
(
new
);
path
->
num_namespaces
++
;
path
->
flags
|=
flags
;
return
S_OK
;
}
static
HRESULT
WINAPI
path_GetNamespaceAt
(
...
...
@@ -532,6 +571,7 @@ static HRESULT WINAPI path_RemoveNamespaceAt(
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
)
{
...
...
dlls/wmiutils/tests/path.c
View file @
f4597120
...
...
@@ -702,6 +702,80 @@ static void test_IWbemPath_RemoveNamespaceAt(void)
IWbemPath_Release
(
path
);
}
static
void
test_IWbemPath_SetNamespaceAt
(
void
)
{
static
const
ULONGLONG
expected_flags
=
WBEMPATH_INFO_ANON_LOCAL_MACHINE
|
WBEMPATH_INFO_V1_COMPLIANT
|
WBEMPATH_INFO_V2_COMPLIANT
|
WBEMPATH_INFO_CIM_COMPLIANT
|
WBEMPATH_INFO_SERVER_NAMESPACE_ONLY
;
static
const
WCHAR
rootW
[]
=
{
'r'
,
'o'
,
'o'
,
't'
,
0
};
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_SetNamespaceAt
(
path
,
0
,
NULL
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"got %08x
\n
"
,
hr
);
hr
=
IWbemPath_SetNamespaceAt
(
path
,
1
,
cimv2W
);
ok
(
hr
==
WBEM_E_INVALID_PARAMETER
,
"got %08x
\n
"
,
hr
);
hr
=
IWbemPath_SetNamespaceAt
(
path
,
0
,
cimv2W
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
count
=
0xdeadbeef
;
hr
=
IWbemPath_GetNamespaceCount
(
path
,
&
count
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
count
==
1
,
"got %u
\n
"
,
count
);
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
);
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_SetNamespaceAt
(
path
,
0
,
rootW
);
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
);
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
,
rootW
),
"unexpected buffer contents %s
\n
"
,
wine_dbgstr_w
(
buf
)
);
ok
(
len
==
lstrlenW
(
rootW
)
+
1
,
"unexpected length %u
\n
"
,
len
);
buf
[
0
]
=
0
;
len
=
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]);
hr
=
IWbemPath_GetNamespaceAt
(
path
,
1
,
&
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
);
IWbemPath_Release
(
path
);
}
START_TEST
(
path
)
{
CoInitialize
(
NULL
);
...
...
@@ -716,6 +790,7 @@ START_TEST (path)
test_IWbemPath_GetNamespaceAt
();
test_IWbemPath_RemoveAllNamespaces
();
test_IWbemPath_RemoveNamespaceAt
();
test_IWbemPath_SetNamespaceAt
();
CoUninitialize
();
}
dlls/wmiutils/wmiutils_private.h
View file @
f4597120
...
...
@@ -27,6 +27,12 @@ static inline void *heap_alloc( size_t len )
return
HeapAlloc
(
GetProcessHeap
(),
0
,
len
);
}
static
void
*
heap_realloc
(
void
*
mem
,
size_t
len
)
__WINE_ALLOC_SIZE
(
2
);
static
inline
void
*
heap_realloc
(
void
*
mem
,
size_t
len
)
{
return
HeapReAlloc
(
GetProcessHeap
(),
0
,
mem
,
len
);
}
static
inline
BOOL
heap_free
(
void
*
mem
)
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
...
...
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