<?xml version="1.0" encoding="UTF-8"?>
<installer-gui-script minSpecVersion='1'>
    <platforms>
        <Windows arch="intel"/>
    </platforms>
    <choices-outline ui='SoftwareUpdate'>
        <line choice='su'/>
    </choices-outline>
    <choice id='su'>
        <pkg-ref id='auto' onConclusion='RequireRestart' arguments='/se /sw'>AppleBcUpdate.exe</pkg-ref>
    </choice>
    <choice id='su' visible='Check()'/>
    <choice id='su' title='SU_TITLE' versStr='SU_VERS'/>
    <choice id='su' description='SU_DESCRIPTION' description-mime-type='text/html'/>
    

// 
<script>

// If it is less than the version number, it needed to update
var DeviceVersionPath = "SOFTWARE\\Apple Inc.\\Boot Camp\\Versions";
var DeviceVersionKey = "Multitouch";
var TargetedOldVersion1 ="2.1.1.9";
var TargetedOldVersion2 ="2.1.2.1";
var TargetedOldVersion3 ="2.1.2.100";
var TargetedOldVersion4 ="2.1.2.110";

function Check() 
{
    // Only install for 32 bit OS
    if(Is64BitOs())
    {
        return false;
    }
    
    if(!IsNeedDriverUpdate())
    {
        return false;
    }
    return true;
} 

function Is64BitOs( OsString )
{
	try
	{
		var count = 0;
        
		count = WMIExecQuery("SELECT * FROM Win32_OperatingSystem ");					
		// log("Found " + count + " records.");
		
		//  Now let us iterate through the list of objects
		//  found from the query.
		
		for (i = 0; i &lt; count; i++)
		{
            var OsArch = WMIGetProperty(i, "OSArchitecture");
            if(OsArch.substring(0,2) == "64")
            {
//                log("Found 64 bit OS.");
                return true;
            }
        }
	}
	catch (e)
	{
		log("An exception occurred. CheckOs failed.");
		log("Error: " + e.message);
	}
    
    return false;
    
}

function IsNeedDriverUpdate()
{
  var result;
  var SystemVersion = ASURegistryQueryStringValue("HKEY_LOCAL_MACHINE", DeviceVersionPath, DeviceVersionKey );
  
//   log("System :" + SystemVersion );
  
    if ((SystemVersion == TargetedOldVersion1)||
        (SystemVersion == TargetedOldVersion2)||
        (SystemVersion == TargetedOldVersion3)||
        (SystemVersion == TargetedOldVersion4)
        )
    {
        return true;
    }
    
    return false;
  
}  
</script>
    <localization>
        <strings language="English"><![CDATA["SU_TITLE" = "Multi-Touch Trackpad Update for Windows";
"SU_VERS" = "1.1";
"SU_SERVERCOMMENT" = "For Windows systems";

"SU_DESCRIPTION"='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.41">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 12.0px 0.0px; font: 12.0px Lucida Sans Unicode}
  </style>
</head>
<body>
<p class="p1">This update improves the performance of the Apple Multi-Touch trackpad when running Microsoft Windows XP and Windows Vista on a Mac computer using Boot Camp.</p>
<p class="p1">For more information about this update, please visit this website: <a href="http://www.apple.com/support/bootcamp/">http://www.apple.com/support/bootcamp/</a></p>
</body>
</html>
';
]]></strings>
    </localization>
</installer-gui-script>