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
4cc9ee7e
Commit
4cc9ee7e
authored
Feb 23, 2024
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 26, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Handle implicit property in object path.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=55619
parent
d2df3c2c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
15 deletions
+79
-15
services.c
dlls/wbemprox/services.c
+43
-11
table.c
dlls/wbemprox/table.c
+21
-0
query.c
dlls/wbemprox/tests/query.c
+12
-2
wbemprox_private.h
dlls/wbemprox/wbemprox_private.h
+3
-2
No files found.
dlls/wbemprox/services.c
View file @
4cc9ee7e
...
...
@@ -336,6 +336,14 @@ static HRESULT WINAPI wbem_services_QueryObjectSink(
return
WBEM_E_FAILED
;
}
void
free_path
(
struct
path
*
path
)
{
if
(
!
path
)
return
;
free
(
path
->
class
);
free
(
path
->
filter
);
free
(
path
);
}
HRESULT
parse_path
(
const
WCHAR
*
str
,
struct
path
**
ret
)
{
struct
path
*
path
;
...
...
@@ -391,7 +399,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
}
q
=
p
;
while
(
*
p
&&
*
p
!=
'.'
)
p
++
;
while
(
*
p
&&
*
p
!=
'.'
&&
*
p
!=
'='
)
p
++
;
len
=
p
-
q
;
if
(
!
(
path
->
class
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
...
...
@@ -411,26 +419,50 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
len
=
q
-
p
;
if
(
!
(
path
->
filter
=
malloc
(
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
free
(
path
->
class
);
free
(
path
);
free_path
(
path
);
return
E_OUTOFMEMORY
;
}
memcpy
(
path
->
filter
,
p
,
len
*
sizeof
(
WCHAR
)
);
path
->
filter
[
len
]
=
0
;
path
->
filter_len
=
len
;
}
else
if
(
p
[
0
]
==
'='
&&
p
[
1
])
{
WCHAR
*
key
;
UINT
len_key
;
while
(
*
q
)
q
++
;
len
=
q
-
p
;
if
(
!
(
key
=
get_first_key_property
(
WBEMPROX_NAMESPACE_CIMV2
,
path
->
class
)))
{
free_path
(
path
);
return
WBEM_E_INVALID_OBJECT_PATH
;
}
len_key
=
wcslen
(
key
);
if
(
!
(
path
->
filter
=
malloc
(
(
len
+
len_key
+
1
)
*
sizeof
(
WCHAR
)
)))
{
free
(
key
);
free_path
(
path
);
return
E_OUTOFMEMORY
;
}
wcscpy
(
path
->
filter
,
key
);
memcpy
(
path
->
filter
+
len_key
,
p
,
len
*
sizeof
(
WCHAR
)
);
path
->
filter_len
=
len
+
len_key
;
path
->
filter
[
path
->
filter_len
]
=
0
;
free
(
key
);
}
else
if
(
p
[
0
])
{
free_path
(
path
);
return
WBEM_E_INVALID_OBJECT_PATH
;
}
*
ret
=
path
;
return
S_OK
;
}
void
free_path
(
struct
path
*
path
)
{
if
(
!
path
)
return
;
free
(
path
->
class
);
free
(
path
->
filter
);
free
(
path
);
}
WCHAR
*
query_from_path
(
const
struct
path
*
path
)
{
static
const
WCHAR
selectW
[]
=
L"SELECT * FROM %s WHERE %s"
;
...
...
dlls/wbemprox/table.c
View file @
4cc9ee7e
...
...
@@ -449,3 +449,24 @@ BSTR get_method_name( enum wbm_namespace ns, const WCHAR *class, UINT index )
release_table
(
table
);
return
NULL
;
}
WCHAR
*
get_first_key_property
(
enum
wbm_namespace
ns
,
const
WCHAR
*
class
)
{
struct
table
*
table
;
WCHAR
*
ret
=
NULL
;
UINT
i
;
if
(
!
(
table
=
find_table
(
ns
,
class
)))
return
NULL
;
for
(
i
=
0
;
i
<
table
->
num_cols
;
i
++
)
{
if
(
table
->
columns
[
i
].
type
&
COL_FLAG_KEY
)
{
ret
=
wcsdup
(
table
->
columns
[
i
].
name
);
break
;
}
}
release_table
(
table
);
return
ret
;
}
dlls/wbemprox/tests/query.c
View file @
4cc9ee7e
...
...
@@ -2286,8 +2286,7 @@ static void test_SystemRestore( IWbemServices *services )
static
void
test_Win32_LogicalDisk
(
IWbemServices
*
services
)
{
BSTR
wql
=
SysAllocString
(
L"wql"
);
BSTR
query
=
SysAllocString
(
L"SELECT * FROM Win32_LogicalDisk"
);
BSTR
wql
=
SysAllocString
(
L"wql"
),
query
=
SysAllocString
(
L"SELECT * FROM Win32_LogicalDisk"
);
IEnumWbemClassObject
*
result
;
IWbemClassObject
*
obj
;
HRESULT
hr
;
...
...
@@ -2329,6 +2328,17 @@ static void test_Win32_LogicalDisk( IWbemServices *services )
IWbemClassObject_Release
(
obj
);
IEnumWbemClassObject_Release
(
result
);
SysFreeString
(
query
);
query
=
SysAllocString
(
L"Win32_LogicalDisk =
\"
C:
\"
"
);
hr
=
IWbemServices_GetObject
(
services
,
query
,
0
,
NULL
,
&
obj
,
NULL
);
ok
(
hr
==
WBEM_E_INVALID_OBJECT_PATH
,
"got %#lx
\n
"
,
hr
);
SysFreeString
(
query
);
query
=
SysAllocString
(
L"Win32_LogicalDisk=
\"
C:
\"
"
);
hr
=
IWbemServices_GetObject
(
services
,
query
,
0
,
NULL
,
&
obj
,
NULL
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
IWbemClassObject_Release
(
obj
);
SysFreeString
(
query
);
SysFreeString
(
wql
);
}
...
...
dlls/wbemprox/wbemprox_private.h
View file @
4cc9ee7e
...
...
@@ -241,8 +241,9 @@ VARTYPE to_vartype( CIMTYPE );
void
destroy_array
(
struct
array
*
,
CIMTYPE
);
BOOL
is_result_prop
(
const
struct
view
*
,
const
WCHAR
*
);
HRESULT
get_properties
(
const
struct
view
*
,
UINT
,
LONG
,
SAFEARRAY
**
);
HRESULT
get_object
(
enum
wbm_namespace
ns
,
const
WCHAR
*
,
IWbemClassObject
**
);
BSTR
get_method_name
(
enum
wbm_namespace
ns
,
const
WCHAR
*
,
UINT
);
HRESULT
get_object
(
enum
wbm_namespace
,
const
WCHAR
*
,
IWbemClassObject
**
);
BSTR
get_method_name
(
enum
wbm_namespace
,
const
WCHAR
*
,
UINT
);
WCHAR
*
get_first_key_property
(
enum
wbm_namespace
,
const
WCHAR
*
);
void
set_variant
(
VARTYPE
,
LONGLONG
,
void
*
,
VARIANT
*
);
HRESULT
create_signature
(
enum
wbm_namespace
ns
,
const
WCHAR
*
,
const
WCHAR
*
,
enum
param_direction
,
IWbemClassObject
**
);
...
...
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