<div dir="ltr">Hi Guo,<div class="gmail_extra"><br>On Tue, May 14, 2013 at 1:32 PM, Guo Jian <span dir="ltr"><<a href="mailto:orzhvs@gmail.com" target="_blank">orzhvs@gmail.com</a>></span> wrote:<br><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I just found that the REG_OPTION_VOLATILE of create_key in hkcr may<br>
have some tricks. Not surprisingly found a strange situation when<br>
testing on windows. See my test here please :<br>
<a href="http://newtestbot.winehq.org/JobDetails.pl?Key=932" target="_blank">http://newtestbot.winehq.org/JobDetails.pl?Key=932</a><br>
This happens as following :<br>
First create hkcu/software/classes/key1, then create the<br>
hkcr/key1/subkey with REG_OPTION_VOLATILE. RegEnumKey on hkcr �will<br>
give two 'key1'.<br></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried to use RegQueryInfoKeyA to count them, also there are more<br>
than there should be.<br>
Why there are two duplicated keys? May it be a bug of windows? If it<br>
is, should we design our algorithm to avoid or treat it as a normal<br>
feature?<br></blockquote><div><br></div><div style>That's interesting. Windows might allow both a volatile and non-volatile key of the same name. Since the volatile one is kept in-memory, any values that exist in it will be discarded eventually, so any inconsistency that arises isn't the kernel's problem. That'd be my guess, at any rate: even though such a behavior has the potential to confuse application developers, since it's not the kernel's problem, it's probably an overlooked quirk.</div>
<div style><br></div><div style>As far as what to do with it: this is one of those nuanced, i.e. hard to decide, things with our tests.</div><div style><br></div><div style>In general, we assume that Windows's behavior is the correct behavior, unless we have strong reason to assume otherwise. We've encountered many times that even what appear to be bugs end up being relied upon by application developers.</div>
<div style><br></div><div style>In this case, though, I think you might have stumbled across something that's relatively rare, and unless there's an application that depends on this behavior, it might be worth ignoring for now.</div>
<div style><br></div><div style>Hope that helps.</div><div style>--Juan</div></div></div></div>