Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionLast revisionBoth sides next revision | ||
en:docs:fapi:dosgetversion [2018/08/31 09:08] – created prokushev | en:docs:fapi:dosgetversion [2021/09/17 06:16] – prokushev | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | This call returns the OS/2 version number. | + | {{page> |
- | ==Syntax== | + | ====== DosGetVersion |
- | DosGetVersion | + | |
- | ==Parameters== | + | This call returns |
- | ; | + | |
- | ==Return Code== | + | ===== Syntax ===== |
- | rc (USHORT) - return | + | |
- | Return code description is: | + | |
- | * 0 NO_ERROR | + | |
- | ==Remarks== | + | <code c> |
- | This function has been eliminated since OS/2 2.0. | + | DosGetVersion (VersionWord) |
+ | </code> | ||
- | ==Bindings== | + | ===== Parameters |
- | ===C=== | + | |
- | < | + | |
- | #define INCL_DOSMISC | + | |
- | USHORT | + | * VersionWord |
- | PUSHORT VersionWord; | + | |
- | USHORT | + | |
- | </ | + | |
- | ===MASM=== | + | ===== Return Code ===== |
- | < | + | |
- | EXTRN DosGetVersion: | + | |
- | INCL_DOSMISC | + | |
- | PUSH@ WORD VersionWord | + | |
- | CALL | + | |
+ | Return code description is: | ||
- | Returns WORD | + | * 0 NO_ERROR |
- | </ | + | |
- | ==Example== | + | ===== Bindings ===== |
- | 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() | + | ==== C ==== |
- | { | + | <code c> |
- | | + | #define INCL_DOSMISC |
- | USHORT | + | |
- | PSZ FAR | + | USHORT |
- | | + | |
- | | + | |
- | BYTE MinorVer; | + | </ |
- | USHORT | + | |
- | /** Locate environment segment and offset of command line. **/ | + | ==== MASM ==== |
- | | + | <code asm> |
- | & | + | EXTRN DosGetVersion: |
- | (returned) */ | + | INCL_DOSMISC |
- | | + | |
- | CmdOffset); | + | PUSH@ WORD VersionWord |
+ | | ||
+ | </code> | ||
+ | Returns WORD | ||
- | /** Use a macro to make a far pointer out of selector: | + | ==== Example ==== |
- | /** Notice the far-string pointer specification (%Fs) used to print **/ | + | |
- | Commandline = MAKEP(EnvSel, | ||
- | printf(" | ||
- | /** Obtain | + | The following example shows how one may obtain information for program initialization. The program locates the environment segment |
- | /** We need to divide by 10 to obtain true version | + | |
- | if(!(rc=DosGetVersion(& | + | <code c> |
+ | #define INCL_DOS | ||
+ | #include < | ||
+ | #define ENVVARNAME " | ||
+ | |||
+ | main() | ||
{ | { | ||
- | 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 ===== | ||
+ | Example code doesn' | ||
- | ====== Note ====== | + | ===== Note ===== |
Text based on [[http:// | Text based on [[http:// |