Page 1 of 1

FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 1:34 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 3:05 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 5:09 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 5:51 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 6:29 pm
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 ) )
 

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 7:06 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 8:05 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sat Aug 14, 2010 9:29 pm
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Sun Aug 15, 2010 7:04 pm
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 )

Re: FWH32 cannot read 64bit Registry Keys

Posted: Mon Aug 16, 2010 9:14 am
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Mon Aug 16, 2010 10:29 am
by byte-one
Please see also to this topic when code of Treg is to modified:
http://forums.fivetechsupport.com/viewt ... =3&t=19331

Re: FWH32 cannot read 64bit Registry Keys

Posted: Mon Aug 16, 2010 11:08 am
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

Re: FWH32 cannot read 64bit Registry Keys

Posted: Tue Aug 17, 2010 12:53 am
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