AllocateLocallyUniqueId function (securitybaseapi.h)

The AllocateLocallyUniqueId function allocates a locally unique identifier (LUID).


BOOL AllocateLocallyUniqueId(
  [out] PLUID Luid


[out] Luid

A pointer to a LUID structure that receives the allocated LUID.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


The allocated LUID is unique to the local system only, and uniqueness is guaranteed only until the system is next restarted.

The allocated LUID is guaranteed to be nonzero if this function succeeds.


Requirement Value
Minimum supported client Windows XP [desktop apps | UWP apps]
Minimum supported server Windows Server 2003 [desktop apps | UWP apps]
Target Platform Windows
Header securitybaseapi.h (include Windows.h)
Library Advapi32.lib
DLL Advapi32.dll

See also

Access Control Overview

Basic Access Control Functions