[Q] [Technical] How do you call an Exported Function in a DLL without p/invoke? - Windows Phone 7 Development and Hacking

How do you call exported functions in a DLL on a Windows Phone 7 device?
The current method using the ComBridge and registering the DLL is only for calling functions in an interface in a given dll so using this method to try and access an exported function simply causes the application to crash.
Anyone know a way to call an exported function without using p/invoke as p/invoking has been locked down on Windows Phone 7?
Many Thanks,
Gaz

Maybe not the answer you want to hear, but what we've been doing is calling native APIs in native code, and exposing a COM interface. As far as I know, we don't know of any other way.

I know the method you are using but it doesnt work for exported functions in a dll. The method you mentioned only works on interfaces in a dll.

lyriquidperfection said:
I know the method you are using but it doesnt work for exported functions in a dll. The method you mentioned only works on interfaces in a dll.
Click to expand...
Click to collapse
The point is that you interface with your own native COM DLL, which interfaces with native code that doesn't export a COM interface.

So to call an exported function in a dll in a ROM, I would have to write a DLL in native code to refrence the exported functions in the DLL i was looking to use then write an app to call the DLL I had written to access the exported functions that way? I have no clue in writing native code unfortunately.
Do you have a code snippit or example of how to do this? It would be much appreciated!

lyriquidperfection said:
So to call an exported function in a dll in a ROM, I would have to write a DLL in native code to refrence the exported functions in the DLL i was looking to use then write an app to call the DLL I had written to access the exported functions that way? I have no clue in writing native code unfortunately.
Do you have a code snippit or example of how to do this? It would be much appreciated!
Click to expand...
Click to collapse
http://forum.xda-developers.com/showpost.php?p=10558804&postcount=34
There are some examples in my Homebrew library that is used for the Webserver project. NativeIO is a vs2008 project compiled for Windows Mobile 6. It shows interop between platform (Windows CE) functions, and Silverlight. There is more information around on the forum. If this isn't enough to get started, you have much reading to do regarding COM.

Cool, thanks for this, ill take a look tomorrow after work.
Sent from my OMNIA7 using Board Express

Related

Porting application to work with windows mobile

I really want to port a small tool to be able to run my magic jack on my HD2. There is a really small and simple tool called MJMD5 that allows you to use your magicjack with any SIP client.
I have the source code for linux, possibly it can be compiled using cygwin for the HD2?
ftp://ftp.bauer-power.net/misc/magicjack/mjproxy.c.tgz
Also, there is a tool that works with windows, but there is a incompatibility with the GUI that isnt allowing it to run on my HD2, a small tweak should fix it.
ftp://ftp.bauer-power.net/misc/magicjack/MJMD5.zip
I am completely new to mobile software development so I hope someone could help me get this working!
Thanks
Is nobody willing to even put me in the right direction?
The source code is for a linux console app; you can't port that easily to WM GUI. You'd need the source code of the Windows exe. To my knowledge, there is no Cygwin version for WinCE yet, or were you referring to cegcc?! It could probably be ported as a console app anyway, but I assume that you want the GUI.
And using a console on the HD2 is somewhat problematic, as the OS has console debug output. I would not recommend that for user programs.
Yeah, I am referring to cegcc. I am not too concerned about the GUI, I just need the functionality, and this program doesnt really need a console, but just needs to be run with certain parameters which is possible with WinCE. So, does anyone know how to compile it for windows mobile?
I appreciate any help.
kkroo said:
Yeah, I am referring to cegcc..
Click to expand...
Click to collapse
OK; I'm reasonably sure that it can be ported with either cegcc or celib. I'd probably do it with celib. I have adapted celib to work with PocketConsole. I just tested my port of perl 5.8.8 on the HD2, and socket/internet functionality seems OK.
kkroo said:
I am not too concerned about the GUI, I just need the functionality, and this program doesnt really need a console, but just needs to be run with certain parameters which is possible with WinCE. So, does anyone know how to compile it for windows mobile?.
Click to expand...
Click to collapse
About the Windows exe, it appears to be a .NET assembly. But it may not run on Windows Mobile because it is for the desktop Framework, and not the Compact Framework. .NET assemblies can be decompiled, however. Maybe that can help you too.
I don't have this MagicJack, but from what I read about it on the internet, I doubt that it can be used with Windows CE at all if you want to plug it into the HD2 directly, and the USB connector may be different as well. I don't know if that's what you want. Depending on how it communicates with its host, you may even need a driver for it. I think that the HD2 has USB OTG, but it may still not work without a driver. I would find that out first.
In terms of recompiling it, I am pretty sure it will work. Sorry but I am a bit of a novice at this, but how would I do either compiling option?
Thanks
I would use Dis# for decompiling; I just tried to decompile the exe, and that seemed to succeed. No guarantees though; not at all tested. You can have Dis# put the source files and project files in a subdirectory. Then I'd use VS2008 for compiling.
A quick test showed that the IniFile class of this program imports unmanaged functions from kernel32, which is not present on WM. The functions are GetPrivateProfileString and WritePrivateProfileString. I don't think that coredll has them, so porting would probably not be easy. This is a known porting issue; not very severe, but it's only the start. I think that ini files are regarded as legacy by Microsoft. The registry is used for settings.
The most logical thing would seem to me to contact the developer to write a CE version if the device works with generic CE USB drivers. And then you'd still have the connector problem, and possibly even an incompatible interface; I don't know how HTC implemented the USB port. This is assuming that you want to plug it into the HD2 directly. You are not clear about that, so I can't be more specific either.
http://netdecompiler.com/download.html

