Waiting for a process - Windows Mobile Development and Hacking General

Hello everybody.
I'm writing an application which starts several other applications (exe and cab files). I want my application to wait for the called process. Can anyone tell me how I can do that?
I've read about an API function called "WaitForInputIdle". But it seems like this function does not exist in User32.dll or even in Windows CE. Do I just have to use another library? If yes which one do I have to invoke?
For now I just check for the called process an set my main thread asleep for one second if the called process is still running. But in my opinion this is not really a nice solution...
Can someone please give me a hint?
Thanks in advance.
Alex

If you use CreateProcess you get back the handle to that process in the PROCESS_INFORMATION structure.
You can use this handle with WaitForSingleObject API to suspend your thread until the process terminates.

Yepp...
Hi levenum.
Thanks for this tip. It works fine.

Related

SHBrowseForFolder problem

hi all,
I want to include a browse for folder dialog in my application but when every I attemp to link the linker gives me an unresolved external symbol problem.
I googled for the problem and most sites say that this API is not implemented in the ceshell.lib.
Anyone used this function successfuly with eVC++ 4.0, 2003se sdk??
if not, are there any easy alternatives?
Thanks
Mohammad
No way. Not implemented. You have to write it down yourself
Thats right, its up to you. Same with the other common dialogs like to open or save files. Its a pitty because it takes a lot of code to re-invent that wheel every time someone wants the functionality.
really this is annoying... anybody wrote similar thing for windows ce??
thanx guys
you can check here
http://www.codeguru.com/

Setup.dll editing what it does on install...

Ok so I have been missing around with an app. and found out that its setup.dll on install adds a shortcut in the programs menu and messes with the default today items settings. I have used ResHacker to look @ it but it doesnt seem to show the shortcut or anything else, it simply has the EULA accept info as far as I see with ResHacker. So my question is, is there a way to stop it from doing so? Would I need to just try and create my own Setup.dll for it? Or is there a better dll editor?
Thanks for any help,
Mike
No such thing as "DLL editor". Resource hacker only shoes resources, that is dialogs bitmaps icons and any text the writer chose to put in a string table so it would be easily changed. I guess the shortcut is hard-coded.
Now I am not sure what your background in programing is, so don't be offended if this explanation is too basic.
DLL is basically a program, only it isn't started by itself but called by another program.
You could try removing it from the CAB all together, but it could be performing other functions critical to program installation. You would need to know about them and be able to code in c / c++ to write a replacement.
There is a powerful disassembler called IDA for ARM code but you need to know assembler on a good level to do anything with it.
Thanks so much for the reply. Well im not that new to .cabs, roms, and what not but c+ or c# im a complete n00b. Didnt know there wasnt a dll editor, my mistake. You learn something new everyday. That being said...I removed it before posting and should have said that. This setup.dll is needed and wont work without it. But I figured what you said a new one would probably be the only way. But you mention disassembler....so since im new which would u suggest would be easier? I do have the tools to write one....but i dont have anything for the disassembler method.
Thanks,
Mike
Writing an app is much easier than disassembling one, since reading assembler is no joy (at leas for normal and semi normal people, some consider it their second / first language).
But like I wrote before you face one basic problem: What is it that this DLL does that the program won't run without?
If you know that, writing a new one will not be a problem. People on the forum could help you with the C++ code if you have basic knowledge of the language. C# won't work for this.
be aware that the dll that dose the installation is normally stored in the windows directory for performing the uninstallation at a later time. Modifying it could prevent propper removal of the program.
If the shortcut is hard coded into the dll it is probably visible as readable text in the dll (as long as the author did not try to obfuscate it). If so you may be able to just replace the string. I gave it a try on a similar dll but just editing the text screws up the dll. Someone else may be able to tell how to do it properly (please).
I think I figured out what the issue was and why it wouldnt work without the setup.dll. Its just a reg edit that the setup.dll does and thats what was missing when its removed. When I added it to the .cab everything worked smoothly! Thanks for the replys guys and I appreciate the help! BTW thanks for being so nice about it levenum. I would have responded sooner just been busy.
~Mike

Hook CreateProcess() function call

Hey,
is it possible to make a hook on the CreateProcess() function call
under WM5?
I want to develope a process blocker app. Currently I poll the process list
with CreateToolhelp32Snapshot() every second but this will
make to much cpu load and drains battery.
Has anybody experience in hooking functions on WM5?
Thanks!
Houser
Hi houser.
Sorry I don't have a link but if you look up mamiac's posts here you should find a source code for hooking CreateFile and some other functions.
I am fairly sure it can be adapted to hook other API as well.
I haven't seen mamiac on this forum for a long time, but he has his own site (once again sorry, I do not remember the address), check it out or try contacting him directly.
Thanks levenum,
have found the post about CreateFile hook from mamaich.
I will try to adapt this to CreateProcess.
Houser
I have found W32_CreateProc definition in psyscall.h and the API
set is SH_WIN32. But the API set has no server process where I can
inject my dll to. How can this work? Has anybody a hint for me?
Thanks!
Houser

