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
42825cdc
Commit
42825cdc
authored
Feb 22, 2015
by
Thomas Faber
Committed by
Alexandre Julliard
Feb 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wbemprox: Allocate a large enough buffer in get_computername.
parent
17c91f60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
1 deletion
+52
-1
builtin.c
dlls/wbemprox/builtin.c
+1
-1
query.c
dlls/wbemprox/tests/query.c
+51
-0
No files found.
dlls/wbemprox/builtin.c
View file @
42825cdc
...
...
@@ -1121,7 +1121,7 @@ static UINT64 get_total_physical_memory(void)
static
WCHAR
*
get_computername
(
void
)
{
WCHAR
*
ret
;
DWORD
size
=
MAX_COMPUTERNAME_LENGTH
;
DWORD
size
=
MAX_COMPUTERNAME_LENGTH
+
1
;
if
(
!
(
ret
=
heap_alloc
(
size
*
sizeof
(
WCHAR
)
)))
return
NULL
;
GetComputerNameW
(
ret
,
&
size
);
...
...
dlls/wbemprox/tests/query.c
View file @
42825cdc
...
...
@@ -341,6 +341,56 @@ static void test_Win32_Process( IWbemServices *services )
IWbemClassObject_Release
(
out
);
}
static
void
test_Win32_ComputerSystem
(
IWbemServices
*
services
)
{
static
const
WCHAR
nameW
[]
=
{
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
queryW
[]
=
{
'S'
,
'E'
,
'L'
,
'E'
,
'C'
,
'T'
,
' '
,
'*'
,
' '
,
'F'
,
'R'
,
'O'
,
'M'
,
' '
,
'W'
,
'i'
,
'n'
,
'3'
,
'2'
,
'_'
,
'C'
,
'o'
,
'm'
,
'p'
,
'u'
,
't'
,
'e'
,
'r'
,
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
BSTR
wql
=
SysAllocString
(
wqlW
),
query
=
SysAllocString
(
queryW
);
IEnumWbemClassObject
*
result
;
IWbemClassObject
*
service
;
VARIANT
value
;
CIMTYPE
type
;
HRESULT
hr
;
WCHAR
compname
[
MAX_COMPUTERNAME_LENGTH
+
1
];
DWORD
len
,
count
;
len
=
sizeof
(
compname
)
/
sizeof
(
compname
[
0
]);
if
(
!
GetComputerNameW
(
compname
,
&
len
))
compname
[
0
]
=
0
;
if
(
!
compname
[
0
])
{
skip
(
"Failed to get computer name
\n
"
);
return
;
}
hr
=
IWbemServices_ExecQuery
(
services
,
wql
,
query
,
0
,
NULL
,
&
result
);
if
(
hr
!=
S_OK
)
{
win_skip
(
"Win32_ComputerSystem not available
\n
"
);
return
;
}
IEnumWbemClassObject_Next
(
result
,
10000
,
1
,
&
service
,
&
count
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
type
=
0xdeadbeef
;
VariantInit
(
&
value
);
hr
=
IWbemClassObject_Get
(
service
,
nameW
,
0
,
&
value
,
&
type
,
NULL
);
ok
(
hr
==
S_OK
,
"failed to get computer name %08x
\n
"
,
hr
);
ok
(
V_VT
(
&
value
)
==
VT_BSTR
,
"unexpected variant type 0x%x
\n
"
,
V_VT
(
&
value
)
);
ok
(
type
==
CIM_STRING
,
"unexpected type 0x%x
\n
"
,
type
);
ok
(
!
lstrcmpiW
(
V_BSTR
(
&
value
),
compname
),
"got %s, expected %s
\n
"
,
wine_dbgstr_w
(
V_BSTR
(
&
value
)),
wine_dbgstr_w
(
compname
)
);
VariantClear
(
&
value
);
IWbemClassObject_Release
(
service
);
IEnumWbemClassObject_Release
(
result
);
SysFreeString
(
query
);
SysFreeString
(
wql
);
}
static
void
test_StdRegProv
(
IWbemServices
*
services
)
{
static
const
WCHAR
enumkeyW
[]
=
{
'E'
,
'n'
,
'u'
,
'm'
,
'K'
,
'e'
,
'y'
,
0
};
...
...
@@ -756,6 +806,7 @@ START_TEST(query)
test_select
(
services
);
test_Win32_Process
(
services
);
test_Win32_Service
(
services
);
test_Win32_ComputerSystem
(
services
);
test_StdRegProv
(
services
);
test_notification_query_async
(
services
);
test_query_async
(
services
);
...
...
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