automated installs - Windows Mobile Development and Hacking General

Hi All,
I need some help with CAb files and such.
I'm working on a "self healing" solution for some customers of ours, so that if their device runs out of battery power, when charged, it will rebuild itself and reconfigure itself, so there is minimal user intervention.
What we do is put all our CAB files in the EXROM, and that's how we get it done.
I have an issue with our encryption software in that it's install CAB can't be run from the EXROM, it needs to be run from the root of the device. But it also has to be paired with a license file.
So what I need to do is build a CAB file, that encompasses the Pointsec install CAB and the license file, that copies itself to the root of the device upon running my CAB and runs them from there.
how do I get these files to execute once i've told them to be copied to the root?
I though i'd also put a shortcut to the install CAB in the \windows\startup folder
but once the install CAB is run, the shortcut remains, and therefore upno soft-reset it throws up errors that the file no longer exists
here is a copy of the INF file i wrote to do this.
bear in mind, i'm new to this, so it may be incorrect.
============================================================================================
[SOURCE FILE]
Name=Pointsec_Shortcut.cab
Path=C:\Documents and Settings\build\My Documents\Pocketpc\corporate soe v1.3a\EXTRACTED\new folder\Pointsec_Shortcut.cab
Type=Original
[Version]
Signature="$Chicago$"
CESignature="$Windows CE$"
Provider="Pointsec"
[CEStrings]
AppName="for Pocket PC 2.3"
InstallDir="\"
[CEDevice]
ProcessorType=0
VersionMin=0.0
VersionMax=0.0
BuildMin=0
BuildMax=0
[SourceDisksNames]
1=,Source1,,"[INSTALLDIR]"
2=,Source2,,"[License]
[SourceDisksFiles]
"Pointsec_for_Pocket_PC 2.3.cab"=1
"InstProf.ppp"=2
[CopyFiles1]
"Pointsec_for_Pocket_PC 2.3.cab",,,0x20000003
[CopyFiles2]
"InstProf.ppp",,,0x20000003
[CEShortcuts1]
"Pointsec.lnk",0,"Pointsec_for_Pocket_PC 2.3.cab"
[DestinationDirs]
CopyFiles1=0,"\"
CEShortcuts1=0,"%CE4"
[DefaultInstall]
CEShortcuts=CEShortcuts1
CopyFiles=CopyFiles1
===========================================================================================
Is there a registry entry, like in win2k/XP where I can get this to "runonce" or anything like that ?
Any help would be greatly appreciated.

you should put the cab in the ExtROM, and then.
In config.txt:
add lines to copy the cab to the root
add a line to run the cab from the root
Syntax: http://forum.xda-developers.com/viewtopic.php?t=6648&highlight=config+txt+syntax

cheers edsub,
I wasn't aware of the EXEC command for the config.txt.
that will save me from having to build a CAb file to do this !
for future reference though, is there an execute command you can put into a .inf for theCAB file?
or is that where the setup.dll comes into play ?

yup, thats the allmighty setup.dll.
problem is with that: If you havent build it, you dont know what it does . . .

damn, looks like i have to brush up on my C++ skills
thanks again !!

Related

Deny or restrain installation of applications WM5

I want to deny or restrain installation of applications on the fly as an service/process or by making changes in the registry on WM5 devices. Any ideas? The app preferely in C++/C#
CAB files are installed by wceload.exe in the windows directory.
You can overwrite this file with a blank exe, or remove the CAB extension reference to it in registry under HKEY_CLASSES_ROOT.
Deny or restrain inst. of apps
Thanks, yes I've thought about this - but this isn't a very dynamic solution. When a person run a CAB I want to check if app is okay to install from a "List" - then show a popup with a message saying something like "Sorry, you are not allowed to install this application. Please contact your company IT Admin for more info".
Is the .CAB association in HKEY_CLASSES_ROOT linked to wceload - so I could run an app to validate CAB, and if ok execute wceload..?
levenum said:
CAB files are installed by wceload.exe in the windows directory.
You can overwrite this file with a blank exe, or remove the CAB extension reference to it in registry under HKEY_CLASSES_ROOT.
Click to expand...
Click to collapse
Write up a registry entry in HKEY_CLASSES_ROOT to associate .CAB files with your custom file. Then, when the user taps on a CAB file, your program reads it, compares it against its list and, if it's approved, calls WceLoad with the appropriate parameters.
The key would probably look something like this:
HKCR\cabfile\shell\open\command
(default) = "<path to your app>" "%1"
(%1 will be replaced with the path to the CAB file).
Then, if the CAB was approved, call WceLoad with the following parameters:
\windows\wceload.exe "<path to cab file>" /nodelete
Note that some apps, may call wceload.exe directly. I am not sure if Activesync does it, but I know a couple of custom installers that do.
If you really want to secure the device against unothorized software do the following:
Rename wceload.exe to something else like wceload1.exe.
Create you own wceload.exe, but make sure you capture and preserve all command line parameters in case you need to transfer them to the original file for proper installation.
This way you can be sure no one will install anything without your permission.
Olso, keep in mind wceload is used to switch themes as well. (It handles *.tsk files).
Very much..
Thank You all!!

Auto install of CAB files

Hi all,
I have a cab file (call it cab1) containing three files to install on a WM5.0 device. These three files are another cab file (call it cab2) and two config files. I drop cab1 onto the device and it executes. This puts cab2 and the two config files into the correct folders that I want. This is all fine
What I need to happen then is for cab2 to auto execute without anymore interaction. How can I add this instruction to cab1?
Dropping cab2 into the startup folder and waiting for the device to soft reset is not an option for me
The whole install needs to happen on the device by sending a single cab file to the device i.e. I cannot use any msi etc to install over ActiveSync
I've created the cabs in VS2005
Thanks for any help
This one is tricky. You need to create a setup.dll for cab1 then have it launch an exe and exit. The exe will wait about a second for th cab installer to complete then launch the installation of cab2.
i believe this is the only way to accomplish what you want with one cab without combining the content of cab1 and cab2 in to a single cab.
Thanks levenum
Combining the cabs is what I would like to do but cab2 is signed so I can't unpack it without breaking it. That's why I went down the road of putting it into another cab with the other files I need to install
Is there a way to add a post-install command to launch cab2 in the setup.dll of cab1(or anywhere else)?
What levenum means is that you can't launch the installation of the second cab from the first one. The reason for this is that only one instance of wceload.exe can be running.
You need to build a setup.dll in the first cab file. The first cab must also have an exe that will install the second cab file. You launch the exe from the setup.dll. The exe must wait until wceload.exe has shut down after installing the first cab before it can install the second one by running createprocess on wceload.exe with the right arguments.
If you don't know how to make the setup.dll, take a look in the Windows Mobile 5.0 SDK. It includes an example on how to do this.
Did you get it?
Øystein

ReLoad v0.1 Beta

