Bruno Jesus 00cpxxx@gmail.com writes:
- /* Zero sized buffer should work too */
- ret = pBCryptGenRandom(NULL, buffer, 0, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
- ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
- /* Test random number generation - It's impossible for a sane RNG to return 8 zeros */
- rnd[0] = 0;
- rnd[1] = 0;
- ret = pBCryptGenRandom(NULL, buffer, sizeof(DWORD) * 2, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
- ok(ret == STATUS_SUCCESS, "Expected success, got 0x%x\n", ret);
- ok(rnd[0] || rnd[1], "Expected a random number, got 0\n");
- trace("BCryptGenRandom : %08X%08X\n", rnd[0], rnd[1]);
There's no reason to work with DWORDs, the function returns bytes, just use that directly.