mirror of
https://github.com/reactos/reactos.git
synced 2025-05-29 22:18:13 +00:00
[DEVMGR]
- Move all public interface functions to api.cpp - Implement DeviceManager_ExecuteA svn path=/trunk/; revision=69548
This commit is contained in:
parent
681a9c3f7c
commit
6af7940dce
4 changed files with 589 additions and 559 deletions
|
@ -3,7 +3,7 @@
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS devmgr.dll
|
* PROJECT: ReactOS devmgr.dll
|
||||||
* FILE: dll/win32/devmgr/api.cpp
|
* FILE: dll/win32/devmgr/api.cpp
|
||||||
* PURPOSE: devmgr.dll stubs
|
* PURPOSE: devmgr.dll interface
|
||||||
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
|
||||||
* Ged Murphy (gedmurphy@reactos.org)
|
* Ged Murphy (gedmurphy@reactos.org)
|
||||||
* NOTES:
|
* NOTES:
|
||||||
|
@ -19,10 +19,506 @@
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
#include <devmgr/devmgr.h>
|
#include <devmgr/devmgr.h>
|
||||||
#include "devmgmt/MainWindow.h"
|
#include "devmgmt/MainWindow.h"
|
||||||
|
#include "properties/properties.h"
|
||||||
|
|
||||||
HINSTANCE hDllInstance = NULL;
|
HINSTANCE hDllInstance = NULL;
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(devmgr);
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DeviceAdvancedPropertiesW
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog, this version may add some property pages
|
||||||
|
* for some devices
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* Always returns -1, a call to GetLastError returns 0 if successful
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
INT_PTR
|
||||||
|
WINAPI
|
||||||
|
DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
|
||||||
|
IN LPCWSTR lpMachineName OPTIONAL,
|
||||||
|
IN LPCWSTR lpDeviceID)
|
||||||
|
{
|
||||||
|
HDEVINFO hDevInfo;
|
||||||
|
SP_DEVINFO_DATA DevInfoData;
|
||||||
|
HINSTANCE hComCtl32;
|
||||||
|
INT_PTR Ret = -1;
|
||||||
|
|
||||||
|
if (lpDeviceID == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* dynamically load comctl32 */
|
||||||
|
hComCtl32 = LoadAndInitComctl32();
|
||||||
|
if (hComCtl32 != NULL)
|
||||||
|
{
|
||||||
|
hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
|
||||||
|
hWndParent,
|
||||||
|
lpMachineName,
|
||||||
|
NULL);
|
||||||
|
if (hDevInfo != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||||
|
if (SetupDiOpenDeviceInfo(hDevInfo,
|
||||||
|
lpDeviceID,
|
||||||
|
hWndParent,
|
||||||
|
0,
|
||||||
|
&DevInfoData))
|
||||||
|
{
|
||||||
|
Ret = DisplayDeviceAdvancedProperties(hWndParent,
|
||||||
|
lpDeviceID,
|
||||||
|
hDevInfo,
|
||||||
|
&DevInfoData,
|
||||||
|
hComCtl32,
|
||||||
|
lpMachineName,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeLibrary(hComCtl32);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DeviceAdvancedPropertiesA
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog, this version may add some property pages
|
||||||
|
* for some devices
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* Always returns -1, a call to GetLastError returns 0 if successful
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
INT_PTR
|
||||||
|
WINAPI
|
||||||
|
DeviceAdvancedPropertiesA(IN HWND hWndParent OPTIONAL,
|
||||||
|
IN LPCSTR lpMachineName OPTIONAL,
|
||||||
|
IN LPCSTR lpDeviceID)
|
||||||
|
{
|
||||||
|
LPWSTR lpMachineNameW = NULL;
|
||||||
|
LPWSTR lpDeviceIDW = NULL;
|
||||||
|
INT_PTR Ret = -1;
|
||||||
|
|
||||||
|
if (lpMachineName != NULL)
|
||||||
|
{
|
||||||
|
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lpDeviceID != NULL)
|
||||||
|
{
|
||||||
|
if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = DeviceAdvancedPropertiesW(hWndParent,
|
||||||
|
lpMachineNameW,
|
||||||
|
lpDeviceIDW);
|
||||||
|
|
||||||
|
Cleanup:
|
||||||
|
if (lpMachineNameW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpMachineNameW);
|
||||||
|
}
|
||||||
|
if (lpDeviceIDW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpDeviceIDW);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DevicePropertiesExA
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the extended device properties dialog
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
||||||
|
* bShowDevMgr is nonzero
|
||||||
|
* dwFlags: This parameter can be a combination of the following flags:
|
||||||
|
* * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
|
||||||
|
* the default device status action button
|
||||||
|
* to be clicked (Troubleshoot, Enable
|
||||||
|
* Device, etc)
|
||||||
|
* bShowDevMgr: If non-zero it displays the device manager instead of
|
||||||
|
* the advanced device property dialog
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* 1: if bShowDevMgr is non-zero and no error occured
|
||||||
|
* -1: a call to GetLastError returns 0 if successful
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
INT_PTR
|
||||||
|
WINAPI
|
||||||
|
DevicePropertiesExA(IN HWND hWndParent OPTIONAL,
|
||||||
|
IN LPCSTR lpMachineName OPTIONAL,
|
||||||
|
IN LPCSTR lpDeviceID OPTIONAL,
|
||||||
|
IN DWORD dwFlags OPTIONAL,
|
||||||
|
IN BOOL bShowDevMgr)
|
||||||
|
{
|
||||||
|
LPWSTR lpMachineNameW = NULL;
|
||||||
|
LPWSTR lpDeviceIDW = NULL;
|
||||||
|
INT_PTR Ret = -1;
|
||||||
|
|
||||||
|
if (lpMachineName != NULL)
|
||||||
|
{
|
||||||
|
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lpDeviceID != NULL)
|
||||||
|
{
|
||||||
|
if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
goto Cleanup;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = DevicePropertiesExW(hWndParent,
|
||||||
|
lpMachineNameW,
|
||||||
|
lpDeviceIDW,
|
||||||
|
dwFlags,
|
||||||
|
bShowDevMgr);
|
||||||
|
|
||||||
|
Cleanup:
|
||||||
|
if (lpMachineNameW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpMachineNameW);
|
||||||
|
}
|
||||||
|
if (lpDeviceIDW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpDeviceIDW);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DevicePropertiesExW
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the extended device properties dialog
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
||||||
|
* bShowDevMgr is nonzero
|
||||||
|
* dwFlags: This parameter can be a combination of the following flags:
|
||||||
|
* * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
|
||||||
|
* the default device status action button
|
||||||
|
* to be clicked (Troubleshoot, Enable
|
||||||
|
* Device, etc)
|
||||||
|
* bShowDevMgr: If non-zero it displays the device manager instead of
|
||||||
|
* the advanced device property dialog
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* 1: if bShowDevMgr is non-zero and no error occured
|
||||||
|
* -1: a call to GetLastError returns 0 if successful
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
INT_PTR
|
||||||
|
WINAPI
|
||||||
|
DevicePropertiesExW(IN HWND hWndParent OPTIONAL,
|
||||||
|
IN LPCWSTR lpMachineName OPTIONAL,
|
||||||
|
IN LPCWSTR lpDeviceID OPTIONAL,
|
||||||
|
IN DWORD dwFlags OPTIONAL,
|
||||||
|
IN BOOL bShowDevMgr)
|
||||||
|
{
|
||||||
|
INT_PTR Ret = -1;
|
||||||
|
|
||||||
|
if (dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION))
|
||||||
|
{
|
||||||
|
FIXME("DevPropertiesExW: Invalid flags: 0x%x\n",
|
||||||
|
dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION));
|
||||||
|
SetLastError(ERROR_INVALID_FLAGS);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bShowDevMgr)
|
||||||
|
{
|
||||||
|
FIXME("DevPropertiesExW doesn't support bShowDevMgr!\n");
|
||||||
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HDEVINFO hDevInfo;
|
||||||
|
SP_DEVINFO_DATA DevInfoData;
|
||||||
|
HINSTANCE hComCtl32;
|
||||||
|
|
||||||
|
if (lpDeviceID == NULL)
|
||||||
|
{
|
||||||
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* dynamically load comctl32 */
|
||||||
|
hComCtl32 = LoadAndInitComctl32();
|
||||||
|
if (hComCtl32 != NULL)
|
||||||
|
{
|
||||||
|
hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
|
||||||
|
hWndParent,
|
||||||
|
lpMachineName,
|
||||||
|
NULL);
|
||||||
|
if (hDevInfo != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
||||||
|
if (SetupDiOpenDeviceInfo(hDevInfo,
|
||||||
|
lpDeviceID,
|
||||||
|
hWndParent,
|
||||||
|
0,
|
||||||
|
&DevInfoData))
|
||||||
|
{
|
||||||
|
Ret = DisplayDeviceAdvancedProperties(hWndParent,
|
||||||
|
lpDeviceID,
|
||||||
|
hDevInfo,
|
||||||
|
&DevInfoData,
|
||||||
|
hComCtl32,
|
||||||
|
lpMachineName,
|
||||||
|
dwFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetupDiDestroyDeviceInfoList(hDevInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
FreeLibrary(hComCtl32);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DevicePropertiesA
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog directly
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown
|
||||||
|
* bShowDevMgr: If non-zero it displays the device manager instead of
|
||||||
|
* the device property dialog
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* >=0: if no errors occured
|
||||||
|
* -1: if errors occured
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
WINAPI
|
||||||
|
DevicePropertiesA(HWND hWndParent,
|
||||||
|
LPCSTR lpMachineName,
|
||||||
|
LPCSTR lpDeviceID,
|
||||||
|
BOOL bShowDevMgr)
|
||||||
|
{
|
||||||
|
return DevicePropertiesExA(hWndParent,
|
||||||
|
lpMachineName,
|
||||||
|
lpDeviceID,
|
||||||
|
DPF_EXTENDED,
|
||||||
|
bShowDevMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DevicePropertiesW
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog directly
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* lpMachineName: Machine Name, NULL is the local machine
|
||||||
|
* lpDeviceID: Specifies the device whose properties are to be shown
|
||||||
|
* bShowDevMgr: If non-zero it displays the device manager instead of
|
||||||
|
* the device property dialog
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* >=0: if no errors occured
|
||||||
|
* -1: if errors occured
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
WINAPI
|
||||||
|
DevicePropertiesW(HWND hWndParent,
|
||||||
|
LPCWSTR lpMachineName,
|
||||||
|
LPCWSTR lpDeviceID,
|
||||||
|
BOOL bShowDevMgr)
|
||||||
|
{
|
||||||
|
return DevicePropertiesExW(hWndParent,
|
||||||
|
lpMachineName,
|
||||||
|
lpDeviceID,
|
||||||
|
DPF_EXTENDED,
|
||||||
|
bShowDevMgr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DeviceProperties_RunDLLA
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* hInst: Handle to the application instance
|
||||||
|
* lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
|
||||||
|
* also see NOTEs
|
||||||
|
* nCmdShow: Specifies how the window should be shown
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* NOTE
|
||||||
|
* - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
|
||||||
|
* (/MachineName is optional). This function only parses this string and eventually
|
||||||
|
* calls DeviceProperties().
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
DeviceProperties_RunDLLA(HWND hWndParent,
|
||||||
|
HINSTANCE hInst,
|
||||||
|
LPCSTR lpDeviceCmd,
|
||||||
|
int nCmdShow)
|
||||||
|
{
|
||||||
|
LPWSTR lpDeviceCmdW = NULL;
|
||||||
|
|
||||||
|
if (lpDeviceCmd != NULL)
|
||||||
|
{
|
||||||
|
if ((lpDeviceCmdW = ConvertMultiByteToUnicode(lpDeviceCmd,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
DeviceProperties_RunDLLW(hWndParent,
|
||||||
|
hInst,
|
||||||
|
lpDeviceCmdW,
|
||||||
|
nCmdShow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lpDeviceCmdW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpDeviceCmdW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* DeviceProperties_RunDLLW
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Invokes the device properties dialog
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* hWndParent: Handle to the parent window
|
||||||
|
* hInst: Handle to the application instance
|
||||||
|
* lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
|
||||||
|
* also see NOTEs
|
||||||
|
* nCmdShow: Specifies how the window should be shown
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
*
|
||||||
|
* REVISIONS
|
||||||
|
*
|
||||||
|
* NOTE
|
||||||
|
* - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
|
||||||
|
* (/MachineName is optional). This function only parses this string and eventually
|
||||||
|
* calls DeviceProperties().
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
WINAPI
|
||||||
|
DeviceProperties_RunDLLW(HWND hWndParent,
|
||||||
|
HINSTANCE hInst,
|
||||||
|
LPCWSTR lpDeviceCmd,
|
||||||
|
int nCmdShow)
|
||||||
|
{
|
||||||
|
WCHAR szDeviceID[MAX_DEVICE_ID_LEN + 1];
|
||||||
|
WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||||
|
LPWSTR lpString = (LPWSTR)lpDeviceCmd;
|
||||||
|
|
||||||
|
if (!GetDeviceAndComputerName(lpString,
|
||||||
|
szDeviceID,
|
||||||
|
szMachineName))
|
||||||
|
{
|
||||||
|
ERR("DeviceProperties_RunDLLW DeviceID: %S, MachineName: %S\n", szDeviceID, szMachineName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
DevicePropertiesW(hWndParent,
|
||||||
|
szMachineName,
|
||||||
|
szDeviceID,
|
||||||
|
FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -48,7 +544,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(devmgr);
|
||||||
* - Win runs the device manager in a separate process, so hWndParent is somehow
|
* - Win runs the device manager in a separate process, so hWndParent is somehow
|
||||||
* obsolete.
|
* obsolete.
|
||||||
*
|
*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
|
@ -57,8 +553,32 @@ DeviceManager_ExecuteA(HWND hWndParent,
|
||||||
LPCSTR lpMachineName,
|
LPCSTR lpMachineName,
|
||||||
int nCmdShow)
|
int nCmdShow)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
LPWSTR lpMachineNameW = NULL;
|
||||||
return FALSE;
|
BOOL Ret;
|
||||||
|
|
||||||
|
if (lpMachineName != NULL)
|
||||||
|
{
|
||||||
|
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
||||||
|
CP_ACP)))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ret = DeviceManager_ExecuteW(hWndParent,
|
||||||
|
hInst,
|
||||||
|
lpMachineNameW,
|
||||||
|
nCmdShow);
|
||||||
|
|
||||||
|
if (lpMachineNameW != NULL)
|
||||||
|
{
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpMachineNameW);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +605,7 @@ DeviceManager_ExecuteA(HWND hWndParent,
|
||||||
* - Win runs the device manager in a separate process, so hWndParent is somehow
|
* - Win runs the device manager in a separate process, so hWndParent is somehow
|
||||||
* obsolete.
|
* obsolete.
|
||||||
*
|
*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
WINAPI
|
WINAPI
|
||||||
|
|
|
@ -2744,556 +2744,3 @@ Cleanup:
|
||||||
|
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
|
||||||
GetDeviceAndComputerName(LPWSTR lpString,
|
|
||||||
WCHAR szDeviceID[],
|
|
||||||
WCHAR szMachineName[])
|
|
||||||
{
|
|
||||||
BOOL ret = FALSE;
|
|
||||||
|
|
||||||
szDeviceID[0] = L'\0';
|
|
||||||
szMachineName[0] = L'\0';
|
|
||||||
|
|
||||||
while (*lpString != L'\0')
|
|
||||||
{
|
|
||||||
if (*lpString == L'/')
|
|
||||||
{
|
|
||||||
lpString++;
|
|
||||||
if(!_wcsnicmp(lpString, L"DeviceID", 8))
|
|
||||||
{
|
|
||||||
lpString += 9;
|
|
||||||
if (*lpString != L'\0')
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while ((*lpString != L' ') &&
|
|
||||||
(*lpString != L'\0') &&
|
|
||||||
(i <= MAX_DEVICE_ID_LEN))
|
|
||||||
{
|
|
||||||
szDeviceID[i++] = *lpString++;
|
|
||||||
}
|
|
||||||
szDeviceID[i] = L'\0';
|
|
||||||
ret = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!_wcsnicmp(lpString, L"MachineName", 11))
|
|
||||||
{
|
|
||||||
lpString += 12;
|
|
||||||
if (*lpString != L'\0')
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while ((*lpString != L' ') &&
|
|
||||||
(*lpString != L'\0') &&
|
|
||||||
(i <= MAX_COMPUTERNAME_LENGTH))
|
|
||||||
{
|
|
||||||
szMachineName[i++] = *lpString++;
|
|
||||||
}
|
|
||||||
szMachineName[i] = L'\0';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* knock the pointer back one and let the next
|
|
||||||
* pointer deal with incrementing, otherwise we
|
|
||||||
* go past the end of the string */
|
|
||||||
lpString--;
|
|
||||||
}
|
|
||||||
lpString++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DeviceAdvancedPropertiesW
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog, this version may add some property pages
|
|
||||||
* for some devices
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* Always returns -1, a call to GetLastError returns 0 if successful
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
INT_PTR
|
|
||||||
WINAPI
|
|
||||||
DeviceAdvancedPropertiesW(IN HWND hWndParent OPTIONAL,
|
|
||||||
IN LPCWSTR lpMachineName OPTIONAL,
|
|
||||||
IN LPCWSTR lpDeviceID)
|
|
||||||
{
|
|
||||||
HDEVINFO hDevInfo;
|
|
||||||
SP_DEVINFO_DATA DevInfoData;
|
|
||||||
HINSTANCE hComCtl32;
|
|
||||||
INT_PTR Ret = -1;
|
|
||||||
|
|
||||||
if (lpDeviceID == NULL)
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dynamically load comctl32 */
|
|
||||||
hComCtl32 = LoadAndInitComctl32();
|
|
||||||
if (hComCtl32 != NULL)
|
|
||||||
{
|
|
||||||
hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
|
|
||||||
hWndParent,
|
|
||||||
lpMachineName,
|
|
||||||
NULL);
|
|
||||||
if (hDevInfo != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
|
||||||
if (SetupDiOpenDeviceInfo(hDevInfo,
|
|
||||||
lpDeviceID,
|
|
||||||
hWndParent,
|
|
||||||
0,
|
|
||||||
&DevInfoData))
|
|
||||||
{
|
|
||||||
Ret = DisplayDeviceAdvancedProperties(hWndParent,
|
|
||||||
lpDeviceID,
|
|
||||||
hDevInfo,
|
|
||||||
&DevInfoData,
|
|
||||||
hComCtl32,
|
|
||||||
lpMachineName,
|
|
||||||
0);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeLibrary(hComCtl32);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DeviceAdvancedPropertiesA
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog, this version may add some property pages
|
|
||||||
* for some devices
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* Always returns -1, a call to GetLastError returns 0 if successful
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
INT_PTR
|
|
||||||
WINAPI
|
|
||||||
DeviceAdvancedPropertiesA(IN HWND hWndParent OPTIONAL,
|
|
||||||
IN LPCSTR lpMachineName OPTIONAL,
|
|
||||||
IN LPCSTR lpDeviceID)
|
|
||||||
{
|
|
||||||
LPWSTR lpMachineNameW = NULL;
|
|
||||||
LPWSTR lpDeviceIDW = NULL;
|
|
||||||
INT_PTR Ret = -1;
|
|
||||||
|
|
||||||
if (lpMachineName != NULL)
|
|
||||||
{
|
|
||||||
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
|
||||||
CP_ACP)))
|
|
||||||
{
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lpDeviceID != NULL)
|
|
||||||
{
|
|
||||||
if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
|
|
||||||
CP_ACP)))
|
|
||||||
{
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ret = DeviceAdvancedPropertiesW(hWndParent,
|
|
||||||
lpMachineNameW,
|
|
||||||
lpDeviceIDW);
|
|
||||||
|
|
||||||
Cleanup:
|
|
||||||
if (lpMachineNameW != NULL)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
lpMachineNameW);
|
|
||||||
}
|
|
||||||
if (lpDeviceIDW != NULL)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
lpDeviceIDW);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DevicePropertiesExA
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the extended device properties dialog
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
|
||||||
* bShowDevMgr is nonzero
|
|
||||||
* dwFlags: This parameter can be a combination of the following flags:
|
|
||||||
* * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
|
|
||||||
* the default device status action button
|
|
||||||
* to be clicked (Troubleshoot, Enable
|
|
||||||
* Device, etc)
|
|
||||||
* bShowDevMgr: If non-zero it displays the device manager instead of
|
|
||||||
* the advanced device property dialog
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* 1: if bShowDevMgr is non-zero and no error occured
|
|
||||||
* -1: a call to GetLastError returns 0 if successful
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
INT_PTR
|
|
||||||
WINAPI
|
|
||||||
DevicePropertiesExA(IN HWND hWndParent OPTIONAL,
|
|
||||||
IN LPCSTR lpMachineName OPTIONAL,
|
|
||||||
IN LPCSTR lpDeviceID OPTIONAL,
|
|
||||||
IN DWORD dwFlags OPTIONAL,
|
|
||||||
IN BOOL bShowDevMgr)
|
|
||||||
{
|
|
||||||
LPWSTR lpMachineNameW = NULL;
|
|
||||||
LPWSTR lpDeviceIDW = NULL;
|
|
||||||
INT_PTR Ret = -1;
|
|
||||||
|
|
||||||
if (lpMachineName != NULL)
|
|
||||||
{
|
|
||||||
if (!(lpMachineNameW = ConvertMultiByteToUnicode(lpMachineName,
|
|
||||||
CP_ACP)))
|
|
||||||
{
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lpDeviceID != NULL)
|
|
||||||
{
|
|
||||||
if (!(lpDeviceIDW = ConvertMultiByteToUnicode(lpDeviceID,
|
|
||||||
CP_ACP)))
|
|
||||||
{
|
|
||||||
goto Cleanup;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Ret = DevicePropertiesExW(hWndParent,
|
|
||||||
lpMachineNameW,
|
|
||||||
lpDeviceIDW,
|
|
||||||
dwFlags,
|
|
||||||
bShowDevMgr);
|
|
||||||
|
|
||||||
Cleanup:
|
|
||||||
if (lpMachineNameW != NULL)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
lpMachineNameW);
|
|
||||||
}
|
|
||||||
if (lpDeviceIDW != NULL)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
lpDeviceIDW);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DevicePropertiesExW
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the extended device properties dialog
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown, optional if
|
|
||||||
* bShowDevMgr is nonzero
|
|
||||||
* dwFlags: This parameter can be a combination of the following flags:
|
|
||||||
* * DPF_DEVICE_STATUS_ACTION: Only valid if bShowDevMgr, causes
|
|
||||||
* the default device status action button
|
|
||||||
* to be clicked (Troubleshoot, Enable
|
|
||||||
* Device, etc)
|
|
||||||
* bShowDevMgr: If non-zero it displays the device manager instead of
|
|
||||||
* the advanced device property dialog
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* 1: if bShowDevMgr is non-zero and no error occured
|
|
||||||
* -1: a call to GetLastError returns 0 if successful
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
INT_PTR
|
|
||||||
WINAPI
|
|
||||||
DevicePropertiesExW(IN HWND hWndParent OPTIONAL,
|
|
||||||
IN LPCWSTR lpMachineName OPTIONAL,
|
|
||||||
IN LPCWSTR lpDeviceID OPTIONAL,
|
|
||||||
IN DWORD dwFlags OPTIONAL,
|
|
||||||
IN BOOL bShowDevMgr)
|
|
||||||
{
|
|
||||||
INT_PTR Ret = -1;
|
|
||||||
|
|
||||||
if (dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION))
|
|
||||||
{
|
|
||||||
FIXME("DevPropertiesExW: Invalid flags: 0x%x\n",
|
|
||||||
dwFlags & ~(DPF_EXTENDED | DPF_DEVICE_STATUS_ACTION));
|
|
||||||
SetLastError(ERROR_INVALID_FLAGS);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bShowDevMgr)
|
|
||||||
{
|
|
||||||
FIXME("DevPropertiesExW doesn't support bShowDevMgr!\n");
|
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HDEVINFO hDevInfo;
|
|
||||||
SP_DEVINFO_DATA DevInfoData;
|
|
||||||
HINSTANCE hComCtl32;
|
|
||||||
|
|
||||||
if (lpDeviceID == NULL)
|
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* dynamically load comctl32 */
|
|
||||||
hComCtl32 = LoadAndInitComctl32();
|
|
||||||
if (hComCtl32 != NULL)
|
|
||||||
{
|
|
||||||
hDevInfo = SetupDiCreateDeviceInfoListEx(NULL,
|
|
||||||
hWndParent,
|
|
||||||
lpMachineName,
|
|
||||||
NULL);
|
|
||||||
if (hDevInfo != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
DevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
|
|
||||||
if (SetupDiOpenDeviceInfo(hDevInfo,
|
|
||||||
lpDeviceID,
|
|
||||||
hWndParent,
|
|
||||||
0,
|
|
||||||
&DevInfoData))
|
|
||||||
{
|
|
||||||
Ret = DisplayDeviceAdvancedProperties(hWndParent,
|
|
||||||
lpDeviceID,
|
|
||||||
hDevInfo,
|
|
||||||
&DevInfoData,
|
|
||||||
hComCtl32,
|
|
||||||
lpMachineName,
|
|
||||||
dwFlags);
|
|
||||||
}
|
|
||||||
|
|
||||||
SetupDiDestroyDeviceInfoList(hDevInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
FreeLibrary(hComCtl32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DevicePropertiesA
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog directly
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown
|
|
||||||
* bShowDevMgr: If non-zero it displays the device manager instead of
|
|
||||||
* the device property dialog
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* >=0: if no errors occured
|
|
||||||
* -1: if errors occured
|
|
||||||
*
|
|
||||||
* REVISIONS
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
WINAPI
|
|
||||||
DevicePropertiesA(HWND hWndParent,
|
|
||||||
LPCSTR lpMachineName,
|
|
||||||
LPCSTR lpDeviceID,
|
|
||||||
BOOL bShowDevMgr)
|
|
||||||
{
|
|
||||||
return DevicePropertiesExA(hWndParent,
|
|
||||||
lpMachineName,
|
|
||||||
lpDeviceID,
|
|
||||||
DPF_EXTENDED,
|
|
||||||
bShowDevMgr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DevicePropertiesW
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog directly
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* lpMachineName: Machine Name, NULL is the local machine
|
|
||||||
* lpDeviceID: Specifies the device whose properties are to be shown
|
|
||||||
* bShowDevMgr: If non-zero it displays the device manager instead of
|
|
||||||
* the device property dialog
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
* >=0: if no errors occured
|
|
||||||
* -1: if errors occured
|
|
||||||
*
|
|
||||||
* REVISIONS
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
WINAPI
|
|
||||||
DevicePropertiesW(HWND hWndParent,
|
|
||||||
LPCWSTR lpMachineName,
|
|
||||||
LPCWSTR lpDeviceID,
|
|
||||||
BOOL bShowDevMgr)
|
|
||||||
{
|
|
||||||
return DevicePropertiesExW(hWndParent,
|
|
||||||
lpMachineName,
|
|
||||||
lpDeviceID,
|
|
||||||
DPF_EXTENDED,
|
|
||||||
bShowDevMgr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DeviceProperties_RunDLLA
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* hInst: Handle to the application instance
|
|
||||||
* lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
|
|
||||||
* also see NOTEs
|
|
||||||
* nCmdShow: Specifies how the window should be shown
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
*
|
|
||||||
* REVISIONS
|
|
||||||
*
|
|
||||||
* NOTE
|
|
||||||
* - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
|
|
||||||
* (/MachineName is optional). This function only parses this string and eventually
|
|
||||||
* calls DeviceProperties().
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
WINAPI
|
|
||||||
DeviceProperties_RunDLLA(HWND hWndParent,
|
|
||||||
HINSTANCE hInst,
|
|
||||||
LPCSTR lpDeviceCmd,
|
|
||||||
int nCmdShow)
|
|
||||||
{
|
|
||||||
LPWSTR lpDeviceCmdW = NULL;
|
|
||||||
|
|
||||||
if (lpDeviceCmd != NULL)
|
|
||||||
{
|
|
||||||
if ((lpDeviceCmdW = ConvertMultiByteToUnicode(lpDeviceCmd,
|
|
||||||
CP_ACP)))
|
|
||||||
{
|
|
||||||
DeviceProperties_RunDLLW(hWndParent,
|
|
||||||
hInst,
|
|
||||||
lpDeviceCmdW,
|
|
||||||
nCmdShow);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lpDeviceCmdW != NULL)
|
|
||||||
{
|
|
||||||
HeapFree(GetProcessHeap(),
|
|
||||||
0,
|
|
||||||
lpDeviceCmdW);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
|
||||||
* NAME EXPORTED
|
|
||||||
* DeviceProperties_RunDLLW
|
|
||||||
*
|
|
||||||
* DESCRIPTION
|
|
||||||
* Invokes the device properties dialog
|
|
||||||
*
|
|
||||||
* ARGUMENTS
|
|
||||||
* hWndParent: Handle to the parent window
|
|
||||||
* hInst: Handle to the application instance
|
|
||||||
* lpDeviceCmd: A command that includes the DeviceID of the properties to be shown,
|
|
||||||
* also see NOTEs
|
|
||||||
* nCmdShow: Specifies how the window should be shown
|
|
||||||
*
|
|
||||||
* RETURN VALUE
|
|
||||||
*
|
|
||||||
* REVISIONS
|
|
||||||
*
|
|
||||||
* NOTE
|
|
||||||
* - lpDeviceCmd is a string in the form of "/MachineName MACHINE /DeviceID DEVICEPATH"
|
|
||||||
* (/MachineName is optional). This function only parses this string and eventually
|
|
||||||
* calls DeviceProperties().
|
|
||||||
*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
VOID
|
|
||||||
WINAPI
|
|
||||||
DeviceProperties_RunDLLW(HWND hWndParent,
|
|
||||||
HINSTANCE hInst,
|
|
||||||
LPCWSTR lpDeviceCmd,
|
|
||||||
int nCmdShow)
|
|
||||||
{
|
|
||||||
WCHAR szDeviceID[MAX_DEVICE_ID_LEN+1];
|
|
||||||
WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH+1];
|
|
||||||
LPWSTR lpString = (LPWSTR)lpDeviceCmd;
|
|
||||||
|
|
||||||
if (!GetDeviceAndComputerName(lpString,
|
|
||||||
szDeviceID,
|
|
||||||
szMachineName))
|
|
||||||
{
|
|
||||||
ERR("DeviceProperties_RunDLLW DeviceID: %S, MachineName: %S\n", szDeviceID, szMachineName);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DevicePropertiesW(hWndParent,
|
|
||||||
szMachineName,
|
|
||||||
szDeviceID,
|
|
||||||
FALSE);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1129,3 +1129,61 @@ LoadAndInitComctl32(VOID)
|
||||||
|
|
||||||
return hComCtl32;
|
return hComCtl32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetDeviceAndComputerName(LPWSTR lpString,
|
||||||
|
WCHAR szDeviceID[],
|
||||||
|
WCHAR szMachineName[])
|
||||||
|
{
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
szDeviceID[0] = L'\0';
|
||||||
|
szMachineName[0] = L'\0';
|
||||||
|
|
||||||
|
while (*lpString != L'\0')
|
||||||
|
{
|
||||||
|
if (*lpString == L'/')
|
||||||
|
{
|
||||||
|
lpString++;
|
||||||
|
if (!_wcsnicmp(lpString, L"DeviceID", 8))
|
||||||
|
{
|
||||||
|
lpString += 9;
|
||||||
|
if (*lpString != L'\0')
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while ((*lpString != L' ') &&
|
||||||
|
(*lpString != L'\0') &&
|
||||||
|
(i <= MAX_DEVICE_ID_LEN))
|
||||||
|
{
|
||||||
|
szDeviceID[i++] = *lpString++;
|
||||||
|
}
|
||||||
|
szDeviceID[i] = L'\0';
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!_wcsnicmp(lpString, L"MachineName", 11))
|
||||||
|
{
|
||||||
|
lpString += 12;
|
||||||
|
if (*lpString != L'\0')
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while ((*lpString != L' ') &&
|
||||||
|
(*lpString != L'\0') &&
|
||||||
|
(i <= MAX_COMPUTERNAME_LENGTH))
|
||||||
|
{
|
||||||
|
szMachineName[i++] = *lpString++;
|
||||||
|
}
|
||||||
|
szMachineName[i] = L'\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* knock the pointer back one and let the next
|
||||||
|
* pointer deal with incrementing, otherwise we
|
||||||
|
* go past the end of the string */
|
||||||
|
lpString--;
|
||||||
|
}
|
||||||
|
lpString++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -128,6 +128,11 @@ ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
|
||||||
HINSTANCE
|
HINSTANCE
|
||||||
LoadAndInitComctl32(VOID);
|
LoadAndInitComctl32(VOID);
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetDeviceAndComputerName(LPWSTR lpString,
|
||||||
|
WCHAR szDeviceID[],
|
||||||
|
WCHAR szMachineName[]);
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet,
|
GetDeviceManufacturerString(IN HDEVINFO DeviceInfoSet,
|
||||||
IN PSP_DEVINFO_DATA DeviceInfoData,
|
IN PSP_DEVINFO_DATA DeviceInfoData,
|
||||||
|
|
Loading…
Reference in a new issue