FWH32 cannot read 64bit Registry Keys

Post Reply
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

FWH32 cannot read 64bit Registry Keys

Post by Davide »

As subject.

To do so, you need to add the KEY_WOW64_64KEY flag to RegOpenKeyEx while now it only uses KEY_ALL_ACCESS in \source\winapi\regedit.c
Please see http://msdn.microsoft.com/en-us/library ... 85%29.aspx

I suggest adding a 4th optional parameter to RegOpenKey() to pass the desired additional flags when accessing the registry (so that the program CAN enable KEY_WOW64_64KEY if IsWow64() - the function I posted yesterday)

Thanks,
Davide
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by Antonio Linares »

Davide,

We will be back in our offices in just few days as we are having a (very short) holidays :-)

As soon as we get back we will review it, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Antonio,
Antonio Linares wrote:As soon as we get back we will review it, thanks
ok, no problem.
The same problem is in reg32.prg too.

Have a nice holiday.
Davide
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Davide wrote:The same problem is in reg32.prg too.
and perhaphs some top definitions are wrong in that prg:

Code: Select all

***
*** Not sure how to handle the &'s and ~'s
***

#define KEY_READ        25 // ((STANDARD_RIGHTS_READ +  KEY_QUERY_VALUE + KEY_ENUMERATE_SUB_KEYS +  KEY_NOTIFY) & (~SYNCHRONIZE))
#define KEY_WRITE        6 // ((STANDARD_RIGHTS_WRITE +  KEY_SET_VALUE +  KEY_CREATE_SUB_KEY) & (~SYNCHRONIZE))
#define KEY_EXECUTE     25 // ((KEY_READ) & (~SYNCHRONIZE))
#define KEY_ALL_ACCESS  63 // ((STANDARD_RIGHTS_ALL +  KEY_QUERY_VALUE +  KEY_SET_VALUE +  KEY_CREATE_SUB_KEY + KEY_ENUMERATE_SUB_KEYS +  KEY_NOTIFY +  KEY_CREATE_LINK) & (~SYNCHRONIZE))
For example KEY_ALL_ACCESS is 0xF003F, which is 983103, not 63 : Math calc. explained at http://www.the-mindseye.co.uk/DllBinder ... ents.shtml

Hi,
Davide
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by Daniel Garcia-Gil »

Davide

Try this way

Code: Select all

#define KEY_READ        nAnd( nOr( STANDARD_RIGHTS_READ, KEY_QUERY_VALUE, KEY_ENUMERATE_SUB_KEYS,  KEY_NOTIFY ), nNot( SYNCHRONIZE ) )
#define KEY_WRITE       nAnd( nOr( STANDARD_RIGHTS_WRITE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY ), nNot( SYNCHRONIZE ) )
#define KEY_EXECUTE     nAnd( KEY_READ, nNot( SYNCHRONIZE ) )
#define KEY_ALL_ACCESS  nAnd( nOr( STANDARD_RIGHTS_ALL, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, KEY_CREATE_LINK ), nNot( SYNCHRONIZE ) )
 
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Dear Daniel,
Daniel Garcia-Gil wrote:Try this way
looks like it works, thanks.

Please find below a modified Treg32 class handling 64bit registry entries (by a 4th parameter "l64bit" in method New() that, if enabled, adds the KEY_WOW64_64KEY to the flags).

Functions in regedit.c still needs similar fixes.

Hi,
Davide
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by Daniel Garcia-Gil »

Thanks Davide

we will check yours modifies very soon...

the source code posted by you in last thread was suppressed, we can not to publish a entire class, only show partial code to modify
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Dear Daniel,
Daniel Garcia-Gil wrote:the source code posted by you in last thread was suppressed, we can not to publish a entire class, only show partial code to modify
oh, ok! I'll keep it in mind in future.

Hi,
Davide
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by Daniel Garcia-Gil »

Davide...

Now, fallow your purpose with new function to detect 64bit OS and try maintain support in 32Bit applications running under 64Bit OS it are changes:

before define CLASS TReg32

Code: Select all

#ifndef _WIN64
#define KEY_WOW64_64KEY If( IsWin64(), 256, 0 )  
#else
#define KEY_WOW64_64KEY 0  
#endif /*_WIN64*/
and change all call to

Code: Select all

RegOpenKeyEx( nKey, cRegKey, KEY_ALL_ACCESS, @nHandle )
for this

Code: Select all

RegOpenKeyEx( nKey, cRegKey, KEY_ALL_ACCESS + KEY_WOW64_64KEY, @nHandle )
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Daniel,

in my modified class I addedd a 4th parameter in method new() because if FWH32 is running on WIN64, you MAY want to access the 32bit mirrored registry entries (like it does now), or you MAY want to access the 64bit ones (installed programs may have different values in 64/32 bit registries). Both things are possible only by adding a parameter to manage programmatically.

Hi,
Davide
User avatar
byte-one
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by byte-one »

Please see also to this topic when code of Treg is to modified:
http://forums.fivetechsupport.com/viewt ... =3&t=19331
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
Daniel Garcia-Gil
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita
Contact:

Re: FWH32 cannot read 64bit Registry Keys

Post by Daniel Garcia-Gil »

Davide wrote:Daniel,

in my modified class I addedd a 4th parameter in method new() because if FWH32 is running on WIN64, you MAY want to access the 32bit mirrored registry entries (like it does now), or you MAY want to access the 64bit ones (installed programs may have different values in 64/32 bit registries). Both things are possible only by adding a parameter to manage programmatically.

Hi,
Davide
What version do you use...??

one year ago the class and function was modified
our best documentation is the source code
Isla de Margarita Venezuela.
danielgarciagil@gmail.com
http://tdolphin.blogspot.com/
https://www.dropbox.com/referrals/NTI5N ... rc=global9
Davide
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: FWH32 cannot read 64bit Registry Keys

Post by Davide »

Daniel,
Daniel Garcia-Gil wrote:What version do you use...??
one year ago the class and function was modified
I'm still on FWH905 but, unless you've already provided that optional flag, the need is independent by the programming language/version.

As you can see at http://msdn.microsoft.com/en-us/library ... 85%29.aspx By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view.

The problem is that, for example the HKLM/Software tree is DIFFERENT on the 2 registries, and actually FWH32 can read just the 32bit one (a 64bit-only program installed on Win64 cannot be found in the 32bit registry tree, even though the FWH32 program could shellexecute it without problems). That's why I modified Treg32 to read EVEN the 64bit registry (if you specifically want to do it in the New() clause)

Hi,
Davide

P.S.: The same additional parameter is needed even in the registry functions included in \source\winapi\regedit.c
Post Reply