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
6e0b07e8
Commit
6e0b07e8
authored
Apr 24, 2024
by
Alex Henrie
Committed by
Alexandre Julliard
Apr 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Don't set RequiredSize when SetupDiGetClassDescription* fails.
Discovered while investigating Bug 56551.
parent
987695a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
devinst.c
dlls/setupapi/devinst.c
+10
-10
devinst.c
dlls/setupapi/tests/devinst.c
+18
-0
No files found.
dlls/setupapi/devinst.c
View file @
6e0b07e8
...
@@ -2119,7 +2119,7 @@ BOOL WINAPI SetupDiGetClassDescriptionExA(
...
@@ -2119,7 +2119,7 @@ BOOL WINAPI SetupDiGetClassDescriptionExA(
{
{
HKEY
hKey
;
HKEY
hKey
;
DWORD
dwLength
;
DWORD
dwLength
;
BOOL
ret
;
LSTATUS
ls
;
hKey
=
SetupDiOpenClassRegKeyExA
(
ClassGuid
,
hKey
=
SetupDiOpenClassRegKeyExA
(
ClassGuid
,
KEY_ALL_ACCESS
,
KEY_ALL_ACCESS
,
...
@@ -2133,11 +2133,11 @@ BOOL WINAPI SetupDiGetClassDescriptionExA(
...
@@ -2133,11 +2133,11 @@ BOOL WINAPI SetupDiGetClassDescriptionExA(
}
}
dwLength
=
ClassDescriptionSize
;
dwLength
=
ClassDescriptionSize
;
ret
=
!
RegQueryValueExA
(
hKey
,
NULL
,
NULL
,
NULL
,
ls
=
RegQueryValueExA
(
hKey
,
NULL
,
NULL
,
NULL
,
(
BYTE
*
)
ClassDescription
,
&
dwLength
);
(
LPBYTE
)
ClassDescription
,
&
dwLength
);
if
(
RequiredSize
)
*
RequiredSize
=
dwLength
;
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
return
ret
;
if
((
!
ls
||
ls
==
ERROR_MORE_DATA
)
&&
RequiredSize
)
*
RequiredSize
=
dwLength
;
return
!
ls
;
}
}
/***********************************************************************
/***********************************************************************
...
@@ -2153,7 +2153,7 @@ BOOL WINAPI SetupDiGetClassDescriptionExW(
...
@@ -2153,7 +2153,7 @@ BOOL WINAPI SetupDiGetClassDescriptionExW(
{
{
HKEY
hKey
;
HKEY
hKey
;
DWORD
dwLength
;
DWORD
dwLength
;
BOOL
ret
;
LSTATUS
ls
;
hKey
=
SetupDiOpenClassRegKeyExW
(
ClassGuid
,
hKey
=
SetupDiOpenClassRegKeyExW
(
ClassGuid
,
KEY_ALL_ACCESS
,
KEY_ALL_ACCESS
,
...
@@ -2167,11 +2167,11 @@ BOOL WINAPI SetupDiGetClassDescriptionExW(
...
@@ -2167,11 +2167,11 @@ BOOL WINAPI SetupDiGetClassDescriptionExW(
}
}
dwLength
=
ClassDescriptionSize
*
sizeof
(
WCHAR
);
dwLength
=
ClassDescriptionSize
*
sizeof
(
WCHAR
);
ret
=
!
RegQueryValueExW
(
hKey
,
NULL
,
NULL
,
NULL
,
ls
=
RegQueryValueExW
(
hKey
,
NULL
,
NULL
,
NULL
,
(
BYTE
*
)
ClassDescription
,
&
dwLength
);
(
LPBYTE
)
ClassDescription
,
&
dwLength
);
if
(
RequiredSize
)
*
RequiredSize
=
dwLength
/
sizeof
(
WCHAR
);
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
return
ret
;
if
((
!
ls
||
ls
==
ERROR_MORE_DATA
)
&&
RequiredSize
)
*
RequiredSize
=
dwLength
/
sizeof
(
WCHAR
);
return
!
ls
;
}
}
/***********************************************************************
/***********************************************************************
...
...
dlls/setupapi/tests/devinst.c
View file @
6e0b07e8
...
@@ -162,6 +162,8 @@ static void test_install_class(void)
...
@@ -162,6 +162,8 @@ static void test_install_class(void)
'1'
,
'1'
,
'd'
,
'b'
,
'-'
,
'b'
,
'7'
,
'0'
,
'4'
,
'-'
,
'1'
,
'1'
,
'd'
,
'b'
,
'-'
,
'b'
,
'7'
,
'0'
,
'4'
,
'-'
,
'0'
,
'0'
,
'1'
,
'1'
,
'9'
,
'5'
,
'5'
,
'c'
,
'2'
,
'b'
,
'd'
,
'b'
,
'}'
,
0
};
'0'
,
'0'
,
'1'
,
'1'
,
'9'
,
'5'
,
'5'
,
'c'
,
'2'
,
'b'
,
'd'
,
'b'
,
'}'
,
0
};
char
tmpfile
[
MAX_PATH
];
char
tmpfile
[
MAX_PATH
];
char
buf
[
32
];
DWORD
size
;
BOOL
ret
;
BOOL
ret
;
static
const
char
inf_data
[]
=
static
const
char
inf_data
[]
=
...
@@ -195,12 +197,28 @@ static void test_install_class(void)
...
@@ -195,12 +197,28 @@ static void test_install_class(void)
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Got unexpected error %#lx.
\n
"
,
GetLastError
());
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"Got unexpected error %#lx.
\n
"
,
GetLastError
());
size
=
123
;
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetClassDescriptionA
(
&
guid
,
buf
,
sizeof
(
buf
),
&
size
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
size
==
123
,
"Expected 123, got %ld.
\n
"
,
size
);
todo_wine
ok
(
GetLastError
()
==
ERROR_NOT_FOUND
/* win7 */
||
GetLastError
()
==
ERROR_INVALID_CLASS
/* win10 */
,
"Got unexpected error %#lx.
\n
"
,
GetLastError
());
/* The next call will succeed. Information is put into the registry but the
/* The next call will succeed. Information is put into the registry but the
* location(s) is/are depending on the Windows version.
* location(s) is/are depending on the Windows version.
*/
*/
ret
=
SetupDiInstallClassA
(
NULL
,
tmpfile
,
0
,
NULL
);
ret
=
SetupDiInstallClassA
(
NULL
,
tmpfile
,
0
,
NULL
);
ok
(
ret
,
"Failed to install class, error %#lx.
\n
"
,
GetLastError
());
ok
(
ret
,
"Failed to install class, error %#lx.
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetClassDescriptionA
(
&
guid
,
buf
,
sizeof
(
buf
),
&
size
);
ok
(
ret
==
TRUE
,
"Failed to get class description.
\n
"
);
ok
(
size
==
sizeof
(
"Wine test devices"
),
"Expected %Iu, got %lu.
\n
"
,
sizeof
(
"Wine test devices"
),
size
);
ok
(
!
strcmp
(
buf
,
"Wine test devices"
),
"Got unexpected class description %s.
\n
"
,
debugstr_a
(
buf
));
todo_wine
ok
(
!
GetLastError
(),
"Got unexpected error %#lx.
\n
"
,
GetLastError
());
ret
=
RegDeleteKeyW
(
HKEY_LOCAL_MACHINE
,
classKey
);
ret
=
RegDeleteKeyW
(
HKEY_LOCAL_MACHINE
,
classKey
);
ok
(
!
ret
,
"Failed to delete class key, error %lu.
\n
"
,
GetLastError
());
ok
(
!
ret
,
"Failed to delete class key, error %lu.
\n
"
,
GetLastError
());
DeleteFileA
(
tmpfile
);
DeleteFileA
(
tmpfile
);
...
...
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