Table of Contents

This is part of Family API which allow to create dual-os version of program runs under OS/2 and DOS

Note: This is legacy API call. It is recommended to use 32-bit equivalent

2021/09/17 04:47 · prokushev · 0 Comments
2021/08/20 03:18 · prokushev · 0 Comments

DosGetCtryInfo

This call obtains country-dependent formatting information that resides in the country information file.

Syntax

DosGetCtryInfo (Length, Country, MemoryBuffer, DataLength)

Parameters

The data is returned in the buffer in the following format:

Value Definition
0 mm/dd/yy
1 dd/mm/yy
2 yy/mm/dd
The currency bit fields in the following format:
Bit Description
7-3 Reserved
2 0 = Bits 0 and 1 are used. 1 = Bits 0 and 1 are ignored; the currency indicator replaces the decimal indicator.
1 0 = No space between the currency indicator and money value. 1 = One space between the currency indicator and money value.
0 0 = Currency indicator precedes the money value. 1 = Currency indicator follows the money value.
Time format for presentation in file directory:
Bit Description
7-1 Reserved
0 0 = 12-hour format 1 = 24-hour format

Returns

Return code descriptions are:

Remarks

The returned country dependent information may be for the default country and current process code page, or for a specific country and code page. For more information on code page, see DosSetCp.

Family API Considerations

Some options operate differently in DOS mode than in OS/2 mode. Note that not all country information is available in DOS 3.3.

Bindings

C Binding

typedef struct _COUNTRYCODE {   /* ctryc */
 
  USHORT country;               /* country code */
  USHORT codepage;              /* code page */
 
} COUNTRYCODE;
 
typedef struct _COUNTRYINFO {   /* ctryi */
 
  USHORT country;                   /* country code */
  USHORT codepage;                  /* code page */
  USHORT fsDateFmt;                 /* date format */
  CHAR   szCurrency[5];             /* currency indicator */
  CHAR   szThousandsSeparator[2];   /* thousands separator */
  CHAR   szDecimal[2];              /* decimal separator *  /
  CHAR   szDateSeparator[2];        /* date separator */
  CHAR   szTimeSeparator[2];        /* time separator */
  UCHAR  fsCurrencyFmt;             /* bit fields for currency format */
  UCHAR  cDecimalPlace;             /* currency decimal places */
  UCHAR  fsTimeFmt;                 /* Time format (AM/PM or 24 hr) */
  USHORT abReserved1[2];            /* reserved (0) */
  CHAR   szDataSeparator[2];        /* Data list separator */
  USHORT abReserved2[5];            /* reserved (0) */
 
} COUNTRYINFO;
 
#define INCL_DOSNLS
 
USHORT  rc = DosGetCtryInfo(Length, Structure, MemoryBuffer, DataLength);
 
USHORT           Length;        /* Length of data area provided */
PCOUNTRYCODE     Structure;     /* Input data structure */
PCOUNTRYINFO     MemoryBuffer;  /* Country information (returned) */
PUSHORT          DataLength;    /* Length of data (returned) */
 
USHORT           rc;            /* return code */

Example

This example gets country-dependent information.
 
#define INCL_DOSNLS
 
#define CURRENT_COUNTRY 0
#define NLS_CODEPAGE 850
 
COUNTRYCODE Country;
COUNTRYINFO CtryBuffer;
USHORT      Length;
USHORT      rc;
 
   Country.country = CURRENT_COUNTRY;
   Country.codepage = NLS_CODEPAGE;
 
   rc = DosGetCtryInfo(sizeof(CtryBuffer), /* Length of data area provided */
                       &Country,           /* Input data structure */
                       &CtryBuffer,        /* Data area to be filled by function */
                       &Length);           /* Length of data returned */

MASM Binding

COUNTRYCODE struc
  ctryc_country   dw  ? ;country code
  ctryc_codepage  dw  ? ;code page
COUNTRYCODE ends
 
COUNTRYINFO struc
  ctryi_country              dw  ? ;country code
  ctryi_codepage             dw  ? ;code page
  ctryi_fsDateFmt            dw  ? ;date format
  ctryi_szCurrency           db  5 dup (?) ;currency indicator
  ctryi_szThousandsSeparator db  2 dup (?) ;thousands separator
  ctryi_szDecimal            db  2 dup (?) ;decimal separator
  ctryi_szDateSeparator      db  2 dup (?) ;date separator
  ctryi_szTimeSeparator      db  2 dup (?) ;time separator
  ctryi_fsCurrencyFmt        db  ? ;bit fields for currency format
  ctryi_cDecimalPlace        db  ? ;currency decimal places
  ctryi_fsTimeFmt            db  ? ;Time format (AM/PM or 24 hr)
  ctryi_abReserved1          dw  2 dup (?) ;reserved (0)
  ctryi_szDataSeparator      db  2 dup (?) ;Data list separator
  ctryi_abReserved2          dw  5 dup (?) ;reserved (0)
COUNTRYINFO ends
 
EXTRN  DosGetCtryInfo:FAR
INCL_DOSNLS         EQU 1
 
PUSH   WORD    Length        ;Length of data area provided
PUSH@  OTHER   Structure     ;Input data structure
PUSH@  OTHER   MemoryBuffer  ;Country information (returned)
PUSH@  WORD    DataLength    ;Length of data (returned)
CALL   DosGetCtryInfo
 
Returns WORD

Note

Text on based http://www.edm2.com/index.php/DosGetCtryInfo