Log in

View Full Version : Mad Programmer's File Dialog Changer, killer of CabInstl – a real must!


Menneisyys
07-23-2005, 03:34 PM
Ever wondered how you could install your CAB files onto your memory card/File Store, and not just in the default location in RAM? Yes, you probably already know the answer: CabInstl (http://www.s-k-tools.com/fp/viewtopic.php?t=44), which is indeed a great little program.

However, CabInstl doesn’t intregrate well into the Windows Mobile operating system.

What does this mean?

Whenever CAB’s are automatically started, and that’s the case when ActiveSync installs or reinstalls an application, for example when you relocate them (you may want to read my tutorial on relocating apps easily, without reinstallation on the desktop, with ActiveSync (http://www.firstloox.org//forums/showthread.php?t=3705)), CAB files are just executed without CabInstl's getting into the game.

Much as you can tell ActiveSync in where to install your app, it will put it in the root directory there if you install it to an alternative medium. That is, you won’t be able to fine-tune it to specify a target directory (for example, \MyPrograms or a directory of any name). In these cases, a solution that integrates better than CabInstl into the operating system is certainly welcome. (Incidentally, this question is often asked on PPC forums; for example, here (http://discussion.brighthand.com/showthread.php?s=&postid=774734).)

Installation

First, install Mad Programmer's FileDialogChanger (http://www.geocities.co.jp/SiliconValley-Cupertino/2039/filedlgchg.zip) (the current version is 1.50) and gsGetFile.dll (http://www.geocities.co.jp/SiliconValley-Cupertino/2039/gsgetfile-i.zip) and import the following registry file ( here's a generic roundup on registry editors and their importing capabilities (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=16508) if you need to get a registry editor to import scripts ):


[HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer]
"fAskOptions"=dword:00000001
"fAskDest"=dword:00000001



(Please note that you don’t need to import these keys and values - they are already existing, with different (false) values, which prohibit destination setting to be done.

With any registry editor, just go to HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer] and edit the two keys fAskOptions and fAskDest . As has already been mentioned, they contain zeros (meaning false). You'll need to change them to 1’s (meaning true: that is, do ask for the destination root directory).

This way, you won’t even need to use an import-capable registry editor and you won’t be forced to create a registry import file with the above contents that your particular reg. editor accepts.)

After all this all has been done and you can click a CAB file on your PDA right away (or, just install a program on your desktop that uses the standard ActiveSync dialog). Then, you’ll be taken to the root of your target (the one that you’ve asked for in ActiveSync, concerning the latter case) memory card/File Store:

http://winmobiletech.com/kuvat/MadProgrammersFileDialogChangerInAction-1.gif

Then, just navigate to the target directory:

http://winmobiletech.com/kuvat/MadProgrammersFileDialogChangerInAction-1b.gif

And press OK (top right icon). Then, the program indeed will be installed in the parent directory you’ve specified (see the target directory name in the dialog screen):

http://winmobiletech.com/kuvat/MadProgrammersFileDialogChangerInAction-1c.gif

Two remarks:

- to download the two ZIP files, right-click the above Mad Programmer-links and choose Save target as… instead of directly clicking them; the latter would also mean a Referer HTTP header check and a subsequent error message.

- still regarding Mad Programmer’s files, you’ll need to copy the following files into your PDA’s \Windows directory:

1. from gsgetfile-i.zip, ARMRel\gsgetfile.dll
2. from filedlgchg.zip, ARM\filedlgchg.cpl

Also, you’ll need to start Settings/System/ File Dialog Changer and check in Exchange Standard File Dialog before you’ll see any change (just press OK after doing this; you won’t need to click Add).

http://winmobiletech.com/kuvat/MagProgrammersFileDialogChangerInAction-2.gif

Note that there’re a lot of other goodies Mad Programmer has written. You may want to read, for example, my review of the Force Hi-resolution tool V1.50/1.51 (http://www.firstloox.org//forums/showthread.php?t=3754) or my tips on using his Fonts on Storage (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=16827). These two tools are also excellent.

Also note that there’re some applications with custom-written installers that don’t use CAB’s at all; with them, not even File Dialog Changer will work. Applications like this are, for example, Destinator, Pocket Promt (http://www.pocketpcthoughts.com/forums/viewtopic.php?t=41610) (sic!) etc.

You may also want to read Gerard’s excellent article (http://www.vancouverpocketpc.com/CAB_installation_tweak.html) on this subject.

EDIT at 18:59: corrected a mistake in the first section. Thanks for the iPAQ HQ forum people for pointing it out! Also, made the text a bit easier to read.

Menneisyys
07-25-2005, 04:43 PM
I’ve received many questions about why the destination dialog screen is needed at all and what makes it better than CabInstl. Well, it indeed has advantages if you need to do a mass-install from your desktop computer onto your storage card and want to install all your software into a common subdirectory (and not the default, that is, the root directory). Then, using the hack does indeed save a lot of time.

What I wasn’t aware of while writing the above tutorial (and giving the thread a title ;) ) is the bugginess of the redirection.

The main disadvantage is that, unless you use registry toggler tools (more on this later in the section on nscript ) to easily switch between the enabled/disabled state of the destination dialog screen, the installer of some programs just won’t work: the PPC will be reset as soon as the CAB is started on the PPC.

Some examples of apps that behave like this:
Resco xBall
vxUtil
All games of Astraware; I’ve tested Bejeweled (tested version 2.45; http://www.astraware.com/download/bejeweled-ppc-v2-45.exe ) and Bejeweled 2 (tested version 1.2; http://www.astraware.com/download/bejeweled2-ppc-v1-2.exe )

They, however, work great if you install them through ActiveSync or CabInstl (tested with the latest version, 1.04). That is, there’re cases (Astraware games etc) when using CabInstl is the only way to get some programs installed to non-RAM media without access to a desktop ActiveSync.

Please note that this is not a bug in Mad Programmer’s File Dialog Changer but that of the Windows CE install-time dialog box redirection.

I need to point out another problem with enabling the destination dialog screen (again, with or without File Dialog Changer – it’s another bug in WindowsCE): the alternative screen will only be activated if you give a non-RAM target to ActiveSync. This will, of course, result in (in cases, far) slower transferring of the initial CAB file to the device, especially with larger CAB files (for example, that of Adobe Acrobat 2.0). If you don’t like the decreased speed introduced by this hack, you may want to stick to the default configuration (with or without CabInstl).

Bottom line: that is, I need to elaborate on the title of the the thread: it would be a killer if it worked with every CAB’s and with CAB’s (auto)copied into main memory. For the time being, you may want to stick to CabInst for offline installations or installations that require a common, non-root directory on your storage card (despite the need for hunting for ActiveSync-created CAB’s on the desktop in the latter case).

You may, despite the problems I’ve outlined above, still want to use the destination dialog screen (with or without the Mad Programmer utility), but want to make it easily switchable. If that’s the case, read on.

First, I elaborate a bit more on the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest.

If you don’t copy the two Mad Programmer files to your PDA (and enable the new file dialog), just enable this key (0 -> 1), you’ll get the following screen each time a CAB is started either locally (by, say, clicking it) or by a remote ActiveSync process:

http://winmobiletech.com/kuvat/MadProgrammerArticlefAskDestMainScreen.gif.png

Here, you can choose in which directory to install your app and on which card. This may be enough for most purposes if you don’t need, for example, built-in directory creation capabilities or multilevel directory tree navigation (both are offered by the Mad Programmer tool) because you already have the target directory (for example, \progs on your storage card) to install your files to and don’t mind the “flat”, one-dimensional format of the “Folder” drop-down list.

Now, the important part: how can you quickly disable and enable the automatic destination dialog screen because of the problems with certain CAB’s and the need for telling ActiveSync a slower destination for the dialog screen to work?

It’s, fortunately, very easy. No, you don’t need to fire up a registry editor, go to HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest and change the registry values every time you want to enable/disable this feature.

Nor need you define two registry import files to enable/disable redirection. (I’ve described a quick way of switching some values in the registry in my article here (http://www.firstloox.org//forums/showthread.php?p=28878). This article describes implementing registry import-based solutions for problems that can be done with reg. imports - for example, as far as my tutorial is concerned, easy and fast HTTP proxy changing/enabling/disabling.) That’s much cleaner but still involves two files because they don’t contain any conditional execution logics: code that reads the current value of HKEY_LOCAL_MACHINE\SOFTWARE\Apps\Microsoft Application Installer\fAskDest and negates it.

Going the ‘let’s write a program in native/managed code to toggle between the two states’ is indeed easy, but definitely not as flexible (you can’t recompile it on your PDA; the EXE sizes are considerably larger than script sizes; distributing these files aren’t as easy as script files which can be checked for “viruses” and “backdoors” by anyone etc) as the one I’ll describe.

nscript (http://www.geocities.com/s_k_s_k_s_kru/util.html#nscript) to the rescue! (Please note that the latest version is 0.88 – their homepage still refers to 0.86, but the ZIP there already contains 0.88!) This utility was written by the same S_K people that wrote CabInstl and a lot of other great tools.

It offers a lot of features, including registry read/write, conditional logics, message boxes etc. The only missing feature is, IMHO, WinCE database read/write, but that’s not a big problem (for comparison: not even the Compact Framework 2 supports full access to all WinCE system databases, let alone 1.0/1.1, which have no way of accessing them without using native system calls).

Furthermore, its script programming code constructs (if/while/for; code blocks etc.) resemble C (and, therefore, Java, C#, C++) a lot. This means you don’t even need to read the docs of the tool to be able to become productive in it if you already know at least one of those languages.

To install NS, you will need to uncompress ARMPPC\ns.exe from it and copy it anywhere on your PDA (preferably in \Program Files or on a non-RAM medium). It has no installer, so you will need to set file associations yourself: associate the ns file association with ns.exe. To do this, you may want to read my posts here (http://pocketpcmag.com/forum/topic.asp?TOPIC_ID=17100) on using Resco File Explorer or myExtensions. Note that you’ll need to create a new entry for .ns files in myExtensions if you use that tool. Furthermore, if you prefer direct registry editing/imports (instead of using Resco File Explorer or myExtensions for extension mapping), you will need to import the following keys/values into the registry:

[HKEY_CLASSES_ROOT\.ns]
@="nsfile"

[HKEY_CLASSES_ROOT\nsfile]
@=".ns Document"


[HKEY_CLASSES_ROOT\nsfile\Shell]


[HKEY_CLASSES_ROOT\nsfile\Shell\Open]


[HKEY_CLASSES_ROOT\nsfile\Shell\Open\Command]
@="\\ns.exe %1"


[HKEY_CLASSES_ROOT\nsfile\DefaultIcon]
@="\\ns.exe,0"

Note that you can assign a different icon to ns.exe if you accordingly set the default value of [HKEY_CLASSES_ROOT\nsfile\DefaultIcon].

Then, you only need to transfer a file with the .ns extension and the following contents to your PDA:


function main()
{
key="HKEY_LOCAL_MACHINE";
subkey="\\SOFTWARE\\Apps\\Microsoft Application Installer";
rggetvalue(key,subkey,"fAskDest",val);
if (val == 0)
{
rgset(key,subkey,"fAskDest",1,"REG_DWORD");
puts("Install redirection ON");
}
else
{
rgset(key,subkey,"fAskDest",0,"REG_DWORD");
puts("Install redirection OFF");
}
}


What does this code do? After initializing two string variables, it reads the value of our registry key by giving a call to the rggetvalue() function. Note the val variable (it can be named anything!). The return value of rggetvalue() will be copied in it. Based on this return value, we go for insertng 0 or 1 to fAskDest. See how similar it is to C (except for being weak typed)? Yes, it’s really great to code in this language if you’re a C/C#/Java/C++ guru! Not another f**** up scripting language syntax to learn!

After the file is copied to your PDA, you can just execute it by simply clicking it. ns.exe will be invoked, the new state will be displayed for a second (so you’ll be able to see whether the redirection is off or on) and then, NS exits. You don’t need to click anything, unlike with the registry import-based solution: you may know that you do need an additional click after the registry file is imported with all the regimport-capable registry editors. And, the need for two registry files is also a showstopper as far as the registry import file-based solution is concerned, while, in this case, you only have only one.

Please note that you can even put shortcuts to your .ns files (as, for example, this one) on your Today screen with, say, Spb Pocket Plus 2.x+ (I’ve described this it in the above article on the registry import-based solution) or with the free (!!) PHM TrayLaunch PowerToy (http://www.phm.lu/Products/PocketPC/PowerToys/#TrayLnch). With the latter, after installing the program (you may need to copy c:\Program Files\PHM\PHM Pocket PC PowerToys\PHMPPCPT.Rpr_ARM.CAB to your device and execute it there to actually install the app – as with several other PHM apps, their MSI installers don’t fire up the actual installation in ActiveSync with WM2003+ devices), go to Settings/System/Admin. Tools/PHM TrayLaunch, enable the Enable TrayLaunch checkbox and click Add. Here, enter the full path (!!) of the .ns file like below:

http://winmobiletech.com/kuvat/TrayLaunch-1.gif.png

After this, press OK. You should now see your script listed in the PHM TrayLaunch main screen:

http://winmobiletech.com/kuvat/TrayLaunch-2.gif.png

And the newly-added icon should also be displayed in the tray (at the bottom right; the new icon is the leftmost):

http://winmobiletech.com/kuvat/TrayLaunch-3.gif.png

Are there alternatives to nscript as a great client-side scripting tool?

MortRunner (http://www.sto-helit.de/freeware/pocketpc/mortrunner-en.pl), while it’s a great scriting utility, still (as of version 2.6, released 20 July) doesn’t have the same functionality as nscript. For example, it can’t read (only write, delete and check for existence – in this case, where we need to read a value of an already-exiting subkey, it’s useless) registry values. It doesn’t know data types except DWORD and String either. Furthermore, it uses a scripting language that is not as similar to C as nscript.

The Pocket PC console tools described in my article (http://www.firstloox.org//forums/showthread.php?t=3836), much as some has (semi-)decent scripting capabilities don’t offer so good a system access than nscript or even MortRunner. They only have rudimentary programming contructs – the MS-DOS (if they implement them at all) batching capabilities are very limited. Furthermore, they can’t access the registry, can’t display dialog windows etc.

CaRsaMyR
09-24-2005, 09:31 AM
I have an issue with the File Dialog Changer. It seems I am not able to install programs into sub-directories that already exist. For example, \Program Files\TMCP was created when I installed The Core Media Player. But when I went back and attempted to install the AC3 and Vorbis plugins (which must be in the same directory as TMCP) the dialog just changed to the directory \Program Files\TMCP and then waited for me to click the ok button. The problem with this is if I hit ok, then the plugins will be installed in a sub-directory of TCMP's program directory with the the name that was entered in the 'name' field. This however is not what I wanted. Is there anyway to work around this issue?

P.S. I noticed at one time when the file change dialog was brought up that (Install here) was set as the default input for the name field. I can't recall what I did to have this happen, but I fortunately it gave me the result that I was expecting in the issue I mentioned above. My program was installled into the default directory, however that was in the ram. I'm asking how to install a program inside an already existing sub-directory on an expansion card.

Hopefully, someone has also experienced this and can offer me some advice.

Menneisyys
10-31-2005, 11:59 AM
Note that the bug explained in my second (big) post only affects WM2003SE, not previous operating system versions. You may want to read my new tutorial on all these questions at http://www.pocketpcmag.com/blogs/index.php?blog=3&title=how_do_i_install_all_my_applications_on

Menneisyys
01-11-2006, 04:01 PM
Please make sure you read http://www.pocketpcmag.com/blogs/index.php?blog=3&p=437&more=1 for the latest bug/problem reports especially if you have a pre-WM2003SE device.