---
name: "RtlAllocateHandle"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/RtlAllocateHandle"
---

# RtlAllocateHandle(3w)

## NAME

**RtlAllocateHandle** (NTDLL.@)

## SYNOPSIS

RTL\_HANDLE \* RtlAllocateHandle\
  (\
   RTL\_HANDLE\_TABLE\* *HandleTable*,\
   ULONG\*            *HandleIndex*\
  )

## DESCRIPTION

Allocates a handle from the handle table.

## PARAMS

*HandleTable* **\[In/Out\]**  The handle table.

*HandleIndex* **\[Out\]**  Index of the handle returned. Optional.

## RETURNS

**Success:** Pointer to allocated handle.

**Failure:** **NULL**.

## NOTES

A valid handle must have the bit set as indicated in the code below otherwise subsequent **[RtlIsValidHandle(3w)](/RtlIsValidHandle/3w.md)** calls will fail.

static inline void RtlpMakeHandleAllocated(**RTL\_HANDLE** \* Handle) { **ULONG\_PTR** \*AllocatedBit = (**ULONG\_PTR** \*)(&Handle*-\>Next*); \*AllocatedBit = \*AllocatedBit \| 1; }.

## SEE

RtlFreeHandle().

## IMPLEMENTATION

Declared in **"winternl.h"**.

Implemented in **"dlls/ntdll/handletable.c"**.

Debug channel **"ntdll"**.
