NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 27 28 29 30 31 … 93 Next »
Handling registry redirection in .NET

 
  • 0 Vote(s) - 0 Average
Handling registry redirection in .NET
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#1
2008-11-22, 09:03 AM
I've just found out that a 32bit app installed on a 64bit platform has its registry entries stored in a Wow6432node subkey. As a result, when gbpvr is installed on Vista x64, HKLM\Software\devnz doesn't exist (as far as I can tell).

The dvbt radio service can't use the IPluginHelper to get the install directory so I'm currently using...
Code:
RegistryKey GBKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\devnz");
...but this obviously fails on Vista x64.

It seems I can use RegOpenKeyEx and pass flags which should allow the registry redirector to find the key but I can't find a .NET equivalent for RegOpenKeyEx.

Anyone know if there's something buried in a ,NET class library I haven't found yet or do I need to do a DllImport on this (yuck)?

Cheers,
Brian
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#2
2008-11-26, 06:33 AM
I know there is probably a better way but here's what I do:
Code:
RegistryKey GBKey;
try { GBKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\devnz"); }
catch {
  try { GBKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432node\devnz"); }
  catch { /* fail code here */ }
}

Doing that from memory but you get the idea if my syntax is wrong.
bgowland
Offline

Posting Freak

West Yorkshire, UK
Posts: 4,583
Threads: 384
Joined: Dec 2004
#3
2008-11-26, 10:40 AM
Thanks - I'll probably use something like that as a temporary measure unless I get time to import the advaip32 stuff. I'd like to avoid it long term though as the MSDN docs warn against direct access in case 'behaviour changes in the future'.

Cheers,
Brian
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  NewStyleButtonListPlugin - handling keypresses psycik 3 1,601 2012-12-14, 07:17 AM
Last Post: whurlston
  Handling simultaneous HTTP requests bgowland 8 3,249 2012-01-29, 12:51 AM
Last Post: bgowland
  Unhandled exception handling in GB-PVR ubu 7 2,322 2007-02-18, 02:54 AM
Last Post: sub
  Tricks for handling number keys? (C#) bgowland 1 1,290 2005-11-14, 07:31 PM
Last Post: psycik

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode