hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

Issues finding HKLM registry key from F# fsi interpreter

Last post 09-05-2008, 14:53 by Puyan. 9 replies.
Sort Posts: Previous Next
  •  09-03-2008, 15:39 6856

    Issues finding HKLM registry key from F# fsi interpreter

    Hi

    I am kind of new to F#, but I did some Scheme in college so I know a bit about what functional languages are about. I am working for one of the MS Office teams and I want to do some work with F# specifically because the interpreter would make some of my job a lot easier.

    I have some F# code that calls some of my teams managed libraries, and I am finding that the compiled code works just fine but that the interpreted code chokes on a registry key open. The Method that is getting called is Microsoft.Win32.Registry.LocalMachine.OpenSubKey(string), and I pass it a path to @"SOFTWARE\Microsoft\Office\..." (can't really show the rest of the path). The key I want to get doesn't work in the interpreter, but the key one level above it does, and the sub keys of that are only 2 of the other 5 keys.

    Are there known to be any issues with opening HKLM registry keys from fsi? This stuff all works when compiled (that OpenSubKey doesn't return a null, and as a result doesn't cause some other exception to get thrown).

    -Thanks

    PL

    http://www.puyan.org
  •  09-03-2008, 21:26 6865 in reply to 6856

    Re: Issues finding HKLM registry key from F# fsi interpreter

    Code:

    let key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Office");;
    let sub = key.GetSubKeyNames();;
    print_any sub;;


    Output from Compiled Version:

    [|"12.0"; "Outlook"|]


    Output from Interpreted version:

    [|"11.0"; "12.0"; "8.0"; "Common"; "Delivery"; "Excel"; "InfoPath"; "Outlook";
    "Word"|]

    The compiled version is what I actually see in regedit.
    http://www.puyan.org
  •  09-03-2008, 22:23 6866 in reply to 6865

    Re: Issues finding HKLM registry key from F# fsi interpreter

    FYI, this does not repro for me (both compiled and VFSI yield same result, and that result matches regedit).
  •  09-04-2008, 9:14 6886 in reply to 6866

    Re: Issues finding HKLM registry key from F# fsi interpreter

    I have tried this on my machines at work (ws2008 64bit), and at home (Vista Ultimate x64). What are you running?

    http://www.puyan.org
  •  09-04-2008, 9:24 6887 in reply to 6866

    Re: Issues finding HKLM registry key from F# fsi interpreter

    I tried this code in the interpreter on my email box at work (which is Vista Enterprise 32bit) and it works fine.

    So maybe I don't get this but, do 32bit processes have a different view of the registry?

    http://www.puyan.org
  •  09-04-2008, 9:42 6888 in reply to 6887

    Re: Issues finding HKLM registry key from F# fsi interpreter

    Works correctly on Windows XP SP3
  •  09-04-2008, 9:55 6890 in reply to 6888

    Re: Issues finding HKLM registry key from F# fsi interpreter

    I know now where these things are going:

    HKLM\SOFTWARE\Wow6432Node

    The WOW stuff is messing me up here.

    Is there a 64bit version of fsi?

    http://www.puyan.org
  •  09-04-2008, 14:16 6900 in reply to 6888

    Re: Issues finding HKLM registry key from F# fsi interpreter

    So I fixed the problem:


    http://cs.hubfs.net/forums/thread/6369.aspx


    Used corflags to change the 32bit flag on the fsi.exe assembly.

    http://msdn.microsoft.com/en-us/library/ms164699(VS.80).aspx


    So should absilsuppc.dll work ok for me even though I am running fsi in 64mode?

    http://www.puyan.org
  •  09-04-2008, 15:15 6903 in reply to 6900

    Re: Issues finding HKLM registry key from F# fsi interpreter

    absilsuppc.dll will not load into the 64-bit process. This should not be an issue for fsi.exe, since absilsupcc.dll only implements code signing, native resource linking and command-line compiler debug symbol generation.
  •  09-05-2008, 14:53 6924 in reply to 6903

    Re: Issues finding HKLM registry key from F# fsi interpreter

    Is there any chance this will be released as an x64 binary? Are there any limitations or issues?

    http://www.puyan.org
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems