<div dir="ltr">Hi George,<div><br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 10, 2013 at 3:55 PM, George Stephanos <span dir="ltr"><<a href="mailto:gaf.stephanos@gmail.com" target="_blank">gaf.stephanos@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div style="font-family:arial,sans-serif;font-size:13px">
I'm proposing my HKEY_CLASSES_ROOT implementation patches for review. Feel free to comment.</div><div style="font-family:arial,sans-serif;font-size:13px">
So far, I've written code for all functions except for the RegEnum family.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">General description:</div>

<div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">HKCR handles are special. All wine handles have the two lowest bits zero'd. HKCR handles are masked. 10b specifically.</div>

<div style="font-family:arial,sans-serif;font-size:13px">They have their own table separate from the generic handle table.</div><div style="font-family:arial,sans-serif;font-size:13px">An HKCR handle has an HKCU handle and an HKLM handle below it. Access mask and a string representing the path are also needed</div>

<div style="font-family:arial,sans-serif;font-size:13px">since the handle has to attempt to reopen previously failed openings at certain stages.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">

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.</div><div style="font-family:arial,sans-serif;font-size:13px">

Second patch: added path management</div><div style="font-family:arial,sans-serif;font-size:13px">Third patch: added HKCU</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">

Here's a quick description of each function:</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">create_hkcr_struct: allocates the memory needed for the struct, adds it to the table and gives back a pointer to it</div>

<div style="font-family:arial,sans-serif;font-size:13px">get_hkcr_path: given an HKCR handle and a subkey string, prepares a subkey string representing the same subkey rooted at HKLM/HKCU.</div><div style="font-family:arial,sans-serif;font-size:13px">

create_hkcr: RegCreateKeyEx</div><div style="font-family:arial,sans-serif;font-size:13px">open_hkcr: RegOpenKeyEx</div><div style="font-family:arial,sans-serif;font-size:13px">resolve_hkcr: checks the HKCR handle, tries to reopen previously failed internal handles, gives back HKCU first if available then HKLM</div>

<div style="font-family:arial,sans-serif;font-size:13px">close_hkcr: deallocates path and struct, removes struct from table.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">

<a href="http://pastie.org/8314658" target="_blank">http://pastie.org/8314658</a></div></div></blockquote><div><br></div><div>a couple bitwise nits in your first patch:</div><div><br></div>+#define HKCR_MASK 2<div>+#define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == HKCR_MASK)</div>
<div><br></div><div>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:</div><div>#define SPECIAL_HKEY_MASK 3</div><div>#define HKCR_FLAG 2</div>
<div><br></div><div>Also, in the following expression:</div><div>((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3)</div><div><br></div><div>The second can never be true when the first is false, so you can just drop the first. These suggestions yield:</div>
<div>#define IS_HKCR(hk) (((UINT_PTR)(hk) & SPECIAL_HKEY_MASK) == HKCR_FLAG)</div><div class="gmail_extra">--Juan</div></div></div></div>