win-pvdrivers

changeset 731:3b46c7474a82 0.11.0.186

Fix installer so that it definitely waits until all drivers are installed properly
author James Harper <james.harper@bendigoit.com.au>
date Sat Jan 02 10:22:04 2010 +1100 (2010-01-02)
parents fc6e317ad8c8
children 29692cff666c
files copyconfig/copyconfig.c dirs installer.wxs waitnopendinginstallevents/makefile waitnopendinginstallevents/makefile.inc waitnopendinginstallevents/sources waitnopendinginstallevents/waitfordevices.vbs waitnopendinginstallevents/waitnopendinginstallevents.c
line diff
     1.1 --- a/copyconfig/copyconfig.c	Sat Jan 02 10:21:10 2010 +1100
     1.2 +++ b/copyconfig/copyconfig.c	Sat Jan 02 10:22:04 2010 +1100
     1.3 @@ -193,6 +193,7 @@ main(
     1.4        printf(" Copied\n", buf);
     1.5      }
     1.6    }
     1.7 +  return 0;
     1.8    
     1.9    // loop through key names that look like GUIDs
    1.10    //   get OID_GEN_VENDOR_DESCRIPTION
     2.1 --- a/dirs	Sat Jan 02 10:21:10 2010 +1100
     2.2 +++ b/dirs	Sat Jan 02 10:22:04 2010 +1100
     2.3 @@ -1,2 +1,2 @@
     2.4  
     2.5 -DIRS=xenpci xenvbd xennet xenscsi xenusb copyconfig shutdownmon coinst
     2.6 +DIRS=xenpci xenvbd xennet xenscsi xenusb copyconfig shutdownmon coinst waitnopendinginstallevents
     3.1 --- a/installer.wxs	Sat Jan 02 10:21:10 2010 +1100
     3.2 +++ b/installer.wxs	Sat Jan 02 10:22:04 2010 +1100
     3.3 @@ -6,7 +6,6 @@
     3.4      <?define ARCHDIR = amd64 ?>
     3.5    <?endif ?>
     3.6  
     3.7 -  
     3.8    <Product Name='GPL PV Drivers for Windows' Id='*'
     3.9      UpgradeCode='4EDE5DEC-3208-4a1e-8E52-DAC44F7D7062'
    3.10      Language='1033' Codepage='1252' Version='$(env.GPLPV_VERSION)' Manufacturer='James Harper'>
    3.11 @@ -17,13 +16,20 @@
    3.12  
    3.13      <WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
    3.14  
    3.15 -    <UIRef Id="WixUI_Mondo" />
    3.16 -    <UIRef Id="WixUI_ErrorProgressText" />
    3.17 +    <UI>
    3.18 +      <UIRef Id="WixUI_Mondo" />
    3.19 +      <UIRef Id="WixUI_ErrorProgressText" />
    3.20 +    </UI>
    3.21      
    3.22      <Media Id='1' Cabinet='gplpv.cab' EmbedCab='yes' />
    3.23  
    3.24 +    <Binary Id='waitfordevices.vbs' SourceFile='waitnopendinginstallevents\waitfordevices.vbs'/>
    3.25 +    <Binary Id='waitnopendinginstallevents.exe' SourceFile='waitnopendinginstallevents\obj$(env.BUILD_ALT_DIR)\$(var.ARCHDIR)\waitnopendinginstallevents.exe'/>
    3.26      <CustomAction Id='InstallShutdownMonService' FileKey='shutdownmon.exe' ExeCommand='-i' Execute='deferred' Return='check'/>
    3.27      <CustomAction Id='UnInstallShutdownMonService' FileKey='shutdownmon.exe' ExeCommand='-u' Execute='deferred' Return='check'/>
    3.28 +    <CustomAction Id='WaitForDevices' BinaryKey='waitfordevices.vbs' VBScriptCall='DoWaitForDevices' Execute='deferred' Return='check'/>
    3.29 +    <CustomAction Id='WaitNoPendingInstallEvents' BinaryKey='waitnopendinginstallevents.exe' ExeCommand='300000' Execute='deferred' Return='check'/>
    3.30 +    <CustomAction Id='CopyConfig' FileKey='copyconfig.exe' ExeCommand='' Execute='deferred' Return='check'/>
    3.31  
    3.32      <Directory Id='TARGETDIR' Name='SourceDir'>
    3.33        <Directory Id='ProgramFilesFolder' Name='PFiles'>
    3.34 @@ -131,6 +137,9 @@
    3.35        <ScheduleReboot After='InstallFinalize' />
    3.36        <Custom Action='UnInstallShutdownMonService' Before='StopServices'>$ShutdownMon=2</Custom> 
    3.37        <Custom Action='InstallShutdownMonService' After='StartServices'>$ShutdownMon>2</Custom> 
    3.38 +      <Custom Action='WaitForDevices' After='MsiProcessDrivers'>1</Custom>
    3.39 +      <Custom Action='WaitNoPendingInstallEvents' After='WaitForDevices'>1</Custom>
    3.40 +      <Custom Action='CopyConfig' After='WaitNoPendingInstallEvents'>$CopyConfig>2</Custom>
    3.41      </InstallExecuteSequence>
    3.42    </Product>
    3.43  </Wix>
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/waitnopendinginstallevents/makefile	Sat Jan 02 10:22:04 2010 +1100
     4.3 @@ -0,0 +1,9 @@
     4.4 +#
     4.5 +# DO NOT EDIT THIS FILE!!!  Edit .\sources. if you want to add a new source
     4.6 +# file to this component.  This file merely indirects to the real make file
     4.7 +# that is shared by all the driver components of the Windows NT DDK
     4.8 +#
     4.9 +
    4.10 +!INCLUDE $(NTMAKEENV)\makefile.def
    4.11 +
    4.12 +
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/waitnopendinginstallevents/sources	Sat Jan 02 10:22:04 2010 +1100
     5.3 @@ -0,0 +1,11 @@
     5.4 +!INCLUDE ..\common.inc
     5.5 +TARGETNAME=waitnopendinginstallevents
     5.6 +TARGETTYPE=PROGRAM
     5.7 +
     5.8 +
     5.9 +TARGETLIBS=$(SDK_LIB_PATH)\cfgmgr32.lib
    5.10 +UMTYPE=console
    5.11 +UMENTRY=main
    5.12 +UMBASE=0x400000
    5.13 +SOURCES=waitnopendinginstallevents.c
    5.14 +USE_MSVCRT=1
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/waitnopendinginstallevents/waitfordevices.vbs	Sat Jan 02 10:22:04 2010 +1100
     6.3 @@ -0,0 +1,33 @@
     6.4 +Sub DoWaitForDevices()
     6.5 +  strComputer = "."
     6.6 +  Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
     6.7 +  
     6.8 +  ' WScript.Echo "Waiting until at least one XEN\ device exists"
     6.9 +  
    6.10 +  Set colMonitoredEvents = objWMIService.ExecNotificationQuery _
    6.11 +    ("SELECT * FROM __InstanceOperationEvent WITHIN 5 WHERE " _
    6.12 +        & "Targetinstance ISA 'Win32_PnPEntity'")
    6.13 +  
    6.14 +  Set colItems = objWMIService.ExecQuery _
    6.15 +    ("Select * from Win32_PnPEntity WHERE DeviceID LIKE 'XEN\\%'")
    6.16 +  
    6.17 +  XenExistsFlag = False
    6.18 +  For Each objItem in colItems
    6.19 +    ' WScript.Echo objItem.getObjectText_
    6.20 +    ' WScript.Echo "Devices Exist"
    6.21 +    XenExistsFlag = True
    6.22 +    Exit For
    6.23 +  Next
    6.24 +
    6.25 +  Do While Not XenExistsFlag
    6.26 +    Set objEventObject = colMonitoredEvents.NextEvent()
    6.27 +    Set objItem = objEventObject.Targetinstance
    6.28 +    ' WScript.Echo objItem.DeviceID
    6.29 +    If LCase(Left(objItem.DeviceID, 4)) = "xen\" Then
    6.30 +      ' WScript.Echo "New Xen Device Created"   
    6.31 +      XenExistsFlag = True
    6.32 +    End If
    6.33 +  Loop
    6.34 +
    6.35 +  ' WScript.Echo "The End"
    6.36 +End Sub
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/waitnopendinginstallevents/waitnopendinginstallevents.c	Sat Jan 02 10:22:04 2010 +1100
     7.3 @@ -0,0 +1,29 @@
     7.4 +#pragma warning(disable: 4201)
     7.5 +#include <basetyps.h>
     7.6 +#include <stdlib.h>
     7.7 +#include <wtypes.h>
     7.8 +#include <stdio.h>
     7.9 +#include <string.h>
    7.10 +#include <strsafe.h>
    7.11 +#include <cfgmgr32.h>
    7.12 +
    7.13 +int __cdecl
    7.14 +main(ULONG argc, PCHAR argv[])
    7.15 +{
    7.16 +  DWORD ret;
    7.17 +  DWORD timeout = INFINITE;
    7.18 +
    7.19 +  if (argc == 2)
    7.20 +  {
    7.21 +    timeout = atoi(argv[1]);
    7.22 +  }
    7.23 +
    7.24 +  printf("timeout = %d\n", timeout);
    7.25 +
    7.26 +  ret = CMP_WaitNoPendingInstallEvents(timeout);
    7.27 +
    7.28 +  printf("ret = %d\n", ret);
    7.29 +
    7.30 +  return ret;
    7.31 +}
    7.32 +