Re: Windows Registry Problem in Win98
Morten Andersen <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Organization | Arosii Information Systems A/S |
| Message-ID | <[email protected]> |
Hi Ivan
First sorry for the slow answering-rate.
And then to your problem. I just looked in the source for the
Registry-class you are using, and Jawin is using the following native
Win32 API functions when your code is executed:
RegOpenKeyW
and
RegQueryValueExW
These are documented in the MSDN here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/regopenkey.asp
and here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/regqueryvalueex.asp
The versions Jawin is using are the so called Unicode versions (can be
seen by the prefix "W"). Unfortunately these functions are only
supported on Windows ME/95/98 in special cases:
"Windows Me/98/95: RegQueryValueExW is supported by the Microsoft Layer
for Unicode. To use this, you must add certain files to your
application, as outlined in Microsoft Layer for Unicode on Windows
Me/98/95 Systems."
(quote from one of the links above).
As far as I know Jawin does not pt. support Ansi-strings (the opposite
to Unicode strings in the Win32 API) as required by Win98. So even if
you would write the Jawin marshalling code yourself (instead of using
the Registry class), I don't think it is possible to get it to run on
all Windows98 machines.
I don't know what your usage of Jawin are beside accessing the Windows
registry? But if you only need to access the registry, you could try to
look into the ice.jni.registry package:
http://www.trustice.com/java/jnireg/ although you should note that the
license is GPL, so if you are planning to use the software in a
closed-source commercial project you may have problems?
I assume that this bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=972585&group_id=66397&atid=514369
has been opened by you, and is related to this mail?
Hope this helps you a little bit further
Best Regards
Morten Andersen
Ivan wrote:
> Hi all,
>
> I got no problem runing the following script in WinXP but it trown
> exception in Win98. Any ideas ?
>
> Thanks
>
> int li_index = 0;
> String ls_install_path = "";
>
> try{
>
> li_index = Registry.OpenKey( RegistryConstants.HKEY_CURRENT_USER,
> "CONTROL PANEL\\INTERNATIONAL");
>
> ls_install_path = Registry.QueryStringValue( li_index,
> "SSHORTDATE" );
>
> }catch( IOException e ){
> System.out.println("Java - Registry IOException" + e.toString());
> }catch( COMException e ){
> System.out.println("Java - Registry COMException" +
> e.toString());
> }catch(Exception e){
> System.out.println("Java - Registry Exception" + e.toString());
> }
>
>
> Exception trown in Win98 :-
> java.lang.NullPointerException
>
> ----------------------------------------------------------------
> This e-mail has been sent via JARING webmail at http://www.jaring.my