ReactOS 0.4.15-dev-7918-g2a2556c
country.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _DOS_COUNTRY_INFO
 
struct  _DOS_COUNTRY_INFO_EX
 
struct  _DOS_COUNTRY_INFO_2
 

Typedefs

typedef struct _DOS_COUNTRY_INFO DOS_COUNTRY_INFO
 
typedef struct _DOS_COUNTRY_INFOPDOS_COUNTRY_INFO
 
typedef struct _DOS_COUNTRY_INFO_EX DOS_COUNTRY_INFO_EX
 
typedef struct _DOS_COUNTRY_INFO_EXPDOS_COUNTRY_INFO_EX
 
typedef struct _DOS_COUNTRY_INFO_2 DOS_COUNTRY_INFO_2
 
typedef struct _DOS_COUNTRY_INFO_2PDOS_COUNTRY_INFO_2
 

Functions

 C_ASSERT (sizeof(DOS_COUNTRY_INFO)==0x22)
 
 C_ASSERT (sizeof(DOS_COUNTRY_INFO_EX)==0x28)
 
WORD DosGetCountryInfo (IN OUT PWORD CountryId, OUT PDOS_COUNTRY_INFO CountryInfo)
 
WORD DosGetCountryInfoEx (IN BYTE InfoId, IN WORD CodePage, IN WORD CountryId, OUT PDOS_COUNTRY_INFO_2 CountryInfo, IN OUT PWORD BufferSize)
 
WORD DosIfCharYesNo (WORD Char)
 
CHAR DosToUpper (CHAR Char)
 
VOID DosToUpperStrN (PCHAR DestStr, PCHAR SrcStr, WORD Length)
 
VOID DosToUpperStrZ (PSTR DestStr, PSTR SrcStr)
 
BOOLEAN DosCountryInitialize (VOID)
 

Typedef Documentation

◆ DOS_COUNTRY_INFO

◆ DOS_COUNTRY_INFO_2

◆ DOS_COUNTRY_INFO_EX

◆ PDOS_COUNTRY_INFO

◆ PDOS_COUNTRY_INFO_2

◆ PDOS_COUNTRY_INFO_EX

Function Documentation

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(DOS_COUNTRY_INFO = =0x22)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(DOS_COUNTRY_INFO_EX = =0x28)

◆ DosCountryInitialize()

BOOLEAN DosCountryInitialize ( VOID  )

Definition at line 236 of file country.c.

237{
238 UINT i;
239
240 /* Initialize some memory to store country information */
241 // FIXME: Can we use instead some static area from the DOS data structure??
243 if (CountryDataSegment == 0) return FALSE;
245
248 sizeof(CaseMapRoutine));
249
251 for (i = 0; i < CountryData->UpCaseTbl.Size; ++i)
252 CountryData->UpCaseTbl.Data[i] = 0x80 + i;
253
255 for (i = 0; i < CountryData->LoCaseTbl.Size; ++i)
256 CountryData->LoCaseTbl.Data[i] = i;
257
259 CountryData->FNameTermTbl.Data[ 0] = 0x01; // Dummy Byte
260 CountryData->FNameTermTbl.Data[ 1] = 0x00; // Lowest permissible Character Value for Filename
261 CountryData->FNameTermTbl.Data[ 2] = 0xFF; // Highest permissible Character Value for Filename
262 CountryData->FNameTermTbl.Data[ 3] = 0x00; // Dummy Byte
263 CountryData->FNameTermTbl.Data[ 4] = 0x00; // First excluded Character in Range \ all characters in this
264 CountryData->FNameTermTbl.Data[ 5] = 0x20; // Last excluded Character in Range / range are illegal
265 CountryData->FNameTermTbl.Data[ 6] = 0x02; // Dummy Byte
266 CountryData->FNameTermTbl.Data[ 7] = 14; // Number of illegal (terminator) Characters
267// CountryData->FNameTermTbl.Data[ 8] = ".\"/\\[]:|<>+=;,"; // Characters which terminate a Filename
268 CountryData->FNameTermTbl.Data[ 8] = '.';
269 CountryData->FNameTermTbl.Data[ 9] = '\"';
270 CountryData->FNameTermTbl.Data[10] = '/';
271 CountryData->FNameTermTbl.Data[11] = '\\';
272 CountryData->FNameTermTbl.Data[12] = '[';
273 CountryData->FNameTermTbl.Data[13] = ']';
274 CountryData->FNameTermTbl.Data[14] = ':';
275 CountryData->FNameTermTbl.Data[15] = '|';
276 CountryData->FNameTermTbl.Data[16] = '<';
277 CountryData->FNameTermTbl.Data[17] = '>';
278 CountryData->FNameTermTbl.Data[18] = '+';
279 CountryData->FNameTermTbl.Data[19] = '=';
280 CountryData->FNameTermTbl.Data[20] = ';';
281 CountryData->FNameTermTbl.Data[21] = ',';
282
284 for (i = 0; i < CountryData->CollateTbl.Size; ++i)
285 CountryData->CollateTbl.Data[i] = i;
286
287 CountryData->DBCSLeadTbl.Size = 0; // Empty DBCS table
288 CountryData->DBCSLeadTbl.Data[0] = 0x0000;
289
290 return TRUE;
291}
static const BYTE CaseMapRoutine[]
Definition: country.c:28
static WORD CountryDataSegment
Definition: country.c:61
struct _COUNTRY_DATA * PCOUNTRY_DATA
static PCOUNTRY_DATA CountryData
Definition: country.c:62
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
LOWERCASE LoCaseTbl
Definition: country.c:52
BYTE CaseMapRoutine[sizeof(CaseMapRoutine)]
Definition: country.c:50
DBCSLEAD DBCSLeadTbl
Definition: country.c:55
COLLATE CollateTbl
Definition: country.c:54
UPPERCASE UpCaseTbl
Definition: country.c:51
FNAMETERM FNameTermTbl
Definition: country.c:53
WORD DosAllocateMemory(WORD Size, WORD *MaxAvailable)
Definition: memory.c:136
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264

