From: Geoff Schaller on
Hi Folks.

For anyone like me who suddenly found a need to retrieve registry
entries on a 64 bit OS from a VO application, there is an issue.

By default, VO and other 32 bit apps are directed to the WOW6432NODE
hive in order to keep them separate to 64 bit apps. However an app we
were working on needed to retrieve keys from the native hive of the OS.
In other words, the 64 bit hive for 64 bit and the native hive
otherwise.

All you have to do is provide a mask of 0x0100 which has the lovely
define of KEY_WOW64_64KEY in Dot Net. For example, the routine way to
open a registry key should be amended like this:

METHOD KeyExists(s_SubKey AS STRING) AS LOGIC PASCAL CLASS
GCSRegistryClass

// test the key by attempting to open it

LOCAL li_Error AS LONG
LOCAL dw_KeyHandle AS DWORD
LOCAL s_Full_SubKey AS STRING
LOCAL lResult AS LOGIC

s_Full_SubKey := SELF:Build_Full_SubKey(s_SubKey)

li_Error := RegOpenKeyEx( ;
SELF:hKey, ; // hKey AS PTR
String2Psz(s_Full_SubKey), ; // lpSubKey AS PSZ
0, ; // ulOPtions AS
DWORD
SELF:mask+KEY_QUERY_VALUE, ; // samDesired AS
DWORD
@dw_KeyHandle ; // phkResult AS PTR
) // AS LONG
PASCAL:ADVAPI32.RegOpenKeyExA#149

IF li_Error == ERROR_SUCCESS
RegCloseKey(dw_KeyHandle)
lResult := TRUE
ENDIF

RETURN lResult

....just in case someone was interested.

Cheers,

Geoff


From: Ginny Caughey on
Geez Geoff, why not do it in C#?

--

Ginny Caughey
www.wasteworks.com



From: Philippe Mermod on
Cuz' he likes VO :-)
--
Phil Mermod
Crystal Reports Library for Visual Objects
http://www.pkl.ch/dev/


Ginny Caughey wrote:

> Geez Geoff, why not do it in C#?
From: Ginny Caughey on
He likes C# too, and it's a lot easier to do some things in C#. You don't
have to use only one language you know. ;-) It's not being disloyal or
anything to use the best tool for the job at hand.

--

Ginny Caughey
www.wasteworks.com




From: Geoff Schaller on
Hi Ginny.

This is a VO app and it is 15 lines of code :-)

In this case there is no benefit doing it in C# and in fact the issue is
identical. C# has the exact same problem. But here we already have a
pre-coded template in VO for these registry functions so it saves a COM
reference etc.

Cheers,

Geoff



"Ginny Caughey" <ginny.caughey.online(a)wasteworks.com> wrote in message
news:4bf6b42f$0$13573$c3e8da3(a)news.astraweb.com:

> Geez Geoff, why not do it in C#?
>
> --
>
> Ginny Caughey
> www.wasteworks.com