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
4fe3d7e2
Commit
4fe3d7e2
authored
Nov 18, 2019
by
Zhiyi Zhang
Committed by
Alexandre Julliard
Nov 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi/tests: Add default device registry property tests.
Signed-off-by:
Zhiyi Zhang
<
zzhang@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
177d6d7f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
115 additions
and
2 deletions
+115
-2
devinst.c
dlls/setupapi/tests/devinst.c
+115
-2
No files found.
dlls/setupapi/tests/devinst.c
View file @
4fe3d7e2
...
...
@@ -27,6 +27,7 @@
#include "winuser.h"
#include "winreg.h"
#include "initguid.h"
#include "devguid.h"
#include "devpkey.h"
#include "setupapi.h"
#include "cfgmgr32.h"
...
...
@@ -1496,7 +1497,7 @@ static void test_registry_property_a(void)
{
static
const
CHAR
bogus
[]
=
"System
\\
CurrentControlSet
\\
Enum
\\
Root
\\
LEGACY_BOGUS"
;
SP_DEVINFO_DATA
device
=
{
sizeof
(
device
)};
CHAR
buf
[
6
]
=
""
;
CHAR
buf
[
6
4
]
=
""
;
DWORD
size
,
type
;
HDEVINFO
set
;
BOOL
ret
;
...
...
@@ -1590,13 +1591,69 @@ todo_wine {
res
=
RegOpenKeyA
(
HKEY_LOCAL_MACHINE
,
bogus
,
&
key
);
ok
(
res
==
ERROR_FILE_NOT_FOUND
,
"Key should not exist.
\n
"
);
/* Test existing registry properties right after device creation */
set
=
SetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"Failed to create device list, error %#x.
\n
"
,
GetLastError
());
/* Create device from a not registered class without device name */
ret
=
SetupDiCreateDeviceInfoA
(
set
,
"LEGACY_BOGUS"
,
&
guid
,
NULL
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* No SPDRP_DEVICEDESC property */
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetDeviceRegistryPropertyA
(
set
,
&
device
,
SPDRP_DEVICEDESC
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"Got unexpected error %#x.
\n
"
,
GetLastError
());
/* No SPDRP_CLASS property */
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetDeviceRegistryPropertyA
(
set
,
&
device
,
SPDRP_CLASS
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"Got unexpected error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_CLASSGUID property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyA
(
set
,
&
device
,
SPDRP_CLASSGUID
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiA
(
buf
,
"{6a55b5a4-3f65-11db-b704-0011955c2bdb}"
),
"Got unexpected value %s.
\n
"
,
buf
);
ret
=
SetupDiDeleteDeviceInfo
(
set
,
&
device
);
ok
(
ret
,
"Failed to delete device, error %#x.
\n
"
,
GetLastError
());
/* Create device from a not registered class with a device name */
ret
=
SetupDiCreateDeviceInfoA
(
set
,
"LEGACY_BOGUS"
,
&
guid
,
"device_name"
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_DEVICEDESC property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyA
(
set
,
&
device
,
SPDRP_DEVICEDESC
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
ok
(
!
lstrcmpA
(
buf
,
"device_name"
),
"Got unexpected value %s.
\n
"
,
buf
);
SetupDiDestroyDeviceInfoList
(
set
);
/* Create device from a registered class */
set
=
SetupDiCreateDeviceInfoList
(
&
GUID_DEVCLASS_DISPLAY
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"Failed to create device list, error %#x.
\n
"
,
GetLastError
());
ret
=
SetupDiCreateDeviceInfoA
(
set
,
"display"
,
&
GUID_DEVCLASS_DISPLAY
,
NULL
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_CLASS property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyA
(
set
,
&
device
,
SPDRP_CLASS
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
todo_wine
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
todo_wine
ok
(
!
lstrcmpA
(
buf
,
"Display"
),
"Got unexpected value %s.
\n
"
,
buf
);
SetupDiDestroyDeviceInfoList
(
set
);
}
static
void
test_registry_property_w
(
void
)
{
WCHAR
friendly_name
[]
=
{
'B'
,
'o'
,
'g'
,
'u'
,
's'
,
0
};
SP_DEVINFO_DATA
device
=
{
sizeof
(
device
)};
WCHAR
buf
[
6
]
=
{
0
};
WCHAR
buf
[
6
4
]
=
{
0
};
DWORD
size
,
type
;
HDEVINFO
set
;
BOOL
ret
;
...
...
@@ -1694,6 +1751,62 @@ todo_wine {
res
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
bogus
,
&
key
);
ok
(
res
==
ERROR_FILE_NOT_FOUND
,
"Key should not exist.
\n
"
);
/* Test existing registry properties right after device creation */
set
=
SetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"Failed to create device list, error %#x.
\n
"
,
GetLastError
());
/* Create device from a not registered class without device name */
ret
=
SetupDiCreateDeviceInfoW
(
set
,
L"LEGACY_BOGUS"
,
&
guid
,
NULL
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* No SPDRP_DEVICEDESC property */
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetDeviceRegistryPropertyW
(
set
,
&
device
,
SPDRP_DEVICEDESC
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"Got unexpected error %#x.
\n
"
,
GetLastError
());
/* No SPDRP_CLASS property */
SetLastError
(
0xdeadbeef
);
ret
=
SetupDiGetDeviceRegistryPropertyW
(
set
,
&
device
,
SPDRP_CLASS
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
!
ret
,
"Expected failure.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_DATA
,
"Got unexpected error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_CLASSGUID property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyW
(
set
,
&
device
,
SPDRP_CLASSGUID
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
ok
(
!
lstrcmpiW
(
buf
,
L"{6a55b5a4-3f65-11db-b704-0011955c2bdb}"
),
"Got unexpected value %s.
\n
"
,
wine_dbgstr_w
(
buf
));
ret
=
SetupDiDeleteDeviceInfo
(
set
,
&
device
);
ok
(
ret
,
"Failed to delete device, error %#x.
\n
"
,
GetLastError
());
/* Create device from a not registered class with a device name */
ret
=
SetupDiCreateDeviceInfoW
(
set
,
L"LEGACY_BOGUS"
,
&
guid
,
L"device_name"
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_DEVICEDESC property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyW
(
set
,
&
device
,
SPDRP_DEVICEDESC
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
ok
(
!
lstrcmpW
(
buf
,
L"device_name"
),
"Got unexpected value %s.
\n
"
,
wine_dbgstr_w
(
buf
));
SetupDiDestroyDeviceInfoList
(
set
);
/* Create device from a registered class */
set
=
SetupDiCreateDeviceInfoList
(
&
GUID_DEVCLASS_DISPLAY
,
NULL
);
ok
(
set
!=
INVALID_HANDLE_VALUE
,
"Failed to create device list, error %#x.
\n
"
,
GetLastError
());
ret
=
SetupDiCreateDeviceInfoW
(
set
,
L"display"
,
&
GUID_DEVCLASS_DISPLAY
,
NULL
,
NULL
,
DICD_GENERATE_ID
,
&
device
);
ok
(
ret
,
"Failed to create device, error %#x.
\n
"
,
GetLastError
());
/* Have SPDRP_CLASS property */
memset
(
buf
,
0
,
sizeof
(
buf
));
ret
=
SetupDiGetDeviceRegistryPropertyW
(
set
,
&
device
,
SPDRP_CLASS
,
NULL
,
(
BYTE
*
)
buf
,
sizeof
(
buf
),
NULL
);
todo_wine
ok
(
ret
,
"Failed to get property, error %#x.
\n
"
,
GetLastError
());
todo_wine
ok
(
!
lstrcmpW
(
buf
,
L"Display"
),
"Got unexpected value %s.
\n
"
,
wine_dbgstr_w
(
buf
));
SetupDiDestroyDeviceInfoList
(
set
);
}
static
void
test_get_inf_class
(
void
)
...
...
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