DosQueryMessageCP

DosQueryMessageCP retrieves the message file list of code pages and language identifiers.

Syntax
DosQueryMessageCP(pb, cb, pszFilename, cbBuf)

Parameters

 * pb (PCHAR) - output: Pointer to the caller's buffer area.
 * This buffer area is where the system returns the requested message file list of code pages and language identifiers.


 * cb (ULONG) - input: The length, in bytes, of pb.
 * pszFilename (PSZ) - input: The file specification of the message file.
 * The drive designation and path are optional. This specifies a file that was previously prepared by the MKMSGF utility program.


 * cbBuf (PULONG) - output: Pointer to the ULONG that receives the actual length, in bytes, of the returned data.


 * ulrc (APIRET) - returns:Return Code.
 * DosQueryMessageCP returns one of the following values:
 * 0 NO_ERROR
 * 2 ERROR_FILE_NOT_FOUND
 * 206 ERROR_FILENAME_EXCED_RANGE
 * 318 ERROR_MR_UN_ACC_MSGF
 * 319 ERROR_MR_INV_MSGF_FORMAT
 * 321 ERROR_MR_UN_PERFORM

Remarks
The system returns the requested message file list of code pages and language identifiers in the caller's buffer (pb). It has the following format:
 * {|class="wikitable"

!Length||Field This data structure is repeated for each subfile within the specified message file.
 * USHORT||Code page count (N)
 * USHORT||Code page identifier. This field occurs N times, once per code page.
 * ULONG||Language identifier
 * }
 * ULONG||Language identifier
 * }
 * }

The code page identifier can have the values specified in COUNTRYCODE.

The language identifier is a ULONG. The low-order word identifies a language family, and the high-order word identifies a specific version of that language (a sublanguage).

The language and sublanguage identifier values 0 through 255 are reserved for system use. The values 256 through 511 are reserved for application use.

The MKMSGF utility program performs range checking on the language and sublanguage identifier values. The value 0 means a null or unspecified language or sublanguage. Only the values defined in the following table are valid below 256. Any values from 256 through 511 are valid. Any identifier value greater than 511 is invalid.

The following table shows the valid language and sublanguage identifier values. Column 1 is the language family identifier, and column 2 is the sublanguage identifier. Column 3 shows the language, and column 4 shows the principal country for this language.

Example Code
This example queries the number of code pages and the first code page and language identifier from the file "SAMPLE.MSG". The result of the query has the format specified be the _MYCPINFO structure. 
 * 1) define INCL_DOSMISC   /* Miscellaneous values */
 * 2) define INCL_DOSERRORS /* DOS Error values */
 * 3) include 
 * 4) include 

int main(VOID) {

typedef struct _MYCPINFO { USHORT       cCP;          /* Number of code pages */ USHORT      CP1;          /* First code page      */ ULONG       dtype; } MYCPINFO;

UCHAR    uchBuffer[20] = {0};            /* Buffer for the returned list */ MYCPINFO CPinfo         = {0};           /* Pointer to buffer */ ULONG    ulDataLen      = 0;             /* Length of data returned */ APIRET   rc             = NO_ERROR;      /* Return code */

rc = DosQueryMessageCP( (PUCHAR) &CPinfo,                        sizeof(MYCPINFO),                         "SAMPLE.MSG",                         &ulDataLen );

if (rc != NO_ERROR) { printf("DosQueryMessageCP error: return code = %u\n", rc); return 1; } else { printf("SAMPLE.MSG: %u Code Page(s) - Code Page 1 = %u.\n",                                        CPinfo.cCP, CPinfo.CP1); } /* endif */

return NO_ERROR; } 

Related Functions

 * DosGetMessage
 * DosInsertMessage
 * DosPutMessage