Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a63c9356
Commit
a63c9356
authored
Sep 21, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Sep 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setupapi: Implement SetupDiGetDeviceInterfaceDetailA/W.
parent
6bd4ed73
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
8 deletions
+101
-8
devinst.c
dlls/setupapi/devinst.c
+101
-2
devinst.c
dlls/setupapi/tests/devinst.c
+0
-6
No files found.
dlls/setupapi/devinst.c
View file @
a63c9356
...
...
@@ -2308,13 +2308,63 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA(
PDWORD
RequiredSize
,
PSP_DEVINFO_DATA
DeviceInfoData
)
{
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
InterfaceInfo
*
info
;
DWORD
bytesNeeded
=
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
,
DevicePath
)
+
1
;
BOOL
ret
=
FALSE
;
FIXM
E
(
"(%p, %p, %p, %d, %p, %p)
\n
"
,
DeviceInfoSet
,
TRAC
E
(
"(%p, %p, %p, %d, %p, %p)
\n
"
,
DeviceInfoSet
,
DeviceInterfaceData
,
DeviceInterfaceDetailData
,
DeviceInterfaceDetailDataSize
,
RequiredSize
,
DeviceInfoData
);
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
(
HDEVINFO
)
INVALID_HANDLE_VALUE
||
set
->
magic
!=
SETUP_DEVICE_INFO_SET_MAGIC
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
!
DeviceInterfaceData
||
DeviceInterfaceData
->
cbSize
!=
sizeof
(
SP_DEVICE_INTERFACE_DATA
)
||
!
DeviceInterfaceData
->
Reserved
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
DeviceInterfaceDetailData
&&
(
DeviceInterfaceDetailData
->
cbSize
<
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
,
DevicePath
)
+
sizeof
(
char
)
||
DeviceInterfaceDetailData
->
cbSize
>
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
)))
{
SetLastError
(
ERROR_INVALID_USER_BUFFER
);
return
FALSE
;
}
if
(
!
DeviceInterfaceDetailData
&&
DeviceInterfaceDetailDataSize
)
{
SetLastError
(
ERROR_INVALID_USER_BUFFER
);
return
FALSE
;
}
info
=
(
struct
InterfaceInfo
*
)
DeviceInterfaceData
->
Reserved
;
if
(
info
->
symbolicLink
)
bytesNeeded
+=
WideCharToMultiByte
(
CP_ACP
,
0
,
info
->
symbolicLink
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
DeviceInterfaceDetailDataSize
>=
bytesNeeded
)
{
if
(
info
->
symbolicLink
)
WideCharToMultiByte
(
CP_ACP
,
0
,
info
->
symbolicLink
,
-
1
,
DeviceInterfaceDetailData
->
DevicePath
,
DeviceInterfaceDetailDataSize
-
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
,
DevicePath
),
NULL
,
NULL
);
else
DeviceInterfaceDetailData
->
DevicePath
[
0
]
=
'\0'
;
ret
=
TRUE
;
}
else
{
if
(
RequiredSize
)
*
RequiredSize
=
bytesNeeded
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
return
ret
;
}
...
...
@@ -2329,10 +2379,59 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
PDWORD
RequiredSize
,
PSP_DEVINFO_DATA
DeviceInfoData
)
{
FIXME
(
"(%p, %p, %p, %d, %p, %p): stub
\n
"
,
DeviceInfoSet
,
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
InterfaceInfo
*
info
;
DWORD
bytesNeeded
=
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
,
DevicePath
)
+
sizeof
(
WCHAR
);
/* include NULL terminator */
BOOL
ret
=
FALSE
;
TRACE
(
"(%p, %p, %p, %d, %p, %p)
\n
"
,
DeviceInfoSet
,
DeviceInterfaceData
,
DeviceInterfaceDetailData
,
DeviceInterfaceDetailDataSize
,
RequiredSize
,
DeviceInfoData
);
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
(
HDEVINFO
)
INVALID_HANDLE_VALUE
||
set
->
magic
!=
SETUP_DEVICE_INFO_SET_MAGIC
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
}
if
(
!
DeviceInterfaceData
||
DeviceInterfaceData
->
cbSize
!=
sizeof
(
SP_DEVICE_INTERFACE_DATA
)
||
!
DeviceInterfaceData
->
Reserved
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
DeviceInterfaceDetailData
&&
(
DeviceInterfaceDetailData
->
cbSize
<
offsetof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
,
DevicePath
)
+
sizeof
(
WCHAR
)
||
DeviceInterfaceDetailData
->
cbSize
>
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_W
)))
{
SetLastError
(
ERROR_INVALID_USER_BUFFER
);
return
FALSE
;
}
if
(
!
DeviceInterfaceDetailData
&&
DeviceInterfaceDetailDataSize
)
{
SetLastError
(
ERROR_INVALID_USER_BUFFER
);
return
FALSE
;
}
info
=
(
struct
InterfaceInfo
*
)
DeviceInterfaceData
->
Reserved
;
if
(
info
->
symbolicLink
)
bytesNeeded
+=
lstrlenW
(
info
->
symbolicLink
);
if
(
DeviceInterfaceDetailDataSize
>=
bytesNeeded
)
{
if
(
info
->
symbolicLink
)
lstrcpyW
(
DeviceInterfaceDetailData
->
DevicePath
,
info
->
symbolicLink
);
else
DeviceInterfaceDetailData
->
DevicePath
[
0
]
=
'\0'
;
ret
=
TRUE
;
}
else
{
if
(
RequiredSize
)
*
RequiredSize
=
bytesNeeded
;
SetLastError
(
ERROR_INSUFFICIENT_BUFFER
);
}
return
ret
;
}
struct
PropertyMapEntry
...
...
dlls/setupapi/tests/devinst.c
View file @
a63c9356
...
...
@@ -440,7 +440,6 @@ static void testGetDeviceInterfaceDetail(void)
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
NULL
,
NULL
,
0
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
ret
=
pSetupDiCreateDeviceInfoA
(
set
,
"ROOT
\\
LEGACY_BOGUS
\\
0000"
,
&
guid
,
...
...
@@ -453,19 +452,16 @@ static void testGetDeviceInterfaceDetail(void)
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
&
interfaceData
,
NULL
,
0
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
&
interfaceData
,
NULL
,
100
,
NULL
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"Expected ERROR_INVALID_USER_BUFFER, got %08x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
&
interfaceData
,
NULL
,
0
,
&
size
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
if
(
!
ret
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
...
...
@@ -478,7 +474,6 @@ static void testGetDeviceInterfaceDetail(void)
SetLastError
(
0xdeadbeef
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
&
interfaceData
,
detail
,
size
,
&
size
,
NULL
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_USER_BUFFER
,
"Expected ERROR_INVALID_USER_BUFFER, got %08x
\n
"
,
GetLastError
());
detail
->
cbSize
=
size
;
...
...
@@ -491,7 +486,6 @@ static void testGetDeviceInterfaceDetail(void)
detail
->
cbSize
=
sizeof
(
SP_DEVICE_INTERFACE_DETAIL_DATA_A
);
ret
=
pSetupDiGetDeviceInterfaceDetailA
(
set
,
&
interfaceData
,
detail
,
size
,
&
size
,
NULL
);
todo_wine
ok
(
ret
,
"SetupDiGetDeviceInterfaceDetailA failed: %d
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
buf
);
...
...
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