[ros-dev] Another NDIS bug fix.

Jerry crashfourit at gmail.com
Tue Jan 24 06:28:09 CET 2006


Inproved the implimentation of NdisWriteConfiguration(), by Crashfourit.
-------------- next part --------------
Index: drivers/net/ndis/ndis/config.c
===================================================================
--- drivers/net/ndis/ndis/config.c	(revision 21005)
+++ drivers/net/ndis/ndis/config.c	(working copy)
@@ -66,6 +66,18 @@
     ULONG ParameterType = ParameterValue->ParameterType;
     ULONG DataSize;
     PVOID Data;
+    
+    /* 
+        The next few lines of code before teh first if statement are used when
+        ParameterType equals NdisParameterHexInteger or NdisParameterInteger.        
+        This is done so that Buff can be used beyond the switch statement.       
+    */     
+    UNICODE_STRING buff;
+    WCHAR str[25];
+             
+    Buff->Length=0;
+    Buff->MaximumLength = sizeof(str) / sizeof(str[0]);
+    Buff->Buffer=str;    
 
     if(ParameterType != NdisParameterInteger &&
         ParameterType != NdisParameterHexInteger &&
@@ -81,12 +93,29 @@
     /* reset parameter type to standard reg types */
     switch(ParameterType)
     {
-        /* TODO: figure out what do do with these; are they different? */
+        /* 
+           TODO: figure out what do do with these; are they different? 
+           Done by Crashfourit
+        */
         case NdisParameterHexInteger:
-        case NdisParameterInteger:
-            ParameterType = REG_SZ;
-            Data = &ParameterValue->ParameterData.IntegerData;
-            DataSize = sizeof(ULONG);
+        case NdisParameterInteger:     
+            {                                                           
+               if (!NT_SUCCESS(RtlIntegerToUnicodeString(
+                     ParameterValue->ParameterData.IntegerData,
+                     ( ParameterType == NdisParameterHexInteger ) ? 16 : 10,
+                     &buff))
+                  )
+               {     
+                     *Status = NDIS_STATUS_FAILURE;
+                     return;
+               }
+               else
+               {
+                     ParameterType = REG_SZ;
+                     Data = &Buff->Buffer;
+                     DataSize = Buff->Length;
+               }  
+            }
             break;
 
         case NdisParameterString:


More information about the Ros-dev mailing list