win-pvdrivers

changeset 339:9e3eb0ed57b1

Automated merge with ssh://win-pvdrivers@xenbits.xensource.com/win-pvdrivers.hg
author Andy Grover <andy.grover@oracle.com>
date Sun Jun 22 17:32:05 2008 -0700 (2008-06-22)
parents 72acaf6e4668 e69e4d79ee3f
children 2be08f708250
files
line diff
     1.1 --- a/common.inc	Sun Jun 22 17:31:23 2008 -0700
     1.2 +++ b/common.inc	Sun Jun 22 17:32:05 2008 -0700
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.10.0
     1.5 +VERSION=0.9.10.4
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/installer.nsi	Sun Jun 22 17:31:23 2008 -0700
     2.2 +++ b/installer.nsi	Sun Jun 22 17:32:05 2008 -0700
     2.3 @@ -3,7 +3,7 @@
     2.4  
     2.5  !define AppName "Xen PV Drivers"
     2.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     2.7 -!define Version "0.9.10"
     2.8 +!define Version "0.9.11-pre4"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
    2.12 @@ -53,7 +53,7 @@ SectionEnd
    2.13    
    2.14  Section "Windows 2000" win2k
    2.15    SetOutPath $INSTDIR
    2.16 -  File /r .\ca.cer
    2.17 +  File /nonfatal .\ca.cer
    2.18    SetOutPath $INSTDIR\drivers
    2.19    File .\target\win2k\xenpci.inf
    2.20    File .\target\win2k\xennet.inf
    2.21 @@ -72,14 +72,14 @@ SectionEnd
    2.22  
    2.23  Section "Windows XP" winxp
    2.24    SetOutPath $INSTDIR
    2.25 -  File /r .\ca.cer
    2.26 +  File /nonfatal .\ca.cer
    2.27    SetOutPath $INSTDIR\drivers
    2.28    File .\target\winxp\xenpci.inf
    2.29    File .\target\winxp\xennet.inf
    2.30    File .\target\winxp\xenvbd.inf
    2.31    File .\target\winxp\xenscsi.inf
    2.32    File .\target\winxp\xenstub.inf
    2.33 -  File /r .\target\winxp\xengplpv.cat
    2.34 +  File /nonfatal .\target\winxp\xengplpv.cat
    2.35    SetOutPath $INSTDIR\drivers\i386
    2.36    File .\target\winxp\i386\xenpci.sys
    2.37    File .\target\winxp\i386\xenhide.sys
    2.38 @@ -92,14 +92,14 @@ SectionEnd
    2.39  
    2.40  Section "Windows 2003 x32" win2k3x32
    2.41    SetOutPath $INSTDIR
    2.42 -  File /r .\ca.cer
    2.43 +  File /nonfatal .\ca.cer
    2.44    SetOutPath $INSTDIR\drivers
    2.45    File .\target\winnet\xenpci.inf
    2.46    File .\target\winnet\xennet.inf
    2.47    File .\target\winnet\xenvbd.inf
    2.48    File .\target\winnet\xenscsi.inf
    2.49    File .\target\winnet\xenstub.inf
    2.50 -  File /r .\target\winnet\xengplpv.cat
    2.51 +  File /nonfatal .\target\winnet\xengplpv.cat
    2.52    SetOutPath $INSTDIR\drivers\i386
    2.53    File .\target\winnet\i386\xenpci.sys
    2.54    File .\target\winnet\i386\xenhide.sys
    2.55 @@ -112,14 +112,14 @@ SectionEnd
    2.56  
    2.57  Section "Windows 2003 x64" win2k3x64
    2.58    SetOutPath $INSTDIR
    2.59 -  File /r .\ca.cer
    2.60 +  File /nonfatal .\ca.cer
    2.61    SetOutPath $INSTDIR\drivers
    2.62    File .\target\winnet\xenpci.inf
    2.63    File .\target\winnet\xennet.inf
    2.64    File .\target\winnet\xenvbd.inf
    2.65    File .\target\winnet\xenscsi.inf
    2.66    File .\target\winnet\xenstub.inf
    2.67 -  File /r .\target\winnet\xengplpv.cat
    2.68 +  File /nonfatal .\target\winnet\xengplpv.cat
    2.69    SetOutPath $INSTDIR\drivers\amd64
    2.70    File .\target\winnet\amd64\xenpci.sys
    2.71    File .\target\winnet\amd64\xenhide.sys
    2.72 @@ -132,14 +132,14 @@ SectionEnd
    2.73  
    2.74  Section "Windows 2008 x32" win2k8x32
    2.75    SetOutPath $INSTDIR
    2.76 -  File /r .\ca.cer
    2.77 +  File /nonfatal .\ca.cer
    2.78    SetOutPath $INSTDIR\drivers
    2.79    File .\target\winlh\xenpci.inf
    2.80    File .\target\winlh\xennet.inf
    2.81    File .\target\winlh\xenvbd.inf
    2.82    File .\target\winlh\xenscsi.inf
    2.83    File .\target\winlh\xenstub.inf
    2.84 -  File /r .\target\winlh\xengplpv.cat
    2.85 +  File /nonfatal .\target\winlh\xengplpv.cat
    2.86    SetOutPath $INSTDIR\drivers\i386
    2.87    File .\target\winlh\i386\xenpci.sys
    2.88    File .\target\winlh\i386\xenhide.sys
    2.89 @@ -152,14 +152,14 @@ SectionEnd
    2.90  
    2.91  Section "Windows 2008 x64" win2k8x64
    2.92    SetOutPath $INSTDIR
    2.93 -  File /r .\ca.cer
    2.94 +  File /nonfatal .\ca.cer
    2.95    SetOutPath $INSTDIR\drivers
    2.96    File .\target\winlh\xenpci.inf
    2.97    File .\target\winlh\xennet.inf
    2.98    File .\target\winlh\xenvbd.inf
    2.99    File .\target\winlh\xenscsi.inf
   2.100    File .\target\winlh\xenstub.inf
   2.101 -  File /r .\target\winlh\xengplpv.cat
   2.102 +  File /nonfatal .\target\winlh\xengplpv.cat
   2.103    SetOutPath $INSTDIR\drivers\amd64
   2.104    File .\target\winlh\amd64\xenpci.sys
   2.105    File .\target\winlh\amd64\xenhide.sys
     3.1 --- a/xenconfig/xenconfig.c	Sun Jun 22 17:31:23 2008 -0700
     3.2 +++ b/xenconfig/xenconfig.c	Sun Jun 22 17:32:05 2008 -0700
     3.3 @@ -349,7 +349,7 @@ XenConfig_Pnp_StartDevice(PDEVICE_OBJECT
     3.4      prd->ShareDisposition = CmResourceShareDeviceExclusive;
     3.5      prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
     3.6      KdPrint((__DRIVER_NAME "     PFN[0] = %p\n", MmGetMdlPfnArray(mdl)[0]));
     3.7 -    prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
     3.8 +    prd->u.Memory.Start.QuadPart = ((ULONGLONG)MmGetMdlPfnArray(mdl)[0]) << PAGE_SHIFT;
     3.9      prd->u.Memory.Length = PAGE_SIZE;
    3.10      KdPrint((__DRIVER_NAME "     Start = %08x:%08x, Length = %d\n", prd->u.Memory.Start.HighPart, prd->u.Memory.Start.LowPart, prd->u.Memory.Length));
    3.11      stack->Parameters.StartDevice.AllocatedResourcesTranslated = new_crl;
    3.12 @@ -362,7 +362,7 @@ XenConfig_Pnp_StartDevice(PDEVICE_OBJECT
    3.13      prd->Type = CmResourceTypeMemory;
    3.14      prd->ShareDisposition = CmResourceShareDeviceExclusive;
    3.15      prd->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
    3.16 -    prd->u.Memory.Start.QuadPart = MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
    3.17 +    prd->u.Memory.Start.QuadPart = (ULONGLONG)MmGetMdlPfnArray(mdl)[0] << PAGE_SHIFT;
    3.18      prd->u.Memory.Length = PAGE_SIZE;
    3.19      stack->Parameters.StartDevice.AllocatedResources = new_crl;
    3.20  
     4.1 --- a/xenhide/xenhide.c	Sun Jun 22 17:31:23 2008 -0700
     4.2 +++ b/xenhide/xenhide.c	Sun Jun 22 17:32:05 2008 -0700
     4.3 @@ -38,6 +38,7 @@ XenHide_AddDevice();
     4.4  #endif
     4.5  
     4.6  static BOOLEAN gplpv;
     4.7 +static XENHIDE_DRIVER_DATA xenhide_global_data;
     4.8  
     4.9  static NTSTATUS
    4.10  XenHide_Power(PDEVICE_OBJECT device_object, PIRP irp)
    4.11 @@ -155,11 +156,60 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    4.12    DriverObject->MajorFunction[IRP_MJ_POWER] = XenHide_Power;
    4.13    DriverObject->DriverExtension->AddDevice = XenHide_AddDevice;
    4.14  
    4.15 +  RtlZeroMemory(&xenhide_global_data, sizeof(XENHIDE_DRIVER_DATA));
    4.16 +
    4.17 +  InitializeListHead(&xenhide_global_data.hide_list_head);
    4.18 +  KeInitializeSpinLock(&xenhide_global_data.hide_list_lock);
    4.19 +  KeInitializeEvent(&xenhide_global_data.hide_list_event, SynchronizationEvent, FALSE);
    4.20 +
    4.21    KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
    4.22  
    4.23    return status;
    4.24  }
    4.25  
    4.26 +static BOOLEAN
    4.27 +XenHide_IdSuffixMatches(PDEVICE_OBJECT pdo, PWCHAR matching_id)
    4.28 +{
    4.29 +  NTSTATUS status;
    4.30 +  ULONG remaining;
    4.31 +  ULONG string_length;
    4.32 +  WCHAR ids[512];
    4.33 +  PWCHAR ptr;
    4.34 +  ULONG ids_length;
    4.35 +  int i;
    4.36 +  
    4.37 +  for (i = 0; i < 2; i++)
    4.38 +  {
    4.39 +    if (i == 0)
    4.40 +      status = IoGetDeviceProperty(pdo, DevicePropertyCompatibleIDs, sizeof(ids), ids, &ids_length);
    4.41 +    else
    4.42 +      status = IoGetDeviceProperty(pdo, DevicePropertyHardwareID, sizeof(ids), ids, &ids_length);
    4.43 +      
    4.44 +    if (!NT_SUCCESS(status))
    4.45 +    {
    4.46 +      KdPrint((__DRIVER_NAME "     i = %d, status = %x, ids_length = %d\n", i, status, ids_length));
    4.47 +      continue;
    4.48 +    }
    4.49 +    
    4.50 +    remaining = ids_length / 2;
    4.51 +    for (ptr = ids; *ptr != 0; ptr += string_length + 1)
    4.52 +    {
    4.53 +      RtlStringCchLengthW(ptr, remaining, (size_t *)&string_length);
    4.54 +      remaining -= string_length - 1;
    4.55 +      if (string_length >= wcslen(matching_id))
    4.56 +      {
    4.57 +        ptr += string_length - wcslen(matching_id);
    4.58 +        string_length -= wcslen(matching_id);
    4.59 +      }
    4.60 +      KdPrint((__DRIVER_NAME "     Comparing '%S' and '%S'\n", ptr, matching_id));
    4.61 +      if (wcscmp(ptr, matching_id) == 0)
    4.62 +       return TRUE;
    4.63 +    }
    4.64 +  }
    4.65 +  KdPrint((__DRIVER_NAME "     No match\n"));  
    4.66 +  return FALSE;
    4.67 +}
    4.68 +
    4.69  static NTSTATUS
    4.70  XenHide_AddDevice(
    4.71    PDRIVER_OBJECT DriverObject,
    4.72 @@ -170,43 +220,77 @@ XenHide_AddDevice(
    4.73    PDEVICE_OBJECT deviceObject = NULL;
    4.74    PXENHIDE_DEVICE_DATA xhdd;
    4.75    ULONG length;
    4.76 -  WCHAR buffer[256];
    4.77 -//  size_t StrLen;
    4.78 -//  int Match;
    4.79 -//  PWCHAR Ptr;
    4.80    GUID bus_type;
    4.81 +  WCHAR device_description[256];
    4.82 +  KIRQL old_irql;
    4.83 +  USHORT hide_type;
    4.84 +  PXENHIDE_HIDE_LIST_ENTRY list_entry;
    4.85  
    4.86 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.87 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.88  
    4.89 -  length = 256;
    4.90 -  status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyDeviceDescription, length, buffer, &length);
    4.91 -//  if (!NT_SUCCESS(status))
    4.92 -//    KdPrint((__DRIVER_NAME "     (failed to get DevicePropertyDeviceDescription %08x)\n", status));
    4.93 -//  else
    4.94 -//    KdPrint((__DRIVER_NAME "     Description = %S\n", buffer));
    4.95 +  
    4.96 +  length = 512;
    4.97 +  status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyDeviceDescription, length, device_description, &length);
    4.98 +  if (!NT_SUCCESS(status))
    4.99 +  {
   4.100 +    device_description[0] = 0;
   4.101 +  }
   4.102 +
   4.103 +  KdPrint((__DRIVER_NAME "     Checking '%S'\n", device_description));
   4.104  
   4.105    length = sizeof(GUID);
   4.106    status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyBusTypeGuid, length, &bus_type, &length);
   4.107    if (!NT_SUCCESS(status))
   4.108    {
   4.109 -//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (failed to get DevicePropertyBusTypeGuid %08x)\n", status));
   4.110 +    RtlZeroMemory(&bus_type, sizeof(GUID));
   4.111 +  }
   4.112 +
   4.113 +  hide_type = XENHIDE_TYPE_NONE;
   4.114 +  if (gplpv)
   4.115 +  {
   4.116 +    /* hide only specific devices */
   4.117 +    if (XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_8086&DEV_7010")
   4.118 +      || XenHide_IdSuffixMatches(PhysicalDeviceObject, L"VEN_10EC&DEV_8139"))
   4.119 +    {
   4.120 +      hide_type = XENHIDE_TYPE_DEVICE;
   4.121 +    }
   4.122 +    else if (XenHide_IdSuffixMatches(PhysicalDeviceObject, L"PNP0A03"))
   4.123 +    {
   4.124 +      hide_type = XENHIDE_TYPE_PCI_BUS;
   4.125 +    }
   4.126 +  }
   4.127 +  else
   4.128 +  {
   4.129 +    /* hide everything on the xen bus */
   4.130 +    if (memcmp(&bus_type, &GUID_BUS_TYPE_XEN, sizeof(GUID)) == 0)
   4.131 +      hide_type = XENHIDE_TYPE_DEVICE;
   4.132 +  }
   4.133 +
   4.134 +  if (hide_type == XENHIDE_TYPE_NONE)
   4.135 +  {
   4.136 +    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (filter not required for %S)\n", device_description));
   4.137      return STATUS_SUCCESS;
   4.138    }
   4.139  
   4.140 -  if (!gplpv && memcmp(&bus_type, &GUID_BUS_TYPE_XEN, sizeof(GUID)) != 0)
   4.141 +  KdPrint((__DRIVER_NAME "     Installing Filter for %S\n", device_description));
   4.142 +
   4.143 +  if (gplpv && hide_type == XENHIDE_TYPE_DEVICE)
   4.144    {
   4.145 -//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == FALSE && bus_type != GUID_BUS_TYPE_XEN)\n"));
   4.146 -    return STATUS_SUCCESS;
   4.147 +    KeAcquireSpinLock(&xenhide_global_data.hide_list_lock, &old_irql);
   4.148 +    list_entry = ExAllocatePoolWithTag(PagedPool, sizeof(XENHIDE_HIDE_LIST_ENTRY), XENHIDE_POOL_TAG);
   4.149 +    list_entry->pdo = PhysicalDeviceObject;
   4.150 +    InsertTailList(&xenhide_global_data.hide_list_head, (PLIST_ENTRY)list_entry);
   4.151 +    KeReleaseSpinLock(&xenhide_global_data.hide_list_lock, old_irql);
   4.152 +    KeSetEvent(&xenhide_global_data.hide_list_event, IO_NO_INCREMENT, FALSE);
   4.153 +    ASSERT(xenhide_global_data.pci_bus_pdo);
   4.154 +    IoInvalidateDeviceRelations(xenhide_global_data.pci_bus_pdo, BusRelations);
   4.155    }
   4.156 -  
   4.157 -  if (gplpv && memcmp(&bus_type, &GUID_BUS_TYPE_PCI, sizeof(GUID)) != 0)
   4.158 +  else if (hide_type == XENHIDE_TYPE_PCI_BUS)
   4.159    {
   4.160 -//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == TRUE && bus_type != GUID_BUS_TYPE_PCI)\n"));
   4.161 -    return STATUS_SUCCESS;
   4.162 +    ASSERT(!xenhide_global_data.pci_bus_pdo);
   4.163 +    xenhide_global_data.pci_bus_pdo = PhysicalDeviceObject;
   4.164    }
   4.165  
   4.166 -//  KdPrint((__DRIVER_NAME "     Installing Filter\n"));
   4.167 -
   4.168    status = IoCreateDevice (DriverObject,
   4.169      sizeof(XENHIDE_DEVICE_DATA),
   4.170      NULL,
   4.171 @@ -217,6 +301,8 @@ XenHide_AddDevice(
   4.172  
   4.173    xhdd = (PXENHIDE_DEVICE_DATA)deviceObject->DeviceExtension;
   4.174  
   4.175 +  xhdd->hide_type = hide_type;
   4.176 +  
   4.177    xhdd->lower_do = IoAttachDeviceToDeviceStack(
   4.178      deviceObject, PhysicalDeviceObject);
   4.179    deviceObject->Flags |= xhdd->lower_do->Flags;
   4.180 @@ -230,7 +316,7 @@ XenHide_AddDevice(
   4.181  
   4.182    deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
   4.183  
   4.184 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.185 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.186  
   4.187    return STATUS_SUCCESS;
   4.188  }
   4.189 @@ -285,9 +371,7 @@ XenHide_SendAndWaitForIrp(PDEVICE_OBJECT
   4.190  
   4.191    if (status == STATUS_PENDING)
   4.192    {
   4.193 -//    KdPrint((__DRIVER_NAME "     waiting ...\n"));
   4.194      KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
   4.195 -//    KdPrint((__DRIVER_NAME "     ... done\n"));
   4.196      status = irp->IoStatus.Status;
   4.197    }
   4.198  
   4.199 @@ -302,31 +386,74 @@ XenHide_Pnp(PDEVICE_OBJECT device_object
   4.200    NTSTATUS status = STATUS_SUCCESS;
   4.201    PIO_STACK_LOCATION stack;
   4.202    PXENHIDE_DEVICE_DATA xhdd = (PXENHIDE_DEVICE_DATA)device_object->DeviceExtension;
   4.203 +  PDEVICE_RELATIONS relations;
   4.204 +  PXENHIDE_HIDE_LIST_ENTRY list_entry;
   4.205 +  ULONG i, j;
   4.206 +  KIRQL old_irql;
   4.207  
   4.208 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   4.209 +  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   4.210  
   4.211    stack = IoGetCurrentIrpStackLocation(irp);
   4.212  
   4.213    switch (stack->MinorFunction) {
   4.214    case IRP_MN_START_DEVICE:
   4.215 -    status = irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
   4.216 -    IoCompleteRequest(irp, IO_NO_INCREMENT);
   4.217 +    KdPrint((__DRIVER_NAME "     IRP_MN_START_DEVICE\n"));
   4.218 +    if (xhdd->hide_type == XENHIDE_TYPE_DEVICE)
   4.219 +    {
   4.220 +      KdPrint((__DRIVER_NAME "     hide_type == XENHIDE_TYPE_DEVICE\n"));
   4.221 +      status = irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
   4.222 +      IoCompleteRequest(irp, IO_NO_INCREMENT);
   4.223 +    }
   4.224 +    else
   4.225 +    {
   4.226 +      KdPrint((__DRIVER_NAME "     hide_type != XENHIDE_TYPE_DEVICE\n"));
   4.227 +      IoSkipCurrentIrpStackLocation(irp);
   4.228 +      status = IoCallDriver(xhdd->lower_do, irp);
   4.229 +    }
   4.230      break;
   4.231 -  case IRP_MN_QUERY_CAPABILITIES:
   4.232 -//    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_CAPABILITIES\n"));
   4.233 -    stack->Parameters.DeviceCapabilities.Capabilities->NoDisplayInUI = 1;
   4.234 -    status = XenHide_SendAndWaitForIrp(device_object, irp);
   4.235 -    status = irp->IoStatus.Status = STATUS_SUCCESS;
   4.236 -    IoCompleteRequest(irp, IO_NO_INCREMENT);
   4.237 -//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   4.238 -    return status;
   4.239 +  case IRP_MN_QUERY_DEVICE_RELATIONS:
   4.240 +    if (xhdd->hide_type == XENHIDE_TYPE_PCI_BUS && stack->Parameters.QueryDeviceRelations.Type == BusRelations)
   4.241 +    {
   4.242 +      KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_DEVICE_RELATIONS - BusRelations\n"));
   4.243 +      IoMarkIrpPending(irp);
   4.244 +      status = XenHide_SendAndWaitForIrp(device_object, irp);
   4.245 +      relations = (PDEVICE_RELATIONS)irp->IoStatus.Information;
   4.246 +      for (i = 0, j = 0; i < relations->Count; i++)
   4.247 +      {
   4.248 +        if (i != j)
   4.249 +          relations->Objects[j] = relations->Objects[i];
   4.250 +        KeAcquireSpinLock(&xenhide_global_data.hide_list_lock, &old_irql);
   4.251 +        list_entry = (PXENHIDE_HIDE_LIST_ENTRY)xenhide_global_data.hide_list_head.Flink;
   4.252 +        while (list_entry != (PXENHIDE_HIDE_LIST_ENTRY)&xenhide_global_data.hide_list_head)
   4.253 +        {
   4.254 +          if (relations->Objects[i] == list_entry->pdo)
   4.255 +          {
   4.256 +            KdPrint((__DRIVER_NAME "     Hiding %p\n", relations->Objects[i]));
   4.257 +            break;
   4.258 +          }
   4.259 +          list_entry = (PXENHIDE_HIDE_LIST_ENTRY)list_entry->entry.Flink;
   4.260 +        }
   4.261 +        if (list_entry == (PXENHIDE_HIDE_LIST_ENTRY)&xenhide_global_data.hide_list_head)
   4.262 +          j++;
   4.263 +        KeReleaseSpinLock(&xenhide_global_data.hide_list_lock, old_irql);
   4.264 +      }
   4.265 +      relations->Count = j;
   4.266 +      irp->IoStatus.Status = status;
   4.267 +      IoCompleteRequest (irp, IO_NO_INCREMENT);
   4.268 +    }
   4.269 +    else
   4.270 +    {
   4.271 +      IoSkipCurrentIrpStackLocation(irp);
   4.272 +      status = IoCallDriver(xhdd->lower_do, irp);
   4.273 +    }
   4.274 +    break;
   4.275    default:
   4.276      IoSkipCurrentIrpStackLocation(irp);
   4.277      status = IoCallDriver(xhdd->lower_do, irp);
   4.278      break;
   4.279    }
   4.280  
   4.281 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returning with status %08x)\n", status));
   4.282 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returning with status %08x)\n", status));
   4.283  
   4.284    return status;
   4.285  }
     5.1 --- a/xenhide/xenhide.h	Sun Jun 22 17:31:23 2008 -0700
     5.2 +++ b/xenhide/xenhide.h	Sun Jun 22 17:32:05 2008 -0700
     5.3 @@ -32,19 +32,37 @@ Foundation, Inc., 51 Franklin Street, Fi
     5.4  
     5.5  #include <xen_guids.h>
     5.6  
     5.7 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
     5.8 +
     5.9  #define XENHIDE_POOL_TAG (ULONG) 'XHID'
    5.10  
    5.11  //{CD433FE7-954F-4D51-BE29-D8A38DFA1108}
    5.12  //DEFINE_GUID(GUID_XENHIDE_IFACE, 0xCD433FE7, 0x954F, 0x4D51, 0xBE, 0x29, 0xD8, 0xA3, 0x8D, 0xFA, 0x11, 0x08);
    5.13  
    5.14 -#define XENHIDE_TYPE_PCI 1
    5.15 -#define XENHIDE_TYPE_HIDE 2
    5.16 +#define XENHIDE_TYPE_NONE 0
    5.17 +#define XENHIDE_TYPE_DEVICE 1
    5.18 +#define XENHIDE_TYPE_PCI_BUS 2
    5.19  
    5.20 -struct {
    5.21 +typedef struct {
    5.22    PDEVICE_OBJECT filter_do;
    5.23    PDEVICE_OBJECT pdo;
    5.24    PDEVICE_OBJECT lower_do;
    5.25    IO_REMOVE_LOCK RemoveLock;
    5.26 -} typedef XENHIDE_DEVICE_DATA, *PXENHIDE_DEVICE_DATA;
    5.27 +  USHORT hide_type;
    5.28 +} XENHIDE_DEVICE_DATA, *PXENHIDE_DEVICE_DATA;
    5.29 +
    5.30 +typedef struct
    5.31 +{
    5.32 +  LIST_ENTRY entry;
    5.33 +  PDEVICE_OBJECT pdo;
    5.34 +} XENHIDE_HIDE_LIST_ENTRY,  *PXENHIDE_HIDE_LIST_ENTRY;
    5.35 +
    5.36 +typedef struct
    5.37 +{
    5.38 +  PDEVICE_OBJECT pci_bus_pdo;
    5.39 +  LIST_ENTRY hide_list_head;
    5.40 +  KSPIN_LOCK hide_list_lock;
    5.41 +  KEVENT hide_list_event;
    5.42 +} XENHIDE_DRIVER_DATA, *PXENHIDE_DRIVER_DATA;
    5.43  
    5.44  #endif
     6.1 --- a/xenpci/xenbus.c	Sun Jun 22 17:31:23 2008 -0700
     6.2 +++ b/xenpci/xenbus.c	Sun Jun 22 17:32:05 2008 -0700
     6.3 @@ -312,7 +312,7 @@ XenBus_Init(PXENPCI_DEVICE_DATA xpdd)
     6.4    xpdd->xen_store_evtchn = (evtchn_port_t)hvm_get_parameter(xpdd, HVM_PARAM_STORE_EVTCHN);
     6.5  
     6.6    xen_store_mfn = (xen_ulong_t)hvm_get_parameter(xpdd, HVM_PARAM_STORE_PFN);
     6.7 -  pa_xen_store_interface.QuadPart = xen_store_mfn << PAGE_SHIFT;
     6.8 +  pa_xen_store_interface.QuadPart = (ULONGLONG)xen_store_mfn << PAGE_SHIFT;
     6.9    xpdd->xen_store_interface = MmMapIoSpace(pa_xen_store_interface, PAGE_SIZE, MmNonCached);
    6.10  
    6.11    for (i = 0; i < MAX_WATCH_ENTRIES; i++)
     7.1 --- a/xenpci/xenpci.inx	Sun Jun 22 17:31:23 2008 -0700
     7.2 +++ b/xenpci/xenpci.inx	Sun Jun 22 17:32:05 2008 -0700
     7.3 @@ -64,6 +64,10 @@ StartType      = 0
     7.4  ErrorControl   = 1
     7.5  LoadOrderGroup = Boot Bus Extender
     7.6  ServiceBinary  = %12%\xenhide.sys
     7.7 +AddReg         = XenHide_Service_AddReg
     7.8 +
     7.9 +[XenHide_Service_AddReg]
    7.10 +HKLM,SYSTEM\CurrentControlSet\Control\Class\{4D36E97D-E325-11CE-BFC1-08002BE10318},UpperFilters,0x00010008,XenHide
    7.11  
    7.12  [Strings]
    7.13  XenGplPv = "Xen GPL PV Driver Developers"