Click to Rate and Give Feedback
MSDN
MSDN Library
Security
Cryptography
 RtlGenRandom Function
RtlGenRandom Function

[The RtlGenRandom function is available for use in the operating systems listed in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use the CryptGenRandom function.]

The RtlGenRandom function generates a pseudo-random number.

Note  This function has no associated import library. This function is available as a resource named SystemFunction036 in Advapi32.dll. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Advapi32.dll.

Syntax

BOOLEAN RtlGenRandom(
  __out  PVOID RandomBuffer,
  __in   ULONG RandomBufferLength
);

Parameters

RandomBuffer [out]

A pointer to a buffer that receives the random number as binary data. The size of this buffer is specified by the RandomBufferLength parameter.

RandomBufferLength [in]

The length, in bytes, of the RandomBuffer buffer.

Return Value

If the function succeeds, the function returns TRUE.

If the function fails, it returns FALSE.

Remarks

When you have finished using the random number, free the RandomBuffer buffer by calling the SecureZeroMemory function.

Requirements

ClientRequires Windows Vista or Windows XP.
ServerRequires Windows Server 2008 or Windows Server 2003.
HeaderDeclared in Ntsecapi.h.
DLLRequires Advapi32.dll.

Send comments about this topic to Microsoft

Build date: 9/25/2008

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker