[Q] How to develop an C# Wp7 app that accesses the registry and change the same - Windows Phone 7 Q&A, Help & Troubleshooting

I want to make a new App to change settings for my phone.
How do I create a C # App in WP7 that makes changes to the registry and files WIndows Phone?

You need a lot of stuff:
- installed Visual Studio + latest WP7 SDK;
- interop-unlocked phone;
- knowledge in C# and WP7 programming.
If you meet the above requirements, read (attentively) this: http://forum.xda-developers.com/showthread.php?t=1569832

And if you are building Windows Phone 7 apps, you qualify as a startup and can get Visual Studio for free from Microsoft:
https://www.microsoft.com/bizspark/Startup/Signup.aspx
This gets you a free MSDN Ultimate subscription for three years.

Still looking for this help
sensboston said:
You need a lot of stuff:
- installed Visual Studio + latest WP7 SDK;
- interop-unlocked phone;
- knowledge in C# and WP7 programming.
If you meet the above requirements, read (attentively) this: http://forum.xda-developers.com/showthread.php?t=1569832
Click to expand...
Click to collapse
I am an average programmer, I have these tools and capabilities.
My intention is to discover how to access and edit the registry through my applications.
wp7roottools is a good choice, but would like to know how to do it from scratch to the end user does not need to have the application installed.
kenikh said:
And if you are building Windows Phone 7 apps, you qualify as a startup and can get Visual Studio for free from Microsoft:
https://www.microsoft.com/bizspark/Startup/Signup.aspx
This gets you a free MSDN Ultimate subscription for three years.
Click to expand...
Click to collapse
Microsoft does not help much in this case

Well, you'll need to know how to write native code (use Visual Studio 2008 and the WinMo 6.x SDKs or the CE 6 or CE 7 platform builders). Write a native DLL with a COM class that exposes the functionality you want. You can then create an instance of the COM class from C# and use that via the ComBridge API. You can read more on doing this in a guide posted by Heathcliff74 on the dev&hacking sub-forum; search "guide developers native mango" and you should find it.
However, that will only give you the APIs to access the registry, it won't actually give you the permissions. You'll have read access to only part of the registry, and no write access at all. If you want higher permissions, you have four options:
1) Write an app for full-unlocked ROMs only. Full-unlock ROMs run all apps with max permissions.
2) Write an app that uses one of the existing "root" hacks that elevate an app to TCB (for example, require that people use WP7 Root Tools with your app).
3) Write an app that uses ID_CAP_INTEROPSERVICES and the OEM drivers present on most phones to do high-privilege operations. This is how registry editors and such worked before Root Tools, but requires substantial work to support various different OEM devices and firmware versions, and some device+firmware combinations aren't supported at all right now.
4) Find your own new elevation-of-privilege vulnerability, hack up an exploit for it, and use that. For example, when I created the HtcRoot project, WP7 Root Tools wasn't yet available for my phone.

GoodDayToDie said:
Well, you'll need to know how to write native code (use Visual Studio 2008 and the WinMo 6.x SDKs or the CE 6 or CE 7 platform builders). Write a native DLL with a COM class that exposes the functionality you want. You can then create an instance of the COM class from C# and use that via the ComBridge API. You can read more on doing this in a guide posted by Heathcliff74 on the dev&hacking sub-forum; search "guide developers native mango" and you should find it.
However, that will only give you the APIs to access the registry, it won't actually give you the permissions. You'll have read access to only part of the registry, and no write access at all. If you want higher permissions, you have four options:
1) Write an app for full-unlocked ROMs only. Full-unlock ROMs run all apps with max permissions.
2) Write an app that uses one of the existing "root" hacks that elevate an app to TCB (for example, require that people use WP7 Root Tools with your app).
3) Write an app that uses ID_CAP_INTEROPSERVICES and the OEM drivers present on most phones to do high-privilege operations. This is how registry editors and such worked before Root Tools, but requires substantial work to support various different OEM devices and firmware versions, and some device+firmware combinations aren't supported at all right now.
4) Find your own new elevation-of-privilege vulnerability, hack up an exploit for it, and use that. For example, when I created the HtcRoot project, WP7 Root Tools wasn't yet available for my phone.
Click to expand...
Click to collapse
Thanks to previous answers, this really seems to get bad to be useful.
So need to develop a DLL with COM classes (for Windows Mobile 6.5) that has the functions I want and then invokes it. I carefully read the topics mentioned.
Answers to your bookmarks:
Option 1) My first application is intended for the HTC HD2 fullUnlock, I believe not having problems with permissions.
Option 2) Use third party tools like WP7RootTools is not very advantageous for the moment
Option 3) seems to be the best option, but as the knowledge needed to collect it?
Option 4) I think I still do not have sufficient skills for this option.
Very grateful for your help this is really helpful and appreciated.

