Author: gedmurphy
Date: Sat Oct 7 19:02:43 2006
New Revision: 24434
URL:
http://svn.reactos.org/svn/reactos?rev=24434&view=rev
Log:
move the string parsing routine into it's own function so it can be used with
DeviceProblemWizard_RunDLL when required.
Modified:
trunk/reactos/dll/win32/devmgr/advprop.c
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 (original)
+++ trunk/reactos/dll/win32/devmgr/advprop.c Sat Oct 7 19:02:43 2006
@@ -1502,6 +1502,64 @@
}
+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
@@ -1908,56 +1966,13 @@
WCHAR szMachineName[MAX_COMPUTERNAME_LENGTH+1];
LPWSTR lpString = (LPWSTR)lpDeviceCmd;
- 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';
- }
- }
- 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++;
- }
-
- //DPRINT("DeviceID: %S, MachineName: %S\n", szDeviceID, szMachineName);
-
- if (szDeviceID == L'\0')
+ if (!GetDeviceAndComputerName(lpString,
+ szDeviceID,
+ szMachineName))
+ {
+ DPRINT1("DeviceProperties_RunDLLW DeviceID: %S, MachineName: %S\n",
szDeviceID, szMachineName);
return;
+ }
DevicePropertiesW(hWndParent,
hInst,