Author: ekohl Date: Tue Feb 9 23:54:02 2010 New Revision: 45541
URL: http://svn.reactos.org/svn/reactos?rev=45541&view=rev Log: Implement device location information override support and add the location override value for PS/2 mice. PS/2 keyboards be added next.
Please translate the location override string.
Modified: trunk/reactos/dll/win32/devmgr/advprop.c trunk/reactos/dll/win32/devmgr/hwpage.c trunk/reactos/dll/win32/devmgr/misc.c trunk/reactos/dll/win32/devmgr/precomp.h trunk/reactos/media/inf/msmouse.inf
Modified: trunk/reactos/dll/win32/devmgr/advprop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/advprop.c?... ============================================================================== --- trunk/reactos/dll/win32/devmgr/advprop.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/advprop.c [iso-8859-1] Tue Feb 9 23:54:02 2010 @@ -1405,7 +1405,8 @@ }
/* set the device location edit control text */ - if (GetDeviceLocationString(DeviceInfoData->DevInst, + if (GetDeviceLocationString(DeviceInfoSet, + DeviceInfoData, dap->ParentDevInst, dap->szTemp, sizeof(dap->szTemp) / sizeof(dap->szTemp[0])))
Modified: trunk/reactos/dll/win32/devmgr/hwpage.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/hwpage.c?r... ============================================================================== --- trunk/reactos/dll/win32/devmgr/hwpage.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/hwpage.c [iso-8859-1] Tue Feb 9 23:54:02 2010 @@ -181,7 +181,8 @@ }
/* get the location string */ - if (GetDeviceLocationString(HwDevInfo->DevInfoData.DevInst, + if (GetDeviceLocationString(HwDevInfo->ClassDevInfo->hDevInfo, + &HwDevInfo->DevInfoData, 0, szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0])) &&
Modified: trunk/reactos/dll/win32/devmgr/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/misc.c?rev... ============================================================================== --- trunk/reactos/dll/win32/devmgr/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/misc.c [iso-8859-1] Tue Feb 9 23:54:02 2010 @@ -317,7 +317,8 @@
BOOL -GetDeviceLocationString(IN DEVINST dnDevInst OPTIONAL, +GetDeviceLocationString(IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize) @@ -326,68 +327,104 @@ ULONG DataSize; CONFIGRET cRet; LPWSTR szFormatted; + HKEY hKey; + DWORD dwSize, dwType; BOOL Ret = FALSE;
DataSize = BufferSize * sizeof(WCHAR); szBuffer[0] = L'\0'; - if (dnParentDevInst != 0) - { - /* query the parent node name */ - if (CM_Get_DevNode_Registry_Property(dnParentDevInst, - CM_DRP_DEVICEDESC, - &RegDataType, - szBuffer, - &DataSize, - 0) == CR_SUCCESS && - RegDataType == REG_SZ && - LoadAndFormatString(hDllInstance, - IDS_DEVONPARENT, - &szFormatted, - szBuffer) != 0) - { - wcsncpy(szBuffer, - szFormatted, - BufferSize - 1); - szBuffer[BufferSize - 1] = L'\0'; - LocalFree((HLOCAL)szFormatted); - Ret = TRUE; - } - } - else if (dnDevInst != 0) - { - cRet = CM_Get_DevNode_Registry_Property(dnDevInst, - CM_DRP_LOCATION_INFORMATION, - &RegDataType, - szBuffer, - &DataSize, - 0); - if (cRet == CR_SUCCESS && RegDataType == REG_SZ) - { - /* FIXME - check string for NULL termination! */ - Ret = TRUE; - } - - if (Ret && szBuffer[0] >= L'0' && szBuffer[0] <= L'9') - { - /* convert the string to an integer value and create a - formatted string */ - ULONG ulLocation = (ULONG)wcstoul(szBuffer, - NULL, - 10); - if (LoadAndFormatString(hDllInstance, - IDS_LOCATIONSTR, - &szFormatted, - ulLocation, - szBuffer) != 0) + + hKey = SetupDiOpenDevRegKey(DeviceInfoSet, + DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DRV, + KEY_QUERY_VALUE); + if (hKey != INVALID_HANDLE_VALUE) + { + /* query the LocationInformationOverride value */ + dwSize = BufferSize; + if (RegQueryValueEx(hKey, + L"LocationInformationOverride", + NULL, + &dwType, + (LPBYTE)szBuffer, + &dwSize) == ERROR_SUCCESS && + dwType == REG_SZ && + szBuffer[0] != L'\0') + { + Ret = TRUE; + } + else + { + szBuffer[0] = L'\0'; + } + + RegCloseKey(hKey); + } + + + if (!Ret) + { + if (dnParentDevInst != 0) + { + /* query the parent node name */ + if (CM_Get_DevNode_Registry_Property(dnParentDevInst, + CM_DRP_DEVICEDESC, + &RegDataType, + szBuffer, + &DataSize, + 0) == CR_SUCCESS && + RegDataType == REG_SZ && + LoadAndFormatString(hDllInstance, + IDS_DEVONPARENT, + &szFormatted, + szBuffer) != 0) { wcsncpy(szBuffer, szFormatted, BufferSize - 1); szBuffer[BufferSize - 1] = L'\0'; LocalFree((HLOCAL)szFormatted); + Ret = TRUE; } - else - Ret = FALSE; + } + else if (DeviceInfoData->DevInst != 0) + { + cRet = CM_Get_DevNode_Registry_Property(DeviceInfoData->DevInst, + CM_DRP_LOCATION_INFORMATION, + &RegDataType, + szBuffer, + &DataSize, + 0); + if (cRet == CR_SUCCESS && RegDataType == REG_SZ) + { + /* FIXME - check string for NULL termination! */ + Ret = TRUE; + } + + if (Ret && szBuffer[0] >= L'0' && szBuffer[0] <= L'9') + { + /* convert the string to an integer value and create a + formatted string */ + ULONG ulLocation = (ULONG)wcstoul(szBuffer, + NULL, + 10); + if (LoadAndFormatString(hDllInstance, + IDS_LOCATIONSTR, + &szFormatted, + ulLocation, + szBuffer) != 0) + { + wcsncpy(szBuffer, + szFormatted, + BufferSize - 1); + szBuffer[BufferSize - 1] = L'\0'; + LocalFree((HLOCAL)szFormatted); + } + else + Ret = FALSE; + } } }
Modified: trunk/reactos/dll/win32/devmgr/precomp.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/precomp.h?... ============================================================================== --- trunk/reactos/dll/win32/devmgr/precomp.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/precomp.h [iso-8859-1] Tue Feb 9 23:54:02 2010 @@ -70,7 +70,8 @@ IN DWORD BufferSize);
BOOL -GetDeviceLocationString(IN DEVINST dnDevInst OPTIONAL, +GetDeviceLocationString(IN HDEVINFO DeviceInfoSet, + IN PSP_DEVINFO_DATA DeviceInfoData, IN DEVINST dnParentDevInst OPTIONAL, OUT LPWSTR szBuffer, IN DWORD BufferSize);
Modified: trunk/reactos/media/inf/msmouse.inf URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/msmouse.inf?rev=4... ============================================================================== Binary files - no diff available.