[ros-diffs] [cgutman] 53250: [HAL] - Fix string length calculation

cgutman at svn.reactos.org cgutman at svn.reactos.org
Mon Aug 15 03:20:18 UTC 2011


Author: cgutman
Date: Mon Aug 15 03:20:17 2011
New Revision: 53250

URL: http://svn.reactos.org/svn/reactos?rev=53250&view=rev
Log:
[HAL]
- Fix string length calculation

Modified:
    trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c

Modified: trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c?rev=53250&r1=53249&r2=53250&view=diff
==============================================================================
--- trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/acpi/halpnpdd.c [iso-8859-1] Mon Aug 15 03:20:17 2011
@@ -492,16 +492,12 @@
                 /* Unknown */
                 return STATUS_NOT_SUPPORTED;
             }
-            
-            /* Static length */
-            Length = 32;
             break;
             
         case BusQueryInstanceID:
                     
             /* And our instance ID */
             Id = L"0";
-            Length = sizeof(L"0") + sizeof(UNICODE_NULL);
             break;
             
         case BusQueryCompatibleIDs:
@@ -510,6 +506,9 @@
             /* We don't support anything else */
             return STATUS_NOT_SUPPORTED;
     }
+    
+    /* Calculate the length */
+    Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
     
     /* Allocate the buffer */
     Buffer = ExAllocatePoolWithTag(PagedPool,
@@ -556,14 +555,12 @@
             
             /* This is our hardware ID */
             Id = HalHardwareIdString;
-            Length = wcslen(HalHardwareIdString) + sizeof(UNICODE_NULL);
             break;
             
         case BusQueryInstanceID:
             
             /* And our instance ID */
             Id = L"0";
-            Length = sizeof(L"0") + sizeof(UNICODE_NULL);
             break;
             
         default:
@@ -571,6 +568,9 @@
             /* We don't support anything else */
             return STATUS_NOT_SUPPORTED;
     }
+    
+    /* Calculate the length */
+    Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL);
     
     /* Allocate the buffer */
     Buffer = ExAllocatePoolWithTag(PagedPool,




More information about the Ros-diffs mailing list