+ pid = GetCurrentProcessId();
+ func(&pid, sizeof(pid));
+
+ if (!wincrypt_module) {
+ wincrypt_module = load_system32_dll("advapi32.dll");
+ GET_WINDOWS_FUNCTION(wincrypt_module, CryptAcquireContextA);
+ GET_WINDOWS_FUNCTION(wincrypt_module, CryptGenRandom);
+ GET_WINDOWS_FUNCTION(wincrypt_module, CryptReleaseContext);
+ }
+
+ if (wincrypt_module && p_CryptAcquireContextA &&
+ p_CryptGenRandom && p_CryptReleaseContext &&
+ p_CryptAcquireContextA(&crypt_provider, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT)) {
+ BYTE buf[32];
+ if (p_CryptGenRandom(crypt_provider, 32, buf)) {
+ func(buf, sizeof(buf));
+ }
+ p_CryptReleaseContext(crypt_provider, 0);
+ }
+