Topic
  • 4 replies
  • Latest Post - ‏2008-10-08T20:34:10Z by SystemAdmin
saintveni
saintveni
4 Posts

Pinned topic How to read a registry value on Windows Mobile 5.0

‏2008-09-19T09:17:53Z |
Hi all,

I am writing a mobile application in java, and need to read a value from the PPC windows registry...

Could anyone, please, give me an example of how I can read from my code a particular registry value?

I have already tried with

COMPUTER_WINDOWS_CAR_FOLDER =
"reg query \"HKLM\\System\\StorageManager\\Profiles\\SDMemory\" /v Folder";
Process process = Runtime.getRuntime().exec(
COMPUTER_WINDOWS_CAR_FOLDER);

but I receive an IOException Unable to start Program.
I have also tried with JavaRegisrtyWrapper, which is published in

Google Projects: http://code.google.com/p/javaregistrywrapper/downloads/detail?name=JavaRegisrtyWrapper.jar&can=2&q=

As long as I test on the PC Windows XP, everything works fine, but on the PPC with Windows CE 5.0, I receive a NoClassDefFoundError.
It seems to me that j9 JVM doesn't have all of the classes needed.

Does anyone have a clue?
Any help, example or advice would be appreciated.
Thanks in advance
Updated on 2008-10-08T20:34:10Z at 2008-10-08T20:34:10Z by SystemAdmin
  • saintveni
    saintveni
    4 Posts

    Re: How to read a registry value on Windows Mobile 5.0

    ‏2008-09-19T09:27:27Z  
    In addition, I am having wsdd5.0 and ive-2.2, and I compile with jclMax.
  • SystemAdmin
    SystemAdmin
    9394 Posts

    Re: How to read a registry value on Windows Mobile 5.0

    ‏2008-10-07T22:42:21Z  
    • saintveni
    • ‏2008-09-19T09:27:27Z
    In addition, I am having wsdd5.0 and ive-2.2, and I compile with jclMax.
    SWT native library for ppc-arm contains registry functions. So you can use SWT OS.class for accessing registry from Java. Here is what I did:
    • I downloaded swt-3.4-win32-wce_ppc-arm-j2se.zip from http://www.eclipse.org/swt/ downloads
    • then I put swt-win32-3448.dll to my \J9\bin directory
    • and swt.jar to my \J9\lib\jclFoundation11\ext directory
    • then I wrote a simple test:
    
    
    
    import org.eclipse.swt.internal.win32.*;   
    
    public 
    
    class ReadRegistry 
    { 
    
    public 
    
    static 
    
    void main(String[] args) 
    {   
    
    int[] hkey = 
    
    new 
    
    int[1]; TCHAR SDMemory = 
    
    new TCHAR( 0, 
    "System\\StorageManager\\Profiles\\SDMemory", 
    
    true); TCHAR Folder = 
    
    new TCHAR( 0, 
    "Folder", 
    
    true ); 
    
    int[] cb = 
    
    new 
    
    int[1]; OS.RegOpenKeyEx( OS.HKEY_LOCAL_MACHINE, SDMemory, 0, OS.KEY_QUERY_VALUE, hkey ); OS.RegQueryValueEx( hkey[0], Folder, 0, null, (TCHAR)null, cb ); TCHAR buf = 
    
    new TCHAR( 0, cb[0] ); OS.RegQueryValueEx( hkey[0], Folder, 0, null, buf, cb ); System.out.println( buf.toString().trim() ); 
    } 
    }
    

    • and run it from \J9\examples directory using
    
    57#\J9\bin\j9.exe -jcl:foun11 -cp \J9\examples ReadRegistry
    

    • on Fujitsu-Siemens Pocket LOOX N560 with WM 5.0 I got: SD-MMCard
  • saintveni
    saintveni
    4 Posts

    Re: How to read a registry value on Windows Mobile 5.0

    ‏2008-10-08T07:40:23Z  
    SWT native library for ppc-arm contains registry functions. So you can use SWT OS.class for accessing registry from Java. Here is what I did:
    • I downloaded swt-3.4-win32-wce_ppc-arm-j2se.zip from http://www.eclipse.org/swt/ downloads
    • then I put swt-win32-3448.dll to my \J9\bin directory
    • and swt.jar to my \J9\lib\jclFoundation11\ext directory
    • then I wrote a simple test:
    <pre class="jive-pre"> import org.eclipse.swt.internal.win32.*; public class ReadRegistry { public static void main(String[] args) { int[] hkey = new int[1]; TCHAR SDMemory = new TCHAR( 0, "System\\StorageManager\\Profiles\\SDMemory", true); TCHAR Folder = new TCHAR( 0, "Folder", true ); int[] cb = new int[1]; OS.RegOpenKeyEx( OS.HKEY_LOCAL_MACHINE, SDMemory, 0, OS.KEY_QUERY_VALUE, hkey ); OS.RegQueryValueEx( hkey[0], Folder, 0, null, (TCHAR)null, cb ); TCHAR buf = new TCHAR( 0, cb[0] ); OS.RegQueryValueEx( hkey[0], Folder, 0, null, buf, cb ); System.out.println( buf.toString().trim() ); } } </pre>
    • and run it from \J9\examples directory using
    <pre class="jive-pre"> 57#\J9\bin\j9.exe -jcl:foun11 -cp \J9\examples ReadRegistry </pre>
    • on Fujitsu-Siemens Pocket LOOX N560 with WM 5.0 I got: SD-MMCard
    Hi Ladya,

    I tried the code that you posted. It works by me too. I guess I know nothing about windows programming:), but one constantly learns.

    Thank you very much for your help!

    Best regards!
  • SystemAdmin
    SystemAdmin
    9394 Posts

    Re: How to read a registry value on Windows Mobile 5.0

    ‏2008-10-08T20:34:10Z  
    • saintveni
    • ‏2008-10-08T07:40:23Z
    Hi Ladya,

    I tried the code that you posted. It works by me too. I guess I know nothing about windows programming:), but one constantly learns.

    Thank you very much for your help!

    Best regards!
    Hi Saintveni,
    you are welcome :)