[Webkit-unassigned] [Bug 17032] No rand_s on Windows 2000 -> crash
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Feb 4 13:05:31 PST 2008
http://bugs.webkit.org/show_bug.cgi?id=17032
------- Comment #4 from eu4bbt12phas4ek at bodhi.lawlita.com 2008-02-04 13:05 PDT -------
(In reply to comment #3)
> That's not to say this bug can't be fixed, though! We'll gladly accept a patch
> to fix this that doesn't regress other platforms.
I've found the bug through Qt's webkit integration, and I assume they wanna
support win2k.
The solution is to not use rand_s on win2k.
But to have only one binary excludes a macro solution.
It must be checked for rand_s at runtime:
somewhere in a cpp file:
#include <windows.h>
bool checkFor_rand_s()
{
HMODULE dll = LoadLibrary("ADVAPI32.DLL");
if (dll && GetProcAddress(dll, "RtlGenRandom") ) {
FreeLibrary(dll);
return true;
}
FreeLibrary(dll);
return false;
}
And a dynamic switch in wtf_random_init/wtf_random,
static bool do_check = true;
static bool rand_s_exists = false;
if (do_check) {
rand_s_exists = checkFor_rand_s();
}
if (rand_s_exists) {
....
}
The only problem I see is that it is ugly and that it eventually
breaks the inlining of the rand functions.
--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the webkit-unassigned
mailing list