win-pvdrivers

changeset 346:a3e81bb18d0b

mingw fixes. Use IoCreateDevice now that security settings are set via INF
author Andy Grover <andy.grover@oracle.com>
date Tue Jul 01 15:19:43 2008 -0700 (2008-07-01)
parents 718e0ffe104c
children f31625adca93
files xenpci/memory.c xenpci/xenpci.c xenpci/xenpci.inx xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c
line diff
     1.1 --- a/xenpci/memory.c	Tue Jul 01 15:17:56 2008 -0700
     1.2 +++ b/xenpci/memory.c	Tue Jul 01 15:19:43 2008 -0700
     1.3 @@ -1,7 +1,7 @@
     1.4  #include "xenpci.h"
     1.5  
     1.6  //static pgentry_t *demand_map_pgt;
     1.7 -static void *demand_map_area_start;
     1.8 +//static void *demand_map_area_start;
     1.9  
    1.10  NTSTATUS
    1.11  hvm_get_stubs(PXENPCI_DEVICE_DATA xpdd)
     2.1 --- a/xenpci/xenpci.c	Tue Jul 01 15:17:56 2008 -0700
     2.2 +++ b/xenpci/xenpci.c	Tue Jul 01 15:19:43 2008 -0700
     2.3 @@ -17,6 +17,7 @@ along with this program; if not, write t
     2.4  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
     2.5  */
     2.6  
     2.7 +#define INITGUID
     2.8  #include "xenpci.h"
     2.9  #include <stdlib.h>
    2.10  
    2.11 @@ -169,7 +170,7 @@ XenPci_AddDevice(PDRIVER_OBJECT DriverOb
    2.12  
    2.13    status = IoRegisterDeviceInterface(
    2.14      PhysicalDeviceObject,
    2.15 -    (LPGUID)&GUID_XEN_IFACE,
    2.16 +    &GUID_XEN_IFACE,
    2.17      NULL,
    2.18      &xpdd->interface_name);
    2.19  
     3.1 --- a/xenpci/xenpci.inx	Tue Jul 01 15:17:56 2008 -0700
     3.2 +++ b/xenpci/xenpci.inx	Tue Jul 01 15:19:43 2008 -0700
     3.3 @@ -55,7 +55,8 @@ ServiceType    = 1
     3.4  StartType      = 0
     3.5  ErrorControl   = 1
     3.6  LoadOrderGroup = System Bus Extender
     3.7 -ServiceBinary  = %12%\xenpci.sys                            
     3.8 +ServiceBinary  = %12%\xenpci.sys
     3.9 +AddReg         = XenPCI_Service_AddReg
    3.10  
    3.11  [XenHide_Service]
    3.12  DisplayName    = %XenHide.SVCDESC%
    3.13 @@ -68,6 +69,9 @@ AddReg         = XenHide_Service_AddReg
    3.14  
    3.15  [XenHide_Service_AddReg]
    3.16  HKLM,SYSTEM\CurrentControlSet\Control\Class\{4D36E97D-E325-11CE-BFC1-08002BE10318},UpperFilters,0x00010008,XenHide
    3.17 +
    3.18 +[XenPCI_Service_AddReg]
    3.19 +HKR,,Security,,"D:P(A;;GA;;;SY)(A;;GA;;;BA)"   ; SDDL_DEVOBJ_SYS_ALL_ADM_ALL
    3.20  
    3.21  [Strings]
    3.22  XenGplPv = "Xen GPL PV Driver Developers"
     4.1 --- a/xenpci/xenpci_fdo.c	Tue Jul 01 15:17:56 2008 -0700
     4.2 +++ b/xenpci/xenpci_fdo.c	Tue Jul 01 15:19:43 2008 -0700
     4.3 @@ -18,15 +18,17 @@ Foundation, Inc., 51 Franklin Street, Fi
     4.4  */
     4.5  
     4.6  #include "xenpci.h"
     4.7 -#include <wdmsec.h>
     4.8 +//#include <wdmsec.h>
     4.9  #include <stdlib.h>
    4.10  
    4.11  #define SYSRQ_PATH "control/sysrq"
    4.12  #define SHUTDOWN_PATH "control/shutdown"
    4.13  #define BALLOON_PATH "memory/target"
    4.14  
    4.15 +#if 0
    4.16  static VOID
    4.17  XenBus_BalloonHandler(char *Path, PVOID Data);
    4.18 +#endif
    4.19  
    4.20  /*
    4.21  static VOID
    4.22 @@ -307,7 +309,7 @@ struct {
    4.23    ULONG nr_spinning;
    4.24  } typedef SUSPEND_INFO, *PSUSPEND_INFO;
    4.25  
    4.26 -static VOID
    4.27 +static DDKAPI VOID
    4.28  XenPci_Suspend(
    4.29    PRKDPC Dpc,
    4.30    PVOID Context,
    4.31 @@ -554,7 +556,7 @@ XenPci_DeviceWatchHandler(char *path, PV
    4.32    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.33  }
    4.34  
    4.35 -static VOID
    4.36 +static DDKAPI VOID
    4.37  XenPci_Pnp_StartDeviceCallback(PDEVICE_OBJECT device_object, PVOID context)
    4.38  {
    4.39    NTSTATUS status = STATUS_SUCCESS;
    4.40 @@ -741,7 +743,7 @@ XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT d
    4.41    return status;
    4.42  }
    4.43  
    4.44 -static VOID
    4.45 +static DDKAPI VOID
    4.46  XenPci_Pnp_QueryBusRelationsCallback(PDEVICE_OBJECT device_object, PVOID context)
    4.47  {
    4.48    NTSTATUS status = STATUS_SUCCESS;
    4.49 @@ -798,15 +800,13 @@ XenPci_Pnp_QueryBusRelationsCallback(PDE
    4.50              KdPrint((__DRIVER_NAME "     New device %s\n", path));
    4.51              child = ExAllocatePoolWithTag(NonPagedPool, sizeof(XEN_CHILD), XENPCI_POOL_TAG);
    4.52              child->state = CHILD_STATE_ADDED;
    4.53 -            status = IoCreateDeviceSecure(
    4.54 +            status = IoCreateDevice(
    4.55                xpdd->common.fdo->DriverObject,
    4.56                sizeof(XENPCI_PDO_DEVICE_DATA),
    4.57                NULL,
    4.58                FILE_DEVICE_UNKNOWN,
    4.59                FILE_AUTOGENERATED_DEVICE_NAME | FILE_DEVICE_SECURE_OPEN,
    4.60                FALSE,
    4.61 -              &SDDL_DEVOBJ_SYS_ALL_ADM_ALL,
    4.62 -              (LPCGUID)&GUID_XENPCI_DEVCLASS,
    4.63                &pdo);
    4.64              if (!NT_SUCCESS(status))
    4.65                KdPrint((__DRIVER_NAME "     IoCreateDevice status = %08X\n", status));
    4.66 @@ -905,7 +905,7 @@ XenPci_Pnp_QueryBusRelations(PDEVICE_OBJ
    4.67    return STATUS_PENDING;
    4.68  }
    4.69  
    4.70 -static VOID
    4.71 +static DDKAPI VOID
    4.72  XenPci_Pnp_FilterResourceRequirementsCallback(PDEVICE_OBJECT device_object, PVOID context)
    4.73  {
    4.74    NTSTATUS status = STATUS_SUCCESS;
    4.75 @@ -996,6 +996,10 @@ XenPci_Pnp_DeviceUsageNotification(PDEVI
    4.76        else
    4.77          xpdd->common.device_usage_hibernation++;      
    4.78        break;
    4.79 +    default:
    4.80 +      KdPrint((__DRIVER_NAME " Unknown usage type %x\n",
    4.81 +        stack->Parameters.UsageNotification.Type));
    4.82 +      break;
    4.83      }
    4.84      if (xpdd->common.device_usage_paging
    4.85        || xpdd->common.device_usage_dump
     5.1 --- a/xenpci/xenpci_pdo.c	Tue Jul 01 15:17:56 2008 -0700
     5.2 +++ b/xenpci/xenpci_pdo.c	Tue Jul 01 15:19:43 2008 -0700
     5.3 @@ -121,7 +121,7 @@ XenPci_BackEndStateHandler(char *Path, P
     5.4      KdPrint((__DRIVER_NAME "     state unchanged\n"));
     5.5      //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
     5.6      return;
     5.7 -  }    
     5.8 +  }
     5.9  
    5.10    xppdd->backend_state = new_backend_state;
    5.11  
    5.12 @@ -455,7 +455,7 @@ XenPci_XenConfigDevice(PVOID context)
    5.13    ADD_XEN_INIT_RSP(&out_ptr, XEN_INIT_TYPE_VECTORS, NULL, &vectors);
    5.14  
    5.15    // first pass, possibly before state == Connected
    5.16 -  while((type = GET_XEN_INIT_REQ(&in_ptr, &setting, &value)) != XEN_INIT_TYPE_END)
    5.17 +  while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value)) != XEN_INIT_TYPE_END)
    5.18    {
    5.19      switch (type)
    5.20      {
    5.21 @@ -535,7 +535,7 @@ XenPci_XenConfigDevice(PVOID context)
    5.22  
    5.23    // second pass, possibly after state == Connected
    5.24    in_ptr = in_start;
    5.25 -  while((type = GET_XEN_INIT_REQ(&in_ptr, &setting, &value)) != XEN_INIT_TYPE_END)
    5.26 +  while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value)) != XEN_INIT_TYPE_END)
    5.27    {
    5.28      switch(type)
    5.29      {
    5.30 @@ -896,6 +896,10 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
    5.31        KdPrint((__DRIVER_NAME "     type = DeviceUsageTypeHibernation\n"));
    5.32        usage_type = &xppdd->common.device_usage_hibernation;
    5.33        break;
    5.34 +    default:
    5.35 +      KdPrint((__DRIVER_NAME " Unknown usage type %x\n",
    5.36 +        stack->Parameters.UsageNotification.Type));
    5.37 +      break;
    5.38      }
    5.39      KdPrint((__DRIVER_NAME "     inpath = %d\n", stack->Parameters.UsageNotification.InPath));
    5.40      if (usage_type)