Related

Creating a WM Application - Where to start ?

I hope this is the right place to put this, if not, mods, feel free to remove and/or delete it. I've dabbled a bit with C before, but that's about the extent of my programming experience. I'd like to create a program that will parse the information from a website and display it... I don't imagine something like that would be hard to do, but I have no idea what tools I would even need to start writing a PPC application.
Kitco (a website that gives live quotes of precious metals) recently came out with an application for the iphone that neatly formats all this information:
http://www.kitco.com/images/banners/KitcoiPhone/iphone.html
I'd like to basically create a PPC version of this application.
Is this something that an individual with next to no experience could hope to achieve ? I'd have to create a GUI, initialize the internet, connect and retrieve a webpage and remove the relevent information before displaying it.
Any help would be greatly appreciated. I've always wanted to become more familiar with these sorts of things and figured this project would be a great way of learning it.
Thanks!
ThreadMoved
Next to no experience? I dont think so. You have to have a little under your belt first and the only way to achieve that is to start readin right here!
I'm also interested in the expert answers to this question.
My very non-expert understanding is as follows:
VS 2005 (microsoft visual studio) can create executables for WM devices using a SDK (low level) or .Net CF (medium level) interface. You want to use .Net CF (compact framework) because it is supposed to make things easier. I think you have to use C++ to use the SDK but you can use C++, C#, or Visual Basic and write to .NET CF.
VS 2005 is an IDE (integrated development environment). It contains features to edit, compile, and even test your program using simulator/debugger. I think there are some non-microsoft IDE's that can also generate Windows Mobile code -- there is a market for cross-platform environments (e.g. programmers write code using a special library instead of the windows SDK or .NET function and the same source code can be compiled to run on Blackberry, iPhone, S60, Windows Mobile, etc...)
Instead of writing to the phone hardware (or .NET abstraction) directly, you can write your application using Java. You would use some Java compatible IDE (like Eclipse, Jbuilder, or NetBeans) to create Java applets that you download to your phone. You'd have to install a Java VM (virtual machine) on your phone to run these applets. I think the downloadable games for phones are Java applets.
Disclaimer: I haven't worn my "programming cap" since 2001 and hopefully things have gotten simpler. In my previous life I designed operating systems for mainframe computers.

running application in C on mobile phone with Android