ReLoad
This is a MortScript script written to simplify reinstalling cab files, and restoring files back to the device from a zip file on the trinity.
More information about MortScript at http://www.sto-helit.de
-v.01 Initial Release
Known Issues
-Cab files that initiate the installation of another cab file ie.Wisbar Advanced
-How to setup:
1)Extract Reload.rar to your storage card.
2)Place cab files in the CabsAuto folder if you want to the cab to be automatically installed to the device (installation to automatically install to the storage card is currently not available).
3)Place cab files in the CabsManual folder if you want to be able to choose where to install the cab.
4)Place file in the Backup.zip file that you want to be restored.
ie. If you wanted example.jpg to be placed in the \Windows folder, place example.jpg in the Windows folder of the zip file.
*Please note that the cab files placed in the CabsAuto folder need to conform to only asking the user for the installation destination, then showing installation successful/unsuccessful. Otherwise you might encounter some
problems. You should place cabs that don't conform in the CabsManual folder, or adjust these cab files with programs such as WinCE CAB Manager.
-How to use:
1)In the Reload folder, execute Run1st. Click ok the the window that pops up. This just installs MortScript
2)Execute Run2nd. This will initiate the script that will first install the CabsAuto, then CabsManual, and finally restore the files in the zip file.
Use at your own risk.
Download
http://rapidshare.com/files/29964511/Reload.rar.html
Thx, that's a good idea.
is there a way to have it restore registry entries from a .reg file?
Is there a way to install certain cab files on RAMDisk/Storage card without individually clicking the install option??
@racerx_
Currently there isn't a way to restore the reg file directly. But you can create a cab from the reg file and then have that cab automatically installed.
MortScript wasn't able to read in the reg files i saved with resco explorer, so I gave up on doing it this way. For right now the easiest way is to create a cab file with WinCE Cab Manager.
@c_shekhar
The best way to install the program to the Storage Card, backup the reg (and any possible files installed on rom), then create a cab from this.
This post has alot of good information on this.
http://forum.xda-developers.com/showthread.php?t=277727
yeah, i've been trying like a madman to get win ce cab manager to make a cab of my .reg file.. but when i click on 'import' and try to grab the .reg file it tells me it's only for registered versions of the program.. is there another way i'm not seeing? cause right now the only other options i see for registry entries is to manually create them one by one which doesn't sound very exciting hah
thanks for the help..
@racerx
What OS and version of WinCE Cab Manager are you running. I heard of some problems with the newest version of WinCE Cab Manager with Vista. I am running version 2.1.0.35.
If that isn't it, you might have run the program past its initial trial use.
hmm.. Win Ce CabManager is 2.1.0.50 running on xp.. still got 17 uses left.. sigh..
Maybe i missed something. Just in case, what button or command are you using to get your .reg file into WinCE? I was using the 'file' 'import' command.
@racerx
That's the same way I do it. I would find an older version and try it again.
Reload V0.2
I made a couple of changes to the script for a rom we are going to be releasing soon...it checks if Backup.zip exists and only does the unzip if it does...I also added a SDBackup.zip for files to unzip to Storage card (specifically exe's and dll's I've already upx'd to shrink them but reinstalling the cabs replaced them again so this puts them back)....
#ReLoad
#v.02 Initial Release
#Use at your own risk.
#v.02 Extract files from SDBackup.zip to Storage Card
If(Question("Do you want to ReLoad?", "Reload 0.2", "YesNo")="No")
EXIT
EndIf
Run("Storage Card\ReLoad\Bin\Message_Running.mscr")
RegWriteDWord("HKLM", "Comm", "AutoRunFlag", "0")
RegWriteString("HKLM", "Comm", "AutoRunCFG", "\Storage Card\ReLoad\CabsAuto\Config.txt")
#Create Config File
Delete("\Storage Card\ReLoad\CabsAuto\Config.txt")
WriteFile("\Storage Card\ReLoad\CabsAuto\Config.txt", "SHOW:\Storage Card\ReLoad\Bin\ReLoad.bmp^NL^")
ForEach x in files { "\Storage Card\ReLoad\CabsAuto\*.cab" }
WriteFile("\Storage Card\ReLoad\CabsAuto\Config.txt", "CAB: ", 1)
WriteFile("\Storage Card\ReLoad\CabsAuto\Config.txt", x, 1)
WriteFile("\Storage Card\ReLoad\CabsAuto\Config.txt", "^NL^", 1)
EndForEach
#CabsAuto Install
RunWait("\Storage Card\ReLoad\Bin\AutoRun.exe")
#CabsManual Install
ForEach x in files { "\Storage Card\ReLoad\CabsManual\*.cab" }
RunWait(x)
EndForEach
If (FileExists("\Storage Card\ReLoad\Backup.zip") )
#Restore files from zip to main storage
UnzipAll("\Storage Card\ReLoad\Backup.zip", "")
EndIf
If (FileExists("\Storage Card\ReLoad\SDBackup.zip") )
#Restore files from zip2 to storage card
UnzipAll("\Storage Card\ReLoad\SDBackup.zip", "\Storage Card\")
EndIf
KillScript("\Storage Card\ReLoad\Bin\Message_Running.mscr")
If(Question("Finished ReLoading.^NL^Do you want to reset?", "Reload 0.2", "YesNo")="No")
Exit
EndIf
Reset
Very good soft, it works nice !!
The only difficulty for the french users is to replace in the script "Storage Card" by "Carte de stockage"
Thx men for this !!!
Nice soft,
I could use FAMAN WM6 on my trinity now !
French translation and modification is (seem to be) ok.
Just wait the OK from the boss and I'll give you !
Edit : Why don't you use the LOCK:Enabled in the header and LOCKDisabled on the end of the config file ? Thxs in advance.
I use SettingsSavior on my Trinity mainly for its similar auto-install functionality
Hello,
Thank you for this very useful tool
My .cab are removed after using Reload. How can I keep my .cab on my SD after a new installation ?
Thank you for your help.
Guillaume
__________________
SPV M700
FAMAN 4.03.FR
1.50.08.11
2.79.7020.19H
can this software reinstall cabs, copy skin files in programs installation directory (eg pocketcm skin) and reconfigure mail and exchange accounts ?
OOPS delete this post.

How to convert LNK to EXE? For key remap

I have been trying to get my HW keys remapped on the Q9 for a day now. After picking through the registry, I found a reg key that maps to the button
\HKEY_CURRENT_USER\ControlPanel\Keybd\APP2_Path
It accepts any .exe but I need to point it to a Mortscript file and that won't work. I can't even put a shortcut LNK value in there. Soon as I pop any exe in that field it works. Anybody know how to convert a LNK into an exe to trick this thing? I even tried running Mortscript.exe with the script name as a parameter but no luck. Thanks!
Looks like what I need is a basic applauncher .exe that would read the script/exe parameter from the registry or file. I have experimented some more with this registry key and it won't take anything other then a straight exe. Even quotes around the value breaks everything so I can't pass parameters around.
Mortscript comes with a file called autorun.exe. rename this file to the name of your mortscript, so if your mortscript is named 'myscript.mscr' then rename autorun.exe to 'myscript.exe'. make sure both files are in the same folder. Now when you run 'myscript.exe' it executes 'myscript.mscr'. For more information check mortscript documentation.
joemanb said:
Mortscript comes with a file called autorun.exe. rename this file to the name of your mortscript, so if your mortscript is named 'myscript.mscr' then rename autorun.exe to 'myscript.exe'. make sure both files are in the same folder. Now when you run 'myscript.exe' it executes 'myscript.mscr'. For more information check mortscript documentation.
Click to expand...
Click to collapse
i was so happy to see this fix and tried it. it appears to work about 5 times and then it stops responding. i have to reboot to get it working again. If i click on the script .mscr it works however. so something buggy in the autorun.exe. Any suggestions?
Take a look at http://www.vijay555.com
I think it's VJbrisk.exe or something like that, but I'm not sure...
There's definitely something there that can help you!
ithx i tried vbrisk but it would not install on wm6 smartphone. Any other apps that do the same?
Are your files in the same folder as 'mortscript.exe'? If not, put them there and try it. Make sure you have the lastest mortscript version.
Also, there is an old program called 'Launch Pad' by 'On Hiatus' that was developed for the HPC version of WinCE, and uses PocketC by 'Orbworks' (google both). You can use it to create .EXEs that work like .lnk files.
It works fine on my WM6 Wizard PPC, don't know if it will work on a Smartphone, but it's worth a try if the above doesn't work.
Another thing you could try is to extract the VJbrisk.exe from the cab file and manually transfer it to your device, then see if it works.
Yah they are in the same folder and named the same. I moved it al into the root. It appears to work for a couple hours, then dies and requires reboot. Otherwise it does the trick nicely. Mortscript is great!

[HELP] How to register a dll?

I try to create a program which consists of
.asx files (to show online tv channels),
.lnk files (shorcuts to the .asx files) and
a .dll file which contains only some .ico files (icons of the tv channels).
I added all these files to a cab using WinCE Cab Manager and tried to install it on my ppc. So far so good. The problem occurred when the message “The program can not be installed. Choose another location” appeared during installation, just after the process bar was filled.
Although I have no idea about computer programming, I have created many cab’s with WinCE Cab Manager for skins I have created for several programs. Anyway, I realized that the problem occurred due to the .dll file, since this is the first time I add such a file in a .cab.
I created my .dll file using a .dll from another program which had only icons in it, as well. I deleted them using Restorator 2007 and I had an “empty” .dll sized 4KB. Then I added my icon files using XN Resource Editor.
I searched the Internet to see what might be the problem with the .dll and I found out that I have to “register” my .dll file. I really have no idea what this means but it needs to be done. I also found an option in WinCE Cab Manager for “self-registering” file, but it didn’t work either.
So, the question to you dev guys is how can I register my .dll file, or should I create it from the beginning with another way?
Please help! Thanks in advance!
sorry to repost but it seems that posts keep coming in this forum and this thread is already in the second page and I'm afraid that noone will see it and reply to it. By the way, is there any special sub-forum for such questions?
This may help. I use his instructions to edit existing DLL's
http://www.modaco.com/content/i9x0-...88904/lisbian-taskbars-for-i910/#entry1023568
It will unsign the dll which will probably fail on your custom dll but it should sign it when you are done editing.
NilsP
Many thanks for your suggestion but unfortunately it didn't work for me.
As you said, this is mainly for resigning already signed .dll files.
Any other help will be appreciated. I can attach it here if anypne is willing to help. Or just tell me the way. Thanks!
I deploy a few dll's with my app, without any problem. If the installer complains about the location, what did you specify where it should go?
There are 2 approaches to solve this problem:
1.) If you have a private key to match a certificate in the device's certificate store, sign the .dll and .cab with this private key and it will be installed with elevated privledges, and be successful. To facilitate this you can install the "SDK Certificates" - and sign with the matching private key (you should be able to find these on a search, term "SDKCerts" or similar)
2.) Look for an "Application Unlocker" or other security reduction tool, run it, and you should be able to install the cab. On this note, if you check here, it will give you a more technical overview of the security policies. You want to change 4101 / 0x1005 to "SECROLE_MANAGER" (8) - which tells the system to install it with elevated privledges. Also make sure 4102 / 0x1006 is set to 1 to allow unsigned applications.
6Fg8
I don't believe that is the location I specified that causes the problem because when I deleted the .dll file from the .cab, it was installed properly. How do you create your dll files? With programming or you just edit existing files? If I send you my .ico files, will you be able to create the .dll file for me?
Da_G
Thanks but both approaches seem very complicated for me!
So, will I need Visual Basic in order to do this or is there any easier way? Can anyone sign the dll for me?
angelos_cy said:
6Fg8
How do you create your dll files? With programming or you just edit existing files? If I send you my .ico files, will you be able to create the .dll file for me?
Click to expand...
Click to collapse
Yes with programming, C++ or .net. Never had any issue with signing. I can try to make a dll if you send me the icons (or post them here if they aren't too secret ).
6Fg8 said:
I can try to make a dll if you send me the icons (or post them here if they aren't too secret ).
Click to expand...
Click to collapse
I have sent them to you by pm. They are not secret at all but I will create a "program" (wannabe ) with that dll and I want that program to be a surprise for users of the forum where I'll post it. I may post it on xda too, but it's nothing important.
Many thanks!
angelos_cy said:
The problem occurred when the message “The program can not be installed. Choose another location” appeared during installation, just after the process bar was filled.
Click to expand...
Click to collapse
This happens because you've changed resources in signed file, which changed file checksum and invalidated it's signature, and Windows installer refuses to install file with invalid signature. But it won't refuse to install this file WITHOUT signature at all - so use unsigner (search for it on XDA) to remove signature completely; if you encounter error, try to remove signature from original (unmodified) file, and then change resources in it...
6Fg8
the_ozyrys
Thanks to both of you!
6Fg8 has created and signed the dll for me and it finally worked, but I also tried the_ozyrys' method and it also worked.
So thanks to baniaczek too, since he created the unsigner.exe.
Everything worked fine with the dll. Now the cab is installed properly.
However, I have another problem. Just after the installation of the cab on my ppc, it seems that the device freezes for about a minute. This is propably because my cab contains a lot of shortcuts (.lnk files) that go under Programs folder.
So, I would like to ask for another favour, if it's possible. As I said I intend to give this cab to others too. Since this delay can make them believe that my program has freezed their device, I would like to make the cab restart the device just after installation and after uninstallation as well. I think this is made with the "Setup.dll" which I don't know how to create.
If anyone knows how to do this and has the time for it, could you please create this setup.dll for me. If the cab is needed to do this, just tell me to send it to you.
Thanks in advance!
Anyone? Plzzzzzzz!
If you want to sign .dll or .exe u can use the apps posted in the two posts below
http://forum.xda-developers.com/showthread.php?t=432041
or
http://forum.xda-developers.com/showpost.php?p=3530246&postcount=18
raykisi
Thanks for your answer but 6Fg8 and the_ozyrys already helped me on that.
My question now is how to create a setup.dll in order to make my .cab to prompt the user to restart the device after installation and uninstallation. If anyone can do it for me, I can send you the .cab which I alreday created and you can add the setup.dll with those functions.

Categories

Resources