Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
en:docs:fapi:dosgetversion [2018/09/01 16:17] – prokushev | en:docs:fapi:dosgetversion [2018/09/01 16:41] – prokushev | ||
---|---|---|---|
Line 3: | Line 3: | ||
====== DosGetVersion ====== | ====== DosGetVersion ====== | ||
- | This call returns the OS/2 version number. | + | This call returns the OS version number. |
==Syntax== | ==Syntax== | ||
- | | + | |
+ | | ||
==Parameters== | ==Parameters== | ||
- | ;VersionWord (PUSHORT) - output: | + | |
+ | * VersionWord (PUSHORT) - output: | ||
==Return Code== | ==Return Code== | ||
- | rc (USHORT) - return | + | |
+ | * rc (USHORT) - return | ||
+ | | ||
Return code description is: | Return code description is: | ||
- | * 0 NO_ERROR | ||
- | ==Remarks== | + | * 0 NO_ERROR |
- | This function has been eliminated since OS/2 2.0. | + | |
==Bindings== | ==Bindings== | ||
===C=== | ===C=== | ||
- | <PRE> | ||
- | #define INCL_DOSMISC | ||
- | USHORT | + | #define INCL_DOSMISC |
- | PUSHORT VersionWord; | + | |
- | USHORT | + | |
- | </ | + | PUSHORT VersionWord; |
+ | USHORT | ||
===MASM=== | ===MASM=== | ||
- | <PRE> | ||
- | EXTRN DosGetVersion: | ||
- | INCL_DOSMISC | ||
- | PUSH@ WORD VersionWord | + | EXTRN DosGetVersion: |
- | CALL | + | INCL_DOSMISC |
+ | |||
+ | | ||
+ | CALL | ||
Returns WORD | Returns WORD | ||
- | </ | ||
==Example== | ==Example== | ||
- | 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. | ||
- | <PRE> | ||
- | #define INCL_DOS | ||
- | #include < | ||
- | #define ENVVARNAME " | ||
- | main() | + | 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 version number |
- | { | + | |
- | SEL | + | |
- | USHORT | + | |
- | PSZ FAR | + | |
- | USHORT | + | |
- | BYTE MajorVer; | + | |
- | BYTE MinorVer; | + | |
- | USHORT | + | |
- | | + | |
- | + | | |
- | | + | |
- | & | + | |
- | | + | |
- | printf("Environment located; selector is %x offset is %x\n", EnvSel, | + | |
- | CmdOffset); | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | 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(& | + | |
{ | { | ||
- | 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(" | ||
+ | } | ||
} | } | ||
- | } | ||
- | </ | ||
- | |||
- | |||
====== Note ====== | ====== Note ====== |