MIDP Datagram connector string - Windows Mobile Development and Hacking General

I've been developing an MIDlet for some time now. I have the application working on both Blackberry and Symbian. My problem is creating a DatagramConnection object on Windows Mobile. I have been trying to guess the connection string to use as I have failed to find any documentation for java managers which i have at my disposal.
Currently I am testing with the Esmertec (Jeodek build 20060421-95649) manager on windows mobile 6. The connection strings I have tried so far are the following... (I have included the code which I use to test the connection string below)
datagram://test.com:22
udp://test.com:22
udpdatagram://test.com:22
What I would apprecicate is if someone could either advise me toward which protocol strings are available in the Esmertec manager or if you could point me toward some documentation I would be very thankfull.
Thank you in advance for all responses.
Code:
private void test(String string) {
log("trying ... " + string);
try {
Connector.open(string);
log("sucess!!");
} catch (Throwable e) {
log("Failed: " + e.getMessage());
}
}

Related

Create virtual CommPort for GPS emulation

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

DllMain not run in windows mobile 5.0

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

console helloworld

hi there!
questions dont come simpler than this! (probably why i couldnt find anything on the web ). i've finally decided to try my hand at c# and the .net framework, but cant seem to manage a console - "hello world":
Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleHelloWorld
{
class Program
{
static void Main(string[] args)
{
Console.Write("Hello world - at last!\n");
Console.ReadLine();
}
}
}
when i run the compiled program on my htc hermes (with cf .net 2), nothing happens. i'm guessing that it's probably because:
1) i've forgotten to do something like
Code:
Console.show
or
2) windows mobile 5 doesnt have console?
thanks,
tian
2.
You need to find a console driver and install. Check out Mamaich's webpage and posts. Or just use Msgbox.
V
thanks.
i might try a work around for now

Deep IAT Hooking

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

MySQL not working well on WM6

Hi guys!
I'm trying to connect to a mySQL Databese from my Phone (to store highscores for a game).
I downloaded the MySQL .dll, which works fine in a "normal" C# windows app.
But when running the same conde on my mobile device I get an error.
Here's the code:
Code:
string myConnectionString = "SERVER=www.myserver.de;" + "DATABASE=testDatabase;" + "UID=myName;" + "PASSWORD=myPW;";
MySqlConnection connection = new MySqlConnection(myConnectionString);
connection.Open();
The dll I use is called "mysql.data.cf.dll".
The error I get is an "IndexOutOfRange Exception in the last line ("connection.Open();"). The whole thing compiles fine though...
Has anyone done this before? Where could the problem be?
Thanks!

Categories

Resources