I found that RegQueryValueEx(HKEY_PERFORMANCE_DATA,...) have more problems.
I can cause deadlocks in mutithreaded apllication during loading of dynamic DLL in
another thread, if loading DLL call inside DllMain function RegQueryValueEx(predefined
constant HKEY_xxx, ) - like microsoft ODBC library.
To solve this in RAND_WIN.C
a) don't use HKEY_PERFORMANCE_DATA - like on W2k or on all OS version in OpenSLL
0.9.7beta
b) access HKEY_PERFORMANCE_DATA using using RegOpenKey, RegQueryValueEx(handle),
RegCloseKey
(this does not lock global process critical section
_PredefinedHandleTableCriticalSection inside ADVAPI32.DLL)
But this may cause other problems, because first open of HKEY_PERFORMANCE_DATA is
loading all perfomance DLL installed in system to current process. I have problem with
this, because it take about 90 seconds delay (inside
RegQueryValueEx(HKEY_PERFORMANCE_DATA,...) during my service initialization after OS
start.
Milan Dadok
----- Puvodn� zpr�va -----
Od: "Bobco, Pete" <[EMAIL PROTECTED]>
Komu: <[EMAIL PROTECTED]>
Odesl�no: 30. srpna 2002 23:09
Predmet: [Patch] for Windows OpenSSL 0.9.6g (or earlier)
> I have found that OpenSSL version 0.9.6g (or earlier) on Windows can cause a problem
>that will prevent Window's
> Disk Administrator from being able to delete a logical drive from a system that has
>several logical drives associated
> with a physical drive. By using a tool call Filemon.exe (from
>http://www.sysinternals.com/sitemap.shtml) I was
> able to isolate the problem to be one in which a registry handle is not closed I
>was able to trace this occurance to a line
> in RAND_WIN.C. I then added a one line 'fix' after the query which closes the key
>and fixes the problem.
>
> In more detail, using symbolic debugging inside of OpenSSL, I found that during the
>first call to SSL_accept()
> OpenSSL ends up querying the HKEY_PERFORMANCE_DATA Registry key in order to get some
>random data.
> It turns out that this is one of those Windows oddities whereby you do not need to
>explicitly open this key, but you have
> to explicity close it or it leaves a handle open that results in this Disk
>Administrator problem.
>
> --- Pete Bobco ---
>
>
>--------------------------------------------------------------------------------------------------------------------------------------------------
>
> [Patch for RAND_WIN.C]
>
> diff -ur \openssl-0.9.6g-orig/crypto/rand/rand_win.c
> \openssl-0.9.6g-work/crypto/rand/rand_win.c
> --- \openssl-0.9.6g-orig/crypto/rand/rand_win.c Thu Feb 21 05:56
> :50 2002
> +++ \openssl-0.9.6g-work/crypto/rand/rand_win.c Fri Aug 23 10:48
> :20 2002
> @@ -286,6 +286,15 @@
> */
> RAND_add(&length, sizeof(length), 0);
> RAND_add(buf, length, length / 4.0);
> +
> + /* Close the Registry Key to allow Windows to cleanup/close the open handle
> + * Note: The 'HKEY_PERFORMANCE_DATA' key is implicitly opened when the
>
> + * RegQueryValueEx above is done. However, if it is not explicitly
> + * closed, it can cause disk partition manipulation problems.
> + */
> +
> + RegCloseKey(HKEY_PERFORMANCE_DATA);
> +
> }
> if (buf)
> free(buf);
>
>
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> Development Mailing List [EMAIL PROTECTED]
> Automated List Manager [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]