Article ID: 176906 - Last Review: November 21, 2006 - Revision: 4.1 BUG: Registry access from multiple threads might fail
This article was previously published under Q176906 On This PageSYMPTOMS
If you simultaneously access the same registry key from multiple threads in
a single process, an error might occur. For example, if several threads in
a carefully designed multi-threaded Win32 application try to open the same
registry key using RegOpenKeyEx()in a loop, the function could fail with
the following error code of 6:
ERROR_INVALID_HANDLE
CAUSE
This behavior is intermittent and is the result of a race condition between
the threads simultaneously accessing the same registry key.
RESOLUTION
There are several possible workarounds for this situation:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section. MORE INFORMATION
The following sample code illustrates the problem with the RegOpenKeyEx()
function. Note that the error only happens intermittently with the
following code.
Sample code | Other Resources Other Support Sites
CommunityArticle Translations |






Windows Live
Facebook
Twitter
Linkedin
Digg it
Yahoo
Delicious
StumbleUpon
Yammer
Reddit
Technorati
FriendFeed
Email
Back to the top