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
0199a943
Commit
0199a943
authored
Jan 02, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Jan 02, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmiutils: Support more flags in IWbemPath::GetText.
parent
38434826
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
179 additions
and
9 deletions
+179
-9
path.c
dlls/wmiutils/path.c
+169
-9
wmiutils_private.h
dlls/wmiutils/wmiutils_private.h
+10
-0
No files found.
dlls/wmiutils/path.c
View file @
0199a943
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include "wmiutils.h"
#include "wmiutils.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wmiutils_private.h"
#include "wmiutils_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
wmiutils
);
WINE_DEFAULT_DEBUG_CHANNEL
(
wmiutils
);
...
@@ -211,6 +210,163 @@ static HRESULT WINAPI path_SetText(
...
@@ -211,6 +210,163 @@ static HRESULT WINAPI path_SetText(
return
S_OK
;
return
S_OK
;
}
}
static
WCHAR
*
build_namespace
(
struct
path
*
path
,
int
*
len
)
{
WCHAR
*
ret
,
*
p
;
int
i
;
*
len
=
0
;
for
(
i
=
0
;
i
<
path
->
num_namespaces
;
i
++
)
{
if
(
i
>
0
)
*
len
+=
1
;
*
len
+=
path
->
len_namespaces
[
i
];
}
if
(
!
(
p
=
ret
=
heap_alloc
(
(
*
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
for
(
i
=
0
;
i
<
path
->
num_namespaces
;
i
++
)
{
if
(
i
>
0
)
*
p
++
=
'\\'
;
memcpy
(
p
,
path
->
namespaces
[
i
],
path
->
len_namespaces
[
i
]
*
sizeof
(
WCHAR
)
);
p
+=
path
->
len_namespaces
[
i
];
}
*
p
=
0
;
return
ret
;
}
static
WCHAR
*
build_server
(
struct
path
*
path
,
int
*
len
)
{
WCHAR
*
ret
,
*
p
;
*
len
=
0
;
if
(
path
->
server
)
*
len
+=
2
+
path
->
len_server
;
else
*
len
+=
4
;
if
(
!
(
p
=
ret
=
heap_alloc
(
(
*
len
+
1
)
*
sizeof
(
WCHAR
)
)))
return
NULL
;
if
(
path
->
server
)
{
p
[
0
]
=
p
[
1
]
=
'\\'
;
strcpyW
(
p
+
2
,
path
->
server
);
}
else
{
p
[
0
]
=
p
[
1
]
=
p
[
3
]
=
'\\'
;
p
[
2
]
=
'.'
;
}
return
ret
;
}
static
WCHAR
*
build_path
(
struct
path
*
path
,
LONG
flags
,
int
*
len
)
{
switch
(
flags
)
{
case
0
:
{
int
len_namespace
;
WCHAR
*
ret
,
*
namespace
=
build_namespace
(
path
,
&
len_namespace
);
if
(
!
namespace
)
return
NULL
;
*
len
=
len_namespace
;
if
(
path
->
class
)
*
len
+=
1
+
path
->
len_class
;
if
(
!
(
ret
=
heap_alloc
(
(
*
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
heap_free
(
namespace
);
return
NULL
;
}
strcpyW
(
ret
,
namespace
);
if
(
path
->
class
)
{
ret
[
len_namespace
]
=
':'
;
strcpyW
(
ret
+
len_namespace
+
1
,
path
->
class
);
}
heap_free
(
namespace
);
return
ret
;
}
case
WBEMPATH_GET_RELATIVE_ONLY
:
if
(
!
path
->
class
)
{
*
len
=
0
;
return
NULL
;
}
*
len
=
path
->
len_class
;
return
strdupW
(
path
->
class
);
case
WBEMPATH_GET_SERVER_TOO
:
{
int
len_namespace
,
len_server
;
WCHAR
*
p
,
*
ret
,
*
namespace
=
build_namespace
(
path
,
&
len_namespace
);
WCHAR
*
server
=
build_server
(
path
,
&
len_server
);
if
(
!
namespace
||
!
server
)
{
heap_free
(
namespace
);
heap_free
(
server
);
return
NULL
;
}
*
len
=
len_namespace
+
len_server
;
if
(
path
->
class
)
*
len
+=
1
+
path
->
len_class
;
if
(
!
(
p
=
ret
=
heap_alloc
(
(
*
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
heap_free
(
namespace
);
heap_free
(
server
);
return
NULL
;
}
strcpyW
(
p
,
server
);
p
+=
len_server
;
strcpyW
(
p
,
namespace
);
p
+=
len_namespace
;
if
(
path
->
class
)
{
*
p
=
':'
;
strcpyW
(
p
+
1
,
path
->
class
);
}
heap_free
(
namespace
);
heap_free
(
server
);
return
ret
;
}
case
WBEMPATH_GET_SERVER_AND_NAMESPACE_ONLY
:
{
int
len_namespace
,
len_server
;
WCHAR
*
p
,
*
ret
,
*
namespace
=
build_namespace
(
path
,
&
len_namespace
);
WCHAR
*
server
=
build_server
(
path
,
&
len_server
);
if
(
!
namespace
||
!
server
)
{
heap_free
(
namespace
);
heap_free
(
server
);
return
NULL
;
}
*
len
=
len_namespace
+
len_server
;
if
(
!
(
p
=
ret
=
heap_alloc
(
(
*
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
heap_free
(
namespace
);
heap_free
(
server
);
return
NULL
;
}
strcpyW
(
p
,
server
);
p
+=
len_server
;
strcpyW
(
p
,
namespace
);
heap_free
(
namespace
);
heap_free
(
server
);
return
ret
;
}
case
WBEMPATH_GET_NAMESPACE_ONLY
:
return
build_namespace
(
path
,
len
);
case
WBEMPATH_GET_ORIGINAL
:
if
(
!
path
->
text
)
{
*
len
=
0
;
return
NULL
;
}
*
len
=
path
->
len_text
;
return
strdupW
(
path
->
text
);
default:
ERR
(
"unhandled flags 0x%x
\n
"
,
flags
);
return
NULL
;
}
}
static
HRESULT
WINAPI
path_GetText
(
static
HRESULT
WINAPI
path_GetText
(
IWbemPath
*
iface
,
IWbemPath
*
iface
,
LONG
lFlags
,
LONG
lFlags
,
...
@@ -218,23 +374,27 @@ static HRESULT WINAPI path_GetText(
...
@@ -218,23 +374,27 @@ static HRESULT WINAPI path_GetText(
LPWSTR
pszText
)
LPWSTR
pszText
)
{
{
struct
path
*
path
=
impl_from_IWbemPath
(
iface
);
struct
path
*
path
=
impl_from_IWbemPath
(
iface
);
WCHAR
*
str
;
int
len
;
TRACE
(
"%p, 0x%x, %p, %p
\n
"
,
iface
,
lFlags
,
puBufferLength
,
pszText
);
TRACE
(
"%p, 0x%x, %p, %p
\n
"
,
iface
,
lFlags
,
puBufferLength
,
pszText
);
if
(
!
puBufferLength
||
!
pszText
)
return
WBEM_E_INVALID_PARAMETER
;
if
(
!
puBufferLength
||
!
pszText
)
return
WBEM_E_INVALID_PARAMETER
;
if
(
lFlags
!=
WBEMPATH_GET_ORIGINAL
)
str
=
build_path
(
path
,
lFlags
,
&
len
);
if
(
*
puBufferLength
<
len
+
1
)
{
{
FIXME
(
"flags 0x%x not supported
\n
"
,
lFlags
)
;
*
puBufferLength
=
len
+
1
;
return
WBEM_E_INVALID_PARAMETER
;
return
S_OK
;
}
}
if
(
*
puBufferLength
<
path
->
len_text
+
1
)
if
(
pszText
)
{
{
*
puBufferLength
=
path
->
len_text
+
1
;
if
(
str
)
strcpyW
(
pszText
,
str
)
;
return
S_OK
;
else
pszText
[
0
]
=
0
;
}
}
if
(
pszText
)
strcpyW
(
pszText
,
path
->
text
)
;
*
puBufferLength
=
len
+
1
;
*
puBufferLength
=
path
->
len_text
+
1
;
heap_free
(
str
)
;
return
S_OK
;
return
S_OK
;
}
}
...
...
dlls/wmiutils/wmiutils_private.h
View file @
0199a943
...
@@ -16,6 +16,8 @@
...
@@ -16,6 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
*/
#include "wine/unicode.h"
HRESULT
WbemPath_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
HRESULT
WbemPath_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
HRESULT
WbemStatusCodeText_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
HRESULT
WbemStatusCodeText_create
(
IUnknown
*
,
LPVOID
*
)
DECLSPEC_HIDDEN
;
...
@@ -29,3 +31,11 @@ static inline BOOL heap_free( void *mem )
...
@@ -29,3 +31,11 @@ static inline BOOL heap_free( void *mem )
{
{
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
return
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
}
}
static
inline
WCHAR
*
strdupW
(
const
WCHAR
*
src
)
{
WCHAR
*
dst
;
if
(
!
src
)
return
NULL
;
if
((
dst
=
heap_alloc
(
(
strlenW
(
src
)
+
1
)
*
sizeof
(
WCHAR
)
)))
strcpyW
(
dst
,
src
);
return
dst
;
}
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