[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cygwin-patches
Subject:    Re: [Patch] Allow access to /proc/registry/HKEY_PERFORMANCE_DATA
From:       Christian Franke <Christian.Franke () t-online ! de>
Date:       2008-12-19 17:35:54
Message-ID: 494BDB7A.4000103 () t-online ! de
[Download RAW message or body]

Chris January wrote:
> On Fri, Dec 19, 2008 at 1:58 PM, Christian Franke  wrote:
>   
>>        (fhandler_registry::fill_filebuf): Use larger buffer to speed up
>>        access to HKEY_PERFORMANCE_DATA values.  Remove check for possible
>>        subkey.  Add RegCloseKey ().
>>     
>
> +      /* RegQueryValueEx () opens HKEY_PERFORMANCE_DATA.  */
> +      RegCloseKey (handle);
>
> I'm slightly puzzled by this change. handle is usually closed in
> fhandler_register::close. If you close it here then won't CloseHandle
> be called with an invalid handle in that method?
>
>   

fhandler_registry::close() closes only handles < HKEY_CLASSES_ROOT. 
Normally, it is not necessary to close predefined keys.

HKEY_PERFORMANCE_DATA is an exception: It has no subkeys and access to a 
value opens the predefined key. Therefore, the key is closed immediately 
after value access. Doing this in close() would require to pass a new 
'key_is_open' flag from fill_filebuf().

Christian

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic