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
f94f6367
Commit
f94f6367
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: Implement SetupDiGetDeviceInstanceIdW.
parent
83f05e79
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
18 deletions
+49
-18
devinst.c
dlls/setupapi/devinst.c
+49
-7
devinst.c
dlls/setupapi/tests/devinst.c
+0
-11
No files found.
dlls/setupapi/devinst.c
View file @
f94f6367
...
...
@@ -97,7 +97,10 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId)
devInfo
->
instanceId
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
instanceId
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
devInfo
->
instanceId
)
{
lstrcpyW
(
devInfo
->
instanceId
,
instanceId
);
struprW
(
devInfo
->
instanceId
);
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
devInfo
);
...
...
@@ -886,7 +889,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
SetLastError
(
ERROR_INVALID_DEVINST_NAME
);
else
{
static
const
WCHAR
newDeviceFmt
[]
=
{
'R'
,
'
o'
,
'o'
,
't
'
,
'\\'
,
'%'
,
's'
,
static
const
WCHAR
newDeviceFmt
[]
=
{
'R'
,
'
O'
,
'O'
,
'T
'
,
'\\'
,
'%'
,
's'
,
'\\'
,
'%'
,
'0'
,
'4'
,
'd'
,
0
};
DWORD
devId
;
...
...
@@ -938,7 +941,7 @@ BOOL WINAPI SetupDiCreateDeviceInfoW(
struct
DeviceInfo
*
devInfo
=
(
struct
DeviceInfo
*
)
set
->
devices
[
i
].
Reserved
;
if
(
!
lstrcmpW
(
DeviceName
,
devInfo
->
instanceId
))
if
(
!
lstrcmp
i
W
(
DeviceName
,
devInfo
->
instanceId
))
{
SetLastError
(
ERROR_DEVINST_ALREADY_EXISTS
);
ret
=
FALSE
;
...
...
@@ -1050,8 +1053,16 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdA(
if
(
!
len
)
ret
=
FALSE
;
else
if
(
RequiredSize
)
*
RequiredSize
=
len
;
else
{
if
(
len
>
DeviceInstanceIdSize
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
ret
=
FALSE
;
}
if
(
RequiredSize
)
*
RequiredSize
=
len
;
}
}
HeapFree
(
GetProcessHeap
(),
0
,
instanceId
);
}
...
...
@@ -1068,10 +1079,41 @@ BOOL WINAPI SetupDiGetDeviceInstanceIdW(
DWORD
DeviceInstanceIdSize
,
PDWORD
RequiredSize
)
{
FIXME
(
"%p %p %p %d %p
\n
"
,
DeviceInfoSet
,
DeviceInfoData
,
DeviceInstanceId
,
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
DeviceInfo
*
devInfo
;
TRACE
(
"%p %p %p %d %p
\n
"
,
DeviceInfoSet
,
DeviceInfoData
,
DeviceInstanceId
,
DeviceInstanceIdSize
,
RequiredSize
);
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
return
FALSE
;
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
INVALID_HANDLE_VALUE
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
set
->
magic
!=
SETUP_DEVICE_INFO_SET_MAGIC
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
!
DeviceInfoData
||
DeviceInfoData
->
cbSize
!=
sizeof
(
SP_DEVINFO_DATA
)
||
!
DeviceInfoData
->
Reserved
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
devInfo
=
(
struct
DeviceInfo
*
)
DeviceInfoData
->
Reserved
;
TRACE
(
"instance ID: %s
\n
"
,
debugstr_w
(
devInfo
->
instanceId
));
if
(
DeviceInstanceIdSize
<
lstrlenW
(
devInfo
->
instanceId
)
+
1
)
{
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
if
(
RequiredSize
)
*
RequiredSize
=
lstrlenW
(
devInfo
->
instanceId
)
+
1
;
return
FALSE
;
}
lstrcpyW
(
DeviceInstanceId
,
devInfo
->
instanceId
);
if
(
RequiredSize
)
*
RequiredSize
=
lstrlenW
(
devInfo
->
instanceId
)
+
1
;
return
TRUE
;
}
/***********************************************************************
...
...
dlls/setupapi/tests/devinst.c
View file @
f94f6367
...
...
@@ -217,12 +217,10 @@ static void testGetDeviceInstanceId(void)
}
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
NULL
,
NULL
,
NULL
,
0
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLEHANDLE, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
NULL
,
&
devInfo
,
NULL
,
0
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_HANDLE
,
"Expected ERROR_INVALID_HANDLEHANDLE, got %08x
\n
"
,
GetLastError
());
set
=
pSetupDiCreateDeviceInfoList
(
&
guid
,
NULL
);
...
...
@@ -235,23 +233,19 @@ static void testGetDeviceInstanceId(void)
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
NULL
,
NULL
,
0
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
NULL
,
0
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
NULL
,
0
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
devInfo
.
cbSize
=
sizeof
(
devInfo
);
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
NULL
,
0
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %08x
\n
"
,
GetLastError
());
ret
=
pSetupDiCreateDeviceInfoA
(
set
,
"Root
\\
LEGACY_BOGUS
\\
0000"
,
&
guid
,
...
...
@@ -259,14 +253,11 @@ static void testGetDeviceInstanceId(void)
ok
(
ret
,
"SetupDiCreateDeviceInfoA failed: %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
NULL
,
0
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %08x
\n
"
,
GetLastError
());
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
instanceID
,
sizeof
(
instanceID
),
NULL
);
todo_wine
ok
(
ret
,
"SetupDiGetDeviceInstanceIdA failed: %08x
\n
"
,
GetLastError
());
todo_wine
ok
(
!
lstrcmpA
(
instanceID
,
"ROOT
\\
LEGACY_BOGUS
\\
0000"
),
"Unexpected instance ID %s
\n
"
,
instanceID
);
ret
=
pSetupDiCreateDeviceInfoA
(
set
,
"LEGACY_BOGUS"
,
&
guid
,
...
...
@@ -274,9 +265,7 @@ static void testGetDeviceInstanceId(void)
ok
(
ret
,
"SetupDiCreateDeviceInfoA failed: %08x
\n
"
,
GetLastError
());
ret
=
pSetupDiGetDeviceInstanceIdA
(
set
,
&
devInfo
,
instanceID
,
sizeof
(
instanceID
),
NULL
);
todo_wine
ok
(
ret
,
"SetupDiGetDeviceInstanceIdA failed: %08x
\n
"
,
GetLastError
());
todo_wine
ok
(
!
lstrcmpA
(
instanceID
,
"ROOT
\\
LEGACY_BOGUS
\\
0001"
),
"Unexpected instance ID %s
\n
"
,
instanceID
);
pSetupDiDestroyDeviceInfoList
(
set
);
...
...
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