Menu

#20 Can't write REG_SZ under Windows 7 32 bit

open
nobody
None
5
2010-09-01
2010-09-01
No

I can read and write a REG_DWORD just fine, but when I write a REG_SZ I get:

# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x770d20cb, pid=1152, tid=3180
#
# JRE version: 6.0_21-b07
# Java VM: Java HotSpot(TM) Client VM (17.0-b17 mixed mode, sharing windows-x86 )
# Problematic frame:
# C [ntdll.dll+0x520cb]
#
# An error report file with more information is saved as:
# D:\Users\me\Documents\NetBeansProjects\MyApp\hs_err_pid1152.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

It does write the string before it crashes. I see it with regedit, and I can read it with jRegistryKey when I run my program again. But I have several strings to write and it won't go past the first one.

Any ideas?

Discussion

  • eddycurrents

    eddycurrents - 2010-09-01

    write REG_SZ crash log

     
  • Matt Hilliard

    Matt Hilliard - 2010-09-01

    Hi!

    Not having a windows licence since XP--I can't be sure what the issue is, but it looks like there may be some symbol confusion in your native calling stack...
    C [ntdll.dll+0x520cb]

    C [ntdll.dll+0x5201f]

    C [msvcrt.dll+0x98cd]

    C [jRegistryKey.dll+0x2fa0]

    j ca.beq.util.win32.registry.RegistryKey.setValue(Lca/beq/util/win32/registry/RegistryValue;)V+0

    The binary that jRK ships with doesn't use *any* version of msvcrt.dll (C:\Windows\system32\msvcrt.dll and C:\Program Files\Java\jdk1.6.0_21\jre\bin\msvcr71.dll are in your program's symbol space)--on account of excessive bloat, poor performance and a general preference to avoid dll hell at all costs--it ports the symbols it needs from static mingw libraries and jams them directly into the jRK dll; which on my XP box; call ntdll.dll directly.

    I'm speculating (but completely unable to verify) that one or more library calls have been renamed or shuffled between XP and 7 (probably one for some kind of string processing--strlen or somesuch--moved out of ntdll.dll into msvcrt dll, or similar).

    If you've got your own copy of Visual studio, there is a build target for that compiler and libraries which may resolve to the symbols your version of windows is expecting. If that's really a no-go (or if you can confirm the calls are correct, but the symbols are scattered), I'll see if newer versions of mingw *officially* support windows 7 (its been more than a few years since I've seen a bug I thought I could address) and try to cross-compile a new native library for the new OS.
    If I have to provide you directly with something from a Microsoft compiler it will be a few more megs and a few more files--and still come from an XP machine which may not really address your issue--you're almost certain to have better luck here than relying on me.

    I also suggested using XP "Compatability Mode" in a Vista bug which I never heard back about--its possible this provides the fixes you need (but again, unverified) http://www.howtogeek.com/howto/windows-vista/using-windows-vista-compatibility-mode/

     
  • eddycurrents

    eddycurrents - 2010-09-03

    Thanks but I'm afraid I don't quite understand what you are suggesting. I haven't touched C under Windows since Win 95. (Do they still have that kludgy event loop? Amiga was so much cleaner.)

    I can download MS Visual Studio (the free version) and try recompiling the DLL under Windows 7. Where is the C source? I have used Visual Studio for Visual Basic but not C.

    I have never heard of mingw. Does that make better source than MS's own? Would it be possible for you to try the latest version and I can see if it helps?

    I found the mingw site (it seems there are two, one on sourceforge) and neither say definitely which version of windows they support, but since they were recently updated they must support Windows 7.

     
  • eddycurrents

    eddycurrents - 2010-09-16

    I tried compiling with Visual Studio, then with Netbeans using gcc under Cygwin then mingw. No luck. I ran out of time / patience... I want to learn Java not C.

    So I gave up and went with java.util.prefs.Preferences. It's very limited and isn't what I wanted but it will do. It's all contained in and maintained with the JRE.

    Interestingly, it treats all prefs as REG_SZ so they obviously got it to work somehow.

     

Log in to post a comment.

MongoDB Logo MongoDB