Hi George, On Tue, Sep 10, 2013 at 3:55 PM, George Stephanos <gaf.stepha...@gmail.com>wrote:
> I'm proposing my HKEY_CLASSES_ROOT implementation patches for review. Feel > free to comment. > So far, I've written code for all functions except for the RegEnum family. > > General description: > > HKCR handles are special. All wine handles have the two lowest bits > zero'd. HKCR handles are masked. 10b specifically. > They have their own table separate from the generic handle table. > An HKCR handle has an HKCU handle and an HKLM handle below it. Access mask > and a string representing the path are also needed > since the handle has to attempt to reopen previously failed openings at > certain stages. > > First patch: specially handles HKCR handles WITHOUT affecting the general > behavior. The end result is still the exact same. Patch provides a > foundation for the rest. > Second patch: added path management > Third patch: added HKCU > > Here's a quick description of each function: > > create_hkcr_struct: allocates the memory needed for the struct, adds it to > the table and gives back a pointer to it > get_hkcr_path: given an HKCR handle and a subkey string, prepares a subkey > string representing the same subkey rooted at HKLM/HKCU. > create_hkcr: RegCreateKeyEx > open_hkcr: RegOpenKeyEx > resolve_hkcr: checks the HKCR handle, tries to reopen previously failed > internal handles, gives back HKCU first if available then HKLM > close_hkcr: deallocates path and struct, removes struct from table. > > http://pastie.org/8314658 > a couple bitwise nits in your first patch: +#define HKCR_MASK 2 +#define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == HKCR_MASK) Typically a mask would define all the bits that could be set, and a flag would be the particular bit you want to test. Something like: #define SPECIAL_HKEY_MASK 3 #define HKCR_FLAG 2 Also, in the following expression: ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) The second can never be true when the first is false, so you can just drop the first. These suggestions yield: #define IS_HKCR(hk) (((UINT_PTR)(hk) & SPECIAL_HKEY_MASK) == HKCR_FLAG) --Juan