Skip to contentSkip to conversation

WinPv driver 64bit patch

PATCH Wayne Gong 2 participants 5 messages Jul 8, 2008 – Jul 9, 2008

lore
Share & tools
lore

Wayne Gong

author
#0 lore raw

Hi James,

This patch can help WinPv driver work fine on Windows 2003 x64 version. Please review.

Best regards
Wayne

# HG changeset patch
# User Wayne Gong <[email protected]> # Date 1215493632 -28800
# Node ID dbaf8f156f3f4cd6f6acc5a10cdf1d282809d1ff # Parent bfc6e1f99b4fcbd4a5d20b1392d28be66fd310fc Let winpv work for win2k3_x64.

xenhide/xenhide.c +22 -13
diff -r bfc6e1f99b4f -r dbaf8f156f3f xenhide/xenhide.c
@@ -171,12 +171,12 @@
 XenHide_IdSuffixMatches(PDEVICE_OBJECT pdo, PWCHAR matching_id)
 {
   NTSTATUS status;
-  ULONG remaining;
-  ULONG string_length;
+  ULONG cmpLen = 0;
   WCHAR ids[512];
   PWCHAR ptr;
   ULONG ids_length;
   int i;
+  size_t j = 0;
   
   for (i = 0; i < 2; i++)
   {
@@ -190,20 +190,29 @@
       //KdPrint((__DRIVER_NAME "     i = %d, status = %x, ids_length = %d\n", i, status, ids_length));
       continue;
     }
-    
-    remaining = ids_length / 2;
-    for (ptr = ids; *ptr != 0; ptr += string_length + 1)
+    ptr = ids;
+    for (j = 0; j < 512 - 3; j++)
     {
-      RtlStringCchLengthW(ptr, remaining, (size_t *)&string_length);
-      remaining -= string_length - 1;
-      if (string_length >= wcslen(matching_id))
+      if (ids[j] == L'V' && ids[j+1] == L'E' && ids[j+2] == L'N')
+      {  
+        ptr = ids + j;
+        cmpLen = 17; // "VEN_10EC&DEV_8139"
+        break;
+      }
+      if (ids[j] == L'P' && ids[j+1] == L'N' && ids[j+2] == L'P')
       {
-        ptr += string_length - wcslen(matching_id);
-        string_length -= (ULONG)wcslen(matching_id);
+        ptr = ids + j;
+        cmpLen = 7; // "PNP0A03"
+        break;
       }
-      //KdPrint((__DRIVER_NAME "     Comparing '%S' and '%S'\n", ptr, matching_id));
-      if (wcscmp(ptr, matching_id) == 0)
-       return TRUE;
+    }
+    if (j == 512 - 3)
+      break;
+    //KdPrint((__DRIVER_NAME "     Comparing '%S' and '%S'\n", ptr, matching_id));
+    if (wcsncmp(ptr, matching_id, cmpLen) == 0)
+    {
+      //KdPrint((__DRIVER_NAME "     Matched\n"));
+      return TRUE;
     }
   }
   //KdPrint((__DRIVER_NAME "     No match\n"));  

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 1 line

From a quick glance of your patch, I can't seem to figure out why you

have made the changes you have made... can you offer a quick explanation?

Thanks

James

Quoted 9 lines

-----Original Message-----
From: Wayne Gong [mailto:[email protected]]
Sent: Tuesday, 8 July 2008 15:10
To: [email protected]; James Harper
Subject: WinPv driver 64bit patch

Hi James,

This patch can help WinPv driver work fine on Windows 2003 x64

version.

Quoted 4 lines

Please review.

Best regards
Wayne

author
#2 lore raw
Quoted 4 lines · James Harper
Quoted 1 line

From a quick glance of your patch, I can't seem to figure out why you

have made the changes you have made... can you offer a quick explanation?

In my 64bit environment as sent to you yesterday, xenhide driver will enter a dead loop in function XenHide_IdSuffixMatches and windows cannot boot up correctly.

Wayne

#3 lore raw
In reply to Wayne Gong

Wayne,

I've taken an alternate approach with this - the original code had 2 bugs:

. I had foolishly cast a pointer to size_t (64 bits on amd64) to a PULONG, so 'i' was getting overwritten with 0 and the loop would never finish.
. I had mucked up some addition and subtraction

Btw, I haven't actually tested on x64 in a while, I am finding the following problems:

1. xennet won't install, when I try to install it says 'The parameter value is incorrect'
2. xenvbd appears to install okay, but there are some odd messages in the logs
3. xenstub won't load, I get "xenstub.sys has been blocked from loading due to incompatibility with this system."

Any ideas?

James

Quoted 9 lines

-----Original Message-----
From: Wayne Gong [mailto:[email protected]]
Sent: Tuesday, 8 July 2008 15:10
To: [email protected]; James Harper
Subject: WinPv driver 64bit patch

Hi James,

This patch can help WinPv driver work fine on Windows 2003 x64

version.

Quoted 4 lines

Please review.

Best regards
Wayne

#4 lore raw
Quoted 8 lines

Btw, I haven't actually tested on x64 in a while, I am finding the following problems:

1. xennet won't install, when I try to install it says 'The parameter value is incorrect'
2. xenvbd appears to install okay, but there are some odd messages in the logs
3. xenstub won't load, I get "xenstub.sys has been blocked from

loading

Quoted 2 lines

due to incompatibility with this system."

Disregard all of that. I was using the debugger and the debugger was offering the 32 bit drivers. All working now.

James