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/12/06 12:15] 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. It is known 2 versions of original Family API 1.00 and 1.10.+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/2Other 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]]
-<code c> +
-#include <os2.h> +
-#include <newexe.h>+
  
-exe_hdr mz_hdr; +====== Documentation ======
-new_exe ne_hdr;+
  
-void main(void) +[[en:docs:fapi:functions|Function reference]]
-+
-  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); +
-+
-</code>+
  
-====== Function Calls ======+======Compatibility======
  
-OS/2 1.0 introduced 93(?) function calls that could be used in FAPI programs.+^    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 |
  
-^ Name                               ^ Description                                              ^ Module (OS/2) ^ Library (DOS)  ^ Status (OS/2) ^ Status (DOS) ^ FAPI Version ^ 
-| [[en:docs:fapi:BadDynLink]]        |                                                          |                  --              | API/FAPI | -- | | 1.00 | 
-| [[en:docs:fapi:DosBeep]]           | Generates sound from the speaker                         | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosBufReset]]       | Flushes a file cache buffers                             | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.10 | 
-| [[en:docs:fapi:DosChDir]]          | Defines the current directory for the requesting process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosChgFilePtr]]     | Moves the read/write pointer                             | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosClose]]          | Closes a handle to a file, pipe, or device               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosCreateCSAlias]]  | Create CS alias from data segment                        | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosDelete]]         | Removes a directory entry associated with a file name    | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosDevConfig]]      | Return device configuration                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosDupHandle]]      | Returns a new file handle for an open file               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosFreeSeg]]        | Deallocates a memory segment                             | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosGetDateTime]]    | Get the current date and time                            | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosGetEnv]]         | Return the address of the process environment string for the current process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosGetHugeShift]]   | Return a shift count used to derive the selectors that address memory allocated with DosAllocHuge | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosGetMachineMode]] | Returns the current mode of the processor                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosGetMessage]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosGetVersion]]     | Returns the OS version number                            | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosInsMessage]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosMkDir]]          | Creates a subdirectory                                   | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosMove]]           | Moves a file object to another location and changes its name | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosNewSize]]        | Changes the size of a file                               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosPutMessage]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosQCurDir]]        | Returns the full path name of the current directory      | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosQCurDisk]]       | Determines the current default drive for the requesting process | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosQFileMode]]      | Queries the mode (attribute) of the specified file       | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosQFSInfo]]        | Query file system info                                   | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosQVerify]]        | Returns the value of the verify flag                     | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosRmDir]]          | Removes a subdirectory from the specified disk           | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosSelectDisk]]     | Selects the drive specified as the default drive         | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosSetDateTime]]    |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSetFileInfo]]    | Set attribute and extended attribute information for a file | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosSetFileMode]]    |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSetVerify]]      | Sets write verification                                  | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | Done | Done | 1.00 | 
-| [[en:docs:fapi:DosSleep]]          | Suspend the current thread for a specified time          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosSubAlloc]]                                                                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSubFree]]        |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSubSet]]                                                                  | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosWrite]]          | Write buffer to file                                     | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosAllocHuge]]      | Allocate multiple segments as a huge block of memory     | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosAllocSeg]]       | Allocate a data segment up to 64KB in size               | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | Done | 1.00 | 
-| [[en:docs:fapi:DosCaseMap]]        |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosDevIOCtl]]                                                                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosError]]          |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosErrClass]]                                                                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosExecPgm]]        |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosExit]]                                                                    | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosFileLocks]]      |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosFindClose]]      |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosFindFirst]]      |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosFindNext]]                                                                | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosGetCtryInfo]]    |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosGetDBCSEv]]      |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosGetCP]]          |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosSetCP]]          |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosGetCollate]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.10 | 
-| [[en:docs:fapi:DosHoldSignal]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosOpen]]                                                                    | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosQFileInfo]]      |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosRead]]                                                                    | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosReallocHuge]]    |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosReallocSeg]]                                                              | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSetCtryCode]]    |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSetFHandState]]  |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:DosSetSigHandler]]  |                                                          | [[en:docs:os2:modules:DOSCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdCharIn]]                                                                  | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdFlushBuffer]]    |                                                          | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdGetStatus]]      |                                                          | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdSetStatus]]      |                                                          | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdStringIn]]                                                                | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:KbdPeek]]                                                                    | [[en:docs:os2:modules:KBDCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioGetBuf]]                                                                  | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioGetCurPos]]      |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioGetCurType]]                                                              | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioGetPhysBuf]]                                                              | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioReadCellStr]]    |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioReadCharStr]]    |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioScrollDn]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioScrollLf]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioScrollRt]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioScrUnLock]]      |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioSetCurPos]]      |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioSetCurType]]                                                              | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioSetMode]]        |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioShowBuf]]        |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtCellStr]]                                                              | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtCharStr]]                                                              | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtCharStrAtt]]  |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtNAttr]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtNCell]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtNChar]]                                                                | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioWrtTTY]]                                                                  | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
-| [[en:docs:fapi:VioScrLock]]        |                                                          | [[en:docs:os2:modules:VIOCALLS]] | API/FAPI | | | 1.00 | 
  
  
-======Limitations======+====== Remarks ======
  
-=== DOS Real Mode === +For implementation details refer to [[en:docs:fapi:Implementation details]] section.
-  *max640K 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. +
- +
-=== OS/2 16-bit Protected Mode === +
- +
-  *16 MB memory +
-  *1GB virtual address space+
  
 ====== Notes ====== ====== Notes ======