VisualPatch 2.0 CheckFolderVersion Retruns nothing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • nsugumar
    Forum Member
    • Oct 2007
    • 19

    VisualPatch 2.0 CheckFolderVersion Retruns nothing

    Hi,
    I'm using Visual Patch 2.0 and I could not able to get Installed version of application.

    Here is my script,

    local MainKey = HKEY_LOCAL_MACHINE;
    local SubKey = SessionVar.Expand("Software\\xxxxxxx");
    local ValueName = "InstallPath";
    local FolderPath = String.Concat(Registry.GetValue(MainKey, SubKey, ValueName) , "\xxxxx");
    local InstallPath = Registry.GetValue(MainKey, SubKey, ValueName);

    SessionVar.Set("%AppFolder%", InstallPath);
    g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);

    error = Application.GetLastError();
    if error ~= 0 then
    Dialog.Message("Error",_tblErrorMessages[error]);
    end

    if not g_InstalledVersion then
    VisualPatch.WriteToLogFile("Not able to get the InstalledVersion",true);
    -- this is not wrtitten into log file
    end



    The above code is working fine with my earlier version of application.exe

    Looks something wrong with my application.exe, but Application.GetLastError also did not capture any error. VisualPatch.WriteToLogFile also not writing into log file.

    Could any help to solve the issue?

    Thanks in advance
    Sugumar
  • Lorne
    Indigo Rose Staff Member
    • Feb 2001
    • 2729

    #2
    Originally posted by nsugumar View Post
    Code:
    		local MainKey = HKEY_LOCAL_MACHINE;
    	local SubKey = SessionVar.Expand("Software\\xxxxxxx"); 
    	local ValueName = "InstallPath";
    	local FolderPath = String.Concat(Registry.GetValue(MainKey, SubKey, ValueName) , [COLOR="Red"][b]"\xxxxx"[/b][/COLOR]);
    	local InstallPath = Registry.GetValue(MainKey, SubKey, ValueName);
    
            SessionVar.Set("%AppFolder%", InstallPath);
    	g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);
      
        	error = Application.GetLastError();
        	if error ~= 0 then
            	Dialog.Message("Error",_tblErrorMessages[error]); 
        	end
    
        	if not g_InstalledVersion then    	
        		VisualPatch.WriteToLogFile("Not able to get the InstalledVersion",true);
    		-- this is not wrtitten into log file
        	end
    You didn't escape one of your backslashes.
    --[[ Indigo Rose Software Developer ]]

    Comment

    • nsugumar
      Forum Member
      • Oct 2007
      • 19

      #3
      VisualPatch 2.0 CheckFolderVersion Retruns nothing

      My registry entry has backslashes and end, the value is C:\Program Files\xxxxxx\xxxxxx\

      Comment

      • Lorne
        Indigo Rose Staff Member
        • Feb 2001
        • 2729

        #4
        No I mean that in the code you posted above, this line:

        local FolderPath = String.Concat(Registry.GetValue(MainKey, SubKey, ValueName) , "\xxxxx");

        ...should be:

        local FolderPath = String.Concat(Registry.GetValue(MainKey, SubKey, ValueName) , "\\xxxxx");
        --[[ Indigo Rose Software Developer ]]

        Comment

        • nsugumar
          Forum Member
          • Oct 2007
          • 19

          #5
          VisualPatch 2.0 CheckFolderVersion Retruns nothing

          The registry data is "C:\Program Files\xxxxxx\xxxxxx\". Already I have a backslash at the end , so I just concatenating with "\xxxxx".

          The script is working for a long time, it simply not working with my current build. If customer change the application exe file (Key file) from previous version build everything is working fine.

          Thanks for your time.

          Comment

          • Lorne
            Indigo Rose Staff Member
            • Feb 2001
            • 2729

            #6
            You need to escape backslashes in strings.

            "\x" isn't a backslash and an x, it's an escape sequence for a single character.

            In quoted strings, a backslash marks the beginning of an escape sequence.

            If you want to put an actual backslash in a string, you need to use \\, which is the escape sequence that represents a single backslash character.

            It doesn't matter if you have a backslash at the end of your other string...you can't join escape sequences like that.

            Valid:

            "foo\\" .. "bar" -> becomes foo\bar
            "foo" .. "\\bar" -> becomes foo\bar

            Not valid:

            "foo\" .. "\bar" -> syntax error
            "foo\\" .. "\bar" -> becomes foo\<backspace>ar
            --[[ Indigo Rose Software Developer ]]

            Comment

            • nsugumar
              Forum Member
              • Oct 2007
              • 19

              #7
              VisualPatch 2.0 CheckFolderVersion Retruns nothing

              Lorne,
              Thanks for your time. As you suggested, I changed the script as follows
              But still the problem is not solved.

              local MainKey = HKEY_LOCAL_MACHINE;
              local SubKey = SessionVar.Expand("Software\\xxxxxxxx\\xxxxxxxxx\\ ");
              local ValueName = "InstallPath";
              local InstallPath = Registry.GetValue(MainKey, SubKey, ValueName);
              local FolderPath = InstallPath.."\\yyyyy";
              Debug.Print( "\r\n FolderPath value = " .. FolderPath .."\r\n" );
              -- debug window prints as C:\xxxxxx\xxxxx\xxxxx\yyyyyy as expected
              g_InstalledVersion = VisualPatch.CheckFolderVersion("%AppFolder%", FolderPath);

              error = Application.GetLastError();
              if error ~= 0 then
              Dialog.Message("Error",_tblErrorMessages[error]);
              end


              if g_InstalledVersion then
              SessionVar.Set("%AppFolder%", InstallPath);
              Dialog.Message( "InstalledVersion ", g_InstalledVersion );
              else
              Dialog.Message("Error" ,"Not able to get version number" );
              end

              The message box shows "Not able to get version number"

              Comment

              • nsugumar
                Forum Member
                • Oct 2007
                • 19

                #8
                Hi,

                I have posted couple of threads in forums and got responses, but still I couldn't resolve the issue. I would like explain more about what are we doing when we are getting error while using visula patch 2.0

                We have an application, lots of our customers are using. Assume that our application's current version is 4.0.10.4. We are using visual patch 2.0 to to apply patch and it is woking fine for a long time. Recently we released our application's full installer which version is 4.0.10.4 with some specific changes to specific customers. Please make note that changes are NOT related to our application, actually some database files only different and those database files are NEVER supplied with visual patch. Even those database files will not reside on our application's installation folder, it is 200% independant to application.

                All the files of version 4.0.10.4 of first relaese and all the files of version 4.0.10.4 of 2nd release are same. Only the thing is version 4.0.10.4 of 2nd release is complete new build. Recently we released new patch to update from 4.0.10.4 to 4.0.10.5. Lot of our customers reported success, they could able to update 4.0.10.5. But the people who installed our 2nd release installer (4.0.10.4 ) could not able to update to 4.0.10.5. Visual patch 2.0 failed to update. After analaysis we found that Key file is different, we are having only one key file. So is the Key file to be must match for Visual patch to work properly? If the Key file doesn't match what is the solution to apply the patch?

                Release 1
                1. Installer started with version 1.0.0.0

                2. Several patches patch has been applied successfully
                with visual patch 2.0 and our current application
                version is 4.0.10.5


                Release 2

                1. Installer started with Installer started with 4.0.10.4
                version 1.0.0.0
                2. patch update failed to update 4.0.10.5

                Can any once suggest a solution to resolve this issue?


                Thanks
                Sugumar

                Comment

                • Lorne
                  Indigo Rose Staff Member
                  • Feb 2001
                  • 2729

                  #9
                  It sounds like you actually have two different versions but you're trying to pretend they're both the same. Binary differencing just doesn't work that way.

                  Originally posted by nsugumar View Post
                  All the files of version 4.0.10.4 of first relaese and all the files of version 4.0.10.4 of 2nd release are same. Only the thing is version 4.0.10.4 of 2nd release is complete new build.
                  Hmmm...what do you mean by "complete new build?" I'm not sure whether you're referring to a new build of your software application, or a new build of your patch, or...?
                  Recently we released new patch to update from 4.0.10.4 to 4.0.10.5. Lot of our customers reported success, they could able to update 4.0.10.5. But the people who installed our 2nd release installer (4.0.10.4 ) could not able to update to 4.0.10.5. Visual patch 2.0 failed to update. After analaysis we found that Key file is different, we are having only one key file. So is the Key file to be must match for Visual patch to work properly?
                  Yes, the key file must match. (Otherwise the CheckFolderVersion action won't recognize the installed version.)

                  Specifically, the key file must exist in the target location and it must have the same MD5 value as the one in your project in order for that version to be identified.

                  Note also that binary differencing can only work for an exact match of the original file.

                  Even if you modify the script to recognize both editions of 4.0.10.4 and force the patch to proceed, if it's a binary patch, it will fail because the data in the file isn't compatible with the instructions in the patch.

                  You could get around that by distributing the whole file instead of a binary patch (by marking the file with "Force install") but that could increase the size of your patch dramatically.

                  A better solution is to just make Visual Patch aware of both versions.
                  If the Key file doesn't match what is the solution to apply the patch?
                  Assuming that I'm understanding you correctly, and you have two kinds of "version 4.0.10.4" that exist...

                  You need to have both versions of 4.0.10.4 in your project. You will need to give the second one a unique name in your project, for example "4.0.10.4b" or "4.0.10.4 (Release 2)" or something similar.

                  That way, Visual Patch will be able to identify both versions of 4.0.10.4, and it will create binary difference files to update both versions, instead of only being able to update whichever one you happen to have in your project.

                  Note: if you want both versions of 4.0.10.4 to show up to the user as "4.0.10.4" you can modify the script to change the value of %InstalledVersion% when g_installedVersion is "4.0.10.4", in other words to override the value that appears on the screens in the patch.
                  Last edited by Lorne; 02-08-2008, 10:17 AM.
                  --[[ Indigo Rose Software Developer ]]

                  Comment

                  • nsugumar
                    Forum Member
                    • Oct 2007
                    • 19

                    #10
                    Lorne
                    Thanks for your time. As you suggested I have created separate patch for that particular release. It is woking fine.

                    Comment

                    Working...
                    X