Windows 7 self/auto updating executable - windows-7

I've had a custom auto-update feature for my programs ever since Windows 95. It used to work fine, until Vista and then Windows 7. What it basically did was to download the new executable, create a batch file and execute it. The batch file simply waited for parent executable to close (by constantly trying to delete it) and then move/rename the downloaded new one as the old one. And even run the newly downloaded one. This worked fine for years. But Windows 7 doesn't really like me to do that. One thing is that it "knows" the executables are no longer same (even though their names and paths are same).
Is there a way to silently replace an executable with a new one by copying the executable properties/permission to the new one, so that Windows 7 won't complaint about it being a different exe? (Of course I need this for auto-update feature, so I'm open to other approaches as well)

Hmm ClickOnce w/ .NET works great for this... Don't know what you mean by windows 7 complaining about the exe however.

Not sure about the warnings you describe but I have had problems where I placed the update in a separate directory which broke the pinned item in the task bar.
One approach is to have thin loader which is installed once and then loads the updated program into its own memory space. That way it will be identified as the same program if pinned in the task bar.
I'm only familiar with using .NET AppDomain but I assume most other runtimes can do it as well.

Related

VB6 application causes install to show up

I got a weird problem with my VB app that has got me very confused. I am updating an existing program. I had to add some processing queue capabilities. On my system, unit testing worked great but when I compile it and run it on a different computer (a network server machine) it first tries to open an office install. If I cancel this, the program seems to run fine. The problem is that this program will be run in the background and I can't be hitting cancel each time it runs.
So my question is this: what is going on here? I'm usually a java developer we eclipse so I'm used to being able to include all the needed libs into the jar files automatically. It doesn't seem like the case with VB6. it seems like it expects all the same libs to be on all the systems. Is there any way to tell what might be triggering this?
The only thing I can think of that is causing it is that I'm using the "OpenProcess" function in the kernal32 lib. that the only major change I have made.
any help would be very appricated. thanks!
EDIT:
It seems that multiple versions of word were installed on the system and it was screwing things up somehow. We uninstalled one and it fixed it.
I ran into this a while ago and it was related to my installer for the VB6 app overwriting some system files for Office that it shouldn't have. Any time one of the System dlls was accessed Windows would determine that something was wrong and the Office installer would start up.
The short-term fix was to let the Office Installer repair the broken chain of dlls.
The long-term fix was to never overwrite built-in Windows System dlls.
You could also check out the Microsoft Fix it Center.

How to make app portable?

