akheron/jansson — pull request #162 by nmlgc (2014-02-15 16:16:28+00:00)
Title: Three fixes for hashtable seeding on Windows

First, wrap "advapi32.dll" into the `TEXT()` macro. If UNICODE is defined, GetModuleHandle() redirects to GetModuleHandleW(), which excepts a `wchar_t*` UTF-16 parameter, thus causing a compile error. TEXT() [prefixes the string literal with `L` in this case, and does nothing otherwise] (http://en.wikibooks.org/wiki/Windows_Programming/Unicode#TEXT_macro).

Second, make sure that CryptGenRandom() is actually called through the function pointer retrieved by the call to GetProcAddress() above.

And third, replace _getpid() with the [equivalent] (https://github.com/mirrors/wine/blob/7e136d68f7625b61afeb61b003b9602124a4c74d/dlls/msvcrt/process.c#L1319) and more ubiquitous Win32 API function `GetCurrentProcessId()`. Since _getpid() is not exported by all C runtimes on Windows (most notably the Driver Development Kit), using it might introduce previously unneeded runtime dependencies. `GetCurrentProcessId()`, on the other hand, has been available in kernel32.dll since at least Windows 95, just like the other API functions used in this code (`GetModuleHandle()` and `GetProcAddress()`).