ZwAllocateLocallyUniqueId function

The ZwAllocateLocallyUniqueId routine allocates a locally unique identifier (LUID).


NTSYSAPI NTSTATUS ZwAllocateLocallyUniqueId(
  PLUID Luid



Pointer to a caller-allocated buffer to receive a copy of the source LUID structure. The buffer must be at least sizeof(LUID).

Return Value

ZwAllocateLocallyUniqueId returns STATUS_SUCCESS if the operation succeeds or the appropriate NTSTATUS value if the operation fails. If the output parameter cannot be written to, the routine returns STATUS_ACCESS_VIOLATION.


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

Note  If the call to the ZwAllocateLocallyUniqueId function occurs in user mode, you should use the name "NtAllocateLocallyUniqueId" instead of "ZwAllocateLocallyUniqueId".
For calls from kernel-mode drivers, the NtXxx and ZwXxx versions of a Windows Native System Services routine can behave differently in the way that they handle and interpret input parameters. For more information about the relationship between the NtXxx and ZwXxx versions of a routine, see Using Nt and Zw Versions of the Native System Services Routines.


Minimum supported client Available in Windows Vista and later versions of Windows.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
DDI compliance rules PowerIrpDDis, HwStorPortProhibitedDDIs, SpNoWait, StorPortStartIo

See Also


Using Nt and Zw Versions of the Native System Services Routines