API Function Calls
Jump to navigation
Jump to search
By Bill Earle
The following information describes the OS/2 Application Program Interface (API) calls. I have included information under the API column as follows:
- F
- is a Family API (FAPI) call. This means that this call will also run under DOS 3.3, if assembled with the BIND program.
- R
- means Restricted function. Refer to the OS/2 Technical Reference Manual for further info.
I also have attempted to provide information to assist in porting old programs over to OS/2. INT and SUBCODE columns provide the old DOS interrupt and subcode functions. In some cases, these are approximations of old DOS calls. Again, refer to the OS/2 Technical Reference Manual for further information.
API | INT | SUBCODE | FUNCTION | DESCRIPTION |
---|---|---|---|---|
F | BadDynLink | Called on bad dynamic link | ||
R | DosAllocHuge | Allocate memory greater than one segment | ||
R | 21H | 48H | DosAllocSegment | Allocate a segment of memory |
DosAllocShrSeg | Allocate a shared-memory segment. The segment returned has a name that each process can access. | |||
F | DosBeep | Generate a sound frequency for the specified duration | ||
21H | 0DH,68H | DosBufReset | Flush the disk buffers for the requesting process | |
F | DosCaseMap | Map a binary string into an ASCII string by using a DOS code-page | ||
F | 21H | 3BH | DosChdir | Set the current directory |
F | 21H | 42H | DosChgFilePtr | Move a file's read/write pointer |
F | DosCLIAccess | Request CLI/STI privilege before performing IN/OUT operations. | ||
F | 21H | 3EH | DosClose | Close the file associated with the specified file handle |
DosCloseQueue | Close the queue specified for use by the calling process | |||
DosCloseSem | Close the semaphore specified for use by the calling process | |||
F | DosCreateCSAlias | Create an executable alias descriptor (second name) for the data type descriptor received | ||
DosCreateQueue | Create and open the queue specified for use by the calling process | |||
DosCreatSem | Create a semaphore for use by the calling process | |||
DosCreateThread | Create an asynchronous execution thread for the calling process. Threads are the OS/2 CPU scheduling entities. | |||
R | 21H | 4DH | DosCWait | Wait for a child process termination and get return code |
F | 21H | 41H | DosDelete | Delete the file specified by the ASCIIZ name. |
F | DosDevConfig | Return device information about attached devices | ||
F | 21H | 44H | DosDevIOCtl | Communicate with an opened device handle |
F | 21H | 45H,46H | DosDupHandle | Return a duplicate DOS handle for the file handle provided |
DosEnterCritSec | Mark the entrance of a critical section of code and prevent the execution of other threads of code in the same process for concurrent processing synchronization | |||
R | DosError | Allow the calling process to receive OS/2 hard-error notification as Opposed to the OS/2 generation of a hard-error signal | ||
R | 21H | 59H | DosErrorClass | Get extended error information. |
R | 21H | 4BH | DosExecPgm | Spawn a secondary program as a child process |
R | 21H | 00H,4CH | DosExit | Complete the current thread of information |
DosExitCritSec | Mark the end of a critical section of code and enable other threads within the current process to execute again in a concurrent fashion | |||
DosExitList | Maintain the list (add,delete,modify) of routines that the current process is to execute upon completion | |||
R | 21H | 5CH | DosFileLock | Lock or unlock a range of bytes within a file in support of file-sharing operations |
R | DosFindClose | Close the handle associated with the file returned by a DosFindNext API service | ||
R | 21H | 4EH | DosFindFirst | Find the first file in a group of files matching the file specification provided |
R | 21H | 4FH | DosFindNext | Find the next file in a group of files matching the file specification provided in the call to DosFindFirst |
DosFlagProcess | Set an external event flag that other processes can access for synchronization of concurrent processes | |||
DosFreeModule | Release the link to the dynamic link module specified by the module handle.
This service decrements the usage for the specified module | |||
F | 21H | 49H | DosFreeSeg | Release a previously allocated memory segment |
F | DosGetCollate | Get the current collating sequence based upon the current code-page | ||
21H | 66H | DosGetCP | Return the code-page in use by the current application | |
R | 21H | 38H | DosGetCtryInfo | Return country dependent formatting information |
F | 21H | 2AH,2CH | DosGetDateTime | Return the current date and time |
21H | 65H | DosGetDBCSEnv | Return the DBCS vector for the specified country code | |
F | DosGetEnv | Return the segment and offset address of the current process command environment | ||
F | DosGetHugeShift | Return the shift count used by DosAllocHuge to allocate memory larger than one segment | ||
DosGetInfoSeg | Return the address of the OS/2 system variables | |||
F | DosGetMachineMode | Return the current processor mode (real or Protected) | ||
F | DosGetMessage | Obtain the text from the system message file for the specified message and place it into a user-defined buffer | ||
DosGetModHandle | Return a handle to a dynamic link module | |||
DosGetModName | Get the complete DOS path name for the dynamic link module associated with the file handle provided | |||
DosGetProcAddr | Return the far address to the procedure specified within a dynamic link library | |||
DosGetPrty | Return the priority of the current process | |||
DosGetResource | Return the segment selector for the handle to the specified resource | |||
DosGetSeg | Obtain access to the memory segment specified by the selector provided | |||
DosGetShrSeg | Obtain access to the shared memory segment specified by the name provided. The usage count of the segment is incremented | |||
F | 21H | 30H | DosGetVersion | Return the DOS version number |
DosGiveSeg | Allow the process specified by the process identification provided to access a shared memory segment | |||
R | DosHoldSignal | Enable/disable signal processing for the current process | ||
F | DosInsMessage | Place a text string into the body of a message | ||
DosKillProcess | Terminate a process and return a termination code to the parent process or OS/2 | |||
DosLoadModule | Load the dynamic link module specified and return a handle. | |||
DosLockSeg | Lock a segment of memory marked as discardable | |||
DosMakePipe | Create a communications pipe for the calling process | |||
DosMemAvail | Return the size of the largest block of memory available | |||
F | 21H | 39H | DosMkDir | Create the specified directory |
DosMonClose | Close the handle to a serial device that the process has been monitoring | |||
DosMonOpen | Open a handle to a serial device for device I/O monitoring | |||
DosMonRead | Wait for and return the input records to a serial device open for I/O monitoring | |||
DosMonReg | Create input and output buffer structures for device I/O monitoring | |||
DosMonWrite | Write a data record to the output monitor buffer of a device open for I/O monitoring | |||
F | 21H | 56H | DosMove | Move a file from one location to another |
DosMuxSemWait | Suspense the execution of the current thread until one or more semaphores have been cleared | |||
F | DosNewSize | Change the size of the file associated with the specified file handle | ||
R | 21H | 3CH,3DH | DosOpen | Open an existing file (if present) or create a file with the name specified by the ASCIIZ string provided |
DosOpenQueue | Open the queue specified by the ASCIIZ string provided for use by the current process | |||
DosOpenSem | Open the semaphore specified by the ASCIIZ string provided for use by the current process | |||
DosPeekQueue | Examine, but do not remove, an element from the specified queue | |||
DosPFSActivate | Activate the code-page and font specified for the printer. This activation only affects the calling process. | |||
DosPFSCloseUser | Notify the font-switching software that the process has closed its spool file. The font-switching software can release any related resources | |||
DosPFSInit | Direct the font-switching software to initialize code-page switching and font-switching for the specified printer | |||
DosPFSQueryAct | Return the current code-page and font for the specified printer | |||
DosPFSVerifyFont | Ensure that the code-page and font desired are supported by the specified printer | |||
DosPhysicalDisk | Return partitioned disk information | |||
F | DosPortAccess | Request or release access to a hardware port or ports | ||
DosPtrace | Set a Ptrace buffer that is used in debugging | |||
DosPurgeQueue | Delete all of the elements contained in the queue associated with the handle provided | |||
DosPutMessage | Output the message provided to the file or device associated with a given file handle | |||
F | 21H | 47H | DosQCurDir | Return the current directory |
F | 21H | 19H | DosQCurDisk | Return the current disk drive |
R | DosQFHandState | Query the state of the file associated with the handle provided | ||
F | 21H | 57H | DosQFileInfo | Return date and time specifics about the file associated with the file handle provided |
F | 21H | 43H | DosQFileMode | Return the attribute byte for a specific file |
F | 21H | 36H | DosQFSInfo | Return information about the disk in the specified drive |
DosQHandType | Determine if the handle specified references a device or file | |||
DosQueryQueue | Return the number of elements in the specified queue | |||
F | 21H | 54H | DosQVerify | Determine whether the specified queue is active or inactive |
F | 21H | 3FH | DosRead | Read the specified number of bytes from the file associated with the file handle |
DosReadAsynch | Read the specified number of bytes from the file associated with the file handle. The I/O operation occurs concurrently with the continued execution of the process | |||
DosReadQueue | Read and remove an element from the specified queue | |||
R | DosReallocHuge | Modify the size of a previously allocated huge (larger than 1 segment) section of memory | ||
R | 21H | 4AH | DosReallocSeg | Modify the size of a previously allocated memory segment |
DosResumeThread | Restart a previously suspended thread of execution for the current process | |||
F | 3AH | DosRmDir | Remove the directory specified by the ASCIIZ string | |
F | DosScanEnv | Search a process environment segment for a specified variable and return its value if found | ||
DosSearchPath | Define a search path for data files | |||
F | 21H | 0EH | DosSelectDisk | Set the desired current drive |
DosSelectSession | Select the desired foreground session | |||
DosSemClear | Clear the specified semaphore | |||
DosSemRequest | Obtain a new handle to a new semaphore | |||
DosSemSet | Set the semaphore associated with the handle provided | |||
DosSemSetWait | Set the semaphore associated with the handle provided and suspend execution of the current thread until the semaphore is cleared | |||
DosSemWait | Suspend execution of the current thread until the semaphore associated with the handle provided is cleared | |||
DosSendCtlC | Send a Ctrl-C signal to the lowest process in the tree of processes | |||
21H | 66H | DosSetCP | Set the code-page as specified for the calling process | |
F | 21H | 2BH,2DH | DosSetDateTime | Set the current system date and time |
R | DosSetFHandState | Set the state of the file associated with the handle provided | ||
F | 21H | 57H | DosSetFileInfo | Set the date information (last read, last write, creation, and so on) for the file associated with the handle provided |
F | 21H | 43H | DosSetFileMode | Set the attribute byte for the file associated with the file handle provided |
F | DosSetFsInfo | Sets information for a file system specified device | ||
21H | 67H | DosSetMaxFH | Define the maximum number of file handles (up to 255) for the current process | |
DosSetPrty | Set the priority for the current thread | |||
DosSetSession | Set the status of a child process | |||
R | DosSetSigHandler | Define a signal-handling routine for a specific signal | ||
F | 21H | 25H | DosSetVec | Define an exception-handling routine for specified exceptions |
F | 21H | 2EH | DosSetVerify | Enable or disable disk verification for the current process |
DosSleep | Suspend the current thread for a specified interval of time | |||
DosStartSession | Invoke a second application as an OS/2 session | |||
DosStopSession | Terminate a session previously invoked thru the DosStartSession | |||
F | DosSubAlloc | Allocate memory from within a segment previously allocated by DosAllocSeg or DosAllocShrSeg | ||
F | DosSubFree | Free memory previously allocated by DosSubAlloc | ||
F | DosSubSet | Initialize a segment for suballocation, or change the size of a previously suballocated segment | ||
DosSuspendThread | Suspend the current thread of execution until a DosResumeThread service is invoked | |||
DosSystemService | Request OS/2 to perform a unique function (such as system-wide event notification for the specific process) | |||
DosTimerAsynch | Start a timer that runs asynchronously to the thread issuing the request. Upon completion of the time interval, this service sets the specified semaphore | |||
DosTimerStart | Start a periodic interval timer that runs asynchronously to the current thread. Each time the interval completes, the service clears the specified semaphore | |||
DosTimerStop | Stop a periodic interval timer previously started by DosTimerStart or DosTimerAsynch | |||
DosUnlockSeg | Unlock a memory segment previously marked as discardable | |||
DosWait | Suspend the current process until the child process specified by the provided process identification terminates | |||
F | 21H | 40H | DosWrite | Write the specified number of bytes to the file associated with the file handle provided |
DosWriteAsynch | Write the specified number of bytes to the file associated with the file handle that is provided concurrently with the threads remaining processing | |||
DosWriteQueue | Place an element in a specified queue |
API | INT | SUBCODE | FUNCTION | DESCRIPTION |
---|---|---|---|---|
F | 16H | 00H | KbdCharIn | Return the character scan code from the standard input device |
KbdClose | Close a handle associated with a logical (unique to a process) keyboard | |||
KbdCustCP | Install a user-definable custom keyboard translation table. The table only affects the keyboard handle provided | |||
KbdDeRegister | Remove a previously registered keyboard from the current session | |||
F | KbdFlushBuffer | Clear the keyboard buffer for a specific keyboard handle | ||
KbdFreeFocus | Release the logical-to-physical keyboard mapping produced by KbdGetFocus | |||
KbdGetFocus | Join a logical (process unique) keyboard to a physical keyboard | |||
F | 16H | 00H | KbdGetStatus | Return information about a specific logical keyboard |
KbdGetXT | Obtain information from the current keyboard translation table | |||
KbdOpen | Open a logical keyboard and return a keyboard handle | |||
R | 16H | 00H | KbdPeek | Return, but do not remove, a keyboard scan code if present in the keyboard buffer associated with the keyboard handle provided |
KbdRegister | Register a keyboard subsystem for a specific session | |||
KbdSetFgnd | Increase the priority of the foreground key board thread | |||
KbdSetStatus | Set the size characteristics for a logical keyboard | |||
KbdSetXT | Set the keyboard translation table for a logical keyboard | |||
KbdShellInit | Request the shell to identify itself to the keyboard routing software | |||
F | 21H | 0AH | KbdStringIn | Read a character string from a logical keybd |
KbdSynch | Synchronize access to the keyboard subsystem | |||
KbdXlate | Translate a scan code into a shift state and ASCII code |
API | INT | SUBCODE | FUNCTION | DESCRIPTION |
---|---|---|---|---|
MouClose | Close the mouse device handle for the current screen group | |||
MouDeRegister | Remove a partially registered mouse subsystem for the current session | |||
33H | 01H | MouDrawPtr | Notify the mouse device driver that a screen area previously restricted from access is now available | |
MouFlushQueue | Direct the mouse device driver to purge the mouse event queue for the current session | |||
MouGetDevStatus | Return the current mouse device driver settings | |||
MouGetEventMask | Return the event mask for the current mouse device driver | |||
MouGetHotKey | Return the specific mouse key used for input (left, middle, or right) | |||
MouGetNumButtons | Return the number of buttons that the mouse driver supports | |||
MouGetNumMickeys | Return the number of "Mickeys" per centimeter for the current mouse driver | |||
MouGetNumQueEl | Return the status of the event queue for the current mouse device driver | |||
33H | 03H | MouGetPtrPos | Return the current row and column of the mouse pointer shape | |
MouGetPtrShape | Obtain the current mouse pointer shape | |||
MouGetScaleFact | Return the current scaling factors for the mouse pointer shape | |||
MouInitReal | Initialize the mouse real-mode pointer | |||
33H | 00H | MouOpen | Open a mouse device driver for the current screen group. Return a device handle | |
33H | 05H,06H | MouReadEventQue | Read and remove an event from the current mouse driver event queue | |
MouRegister | Register a mouse subsystem for use with the current screen group | |||
33H | 02H | MouRemovePtr | Restrict a screen area from use by the mouse pointer | |
MouSetDevStatus | Set the current mouse device driver status flags | |||
33H | 0CH | MouSetEventMask | Assign an event mask to the current mouse device driver | |
MouSetHotKey | Define which button (left, middle, or right) serves as the hot key for the current mouse driver | |||
33H | 04H | MouSetPtrPos | Set the mouse pointer screen coordinates | |
33H | 09H,0AH | MouSetPtrShape | Set the mouse pointer shape | |
MouSetScaleFact | Set the scaling factor for the mouse pointer shape | |||
MouShellInit | Mouse shell indentifies itself to the mouse router | |||
MouSynch | Direct mouse subsystems to synchronize access to the mouse device driver |
API | INT | SUBCODE | FUNCTION | DESCRIPTION |
---|---|---|---|---|
VioDeRegister | Remove a previously registered video subsystem from a screen group | |||
VioEndPopUp | Remove a temporary window created by VioPopUp that is no longer required | |||
VioGetAnsi | Specify whether ANSI support is on or off for the current video buffer | |||
F | VioGetBuf | Return the address of the logical (process unique) video buffer specified | ||
VioGetCP | Return the code-page used for display by the specified handle | |||
VioGetConfig | Return the current video display configuration | |||
F | 10H | 03H | VioGetCurPos | Return the current row and column cursor position for the specified logical video buffer |
F | VioGetCurType | Return the cursor type and attributes for the specified logical video buffer | ||
VioGetFont | Return the current font for the specified logical video buffer | |||
F | 10H | 0FH | VioGetMode | Return the current video mode for the specified logical video buffer |
F | VioGetPhysBuf | Return the address of the physical video buffer | ||
VioGetState | Return the current video states, or the palette registers, the border color, or background intensity | |||
VioModeUndo | Allow one process thread to cancel a VioModeWait service issued by another thread in the same process | |||
VioModeWait | Request that a graphics mode application be notified each time it needs to restore its video mode | |||
VioPopUp | Allocate a temporary popup display screen for message display | |||
VioPrtSc | Print the current screen contents | |||
VioPrtScToggle | The OS/2 session manager invokes this routine each time the user presses the Shift-PrtSc key combination | |||
F | 10H | 08H | VioReadCellStr | Read a string of characters and attributes from the screen starting at a specified row and column location |
F | VioReadCharStr | Read a character string from the display starting at ther specified row and column | ||
VioRegister | Register a video subsystem with a specific screen group | |||
VioSavRedraw | Request that a process be notified when it must save or redraw its contents | |||
VioSavRedrawUndo | Allow one thread in a process to cancel a | |||
VioSavRedrawWait | service issued by another thread within the same process | |||
F | 10H | 07H | VioScrollDn | Scroll the screen contents down as specified by the row and column numbers and number of lines to scroll |
VioScrLock | Lock the screen and prevent I/O operations | |||
F | VioScrollLf | Scroll the screen contents to the left as specified | ||
F | VioScrollRt | Scroll the screen contents to the right as specified | ||
F | 10H | 06H | VioScrollUp | Scroll the screen contents up as specified by the row and column numbers and number of lines to scroll |
VioScrUnlock | Unlock the screen for I/O operations | |||
VioSetAnsi | Enable or disable ANSI support for the specified logical video buffer | |||
VioSetCP | Set the code-page for the specified logical video buffer | |||
VioSetCurPos | Set the cursor position to the row and column of the logical video buffer provided | |||
F | 10H | 02H | VioSetCurType | Set the cursor type (attributes) for the logical video display provided |
VioSetFont | Set the font for the logical video display | |||
F | 10H | 00H | VioSetMode | Set the display mode for the logical video display provided |
10H | 0BH | VioSetState | Set the state for the palette registers, border color, or background intensity for the specified logical video display | |
F | VioShowBuf | Update the physical display with the contents of a logical display buffer | ||
F | 10H | 09H | VioWrtCellStr | Write a character string (with attributes) to the specified video display location |
F | 10H | 0AH | VioWrtCharStr | Write a character string to the specified vidoe display location |
F | VioWrtCharStrAtt | Write a character string using a repeated attribute to the specified video display | ||
F | VioWrtNAttr | Write the character attribute to the video display at the specified location. This service provides an optional repeat count | ||
F | VioWrtNCell | Write a character or attribute to the video display the specified number of times | ||
F | VioWrtNChar | Write a character to the video display starting at the specified location and repeating the display n times | ||
F | 10H | 0EH | VioWrtTty | Write a character string to the video display starting at the current cursor position in TTY mode |