win-pvdrivers

changeset 468:7786cebdb4df

merge with head
author James Harper <james.harper@bendigoit.com.au>
date Thu Nov 27 09:32:48 2008 +1100 (2008-11-27)
parents 6800498baafd 7b2131b4f776
children fd203efae5ca
files common/include/xen_public.h xenpci/xenpci_pdo.c
line diff
     1.1 --- a/common/include/xen_windows.h	Thu Nov 27 09:29:41 2008 +1100
     1.2 +++ b/common/include/xen_windows.h	Thu Nov 27 09:32:48 2008 +1100
     1.3 @@ -83,7 +83,7 @@ SplitString(char *String, char Split, in
     1.4  
     1.5    *Count = 0;
     1.6  
     1.7 -  RetVal = ExAllocatePoolWithTag(NonPagedPool, (MaxParts + 1) * sizeof(char *), SPLITSTRING_POOL_TAG);
     1.8 +  RetVal = (char **)ExAllocatePoolWithTag(NonPagedPool, (MaxParts + 1) * sizeof(char *), SPLITSTRING_POOL_TAG);
     1.9    last = String;
    1.10    do
    1.11    {
    1.12 @@ -92,7 +92,7 @@ SplitString(char *String, char Split, in
    1.13      //KdPrint((__DRIVER_NAME "     b - count = %d\n", *Count));
    1.14      first = last;
    1.15      for (last = first; *last != '\0' && *last != Split; last++);
    1.16 -    RetVal[*Count] = ExAllocatePoolWithTag(NonPagedPool, last - first + 1, SPLITSTRING_POOL_TAG);
    1.17 +    RetVal[*Count] = (char *)ExAllocatePoolWithTag(NonPagedPool, last - first + 1, SPLITSTRING_POOL_TAG);
    1.18      //KdPrint((__DRIVER_NAME "     c - count = %d\n", *Count));
    1.19      strncpy(RetVal[*Count], first, last - first);
    1.20      RetVal[*Count][last - first] = 0;
    1.21 @@ -132,7 +132,7 @@ AllocatePagesExtra(int Pages, int ExtraS
    1.22      return NULL;
    1.23    }
    1.24  //  KdPrint((__DRIVER_NAME " --- AllocatePages IRQL = %d, Buf = %p\n", KeGetCurrentIrql(), Buf));
    1.25 -  Mdl = ExAllocatePoolWithTag(NonPagedPool, MmSizeOfMdl(Buf, Pages * PAGE_SIZE) + ExtraSize, ALLOCATE_PAGES_POOL_TAG);
    1.26 +  Mdl = (PMDL)ExAllocatePoolWithTag(NonPagedPool, MmSizeOfMdl(Buf, Pages * PAGE_SIZE) + ExtraSize, ALLOCATE_PAGES_POOL_TAG);
    1.27    //Mdl = IoAllocateMdl(Buf, Pages * PAGE_SIZE, FALSE, FALSE, NULL);
    1.28    if (Mdl == NULL)
    1.29    {
     2.1 --- a/copyconfig/copyconfig.c	Thu Nov 27 09:29:41 2008 +1100
     2.2 +++ b/copyconfig/copyconfig.c	Thu Nov 27 09:32:48 2008 +1100
     2.3 @@ -1,3 +1,4 @@
     2.4 +#pragma warning(disable: 4201)
     2.5  #include <basetyps.h>
     2.6  #include <stdlib.h>
     2.7  #include <wtypes.h>
     2.8 @@ -105,7 +106,7 @@ main(
     2.9        continue;
    2.10      }
    2.11      printf(" Description = %s\n", buf);
    2.12 -    if (strstr(buf, "Xen"))
    2.13 +    if (strstr((char *)buf, "Xen"))
    2.14      {
    2.15        printf(" Type = Xen\n");
    2.16        keyptr = adapter->xen_IpConfig_key_name;
    2.17 @@ -128,7 +129,7 @@ main(
    2.18        printf(" Failed to read registry (%08x). Ignoring.\n", status);
    2.19        continue;
    2.20      }
    2.21 -    status = RegQueryValueEx(adapter_key_handle, "IpConfig", NULL, NULL, keyptr, &buf_len);
    2.22 +    status = RegQueryValueEx(adapter_key_handle, "IpConfig", NULL, NULL, (LPBYTE)keyptr, &buf_len);
    2.23      if (status != ERROR_SUCCESS)
    2.24      {
    2.25        printf(" Failed to read registry (%08x). Ignoring.\n", status);
    2.26 @@ -154,15 +155,15 @@ main(
    2.27      if (adapter->xen_IpConfig_key_name[0] && adapter->other_IpConfig_key_name[0])
    2.28      {
    2.29        // open HKLM\SYSTEM\Services\%s
    2.30 -      sprintf(buf, "SYSTEM\\CurrentControlSet\\Services\\%s", adapter->xen_IpConfig_key_name);
    2.31 -      status = RegOpenKey(HKEY_LOCAL_MACHINE, buf, &dst_key_handle);
    2.32 +      sprintf((char *)buf, "SYSTEM\\CurrentControlSet\\Services\\%s", adapter->xen_IpConfig_key_name);
    2.33 +      status = RegOpenKey(HKEY_LOCAL_MACHINE, (LPCSTR)buf, &dst_key_handle);
    2.34        if (status != ERROR_SUCCESS)
    2.35        {
    2.36          printf(" Cannot open Xen adapter config key. Skipping.\n");
    2.37          continue;
    2.38        }
    2.39 -      sprintf(buf, "SYSTEM\\CurrentControlSet\\Services\\%s", adapter->other_IpConfig_key_name);
    2.40 -      status = RegOpenKey(HKEY_LOCAL_MACHINE, buf, &src_key_handle);
    2.41 +      sprintf((char *)buf, "SYSTEM\\CurrentControlSet\\Services\\%s", adapter->other_IpConfig_key_name);
    2.42 +      status = RegOpenKey(HKEY_LOCAL_MACHINE, (LPCSTR)buf, &src_key_handle);
    2.43        if (status != ERROR_SUCCESS)
    2.44        {
    2.45          printf(" Cannot open Other adapter config key. Skipping.\n");
    2.46 @@ -170,7 +171,7 @@ main(
    2.47        }
    2.48        value_name_len = 256;
    2.49        value_data_len = 1024;
    2.50 -      while ((status = RegEnumValue(dst_key_handle, 0, value_name, &value_name_len, NULL, &value_type, value_data, &value_data_len)) != ERROR_NO_MORE_ITEMS)
    2.51 +      while ((status = RegEnumValue(dst_key_handle, 0, value_name, &value_name_len, NULL, &value_type, (LPBYTE)value_data, &value_data_len)) != ERROR_NO_MORE_ITEMS)
    2.52        {
    2.53          RegDeleteValue(dst_key_handle, value_name);
    2.54          value_name_len = 256;
    2.55 @@ -179,9 +180,9 @@ main(
    2.56        i = 0;
    2.57        value_name_len = 256;
    2.58        value_data_len = 1024;
    2.59 -      while ((status = RegEnumValue(src_key_handle, i, value_name, &value_name_len, NULL, &value_type, value_data, &value_data_len)) != ERROR_NO_MORE_ITEMS)
    2.60 +      while ((status = RegEnumValue(src_key_handle, i, value_name, &value_name_len, NULL, &value_type, (LPBYTE)value_data, &value_data_len)) != ERROR_NO_MORE_ITEMS)
    2.61        {
    2.62 -        RegSetValueEx(dst_key_handle, value_name, 0, value_type, value_data, value_data_len);
    2.63 +        RegSetValueEx(dst_key_handle, value_name, 0, value_type, (BYTE *)value_data, value_data_len);
    2.64          value_name_len = 256;
    2.65          value_data_len = 1024;
    2.66          i++;
     3.1 --- a/shutdownmon/shutdownmon.c	Thu Nov 27 09:29:41 2008 +1100
     3.2 +++ b/shutdownmon/shutdownmon.c	Thu Nov 27 09:32:48 2008 +1100
     3.3 @@ -1,3 +1,4 @@
     3.4 +#pragma warning(disable: 4201)
     3.5  #include <windows.h>
     3.6  #include <basetyps.h>
     3.7  #include <stdlib.h>
     3.8 @@ -300,9 +301,10 @@ void control_handler(DWORD request)
     3.9  
    3.10  void service_main(int argc, char *argv[]) 
    3.11  { 
    3.12 -  int error; 
    3.13 +  UNREFERENCED_PARAMETER (argc);
    3.14 +  UNREFERENCED_PARAMETER (argv);
    3.15  
    3.16 -write_log("Entering service_main\n"); 
    3.17 +  write_log("Entering service_main\n"); 
    3.18  
    3.19    service_status.dwServiceType = SERVICE_WIN32; 
    3.20    service_status.dwCurrentState =  SERVICE_START_PENDING; 
     4.1 --- a/xenhide/xenhide.c	Thu Nov 27 09:29:41 2008 +1100
     4.2 +++ b/xenhide/xenhide.c	Thu Nov 27 09:32:48 2008 +1100
     4.3 @@ -20,6 +20,8 @@ Foundation, Inc., 51 Franklin Street, Fi
     4.4  #include "xenhide.h"
     4.5  #include <stdlib.h>
     4.6  
     4.7 +extern PULONG InitSafeBootMode;
     4.8 +
     4.9  DRIVER_INITIALIZE DriverEntry;
    4.10  static NTSTATUS
    4.11  XenHide_AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT PhysicalDeviceObject);
    4.12 @@ -156,6 +158,15 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    4.13      }
    4.14    }
    4.15  
    4.16 +  //
    4.17 +  // Check for Safe mode boot...
    4.18 +  //
    4.19 +  if (*InitSafeBootMode > 0)
    4.20 +  {
    4.21 +    KdPrint((__DRIVER_NAME "     Running in SAFE MODE...disabling PV drivers\n"));
    4.22 +    gplpv = FALSE;
    4.23 +  }
    4.24 +
    4.25    KdPrint((__DRIVER_NAME "     gplpv = %d\n", gplpv));
    4.26  
    4.27    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
     5.1 --- a/xenhide/xenhide.inx	Thu Nov 27 09:29:41 2008 +1100
     5.2 +++ b/xenhide/xenhide.inx	Thu Nov 27 09:32:48 2008 +1100
     5.3 @@ -43,10 +43,10 @@ xenhide.sys
     5.4  xenhide.sys=1
     5.5  
     5.6  [SourceDisksNames.x86]
     5.7 -1 = %DISK_NAME%,,,\i386
     5.8 +1 = %DISK_NAME%,,,.\i386
     5.9  
    5.10  [SourceDisksNames.amd64]
    5.11 -1 = %DISK_NAME%,,,\amd64
    5.12 +1 = %DISK_NAME%,,,.\amd64
    5.13  
    5.14  [XenHide_Inst.NT.Services]
    5.15  AddService=XenHide,,XenHide_Service_Inst
     6.1 --- a/xenpci/xenpci_pdo.c	Thu Nov 27 09:29:41 2008 +1100
     6.2 +++ b/xenpci/xenpci_pdo.c	Thu Nov 27 09:32:48 2008 +1100
     6.3 @@ -125,7 +125,11 @@ XenPci_BackEndStateHandler(char *path, P
     6.4    PXENPCI_DEVICE_DATA xpdd = xppdd->bus_fdo->DeviceExtension;
     6.5    ULONG new_backend_state;
     6.6  
     6.7 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     6.8 +#if !DBG
     6.9 +  UNREFERENCED_PARAMETER(path);
    6.10 +#endif
    6.11 +  
    6.12 +  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    6.13  
    6.14    /* check that path == device/id/state */
    6.15    //RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->path);
    6.16 @@ -834,7 +838,7 @@ XenPci_Pdo_Resume(PDEVICE_OBJECT device_
    6.17        // reset things - feed the 'requested resources' back in
    6.18        ADD_XEN_INIT_REQ(&xppdd->requested_resources_ptr, XEN_INIT_TYPE_END, NULL, NULL);
    6.19        src = xppdd->requested_resources_start;
    6.20 -      xppdd->requested_resources_ptr = xppdd->requested_resources_start = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);
    6.21 +      xppdd->requested_resources_ptr = xppdd->requested_resources_start = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, XENPCI_POOL_TAG);;
    6.22        xppdd->assigned_resources_ptr = xppdd->assigned_resources_start;
    6.23        
    6.24        dst = MmMapIoSpace(xppdd->config_page_phys, xppdd->config_page_length, MmNonCached);
    6.25 @@ -938,6 +942,10 @@ XenPci_DumpPdoConfig(PDEVICE_OBJECT devi
    6.26  {
    6.27    PXENPCI_PDO_DEVICE_DATA xppdd = (PXENPCI_PDO_DEVICE_DATA)device_object->DeviceExtension;
    6.28  
    6.29 +#if !DBG
    6.30 +  UNREFERENCED_PARAMETER(xppdd);
    6.31 +#endif
    6.32 +
    6.33    KdPrint((__DRIVER_NAME "     path = %s\n", xppdd->path));
    6.34    KdPrint((__DRIVER_NAME "     backend_path = %s\n", xppdd->backend_path));
    6.35    KdPrint((__DRIVER_NAME "     irq_number = %d\n", xppdd->irq_number));