Auto install of .CAB files from memory card - Windows Mobile Development and Hacking General

Dear list,
Sorry if this has been answered in the past.
I am trying to install a CAB file from the memory card. MS documentation state is should be in a directory with the CPU number and called "<Provider> <AppName>.cab" (see autorun.cpp in samples.)
So I create:
\PXA272\my app.cab
Yet this is not installed. Maybe my CPU number is wrong?
If any users have experience of the auto-install method, I would be very interested in hearing from you.

There is a reg hack to point the autorun found in Ext rom as well as the config.txt to some other location.
In the Blueangel forum I opened a thread some thing about auto install (search).
The same info is also on wiki in the BA ext rom kitchen.
Hope it helps

Thanks for the information.
My needs are really for customers running unmodified XDA's. These customers seem to frequently run down their batteries, therefore loosing all programs.
What I really need is an ability to reinstall and run our application from a memory card placed into an unmodified XDA.
Regards,
Ben

I seem to have found the solution
Create a program \2577\autorun.exe on the card.
When the card is inserted the program is run with the parameter 'install'.
When the devise reinstalls, I belive the above is also run.
When card removed, a copy of program run with parameter 'uninstall'.
If you want to install a CAB, use code something like:
CreateProcess(_T("\\Windows\\wceload.exe")
, _T("cab_file.cab"), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
More info at:
http://msdn.microsoft.com/library/d.../html/ppc_programming_pocket_pc_2002_balr.asp
Also sample file autorun.cpp found in PocketPC 2003 installation directory.
Regards,
Ben.

Related

Cold boot auto install

How would I go about performing an automatic installation of several .CAB files after a cold boot of the XDA 2? These CAB files will be located on a storage card and are part of a commercial package.
Thanks
Tony Hudson
One can create a "autorun.exe" in a folder called "2577" on the memorycard..
But I'm really not sure how...
you can auto install
by putting the updates in the extented rom
http://wiki.xda-developers.com/index.php?pagename=ER2003Edit
not sure how you would go about making them be able to be located on the sd card unless you put in a program in the extented rom
which would again auto install the cab files located on the sd card
I have wrote an eVC app for installing multiple .CAB files on an SD card. I am wanting the CAB files to be installed synchronously then the device to be warm booted so I am calling ShellExecuteEx to open the CAB file, WaitForSingleObject to determine when the CAB file has finished and then KernelIoControl to reboot the device.
The problem is that WaitForSingleObject is returning before the CAB file has closed with an error code of 6 which is invalid handle.
info.cbSize = sizeof(info);
info.fMask = SEE_MASK_FLAG_NO_UI;
info.hwnd = NULL;
info.lpVerb = _T("open");
info.lpFile = (LPCWSTR) &szCAB;
info.lpParameters = _T("");
info.lpDirectory = _T("");
info.nShow = SW_SHOW;
// Call to perform an action
ShellExecuteEx(&info);
if ((long)info.hInstApp > 32)
{
dwRetVal = WaitForSingleObject(info.hProcess, INFINITE);
switch(dwRetVal)
{
case WAIT_ABANDONED:
iErrCode = 4;
break;
case WAIT_OBJECT_0:
iErrCode = 4;
break;
case WAIT_FAILED:
dwErr = GetLastError();
iErrCode = 4;
break;
default:
iErrCode = 0;
break;
}
}
When running this in debug mode the CAB file being executed has presented the user with a dialog box prompting to overwrite existing files and the WaitForSingleObject has already returned.
Any suggestions?
Thanks.
Install From Storage Card on Insertion
This details info about autoinstalls from a SD card...
But the application is also uninstalled on removal of the card?
http://msdn.microsoft.com/library/d...P/html/sp_programming_pocket_pc_2002_balr.asp
Thankyou but I have already read this, and the above listing is a section of my autorun.exe application. This does not answer the problem I have documented above but thanks for taking time to assist me.
Just to outline, the problem that I am witnessing is that all the CAB files are being opened before the previous CAB installation has completed and the device is being warm booted without all the CAB files being installed. I need to wait in the looping code until a CAB file has completed its installation. The waitforsingleobject call should do this but it appears to fail. The CAB file has been opened succesfully but the error is that an invalid handle has been provided to the call. Thanks for any help
Doh! How stupid am I - please dont everyone reply. The programming error is in that I assign the return value of WaitForSingleObject to a variable. Change the above code snippet from
dwRetVal = WaitForSingleObject(info.hProcess, INFINITE);
to
WaitForSingleObject(info.hProcess, INFINITE);
and remove the switch..case code and it works fine.
Ok. So I now have my autorun.exe program that installs my CAB files but where do I put it in order for it to automatically install after a cold boot? I have tried the .EXE in "\storage card\2577" and in "\storage\2577" neither of them working. Modifying extended ROM is not an option here as this is a commercial package that is distributed on an SD card. I simply want the user to insert the SD card and then do a cold boot that will then install the CAB files. Is this possible and if so how? Thanks.
Got it all working now, the .EXE does go into the SD card subdirectory \storage card\2577.
HI,
Have you (or someOne else) tried to call registry keys (mostly interested in network connections) from this autorun.exe?
Herman
autorun?
what did you use for an autorun.exe??
is the code u put up earlier comilable to an autrun.exe?
(not a coder per se ,but dibble little here and there)
or is it from the sdk?
It it possible for u to post it as a attachment here?
Re: autorun?
lynxlynx said:
what did you use for an autorun.exe??
is the code u put up earlier comilable to an autrun.exe?
(not a coder per se ,but dibble little here and there)
or is it from the sdk?
It it possible for u to post it as a attachment here?
Click to expand...
Click to collapse
The Autorun.exe file can be whatever exe file you want.
that I understand...but what if I wanna install more than 1 thing...I have a list of stuff I wanna do...like a couple of .cab and some .exe´s and maybe a .cpf.....how can I get them all to run automatically on cardinsert....
I gave the code to a programmer at work..I will see what he comes upp with...but I thinkthat there should be somekind of "public" autrun.exe with a .cfg file with it to download here at xda-dev.
If mine works I will post it later...

CABS dissapear from my minisd why?

Hello everybody.
Whenever I install a .cab from my miniSD card it dissapears from the miniSD card. Why is this? Is there any solution?
Thanks in advance.
Thats what WM does. It will remove the original CAB files once you have installed it. To solve this, copy a backup of the CAB file before installing.
Ot make a CAB not delete after running it. copy the file to your SD via your PC and then right click on the file and make it Read only.
Once read only the file will not be delete after being run.
hanmin said:
Thats what WM does. It will remove the original CAB files once you have installed it. To solve this, copy a backup of the CAB file before installing.
Click to expand...
Click to collapse
Or just set the file properties to read only using TotalCommander /GSFinder etc. That way you can keep them all on your SD card in case you need to reinstall away from your PC.
bryanz, click on cabinstl.exe. check the option <Do not delete cab file>. The default is unchecked (blank). This solves ur problem
Hi blogg buster, in what folder is that file?
Thanks for all your replies.
bryanz said:
Hi blogg buster, in what folder is that file?
Thanks for all your replies.
Click to expand...
Click to collapse
cabinstl is a freeware program for WM2003 which lets you to choose whether to install the application to main memory or SD card, (which WM5/AS4 now does itself), and the option to keep the cab, which you can do anyway by setting the RO attribute. So IMHO it's not really needed on the Wizard.
OK, thanks a lot Ineedtoys
Ineedtoys, I think bryanz may be right but from what I gather u are running smthing which looks like cabinstaller. Check from Start>program to see whether u have cab installer. if not, then discard my suggestion. Another way is to use the FIND option from ur file explorer to find "cabinstl.exe" .
Good luck
This little cab will stop all cabs installed after it from being deleted, although it will delete after you use it. It probably is the same as putting a check mark in the cabinstl.exe program.
blogg buster said:
Ineedtoys, I think bryanz may be right but from what I gather u are running smthing which looks like cabinstaller. Check from Start>program to see whether u have cab installer. if not, then discard my suggestion. Another way is to use the FIND option from ur file explorer to find "cabinstl.exe" .
Good luck
Click to expand...
Click to collapse
The only file I can find on my WM5 and 2003SE machines is a cabinstl.dll in ROM, which cannot be run directly. So if you have a "cabinstl.exe", you must have installed the freeware add-on?
Which is largely redundant in WM5 anyway, apart from letting you see or extract the contents of the cab prior to installation.
guttrhead said:
This little cab will stop all cabs installed after it from being deleted, although it will delete after you use it. It probably is the same as putting a check mark in the cabinstl.exe program.
Click to expand...
Click to collapse
I have posted on other forums the reverse issue for some people with other WM5 devices.
Kevin Tofel and James Kendrick of MobileTechRoundup have mentioned that on their WM5 phones - Verizon 6700 and Treo 700w, that any installation .cab files that they install are not deleted after the app is installed. I wonder if the above little cab (or something like it) has been installed on some OEM devices.
Any ideas how to reverse this and have the cab deleted for those that don't have the functionality.
There's actually a registry setting that controls this. Here's a quote from a registry tweak thread on Treo Central exlaining how:
Make WM5 keep CAB files around after installing (1)
If you wish to keep the original .CAB file around after installing the application, set:
HKLM\Software\apps\Microsoft Application Installer\nDynamicDelete = 0 (DWORD decimal)
Or to restore to the default:
HKLM\Software\apps\Microsoft Application Installer\nDynamicDelete = 2 (DWORD decimal)
Make WM5 keep CAB files around after installing (2)
An alternative method of making WM5 keep the original .CAB file around after installing the application is by adding the "/nodelete" option to the Windows CE loader:
HKCR\cabfile\Shell\open\command = 'wceload.exe "%1" /nodelete' (REG_SZ string, no quotes)
I trialed a 700w for a while and noticed that it would delete cabs installed from main memory but not from SD. I'm wondering if nDynamicDelete = 1 sets this behavior.

ROM Chefs: SDAutoRun gives customziation to everybody!

User Customization is a config.txt file that's located on an SD card which can install cab & xml files located there too! Think about it: this gives anyone who loads your rom the ability to automatically install their preferred apps/settings as part of customization. Here's how to make your next ROM UC capable:
Cook the attached SDAutoRun.exe into \windows
if AutoRun.exe isn't already in \windows then place a copy there too. Note: some devices don't have a compatible AutoRun.exe. If you have issues, try the attached version.
Replace the "RST: Reset" line in config.txt with "EXEC:\windows\SDAutoRun.exe"
That's it! SDAutoRun will do the final reset unless it encounters a file called SDConfig.txt in the root directory of the storage card. If it sees this file, it will restart autorun and install cabs/configure settings from SDConfig.txt which can point to files that are also located on the SD card.
What's important is this: If every chef uses this system then ROM junkies will be able to freely move between ROMs. If you decide to include this in your next cooked ROM, then make sure you indicate that it's UC capable. I'd really like to make this a standard because it will greatly ease the time consuming task of re-installing apps/settings.
UC v2.0 is now Live!
Changelog
Works with non-WWE ROMs & Internal Storage Roms. SDAutoRun uses the registry to determine the default name for the Storage Card now. For newer devices, this key might be missing altogether so just cook it in. The "Folder" value points to the actual location that contains sdconfig.txt. Here's the key:
[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\SDMemory]
"Folder"="Storage Card"
Automatically corrects SDConfig.txt formatting errors. Extra/missing tabs, spaces, newline characters etc are corrected before passing to autorun.exe.
New string value "SDAutoRunVersion" created in HKLM\comm contains "2.0". This will help debug SDConfig.txt file issues in the user thread.
SDAutorun v2.0 is fully compatible with all SDConfig.txt files created to date. Additionally, there now shouldn't be a config file users can throw at it that it won't re-format to the following template:
Commands will be left justified into the first 5 characters and space filled
Parameters will be left justified to the 6th character and trailing whitespace will be removed
Lines that don't contain a command will not be passed to autorun. Note: To determine validity, I only check for a ":" in postion 4 or 5 here to allow for future command expansion.
if no valid commands are encountered, then a file containing only "RST: Reset" will be created
Assumptions
SDAutoRun is not signed so security must be relaxed in HKLM\Security\Policies\Polices by setting the value 0000101a to a 1.
SDConfig.txt cannot be Unicode.
Here's a link to the User's side of ROM customization:
ROM Flashing Junkies: User Customization is here!
If you build a UC capable ROM, be sure to link to the above thread. Also shoot me a PM and I'll add your ROM to the UC capable list.
The key here is that UC is an automated, unattended configuration. Setting it up is done out of the Hard Reset window and once its on your SD card, it works any time you hard reset. Automated is good because it allows mass customization from a business standpoint too. Any business using a UC capable ROM can set up a single "ROM customization" SD card then give it to their IT staff for the daily provisioning of company software/branding on new devices. Your UC capable ROMs have business appeal now!
We are also working on tools that will simplify the XML/SDConfig.txt file creation process. Several good ones have already surfaced in the Users thread.
Useful Stuff
OEM Package for Kaiser
I think this is/will be a great standard! Well done Sleuth for initiating this.
Genius idea.
Good news: doedoe is looking at building a provisioning tool! Now we have two developers working on this. We can sure use more help though. See the user thread for more info!
Good But What S About Cab Wich Prompt For Choosing Languages Or Some Parameters To Be Installed ?
UC
Very nice.
For flashing junkies it's necassary yes, after each flash all your favorit apps auto installed is awsom, nice one Sleuth
a request
can someone make it for all devices/ for example wizard? that will be awesome
Hehe many many thanks.
I tried to get this working with the standard AutoRun from SD but i couln't get it working.
Screw Extended Rom completly.
Great Work.
Making A bookmark.
character said:
can someone make it for all devices/ for example wizard? that will be awesome
Click to expand...
Click to collapse
ROM chefs should be able to use UC on any ROM. Post a link on your favorite ROM Chef's thread if you want to see UC.
SETOUF said:
Good But What S About Cab Wich Prompt For Choosing Languages Or Some Parameters To Be Installed ?
Click to expand...
Click to collapse
Those will need to be researched by the community. Post findings in the user thread (see page 1 for the link)
Awesome application.. so simple I'm amazed it took this long for someone to think of it!
I've cooked it into my ROM.. but I haven't released it so it cant really count as a UC compliant ROM..
It's definitely useful though and I'd love to see others using it. Thanks Sleuth
Already Found in Kin0kin ROMS
Great idea; however Kin0kin released a couple of roms some time ago that do this plus his final WM6 rom is also capable of auto install of applications off a storage card in this way.
WB
And why not change the reg
HKLM\Comm
\Extended_ROM\autorun.exe
and
\Extended_ROM\config.txt
into
\Storage Card\autorun.exe
and
\Storage Card\config.txt
Most ELF roms don't use Ext rom Auto installs any ways.
I still think this is a good cause because he's trying to get more people into doing this.
Instead of one or a few cooks integrating this.
Sleuth255 said:
sorry. AutoRun, by HTC design, cannot install apps to your storage card.
Click to expand...
Click to collapse
Well it shouldn't be hard to patch cab files hardcoded to a path on SD Card. (once i have found all my software back) But not something for a regular user nope.
Sorry to hear that Limitation still exists, seeing your actually using the Original Autorun.
I was allready removing this from my Roms.
Noonski said:
And why not change the reg
HKLM\Comm
\Extended_ROM\autorun.exe
and
\Extended_ROM\config.txt
into
\Storage Card\autorun.exe
and
\Storage Card\config.txt
Click to expand...
Click to collapse
that's pretty much what SDAutoRun does. It reconfigures the reg settings as you indicate and re-runs autorun. First however, it changes SDconfig.txt referenced cabs to RO since on a kaiser at least, the reg settings to prevent post installation CAB removal are ignored by AutoRun. Also, if no SDConfig.txt exists or there is no SD card installed, then it generates a quick one line config.txt containg the RST: command then re-runs autorun. On a Kaiser at least, the RST: command also re-activates the radio first. Without it, the device comes up with the radio disabled. I figured this scheme would maintain compatibility across all devices.
The standard is the important thing though as you indicate. You don't need to incorporate SDAutoRun in the manner I suggest. Whatever scheme works best for you is fine as long as it meets the following specifications:
user config occurs after all other autorun config
if SDConfig.txt is found on the storage card, set up the registry and re-run autorun
if SDConfig.txt is missing or there is no storage card installed then perform the final RST:
don't remove CABS from the storage card after installation.
I just thought my little 31K pgm was the easiset way to accomplish this. On deck is a way to do this even if the user renames the storage card...
Well looks like you can ad me to the list after monday.
I'm going to strip The new 6. rom to the bone and make some custom cabs hardcoded to SD card installation for the stripped Apps that can work from SD.
Cool... shoot me the link to your support thread when you do & I'll put it up on pg 1 of the UC user thread.
Regedit setting
Sleuth255 said:
HKLM\Security\Policies\Polices by setting the value 0000101C to a 1.
Click to expand...
Click to collapse
Can someone tell me what's "a 1"?
??[HKEY_LOCAL_MACHINE\Security\Policies\Policies]
"0000101C"=dword:a 1??
or
??[HKEY_LOCAL_MACHINE\Security\Policies\Policies]
"0000101C"=dword:a1??
Cheers
Strange that it's contain hardcoded paths ...! The name of my Storage card is Speicherkarte and so it's useless for me!
Probably a dumb question but where would I put this file in the base kit I have. I have a base kit for wm6.1 on titan. Ide love to cook up a rom but I dont know where this file goes.
smarvest said:
Can someone tell me what's "a 1"?
??[HKEY_LOCAL_MACHINE\Security\Policies\Policies]
"0000101C"=dword:a 1??
or
??[HKEY_LOCAL_MACHINE\Security\Policies\Policies]
"0000101C"=dword:a1??
Cheers
Click to expand...
Click to collapse
set the value "000101c" to a 1 ie:
[HKEY_LOCAL_MACHINE\Security\Policies\Policies]
"0000101C"=dword:1

.cab files installation

Hi
I using i-mate Jam
Whenever I try to install a cab file I dont get option of saving the program on sd card or on phone memory.
How can it be fixed?
Looking forward to your help
Regards
you can try WinCE CAB Manager for that, it's an amazing program to edit cab's, and allows me to even relocate some DLL's files off \Windows folder.
Beware that some cab's dont like to be relocated, however it's great to save some precious space on wm2003 devices.
Thanks iRiKi
I have found out that after installation, I can use Pocket Mechanic to move any program from Main memory to Storage Card Its a pretty handy application!
you can try these registry hacks. they work on my O2 XDA II Mini
Ask where to install CAB
HKEY_LOCAL_MACHINE/software/Apps/Microsoft Application installer
'fAskDest' DWORD to 1 (DEC).
--------------------------------------------------------------------------------
Dont delete CAB files after install
HKEY_LOCAL_MACHINE/software/Apps/Microsoft Application installer
'nDynamicDelete' DWORD to 0 (DEC)
--------------------------------------------------------------------------------
guess i quite didn't understand the first post correctly..
what you want is CabInstl:
http://freewareppc.com/utilities/cabinstl.shtml
it's the very first thing i run after hard-resets

Moving Mail and Attachments to Storage Card

Hi
The attached file makes necessary registry changes to move Mail and Atachement storage to SD Card.
There have been a few cab installers available to perform a registry change, enabling storage of both Mail as well as Attachments on the Storage Card. However these solutions have the "Storage Card" hard coded as destination, which means if more than one partitions exist on Storage Card, manual changes would be required to the registry to use another partition. Another way is to have separate cabs created for each partition. Another problem is that on some devices the Storage Card is named as "Memory Card" (I've seen this on on my O2 Atom Exec), hence again manual registry changes are required or a custom cab needs to be created for these devices.
The attached cab installer tries to overcome above mentioned limitations. During the installation "Device" and all the available Storage Card Partitions are listed and user is asked to select the destination. The registry changes are performed accordingly to enable Mail and Attachment storage on the selected partition or Device.
The cab creates following registry entries under "HKLM\System\Inbox\Settings" :
- PropertyPath = <destination>\Mail
- AttachPath = <destination>\Mail\Attachment
where <destination> is the option selected as destination while installing the cab.
Uninstalling the application from Add/Remove programs should restore the old values (if any) of the above registry keys.
The cab file has been tested to be working fine on WM6.1 and should work fine on WM6 also. WM5 requires different registry entries and the attached cab does not work for WM5.
Please let me know if anyone find this useful
I just installed this on my Verizon XV6900 with Windows Mobile 6.1. All I can say is, Awesome! Thanks for this. I love the automation of it. Seamless. And providing the uninstall is also nice. Just installed, powered off, then back on, and all is well. Do you think you might also be interested in doing the same thing for Internet explorer temp files, favs, cookies. Maybe make the folder it creates be called "Internet". I had a file before for my Moto Q9m that made a bunch of things store on my storage card and I loved it. It really kept my phone running very fast, as it didn't use up main storage. With my old phone, I had 5000+ emails, alot of favs and such. I loved the fact that I could wipe my phone out any time, and then re-import the reg changes to point back to the storage card for all my stuff, and I was right back up and ready to go with all my files.
Thanks Again!

Categories

Resources