It's seems DllMain won't run when a dll loaded by LoadLibrary in wm5.0.
The dll is very simple,complied by vs 2005 beta2,just a MessageBox in dllmain
I load this dll in another process,using the api loadlibrary,In windows mobile 5.0 ppc emulator,no dialog box appear,but you can see that dll.dll had been loaded with remote file viewer.In Pocket PC 2003 SE emulator,every thing is ok
anybody has any idea about it?
Thanks
dll.cpp
#include "stdafx.h"
#include <windows.h>
#include <commctrl.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL,L"11",L"22",0);
return TRUE;
}
Hi,
There is no default entry point in a DLL. You are doing everything fine except you need to load the module (function) you want to call. I cant remember off hand the details but its LoadModule.
Look thought the documentation for calling a function in a dll some more.
Paul
psneddon said:
Hi,
There is no default entry point in a DLL. You are doing everything fine except you need to load the module (function) you want to call. I cant remember off hand the details but its LoadModule.
Look thought the documentation for calling a function in a dll some more.
Paul
Click to expand...
Click to collapse
Thanks for your reply.
I don't want to call any function,excep the default entry point DllMain when loading library.
There should be default entry point in the dll I complied,because in wm2003,everything is ok(Messagebox appears when loading or unloading library)
DllMain worked in my programs in 2K5. Maybe your messagebox appears behind today window? I never tried MessageBox in DLLs, but CreateFile worked fine.
oh right. Maybe I'm wrong - i always thought DLL's didnt have default entry points - I need to get reading the SDK's more
Paul
mamaich said:
DllMain worked in my programs in 2K5. Maybe your messagebox appears behind today window? I never tried MessageBox in DLLs, but CreateFile worked fine.
Click to expand...
Click to collapse
hi mamaich,what device are you using?Emulator?
I've tried in another way:return TRUE or FALSE in DllMain,then check whether the dll is loaded with remote process viewer.
In wm5.0 emulator,DllMain's return value is ingored,the dll is always loaded.And in wm2003 emulator,dll can be loaded only if DllMain's return value is TRUE
I've compiled the DLL with eVC4 and run it on XDA2 with WM5. That DLL was a part of a rather large project.
Maybe VS2005 produces incorrect DLLs?
mamaich said:
I've compiled the DLL with eVC4 and run it on XDA2 with WM5. That DLL was a part of a rather large project.
Maybe VS2005 produces incorrect DLLs?
Click to expand...
Click to collapse
The dll should be ok,it works well on ppc2003's emulator.I have also tried the dll produced by evc4.0.
Seems it's my fault,I got it work on wm emulator now
Thanks for all
I found it,dllmain not run just because the dll export no function.after add a not used fuction,MessageBox appear when loading
Related
Hi Folks!
I'm trying to add GPS emulation to my navigation system, that is based on CellTracking via GSM.
Does anybody know how to create a virtual CommPort in eVC++ :?:
I tried it with function like ActivateDevice or RegisterDevice, but i always receive a zero Handle:
Code:
#include "winbase.h"
bool virtPortOpen(HANDLE& HandleGiveAway)
{
//HandleGiveAway = ActivateDevice(L"HKEY_LOCAL_MACHINE\\Drivers\\GPSvirt", 0);
HandleGiveAway = RegisterDevice(L"COM", 7, L"serial.dll", 0);
if ((HandleGiveAway == INVALID_HANDLE_VALUE) || (HandleGiveAway == NULL))
return false;
else
return true;
}
int virtPortClose(HANDLE& GetHandle)
{
return DeactivateDevice(GetHandle);
}
Did i use the right .dll-File? Need i create a own .dll-DeviceDriver with the DDK?
Please give me a hint!
Greetings,
Florian
http://www.eltima.com/products/virtual_drivers/
ELTIMA Solution to expensive
cairo31male said:
http://www.eltima.com/products/virtual_drivers/
Click to expand...
Click to collapse
Thanks for the URL, but i think that this solution is much to expensive for a student!
Any other suggestions?
Greetings,
Florian
http://mamaich.kasone.com/rover/IrCOMM.rar
Archive contains a sample virtual COM-port driver. It is installed as a COM8 and after opening COM8 it redirects all data to COM1. You may modify the driver as you like.
Post of "mamaich"
mamaich said:
http://mamaich.kasone.com/rover/IrCOMM.rar
Archive contains a sample virtual COM-port driver. It is installed as a COM8 and after opening COM8 it redirects all data to COM1. You may modify the driver as you like.
Click to expand...
Click to collapse
In this Archive is a C++ project, which deals with infrared communication. I don't know what it has in common with creating a virtual CommPort. - Haven't you postet the right file?
When i try to compile this project, i found out, that it calls some functions not included in the header files, or anywhere else! Look here:
Code:
Compiling resources...
Compiling...
IrCOMM.cpp
C:\Dokumente und Einstellungen\Administrator.MCFLOWNNET\Eigene Dateien\Programmierung\eVC\IrCommEmu\IrCOMM.cpp(34) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
C:\Dokumente und Einstellungen\Administrator.MCFLOWNNET\Eigene Dateien\Programmierung\eVC\IrCommEmu\IrCOMM.cpp(47) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
C:\Dokumente und Einstellungen\Administrator.MCFLOWNNET\Eigene Dateien\Programmierung\eVC\IrCommEmu\IrCOMM.cpp(77) : warning C4018: '<' : signed/unsigned mismatch
StdAfx.cpp
Linking...
IrCOMM.obj : error LNK2019: unresolved external symbol closesocket referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol recv referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol select referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol send referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol __WSAFDIsSet referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol accept referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol listen referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol bind referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol setsockopt referenced in function WinMain
IrCOMM.obj : error LNK2019: unresolved external symbol socket referenced in function WinMain
ARMRel/IrCommEmu.exe : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.
Please give me further information! - Thanks in advance!
Florian
Re: Post of "mamaich"
oops. Wrong archive. Should be http://mamaich.kasone.com/rover/RIL_hook.rar
it contains 2 projects:
Serial - a wrapper around the standart COM1 driver
seRILal - a virtual COM8 driver that creates COM8 and redirects all its IO to the first driver.
Re: Post of "mamaich"
mamaich said:
oops. Wrong archive. Should be http://mamaich.kasone.com/rover/RIL_hook.rar
it contains 2 projects:
Serial - a wrapper around the standart COM1 driver
seRILal - a virtual COM8 driver that creates COM8 and redirects all its IO to the first driver.
Click to expand...
Click to collapse
Sounds good. - Thanks!
I'll give it a try in the evening! - Too good weather here in Germany!
Florian
How to install virtual ports?
This project seems to be exactly what I was searching for! - Much thanks!
But I still have a question: :arrow: How do I install the drivers? - Should I place a new Key in the registry, and in that case, which values do I need to add?
When I try to load one of the drivers with RegisterDevice, I always receive a NULL handle.
Is it a problem that I have deinstalled the standart serial COM1? - But the serial.dll is still existing!
Greetings,
Florian
Re: How to install virtual ports?
this project is coming from Anextek SP230. It had COM1 driver named xsc1_serial.Dll.
To install you should go to registry and modify COM1 driver to be serial.dll and add manualy COM8 driver to be seRILal.dll (you may choose any other COM-port number).
In case of Imate COM1 driver is com16550.Dll, so for this method to work you should recreate import library from com16550.Dll and overwrite Serial\serial.lib file with it. Otherwise your serial.dll would import functions from a nonexistent DLL and the system will crash.
Re: How to install virtual ports?
Well,
thanks very much for your explanations!
But I still have a problem: How do i edit the link to the "xsc1_serial.dll" in the .lib-file?
Need it to be rebuild? - My Problem is that i only have emVC++ without DDK or Platform Builder! - It isn't availibe for free, i think!
Why is the .lib-file needed? - Does it export the COM_Write etc. fuctions to the project?
Thanks in an advance!
Florian
Re: How to install virtual ports?
Probably you don't need this file.
My project is hooking COM1 and makes the real hardware accessible by both COM8 and COM1. As far as I understand you are trying to add a new COM-port to the system that would emulate a GPS receiver. You should take seRILal project, remove Redirected_COM_* functions, remove serial.lib from the project and write your own implementation of My_COM_* functions (they would be exported as COM_* functions, look into serial.def file).
Reed MSDN library for information on this, but remember that it is incorrect in most function prototypes .
You should implement COM_Init (typically driver reads its settings from registry), COM_Open (allocate buffers, return HANDLE for the opened port, that is typically a pointer to allocated buffer), COM_Read (read data), COM_Write (wite data), COM_Close (free the memory allocated in COM_Open). All other functions should be present, but they may do nothing (simply return "success"). You should later implement COM_IOControl function, so that your driver would correctly implement read/write timeouts. My code does not implements this. All timeouts are hard-coded.
My Problem is that i only have emVC++ without DDK or Platform Builder! - It isn't availibe for free, i think!
Click to expand...
Click to collapse
Everything is available for free (soft, beer, girls, etc ). At least in Russia.
Trial 120-day version of Platform Builder 4.20 is available for free from Microsoft.
http://franson.biz/gpsgate/index.asp
Maybe you could look here.
Sorry I can't be any help but...
I've been thinking about CellTracking via GSM for a while now.
Most folk I've talked to in the UK tell me that it's not possible for a GSM device to discover it's own position !?
Any links or pointers on tracking ?
Ideally i'd like to append coordinates of the device on every post to the backend db.
Cheers (and good luck with the comm port thingy!)
I need to creat on my ipaq 5550 a virtual comm port
Hi,
Have you solve your problem ?
I am working on a robotic project and I have the same problem but on a ipaq 5550 under ppc2003.
I need to creat on my pocket pc a virtual comm port.
Because I receive by WIFI, GPS NMEA sentences, so I want to redirect them to this virtual port, and finaly connect to this port my regular GPS navigation software.
Thanks
Laurent
FRANCE
http://ourworld.compuserve.com/homepages/richard_grier/CFSerial.htm
I have been trying to get the new demo version of IDA to connect to my WM5 Qtek S200 with no luck.
When I click on attach it sends across wince_remote_arm.dll
then I get cannot invoke server.
If I add the reg key in HKLM\Security\Policies\Policies then it will connect and immediatly kill the ActiveSync connection and I have to unplug/replug in the USB cable. It also displays the following message.
irs_recv:An existing connection was forcibly closed by the remote host.
I can however debug .net apps and do the usual active sync transfer files etc.
Anyone have any thoughts on what to try?
Thanks
Pete
I think you have to enable RAPI, there is a cab for it on the forums or on the FTP, search for it, I think it is enable_rapi.cab.
^^ exactly... just run it on the device and it will connect
I have tried the above cab file and unfortunately still no luck.
It still dies when connecting, and the green activesync icon changes to grey and the "irs_recv:An existing connection was forcibly closed by the remote host." messagebox is displayed.
Strangely I can get it to connect to and debug the emulator.
Anyone have any other suggestions.
Thanks
Pete
I use full version of IDA (you can find it on chinese warez sites), ARM debugger extracted from demo version of IDA, cert.SPCS.cab, EnableRapi.cab, and HKLM\Init\RequireCertMods=0.
IDA connects and works.
mamaich said:
I use full version of IDA (you can find it on chinese warez sites), ARM debugger extracted from demo version of IDA, cert.SPCS.cab, EnableRapi.cab, and HKLM\Init\RequireCertMods=0.
IDA connects and works.
Click to expand...
Click to collapse
Uhhmm... which site exactly? And why doesn't it containt the debugger?
i have the same error "irs_recv...." anyone found a solution for it ?
Guybrush said:
i have the same error "irs_recv...." anyone found a solution for it ?
Click to expand...
Click to collapse
Solution is 2 posts upper.
I tried... Installed cert_SPCS.cab, EnableRapi.cab changed registry value but always same message
can you give me your security policies values under
HKLM/Security/Policies/Policies/
Thanks in advance.
I'm trying to run the IDA debugger on a Cingular 8125. It gives me the exact same error.
I have these values in the registry:
HKLM/init/BootVars/RequireCertMod = 0
HKLM/Security/Policies/Policies/00001001 = 1
HKLM/Security/Policies/Policies/00001005 = 40
HKLM/Security/Policies/Policies/00001017 = 144
I've installed EnableRapi.cab and Cert_SPCS.cab, but it still doesn't work.
Has anyone found a solution for this?
Same for me
I did all the same actions but it still doesn't work
Anyone?????
I think the problem is a result of some incompatibility of ida's debugger dll under OMAP 850 cpu...Therefore I use m$ deviceemulator which is VERY slow.
I had problems aswell with my devices... And after this last post.. i tried a WM device without a OMAP 850.. And it worked fine for me... on every OMAP850 device i tried .. i get the same error as you guys have reported..
So I must agree with george that OMAP850 is the problem
sashje, the problem is in IDA debugger's CPU detection routines. I've even reported this to IDA "support" but they paid no attention to my words.
Datarescue
you must download CE Debugger for windows ce if have it you must test another version of it you can download directly from datarescue
accepted, as far as I know even the latest versions of IDA 5 are bundled with an old ARM remote debugger dated from 2005...I bet that presently there is no such working version with OMAP CPU, but I would take my words back if only you could have pointed out the links for the downloads you meant.
if u changed your WM to unofficial WM
if u have any problem with pointers and breakpoints
if u have any connection error
you should test another version of CE Debugger On IDA PRO 5(my current version)
i have this problem with my device(Axim X30)
i changed CE debugger and work truth now
if you want some version of CE debugger i can give u
please use private messages
thanks
regards
accepted, your axim has Intel PXA270 (at 624MHz). We are speaking about Texas Instruments OMAP CPU problems lately here - so your remarks are quite incompetent. There is no version of this arm ida remote debugger dll that can work with OMAP CPU. If you have one (I'm sure you don't) please share it with all of us.
Texas Instruments
oh man i am sorry
i don't read carefully
IDA PRO do not support OMAP and only support ARm version
only support ARM(CE debugger)
sorry again
is there a namespace to get the list of progams currently running on the smartphone ????
and if there isn't what dll should i interop to do that ?!!!
thanks!!!
ToolHelp Reference
If you just want to do it once, use the remote tools that come with Embedded C++ or Visual Studio. If you want to get it within your program, see the ToolHelp Reference. (search for toolhelp at microsoft.com) You'll find such functions as:
CreateToolhelp32Snapshot
Process32First
Process32Next
Since you asked for the dll, toolhelp uses toolhelp.dll
Hi,
I've been porting a large number of linux based programs to the Gizmondo (CE 4.2 device).
One of the main issues is the broken c-runtime of CE, specifically the lack of current dir support (not to mention no posix layer ). At any rate I wanted to be able to hook fopen etc. to call my own functions which would handle current dir.
To do this I thought I'd make some nice and easy IAT hooking code, that was until I discovered how complex this was on CE (relative to Win32 that is).
After much head scratching and looking at the stellar work of those such as mamaich, itsme etc. I finally managed to get it right.
I hope this is useful to someone (I searched this board, but couldn't find any code, though I do remember someone asking how to do it) and have attached a zip file with the hooking code. In order to use this you will need to provide your own undoc.h with the relevant kernel struct and function definitions for your wince flavour.
Once again, I stand on the shoulders of giants, without whom this would not have been possible
Enjoy
-(e)
Beatiful~
You are genius~
Thank you.
Wow~
You are so beautiful~ ^_____^
Thank you.
I just wanted to start asking questions here... sweetlilmre, THANK YOU VERY MUCH!!!
excellent job~
thank you
Does anybody have undoc.h created for windows mobile 6 (wince 5.x)? If not, where should I look for the undocumented type info?
Hi~ JKingDev
I have ever created undoc.h with referencing "private" directroty.
"private" directory is installed with Platform builder. ( I used Platform Builder 5.0 )
If PB is installed, then C:\WINCE500\PUBLIC and C:\WINCE500\PRIVATE is created.
( I don't know Window Mobile 6.0 environment. )
p.s :
If you can translate KOREAN, then visit http://www.digipine.com/programming/1310.
This site has attached file "WinCE_ARM_Hook.zip". ( bottom side )
It is not my post, maybe it is posted by "jung cheulwon".
Hi all,
first of all, thank you sweetlilmre for posting this.
Your solution works perfectly fine for platforms based on Win CE 5, e.g. Win Mobile 6.1 and Win Mobile 6.5.3.
However it does unfortunately not work on Win CE 6 and Win CE 7.
I assume that this is due to changes in the memory architecture of Win CE 6 and higher.
Does anyone have a clue on how to port the "Deep IAT Hooking" solution on Win CE 6 and Win CE 7?
Some techical details on what i have tried so far...
Code:
[INDENT]
PROC WINAPI DeepHookImportedFunction(
LPCWSTR pwszModuleToHook, // Module to intercept calls to
LPCWSTR pwszFunctionToHook, // Function to intercept calls to
PROC pfnNewProc, // New function (replaces old function)
LPWSTR* ppwszExcludeList // List of module names to exclude from the hook
) {
PROC pfnOriginalProc;
PIMAGE_IMPORT_DESCRIPTOR pImportDesc;
PIMAGE_THUNK_DATA pThunk;
PPROCESS pProcess;
struct info inf;
PMODULE pmods;
LPVOID baseptr;
BOOL bHooked = FALSE;
SetKMode(TRUE);
// Get current process struct from KData
pProcess = KData.pCurPrc;
// Get process import descriptor
[B][COLOR="Red"]inf = pProcess->e32.e32_unit[IMP];[/COLOR][/B]
[/INDENT]
The program crashes (at the red marked spot) when i try to access the member
Code:
pProcess->e32
.
This is because the structure
Code:
pProcess
is filled up by the value zero only.
This happens quite early in the implementation, therefore i didn't proceed very far. I still hope that somebody can help me out with this case.
Kind regards
Hi there. What I am looking for is a functional debugger for Windows Mobile Applications. I does not have to run on Windows Mobile - I'd rather have a sort of emulator with included debugger for Win Vista. I need to be able to set Breakpoints and view the code being executed of course. I don't think it will be x86 ASM, but I suppose some Asm of whatever architecture these QUALCOMM CPUs are.
IDA Pro
I'd recommend IDA Pro v5.x
You can try the demo version which comes with ARM/Windows CE debugger.
http://www.hex-rays.com/idapro/
crc64 said:
I'd recommend IDA Pro v5.x
You can try the demo version which comes with ARM/Windows CE debugger.
http://www.hex-rays.com/idapro/
Click to expand...
Click to collapse
Downloaded it but I does not work very well. How would you properly load a program? What I tried was copying the Exe to my PC and open it - fail of course. WHen I try to run it, it asks me whether I would like to copy it to my phone. SO that's what I do. Then the program starts but it closes immediately because language files are missing. So I copy the contents of the program folder to the folder where IDA copies the file. Now when I click Run nothing happens. And it prompts me all the time for bthutil.dll - I think that's the Bluetooth driver. But no idea what do to with this, I only click cancel.
Anyone? I really need this
Are you debugging a native or a .NET app?
Check
http://msdn.microsoft.com/en-us/library/bb158521.aspx
I can't tell by this time. If it's .NET, then it's NOT .NET 3.5. I do NOT have the sourcecode readily available.
Anyone? Hey, I think about 60% of all keygenners/crackers/etc for WinMo are registered users here. You MUST know!
0 get the ide debugger for every non system dll app this thing works on the X1
1 find the registry values to set to allow the IDA debugger to work
2 read the documentation provided @ hexrays for exactly your project.
0x41414141 said:
0 get the ide debugger for every non system dll app this thing works on the X1
1 find the registry values to set to allow the IDA debugger to work
2 read the documentation provided @ hexrays for exactly your project.
Click to expand...
Click to collapse
Sorry I don't fully understand you, can you go in a little bit more detail?
Firefall! said:
Sorry I don't fully understand you, can you go in a little bit more detail?
Click to expand...
Click to collapse
0 ida doesn't let you set breakpoints on system dll's
1 Key: 'HKLM\Security\Policies\Policies001001'
change to value DWORD:1
Key: 'HKLM\Security\Policies\Policies00100b'
change to value DWORD:1
2 http://www.hex-rays.com/idapro/wince/index.htm
ljankok said:
0 ida doesn't let you set breakpoints on system dll's
1 Key: 'HKLM\Security\Policies\Policies001001'
change to value DWORD:1
Key: 'HKLM\Security\Policies\Policies00100b'
change to value DWORD:1
2 http://www.hex-rays.com/idapro/wince/index.htm
Click to expand...
Click to collapse
Thank you very much, will try this Much appreciated!