Daniel Trebbien
Daniel Trebbien

Reputation: 39238

Is it possible to allocate a segment using the Windows API?

I am wondering if it is possible for a Windows program to allocate a segment descriptor within the process' local descriptor table. Is there a Windows API function that can install a new segment descriptor to the running process' LDT using a provided linear offset, segment length, and combination of flags (RWX)?

Upvotes: 4

Views: 855

Answers (1)

pezcode
pezcode

Reputation: 5769

It's possible using undocumented NT API, specifically NtSetLdtEntries. Note that Windows x86-64 does not set up an LDT so this only works on x86.

Here's some code.

Upvotes: 4

Related Questions