Correct Version Detection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • AXXESS
    Forum Member
    • Nov 2001
    • 498

    Correct Version Detection

    IR guys, wondering what the most common issue you find users have if they are having difficulties building patches.

    I have built successful patches for projects that I have only 2 versions of (i.e., 1.0.0.0 and 1.0.0.1), but it seems when I attempt to build a patch and include three versions, the patch either a) cant locate the software, or b) tells me that I have the latest version installed when I only have 1.0.0.0. I am looking at a registry key, specifically, and even when it indicates 1.0.0.0 it tells me that the 1.0.0.2 is installed. When this happens, I am launching the patch file from the same directory that the AutoPlay files to be updated are installed in...

    Being fairly new at VP, I'm sure that I am missing something. I know that the selected key files can have a huge impact. I have selected key files that are unique to each version. Autoplay.cdd seems to be a good one. The MD5 and CRC values confirm this.

    Also, when building a full history patch, how does this work between three versions? For instance, if the user has 1.0.0.1 installed, do they receive all the files needed to get to 1.0.0.2 from 1.0.0.0? I'm thinking this is the case... However, going from 1.0.0.0 to 1.0.0.1 is about 29mb, from 1.0.0.1 to 1.0.0.2 is about 2.4mb, so I'm thinking that incremental patches may be the way to go based on the installed version...

    AND... ().... is there a best practice to use in TU2 to have the proper incremental patch applied?

    Also, an "faq" section for VP2 may be a good idea to include on the support site... currently only version 1 is there.
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    This was the FAQ for 2.0 here:
    Binary Patch Maker for Windows Visual Patch is designed for software developers who need to build secure, compact and reliable binary update patches for their software products. It features our state-of-the-art DeltaMAX binary difference compression, combined with a powerful full-history patching engine. No other tool makes software patching this easy. Secure Binary Patch Development Binary …


    We figured anyone with more specific questions would ask here. But anyhow what sort of stuff would you like to see added?

    Comment

    • AXXESS
      Forum Member
      • Nov 2001
      • 498

      #3
      Kinda like the one here:

      knowledgebase

      Not the pre-sales stuff, but an in-depth faq section based on inquires of customers through direct support requests, etc.

      Anyway, any thoughts on the ??s ? So far VP2 is looking great, and I'm sure I have overlooked something...

      Comment

      • Corey
        Indigo Rose Staff Alumni
        • Aug 2002
        • 9745

        #4
        OK, I think that will happen at some point, as things move along more stuff will be added to the support site. The dev guys will be back in on Monday, I'm sure they'll have some answers.

        Comment

        • Lorne
          Indigo Rose Staff Member
          • Feb 2001
          • 2729

          #5
          Originally posted by AXXESS
          I am looking at a registry key, specifically, and even when it indicates 1.0.0.0 it tells me that the 1.0.0.2 is installed. When this happens, I am launching the patch file from the same directory that the AutoPlay files to be updated are installed in...
          The default scripted behavior is to check for the key file (or files) in the local folder before checking for version information in the registry. This is to allow the user to override the Registry check, for example if they have more than one version installed, or if the information in their Registry is no longer accurate because they messed it up.

          Being fairly new at VP, I'm sure that I am missing something.
          Nothing more than the default order in which the version detection methods are applied in.

          Move the patch file out of that directory, and it will see the version in the Registry. If you want, you can disable the local folder check, or make it so the Registry check happens first, by simply rearranging the On Startup script a little bit.

          Also, when building a full history patch, how does this work between three versions? For instance, if the user has 1.0.0.1 installed, do they receive all the files needed to get to 1.0.0.2 from 1.0.0.0? I'm thinking this is the case... However, going from 1.0.0.0 to 1.0.0.1 is about 29mb, from 1.0.0.1 to 1.0.0.2 is about 2.4mb, so I'm thinking that incremental patches may be the way to go based on the installed version...
          Yes, definitely. In most cases it's enough to offer one or two incremental patches, for the previous two releases say, and then offer a full-history patch for the other users. (See "Patching Strategies" on page 34 of the user's guide for a more detailed explanation.)

          AND... ().... is there a best practice to use in TU2 to have the proper incremental patch applied?
          It's pretty straightforward. I'd recommend using the Registry key approach to determine the version, as you're doing now. Keep the information about which patch to download for a given version in the server script, obviously, so you can change it without affecting the TrueUpdate client.

          You can save a lot of bandwidth by taking advantage of TU2 -- it essentially nullifies one of the main disadvantages of the incremental patch strategy, which is that it can be more complicated for the user. But with TU2 making the decisions automatically, a user never has to figure out which file they need to download for the version they have.
          --[[ Indigo Rose Software Developer ]]

          Comment

          • AXXESS
            Forum Member
            • Nov 2001
            • 498

            #6
            The odd thing is, is that I was able to successfully build a patch going from 1.0.0.0 to 1.0.0.1 and 1.0.0.1 to 1.0.0.2, but not the full history patch.

            Testing the full history patch indicates that the software cannot be found, even though I have not changed the script from my initial builds. The registry key is still in place, but it is not seeing it. I have moved the patch file in and out of the folder, no difference. I have changed the detection order. No difference.

            I meant I must be missing something, because it did work before, and now it does not. I have 1.0.0.0 clearly in the specific registry key HKEY_LOCAL_MACHINE\\SOFTWARE\\MYPRODUCT\\Data - and for some reason it doesn't see it. Though it did before...

            Code:
            --------------------------------------------------------------
            -- Check for administrative privileges
            --------------------------------------------------------------
            
            -- Make sure that the user has administrative privileges on the system.
            -- (g_IsUserAdmin is defined in _Global_Functions.lua)
            if not g_IsUserAdmin() then
            	if not _SilentPatch then
            		local Title = SessionVar.Expand("%WindowTitle%");
            		local Message = SessionVar.Expand(VisualPatch.GetLocalizedString("MSG_SYSREQ_ADMIN"));
            		local DlgResult = Dialog.Message(Title, Message, MB_OKCANCEL, MB_ICONEXCLAMATION);
            		if DlgResult == IDCANCEL then
            			Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
            		end
            	else
            		-- Since it is a silent patch, fail
            		Application.Exit(EXIT_REASON_USER_NOT_ADMIN);
            	end
            end
            
            --------------------------------------------------------------
            -- Locate installed version
            --------------------------------------------------------------
            
            -- Define a global variable that will indicate the name
            -- of the installed version on the user's system. A nil value
            -- indicates that an installed version has not been found.
            g_InstalledVersion = nil;
            
            -- Location method: Current folder
            -- Check whether the software is installed in the folder
            -- that the patch was run from.
            -- Remove the following block comment to enable this script
            
            if not g_InstalledVersion then
            	g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", _SourceFolder);
            	if g_InstalledVersion then
            		SessionVar.Set("%AppFolder%", _SourceFolder);
            	end
            end
            
            
            -- Location method: Registry key
            -- Read a folder path from the Registry.
            if not g_InstalledVersion then
            	local MainKey = HKEY_LOCAL_MACHINE;
            	local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT");
            	local ValueName = "Data";
            	local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
            	g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
            	if g_InstalledVersion then
            		SessionVar.Set("%AppFolder%", FolderPath);
            	end
            end
            
            -- Location method: File search
            -- Search the user's system for a file that is known to
            -- exist in the software's application folder.
            if not g_InstalledVersion then
            	local TargetFileName = "autorun.exe";
            	local tbFolders = {};
            	tbFolders[1] = SessionVar.Expand("%ProgramFilesFolder%\\My Product");
            	tbFolders[2] = SessionVar.Expand("%ProgramFilesFolder%\\My Product Inc.");
            	tbFolders[3] = SessionVar.Expand("%ProgramFilesFolder%");
            	-- Insert other folders here...
            
            	local CheckFixedDrives = true;
            	local CheckNetworkDrives = false;
            
            	-- (g_FindApplicationOnSystem is defined in _Global_Functions.lua)
            	g_InstalledVersion = g_FindApplicationOnSystem("%AppFolder%", TargetFileName, tbFolders, CheckFixedDrives, CheckNetworkDrives);
            end
            
            
            --------------------------------------------------------------
            -- Ensure that installed software is not running
            --------------------------------------------------------------
            
            -- If we located an out-of-date version, make sure the installed
            -- software is not running.
            -- Remove the following block comment to enable this script
            
            if g_InstalledVersion then
            	local Filename = SessionVar.Expand("autorun.cdd");
            	local ProgramName = SessionVar.Expand("My Product");
            	-- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)
            	local ProgramIsClosed = g_EnsureProgramIsClosed(Filename, ProgramName);
            	if not ProgramIsClosed then
            		Application.Exit(EXIT_REASON_PROGRAM_IS_OPEN);
            	end
            end
            
            
            --------------------------------------------------------------
            -- Set session variables
            --------------------------------------------------------------
            
            -- Set session variables that will be used in the log file
            -- and in the user interface.
            if g_InstalledVersion then
            	SessionVar.Set("%InstalledVersion%", g_InstalledVersion);
            	SessionVar.Set("%TargetVersion%", VisualPatch.GetTargetVersion());
            end
            
            --------------------------------------------------------------
            -- Log result
            --------------------------------------------------------------
            
            -- Make a log file entry with the result.
            if g_InstalledVersion then
            	local LogMsg = SessionVar.Expand("Success\tLocated installed version %InstalledVersion%: %AppFolder%\r\n");
            	VisualPatch.WriteToLogFile(LogMsg);
            else
            	local LogMsg = SessionVar.Expand("Error\tCould not locate software on system\r\n");
            	VisualPatch.WriteToLogFile(LogMsg);
            end
            
            --------------------------------------------------------------
            -- Select start screen
            --------------------------------------------------------------
            
            -- Decide which "Before Patching" screen to show.
            if g_InstalledVersion then
            	if g_InstalledVersion == VisualPatch.GetTargetVersion() then
            		-- The target version was found
            		Screen.SetStartScreen("Software is Current");
            	else
            		-- An out-of-date version was found
            		Screen.SetStartScreen("Ready to Patch");
            	end
            else
            	-- No version was found
            	Screen.SetStartScreen("Cannot Locate Software");
            end

            Comment

            • Lorne
              Indigo Rose Staff Member
              • Feb 2001
              • 2729

              #7
              What does the log indicate?

              Which version of the files do you actually have installed?
              --[[ Indigo Rose Software Developer ]]

              Comment

              • AXXESS
                Forum Member
                • Nov 2001
                • 498

                #8
                When I am attmpting to apply the history patch to bring the installed version up to 1.0.0.2, I have 1.0.0.0 installed.

                Here is the pertinent log info:


                Code:
                [09/19/2005 20:30:07] Success	Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
                [09/19/2005 20:30:07] Notice	Patch engine version: 2.0.1.0
                [09/19/2005 20:30:07] Notice	Product: MY PRODUCT
                [09/19/2005 20:30:07] Success	Language set: Primary = 9, Secondary = 1
                [09/19/2005 20:30:07] Success	Include script: _Global_Functions.lua
                [09/19/2005 20:30:07] Notice	Start project event: Global Functions
                [09/19/2005 20:30:07] Success	Run project event: Global Functions
                [09/19/2005 20:30:07] Notice	Start project event: On Startup
                [09/19/2005 20:30:07] Error	Script: On Startup, Line 49 (1605)
                [09/19/2005 20:30:07] Error	Script: On Startup, Line 86 (1002)
                [09/19/2005 20:31:17] Error	Could not locate software on system
                [09/19/2005 20:31:17] Success	Run project event: On Startup
                [09/19/2005 20:31:17] Success	Display screen: Cannot Locate Software
                [09/19/2005 20:31:18] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG1.JPG
                [09/19/2005 20:31:18] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG2.JPG
                [09/19/2005 20:31:18] Notice	Exit patch process (Return code: 1210)
                Line 49 is this one:

                Code:
                local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
                Line 86 is this one:

                Code:
                -- (g_EnsureProgramIsClosed is defined in _Global_Functions.lua)
                I see that Return Code 1210 was indicated. The Help file indicates that the %AppFolder% was not successfully located or defined. Something wrong with the OnStartup action.... ?

                Comment

                • csd214
                  Forum Member
                  • Oct 2001
                  • 939

                  #9
                  I have only created one single VP20 project so I’m a real newbie to VP. The interesting point with this thread is the three versions issue and the Registry read method; exactly like MY project. I haven’t noticed any problem at all, but “the wizard did the entire job” (almost) so I don’t remember much of the challenges!

                  AXXESS, your script generates the error codes
                  1605 "Could not get the specified value's data."
                  1002 "The specified path was not found."

                  What values do you have in SubKey and ValueName? Could it be that simple that you have forgotten the double backslashes in SubKey?

                  I would suggest to add VisualPatch.WriteToLogFile() to test the values (please forgive me; I’m new to VP20…)

                  Comment

                  • Lorne
                    Indigo Rose Staff Member
                    • Feb 2001
                    • 2729

                    #10
                    That's a good guess. Adding some temporary actions to output those values before line 49 would be a good idea.
                    --[[ Indigo Rose Software Developer ]]

                    Comment

                    • AXXESS
                      Forum Member
                      • Nov 2001
                      • 498

                      #11
                      OK, just testing this out, I ran the 1.0.0.1 incremental patch, works fine. So I am attempting to apply the full history patch to go from 1.0.0.1 to 1.0.0.2.

                      Added the VisualPatch.WriteToLogFile() actions here:

                      Code:
                      -- Location method: Registry key
                      -- Read a folder path from the Registry.
                      if not g_InstalledVersion then
                      	local MainKey = HKEY_LOCAL_MACHINE;
                      	local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
                      	local ValueName = "Data";
                      	local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
                      	VisualPatch.WriteToLogFile("Stated Variables are: "..FolderPath.."t\r\n", true);
                      	[B]patch = VisualPatch.GetTargetVersion();
                      	VisualPatch.WriteToLogFile("Patching to: "..patch.."t\r\n", true);[/B]
                      	
                      	g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
                      	if g_InstalledVersion then
                      		SessionVar.Set("%AppFolder%", FolderPath);
                      	end
                      end
                      And here is the resulting log:

                      Code:
                      [09/20/2005 09:52:21] Success	Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
                      [09/20/2005 09:52:21] Notice	Patch engine version: 2.0.1.0
                      [09/20/2005 09:52:21] Notice	Product: MY PRODUCT
                      [09/20/2005 09:52:21] Success	Language set: Primary = 9, Secondary = 1
                      [09/20/2005 09:52:21] Success	Include script: _Global_Functions.lua
                      [09/20/2005 09:52:21] Notice	Start project event: Global Functions
                      [09/20/2005 09:52:21] Success	Run project event: Global Functions
                      [09/20/2005 09:52:21] Notice	Start project event: On Startup
                      [09/20/2005 09:52:21] Stated Variables are: 1.0.0.1t
                      [09/20/2005 09:52:21] Patching to: 1.0.0.2t
                      [09/20/2005 09:52:21] Error	Script: On Startup, Line 86 (1002)
                      [09/20/2005 09:52:26] Error	Could not locate software on system
                      [09/20/2005 09:52:26] Success	Run project event: On Startup
                      [09/20/2005 09:52:26] Success	Display screen: Cannot Locate Software
                      [09/20/2005 09:53:13] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG1.JPG
                      [09/20/2005 09:53:13] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG2.JPG
                      [09/20/2005 09:53:13] Notice	Exit patch process (Return code: 1210)

                      Comment

                      • Lorne
                        Indigo Rose Staff Member
                        • Feb 2001
                        • 2729

                        #12
                        Originally posted by AXXESS
                        OK, just testing this out, I ran the 1.0.0.1 incremental patch, works fine. So I am attempting to apply the full history patch to go from 1.0.0.1 to 1.0.0.2.

                        Added the VisualPatch.WriteToLogFile() actions here:

                        Code:
                        -- Location method: Registry key
                        -- Read a folder path from the Registry.
                        if not g_InstalledVersion then
                        	local MainKey = HKEY_LOCAL_MACHINE;
                        	local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
                        	local ValueName = "Data";
                        	[b]local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
                        	VisualPatch.WriteToLogFile("Stated Variables are: "..FolderPath.."t\r\n", true);[/b]
                        	patch = VisualPatch.GetTargetVersion();
                        	VisualPatch.WriteToLogFile("Patching to: "..patch.."t\r\n", true);
                        	
                        	g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
                        	if g_InstalledVersion then
                        		SessionVar.Set("%AppFolder%", FolderPath);
                        	end
                        end
                        And here is the resulting log:

                        Code:
                        [09/20/2005 09:52:21] Success	Patch started: C:\Documents and Settings\User1\Desktop\test\fullhistorypatch.exe
                        [09/20/2005 09:52:21] Notice	Patch engine version: 2.0.1.0
                        [09/20/2005 09:52:21] Notice	Product: MY PRODUCT
                        [09/20/2005 09:52:21] Success	Language set: Primary = 9, Secondary = 1
                        [09/20/2005 09:52:21] Success	Include script: _Global_Functions.lua
                        [09/20/2005 09:52:21] Notice	Start project event: Global Functions
                        [09/20/2005 09:52:21] Success	Run project event: Global Functions
                        [09/20/2005 09:52:21] Notice	Start project event: On Startup
                        [b][09/20/2005 09:52:21] Stated Variables are: 1.0.0.1t[/b]
                        [09/20/2005 09:52:21] Patching to: 1.0.0.2t
                        [09/20/2005 09:52:21] Error	Script: On Startup, Line 86 (1002)
                        [09/20/2005 09:52:26] Error	Could not locate software on system
                        [09/20/2005 09:52:26] Success	Run project event: On Startup
                        [09/20/2005 09:52:26] Success	Display screen: Cannot Locate Software
                        [09/20/2005 09:53:13] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG1.JPG
                        [09/20/2005 09:53:13] Success	Delete image file: C:\DOCUME~1\User1\LOCALS~1\Temp\_ir_vp2_temp_0\IRIMG2.JPG
                        [09/20/2005 09:53:13] Notice	Exit patch process (Return code: 1210)
                        According to the log, your FolderPath variable contains "1.0.0.1"...which doesn't sound like a valid folder path to me.

                        Are you sure there isn't a mistake in your Registry actions? It looks like you're overwriting the install folder value in the Registry with the current version.

                        Note that the default script in Visual Patch wants to read your software's location from the Registry. It will use the key files and MD5s and such to determine the version. (This is actually taken care of by the VisualPatch.CheckFolderVersion action.)

                        You can script a different version checking behavior if you want, e.g. just read the installed version directly from the Registry...although that won't be as foolproof as checking the key files etc.
                        --[[ Indigo Rose Software Developer ]]

                        Comment

                        • AXXESS
                          Forum Member
                          • Nov 2001
                          • 498

                          #13
                          According to the log, your FolderPath variable contains "1.0.0.1"...which doesn't sound like a valid folder path to me.
                          Right. This script was untouched from the provided OnStartup Script...other than changing the MainKey type and the ValueName... Isn't the following supposed to return a version number? The version number is stored in the SubKey...
                          Code:
                          local MainKey = HKEY_LOCAL_MACHINE;
                          local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
                          local ValueName = "Data";
                          local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);

                          Comment

                          • Lorne
                            Indigo Rose Staff Member
                            • Feb 2001
                            • 2729

                            #14
                            Originally posted by AXXESS
                            Right. This script was untouched from the provided OnStartup Script...other than changing the MainKey type and the ValueName... Isn't the following supposed to return a version number?
                            Code:
                            local MainKey = HKEY_LOCAL_MACHINE;
                            local SubKey = SessionVar.Expand("SOFTWARE\\MYPRODUCT\\");
                            local ValueName = "Data";
                            local FolderPath = Registry.GetValue(MainKey, SubKey, ValueName);
                            No, it's supposed to return the path to the folder where your software was installed, which should be stored in the Registry for this version detection method to work.
                            --[[ Indigo Rose Software Developer ]]

                            Comment

                            • AXXESS
                              Forum Member
                              • Nov 2001
                              • 498

                              #15
                              So I should have had Setup Factory specifically write the %AppFolder% to the registry?

                              If that is the case, then I am wondering why the incremental patches do work...

                              Currently I have SUF writing the version to HKEY_LOCAL_MACHINE\\MYPRODUCT\\DATA ....

                              Comment

                              Working...
                              X