Songbird Windows Device Utilities Source. More...
#include "sbWindowsDeviceUtils.h"
#include <sbWindowsUtils.h>
#include <dbt.h>
#include <winioctl.h>
Go to the source code of this file.
Functions | |
nsresult | sbWinCreateDeviceFile (HANDLE *aDevFile, DEVINST aDevInst, const GUID *aGUID, DWORD aDesiredAccess, DWORD aShareMode, LPSECURITY_ATTRIBUTES aSecurityAttributes, DWORD aCreationDisposition, DWORD aFlagsAndAttributes, HANDLE aTemplateFile) |
nsresult | sbWinCreateAncestorDeviceFile (HANDLE *aDevFile, DEVINST aDevInst, const GUID *aGUID, DWORD aDesiredAccess, DWORD aShareMode, LPSECURITY_ATTRIBUTES aSecurityAttributes, DWORD aCreationDisposition, DWORD aFlagsAndAttributes, HANDLE aTemplateFile) |
nsresult | sbWinDeviceHasInterface (DEVINST aDevInst, const GUID *aGUID, PRBool *aHasInterface) |
nsresult | sbWinGetDevicePath (DEVINST aDevInst, const GUID *aGUID, nsAString &aDevicePath) |
static nsresult | _sbWinFindDevicesByInterface (nsTArray< DEVINST > &aDevInstList, DEVINST aRootDevInst, const GUID *aGUID, PRBool aSearchAncestors) |
nsresult | sbWinFindDevicesByInterface (nsTArray< DEVINST > &aDevInstList, DEVINST aRootDevInst, const GUID *aGUID, PRBool aSearchAncestors) |
nsresult | sbWinFindDeviceByClass (DEVINST *aDevInst, PRBool *aFound, DEVINST aRootDevInst, const nsAString &aClass) |
nsresult | sbWinGetDevInfoData (DEVINST aDevInst, HDEVINFO aDevInfo, PSP_DEVINFO_DATA aDevInfoData) |
nsresult | sbWinGetDevDetail (PSP_DEVICE_INTERFACE_DETAIL_DATA *aDevIfDetailData, SP_DEVINFO_DATA *aDevInfoData, HDEVINFO aDevInfo, const GUID *aGUID, DWORD aDevIndex) |
nsresult | sbWinGetDevInterfaceDetail (PSP_DEVICE_INTERFACE_DETAIL_DATA *aDevIfDetailData, HDEVINFO aDevInfo, SP_DEVINFO_DATA *aDevInfoData, const GUID *aGUID) |
nsresult | sbWinGetDeviceInstanceIDFromDeviceInterfaceName (nsAString &aDeviceInterfaceName, nsAString &aDeviceInstanceID) |
nsresult | sbWinGetDeviceInstanceID (DEVINST aDevInst, nsAString &aDeviceInstanceID) |
nsresult | sbWinDeviceEject (DEVINST aDevInst) |
nsresult | sbWinDeviceEject (nsAString const &aMountPath) |
nsresult | sbWinDeviceIsDescendantOf (DEVINST aDevInst, DEVINST aDescendantDevInst, PRBool *aIsDescendant) |
nsresult | sbWinRegisterDeviceHandleNotification (HDEVNOTIFY *aDeviceNotification, HWND aEventWindow, DEVINST aDevInst, const GUID &aGUID) |
Variables | |
static const GUID | GUID_DEVINTERFACE_USB_HUB |
Songbird Windows Device Utilities Source.
Definition in file sbWindowsDeviceUtils.cpp.
|
static |
Search the device specified by aRootDevInst and all of its descendents or ancestors for device instances providing the device interface specified by aGUID. Return all found device instances in aDevInstList. If aSearchAncestors is true, search all ancestors; otherwise, search all descendents. If searching ancestors, the returned list will be ordered by most immediate ancestors first.
aDevInstList | Returned list of found device instances. |
aRootDevInst | Root device instance from which to begin search. |
aGUID | Device interface class for which to search. |
aSearchAncestors | If true, search ancestors. |
Definition at line 368 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinCreateAncestorDeviceFile | ( | HANDLE * | aDevFile, |
DEVINST | aDevInst, | ||
const GUID * | aGUID, | ||
DWORD | aDesiredAccess, | ||
DWORD | aShareMode, | ||
LPSECURITY_ATTRIBUTES | aSecurityAttributes, | ||
DWORD | aCreationDisposition, | ||
DWORD | aFlagsAndAttributes, | ||
HANDLE | aTemplateFile | ||
) |
Create a device file for an ancestor of the device instance specified by aDevInst and device interface class specified by aGUID. Create the device file for the first ancestor implementing the specified device interface class. Return the created device file handle in aDevFile
aDevFile | Returned created device file handle. |
aDevInst | Device instance for which to create file. |
aGUID | Device interface class for which to create file. |
aDesiredAccess | File creation arguments. |
aShareMode | |
aSecurityAttributes | |
aCreationDisposition | |
aFlagsAndAttributes | |
aTemplateFile |
Definition at line 162 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinCreateDeviceFile | ( | HANDLE * | aDevFile, |
DEVINST | aDevInst, | ||
const GUID * | aGUID, | ||
DWORD | aDesiredAccess, | ||
DWORD | aShareMode, | ||
LPSECURITY_ATTRIBUTES | aSecurityAttributes, | ||
DWORD | aCreationDisposition, | ||
DWORD | aFlagsAndAttributes, | ||
HANDLE | aTemplateFile | ||
) |
Create a device file for the device instance specified by aDevInst and device interface class specified by aGUID. Return the created device file handle in aDevFile
aDevFile | Returned created device file handle. |
aDevInst | Device instance for which to create file. |
aGUID | Device interface class for which to create file. |
aDesiredAccess | File creation arguments. |
aShareMode | |
aSecurityAttributes | |
aCreationDisposition | |
aFlagsAndAttributes | |
aTemplateFile |
Definition at line 102 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinDeviceEject | ( | DEVINST | aDevInst | ) |
Eject the device specified by aDevInst.
aDevInst | Device instance to eject. |
Definition at line 775 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinDeviceEject | ( | nsAString const & | aMountPath | ) |
Ejects the USB drive using the supplied drive (X:) via the DeviceIoControl functions. I used MSDN KB165721 to create this code.
Definition at line 827 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinDeviceHasInterface | ( | DEVINST | aDevInst, |
const GUID * | aGUID, | ||
PRBool * | aHasInterface | ||
) |
Check if the device instance specified by aDevInst provides the device interface specified by aGUID. If it does, return true in aHasInterface.
aDevInst | Device instance to check. |
aGUID | Device interface class. |
aHasInterface | Returned true if device instance provides the specified interface. |
Definition at line 223 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinDeviceIsDescendantOf | ( | DEVINST | aDevInst, |
DEVINST | aDescendantDevInst, | ||
PRBool * | aIsDescendant | ||
) |
Determine whether the device specified by aDescendantDevInst is a descendant of the device specified by aDevInst. If it is, return true in aIsDescendant.
aDevInst | Ancestor device. |
aDescendantDevInst | Descendant device. |
aIsDesendant | Returned true if descendant device is a descendant of ancestor device. |
Definition at line 941 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinFindDeviceByClass | ( | DEVINST * | aDevInst, |
PRBool * | aFound, | ||
DEVINST | aRootDevInst, | ||
const nsAString & | aClass | ||
) |
Search the device specified by aRootDevInst and all of its descendents for a device instance of the class specified by aClass. If one is found, this function returns the found device instance in aDevInst and true in aFound.
aDevInst | Returned found device instance. |
aFound | Returned true if device was found. |
aRootDevInst | Root device instance. |
aClass | Device class for which to search. |
Definition at line 434 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinFindDevicesByInterface | ( | nsTArray< DEVINST > & | aDevInstList, |
DEVINST | aRootDevInst, | ||
const GUID * | aGUID, | ||
PRBool | aSearchAncestors | ||
) |
nsresult sbWinGetDevDetail | ( | PSP_DEVICE_INTERFACE_DETAIL_DATA * | aDevIfDetailData, |
SP_DEVINFO_DATA * | aDevInfoData, | ||
HDEVINFO | aDevInfo, | ||
const GUID * | aGUID, | ||
DWORD | aDevIndex | ||
) |
Return in aDevIfDetailData and aDevInfoData the device details for a device. The device is specified by the enumeration handle aDevInfo. The device class GUID is specified by aGUID, and the device enumeration index is specified by aDevIndex.
aDevIfDetailData | Returned device detail data. |
aDevInfoData | Returned device info data. |
aDevInfo | Device info enumeration handle. |
aGUID | Device class GUID. |
aDevIndex | Device enumeration index. |
Definition at line 549 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinGetDeviceInstanceID | ( | DEVINST | aDevInst, |
nsAString & | aDeviceInstanceID | ||
) |
Return in aDeviceInstanceID the device instance ID for the device specified by aDevInst.
aDevInst | Device instance for which to get ID. |
aDeviceInstanceID | Returned device instance ID. |
Definition at line 753 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinGetDeviceInstanceIDFromDeviceInterfaceName | ( | nsAString & | aDeviceInterfaceName, |
nsAString & | aDeviceInstanceID | ||
) |
Return in aDeviceInstanceID the device instance ID for the device with the device interface name specified by aDeviceInterfaceName.
aDeviceInterfaceName | Device interface name. |
aDeviceInstanceID | Returned device instance ID. |
Definition at line 708 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinGetDevicePath | ( | DEVINST | aDevInst, |
const GUID * | aGUID, | ||
nsAString & | aDevicePath | ||
) |
Return in aDevicePath the device file path for the device specified by aDevInst and device interface class specified by aGUID.
aDevInst | Device instance for which to get path. |
aGUID | Device interface class. |
aDevicePath | Returned device path. |
Definition at line 283 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinGetDevInfoData | ( | DEVINST | aDevInst, |
HDEVINFO | aDevInfo, | ||
PSP_DEVINFO_DATA | aDevInfoData | ||
) |
Return in aDevInfoData the device info for the device instance specified by aDevInst using the device info set specified by aDevInfo.
aDevInst | Device instance for which to get device info. |
aDevInfo | Device info set handle. |
aDevInfoData | Returned device info. |
Definition at line 504 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinGetDevInterfaceDetail | ( | PSP_DEVICE_INTERFACE_DETAIL_DATA * | aDevIfDetailData, |
HDEVINFO | aDevInfo, | ||
SP_DEVINFO_DATA * | aDevInfoData, | ||
const GUID * | aGUID | ||
) |
Return in aDevIfDetailData the device interface details for the device specified by aDevInfoData and the device interface class specified by aGUID using the device info set specified by aDevInfo. If the specified device does not provide the specified interface, return NS_ERROR_NOT_AVAILABLE. The caller is responsible for calling NS_Free for the returned device interface details data record.
aDevIfDetailData | Returned device detail data. |
aDevInfo | Device info set handle. |
aDevInfoData | Device info data for which to get device interface details. |
aGUID | Device interface class GUID. |
Definition at line 634 of file sbWindowsDeviceUtils.cpp.
nsresult sbWinRegisterDeviceHandleNotification | ( | HDEVNOTIFY * | aDeviceNotification, |
HWND | aEventWindow, | ||
DEVINST | aDevInst, | ||
const GUID & | aGUID | ||
) |
Register device handle notification for the device specified by aDevInst with the device interface specified by aGUID. Send the notification to the window specified by aEventWindow. Return the device notification handle in aDeviceNotification.
aDeviceNotification | Returned device notification handle. |
aEventWindow | Window to which to send notification. |
aDevInst | Device for which to register notification. |
aGUID | Device interface for which to register notification. |
Definition at line 988 of file sbWindowsDeviceUtils.cpp.
|
static |
Definition at line 67 of file sbWindowsDeviceUtils.cpp.