I have standard instalations of some programs, and althou they are freeware and i can download them and install on any machine, things are not that easy always. When system crash and i dont have working machine or working internet connection or lan card or drivers for lan card i always struggle to find them and make them work if some dependency file is not on that version of windows.
What i need is to know is how can i make applications portable so i can run them from my usb or just copy them from my usb on pc and run, what dependency files application require, and what files and where specific application install?
It's a complicated story but let's try to summarize. Starts from the part "why?"
I'm an obsessive guy who seriously "hates" installers. I love to have a clean system without bloated in files reg entries and DLL's. Thats why I make nearly all (at least 97%) of programs that I use portable. I made more than 600 up to today and what I can say is;
You need:
1- A program to watch file system (what included after installation)
I use this. Simple and straight (sorry not freeware, but you can find tons of alternates)
http://www.samsunsegman.com/um/
2- A program to watch registry (what changed or included after installation)
I use this in HTML mode. Free fast and simple. And portable in nature.
http://sourceforge.net/projects/regshot/
Now scan the system with these 2, and than run the installer. After open the installed program and make your settings as you want. And than use this 2 program to find the added files and registry entries.
For files, delete them to trash can and take them back from trash in batch (easy to do like that) to the folder of application.
Registry, open the related branches in registry, delete any entries containing addressings like (plugins folder = c:\prog.... etc) After right click on main branch and select export. This is your reg settings...
3- Download this program http://ctuser.net/?reg2exe
This will convert your reg file to an exe file.
4- Download this application http://download.cnet.com/FilePacker/3000-2216_4-10414081.html
Note: Click on "Direct Download Link" if not you'll cnet will welcome you with their installer :)
And with this program (I use this because have no interference with any application) pack the program that you want to make portable. In wizard, first choose your reg-exe file after main programs file. Launcher will execute them with this order. And in setting choose "delete after terminate" will delete the extracted files on exit.
You can discover the further details. This helps you to portabilitize nearly 75% of simple applications.
5- For complicated programs or complicated needs you even can make home made loaders like
Before executing the app, put the user files under appdata folder (that I hate)
Put settings in registry (even with dynamically modified "path" addresses)
Choose which to execute (x86 or x64)
Execute in admin mode if needed
Execute the app... And when application is terminated...
Delete the settings from registry
Take the user files from appdata folder and put under programs folder (usb etc) back.
Delete left-over files under the system...
I just wrote these last ones to make you understand how far you can go. And for all these extra tricks, I use just and just bat files. And I convert them to exe also with this software. http://www.f2ko.de/programs.php?lang=en&pid=b2e (also free)
All the softwares that I use except "uninstall manager" are free. And with this technique, amazing but some of programs are running even faster.
Actually you can just use JauntePE or portable apps packer things but... Jaunte and similar sandbox making programs are so slow and not compatible with all. Even causing crashes. Portable apps approach is a bit bloated regarding to my strict spped and size standards. That's why I do it myself about for 10 years (yes even people was not talking about portability)
Note: I'm not a programmer, and you also don't need to be to do these.
I never released my portables, and you also shouldn't (read EULA's) for respect to authors.
But never forget to demand portable version from all authors. Force them to quit installers ;)
Best regards
inovasyon did a great job!
If you want to make some portable app that will work on every computer you move it to, then 99.9% of apps can be made portable.
If you also expect the app to not leave any files, folders or registry entries behind and not change or break things on the host PC's setup, then that limits things a bit further.
Apps requiring admin privileges to write to protected areas of the registry or file system will break when used on PCs with locked-down privileges.
Apps requiring services to be installed on the host PC will often leave them behind.
You must to know there are apps that are locked to specific PCs - Microsoft's recent versions of Office are a great example of this. They simply will not run when moved to another PC.
Also, you'll need some tools for making portable app: cameyo, thinapp, boxedapp, portableapps, spoon, app-v and other.
Portable applications will run from a flash drive, and from the computer.
Good Luck!
Here is a primer for setting up a portable app using the PortableApps.com tools. They have a page for developers that is quite helpful for some specifics, but the overall process is not well summarized. Here is the general outline for creating a portable application:
1. Investigate your application's footprints
Find all the files, registry locations and settings of the application you want to make portable (make use of point (1) and (2) in inovasyon's answer, and maybe take a look at Zsoft). It is usally a good idea to fire-up a virtual machine and track the application's changes without much clutter.
2. The PortableApp generator
Download, extract, and open the PortableApps.com Platform, and follow [The system tray icon] →[Apps] →[Get More Apps] →[By Category] to install the PortableApps.com Launcher, and NSIS (Unicode) needed to Portabilize your app. Alternatively, but with some added hassle, download both the PortableApps.com Launcher and NSIS Portable (Unicode version) as standalones.
You can now compile a project by running the PortableApps.com Launcher and pointing it to your project.
3. PortableApp layout and structure
Download the PortableApp.com Application Template (search for it here) to structure the data and files obtained in (1.) according to the specifications. Also, download some apps from portableapps.com for some practical examples of how they are structured, and to learn more about the struggles of portability (such as the substitution of drive letters in settings files to correspond to the movement of a portable drive).
As a "Hello World" example, try portability this simple program: helloworld.bat, with content:
#echo off
echo Hello World > log.txt
It writes all local environmental variables to the log file log.txt. You can play around a bit by trying to writing files to an %APPDATA% subdirectory and see if you can make your project redirect it to a portable directory.
4. Additional usage
If you need to do some additional coding that is not achievable with the default .ini capabilities (such as forcing only one instance of an app), add a NSIS script with file location App\AppInfo\Launcher\Custom.nsh to your project. Note that PortableApps.com's custom code guide incorrectly states the file location as Other\Source\Custom.nsh. It is also quite unhelpful regarding the layout of this script. Rather look at examples from other Apps and learn the NSIS syntax by Google-ing a bit.

Creating a new installer for an old VB6 program

Recently my boss told me that he wants a new installer for his program he created in Visual Basic 6 back in 2001, moreover he said "he want's it to be like one of those Adobe installers".
so to make a long story short, for the past few days I've been using everything i could find but none of the solutions I've found(mostly software) yielded any results
To clarify, he specifically told me to do it without the source code of the program
all i have to work with is the programs actual installer (which is not even .msi) the .CAB file of the program and a file folder where he keeps some support files for the actual installation method.
Your old setup is PDW based and should have a Setup.lst file which lists all the files, where and how to install them.
This can easily converted to an Inno Setup script that provides a much nice and more up to date "installation experiance" than the PDW can natively.

Making a replacement for a 16-bit installer, program needs short filenames?

I have an old game (Westwood Monopoly CD-ROM) that only has a 16-bit installer so it won't run on my Windows 7 x64. To get around this I decided to use Inno Setup to make a new installer. The game itself is 32-bit but not LFN aware and will run on Vista/7, however the game will crash if the installer I built with Inno Setup is not run with Windows 95 compatibility checked.
There are no file or attribute differences between the folder generated by having compatibility mode on and the folder generated with no compatibility settings checked. However, the game will only run in the folder installed with compatibility mode, the game exe (Monopoly.exe) itself cannot have any compatibility mode option enabled or the game terminates whenever you try to save, load, or choose one of the computer ai player files. If compatibility mode for 95 is turned on for Monopoly.exe in the folder created without compatibility mode set for the installer, the game will load but will be unplayable for the above reasons.
My guess is that the Windows 95 setting forces short filenames to be created, while without it the game cannot find it's files because the short filename information isn't there. Having compatibility mode set for the installer is not the ideal solution since I need to be able to copy a different exe based on the version of Windows detected (Aero causes part of the screen to be cut off so I use a hex edited exe with a bigger default size).
So my question is this: Is there a way to force Inno setup to create the short filename information as it copies, or is there a way to add that with a command after it is finished (ie. repair the broken folder so the game can find its files)?
As far as I am aware, the problem is that the newer version of Windows Installer and Windows itself no longer support the use of short names. That property has been phased out of use and as of (AFIK) Vista it is flat out not used. Most modern installer technologies will give you an error if you try to include them. Have you tried looking at DosBox? That might also allow you to run it without the need for a special installer.

Automate an OS check, three installers, and two registry appends

I need to create a single installer that I can distribute to machines running one of Windows XP or Vista. The installer needs to do the following:
1) Check if the OS is XP SP3 or Vista. If it's vanilla XP or SP1, run an MSI. This will install Remote Desktop 6.1.
2) Run an executable. This is the installation file for a VPN client application.
3) Run a RemoteApp deployment MSI.
4) If the OS is XP, edit the registry as per http://support.microsoft.com/kb/951608 in order to enable Network Level Authentication for Remote Desktop. This requires appending to existing registry keys (i.e. not overwriting their existing values).
Initially, I'd hoped to do this with a simple batch file, but I read that it's impossible to append values to a registry key -- I can only create new ones or overwrite old ones. I've looked into a couple of GUI installers, but I haven't found one that will simply run another installation executable. I've also looked at NSIS, but learning an entirely new scripting language seems a bit like overkill.
Any simple solutions out there?
Isn't an append to a registry key a matter of reading the current value, concatenating your new data and overwriting the key with the combined result? I would think that would be doable in a batch script.
I'm going to recommend NSIS only because it's what I use for my application installers, it has never let me down when I need to add new functionality, and I've enjoyed every minute of learning the language (which really isn't that bad).
I've looked into a couple of GUI
installers, but I haven't found one
that will simply run another
installation executable.
NSIS can easily run executables and MSI installers. It can also give you their return codes so your installer's logic can react to errors, etc.
learning an entirely new scripting
language seems a bit like overkill
I'd say it really depends on how long you will need to maintain this installer. If it's just setting up a test project on in-house machines, then yes it might be overkill to learn a new language. But if this installation is a process that your clients/business partners/etc will see, I think it's well worth the effort to learn a GUI install package, whatever it may be.
Some more things to think about: NSIS has plugins that make life easier when it comes to dealing with UAC, registry redirection, and detecting OS versions

Resources