Need help in killing existing processes in C#

I've been searching for hours and can't find the answer. I'm hoping someone here could help me out. I just started programming in C# and I'm trying to kill a process that already exists. I'm guessing I have to somehow do it via process name, but that's where the problems start. I've found a solution using System.Diagnositics.Process and a couple using WMI, however that function seems to only be in .NET 2.0.50727, and I don't think that applies to mobiles (please let me be wrong). I can easily start/stop another exe from with the program, just not one that the program hasn't started itself. Does anyone have a preferrably easy solution to this problem. If not, I'll gladly accept a complicated one.
Thanks.
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.aspx
says
"Version Information
.NET Framework
Supported in: 3.0, 2.0, 1.1, 1.0
.NET Compact Framework
Supported in: 2.0"
Thanks Rudegar. That's some good info, however that class only works for processes created by the program. What I'm trying to do is kill a background process (or multiple instances ) that's already running. If I use this technique to create then close/kill the process, it creates a duplicate and closes that one, leaving the original process(es) running.
The functionality I'm looking for seems to be missing from the compact framework, so I'll probably need to use the WMI through a DLL in the OS (which I did to call for a soft reset), so I'll have to figure that one out.
EDIT: Looks like this class has a few other features I need to check out. I'll do that this afternoon as the golf gods are calling me right now
direct link is here
http://www.codeplex.com/MobilePE/SourceControl/DownloadSourceCode.aspx?changeSetId=11259
indirect link here, you need to download 11259
http://www.codeplex.com/MobilePE/SourceControl/ListDownloadableCommits.aspx
Sorry, can I request that you rename this thread to include the keywords "Kill Process"? Thanks!

starting a process on incoming call and stopping when the call is answered

Hi,
I am trying to write a small application for my WM6 phone device.
What I intend to do is :
- write the application in c#
- it will be a background application (daemon)
- starting to blink leds of my phone (I have a dll which I know how to call from within a C# app)
- stopping this process when the call is answered or the ringing state is passed
- no forms will be used (as it will be a background application which will only play with leds)
- when the exe is called a second time , it should disable itself
Unfortunately, I could not succeed a few months ago as seen here :
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2454023&SiteID=1
Then , I had some other issues to deal with and left the project. Now I want to start over, fresh...
However, I am not sure of what is the most acceptable solution for this.
As I do not want to load the CPU or memory with unneccessary processes, I want to be able to do it correctly.
Could someone show me the path ?
Please take a look at the thread that I gave the URL above. At that time we discussed this but I couldn't achieve it.
Thanks for any help, comments...
SystemState class seems to only work if you have a form based application. Which is silly I know. Basically the only solution is do dump the daemon idea and have a form based app but hide the form.
thanks for your reply.
what do you mean by "dump the daemon idea" ? do you mean I shouldn't use it ?
if I create a form based app and hide the form, which method should I use to start the process when phone starts ringing ?
p.s : english is not my native language so I may misunderstand some phrases.
yes he means forget the daemon..and i recommend using C++ as it uses less system resources plus its fast .. im currently developing my first Kitchen in C++ if u want i can work with you also
I agree with you; of course c++ is faster but it's not as easy as c#.
what do you mean by kitchen ?
I would like to work with you but my intention is just creating a simple application. This is not my job, you see ?
A kitchen is a place where you can cook your OWN ROM for your Windows Mobile Device..currently its for Himalaya Only ..check it out here
http://forum.xda-developers.com/showthread.php?t=378498
for me its not a JOB also its just my hobby ..im also a student in 12th grade
thanks for your kind offer. however, I wouldn't like to take your time for my very simple application
If you tell me the correct and easiest method to invoke my application and start its process, I can write the application. I'd just consult you if I'm stuck.
If you are also interested in this app. I can always send you the source code.
sure sure..send me the source....i am not doing much at the moment any way..except for re-writing the tools in C++..i have another useful suggestion..u can use MortScript to this but then it will be different
if you pm me your email address , I can send you the current source code.
But I am not sure if what I wrote is the best way of doing it.
by "best" I mean least cpu power used.
ather90,
did you receive my email ?
yeah i got the source..but there is a problem..you have built this on WM6 Pro SDK..not on WM5..i dnt have WM6 SDK..so i couldnt work yet..but will download it today..its better if you can switch it to WM5 SDK ( it will be same for WM6/6.1 i guess).
I don't know how to convert it to WM5 SDK.
If you tell me I can switch...
NO probs..the SDK is almost downloaded..i figured i might as well download the SDK caz i will need later
ok; waiting for your update...
any updates ?

Categories

Resources