[Question] SIP Tutorial?

I've programmed in C++ before, and used all the Win32 apis etc., but I've never written a COM object in C++.
I had a look at the SIP sample in the WM6.5 SDK, and following some MSDN guides, I tried to use the wizards in VS2008 to create an ATL COM object. I think I got somewhere, because my SIP appeared in the list, however, none of my SIP functions ever got called, so I must have messed something up somewhere.
Does anybody know a decent tutorial or a blank SIP template I can look at?
Thanks

Registry Edit Apps for Dell Venue Pro

Have there been any tools written to work with the Dell Venue Pro for editing Registry?
All the registry hacks and programs written so far seems to be HTC specific, or at least only HTC compatible.
I can unlock my Dell Venue Pro with Chevron, deploy XAPs but I cannot modify the registry. Argh! No program I have tried can modify it.
Basically, I want to be able to spoof my Dell Venue Pro to an HD7 (just like what we've done with the HD2). - Maybe then my web2go plan can work the DVP after?
If not, IMEI spoofing is another consideration (but we all know why I can't ) - unless....
rebump. anyone?
Bump. I'm also interested in this. I would prefer a general WP7 registry hack though. It would help to keep development free flowing across devices.
dell - no com dlls...
ergo no provxml
no registry...it sucks
domineus said:
dell - no com dlls...
ergo no provxml
no registry...it sucks
Click to expand...
Click to collapse
sorry, i didnt understand that. can you reiterate? in layman's terms?
A com dll is a library for storing files that are shared between programs. Which brings me to my question. How can there be no com dll? We have read access to the registry but the write access is blocked right now. They are sharing essentially the exact same code with minor customizations for drivers and such. This does not remove the dll files from the device though. Or am I completely misunderstanding the idea of a dll file?
The LG, Samsung, and HTC phones have OEM-specific apps. To make those apps do useful work, the manufacturer has some COM DLLs exposing functionality not otherwise available to applications. Those COM DLLs are being exploited to create the hacks you see for other phones.
There are no Dell-specific apps and therefore no COM DLLs to exploit.
they do have some tmobile apps that come preloaded. can those work?
gosh! there must be some common exploit. this is stupid!
This is as close as an explot we can get the:
http://forum.xda-developers.com/showthread.php?t=929211
that is Dell's hidden diagnostic menu.
please someone find a way to hack this device!
Thanks for the clarification. I was not aware that the work around for ALL devices was coming from the pre installed manufacturer apps. Would the supposed password for the composite mode on the venue pro diagnostic mode be of any help? This is supposed to allow access to tethering according to pocketnow.com. The composite mode password is supposedly *#301# from what I have read.
Extremely unlikely.
The functionality exposed by the COM DLLs on Samsung HTC LG are things like being able to write to the registry and filesystem with elevated privs (to support provisioning apps and the like).
There is a com dll in the "connection setting" app from the store. Search for that title or "Dell" in the marketplace. Someone also posted the EM mode app. You could use that com dll as well

[Q] WP7- Using remote procedure call as a way around to pinvoke

The idea is to gain access to native lib functions from windows phone. so instead of pinvoking functions, can we make a rpc to the native function. the dll could be hosted elsewhere e.g. on a azure platform ?
anyone tried this/ know if this is a doable?

Calling ProcessKeyPress(e.KeyCode) for Windows Mobile 6 in C#?

How do I call this function ProcessKeyPress(e.KeyCode) in C# for WIndows Mobile 6?
I have the original VB.net code that I am trying to translate to C#, however, I can't find this function.
That function is not part of the .NET framework.
It is either part of the code you already have in VB, or part of the assemblies that are part of the application.
You can use something like Red Gate's .NET Reflector to open .NET executables/DLLs and view the internal code as IL, VB or C#, providing the object has not been deliberately obfuscated when it was compiled.
This is also a neat method of converting VB to C#

Categories

Resources