Referenced by DosKRNLInitialize().

◆ DosGetCountryInfo()

WORD DosGetCountryInfo ( IN OUT PWORD  CountryId,
OUT PDOS_COUNTRY_INFO  CountryInfo 
)

Definition at line 77 of file country.c.

79{
80 INT Return;
81 DWORD NumVal;
82
83 Return = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_IDATE | LOCALE_RETURN_NUMBER, // LOCALE_ILDATE | LOCALE_RETURN_NUMBER
84 (LPSTR)&NumVal,
85 sizeof(NumVal));
86 if (Return == 0) return LOWORD(GetLastError());
87 CountryInfo->DateTimeFormat = (WORD)NumVal;
88
90 (LPSTR)&CountryInfo->CurrencySymbol,
91 sizeof(CountryInfo->CurrencySymbol));
92 if (Return == 0) return LOWORD(GetLastError());
93
95 (LPSTR)&CountryInfo->ThousandSep,
96 sizeof(CountryInfo->ThousandSep));
97 if (Return == 0) return LOWORD(GetLastError());
98
100 (LPSTR)&CountryInfo->DecimalSep,
101 sizeof(CountryInfo->DecimalSep));
102 if (Return == 0) return LOWORD(GetLastError());
103
105 (LPSTR)&CountryInfo->DateSep,
106 sizeof(CountryInfo->DateSep));
107 if (Return == 0) return LOWORD(GetLastError());
108
110 (LPSTR)&CountryInfo->TimeSep,
111 sizeof(CountryInfo->TimeSep));
112 if (Return == 0) return LOWORD(GetLastError());
113
114 // NOTE: '4: Symbol replace decimal separator' is unsupported.
115 Return = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ICURRENCY | LOCALE_RETURN_NUMBER,
116 (LPSTR)&NumVal,
117 sizeof(NumVal));
118 if (Return == 0) return LOWORD(GetLastError());
119 CountryInfo->CurrencyFormat = (BYTE)NumVal;
120
121 Return = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER, // LOCALE_IDIGITS | LOCALE_RETURN_NUMBER
122 (LPSTR)&NumVal,
123 sizeof(NumVal));
124 if (Return == 0) return LOWORD(GetLastError());
125 CountryInfo->CurrencyDigitsNum = (BYTE)NumVal;
126
127 Return = GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_ITIME | LOCALE_RETURN_NUMBER,
128 (LPSTR)&NumVal,
129 sizeof(NumVal));
130 if (Return == 0) return LOWORD(GetLastError());
131 CountryInfo->TimeFormat = (BYTE)NumVal;
132
134
135 // CountryInfo->DataListSep;
136
137 return ERROR_SUCCESS;
138}
#define ERROR_SUCCESS
Definition: deptool.c:10
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
INT WINAPI GetLocaleInfoA(LCID lcid, LCTYPE lctype, LPSTR buffer, INT len)
Definition: lang.c:1028
#define LOCALE_USER_DEFAULT
#define LOWORD(l)
Definition: pedump.c:82
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOCALE_ICURRDIGITS
Definition: winnls.h:54
#define LOCALE_SDATE
Definition: winnls.h:58
#define LOCALE_SDECIMAL
Definition: winnls.h:42
#define LOCALE_IDATE
Definition: winnls.h:63
#define LOCALE_ITIME
Definition: winnls.h:65
#define LOCALE_ICURRENCY
Definition: winnls.h:56
#define LOCALE_STHOUSAND
Definition: winnls.h:43
#define LOCALE_STIME
Definition: winnls.h:59
#define LOCALE_SCURRENCY
Definition: winnls.h:49
char * LPSTR
Definition: xmlstorage.h:182
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DosGetCountryInfoEx(), and DosInt21h().

