Jump to content

DosGetCp: Difference between revisions

From EDM2
No edit summary
Ak120 (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[image:legacy.png]]
This is the legacy function. It is recommended to use:  "[[OS2_API:CPI:DosQueryCp|DosQueryCp]]". [https://books.google.com.ec/books?id=u7WbsmbttwYC&pg=PT372&lpg=PT372&dq#v=onepage&q&f=false]
==Description==
This call allows a process to query the current process code page and the prepared system code pages.
This call allows a process to query the current process code page and the prepared system code pages.


==Syntax==
==Syntax==
<PRE>
  DosGetCp (Length, CodePageList, DataLength)
  DosGetCp


    (Length, CodePageList, DataLength)
</PRE>
==Parameters==
==Parameters==
; Length (USHORT) - input : Length, in bytes, of CodePageList. This length should be at least 2 bytes. If the length is less than the bytes needed to return all the prepared system code pages than the returned CodePageList is truncated.  
;Length (USHORT) - input : Length, in bytes, of CodePageList. This length should be at least 2 bytes. If the length is less than the bytes needed to return all the prepared system code pages than the returned CodePageList is truncated.
 
; CodePageList (PUSHORT) - output : Address of the list of available system code pages. The format of the information returned in this list is:
; CodePageList (PUSHORT) - output : Address of the list of available system code pages. The format of the information returned in this list is:
::1 - Current code page identifier
::2 - The first prepared code page
::3 - The second prepared code page
::N - Other prepared system code pages.
; DataLength (PUSHORT) - output : Address of the length, in bytes, of the returned data.


'''Word        Description'''
1      Current code page identifier
2      The first prepared code page 
3      The second prepared code page 
N      Other prepared system code pages.
; DataLength (PUSHORT) - output : Address of the length, in bytes, of the returned data.
==Return Code==
==Return Code==
rc (USHORT) - return
;rc (USHORT) - return:Return code descriptions are:
 
*0 NO_ERROR
Return code descriptions are:
*473 ERROR_CPLIST_TOO_SMALL
 
* 0         NO_ERROR  
* 473       ERROR_CPLIST_TOO_SMALL  


==Remarks==
==Remarks==
If the process code page identifier was previously set by DosSetCp or inherited by a process, it is returned to the caller.
If the process code page identifier was previously set by [[DosSetCp]] or inherited by a process, it is returned to the caller.


An input list size (length) of two bytes returns only the current process code page identifier. If CodePageList length is too small to hold all the available information, then as much information as possible is provided in the available space and ERROR_CPLIST_TOO_SMALL is returned.
An input list size (length) of two bytes returns only the current process code page identifier. If CodePageList length is too small to hold all the available information, then as much information as possible is provided in the available space and ERROR_CPLIST_TOO_SMALL is returned.
Line 39: Line 26:


===Family API Considerations===
===Family API Considerations===
Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetCp when coding for the DOS mode:
Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetCp when coding for the DOS mode:


The current process code page, and no more than one prepared system code page, is returned.  
The current process code page, and no more than one prepared system code page, is returned.  


 
==Bindings==
==Example Code==
===C===
===C Binding===
<PRE>
<PRE>
#define INCL_DOSNLS
#define INCL_DOSNLS
Line 59: Line 44:
</PRE>
</PRE>


This example gets the current code page and then up to 3 other prepared codepages.
===MASM===
<PRE>
#define INCL_DOSNLS
 
USHORT CpList[8];
USHORT CpSize;
USHORT rc;
 
  rc = DosGetCp(sizeof(CpList),      /* Length of list */
                CpList,              /* List */
                &CpSize);            /* Length of returned list */
</PRE>
===MASM Binding===
<PRE>
<PRE>
EXTRN  DosGetCp:FAR
EXTRN  DosGetCp:FAR
Line 83: Line 56:
Returns WORD
Returns WORD
</PRE>
</PRE>
==Example==
This example gets the current code page and then up to 3 other prepared codepages.
<PRE>
#define INCL_DOSNLS
USHORT CpList[8];
USHORT CpSize;
USHORT rc;
rc = DosGetCp(sizeof(CpList),  /* Length of list */
              CpList,          /* List */
              &CpSize);        /* Length of returned list */
</PRE>
==Related Functions==
==Related Functions==
*
*[[DosSetCp]]


[[Category:Dos]]
[[Category:Dos]]

Latest revision as of 13:09, 29 February 2020

This call allows a process to query the current process code page and the prepared system code pages.

Syntax

DosGetCp (Length, CodePageList, DataLength)

Parameters

Length (USHORT) - input
Length, in bytes, of CodePageList. This length should be at least 2 bytes. If the length is less than the bytes needed to return all the prepared system code pages than the returned CodePageList is truncated.
CodePageList (PUSHORT) - output
Address of the list of available system code pages. The format of the information returned in this list is:
1 - Current code page identifier
2 - The first prepared code page
3 - The second prepared code page
N - Other prepared system code pages.
DataLength (PUSHORT) - output
Address of the length, in bytes, of the returned data.

Return Code

rc (USHORT) - return
Return code descriptions are:
  • 0 NO_ERROR
  • 473 ERROR_CPLIST_TOO_SMALL

Remarks

If the process code page identifier was previously set by DosSetCp or inherited by a process, it is returned to the caller.

An input list size (length) of two bytes returns only the current process code page identifier. If CodePageList length is too small to hold all the available information, then as much information as possible is provided in the available space and ERROR_CPLIST_TOO_SMALL is returned.

If no codepages were prepared with the CODEPAGE command, a length of two and current codepage identifier value of zero is returned.

Family API Considerations

Some options operate differently in the DOS mode than in OS/2 mode. Therefore, the following restriction applies to DosGetCp when coding for the DOS mode:

The current process code page, and no more than one prepared system code page, is returned.

Bindings

C

#define INCL_DOSNLS

USHORT  rc = DosGetCp(Length, CodePageList, DataLength);

USHORT           Length;        /* Length of list */
PUSHORT          CodePageList;  /* List (returned) */
PUSHORT          DataLength;    /* Length of list (returned) */

USHORT           rc;            /* return code */

MASM

EXTRN  DosGetCp:FAR
INCL_DOSNLS         EQU 1

PUSH   WORD    Length        ;Length of list
PUSH@  WORD    CodePageList  ;List (returned)
PUSH@  WORD    DataLength    ;Length of list (returned)
CALL   DosGetCp

Returns WORD

Example

This example gets the current code page and then up to 3 other prepared codepages.

#define INCL_DOSNLS

USHORT CpList[8];
USHORT CpSize;
USHORT rc;

 rc = DosGetCp(sizeof(CpList),   /* Length of list */
               CpList,           /* List */
               &CpSize);         /* Length of returned list */

Related Functions