|
-
Mar 13th, 2017, 10:42 AM
#10
Re: Here's a better way to generate random nums than using Rnd
 Originally Posted by Ben321
Also note that nowhere does it say that CryptGenRandom is equivalent to RtlGenRandom. In fact, common sense would say they are significantly different.
We must have different definitions of "common sense." Verification of dilettante's original statement, which is 100% correct:
On a default Windows XP and later install, CryptGenRandom calls into a function named ADVAPI32!RtlGenRandom, which does not require you load all the CryptAPI stuff.
@Steve: you are a good man to try and help a frequently aggressive forum member. The original code sample has a number of problems (you should generally always supply your own provider name, as the "default" one varies by system and is unpredictable - as you've discovered!), but if you want to continue to debug this, I'd check the value of Err.LastDllError after the initial call to CryptAcquireContext. This may have additional details.
Or you could just forgo this sample entirely, and manually request a known provider per the MSDN documentation. I think there are a number of code samples here in the forums that demonstrate this. (If not, feel free to start your own thread. You'd probably get a lot more participation from members that have learned to avoid threads from certain problematic participants.)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|