Hello !
SUMMARY: How to run pocketsphinx_continuous on mobile phone with Android, and how to do it with simulator of mobile phone with Android. PocketSphinx can be downloaded for free here, for both Linux and Windows: http://cmusphinx.sourceforge.net/html/download.php .
Click to expand...
Click to collapse
------------------------------------------------------------------------------------------------------------
SHORT EXPLANATION
I'd like to create application for mobile phone and server such that:
1. User runs application on mobile phone with Android, this application uses PocketSphinx. It is Automatic Speech Recognition software for devices like mobile phones, written in C. Somebody told me that "Pocketsphinx is used successfully on Symbian with minimal effort". (However I think Android may be better choice). My knowledge about Android is limited but I know something about CMU Sphinx. Can you help me, please, to run this PocketSphinx on Android? I also need to find simulator of mobile phone with Android. I have already found Wireless Toolkit and I tried to use this emulator, however I think it doesn't allow to run simulation of mobile phones with Android. (By the way I am limited in my project to mobile phone of the price up to about 160 euro; which Android version would be best for my application?).
2. This application communicates with the user. The users speaks digits and some other words (dictionary is about fifteen words, I can create language and acoustic models, as well as formal grammar in CMU Sphinx, with the use of SphinxTrain). The application recognizes those digits.
3. Based on this talk, mobile phone sends information about results of recognition to the server. I can do it in Java for CLDC/MIDP with httpconnection, POST method on the mobile phone side and with Tomcat on server. I think this httpconnection must be possible not only in Java ME, but also in Android C. But this is thing which will bother me later, now I'd like to run pocketsphinx_continuous on Android and try to modify it according to my needs.
Summing up, what I'd like to know is how to run demo pocketsphinx_continuous on mobile phone with Android, and how to do it with simulator of mobile phone with Android. (I've got Wireless Toolkit but I think it is not capable of running Android). PocketSphinx can be downloaded for free here, for both Linux and Windows: http://cmusphinx.sourceforge.net/html/download.php . There are two ways of installing it in Ubuntu. First is to unpack it (it is tar.gz), enter its directory and type "./configure", "make", "sudo make install". The other, different, is written in README file, i.e. run autogen.sh, "./configure", "make clean all", "make test", "make install". The result should be, among many other files, javadoc in doc directory.
------------------------------------------------------------------------------------------------------------
LONG EXPLANATION
What is required to give me some advices is written above. So if you don't want / don't have time to read the whole text, just above explanation is enough. But let me say about other possible approaches which I try to do. Those are worse than what I explained above, but I also tried them.
CMU Sphinx contains SphinxTrain to create acoustic model. It has got some different recognizers (also called decoders), those are PocketSphinx, Sphinx4 and some other. PocketSphinx is written in C and is for devices like mobile phones. Sphinx4 is Java application for PCs because it requires better hardware. There is good tutorial about using SphinxTrain with Sphinx4. It is here: http://www.speech.cs.cmu.edu/sphinx/tutorial.html . There is no similar tutorial for PocketSphinx. However with some knowledge about Android and C it is possible to run it on Android. The other approach than PocketSphinx, is using this Sphinx4. However it requires connection between mobile phone and server, sending audio data from cellular phone to server. It can be done with Skype, but there is still problem on server side with redirecting sound from Skype to Sphinx4. So you see there are two different approaches. One is to run speech recognition on mobile phone with PocketSphinx and Android. The other is speech recognition on server with Sphinx4. There are some ways to follow this second option. One is Skype on both server and mobile phone. (But there is problem with redirecting speech from Skype to Sphinx4). The other is too expensive Digium card. The third one is IVR, but I still look for good open-source IVR software. All of those three ways of second option involve Sphinx4. It was much easier to create application with Sphinx4. It is for PCs, not embedded devices, because it requires better device, extensive floating point math and some other things. But it has much better documentation than PocketSphinx. But I want to use PocketSphinx because I don't need to pay to anybody for access to mobile internet in order to send data through internet for application like Skype. The access to internet is required only for short time to send little text data with httpconnection, POST method. This is why I'd like you to help me, please, with running pocketsphinx_continuous on simulator of PocketSphinx on mobile phone with Android. (By the way, I see I've got installed S60 Developer Tools -> 3rd Edition FP1 SDK -> MIDP -> Emulator).
Summing up in a list, those are in CMU Sphinx:
I. SphinxTrain, which I can use to create files needed for speech recognition
II. decoders which use speech input and some files which I create with SphinxTrain, to follow speech recognition (input speech + files from SphinxTrain = are used by decoder)
II-1. PocketSphinx, written in C, for devices like mobile phones
II-2. Sphinx3, written in C, for PCs, actually the best developed
II-3. Sphinx4, written in Java, for PCs, with the best documentation
II-4. Some other, older versions
Those are possible approaches of solving my task:
I. Speech recognition on mobile phone with PocketSphinx. This is much better way than [II].
Problems: 1. running PocketSphinx on mobile phone with Android. 2. simulating mobile phone with Android on PC. I also thought that maybe I should consider Meamo, what do you think about it? Or use things different than CMU Sphinx, e.g. Simon, HTK, Julius. I looked at those other ASR engines and I think PocketSphinx may be best choice.
II. Speech recognition on server with Sphinx4. There are some different ways of establishing voice connection between mobile phone and server.
II-1. ordinary call from mobile phone to server; server has got Digium card. Disadvantage: Digium card is expensive.
II-2. to use Skype on both mobile phone and server. Problem: redirecting of sound from Skype to Sphinx4 and vice versa.
II-3. can you think about any other ways? I found that Asterisk may be useful.
Greetings !
Summing up, what I'd like to know is how to run demo pocketsphinx_continuous on mobile phone with Android
Click to expand...
Click to collapse
First step would be to setup a toolchain and compile the prog for android
or statically linked with uClibc.
Then push it onto your device and test if it works as expected.
You can also push it onto the android emulator that comes with the sdk.
Just my 2 cents...
Thank you very much!
Can you give me any links to tutorials which can be useful for me?
By the way I know how to create my own application in Sphinx4 and I know how to run demo in PocketSphinx, but I've got some difficulties with creating my own application for PocketSphinx. So if you can have a look at PocketSphinx http://cmusphinx.sourceforge.net/html/download.php and tell me which files I need to have to create new project for PocketSphinx, I would be greatful. I mean that for Sphinx4 the only what I need to do is to enter S:\tutorial\sphinx4-1.0beta3-src\src\apps\edu\cmu\sphinx\demo\helloworld and create my own ...\demo\my_application, and inside it analogically to what is here ...\demo\helloworld. In the case of PocketSphinx, to run the application, I need to enter S:\tutorial\pocketsphinx\doc and run pocketsphinx_continuous. So I check what I've got in this file and I cannot see what files and where I need to have in order to create new project. I uploaded directory doc with pocketsphinx_continuous here: http://www.speedyshare.com/files/19429494/doc.7z
Greetings and thanks once more !
Rough outline: You'll need the Android SDK and NDK, both of which are available from http://developer.android.com/. The NDK will allow you to compile C code. You'll need to wrap the C core in a Java layer to make it accessible to the rest of the Android system. The SDK also includes an emulator, which I believe you've asked for if I understand you right.
I haven't actually attempted this, so that's about all the help I can be, but there is sample code included with the NDK that should get you started.
Thanks for your answer !
I check the google and see that NDK is term of Android, because I knew only SDK abbreviation. I assume NDK is especially for porting (like porting PocketSphinx for Android). So am I right that with this NDK I don't need to change code of PocketSphinx? I think it would be too easy .
There also other question which I've got. It is not strictly connected with Symbian but there wouldn't be any need for porting if I won't solve this problem. I've got my application in Sphinx4. There are also examplary appications for Sphinx4 and PocketSphinx. I can run demos from PocketSphinx (as explained in first post), as well as demos from Sphinx4. I can change source code of demos from Sphinx4 to perform my task. I'd like to do similar thing with PocketSphinx, but even if it should be easy task, I cannot do it. In Sphinx4 it is much simpler because all source files are in one directory. In PocketSphinx it is done in somehow different way. (http://cmusphinx.sourceforge.net/html/download.php). Without ability to move my application from Sphinx4 there is no need for me to port this PocketSphinx to Symbian.
Greetings !
johnyjj2 said:
I assume NDK is especially for porting (like porting PocketSphinx for Android). So am I right that with this NDK I don't need to change code of PocketSphinx? I think it would be too easy .
Click to expand...
Click to collapse
NDK is used to write software for Android devices that are compiled natively to the platform -- for now, this usually means ARM. Java as you probably realize is a bytecode intermediate language that the java virtual machine converts to native calls at runtime. This means that Java is generally platform independent whereas your C code is not.
JNI as used with the NDK is the Java Native Interface (or something to that effect). It allows you to call code that has been compiled for a specific processor from Java. This means that you could put heavily optimized super fast calculations in a native library and call them from your Java app.
It could also mean, that you've more or less written your entire application in some native code, and then you have written a java shim that has enough code to initiate and start your native software. Beware, there be dragons here.
The fact that you CAN do this, doesn't mean you SHOULD. There are a lot of benefits to using the android platform and specifically using the android way of writing applications. Concepts like views, activities, intents, etc., greatly simplify how an Android device interacts with other Android devices and provides a consistent and powerful framework.
For something like SCUMMVM, it is a game (platform) that is very linear in design; you are either actively playing it, or it is on pause. How other applications are running while using SCUMMVM is inconsequential. It sounds like you have very different requirements.
Thanks for answer!
Isn't that link (http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx?view=rev&revision=9470) simply trying to copy engine library to Symbian, without effect? Only enginge won't help, there is also need to write from zero code which will use this library. So it looks like there is still long way to have it working. Do I understand it properly?
Greetings!

