Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:docs:fapi:dosgetversion [2018/09/01 16:17] – prokushev | en:docs:fapi:dosgetversion [2021/10/17 06:28] (current) – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | {{logos:os2.gif? | + | {{page>en:templates:fapiint}} |
====== DosGetVersion ====== | ====== DosGetVersion ====== | ||
- | This call returns the OS/2 version number. | + | This call returns the OS version number. |
- | ==Syntax== | + | ===== Syntax ===== |
- | | + | |
- | ==Parameters== | + | <code c> |
- | ; | + | DosGetVersion |
+ | </code> | ||
- | ==Return Code== | + | ===== Parameters ===== |
- | rc (USHORT) - return | + | |
- | Return code description is: | + | |
- | * 0 NO_ERROR | + | |
- | ==Remarks== | + | * VersionWord ([[PUSHORT]]) - output: |
- | This function has been eliminated since OS/2 2.0. | + | |
- | ==Bindings== | + | ===== Return Code ===== |
- | ===C=== | + | |
- | < | + | |
- | #define INCL_DOSMISC | + | |
- | USHORT | + | * rc ([[USHORT]]) - return |
- | PUSHORT VersionWord; | + | |
- | USHORT | + | Return |
- | </ | + | |
- | ===MASM=== | + | * 0 NO_ERROR |
- | < | + | |
- | EXTRN DosGetVersion: | + | |
- | INCL_DOSMISC | + | |
- | PUSH@ WORD VersionWord | + | ===== Bindings ===== |
- | CALL | + | |
- | Returns WORD | + | ==== C ==== |
- | </PRE> | + | <code c> |
+ | #define INCL_DOSMISC | ||
+ | |||
+ | USHORT | ||
+ | PUSHORT VersionWord; | ||
+ | USHORT | ||
+ | </code> | ||
- | ==Example== | + | ==== MASM ==== |
- | The following example shows how one may obtain information for program initialization. The program locates the environment segment and prints the name of the command from the command line. It then obtains the OS/2 version number and prints it. | + | |
- | < | + | |
- | #define INCL_DOS | + | |
- | #include < | + | |
- | #define ENVVARNAME " | + | |
- | main() | + | <code asm> |
- | { | + | EXTRN DosGetVersion: |
- | | + | |
- | | + | |
- | | + | |
- | USHORT | + | |
- | | + | </code> |
- | | + | Returns WORD |
- | | + | |
- | /** Locate environment segment and offset of command line. **/ | + | ==== Example ==== |
- | if(!(rc=DosGetEnv(& | ||
- | & | ||
- | | ||
- | printf(" | ||
- | CmdOffset); | ||
- | /** Use a macro to make a far pointer out of selector: | + | The following example shows how one may obtain information for program initialization. The program locates the environment segment and prints the name of the command from the command line. It then obtains |
- | /** Notice | + | |
- | Commandline = MAKEP(EnvSel, | + | <code c> |
- | | + | |
- | + | | |
- | | + | |
- | | + | |
- | + | | |
- | | + | |
{ | { | ||
- | MajorVer = HIBYTE(Version) / 10; | + | |
- | MinorVer = LOBYTE(Version) / 10; | + | USHORT |
- | printf(" | + | PSZ FAR |
+ | USHORT | ||
+ | BYTE MajorVer; | ||
+ | BYTE MinorVer; | ||
+ | USHORT | ||
+ | |||
+ | /** Locate environment segment and offset of command line. **/ | ||
+ | |||
+ | if(!(rc=DosGetEnv(& | ||
+ | & | ||
+ | | ||
+ | printf(" | ||
+ | CmdOffset); | ||
+ | |||
+ | /** Use a macro to make a far pointer out of selector: | ||
+ | /** Notice the far-string pointer specification (%Fs) used to print **/ | ||
+ | |||
+ | Commandline = MAKEP(EnvSel, | ||
+ | printf(" | ||
+ | |||
+ | /** Obtain and print version info; use macros to extract info. **/ | ||
+ | /** We need to divide by 10 to obtain true version numbers. | ||
+ | |||
+ | if(!(rc=DosGetVersion(& | ||
+ | { | ||
+ | | ||
+ | MinorVer = LOBYTE(Version) / 10; | ||
+ | printf(" | ||
+ | } | ||
} | } | ||
- | } | + | </code> |
- | </PRE> | + | |
- | + | ||
- | ====== Note ====== | + | ===== Note ===== |
Text based on [[http:// | Text based on [[http:// |