◆ DosGetCountryInfoEx()

WORD DosGetCountryInfoEx ( IN BYTE  InfoId,
IN WORD  CodePage,
IN WORD  CountryId,
OUT PDOS_COUNTRY_INFO_2  CountryInfo,
IN OUT PWORD  BufferSize 
)

Definition at line 141 of file country.c.

146{
147 // FIXME: use: CodePage; CountryId
148 // FIXME: Check BufferSize
149 // FIXME: Use NLSFUNC resident?
150
151 switch (InfoId)
152 {
153 /* Get General Internationalization Info (similar to AX=3800h) */
154 case 0x01:
155 {
157 ErrorCode = DosGetCountryInfo(&CountryId,
158 &CountryInfo->CountryInfoEx.CountryInfo);
159 if (ErrorCode != ERROR_SUCCESS) return ErrorCode;
160 CountryInfo->CountryInfoEx.Size = sizeof(CountryInfo->CountryInfoEx);
161 CountryInfo->CountryInfoEx.CountryId = CountryId;
162 // CountryInfo->CodePage;
163 break;
164 }
165
166 /* Get Pointer to Uppercase Table */
167 case 0x02:
168 CountryInfo->UpCaseTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, UpCaseTbl), CountryDataSegment);
169 break;
170
171 /* Get Pointer to Lowercase Table */
172 case 0x03:
173 CountryInfo->LoCaseTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, LoCaseTbl), CountryDataSegment);
174 break;
175
176 /* Get Pointer to Filename Uppercase Table */
177 case 0x04:
178 CountryInfo->FNameUpCaseTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, UpCaseTbl), CountryDataSegment);
179 break;
180
181 /* Get Pointer to Filename Terminator Table */
182 case 0x05:
183 CountryInfo->FNameTermTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, FNameTermTbl), CountryDataSegment);
184 break;
185
186 /* Get Pointer to Collating Sequence Table */
187 case 0x06:
188 CountryInfo->CollateTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, CollateTbl), CountryDataSegment);
189 break;
190
191 /* Get Pointer to Double-Byte Character Set Table */
192 case 0x07:
193 CountryInfo->DBCSLeadTblPtr = MAKELONG(FIELD_OFFSET(COUNTRY_DATA, DBCSLeadTbl), CountryDataSegment);
194 break;
195
196 default:
198 }
199 CountryInfo->InfoId = InfoId;
200
201 return ERROR_SUCCESS;
202}
WORD DosGetCountryInfo(IN OUT PWORD CountryId, OUT PDOS_COUNTRY_INFO CountryInfo)
Definition: country.c:77
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436

Referenced by DosInt21h().

◆ DosIfCharYesNo()

WORD DosIfCharYesNo ( WORD  Char)

Definition at line 204 of file country.c.

205{
206 Char = toupper(Char);
207
208 /* NO-type */
209 if (Char == YesNoTable[1])
210 return 0x0000;
211 /* YES-type */
212 if (Char == YesNoTable[0])
213 return 0x0001;
214 /* Unknown type */
215 return 0x0002;
216}
int toupper(int c)
Definition: utclib.c:881
WORD YesNoTable[2]
Definition: country.c:64

Referenced by DosInt21h().

◆ DosToUpper()

CHAR DosToUpper ( CHAR  Char)

Definition at line 218 of file country.c.

219{
220 // FIXME: Use the current locale
221 return toupper(Char);
222}

Referenced by DosInt21h().

◆ DosToUpperStrN()

VOID DosToUpperStrN ( PCHAR  DestStr,
PCHAR  SrcStr,
WORD  Length 
)

Definition at line 224 of file country.c.

225{
226 while (Length-- > 0)
227 *DestStr++ = toupper(*SrcStr++);
228}
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102

Referenced by DosInt21h().

◆ DosToUpperStrZ()

VOID DosToUpperStrZ ( PSTR  DestStr,
PSTR  SrcStr 
)

Definition at line 230 of file country.c.

231{
232 while (*SrcStr)
233 *DestStr++ = toupper(*SrcStr++);
234}

Referenced by DosInt21h().