Self deleting executable - Windows Mobile Development and Hacking General

Hello all,
I am trying to write an application in Visual Basic.NET 2008 for the Windows Mobile 5.0 platform. One of the features of the application is that it needs to have a "panic" button. The idea is that a user can run the application and press the panic button. The application should then terminate immediately and remove itself (the physical executable). A sort of self destructing program
The problem is that an executable cannot be deleted if it is running because the file is locked. It can only be deleted after the program has terminated, but after the program has terminated it is not possible to fire a delete command anymore.
I have done some investigation on the web and I found this article: http://www.catch22.net/tuts/selfdel
The article explains the problem and it also provides a few solutions. Unfortunately I am not familiar with writing C++ or assembler (too stupid ) ) so I have not been able to use "the ultimate self deleting executable code".
Is there anybody here that can help me a bit to get this working ? Any help is appreciated

There are two ways:
1. Use something else to delete you app.
2. Figure out the ASM root.
By your own admission, 2 isn't viable, so that leaves us with 1.
I can think of 2 ways to do it, a seperate App to delete yours, all the other app does is way 2 seconds and run, and keep running and retrying until the File is Deleted. Your app then calls it and quits.
The other way is to do the above process but use MortScript to delete and wait instead of an app. There's loads of Mort examples on xda.
Dave

Related

HELP: Re-Installing VBScipt on a Vario

All Games / Apps using Visual Basic seem to have stopped working.
Shortcuts to *.vb links get the error:
"There is no application associated with ...... Run the application first, then open this file from within the application."
Other files get the error:
Error : 0x80040154
(Cannot open VBScript)
Is there anyway I can reinstall the Visual Basic runtimes on my Vario without doing a full factory reset.
Logic says there must be a way.
I do not want to do a reset and lose all saved texts, MMS, contacts and all the software I have installed.
Appologies if this post is in the wrong place or has been asked before.
___________________________________________________________
T-Mobile Vario
Windows Mobile 5
ROM: 1.6.2.4 WWE
Radio: 01.12.10
well, I have more or less the same problem, there seems to be a problem with the installation of the eVb runtime on WM5, even thouhg I succeeded once...But the webmaster of http://www.omnisoft.com seems to have found a way of bypassing these limitations, I haven't found the time to test his solution yet. Let's say that the firts to try lets the other one know how it worked out.
Any idea how they bypassed these limitations or how I can get hold of them.
Anyone else got any links / guides to this problem.
I have two Varios and one MDA Compact to fix this problem on so far and I really dont want to do a hard reset.
It seems that the main problem is not the scripting engine itself which installs just fine. It has to do with the various ActiveX controls (MSCE*.dll) that are not registered when you install the runtime, but are requested by most apps to function properly. Basically, the post on omnisoft.com explains what entries you have to enter manually in the registry to register these controls.
By the way, what setup did you use to install the runtime?
I used the W2003
VBScript just stoped working inc games/apps I downloaded + minor apps I wrote with Forward Pass.
I did not install the runtime, it was in ROM.
That is why I may have to do a hard reset.
Is there any link to the post on omnisoft.com?
Doesn't Microsoft have any VB runtime install that will fix this? It is their OS.

how to run rundll32 under WM6

Dears,
I have 3 Blackberry services starting automatically. The security service locks the device completely after 60 min, which is not very helpful if you run a navigation program, because you're driving .
I know how to change the registry to stop these services, but later I would have to start them manually. The services are in 3 different .dll files.
How can I run rundll32 (the utiity exists in \windows) like I would do in Windows XP:
run rundll32 <filename.dll>
preferably I would like to write a small batch file, which would issue all the 3 necessary run commands.
Your help will be highly appreciated.
Searched the forum, but rundll32 returns no results.
Best Regards
What are you doing, registering the dll or trying to execute a function within the dll?
V
Autostart starts Services automatically during the boot process.
I want to start 3 of these services manually.
These 3 services are contained in 3 .dll files.
I was assuming, that rundll32 would load these dlls into the memory and make them available for applications.
On the bottom line, I want to start services manually as they would normally be started automatically by the OS.
Best Regards
I'm not really sure about the service you mentioned. . but if you download the 'TaskManager' (freeware), there is a section of it that controls services, which you can disable/enable and set it manual/automatic.
Thank you,
you were right, TaskManager can do, Memmaid cannot :-( Like that I can start/stop the service.
However,
I would still like to know, how services contined in a dll file are started by the OS.
I downloaded also MortScript, which can execute batch files. But the rundll32 <filename.dll> does not start the service.
Try looking for regsvr (google, not on your device).
eg http://www.pocketpcdn.com/articles/regsvr.html
(but there's a better version somewhere IIRC)
V

Software installation problems on WM5.0 and HTC Advantage.

Hello All,
I've got a HTC Advantage X7500, running WM5.0. I'm trying to install some of my company's software on the machine. The software package has installed fine on many other WM5.0 machines but fails on this one.
The install just reboots the machine towards the end of the install process. On restart, the machine beings the install process from the beginning.
If I look at the registry after the reboot I can see that all the registry entries in the install ARE in the machine registry, so it looks like the most of the install has been done. However, it does not get as far as calling my Install_Exit DLL routine.
So, I removed the custom DLL that I use during the install. But I get the same problem - it reboots and restarts the install. I have no reboots coded anywhere in the install.
I've tried attaching the Visual Studio debugger to what I think is the correct process on the machine but no errors are reported in the debugger, and the reboot goes ahead anyway. I even tried attaching the debugger to ALL processes on the machine, but that just hung the debugger :-(.
Does anyone have any hints for debugging installls, or any other handy ideas. Would I get any joy from the HTC support? (in fact does anyone have a developer support contact at HTC?)
Thanks,
John
Ah, OK. got it. Sit down, here's a little story.
I binary chopped my way through the install and found the offending section of the script. It was in the [RegSettings] sections, which is actioned by AddReg.
I was creating 8 subkeys or values under HKCR. These are to register two file extensions for some of our application data files. One of these was succeeding, the other was causing the reboot.
The one that fails is for an extension ".DCF". It seems that on the HTC Advantage device (and perhaps on all 5.0 devices) this file extension in already registered. (still, shouldn't cause the machine to reboot).
Here's where the paranoia kicks in.
As I was looking at this I was reading an article about DRM in Windows Vista (very interesting: http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.html)
So I was very amused when I noticed on the PDA that the "'.DCF" extension is described as "drmcontent" in the registry. Now, it may be a complete coincidence that "drmcontent" contains the acronym DRM, but I was amused nevertheless. Have the interesting attempts by Microsoft to add DRM to Vista had repercussions on Windows Mobile? or is the paranoia really getting to me?
Anyway, problem found, solution accepted (don't register that file extension), and bug reported (well it will be soon, the reboot really should not occur (remember it's not just the reboot, but the re-start of the install from the beginning after the reboot) ).
On a related note, I phoned the HTC support number here in the UK and was told that the only way I could get "developer support" was to write to head office in Taiwan (that's write mind you, not phone, not even email, good old snail mail).
Ah, roll on the weekend.
Thanks to all of you who took the time to read the original problem.
/john

HKEY_LOCAL_MACHINE\init - App does not start

Hi,
I've programmed a small MFC-based Visual c++ application which I want to start automatically on boot on an ARTEMIS device. The earlier the app starts, the better. Thus, rather than creating a shortcut in windows\Start up, I decided to add a registry entry into HKLM/init as "Launch90" "myApp.exe" The executable is placed in the /Windows directory.
But it does not start as expected, just occasionally. I got the impression that the application comes up only the second or third reboot (soft reset) after installing the CAB file. After other reboots, no indication why the application fails.
I have already tried to vary the number right to "launch" in the key, tried to set a dependency, set the MFC to static and to dynamic, but the application does not start. (by the way, it works well when adding a shortcut to the start up directory). I have no idea why it does not work with the registry approach. Do I have to consider something special for such kind of applications?
thanks in advance for any idea...
Gunther
Is it signed or authorized?
When you run your application your device asks you if it is OK to run because it is not signed (unless you disabled that in security settings).
If you answered yes once, it won't ask again.
However if you try to launch unsigned and unauthorized app from init it will just ignore it.
Another possibility is that your app is trying to access an unavailable resource (maybe something on storage card?) and crashes. Make sure everything it needs is available during init stage.
I guess the signing issue is one of the reason for the problems. I've in the meantime created an individual certificate, installed it on the device, and signed my application with that cert.
The behaviour improved: At most reboots, my application comes up as expected. But sometimes it does not. I just rebooted my device 5 times, 4 times it worked and once, launching the app failed. Another reboot again succeeded.
Do you think when launching the application with the reg setting "Launch95", it sometimes happen that the MFC DLL can not be accessed (it is linked during runtime)?
Create somewhere shortcut to execute your exe with one and only one parameter: "90"
Something like this:
Code:
0#\windows\myApp.exe 90
If app doesn't start - read this thread:
http://forum.xda-developers.com/showthread.php?t=302013
initlauncher may be method for vjtoggletoday missing tray..hmmm.
thx for that topic.
Thanks for the hints, but I'm still not satisfied with the outcomes. I've implemented the InitLauncher.exe (with slight modifications) and it works also with multiple reboots. But then I did a "hardcore test": I rebooted the device, InitLauncher.exe was executed and the second application came up. Then I've removed the battery. Since then it does not anymore work.
The certificate is still listed in the device, but could it be that something happened to the cert by killing the system? (For installing the cert, I simply copied the myCert.cer to the root directory and executed the cert installer by tapping the cer file.)
Or could the signature of the executable have been damaged? Any idea how to avoid such problems?
Addendum to my last post: I've now tried to re-install the Certificate on the device by again clicking the *.cer file - autostart worked again. Thus, I assume that something happened to the certificate on the mobile device. But the question is: WHAT happened...?
I recommend to you test all in emulator at first.
Or make hard reset and test on clear system.
I did a hard reset, re-installed the application and tested again. On warmstarts, it mostly works, but not everytime.
And there's another thing that puzzles me: When I create the CAB-Installer, all modules get signed using the signtool. If one of the modules is replaced (e.g. the replacement .exe is just copied to the device and overwrites the existing one), on first start the device always pops up a security warning as it does with unsigned apps, although the new exe has been signed as well.
Could this be caused by using a proprietary signature rather than one of the commercial pre-installed ones?
I furthermore used the signtool to sign the CAB file (I also tried to include the certificate through a pre-XML file when creating the CAB file) - however, this has no effect: Anytime the CAB is being executed on the device, the security warning pops up...
Possible you use wrong sertificate?
please show name of it.
Also don't forget to install certificate on device!
Basically, its a self-created certificate. The certificate is acutally installed on the device (copied the .cer file to the device and clicked it - it then shows up in the device's certificate list)
When signed applications are manually started on the device there is no security warning. Thus, I assume that the signature of the executables and the installed cert match.
Again back to the start-up problem: When using user-created certificates and when autostarting apps through HKLM/init: Do these apps have to wait for another module to be loaded first?
Không vào được màn hình Home của DVD trên xe hơi chạy winCe 6.0. Xin giúp đỡ.
Hello friends !
I'm living in Vietnam
I recently accidentally reinstalled the system of the DVD in the car.
Run operating system win CE 6.0
Now it's time to start it straight into win without going to the default home screen of your head. I've been able to understand but can not do anything else to make the situation better. Currently the new room is not possible.
Can you just help yourself to boot it (the app home line is: \ Residentflash2 \ app \ home.exe).
I hope you help me. You can instruct yourself how and if any editing software. I would like to thank !
Email: [email protected]
---------- Post added at 07:59 PM ---------- Previous post was at 07:56 PM ----------
Hello friends !
I'm living in Vietnam
I recently accidentally reinstalled the system of the DVD in the car.
Run operating system win CE 6.0
Now it's time to start it straight into win without going to the default home screen of your head. I've been able to understand but can not do anything else to make the situation better. Currently the new room is not possible.
Can you just help yourself to boot it (the app home line is: \ Residentflash2 \ app \ home.exe).
I hope you help me. You can instruct yourself how and if any editing software. I would like to thank !
Email: [email protected]
Hello friends ...I accidentally deleted the file \ Residentflash2 \ app \ home.exe . Any one can send me this file ? My double din not work any more .

[Q] RAPICONFIG (0x80042008) error

Hi guys,
I'm trying to provision a HTC Touch 2 with RAPI. After I run this:
Code:
rapiconfig /p config.xml
I get this:
Code:
Config failed (0x80042008): A fatal transaction failure has occurred. The device may be in an unknown state.
I'm clueless in what I can do to fix this, since the .xml holds the security policy settings for the device...
Ultimately, I need to install a few cabs through a script, with no UI during install. Which i'm running with rapistart by the way.
Some help would be greatly appreciated!
I don't know about this Rapi Neo, but you can use Dotfred's Taskmanager to import a xml.
Edit; no UI ok, so no way you can install Dotfred LoL, sorry.
Thanks Laurentius, I'll still have a look at that.
I'll explain my scenario a bit more.
I have to run a script which installs a few cabs (so no cab security etc) and then modify the start menu, so users are only able to run forementioned apps and a few standard things like contacts, sms, that sort of thing. Settings should be blocked or removed, so they won't be able to change any settings made before running the script.
The first problem arises with getting rid of the security. RAPIconfig usually was able to send a provisioning xml to the device (on wm6.1) and change the security policy keys in the registry. This time, i'm running it on a wm6.5 device. So i'm doing something wrong there.
And last but not least: I used to be able to run CeRun.exe in the script on wm6.1 (does almost the same as RAPIstart.exe, but is able to do multiple cab installs at the same time, without showing the installation on the device) and i'm wondering why it doesn't work in 6.5 anymore.
I guess no one ever used RAPI tools?

Resources