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
bc924f5b
Commit
bc924f5b
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 SetupDiGetDeviceRegistryPropertyA/W.
parent
f94f6367
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
3 deletions
+153
-3
devinst.c
dlls/setupapi/devinst.c
+152
-2
setupapi.spec
dlls/setupapi/setupapi.spec
+1
-1
No files found.
dlls/setupapi/devinst.c
View file @
bc924f5b
...
@@ -67,6 +67,22 @@ static const WCHAR DeviceClasses[] = {'S','y','s','t','e','m','\\',
...
@@ -67,6 +67,22 @@ static const WCHAR DeviceClasses[] = {'S','y','s','t','e','m','\\',
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'\\'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'\\'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
'e'
,
's'
,
0
};
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'C'
,
'l'
,
'a'
,
's'
,
's'
,
'e'
,
's'
,
0
};
static
const
WCHAR
Enum
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'C'
,
'o'
,
'n'
,
't'
,
'r'
,
'o'
,
'l'
,
'S'
,
'e'
,
't'
,
'\\'
,
'E'
,
'n'
,
'u'
,
'm'
,
0
};
static
const
WCHAR
DeviceDesc
[]
=
{
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'D'
,
'e'
,
's'
,
'c'
,
0
};
static
const
WCHAR
HardwareId
[]
=
{
'H'
,
'a'
,
'r'
,
'd'
,
'w'
,
'a'
,
'r'
,
'e'
,
'I'
,
'D'
,
0
};
static
const
WCHAR
CompatibleIDs
[]
=
{
'C'
,
'o'
,
'm'
,
'p'
,
'a'
,
't'
,
'i'
,
'b'
,
'l'
,
'e'
,
'I'
,
'd'
,
's'
,
0
};
static
const
WCHAR
Service
[]
=
{
'S'
,
'e'
,
'r'
,
'v'
,
'i'
,
'c'
,
'e'
,
0
};
static
const
WCHAR
Driver
[]
=
{
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
ConfigFlags
[]
=
{
'C'
,
'o'
,
'n'
,
'f'
,
'i'
,
'g'
,
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
static
const
WCHAR
Mfg
[]
=
{
'M'
,
'f'
,
'g'
,
0
};
static
const
WCHAR
FriendlyName
[]
=
{
'F'
,
'r'
,
'i'
,
'e'
,
'n'
,
'd'
,
'l'
,
'y'
,
'N'
,
'a'
,
'm'
,
'e'
,
0
};
static
const
WCHAR
LocationInformation
[]
=
{
'L'
,
'o'
,
'c'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
'I'
,
'n'
,
'f'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
'i'
,
'o'
,
'n'
,
0
};
static
const
WCHAR
Capabilities
[]
=
{
'C'
,
'a'
,
'p'
,
'a'
,
'b'
,
'i'
,
'l'
,
'i'
,
't'
,
'i'
,
'e'
,
's'
,
0
};
static
const
WCHAR
UINumber
[]
=
{
'U'
,
'I'
,
'N'
,
'u'
,
'm'
,
'b'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
UpperFilters
[]
=
{
'U'
,
'p'
,
'p'
,
'e'
,
'r'
,
'F'
,
'i'
,
'l'
,
't'
,
'e'
,
'r'
,
's'
,
0
};
static
const
WCHAR
LowerFilters
[]
=
{
'L'
,
'o'
,
'w'
,
'e'
,
'r'
,
'F'
,
'i'
,
'l'
,
't'
,
'e'
,
'r'
,
's'
,
0
};
/* is used to identify if a DeviceInfoSet pointer is
/* is used to identify if a DeviceInfoSet pointer is
valid or not */
valid or not */
...
@@ -84,6 +100,7 @@ struct DeviceInfoSet
...
@@ -84,6 +100,7 @@ struct DeviceInfoSet
/* Pointed to by SP_DEVINFO_DATA's Reserved member */
/* Pointed to by SP_DEVINFO_DATA's Reserved member */
struct
DeviceInfo
struct
DeviceInfo
{
{
HKEY
key
;
LPWSTR
instanceId
;
LPWSTR
instanceId
;
};
};
...
@@ -98,8 +115,20 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId)
...
@@ -98,8 +115,20 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId)
(
lstrlenW
(
instanceId
)
+
1
)
*
sizeof
(
WCHAR
));
(
lstrlenW
(
instanceId
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
devInfo
->
instanceId
)
if
(
devInfo
->
instanceId
)
{
{
HKEY
enumKey
;
LONG
l
;
devInfo
->
key
=
INVALID_HANDLE_VALUE
;
lstrcpyW
(
devInfo
->
instanceId
,
instanceId
);
lstrcpyW
(
devInfo
->
instanceId
,
instanceId
);
struprW
(
devInfo
->
instanceId
);
struprW
(
devInfo
->
instanceId
);
l
=
RegCreateKeyExW
(
HKEY_LOCAL_MACHINE
,
Enum
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
enumKey
,
NULL
);
if
(
!
l
)
{
RegCreateKeyExW
(
enumKey
,
devInfo
->
instanceId
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
devInfo
->
key
,
NULL
);
RegCloseKey
(
enumKey
);
}
}
}
else
else
{
{
...
@@ -112,6 +141,8 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId)
...
@@ -112,6 +141,8 @@ static struct DeviceInfo *SETUPDI_AllocateDeviceInfo(LPCWSTR instanceId)
static
void
SETUPDI_FreeDeviceInfo
(
struct
DeviceInfo
*
devInfo
)
static
void
SETUPDI_FreeDeviceInfo
(
struct
DeviceInfo
*
devInfo
)
{
{
if
(
devInfo
->
key
!=
INVALID_HANDLE_VALUE
)
RegCloseKey
(
devInfo
->
key
);
HeapFree
(
GetProcessHeap
(),
0
,
devInfo
->
instanceId
);
HeapFree
(
GetProcessHeap
(),
0
,
devInfo
->
instanceId
);
HeapFree
(
GetProcessHeap
(),
0
,
devInfo
);
HeapFree
(
GetProcessHeap
(),
0
,
devInfo
);
}
}
...
@@ -1478,11 +1509,94 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
...
@@ -1478,11 +1509,94 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW(
return
FALSE
;
return
FALSE
;
}
}
struct
PropertyMapEntry
{
DWORD
regType
;
LPCSTR
nameA
;
LPCWSTR
nameW
;
};
static
struct
PropertyMapEntry
PropertyMap
[]
=
{
{
REG_SZ
,
"DeviceDesc"
,
DeviceDesc
},
{
REG_MULTI_SZ
,
"HardwareId"
,
HardwareId
},
{
REG_MULTI_SZ
,
"CompatibleIDs"
,
CompatibleIDs
},
{
0
,
NULL
,
NULL
},
/* SPDRP_UNUSED0 */
{
REG_SZ
,
"Service"
,
Service
},
{
0
,
NULL
,
NULL
},
/* SPDRP_UNUSED1 */
{
0
,
NULL
,
NULL
},
/* SPDRP_UNUSED2 */
{
REG_SZ
,
"Class"
,
Class
},
{
REG_SZ
,
"ClassGUID"
,
ClassGUID
},
{
REG_SZ
,
"Driver"
,
Driver
},
{
REG_DWORD
,
"ConfigFlags"
,
ConfigFlags
},
{
REG_SZ
,
"Mfg"
,
Mfg
},
{
REG_SZ
,
"FriendlyName"
,
FriendlyName
},
{
REG_SZ
,
"LocationInformation"
,
LocationInformation
},
{
0
,
NULL
,
NULL
},
/* SPDRP_PHYSICAL_DEVICE_OBJECT_NAME */
{
REG_DWORD
,
"Capabilities"
,
Capabilities
},
{
REG_DWORD
,
"UINumber"
,
UINumber
},
{
REG_MULTI_SZ
,
"UpperFilters"
,
UpperFilters
},
{
REG_MULTI_SZ
,
"LowerFilters"
,
LowerFilters
},
};
/***********************************************************************
/***********************************************************************
* SetupDiGetDeviceRegistryPropertyA (SETUPAPI.@)
* SetupDiGetDeviceRegistryPropertyA (SETUPAPI.@)
*/
*/
BOOL
WINAPI
SetupDiGetDeviceRegistryPropertyA
(
BOOL
WINAPI
SetupDiGetDeviceRegistryPropertyA
(
HDEVINFO
devinfo
,
HDEVINFO
DeviceInfoSet
,
PSP_DEVINFO_DATA
DeviceInfoData
,
DWORD
Property
,
PDWORD
PropertyRegDataType
,
PBYTE
PropertyBuffer
,
DWORD
PropertyBufferSize
,
PDWORD
RequiredSize
)
{
BOOL
ret
=
FALSE
;
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
DeviceInfo
*
devInfo
;
TRACE
(
"%04x %p %d %p %p %d %p
\n
"
,
(
DWORD
)
DeviceInfoSet
,
DeviceInfoData
,
Property
,
PropertyRegDataType
,
PropertyBuffer
,
PropertyBufferSize
,
RequiredSize
);
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
;
if
(
Property
<
sizeof
(
PropertyMap
)
/
sizeof
(
PropertyMap
[
0
])
&&
PropertyMap
[
Property
].
nameA
)
{
DWORD
size
=
PropertyBufferSize
;
LONG
l
=
RegQueryValueExA
(
devInfo
->
key
,
PropertyMap
[
Property
].
nameA
,
NULL
,
PropertyRegDataType
,
PropertyBuffer
,
&
size
);
if
(
RequiredSize
)
*
RequiredSize
=
size
;
if
(
!
l
)
ret
=
TRUE
;
else
SetLastError
(
l
);
}
return
ret
;
}
/***********************************************************************
* SetupDiGetDeviceRegistryPropertyW (SETUPAPI.@)
*/
BOOL
WINAPI
SetupDiGetDeviceRegistryPropertyW
(
HDEVINFO
DeviceInfoSet
,
PSP_DEVINFO_DATA
DeviceInfoData
,
PSP_DEVINFO_DATA
DeviceInfoData
,
DWORD
Property
,
DWORD
Property
,
PDWORD
PropertyRegDataType
,
PDWORD
PropertyRegDataType
,
...
@@ -1490,10 +1604,46 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
...
@@ -1490,10 +1604,46 @@ BOOL WINAPI SetupDiGetDeviceRegistryPropertyA(
DWORD
PropertyBufferSize
,
DWORD
PropertyBufferSize
,
PDWORD
RequiredSize
)
PDWORD
RequiredSize
)
{
{
FIXME
(
"%04x %p %d %p %p %d %p
\n
"
,
(
DWORD
)
devinfo
,
DeviceInfoData
,
BOOL
ret
=
FALSE
;
struct
DeviceInfoSet
*
set
=
(
struct
DeviceInfoSet
*
)
DeviceInfoSet
;
struct
DeviceInfo
*
devInfo
;
TRACE
(
"%04x %p %d %p %p %d %p
\n
"
,
(
DWORD
)
DeviceInfoSet
,
DeviceInfoData
,
Property
,
PropertyRegDataType
,
PropertyBuffer
,
PropertyBufferSize
,
Property
,
PropertyRegDataType
,
PropertyBuffer
,
PropertyBufferSize
,
RequiredSize
);
RequiredSize
);
if
(
!
DeviceInfoSet
||
DeviceInfoSet
==
INVALID_HANDLE_VALUE
)
{
SetLastError
(
ERROR_INVALID_HANDLE
);
return
FALSE
;
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
;
if
(
Property
<
sizeof
(
PropertyMap
)
/
sizeof
(
PropertyMap
[
0
])
&&
PropertyMap
[
Property
].
nameW
)
{
DWORD
size
=
PropertyBufferSize
;
LONG
l
=
RegQueryValueExW
(
devInfo
->
key
,
PropertyMap
[
Property
].
nameW
,
NULL
,
PropertyRegDataType
,
PropertyBuffer
,
&
size
);
if
(
RequiredSize
)
*
RequiredSize
=
size
;
if
(
!
l
)
ret
=
TRUE
;
else
SetLastError
(
l
);
}
return
ret
;
}
}
/***********************************************************************
/***********************************************************************
...
...
dlls/setupapi/setupapi.spec
View file @
bc924f5b
...
@@ -330,7 +330,7 @@
...
@@ -330,7 +330,7 @@
@ stdcall SetupDiGetDeviceInterfaceDetailA(long ptr ptr long ptr ptr)
@ stdcall SetupDiGetDeviceInterfaceDetailA(long ptr ptr long ptr ptr)
@ stdcall SetupDiGetDeviceInterfaceDetailW(long ptr ptr long ptr ptr)
@ stdcall SetupDiGetDeviceInterfaceDetailW(long ptr ptr long ptr ptr)
@ stdcall SetupDiGetDeviceRegistryPropertyA(long ptr long ptr ptr long ptr)
@ stdcall SetupDiGetDeviceRegistryPropertyA(long ptr long ptr ptr long ptr)
@ st
ub SetupDiGetDeviceRegistryPropertyW
@ st
dcall SetupDiGetDeviceRegistryPropertyW(long ptr long ptr ptr long ptr)
@ stub SetupDiGetDriverInfoDetailA
@ stub SetupDiGetDriverInfoDetailA
@ stub SetupDiGetDriverInfoDetailW
@ stub SetupDiGetDriverInfoDetailW
@ stub SetupDiGetDriverInstallParamsA
@ stub SetupDiGetDriverInstallParamsA
...
...
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