en:docs:fapi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:fapi [2020/11/23 13:20] – [Function Calls] prokusheven:docs:fapi [2022/02/16 15:02] (current) prokushev
Line 1: Line 1:
-{{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 2 versions of original Family API 1.00 and 1.10. Also exists side Family API implementation. FAMAPI by Jonathan de Boyne Pollard and HX DOS Extender API by Andreas Grech. 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 ======
Line 17: Line 17:
 ====== Writing portable tools ====== ====== Writing portable tools ======
  
-As example of dual mode program lets clone EXEHDR tools from OS/2 and Windows SDK/ToolkitFirst 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> +====== Documentation ======
-  #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 ======+[[en:docs:fapi:functions|Function reference]]
  
-OS/2 1.0 introduced 93(?) function calls that could be used in FAPI programs.+======Compatibility======
  
-Name                               Description                                              Module (OS/2) ^ Library (DOS Status (OS/2) ^ Status (DOS) +   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 
-[[en:docs:fapi:BadDynLink]]        |                                                          |                  --              | API/FAPI | -- | | +Max memory          640KB                16MB  ((Actually depends on DPMI host and current CPU)) |16MB 
-| [[en:docs:fapi:DosBeep]]           | Generates sound from the speaker                         | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | +Virtual memory      | No                   No   1Gb 
-| [[en:docs:fapi:DosBufReset]]       | Flushes a file cache buffers                             | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | +Multitasking        No                   No   Yes 
-| [[en:docs:fapi:DosChDir]]          Defines the current directory for the requesting process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | +Multithreading      No                   No   Yes 
-| [[en:docs:fapi:DosChgFilePtr]]     | Moves the read/write pointer                             | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | +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.??)) 
-| [[en:docs:fapi:DosClose]]          | Closes a handle to a file, pipe, or device               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | +Extended attributes Yes ((Under OS/2 BOX only))               Yes ((Under OS/2 BOX only)) Yes ((Starting from OS/2 1.??)) 
-[[en:docs:fapi:DosCreateCSAlias]]  | Create CS alias from data segment                        | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | +App EXE name change Yes ((Under DOS 3 and higher))  Yes ((Under DOS 3 and higher))   Yes |
-| [[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]]        |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | +
-| [[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]]                                                                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | +
-| [[en:docs:fapi:DosQFileMode]]                                                               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | +
-[[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 | | |+
  
  
-======Limitations====== 
  
-=== Real Mode === +====== Remarks ======
-  *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 === +For implementation details refer to [[en:docs:fapi:Implementation details]] section.
- +
-  *16 MB memory +
-  *1GB virtual address space+
  
 ====== Notes ====== ====== Notes ======