[Q] Wanting to start creating homebrew applications.

Ok, so I have no experience of working with any type of coding of development except for Adobe Flash. I don't think that really counts though, nor help me here, but I want to start off by saying that I'm simply a 17 year old.
I want to start development of an app to edit the registry. For example, I got the idea for everytime you click a button on the app, it edits something on the registry. Of course, phones will have to be Interop-Unlocked (Which my Samsung Focus is).
So to get on topic, how may I start creating an app for Windows Phone to edit registry and etc.? As I said before, I really don't have much experience, but I would love to learn and help the community.
Thanks in advance.
Bump up....
Ok, basic first steps: do you have the WP7 SDK? You can get it for free, and you'll need it. It includes the tools to build and deploy apps (compilers and so forth).
The project you're talking about is a bit heavy for a first foray into app development, but you can give it a shot. One of the easier ways (for me, at least) to learn things is to look at what other people did, which in coding usually means looking at open source projects. There are a few open-source apps which access the registry.
For example, my MultiTaskToggle app (linked in my sig) works on Samsung and provides an example of how to read and write a specific registry value.
If you want to browse the registry at all, you'll need something different. This can be done, using COM to call native APIs. Look at the Homebrew library (used by the Webserver projects, among others) or WP7 Advanced Explorer (open source, code is on Codeplex). These types of project have two parts: managed (.NET code, typically in C#) that calls the COM interface, and native (C/C++, written using the Windows Mobile SDK) that implements the COM object.
You may want to do some research online to get started, either here on XDA-Devs (though I think most tutorials here assume at least basic knowledge) or elsewhere (even from MS directly) if you're really starting from scratch.

