PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Odd Installer

Hey,

We (Overloaded) want to be able to install applications from a website directly to the XDA (over the air, no PC needed). The only thing that Pocket Internet Explorer will execute after download is an executable. Sadly, PocketSetup, the tool we use to generate our setups, doesn't let us generate such an exe, just cabs and PC based installers.

So I wrote a little proggie: It's a 4Kb executable that copies it's contents after that 4Kb boundary to a .cab file in the root on the device. So basically, you just append the cabinet file to the executable and you have your PocketPC installer. After copying to cabinet file to the root, that cabinet file is 'opened' (ShellExecute() api call), wich installs the app and destroys the cabinet file. So far so good. Now there's one problem left: The original .exe file... I can't delete it, since it's running. :) Does anyone know how I can get rid of it? I was thinking, perhaps I can install an empty file over it using the cab file, but I'm afraid the directory that PIE downloads to is not the same on all devices... Any good ideas?

In the meantime I'll add some compressions, those installers are huge. :)

- Jacco.
You could...
-create a very small EXE that the installer EXE executes after it completes that would delete the large installer EXE and maybe finish a few of the install options. It could just be the deletion/cleanup EXE.
-Have Overloaded search for the installer EXE on the device on first and only first run and delete it. Could create one long initial load time unless you specify some well known location it could be.
-I'm sure there's a registry key that tells PIE where to put downloaded files. I know there is on the desktop. Why not try to find this key and read it to find the installer EXE.
If I could make the installer execute an exe after it has finished, that could just as well be the system delete command, I suppose. :) Problem is, I can't start a process that deletes the process that started the process. (uhm... or something like that ;) ).

How about this:
- The installer extracts the cabinet file AND the 'delete tool', both to the root.
- The installer opens the cabinet file using ShellExecute().
- The installer spawns a new process, the 'delete tool'.
- The delete tool waits 500ms or whatever to give the original app a chance to terminate.
- The delete tool removes the original app.

Subsequent installs will overwrite the already small delete tool, and we're done. :)

One other question: I've been looking for some good compression stuff; ZLib adds 40Kb to the 4Kb installer, wich sucks for small games. Does anyone know of a decent compressor that comes with extremely small DECOMPRESSION code? The compressor may be any size and take any amount of time, but the decompressor needs to add as little as possible to the executable size.
That's what I was saying... a new little delete application. *sigh*
Ow. Hehe. ;) Thanks, in that case.

Anyway, I also solved the decompression problem: I'm now using LZO wich comes in two flavours, one of wich is MiniLZO. The MiniLZO thingy compiles to about 6Kb on the PocketPC, wich brings my installer to 7680 bytes (excluding the cabinet file, of course). Compression is performed by a command line tool and seems to be pretty good.

LZO is especially well known for it's extreme decompression speed, so it won't hurt the installation process either. It looks like I'm finished, all I need now is that little delete tool that I... ehm, I mean, Moosemaster proposed. ;)
:D
hmm...

"Last edited by MooseMaster on Tun Jal 38, 2009 13:02 pm, edited 17 time(s) in total"

I'm asking myself how the 16 previous editions of your post looked like 8O
They probably had the same signature ;)
Uhm... why can't an executable delete itself? Must admit, I never tried it. But considering that all the code and data is probably loaded into memory anyway.....

Mmmm, here's an idea. Load your executable into a memory-mapped file. Start a new process, using that executable. Let the original process quit. Let that new process delete the executable. Let the new proccess quit (memory-mapped file is cleaned up).

It's pretty sick, but fun nevertheless!!!

Anyway, there must be a way, otherwise, how would all those win32 uninstall.exe's be removed?

Cheers,

Jape