[Mobies-commit] [commit] r3729 - UDM/trunk/InnoSetup

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Wed May 11 16:32:05 CDT 2011


Author: ksmyth
Date: Wed May 11 16:32:04 2011
New Revision: 3729

Log:
Check for .NET v2 or v4

Modified:
   UDM/trunk/InnoSetup/udm_innosetupVS2008.iss

Modified: UDM/trunk/InnoSetup/udm_innosetupVS2008.iss
==============================================================================
--- UDM/trunk/InnoSetup/udm_innosetupVS2008.iss	Wed May 11 14:12:21 2011	(r3728)
+++ UDM/trunk/InnoSetup/udm_innosetupVS2008.iss	Wed May 11 16:32:04 2011	(r3729)
@@ -338,6 +338,43 @@
 #endif
 end;
 
+// http://www.kynosarges.de/DotNetVersion.html
+function IsDotNetDetected(version: string; service: cardinal): boolean;
+// Indicates whether the specified version and service pack of the .NET Framework is installed.
+//
+// version -- Specify one of these strings for the required .NET Framework version:
+//    'v1.1.4322'     .NET Framework 1.1
+//    'v2.0.50727'    .NET Framework 2.0
+//    'v3.0'          .NET Framework 3.0
+//    'v3.5'          .NET Framework 3.5
+//    'v4\Client'     .NET Framework 4.0 Client Profile
+//    'v4\Full'       .NET Framework 4.0 Full Installation
+//
+// service -- Specify any non-negative integer for the required service pack level:
+//    0               No service packs required
+//    1, 2, etc.      Service pack 1, 2, etc. required
+var
+    key: string;
+    install, serviceCount: cardinal;
+    success: boolean;
+begin
+    key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + version;
+    // .NET 3.0 uses value InstallSuccess in subkey Setup
+    if Pos('v3.0', version) = 1 then begin
+        success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
+    end else begin
+        success := RegQueryDWordValue(HKLM, key, 'Install', install);
+    end;
+    // .NET 4.0 uses value Servicing instead of SP
+    if Pos('v4', version) = 1 then begin
+        success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
+    end else begin
+        success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
+    end;
+    result := success and (install = 1) and (serviceCount >= service);
+end;
+
+
 function NextButtonClick(CurPageID: Integer): Boolean;
 var
   MyComponents : String;
@@ -360,7 +397,12 @@
     for i := 1 to 100 do
       if WizardForm.ComponentsList.ItemCaption[i] = 'C# UDM' then
         break;
-    if not RegKeyExists(HKLM,'SOFTWARE\Microsoft\.NETFramework\policy\v2.0') then
+    if  not IsDotNetDetected('v2.0.50727', 0) and
+        // either v2 or v4 is sufficient
+        //not IsDotNetDetected('v3.0', 0) and
+        //not IsDotNetDetected('v3.5', 0) and
+        not IsDotNetDetected('v4\Client', 0) and
+        not IsDotNetDetected('v4\Full', 0) then
       WizardForm.ComponentsList.Checked[i] := False;
 
     Result := CheckVersions();


More information about the Mobies-commit mailing list