[Q] C# for reading/writing Registry

Hi all,
I'm sure this is in the forums somewhere, but due to the billion mentions of "registry" I haven't been able to locate it.
Is there a tutorial anywhere for programming the reading and writing of registry keys? I'd like to develop a UI to provide XDA members to adjust the Bluetooth services that are associated with each paired device to enable dual pairing on unlocked phones (I.E. a UI for this: http://forum.xda-developers.com/showthread.php?t=1517029)
Thanks,
Ben
It can't be done directly with C#, because there's no managed (.NET) API for registry access on the phone. Instead, you either need to call into a native DLL that you wrote and exposed through COM, or you need to call into an OEM DLL that calls an OEM driver for you. The first approach requires writing, or at least having access to, a native library written in C++. It will also run only with the permissions of the app, which is insufficient for writing to the registry on stock ROMs (unless elevated with something like HtcRoot or WP7 Root Tools 0.9). The second approach requires device-specific code and the ID_CAP_INTEROPSERVICES capability in its manifest.
For a simple app that uses the second approach, see my MultiTaskToggle app (linked in my sig). Note that this app only needs to read or write a single registry value, so that's how I wrote it. If you want to enumerate registry keys and values, you'll need to use the COM library approach for reading. There used to be a great set of COM libraries for "hybrid" managed/native apps, but most of them were never updated for Mango compatibility. The only one I know of that currently support registry access is used in Schaps' apps, Registry Editor and Advanced Config, and those tools are closed-source (although, with a .NET decompiler, you could probably figure out their APIs easily).
GoodDayToDie said:
It can't be done directly with C#, because there's no managed (.NET) API for registry access on the phone. Instead, you either need to call into a native DLL that you wrote and exposed through COM, or you need to call into an OEM DLL that calls an OEM driver for you. The first approach requires writing, or at least having access to, a native library written in C++. It will also run only with the permissions of the app, which is insufficient for writing to the registry on stock ROMs (unless elevated with something like HtcRoot or WP7 Root Tools 0.9). The second approach requires device-specific code and the ID_CAP_INTEROPSERVICES capability in its manifest.
For a simple app that uses the second approach, see my MultiTaskToggle app (linked in my sig). Note that this app only needs to read or write a single registry value, so that's how I wrote it. If you want to enumerate registry keys and values, you'll need to use the COM library approach for reading. There used to be a great set of COM libraries for "hybrid" managed/native apps, but most of them were never updated for Mango compatibility. The only one I know of that currently support registry access is used in Schaps' apps, Registry Editor and Advanced Config, and those tools are closed-source (although, with a .NET decompiler, you could probably figure out their APIs easily).
Click to expand...
Click to collapse
Perfect, that was all the info I needed. Thanks.
Ben

