This function is used to free descriptors that were allocated through the Allocate Descriptors function.
To Call
AX = 0001h
BX = Selector to free
Returns
If function was successful:
Carry flag is clear.
If function was not successful:
Carry flag is set.
Programmer's Notes
The following function compiles with Watcom C/C++ version 11.0 or later, and Microsoft Visual C/C++ version 4.0 or later:
// de-allocate one descriptor
int dpmiFreeDescriptor(unsigned short sel) // selector to release
{
int result; // zero if int 31h succeeds
unsigned short errorCode; // error code from DPMI host
__asm {
mov bx, sel // the selector to free
mov eax, 0x001 // call dpmi host to do freeing
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, indicate success
return 0;
}