This DPMI 0.9 Specification is hosted by Tenberry Software, Inc.

8. Descriptor Management Services, Continued


[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]

8.1 Allocate Descriptors

This function is used to allocate one or more descriptors from the current Descriptor Table (GDT or LDT). The descriptor(s) allocated must be initialized by the application.

Availability:

DOS/4G, DOS/4GW Professional, DOS/4GW

To Call:

     AX = 0000h
     CX = Number of descriptors to allocate

Returns:

     If function was successful:
     Carry flag is clear.
     AX = Base selector

     If function was not successful:
     Carry flag is set.

Programmer's Notes:

Code Sample:

The following function compiles with Watcom C/C++ version 11.0 or later, and Microsoft Visual C/C++ version 4.0 or later:

// allocate one or more descriptors

int dpmiAllocateDescriptors(short num,	// how many descriptors wanted
			unsigned short *pSel)	// (returned) first selector allocated
	{
	int result;			// zero if int 31h succeeds
	unsigned short errorCode;	// error code from DPMI host

	__asm {
		mov	cx, num		// the number of descriptors we want

		mov	eax, 0x000	// call dpmi host to do allocation
		int	0x31

		mov	errorCode, ax	// save error code from DPMI, if any

		sbb	eax, eax	// record success/failure flag
		mov	result, eax
		}

	// if the dpmi call failed, return the dpmi error code
	if (result != 0)
		return errorCode;

	// otherwise, set the base selector, which was stored in errorCode
	*pSel = errorCode;

	// indicate success
	return 0;
	}

[Next Section] * [Previous Section] * [DPMI Index]
[Tenberry Home] * [Software Quality] * [DOS/4G] * [DOS/4GW] * [DOS/16M]
This HTML edition of the DPMI 0.9 Specification is hosted by Tenberry Software, Inc., makers of the DOS/16M and the DOS/4G family of DOS extenders. Page last modified 2003.1.28, <webmaster@tenberry.com>