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
a57a17d3
Commit
a57a17d3
authored
Sep 20, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Sep 21, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Add tests for SetupDiRegisterDeviceInfo.
parent
3a2a9947
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
0 deletions
+65
-0
devinst.c
dlls/setupapi/tests/devinst.c
+65
-0
No files found.
dlls/setupapi/tests/devinst.c
View file @
a57a17d3
...
@@ -40,6 +40,7 @@ static BOOL (WINAPI *pSetupDiEnumDeviceInfo)(HDEVINFO, DWORD, PSP_DEVINFO_DA
...
@@ -40,6 +40,7 @@ static BOOL (WINAPI *pSetupDiEnumDeviceInfo)(HDEVINFO, DWORD, PSP_DEVINFO_DA
static
HKEY
(
WINAPI
*
pSetupDiOpenClassRegKeyExA
)(
GUID
*
,
REGSAM
,
DWORD
,
PCSTR
,
PVOID
);
static
HKEY
(
WINAPI
*
pSetupDiOpenClassRegKeyExA
)(
GUID
*
,
REGSAM
,
DWORD
,
PCSTR
,
PVOID
);
static
BOOL
(
WINAPI
*
pSetupDiCreateDeviceInfoA
)(
HDEVINFO
,
PCSTR
,
GUID
*
,
PCSTR
,
HWND
,
DWORD
,
PSP_DEVINFO_DATA
);
static
BOOL
(
WINAPI
*
pSetupDiCreateDeviceInfoA
)(
HDEVINFO
,
PCSTR
,
GUID
*
,
PCSTR
,
HWND
,
DWORD
,
PSP_DEVINFO_DATA
);
static
BOOL
(
WINAPI
*
pSetupDiGetDeviceInstanceIdA
)(
HDEVINFO
,
PSP_DEVINFO_DATA
,
PSTR
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pSetupDiGetDeviceInstanceIdA
)(
HDEVINFO
,
PSP_DEVINFO_DATA
,
PSTR
,
DWORD
,
PDWORD
);
static
BOOL
(
WINAPI
*
pSetupDiRegisterDeviceInfo
)(
HDEVINFO
,
PSP_DEVINFO_DATA
,
DWORD
,
PSP_DETSIG_CMPPROC
,
PVOID
,
PSP_DEVINFO_DATA
);
static
void
init_function_pointers
(
void
)
static
void
init_function_pointers
(
void
)
{
{
...
@@ -52,6 +53,7 @@ static void init_function_pointers(void)
...
@@ -52,6 +53,7 @@ static void init_function_pointers(void)
pSetupDiEnumDeviceInfo
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiEnumDeviceInfo"
);
pSetupDiEnumDeviceInfo
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiEnumDeviceInfo"
);
pSetupDiGetDeviceInstanceIdA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiGetDeviceInstanceIdA"
);
pSetupDiGetDeviceInstanceIdA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiGetDeviceInstanceIdA"
);
pSetupDiOpenClassRegKeyExA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiOpenClassRegKeyExA"
);
pSetupDiOpenClassRegKeyExA
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiOpenClassRegKeyExA"
);
pSetupDiRegisterDeviceInfo
=
(
void
*
)
GetProcAddress
(
hSetupAPI
,
"SetupDiRegisterDeviceInfo"
);
}
}
static
void
test_SetupDiCreateDeviceInfoListEx
(
void
)
static
void
test_SetupDiCreateDeviceInfoListEx
(
void
)
...
@@ -272,6 +274,68 @@ static void testGetDeviceInstanceId(void)
...
@@ -272,6 +274,68 @@ static void testGetDeviceInstanceId(void)
}
}
}
}
static
void
testRegisterDeviceInfo
(
void
)
{
BOOL
ret
;
GUID
guid
=
{
0x6a55b5a4
,
0x3f65
,
0x11db
,
{
0xb7
,
0x04
,
0x00
,
0x11
,
0x95
,
0x5c
,
0x2b
,
0xdb
}};
HDEVINFO
set
;
if
(
!
pSetupDiCreateDeviceInfoList
||
!
pSetupDiDestroyDeviceInfoList
||
!
pSetupDiRegisterDeviceInfo
)
{
skip
(
"No SetupDiRegisterDeviceInfo
\n
"
);
return
;
}
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiRegisterDeviceInfo
(
NULL
,
NULL
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLE, got %d
\n
"
,
GetLastError
());
ret
=
pSetupDiRegisterDeviceInfo
(
NULL
,
NULL
,
0
,
NULL
,
NULL
,
NULL
);
set
=
pSetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
ok
(
set
!=
NULL
,
"SetupDiCreateDeviceInfoList failed: %d
\n
"
,
GetLastError
());
if
(
set
)
{
SP_DEVINFO_DATA
devInfo
=
{
0
};
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiRegisterDeviceInfo
(
set
,
NULL
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiRegisterDeviceInfo
(
set
,
&
devInfo
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
devInfo
.
cbSize
=
sizeof
(
devInfo
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiRegisterDeviceInfo
(
set
,
&
devInfo
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ret
=
pSetupDiCreateDeviceInfoA
(
set
,
"USB
\\
BOGUS
\\
0000"
,
&
guid
,
NULL
,
NULL
,
0
,
&
devInfo
);
ok
(
ret
||
GetLastError
()
==
ERROR_DEVINST_ALREADY_EXISTS
,
"SetupDiCreateDeviceInfoA failed: %d
\n
"
,
GetLastError
());
if
(
ret
)
{
/* If it already existed, registering it again will fail */
ret
=
pSetupDiRegisterDeviceInfo
(
set
,
&
devInfo
,
0
,
NULL
,
NULL
,
NULL
);
todo_wine
ok
(
ret
,
"SetupDiCreateDeviceInfoA failed: %d
\n
"
,
GetLastError
());
}
/* FIXME: On Win2K+ systems, this is now persisted to registry in
* HKLM\System\CCS\Enum\USB\Bogus\0000. I don't check because the
* Win9x location is different.
* FIXME: the key also becomes undeletable. How to get rid of it?
*/
pSetupDiDestroyDeviceInfoList
(
set
);
}
}
START_TEST
(
devinst
)
START_TEST
(
devinst
)
{
{
init_function_pointers
();
init_function_pointers
();
...
@@ -287,4 +351,5 @@ START_TEST(devinst)
...
@@ -287,4 +351,5 @@ START_TEST(devinst)
skip
(
"SetupDiOpenClassRegKeyExA is not available
\n
"
);
skip
(
"SetupDiOpenClassRegKeyExA is not available
\n
"
);
testCreateDeviceInfo
();
testCreateDeviceInfo
();
testGetDeviceInstanceId
();
testGetDeviceInstanceId
();
testRegisterDeviceInfo
();
}
}
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