Hook CreateProcess() function call - Windows Mobile Development and Hacking General

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

Related

Waiting for a process

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.

URGENT URGENT: Bluetooth OBEX

Hi all,
I am really mad from this OBEX bluetooth thing, I have spent a month trying to add BT OBEX support in my program but ith no luck, I scanned the internet line by line and found almost nothing.
I found things on codeproject and experts-exchange, but not of much use and some did not work correctly.
I saw some programs that deal with obex developed in this forum like GSMBeam and maybe others.
Any one knows how to program BT OBEX for file exchange?? I need to only send a file!! any libraries for evc++? I am really tired now and this is my last place to save my project.
I hope I will find help here
Don't know if this works for you... give it a go..
To change the ability to receive files via Bluetooth (OBEX)
* The setting is at 'HKEY_LOCAL_MACHINE\Software\Microsoft\Obex'
* The 'IsEnabled' DWORD value should be set to '1' to enable OBEX and '0' to disable OBEX.
Hi,
The problem is not with my device, the registry settings are correct, but I need help for developing my BT Obex application, specifically, I need my application to be able to send files to other devices via bluetooth (just like resco explorer).
ANY HELP GUYS? ANY C++ LIBRARIES? ANYONE DID THAT BEFORE?
please shade some light if you can.
Thanks in advance
Aaaa... IC
U could try here... http://www.gatefold.co.uk/obex/
It's a test-ware for sending contacts and files by bluetooth and there's a source and compiles software that u could d/load 2 test...
Hope this helps
Hi,
Thanks for your help, but as I wrote in the first post, I need it for c++, I already have this library but unfortunately it is for .NET applications, not c++.
I need some help on c++
Thanks again.
Come on guys... provide something
Would this help you out?
And maybe this
Thanks _Nomad_ for your help.
But again, both links are dedicated to the .NET CF, but I am using eVC++, so they are not useful for me.
I need some thing to use in eVC++, not .NET.
Thanks anyway.
And Guys, if any body knows anything useful please let me know.
mohgdeisat said:
I need some thing to use in eVC++, not .NET.
Click to expand...
Click to collapse
Use the force luke...
search for "obexsquirt"
the result will lead you to a full functioning c++ source code for obex transfer over both bt and irda.
cheers
Yes, thanks.
Actually I have the book that introduced this sample but some code is missing in the book.
I found another code derived from obexsquirt sample, it works fine but the problem is that it fails to disconnect from the target device and the connection remains open, I tried to debug it but found nothing to correct, the code seems to be written correctly but I don't know why the problem arises.
Please try to see the code guys and tell me whatever you get:
Article:
http://www.developer.com/ws/palm/article.php/10946_3573636_3
Code sample:
http://www.developer.com/img/2005/12/Obex.zip
Thanks guys

Find dll functions from rom dll

Not sure if I have worded this properly as I'm at the edge of my knowledge but I wish to call a function that I am assuming is in a DLL which is contained in ROM. I know the name of the DLL but how can I get a list of functions available from it when I cannot copy it onto my PC?
Many Thanks
Hi Tailor.
First, what function exactly are you looking for? There may be some documentation on it somewhere.
To browse a ROM dll you need to get a ROM dump. The simplest way for your purpose, provided you have a WM5 device is to search for TESTWM5.exe by mamiac on this forum. It will dump all files to your SD. They won't be workable for coding purposes, but still good enough to use dependency walker to get exported functions from DLLs.
Unfortunately that still won't tell you the parameters the function expects. only its name.
Hi Levenum and thanks for your reply.
Its a Sony Sat Nav Windows CE 4.2 device so unforunately theres not much chance of a ROM dump or documentation. Then unit is sold as a finished product and not intended for further developement.
I have installed TomTom instead of the poor app already installed and was trying to get access to the hardware buttons and Light sensor on the unit and then intended to use the TomTom SDK to recreate their functions.
The keys don't not trigger a key press event but their are DLL's called something like powerbutton.dll and navbutton.dll and so it's a fair guess that they could be used to trigger these events.
Obviously without knowing their exported functions I'm not going to get much further.
Any further thoughts ?
Many Thanks
How exactly are you trying to catch the key events?
For what you describe, you don't just need to know function names, you need to know with what parameters to call them so this is definitely not the way to go.
If you are coding with C++ search for info on SetWindowsHook. I am not sure of its implementation on CE, but this might be what you need.
I'm using VB.Net 2005
I'll have a look at SetWindowsHook, Thanks.
Any ideas for the light sensor, there's a test app that Sony have left on the device, it gives a reading from 0 to 100?
How are they likely to be reading this value?

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 ?

How To develop a Tool for PPC

Hello,
in our company are a lot of Windows Mobile Devices in use. These should like our Client PC's listed in OCS Inventory.So, i'll try to develop a OCS Agent Client.
Functions needed:
-read out hardware Specs
-read out installed Software
-read out User Name
-send this Information over Port 80 to a Server
-nice to have: run as Service and auto send this information to the Server
Tools I've got:
-Visual Studio 2008
Skills I've got:
-writing c++ console apps
What I need:
-a Tip which programming-language I shoul use
-Some links where i can find the the functions in this language which I need
What I've done:
-search in xda-developers.com
-search in MSDN(but I don't know which language i should use)
-wrote small (stupid) apps like an calculator for ppc in visual basic as little test
-I tried to do the same in visual c++ -> without any good product, i don't know how to make a gui for the functions.
I hope you can help me, espacially in the language thing.
Thanks,
Flo
some good reads about many of your questions
http://forum.xda-developers.com/showthread.php?t=245426&highlight=develop
http://forum.xda-developers.com/showthread.php?t=225177&highlight=develop
http://forum.xda-developers.com/showthread.php?t=349808&highlight=coding
http://forum.xda-developers.com/showthread.php?t=269142&highlight=coding
http://forum.xda-developers.com/showthread.php?t=226603&highlight=coding
Thanks a lot!
I think I'll try to use Visual Basic.
One Question further: where I can find the Commands I need to read out the Information out of the Device.
Hi,
VB was good for the first steps, but after reading in msdn i decided to use Visual c#(a can use c++ although but i think c# is better for this!?) instead.
So, registry Values i can read out. But all the other stuff....I don't know how to get this out. "You should use the API functions" i read every where, but that helps no step. I don't know which API and i don't know how to speak with it.
I hope you can give me some Tips or links.
Thanks
thanks for your help so far *:-/
IMEI,Owner,Hardware(bluetooth,Phone,Wifi,Camera) is detected....
My Problem now is: CPU Speed
I didn't found a registry entry with the Speed in it, so i need another function. Some ideas?
Im using C#...
One more Question:
Where the "Settings->System->Deviceinformation->Hardware"-Window gets its Information from?
Hope someone will answer.
Thanks.

Categories

Resources