Both sides previous revisionPrevious revisionNext revision | Previous revision |
en:docs:fapi [2020/11/24 14:07] – [Function Calls] prokushev | en:docs:fapi [2024/04/30 15:22] (current) – prokushev |
---|
{{logos:os2.gif?35x35}} {{logos:dos.gif?35x35}} | {{page>en:templates:fapiint}} |
| |
====== Family API ====== | ====== Family API ====== |
| |
Family API (FAPI) is a subset of [[en:docs:os2:api:cpi|Control Program API]] which can be used to write binary portable applications. Such applications can be run as on OS/2 as on DOS system without any modifications. | Family API (FAPI) is a subset of [[en:docs:os2:api:cpi|Control Program API]] which can be used to write binary portable applications. Such applications can be run as on OS/2 as on DOS system without any modifications. |
| |
| It is known 3 versions of original Family API 1.00, 1.10 and [[https://github.com/microsoft/MS-DOS/tree/main/v4.0/src/MAPPER|Mapper]] from MS-DOS 4.0. |
| |
| Also exists side Family API implementation: |
| * FAMAPI by [[http://jdebp.info/Softwares/famapi.html|Jonathan de Boyne Pollard]] |
| * HX DOS Extender API by [[https://github.com/Baron-von-Riedesel/HX|Andreas Grech]] |
| * os2api by [[https://github.com/malxau/os2api|Malcolm Smith]] |
| |
| Versions up to 1.10 is a original OS/2 Family API. 1.20 and higher is a osFree extensions. |
| |
====== Dual OS applications ====== | ====== Dual OS applications ====== |
====== Writing portable tools ====== | ====== Writing portable tools ====== |
| |
As example of dual mode program lets clone EXEHDR tools from OS/2 and Windows SDK/Toolkit. First of all consider we writing program for OS/2. Other things will be done later to make dual mode program. | [[http://www.edm2.com/index.php/Hints_for_writing_simple_programs_for_both_OS/2_and_DOS]] |
| |
#include <os2.h> | |
#include <newexe.h> | |
| |
exe_hdr mz_hdr; | |
new_exe ne_hdr; | |
| |
void main(void) | |
{ | |
DosOpen(FileHandle); | |
DosRead(FileHandle, mz_hdr); | |
DumpMZ(mz_hdr); | |
if (is_extended_exe(mz_hdr)) | |
{ | |
DosRead(FileHandle, buffer); | |
if (is_NE(buffer)) DumpNE((new_exe)buffer); | |
} | |
DosClose(FileHandle); | |
} | |
| |
====== Function Calls ====== | ====== Documentation ====== |
| |
OS/2 1.0 introduced 93(?) function calls that could be used in FAPI programs. | [[en:docs:fapi:functions|Function reference]] |
| |
^ Name ^ Description ^ Module (OS/2) ^ Library (DOS) ^ Status (OS/2) ^ Status (DOS) ^ | ======Compatibility====== |
| [[en:docs:fapi:BadDynLink]] | | -- | API/FAPI | -- | | | |
| [[en:docs:fapi:DosBeep]] | Generates sound from the speaker | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosBufReset]] | Flushes a file cache buffers | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosChDir]] | Defines the current directory for the requesting process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosChgFilePtr]] | Moves the read/write pointer | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosClose]] | Closes a handle to a file, pipe, or device | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosCreateCSAlias]] | Create CS alias from data segment | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosDelete]] | Removes a directory entry associated with a file name | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosDevConfig]] | Return device configuration | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosDupHandle]] | Returns a new file handle for an open file | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosFreeSeg]] | Deallocates a memory segment | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosGetDateTime]] | Get the current date and time | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosGetEnv]] | Returns the address of the process environment string for the current process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosGetHugeShift]] | Returns a shift count used to derive the selectors that address memory allocated with DosAllocHuge | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosGetMachineMode]] | Returns the current mode of the processor | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosGetMessage]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosGetVersion]] | Returns the OS version number | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosInsMessage]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosMkDir]] | Creates a subdirectory | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosMove]] | Moves a file object to another location and changes its name | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosNewSize]] | Changes the size of a file | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosPutMessage]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosQCurDir]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosQCurDisk]] | Determines the current default drive for the requesting process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosQFileMode]] | Queries the mode (attribute) of the specified file | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | | |
| [[en:docs:fapi:DosQFSInfo]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosQVerify]] | Returns the value of the verify flag | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosRmDir]] | Removes a subdirectory from the specified disk | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosSelectDisk]] | Selects the drive specified as the default drive | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosSetDateTime]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetFileInfo]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetFileMode]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetVerify]] | Sets write verification | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | | |
| [[en:docs:fapi:DosSleep]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSubAlloc]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSubFree]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSubSet]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosWrite]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosAllocHuge]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosAllocSeg]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosCaseMap]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosDevIOCtl]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosError]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosExecPgm]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosExit]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosFileLocks]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosFindClose]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosFindFirst]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosFindNext]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosGetCtryInfo]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosGetDBCSEv]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosHoldSignal]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosOpen]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosQFileInfo]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosRead]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosReallocHuge]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosReallocSeg]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetCtryCode]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetFHandState]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:DosSetSigHandler]] | | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdCharIn]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdFlushBuffer]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdGetStatus]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdSetStatus]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdStringIn]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:KbdPeek]] | | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioGetBuf]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioGetCurPos]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioGetCurType]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioGetPhysBuf]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioReadCellStr]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioReadCharStr]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioScrollDn]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioScrollLf]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioScrollRt]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioScrUnLock]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioSetCurPos]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioSetCurType]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioSetMode]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioShowBuf]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtCellStr]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtCharStr]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtCharStrAtt]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtNAttr]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtNCell]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtNChar]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioWrtTTY]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| [[en:docs:fapi:VioScrLock]] | | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | | |
| |
| ^ Feature ^ DOS 16-bit Real Mode ^ DOS 16-bit Protected Mode ((Requires DPMI host with 16-bit client support)) ^ OS/2 16-bit Protected Mode ^ |
| | Max memory | 640KB | 16MB ((Actually depends on DPMI host and current CPU)) |16MB | |
| | Virtual memory | No | No | 1Gb | |
| | Multitasking | No | No | Yes | |
| | Multithreading | No | No | Yes | |
| | Long filenames | Yes ((Supported since version 1.20 Requires LFN driver under DOS or run in Windows 9x VDM.)) | Yes ((Supported since version 1.20 Requires LFN driver under DOS or run in Windows 9x VDM.)) | Yes ((Starting from OS/2 1.??)) | |
| | Extended attributes | Yes ((Under OS/2 BOX only)) | Yes ((Under OS/2 BOX only)) | Yes ((Starting from OS/2 1.??)) | |
| | App EXE name change | Yes ((Under DOS 3 and higher)) | Yes ((Under DOS 3 and higher)) | Yes | |
| |
======Limitations====== | |
| |
=== Real Mode === | |
*max. 640K memory | |
*no virtual address space | |
*no multitasking | |
*no undocumented OS services | |
*If the filename of an executable produced by BIND is changed, then it will not run under DOS 2.1. | |
| |
=== Protected Mode === | ====== Remarks ====== |
| |
*16 MB memory | For implementation details refer to [[en:docs:fapi:Implementation details]] section. |
*1GB virtual address space | |
| |
====== Notes ====== | ====== Notes ====== |