- Build the properties as C++
- Rearrange the folder structure
- The whole thing now builds and runs from VS (with a few hacks). CMake next

svn path=/trunk/; revision=69320
This commit is contained in:
Ged Murphy 2015-09-22 18:23:03 +00:00
parent 0ea9ff44f2
commit e82b2a4870
15 changed files with 415 additions and 379 deletions

View file

@ -3,16 +3,17 @@ spec2def(devmgr.dll devmgr.spec ADD_IMPORTLIB)
set_cpp(WITH_RTTI WITH_RUNTIME) set_cpp(WITH_RTTI WITH_RUNTIME)
include_directories(${REACTOS_SOURCE_DIR}/lib/atl) include_directories(${REACTOS_SOURCE_DIR}/lib/atl includes devmgmt)
list(APPEND SOURCE list(APPEND SOURCE
precomp.h stdafx.h
properties/advprop.c api.cpp
properties/devprblm.c properties/advprop.cpp
properties/hwpage.c properties/devprblm.cpp
properties/hwresource.c properties/hwpage.cpp
properties/misc.c properties/hwresource.cpp
properties/stubs.c properties/misc.cpp
properties/stubs.cpp
devmgmt/ClassNode.cpp devmgmt/ClassNode.cpp
devmgmt/DeviceNode.cpp devmgmt/DeviceNode.cpp
devmgmt/DeviceView.cpp devmgmt/DeviceView.cpp

View file

@ -0,0 +1,262 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS devmgr.dll
* FILE: lib/devmgr/stubs.c
* PURPOSE: devmgr.dll stubs
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* Ged Murphy (gedmurphy@reactos.org)
* NOTES:
* Some helpful resources:
* http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;815320
* http://www.jsiinc.com/SUBO/tip7400/rh7482.htm
* http://www.jsiinc.com/SUBM/tip6400/rh6490.htm
*
* UPDATE HISTORY:
* 04-04-2004 Created
*/
#include "stdafx.h"
#include "devmgmt\MainWindow.h"
#define UNIMPLEMENTED
/***************************************************************************
* NAME EXPORTED
* DeviceManager_ExecuteA
*
* DESCRIPTION
* Starts the Device Manager
*
* ARGUMENTS
* hWndParent: Handle to the parent window
* hInst: Handle to the application instance
* lpMachineName: Machine Name, NULL is the local machine
* nCmdShow: Specifies how the window should be shown
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if the device manager could not be executed
*
* REVISIONS
*
* NOTE
* - Win runs the device manager in a separate process, so hWndParent is somehow
* obsolete.
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManager_ExecuteA(HWND hWndParent,
HINSTANCE hInst,
LPCSTR lpMachineName,
int nCmdShow)
{
UNIMPLEMENTED;
return FALSE;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManager_ExecuteW
*
* DESCRIPTION
* Starts the Device Manager
*
* ARGUMENTS
* hWndParent: Handle to the parent window
* hInst: Handle to the application instance
* lpMachineName: Machine Name, NULL is the local machine
* nCmdShow: Specifies how the window should be shown
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if the device manager could not be executed
*
* REVISIONS
*
* NOTE
* - Win runs the device manager in a separate process, so hWndParent is somehow
* obsolete.
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManager_ExecuteW(HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpMachineName,
int nCmdShow)
{
//
// This needs to create the mmc process which will load the device manager in-proc
CDeviceManager DevMgr;
return DevMgr.Create(hWndParent, hInst, lpMachineName, nCmdShow);
}
/***************************************************************************
* NAME EXPORTED
* DeviceProblemWizard_RunDLLA
*
* DESCRIPTION
* Calls the device problem wizard
*
* 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
* - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
* a typo so we additionally export an alias function
* - 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().
*
* @unimplemented
*/
VOID
WINAPI
DeviceProblemWizard_RunDLLA(HWND hWndParent,
HINSTANCE hInst,
LPCSTR lpDeviceCmd,
int nCmdShow)
{
UNIMPLEMENTED;
}
/***************************************************************************
* NAME EXPORTED
* DeviceProblemWizard_RunDLLW
*
* DESCRIPTION
* Calls the device problem wizard
*
* 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
* - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
* a typo so we additionally export an alias function
* - 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().
*
* @unimplemented
*/
VOID
WINAPI
DeviceProblemWizard_RunDLLW(HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpDeviceCmd,
int nCmdShow)
{
UNIMPLEMENTED;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManagerPrintA
*
* DESCRIPTION
* Calls the device problem wizard
*
* ARGUMENTS
* lpMachineName: Machine Name, NULL is the local machine
* lpPrinter: Filename of the printer where it should be printed on
* nPrintMode: Specifies what kind of information is to be printed
* DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
* uNumberOfGuids, Guids are ignored
* DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
* DEV_PRINT_ALL: Prints an abstract of system information and all
* system devices
* uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
* lpGuids: Array of device guids, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if errors occured
*
* REVISIONS
*
* NOTE
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManagerPrintA(LPCSTR lpMachineName,
LPCSTR lpPrinter,
int nPrintMode,
UINT uNumberOfGuids,
LPGUID lpGuids)
{
UNIMPLEMENTED;
return FALSE;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManagerPrintW
*
* DESCRIPTION
* Calls the device problem wizard
*
* ARGUMENTS
* lpMachineName: Machine Name, NULL is the local machine
* lpPrinter: Filename of the printer where it should be printed on
* nPrintMode: Specifies what kind of information is to be printed
* DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
* uNumberOfGuids, Guids are ignored
* DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
* DEV_PRINT_ALL: Prints an abstract of system information and all
* system devices
* uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
* lpGuids: Array of device guids, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if errors occured
*
* REVISIONS
*
* NOTE
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManagerPrintW(LPCWSTR lpMachineName,
LPCWSTR lpPrinter,
int nPrintMode,
UINT uNumberOfGuids,
LPGUID lpGuids)
{
UNIMPLEMENTED;
return FALSE;
}

View file

@ -819,17 +819,3 @@ HandleDefaultMessage:
return RetCode; return RetCode;
} }
#if 1 // test
BOOL
WINAPI
DeviceManager_ExecuteW(HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpMachineName,
int nCmdShow)
{
CDeviceManager DevMgr;
return DevMgr.Create(hWndParent, hInst, lpMachineName, nCmdShow);
}
#endif

View file

@ -9,8 +9,8 @@
#define REACTOS_STR_INTERNAL_NAME "devmgr" #define REACTOS_STR_INTERNAL_NAME "devmgr"
#define REACTOS_STR_ORIGINAL_FILENAME "devmgr.dll" #define REACTOS_STR_ORIGINAL_FILENAME "devmgr.dll"
#include <reactos/version.rc> //#include <reactos/version.rc>
#include <reactos/manifest_dll.rc> //#include <reactos/manifest_dll.rc>
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL

View file

@ -0,0 +1,11 @@
#pragma once
BOOL
CreateDeviceManager(
HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpMachineName,
int nCmdShow
);

View file

@ -27,7 +27,10 @@
* 04-04-2004 Created * 04-04-2004 Created
*/ */
#include "precomp.h" #include "stdafx.h"
#include <devmgr\devmgr.h>"
#include "properties.h"
#include "resource.h"
#include <winver.h> #include <winver.h>
@ -768,9 +771,9 @@ DisplayDevicePropertyText(IN PDEVADVPROP_INFO dap,
if (dwType == REG_SZ) if (dwType == REG_SZ)
dwSize += sizeof(WCHAR); dwSize += sizeof(WCHAR);
lpBuffer = HeapAlloc(GetProcessHeap(), lpBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dwSize); dwSize);
if (lpBuffer == NULL) if (lpBuffer == NULL)
{ {
SetListViewText(hwndListView, 0, L"Error: Allocating the buffer failed!"); SetListViewText(hwndListView, 0, L"Error: Allocating the buffer failed!");
@ -1075,7 +1078,7 @@ DisplayClassCoinstallers(IN PDEVADVPROP_INFO dap,
HDEVINFO DeviceInfoSet; HDEVINFO DeviceInfoSet;
PSP_DEVINFO_DATA DeviceInfoData; PSP_DEVINFO_DATA DeviceInfoData;
WCHAR szClassGuid[45]; WCHAR szClassGuid[45];
HKEY hKey = INVALID_HANDLE_VALUE; HKEY hKey = (HKEY)INVALID_HANDLE_VALUE;
DWORD dwSize; DWORD dwSize;
DWORD dwType; DWORD dwType;
LPBYTE lpBuffer = NULL; LPBYTE lpBuffer = NULL;
@ -1126,9 +1129,9 @@ DisplayClassCoinstallers(IN PDEVADVPROP_INFO dap,
if (dwSize == 0) if (dwSize == 0)
goto done; goto done;
lpBuffer = HeapAlloc(GetProcessHeap(), lpBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dwSize); dwSize);
RegQueryValueEx(hKey, RegQueryValueEx(hKey,
szClassGuid, szClassGuid,
@ -1201,9 +1204,9 @@ DisplayDeviceCoinstallers(IN PDEVADVPROP_INFO dap,
dwSize > 0) dwSize > 0)
{ {
lpBuffer = HeapAlloc(GetProcessHeap(), lpBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dwSize); dwSize);
RegQueryValueEx(hKey, RegQueryValueEx(hKey,
L"CoInstallers32", L"CoInstallers32",
@ -1288,9 +1291,9 @@ DisplayClassProperties(IN PDEVADVPROP_INFO dap,
&dwSize) == ERROR_SUCCESS && &dwSize) == ERROR_SUCCESS &&
dwSize > 0) dwSize > 0)
{ {
lpBuffer = HeapAlloc(GetProcessHeap(), lpBuffer = (LPBYTE)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
dwSize); dwSize);
RegQueryValueEx(hKey, RegQueryValueEx(hKey,
lpProperty, lpProperty,
@ -1347,9 +1350,9 @@ DisplayDeviceRelations(
if (ret != CR_SUCCESS) if (ret != CR_SUCCESS)
return; return;
pszBuffer = HeapAlloc(GetProcessHeap(), pszBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
ulLength); ulLength);
if (pszBuffer == NULL) if (pszBuffer == NULL)
return; return;
@ -1774,8 +1777,6 @@ UpdateDevInfo(IN HWND hwndDlg,
DWORD nDriverPages = 0; DWORD nDriverPages = 0;
BOOL RecalcPages = FALSE; BOOL RecalcPages = FALSE;
TRACE("UpdateDevInfo()\n");
hPropSheetDlg = GetParent(hwndDlg); hPropSheetDlg = GetParent(hwndDlg);
if (dap->PageInitialized) if (dap->PageInitialized)
@ -2171,7 +2172,6 @@ GetParentNode:
dap->PropertySheetType) && dap->PropertySheetType) &&
nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER) nDriverPages != 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{ {
TRACE("Count %d additional pages!\n", nDriverPages);
dap->nDevPropSheets += nDriverPages; dap->nDevPropSheets += nDriverPages;
} }
else else
@ -2193,10 +2193,9 @@ TRACE("Count %d additional pages!\n", nDriverPages);
/* add the device property sheets */ /* add the device property sheets */
if (dap->nDevPropSheets != 0) if (dap->nDevPropSheets != 0)
{ {
TRACE("Show %d pages!\n", dap->nDevPropSheets); dap->DevPropSheets = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
dap->DevPropSheets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
HEAP_ZERO_MEMORY, dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
dap->nDevPropSheets * sizeof(HPROPSHEETPAGE));
if (dap->DevPropSheets != NULL) if (dap->DevPropSheets != NULL)
{ {
if (nDriverPages != 0) if (nDriverPages != 0)
@ -2216,25 +2215,17 @@ TRACE("Show %d pages!\n", dap->nDevPropSheets);
iPage < nDriverPages; iPage < nDriverPages;
iPage++) iPage++)
{ {
TRACE("Add page %d\n", iPage);
TRACE("Sheet %p\n", dap->DevPropSheets[iPage]);
if (PropSheet_AddPage(hPropSheetDlg, if (PropSheet_AddPage(hPropSheetDlg,
dap->DevPropSheets[iPage])) dap->DevPropSheets[iPage]))
{ {
RecalcPages = TRUE; RecalcPages = TRUE;
} }
else
{
TRACE("PropSheet_AddPage() failed\n");
}
} }
dap->FreeDevPropSheets = TRUE; dap->FreeDevPropSheets = TRUE;
} }
else else
{ {
TRACE("SetupDiGetClassDevPropertySheets() failed\n");
/* cleanup, we were unable to get the device property sheets */ /* cleanup, we were unable to get the device property sheets */
iPage = nDriverPages; iPage = nDriverPages;
dap->nDevPropSheets -= nDriverPages; dap->nDevPropSheets -= nDriverPages;
@ -2602,11 +2593,11 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
/* create the internal structure associated with the "General", /* create the internal structure associated with the "General",
"Driver", ... pages */ "Driver", ... pages */
DevAdvPropInfo = HeapAlloc(GetProcessHeap(), DevAdvPropInfo = (PDEVADVPROP_INFO)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
FIELD_OFFSET(DEVADVPROP_INFO, FIELD_OFFSET(DEVADVPROP_INFO,
szDeviceID) + szDeviceID) +
(DevIdSize * sizeof(WCHAR))); (DevIdSize * sizeof(WCHAR)));
if (DevAdvPropInfo == NULL) if (DevAdvPropInfo == NULL)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -2645,7 +2636,7 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
DevAdvPropInfo->pCreatePropertySheetPageW = pCreatePropertySheetPageW; DevAdvPropInfo->pCreatePropertySheetPageW = pCreatePropertySheetPageW;
DevAdvPropInfo->pDestroyPropertySheetPage = pDestroyPropertySheetPage; DevAdvPropInfo->pDestroyPropertySheetPage = pDestroyPropertySheetPage;
DevAdvPropInfo->IsAdmin = IsUserAdmin(); DevAdvPropInfo->IsAdmin = TRUE;// IsUserAdmin();
DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0); DevAdvPropInfo->DoDefaultDevAction = ((dwFlags & DPF_DEVICE_STATUS_ACTION) != 0);
DevAdvPropInfo->Extended = ((dwFlags & DPF_EXTENDED) != 0); DevAdvPropInfo->Extended = ((dwFlags & DPF_EXTENDED) != 0);
@ -2658,9 +2649,9 @@ DisplayDeviceAdvancedProperties(IN HWND hWndParent,
DIGCDP_FLAG_REMOTE_ADVANCED : DIGCDP_FLAG_REMOTE_ADVANCED :
DIGCDP_FLAG_ADVANCED; DIGCDP_FLAG_ADVANCED;
psh.phpage = HeapAlloc(GetProcessHeap(), psh.phpage = (HPROPSHEETPAGE *)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
1 * sizeof(HPROPSHEETPAGE)); 1 * sizeof(HPROPSHEETPAGE));
if (psh.phpage == NULL) if (psh.phpage == NULL)
{ {
goto Cleanup; goto Cleanup;

View file

@ -25,7 +25,10 @@
* 04-04-2004 Created * 04-04-2004 Created
*/ */
#include "precomp.h" #include "stdafx.h"
#include <devmgr\devmgr.h>"
#include "properties.h"
#include "resource.h"
BOOL BOOL
@ -423,9 +426,9 @@ DeviceProblemTextA(IN HMACHINE hMachine OPTIONAL,
if (uMaxString != 0) if (uMaxString != 0)
{ {
lpBuffer = HeapAlloc(GetProcessHeap(), lpBuffer = (LPWSTR)HeapAlloc(GetProcessHeap(),
0, 0,
(uMaxString + 1) * sizeof(WCHAR)); (uMaxString + 1) * sizeof(WCHAR));
if (lpBuffer == NULL) if (lpBuffer == NULL)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);

View file

@ -25,7 +25,10 @@
* 04-04-2004 Created * 04-04-2004 Created
*/ */
#include "precomp.h" #include "stdafx.h"
#include <devmgr\devmgr.h>"
#include "properties.h"
#include "resource.h"
typedef struct _HWDEVINFO typedef struct _HWDEVINFO
@ -301,11 +304,11 @@ BuildDevicesList(IN PHARDWARE_PAGE_DATA hpd)
if (ClassDevInfo->HwDevInfo != NULL) if (ClassDevInfo->HwDevInfo != NULL)
{ {
PHWDEVINFO HwNewDevInfo = HeapReAlloc(GetProcessHeap(), PHWDEVINFO HwNewDevInfo = (PHWDEVINFO)HeapReAlloc(GetProcessHeap(),
0, 0,
ClassDevInfo->HwDevInfo, ClassDevInfo->HwDevInfo,
(ClassDevInfo->ItemCount + 1) * (ClassDevInfo->ItemCount + 1) *
sizeof(HWDEVINFO)); sizeof(HWDEVINFO));
if (HwNewDevInfo != NULL) if (HwNewDevInfo != NULL)
{ {
ClassDevInfo->HwDevInfo = HwNewDevInfo; ClassDevInfo->HwDevInfo = HwNewDevInfo;
@ -319,9 +322,9 @@ BuildDevicesList(IN PHARDWARE_PAGE_DATA hpd)
} }
else else
{ {
ClassDevInfo->HwDevInfo = HeapAlloc(GetProcessHeap(), ClassDevInfo->HwDevInfo = (PHWDEVINFO)HeapAlloc(GetProcessHeap(),
0, 0,
sizeof(HWDEVINFO)); sizeof(HWDEVINFO));
if (ClassDevInfo->HwDevInfo == NULL) if (ClassDevInfo->HwDevInfo == NULL)
{ {
ERR("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n"); ERR("Unable to allocate memory for a SP_DEVINFO_DATA structures!\n");
@ -364,9 +367,9 @@ DeviceIdMatch(IN HDEVINFO DeviceInfoSet,
{ {
if (DevIdLen == wcslen(lpDeviceId) + 1) if (DevIdLen == wcslen(lpDeviceId) + 1)
{ {
lpQueriedDeviceId = HeapAlloc(GetProcessHeap(), lpQueriedDeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
0, 0,
DevIdLen * sizeof(WCHAR)); DevIdLen * sizeof(WCHAR));
if (lpQueriedDeviceId != NULL) if (lpQueriedDeviceId != NULL)
{ {
if (SetupDiGetDeviceInstanceId(DeviceInfoSet, if (SetupDiGetDeviceInstanceId(DeviceInfoSet,
@ -414,8 +417,8 @@ FillDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd,
LastHwDevInfo = HwDevInfo + ClassDevInfo->ItemCount; LastHwDevInfo = HwDevInfo + ClassDevInfo->ItemCount;
SelectedInClass = (SelectedClassGuid != NULL && SelectedInClass = (SelectedClassGuid != NULL &&
IsEqualGUID(SelectedClassGuid, IsEqualGUID(*SelectedClassGuid,
&ClassDevInfo->Guid)); ClassDevInfo->Guid));
while (HwDevInfo != LastHwDevInfo) while (HwDevInfo != LastHwDevInfo)
{ {
INT iItem; INT iItem;
@ -497,9 +500,9 @@ UpdateDevicesListViewControl(IN PHARDWARE_PAGE_DATA hpd)
GetLastError() == ERROR_INSUFFICIENT_BUFFER) GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{ {
SelectedClassGuid = HwDevInfo->DevInfoData.ClassGuid; SelectedClassGuid = HwDevInfo->DevInfoData.ClassGuid;
lpDeviceId = HeapAlloc(GetProcessHeap(), lpDeviceId = (LPWSTR)HeapAlloc(GetProcessHeap(),
0, 0,
DevIdLen * sizeof(WCHAR)); DevIdLen * sizeof(WCHAR));
if (lpDeviceId != NULL && if (lpDeviceId != NULL &&
!SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo, !SetupDiGetDeviceInstanceId(HwDevInfo->ClassDevInfo->hDevInfo,
&HwDevInfo->DevInfoData, &HwDevInfo->DevInfoData,
@ -1029,10 +1032,10 @@ DeviceCreateHardwarePageEx(IN HWND hWndParent,
/* allocate the HARDWARE_PAGE_DATA structure. Make sure it is /* allocate the HARDWARE_PAGE_DATA structure. Make sure it is
zeroed because the initialization code assumes that in zeroed because the initialization code assumes that in
failure cases! */ failure cases! */
hpd = HeapAlloc(GetProcessHeap(), hpd = (PHARDWARE_PAGE_DATA)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY, HEAP_ZERO_MEMORY,
FIELD_OFFSET(HARDWARE_PAGE_DATA, FIELD_OFFSET(HARDWARE_PAGE_DATA,
ClassDevInfo[uNumberOfGuids])); ClassDevInfo[uNumberOfGuids]));
if (hpd != NULL) if (hpd != NULL)
{ {
HWND hWnd; HWND hWnd;

View file

@ -7,7 +7,10 @@
* 2005/11/24 Created * 2005/11/24 Created
*/ */
#include "precomp.h" #include "stdafx.h"
#include <devmgr\devmgr.h>"
#include "properties.h"
#include "resource.h"
typedef struct typedef struct
@ -47,7 +50,7 @@ typedef struct _CM_PARTIAL_RESOURCE_DESCRIPTOR {
} Interrupt; } Interrupt;
#if (NTDDI_VERSION >= NTDDI_LONGHORN) #if (NTDDI_VERSION >= NTDDI_LONGHORN)
struct { struct {
_ANONYMOUS_UNION union { union {
struct { struct {
#if defined(NT_PROCESSOR_GROUPS) #if defined(NT_PROCESSOR_GROUPS)
USHORT Group; USHORT Group;

View file

@ -25,8 +25,10 @@
* 2005/11/24 Created * 2005/11/24 Created
*/ */
#include "precomp.h" #include "stdafx.h"
#include <devmgr\devmgr.h>"
#include "properties.h"
#include "resource.h"
HINSTANCE hDllInstance = NULL; HINSTANCE hDllInstance = NULL;
@ -49,7 +51,7 @@ LengthOfStrResource(IN HINSTANCE hInst,
/* Find the string table block */ /* Find the string table block */
if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) && if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
(hRes = LoadResource(hInst, hrSrc)) && (hRes = LoadResource(hInst, hrSrc)) &&
(lpStr = LockResource(hRes))) (lpStr = (LPWSTR)LockResource(hRes)))
{ {
UINT x; UINT x;
@ -251,9 +253,9 @@ ConvertMultiByteToUnicode(IN LPCSTR lpMultiByteStr,
if (nLength == 0) if (nLength == 0)
return NULL; return NULL;
lpUnicodeStr = HeapAlloc(GetProcessHeap(), lpUnicodeStr = (LPWSTR)HeapAlloc(GetProcessHeap(),
0, 0,
nLength * sizeof(WCHAR)); nLength * sizeof(WCHAR));
if (lpUnicodeStr == NULL) if (lpUnicodeStr == NULL)
{ {
SetLastError(ERROR_NOT_ENOUGH_MEMORY); SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@ -462,7 +464,7 @@ GetDeviceStatusString(IN DEVINST DevInst,
{ {
UINT uRet; UINT uRet;
uRet = DeviceProblemText(hMachine, uRet = DeviceProblemTextW(hMachine,
DevInst, DevInst,
ProblemNumber, ProblemNumber,
szBuffer, szBuffer,
@ -925,7 +927,7 @@ FindCurrentDriver(IN HDEVINFO DeviceInfoSet,
IN PSP_DEVINFO_DATA DeviceInfoData, IN PSP_DEVINFO_DATA DeviceInfoData,
OUT PSP_DRVINFO_DATA DriverInfoData) OUT PSP_DRVINFO_DATA DriverInfoData)
{ {
HKEY hKey = INVALID_HANDLE_VALUE; HKEY hKey = (HKEY)INVALID_HANDLE_VALUE;
SP_DEVINSTALL_PARAMS InstallParams = {0}; SP_DEVINSTALL_PARAMS InstallParams = {0};
SP_DRVINFO_DETAIL_DATA DriverInfoDetailData = {0}; SP_DRVINFO_DETAIL_DATA DriverInfoDetailData = {0};
WCHAR InfPath[MAX_PATH]; WCHAR InfPath[MAX_PATH];
@ -1078,7 +1080,7 @@ FindCurrentDriver(IN HDEVINFO DeviceInfoSet,
ERR("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", GetLastError()); ERR("SetupDiGetDriverInfoDetail() failed with error 0x%lx\n", GetLastError());
goto Cleanup; goto Cleanup;
} }
if (!wcsicmp(DriverInfoDetailData.SectionName, if (!_wcsicmp(DriverInfoDetailData.SectionName,
InfSection) != 0) InfSection) != 0)
{ {
/* We have found the right driver */ /* We have found the right driver */

View file

@ -1,26 +1,7 @@
#ifndef __DEVMGR_H #ifndef __DEVMGR_H
#define __DEVMGR_H #define __DEVMGR_H
#include <stdarg.h> //WINE_DEFAULT_DEBUG_CHANNEL(devmgr);
#include <stdlib.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winnls.h>
#include <winuser.h>
#include <wchar.h>
#include <regstr.h>
#include <setupapi.h>
#include <cfgmgr32.h>
#include <dll/newdevp.h>
#include <dll/devmgr/devmgr.h>
#include <wine/debug.h>
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(devmgr);
extern HINSTANCE hDllInstance; extern HINSTANCE hDllInstance;

View file

@ -1,257 +0,0 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS devmgr.dll
* FILE: lib/devmgr/stubs.c
* PURPOSE: devmgr.dll stubs
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* NOTES: If you implement a function, remove it from this file
*
* Some helpful resources:
* http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;815320
* http://www.jsiinc.com/SUBO/tip7400/rh7482.htm
* http://www.jsiinc.com/SUBM/tip6400/rh6490.htm
*
* UPDATE HISTORY:
* 04-04-2004 Created
*/
#include "precomp.h"
/***************************************************************************
* NAME EXPORTED
* DeviceManager_ExecuteA
*
* DESCRIPTION
* Starts the Device Manager
*
* ARGUMENTS
* hWndParent: Handle to the parent window
* hInst: Handle to the application instance
* lpMachineName: Machine Name, NULL is the local machine
* nCmdShow: Specifies how the window should be shown
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if the device manager could not be executed
*
* REVISIONS
*
* NOTE
* - Win runs the device manager in a separate process, so hWndParent is somehow
* obsolete.
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManager_ExecuteA(HWND hWndParent,
HINSTANCE hInst,
LPCSTR lpMachineName,
int nCmdShow)
{
UNIMPLEMENTED;
return FALSE;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManager_ExecuteW
*
* DESCRIPTION
* Starts the Device Manager
*
* ARGUMENTS
* hWndParent: Handle to the parent window
* hInst: Handle to the application instance
* lpMachineName: Machine Name, NULL is the local machine
* nCmdShow: Specifies how the window should be shown
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if the device manager could not be executed
*
* REVISIONS
*
* NOTE
* - Win runs the device manager in a separate process, so hWndParent is somehow
* obsolete.
*
* @unimplemented
*/
//BOOL
//WINAPI
//DeviceManager_ExecuteW(HWND hWndParent,
// HINSTANCE hInst,
// LPCWSTR lpMachineName,
// int nCmdShow)
//{
// UNIMPLEMENTED;
// return FALSE;
//}
/***************************************************************************
* NAME EXPORTED
* DeviceProblemWizard_RunDLLA
*
* DESCRIPTION
* Calls the device problem wizard
*
* 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
* - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
* a typo so we additionally export an alias function
* - 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().
*
* @unimplemented
*/
VOID
WINAPI
DeviceProblemWizard_RunDLLA(HWND hWndParent,
HINSTANCE hInst,
LPCSTR lpDeviceCmd,
int nCmdShow)
{
UNIMPLEMENTED;
}
/***************************************************************************
* NAME EXPORTED
* DeviceProblemWizard_RunDLLW
*
* DESCRIPTION
* Calls the device problem wizard
*
* 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
* - Win XP exports this function as DeviceProblenWizard_RunDLLA, apparently it's
* a typo so we additionally export an alias function
* - 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().
*
* @unimplemented
*/
VOID
WINAPI
DeviceProblemWizard_RunDLLW(HWND hWndParent,
HINSTANCE hInst,
LPCWSTR lpDeviceCmd,
int nCmdShow)
{
UNIMPLEMENTED;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManagerPrintA
*
* DESCRIPTION
* Calls the device problem wizard
*
* ARGUMENTS
* lpMachineName: Machine Name, NULL is the local machine
* lpPrinter: Filename of the printer where it should be printed on
* nPrintMode: Specifies what kind of information is to be printed
* DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
* uNumberOfGuids, Guids are ignored
* DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
* DEV_PRINT_ALL: Prints an abstract of system information and all
* system devices
* uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
* lpGuids: Array of device guids, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if errors occured
*
* REVISIONS
*
* NOTE
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManagerPrintA(LPCSTR lpMachineName,
LPCSTR lpPrinter,
int nPrintMode,
UINT uNumberOfGuids,
LPGUID lpGuids)
{
UNIMPLEMENTED;
return FALSE;
}
/***************************************************************************
* NAME EXPORTED
* DeviceManagerPrintW
*
* DESCRIPTION
* Calls the device problem wizard
*
* ARGUMENTS
* lpMachineName: Machine Name, NULL is the local machine
* lpPrinter: Filename of the printer where it should be printed on
* nPrintMode: Specifies what kind of information is to be printed
* DEV_PRINT_ABSTRACT: Prints an abstract of system information, the parameters
* uNumberOfGuids, Guids are ignored
* DEV_PRINT_SELECTED: Prints information about the devices listed in Guids
* DEV_PRINT_ALL: Prints an abstract of system information and all
* system devices
* uNumberOfGuids: Numbers of guids in the Guids array, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
* lpGuids: Array of device guids, this parameter is ignored unless
* nPrintMode is DEV_PRINT_SELECTED
*
* RETURN VALUE
* TRUE: if no errors occured
* FALSE: if errors occured
*
* REVISIONS
*
* NOTE
*
* @unimplemented
*/
BOOL
WINAPI
DeviceManagerPrintW(LPCWSTR lpMachineName,
LPCWSTR lpPrinter,
int nPrintMode,
UINT uNumberOfGuids,
LPGUID lpGuids)
{
UNIMPLEMENTED;
return FALSE;
}

View file

@ -0,0 +1,36 @@
/*
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS devmgr.dll
* FILE: lib/devmgr/stubs.c
* PURPOSE: devmgr.dll stubs
* PROGRAMMER: Thomas Weidenmueller (w3seek@users.sourceforge.net)
* NOTES: If you implement a function, remove it from this file
*
* Some helpful resources:
* http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;815320
* http://www.jsiinc.com/SUBO/tip7400/rh7482.htm
* http://www.jsiinc.com/SUBM/tip6400/rh6490.htm
*
* UPDATE HISTORY:
* 04-04-2004 Created
*/
#include "stdafx.h"
// remove me
BOOL
WINAPI
InstallDevInst(
IN HWND hWndParent,
IN LPCWSTR InstanceId,
IN BOOL bUpdate,
OUT LPDWORD lpReboot)
{
return FALSE;
}
unsigned long __stdcall pSetupGuidFromString(wchar_t const *, struct _GUID *)
{
return 1;
}

View file

@ -12,7 +12,7 @@
#include <Cfgmgr32.h> #include <Cfgmgr32.h>
#include <devguid.h> #include <devguid.h>
#include <process.h> #include <process.h>
#include <RegStr.h>
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <tchar.h> #include <tchar.h>
@ -21,6 +21,20 @@
#include <atlcoll.h> #include <atlcoll.h>
#include <strsafe.h> #include <strsafe.h>
#define ERR printf
#define FIXME printf
DWORD WINAPI pSetupGuidFromString(PCWSTR pString, LPGUID lpGUID);
BOOL
WINAPI
InstallDevInst(
IN HWND hWndParent,
IN LPCWSTR InstanceId,
IN BOOL bUpdate,
OUT LPDWORD lpReboot);
#else #else
#include <string.h> #include <string.h>