[Q] Mathstudio (Space Time) for Windows Phone 7

Hi everybody, I am an engineer and I think that windows phone is perfect for my needs..so fast and efficient, office integrated, easy to use and many other qualities..the only thing that I can't find for this OS is Mathstudio.
For those who don't know what's this, it's like having a graphic calculator always in your poket. This program doesn't make everything, of course, but many of the most common things can be done with mathstudio.
I was wondering if somebody could port this program from android/iOS to windows phone 7. Otherwise I must always go around with my mobile and with an ipod touch only for this program. I remember that the previous version of mathstudio (called spacetime) exsists for windows mobile 6.5, an other way could be a porting from windows mobile. I wrote to the official developer but he said he won't realse a windows phone 7 version of his program.
Thank you for listening
Porting WinMo apps is technically possible (though hard unless they were written initially in .NET). Making an unmodified WinMo app run on WP7 is very hard and usually requires a custom ROM to run it (the stock ROMs have very restrictive permissions policies that most WinMo apps can't work with). Porting iOS or Android apps pretty much requires re-writing them, which is an expense that some app authors don't find worth doing.
There are a number of graphing calculator apps available for WP7, and the built-in calculator works pretty well for non-graphing functions, but I can understand wanting access to a specific tool. Unfortunately, since I've never used the app you describe, I can't tell you how well any of the WP7 alternatives compare.
I've got an HD7 and I've made on my own an Y-cable to downgrade it, so now I use the DFT's Deepshining ROM..I didn't know it was even possible to run some old WM6 apps on WP7, such a grat news I'll try to find out more about it Can you give me a list of alternative graphic calculators for windws phone 7? I wasn't able to find anywhere Thank's a lot!!!
I just did a search on the Marketplace for "graphing calculator" and got a number of hits.
If you look at the Opera apps for WP7 custom ROMs, those are actually wrappers around the WinMo Opera apps - the wrappers just put the files in the right places and then launch EXEs.
Thank you so much for the help , I had a look on the marketplace and I found different graphic calculators (Graphing calculator, PoketPi, Eval Graph, Grapher Calculator), but none of them can replace mathstudio for the following reasons: they are only in 2D, they don't support the CAS (computer algebra system, the same present in Matlab), you can't write and save scripts or even one algorythm. I will find out more about wrapping for the moment, but I hope it will come a better solution
Unfortunately, MathStudio will never ported on WP7 platform (according to this: http://www.mathstudio.net/forums/discussion/164/platform-requests , check the last post)
The only hope is upcoming Apollo. WinRT (Win8 API) will have C++ compiler and (probably) will support native code, so MathStudio developers can (also - possible, it's not too easy) port their app to Win8.

Categories

Resources