Академический Документы
Профессиональный Документы
Культура Документы
By BigJohnny
Intro:
I hate crippled shareware and trials that don't last forever. I'll pay for stuff,
but I don't always have the means to do so. I also carry a thumbdrive around with
me with loads of utilities on it and use them on multiple computers to fix an
diagnose problems. It's a pain that so many good utilities are not made to work
from removable media.
Basic Theory:
In order for a program to remember a setting, such as time/date installed, it
needs to store that information somewhere. Commonly data is stored in a (1)
registry setting or (2)a file. Registry settings generally fall under:
HKLM\Software\[name of author or company]
HKLM\Classes\CLSID
HKCU\Software\[name of author or company]
Files can be located in the Program Files\[name of author or company] also some
programs will write to Win.ini, System.ini or copy a file to one of the
environment variables listed below. An Environment Variable is common to all
computers and points to data that is specific to that PC.
%HOMEDRIVE%
%WINDIR%
%WINDIR%\System32
%WINDIR%\System
%USERPROFILE%
%APPDATA%
%CommonProgramFiles%
1. The most important tip is to make a snapshot before installing. This makes
life alot easier and narrows down your hunt for which settings belong to the
program. Some programs will also write to the system on first run, so you may
want to do a snapshot before and after first run. I recommend RegShot from
TiANWEi & Tulipfan because it is fast, highly customizable (you can even use ENV
Variables) and it also does a snapshot of the filesystem.
2. What I normally do is backup all the reg settings that were made and then
delete them. If when the program is run it complains about something then I will
put back the setting that seems to correlate. If a program wants to save
something than it needs to know the path and sometimes the path is listed under
it's registry key. In this case, it is more difficult to run the program without
an install and you have a few options:
1) Try to ignore the error and see if all the program functions still work
1) Merge the regfile containing the path and copy the program to an identical
location each time you run it.
2) Edit the registry file to point to the location the file is at
3) [For removable media] Edit the registry file to point to the location the file
is at and write a batch file to SUBST the file location. I like using Y: as a
drive but basically any letter will do that isn't already a drive or network
share. You can find which drives are in use by going to My Computer.
3. If the snapshot and compare and pruning the registry did not work, or if you
feel adventurous, or didn't run a snapshot before the install there are some other
options.
Sysinternals.com has a great selection of free network and security tools,
you should download all thier freeware but for this project you want filemon and
regmon. Filemon hooks into all programs accessing the filesystem and logs thier
writes and reads. Regmon does the same for the registry.
So what you do is eliminate any programs or services that don't need to be
running(to avoid information overload in the logfiles). Next you run and
configure (to filter what you want) them both, and then run your program. Try all
the functions if you are trying to find out which files the program needs. Maybe
let it run for awhile to see it accesses anything more than once. Now exit your
program and filter or just save the outputs from filemon and regmon. The outputs
can be better organized if you open them in Excel or a similar spreadsheet
program. You want to prune out the settings that are not related to the software
you are 'testing'. There's going to be alot of output in both files so
eliminating the crap is important. Excel can help you by sorting the data bases
on file path, type of access, etc.
Now you want to view the outputs looking at the point when the system starts
accessing the filesystem or registry and look for a pattern. Some common
scenarios are:
1) The system will query a value in the registry or a data file when the program
starts up, to decide whether the trial is up or whatever.
2) The software will continually update a value (measuring minutes used)
3) The software will write something when it finishes running (number of times
used)
Removable media:
Some tricks that I've used successfully to run a program from removable media.
I'm not a programmer but I can do alot with a batch file.
1) copy the program to %TMP% and run it from there
2) SUBST the removable drive: SUBST Z: %TMP% (now temporary files can be accessed
like a drive)
3) merge reg files from a batch: REG IMPORT file.reg
4) register DLLs from a batch: regsvr32 /i [path to file]
5) copy files to %WINDIR% with a batch
Files to prune:
Space is always small so you want to delete or compress some files to use as
little as possible, some thing to get rid of (if you don't need them).
1) *.hlp,*.txt,*.log,*.chm,*.diz,*.doc
2) Any documentation
3) languages you don't use
4) comments in plaintext files
5) DLLs that are unused by your version of windows
If you aren't sure if a file or folder is needed or not, I suggest renaming it to
have an ! in front of the file or folder name, the added benefit is that it will
move to the top of folder listing so it is easier to separate. Now run the
program and see if it complains or if it just rewrites the file (this happens alot
with .ini files). Lastly, large exe files and DLL files can be compressed using a
free software called UPX.
All this information was researched by myself and if you use it or copy it, just
leave my copyright intact. Feel free to post it wherever and educate the world.