- Timestamp:
- Apr 3, 2001, 4:10:48 PM (24 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.CPP
r5411 r5451 1 /* $Id: KERNEL32.CPP,v 1.6 2 2001-03-31 10:39:01sandervl Exp $ */1 /* $Id: KERNEL32.CPP,v 1.63 2001-04-03 14:10:47 sandervl Exp $ */ 2 2 3 3 /* … … 170 170 //****************************************************************************** 171 171 //****************************************************************************** 172 UINT WIN32API GetOEMCP(VOID)173 {174 dprintf(("KERNEL32: GetOEMCP\n"));175 return(O32_GetOEMCP());176 }177 //******************************************************************************178 //******************************************************************************179 180 172 /* 181 173 * PH 2000/09/25 This is an experiment to overcome some problems … … 276 268 dprintf(("KERNEL32: IsBadHugeWritePtr\n")); 277 269 return O32_IsBadHugeWritePtr(arg1, arg2); 278 }279 //******************************************************************************280 //******************************************************************************281 BOOL WIN32API IsDBCSLeadByte(BYTE arg1)282 {283 dprintf2(("KERNEL32: IsDBCSLeadByte %x", arg1));284 return O32_IsDBCSLeadByte(arg1);285 270 } 286 271 //****************************************************************************** … … 411 396 412 397 //****************************************************************************** 413 /*KSO Thu 21.05.1998*/414 BOOL WIN32API IsDBCSLeadByteEx(UINT CodePage, BYTE TestChar)415 {416 dprintf(("KERNEL32: OS2IsDBCSLeadByteEx - not correctly implemented\n"));417 return O32_IsDBCSLeadByte(TestChar);418 }419 //******************************************************************************420 398 421 399 -
trunk/src/kernel32/codepage.cpp
r5424 r5451 1 /* $Id: codepage.cpp,v 1.9 2001-04-01 12:33:10 sandervl Exp $ 2 ** 3 ** Module :CODEPAGE.CPP 4 ** Abstract : 5 ** 6 ** Copyright (C) Vit Timchishin 7 ** 8 ** Log: Wed 22/12/1999 Created 9 ** 10 */ 11 12 #include <odin.h> 13 #include <odinwrap.h> 14 #include <os2win.h> 15 #include "oslibdos.h" 16 //#include "profile.h" 1 /* 2 * Code page functions 3 * 4 * Based on Wine code (memory\codepage.c) 5 * 6 * Copyright 2000 Alexandre Julliard 7 * 8 * Project Odin Software License can be found in LICENSE.TXT 9 * 10 */ 11 12 #include <assert.h> 13 #include <stdio.h> 14 #include <stdlib.h> 15 #include <string.h> 16 17 #include "winbase.h" 18 #include "winerror.h" 19 #include "winnls.h" 20 #include "wine/unicode.h" 21 #include "debugtools.h" 22 23 #ifdef __WIN32OS2__ 17 24 #include <options.h> 18 25 #include "codepage.h" … … 20 27 #define DBG_LOCALLOG DBG_codepage 21 28 #include "dbglocal.h" 22 23 static UconvObject DisplayUconv = NULL; 24 static UconvObject WindowsUconv = NULL; 25 26 static ULONG windowCodePage = -1; 27 static ULONG displayCodePage = -1; 28 29 #endif 30 31 DEFAULT_DEBUG_CHANNEL(string); 32 33 /* current code pages */ 34 static const union cptable *ansi_cptable; 35 static const union cptable *oem_cptable; 36 static const union cptable *mac_cptable; 37 38 /* retrieve a code page table from the locale info */ 39 static const union cptable *get_locale_cp( LCID lcid, LCTYPE type ) 40 { 41 const union cptable *table = NULL; 42 char buf[32]; 43 44 if (GetLocaleInfoA( lcid, type, buf, sizeof(buf) )) table = cp_get_table( atoi(buf) ); 45 return table; 46 } 47 48 /* setup default codepage info before we can get at the locale stuff */ 49 static void init_codepages(void) 50 { 51 ansi_cptable = cp_get_table( 1252 ); 52 oem_cptable = cp_get_table( 437 ); 53 mac_cptable = cp_get_table( 10000 ); 54 assert( ansi_cptable ); 55 assert( oem_cptable ); 56 assert( mac_cptable ); 57 } 58 59 /* find the table for a given codepage, handling CP_ACP etc. pseudo-codepages */ 60 static const union cptable *get_codepage_table( unsigned int codepage ) 61 { 62 const union cptable *ret = NULL; 63 64 if (!ansi_cptable) init_codepages(); 65 66 switch(codepage) 67 { 68 case CP_ACP: return ansi_cptable; 69 case CP_OEMCP: return oem_cptable; 70 case CP_MACCP: return mac_cptable; 71 case CP_THREAD_ACP: return get_locale_cp( GetThreadLocale(), LOCALE_IDEFAULTANSICODEPAGE ); 72 case CP_UTF7: 73 case CP_UTF8: 74 break; 75 default: 76 if (codepage == ansi_cptable->info.codepage) return ansi_cptable; 77 if (codepage == oem_cptable->info.codepage) return oem_cptable; 78 if (codepage == mac_cptable->info.codepage) return mac_cptable; 79 ret = cp_get_table( codepage ); 80 break; 81 } 82 return ret; 83 } 84 85 /* initialize default code pages from locale info */ 86 /* FIXME: should be done in init_codepages, but it can't right now */ 87 /* since it needs KERNEL32 to be loaded for the locale info. */ 88 void CODEPAGE_Init(void) 89 { 90 const union cptable *table; 91 LCID lcid = GetUserDefaultLCID(); 92 93 if (!ansi_cptable) init_codepages(); /* just in case */ 94 95 if ((table = get_locale_cp( lcid, LOCALE_IDEFAULTANSICODEPAGE ))) ansi_cptable = table; 96 if ((table = get_locale_cp( lcid, LOCALE_IDEFAULTMACCODEPAGE ))) mac_cptable = table; 97 if ((table = get_locale_cp( lcid, LOCALE_IDEFAULTCODEPAGE ))) oem_cptable = table; 98 99 TRACE( "ansi=%03d oem=%03d mac=%03d\n", ansi_cptable->info.codepage, 100 oem_cptable->info.codepage, mac_cptable->info.codepage ); 101 } 102 103 #ifdef __WIN32OS2__ 29 104 ULONG GetDisplayCodepage() 30 105 { 31 if(displayCodePage == -1) { 32 //default codepage is 1252 (same as default Windows codepage) 33 displayCodePage = PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 1252); 34 // displayCodePage = PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "DISPLAY", 0); 35 } 36 return displayCodePage; 106 if (!ansi_cptable) CODEPAGE_Init(); 107 108 return oem_cptable->info.codepage; 37 109 } 38 110 39 111 ULONG GetWindowsCodepage() 40 112 { 41 if(windowCodePage == -1) { 42 //default codepage is 1252 (same as default Windows codepage) 43 windowCodePage = PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 1252); 44 // windowCodePage = PROFILE_GetOdinIniInt(CODEPAGE_SECTION, "WINDOWS", 0); 45 } 46 return windowCodePage; 47 } 48 49 UINT WIN32API GetACP() 50 { 51 UINT codepage = GetDisplayCodepage(); 52 dprintf(("GetACP -> %d", codepage)); 53 54 return(codepage); 113 if (!ansi_cptable) CODEPAGE_Init(); 114 115 return oem_cptable->info.codepage; 55 116 } 56 117 … … 71 132 } 72 133 134 static UconvObject DisplayUconv = NULL; 135 static UconvObject WindowsUconv = NULL; 136 73 137 UconvObject GetDisplayUconvObject() 74 138 { … … 87 151 } 88 152 153 #endif 154 155 /****************************************************************************** 156 * GetACP (KERNEL32) 157 * 158 * RETURNS 159 * Current ANSI code-page identifier, default if no current defined 160 */ 161 UINT WINAPI GetACP(void) 162 { 163 if (!ansi_cptable) init_codepages(); 164 #ifdef __WIN32OS2__ 165 dprintf(("GetACP %d", ansi_cptable->info.codepage)); 166 #endif 167 return ansi_cptable->info.codepage; 168 } 169 170 171 /*********************************************************************** 172 * GetOEMCP (KERNEL32) 173 */ 174 UINT WINAPI GetOEMCP(void) 175 { 176 if (!oem_cptable) init_codepages(); 177 #ifdef __WIN32OS2__ 178 dprintf(("GetOEMCP %d", oem_cptable->info.codepage)); 179 #endif 180 return oem_cptable->info.codepage; 181 } 182 183 184 /*********************************************************************** 185 * IsValidCodePage (KERNEL32) 186 */ 187 BOOL WINAPI IsValidCodePage( UINT codepage ) 188 { 189 #ifdef __WIN32OS2__ 190 dprintf(("IsValidCodePage %d", codepage)); 191 #endif 192 return cp_get_table( codepage ) != NULL; 193 } 194 195 196 /*********************************************************************** 197 * IsDBCSLeadByteEx (KERNEL32) 198 */ 199 BOOL WINAPI IsDBCSLeadByteEx( UINT codepage, BYTE testchar ) 200 { 201 #ifdef __WIN32OS2__ 202 dprintf2(("IsDBCSLeadByteEx %d %x", codepage, testchar)); 203 #endif 204 205 const union cptable *table = get_codepage_table( codepage ); 206 return table && is_dbcs_leadbyte( table, testchar ); 207 } 208 209 210 /*********************************************************************** 211 * IsDBCSLeadByte (KERNEL32) 212 */ 213 BOOL WINAPI IsDBCSLeadByte( BYTE testchar ) 214 { 215 if (!ansi_cptable) init_codepages(); 216 return is_dbcs_leadbyte( ansi_cptable, testchar ); 217 } 218 219 220 /*********************************************************************** 221 * GetCPInfo (KERNEL32) 222 */ 223 BOOL WINAPI GetCPInfo( UINT codepage, LPCPINFO cpinfo ) 224 { 225 const union cptable *table = get_codepage_table( codepage ); 226 227 #ifdef __WIN32OS2__ 228 dprintf(("GetCPInfo %d %x", codepage, cpinfo)); 229 #endif 230 231 if (!table) 232 { 233 SetLastError( ERROR_INVALID_PARAMETER ); 234 return FALSE; 235 } 236 if (table->info.def_char & 0xff00) 237 { 238 cpinfo->DefaultChar[0] = table->info.def_char & 0xff00; 239 cpinfo->DefaultChar[1] = table->info.def_char & 0x00ff; 240 } 241 else 242 { 243 cpinfo->DefaultChar[0] = table->info.def_char & 0xff; 244 cpinfo->DefaultChar[1] = 0; 245 } 246 if ((cpinfo->MaxCharSize = table->info.char_size) == 2) 247 memcpy( cpinfo->LeadByte, table->dbcs.lead_bytes, sizeof(cpinfo->LeadByte) ); 248 else 249 cpinfo->LeadByte[0] = cpinfo->LeadByte[1] = 0; 250 251 return TRUE; 252 } 253 254 255 /*********************************************************************** 256 * EnumSystemCodePagesA (KERNEL32) 257 */ 258 BOOL WINAPI EnumSystemCodePagesA( CODEPAGE_ENUMPROCA lpfnCodePageEnum, DWORD flags ) 259 { 260 const union cptable *table; 261 char buffer[10]; 262 int index = 0; 263 264 #ifdef __WIN32OS2__ 265 dprintf(("EnumSystemCodePagesA %x %x", lpfnCodePageEnum, flags)); 266 #endif 267 268 for (;;) 269 { 270 if (!(table = cp_enum_table( index++ ))) break; 271 sprintf( buffer, "%d", table->info.codepage ); 272 if (!lpfnCodePageEnum( buffer )) break; 273 } 274 return TRUE; 275 } 276 277 278 /*********************************************************************** 279 * EnumSystemCodePagesW (KERNEL32) 280 */ 281 BOOL WINAPI EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpfnCodePageEnum, DWORD flags ) 282 { 283 const union cptable *table; 284 WCHAR buffer[10], *p; 285 int page, index = 0; 286 287 #ifdef __WIN32OS2__ 288 dprintf(("EnumSystemCodePagesW %x %x", lpfnCodePageEnum, flags)); 289 #endif 290 291 for (;;) 292 { 293 if (!(table = cp_enum_table( index++ ))) break; 294 p = buffer + sizeof(buffer)/sizeof(WCHAR); 295 *--p = 0; 296 page = table->info.codepage; 297 do 298 { 299 *--p = '0' + (page % 10); 300 page /= 10; 301 } while( page ); 302 if (!lpfnCodePageEnum( p )) break; 303 } 304 return TRUE; 305 } 306 307 308 /*********************************************************************** 309 * MultiByteToWideChar (KERNEL32) 310 * 311 * PARAMS 312 * page [in] Codepage character set to convert from 313 * flags [in] Character mapping flags 314 * src [in] Source string buffer 315 * srclen [in] Length of source string buffer 316 * dst [in] Destination buffer 317 * dstlen [in] Length of destination buffer 318 * 319 * NOTES 320 * The returned length includes the null terminator character. 321 * 322 * RETURNS 323 * Success: If dstlen > 0, number of characters written to destination 324 * buffer. If dstlen == 0, number of characters needed to do 325 * conversion. 326 * Failure: 0. Occurs if not enough space is available. 327 * 328 * ERRORS 329 * ERROR_INSUFFICIENT_BUFFER 330 * ERROR_INVALID_PARAMETER 331 * ERROR_NO_UNICODE_TRANSLATION 332 * 333 */ 334 INT WINAPI MultiByteToWideChar( UINT page, DWORD flags, LPCSTR src, INT srclen, 335 LPWSTR dst, INT dstlen ) 336 { 337 const union cptable *table; 338 int ret; 339 340 #ifdef __WIN32OS2__ 341 dprintf2(("MultiByteToWideChar %d %x %x %d %x %d", page, flags, src, srclen, dst, dstlen)); 342 #endif 343 344 if (!src || (!dst && dstlen)) 345 { 346 SetLastError( ERROR_INVALID_PARAMETER ); 347 return 0; 348 } 349 350 if (srclen == -1) srclen = strlen(src) + 1; 351 352 if (flags & MB_USEGLYPHCHARS) FIXME("MB_USEGLYPHCHARS not supported\n"); 353 354 switch(page) 355 { 356 case CP_UTF7: 357 FIXME("UTF not supported\n"); 358 SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); 359 return 0; 360 case CP_UTF8: 361 ret = utf8_mbstowcs( flags, src, srclen, dst, dstlen ); 362 break; 363 default: 364 if (!(table = get_codepage_table( page ))) 365 { 366 SetLastError( ERROR_INVALID_PARAMETER ); 367 return 0; 368 } 369 ret = cp_mbstowcs( table, flags, src, srclen, dst, dstlen ); 370 break; 371 } 372 373 if (ret < 0) 374 { 375 switch(ret) 376 { 377 case -1: SetLastError( ERROR_INSUFFICIENT_BUFFER ); break; 378 case -2: SetLastError( ERROR_NO_UNICODE_TRANSLATION ); break; 379 } 380 ret = 0; 381 } 382 return ret; 383 } 384 385 386 /*********************************************************************** 387 * WideCharToMultiByte (KERNEL32) 388 * 389 * PARAMS 390 * page [in] Codepage character set to convert to 391 * flags [in] Character mapping flags 392 * src [in] Source string buffer 393 * srclen [in] Length of source string buffer 394 * dst [in] Destination buffer 395 * dstlen [in] Length of destination buffer 396 * defchar [in] Default character to use for conversion if no exact 397 * conversion can be made 398 * used [out] Set if default character was used in the conversion 399 * 400 * NOTES 401 * The returned length includes the null terminator character. 402 * 403 * RETURNS 404 * Success: If dstlen > 0, number of characters written to destination 405 * buffer. If dstlen == 0, number of characters needed to do 406 * conversion. 407 * Failure: 0. Occurs if not enough space is available. 408 * 409 * ERRORS 410 * ERROR_INSUFFICIENT_BUFFER 411 * ERROR_INVALID_PARAMETER 412 */ 413 INT WINAPI WideCharToMultiByte( UINT page, DWORD flags, LPCWSTR src, INT srclen, 414 LPSTR dst, INT dstlen, LPCSTR defchar, BOOL *used ) 415 { 416 const union cptable *table; 417 int ret, used_tmp; 418 419 #ifdef __WIN32OS2__ 420 dprintf2(("WideCharToMultiByte %d %x %x %d %x %d", page, flags, src, srclen, dst, dstlen)); 421 #endif 422 423 if (!src || (!dst && dstlen)) 424 { 425 SetLastError( ERROR_INVALID_PARAMETER ); 426 return 0; 427 } 428 429 if (srclen == -1) srclen = strlenW(src) + 1; 430 431 switch(page) 432 { 433 case CP_UTF7: 434 FIXME("UTF-7 not supported\n"); 435 SetLastError( ERROR_CALL_NOT_IMPLEMENTED ); 436 return 0; 437 case CP_UTF8: 438 ret = utf8_wcstombs( src, srclen, dst, dstlen ); 439 break; 440 default: 441 if (!(table = get_codepage_table( page ))) 442 { 443 SetLastError( ERROR_INVALID_PARAMETER ); 444 return 0; 445 } 446 ret = cp_wcstombs( table, flags, src, srclen, dst, dstlen, 447 defchar, used ? &used_tmp : NULL ); 448 if (used) *used = used_tmp; 449 break; 450 } 451 452 if (ret == -1) 453 { 454 SetLastError( ERROR_INSUFFICIENT_BUFFER ); 455 ret = 0; 456 } 457 return ret; 458 } 459 460 461 /****************************************************************************** 462 * GetStringTypeW (KERNEL32) 463 * 464 */ 465 BOOL WINAPI GetStringTypeW( DWORD type, LPCWSTR src, INT count, LPWORD chartype ) 466 { 467 #ifdef __WIN32OS2__ 468 dprintf(("GetStringTypeW %x %x %d %x", type, src, count, chartype)); 469 #endif 470 471 if (count == -1) count = strlenW(src) + 1; 472 switch(type) 473 { 474 case CT_CTYPE1: 475 while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff; 476 break; 477 case CT_CTYPE2: 478 while (count--) *chartype++ = get_char_typeW( *src++ ) >> 12; 479 break; 480 case CT_CTYPE3: 481 FIXME("CT_CTYPE3 not supported.\n"); 482 default: 483 SetLastError( ERROR_INVALID_PARAMETER ); 484 return FALSE; 485 } 486 return TRUE; 487 } 488 489 490 /****************************************************************************** 491 * GetStringTypeExW (KERNEL32) 492 */ 493 BOOL WINAPI GetStringTypeExW( LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype ) 494 { 495 /* locale is ignored for Unicode */ 496 return GetStringTypeW( type, src, count, chartype ); 497 } -
trunk/src/kernel32/initterm.cpp
r5308 r5451 52 52 #include <Win32k.h> 53 53 #include <initdll.h> 54 #include <codepage.h> 54 55 55 56 #define DBG_LOCALLOG DBG_initterm … … 179 180 ulSysinfo = 1; 180 181 182 /* Setup codepage info */ 183 CODEPAGE_Init(); 184 181 185 InitSystemInfo(ulSysinfo); 182 186 //Set up environment as found in NT -
trunk/src/kernel32/lang.cpp
r4658 r5451 1 /* $Id: lang.cpp,v 1.3 1 2000-11-21 11:35:08sandervl Exp $ */1 /* $Id: lang.cpp,v 1.32 2001-04-03 14:10:47 sandervl Exp $ */ 2 2 /* 3 3 * Win32 language API functions for OS/2 … … 141 141 //****************************************************************************** 142 142 //****************************************************************************** 143 BOOL WIN32API IsValidCodePage(UINT CodePage)144 {145 dprintf(("KERNEL32: IsValidCodePage %d not implemented", CodePage));146 return(TRUE);147 }148 //******************************************************************************149 //******************************************************************************150 143 LCID WIN32API GetUserDefaultLCID(void) 151 144 { … … 157 150 LCID WIN32API GetSystemDefaultLCID(void) 158 151 { 159 dprintf2(("KERNEL32: GetSystemDefaultLCID: returns %x", MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)));160 return (MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT)); //US English152 dprintf2(("KERNEL32: GetSystemDefaultLCID: returns %x", GetUserDefaultLCID())); 153 return GetUserDefaultLCID(); 161 154 } 162 155 //****************************************************************************** … … 171 164 LANGID WIN32API GetSystemDefaultLangID(void) 172 165 { 173 dprintf2(("KERNEL32: GetSystemDefaultLangID returns %x", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)));174 return (MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));166 dprintf2(("KERNEL32: GetSystemDefaultLangID returns %x", GetUserDefaultLangID())); 167 return GetUserDefaultLangID(); 175 168 } 176 169 -
trunk/src/kernel32/makefile
r5387 r5451 1 # $Id: makefile,v 1.113 2001-03-27 16:18:26 sandervl Exp $ 2 1 # $Id: makefile,v 1.114 2001-04-03 14:10:47 sandervl Exp $ 3 2 # 4 3 # Odin32 API 5 4 # 6 # kernel32 .dllmakefile5 # kernel32 makefile 7 6 # 8 7 9 # 10 # Compiler, tools, and interference rules. 11 # 8 9 # Common tools macros. (MAKE_CMD) 12 10 !include ../../makefile.inc 13 11 14 # 15 # Object files. Prefix with OBJDIR and one space before the '\'. 16 # 17 OBJS = \ 18 $(OBJDIR)\kernel32.obj \ 19 $(OBJDIR)\kobjects.obj \ 20 $(OBJDIR)\console.obj \ 21 $(OBJDIR)\conin.obj \ 22 $(OBJDIR)\conbuffer.obj \ 23 $(OBJDIR)\conbuffervio.obj \ 24 $(OBJDIR)\conout.obj \ 25 $(OBJDIR)\unicode.obj \ 26 $(OBJDIR)\network.obj \ 27 $(OBJDIR)\hmdevio.obj \ 28 $(OBJDIR)\profile.obj \ 29 $(OBJDIR)\thread.obj \ 30 $(OBJDIR)\virtual.obj \ 31 $(OBJDIR)\thunk.obj \ 32 $(OBJDIR)\obsolete.obj \ 33 $(OBJDIR)\comm.obj \ 34 $(OBJDIR)\message.obj \ 35 $(OBJDIR)\resource.obj \ 36 $(OBJDIR)\exceptions.obj \ 37 $(OBJDIR)\heapshared.obj \ 38 $(OBJDIR)\cpuhlp.obj \ 39 $(OBJDIR)\heapcode.obj \ 40 $(OBJDIR)\lfile.obj \ 41 $(OBJDIR)\npipe.obj \ 42 $(OBJDIR)\oslibdos.obj \ 43 $(OBJDIR)\oslibmisc.obj \ 44 $(OBJDIR)\ole2nls.obj \ 45 $(OBJDIR)\misc.obj \ 46 $(OBJDIR)\exceptutil.obj \ 47 $(OBJDIR)\lang.obj \ 48 $(OBJDIR)\iccio.obj \ 49 $(OBJDIR)\map.obj \ 50 $(OBJDIR)\win32util.obj \ 51 $(OBJDIR)\heap.obj \ 52 $(OBJDIR)\heapstring.obj \ 53 $(OBJDIR)\os2heap.obj \ 54 $(OBJDIR)\vmutex.obj \ 55 $(OBJDIR)\vsemaphore.obj \ 56 $(OBJDIR)\initterm.obj \ 57 $(OBJDIR)\handlemanager.obj \ 58 $(OBJDIR)\environ.obj \ 59 $(OBJDIR)\initsystem.obj \ 60 $(OBJDIR)\hmdevice.obj \ 61 $(OBJDIR)\hmopen32.obj \ 62 $(OBJDIR)\hmobjects.obj \ 63 $(OBJDIR)\hmevent.obj \ 64 $(OBJDIR)\hmfile.obj \ 65 $(OBJDIR)\hmmutex.obj \ 66 $(OBJDIR)\hmcomm.obj \ 67 $(OBJDIR)\hmsemaphore.obj \ 68 $(OBJDIR)\hmstd.obj \ 69 $(OBJDIR)\wprocess.obj \ 70 $(OBJDIR)\conprop.obj \ 71 $(OBJDIR)\conprop2.obj \ 72 $(OBJDIR)\winimagelx.obj \ 73 $(OBJDIR)\winimagebase.obj \ 74 $(OBJDIR)\windllbase.obj \ 75 $(OBJDIR)\winexebase.obj \ 76 $(OBJDIR)\time.obj \ 77 $(OBJDIR)\mmap.obj \ 78 $(OBJDIR)\winimagepe2lx.obj \ 79 $(OBJDIR)\winimagepeldr.obj \ 80 $(OBJDIR)\windllpe2lx.obj \ 81 $(OBJDIR)\windlllx.obj \ 82 $(OBJDIR)\windllpeldr.obj \ 83 $(OBJDIR)\winexepe2lx.obj \ 84 $(OBJDIR)\winexelx.obj \ 85 $(OBJDIR)\winexepeldr.obj \ 86 $(OBJDIR)\critsection.obj \ 87 $(OBJDIR)\pefile.obj \ 88 $(OBJDIR)\winimgres.obj \ 89 $(OBJDIR)\wintls.obj \ 90 $(OBJDIR)\async.obj \ 91 $(OBJDIR)\fileio.obj \ 92 $(OBJDIR)\hmtoken.obj \ 93 $(OBJDIR)\atom.obj \ 94 $(OBJDIR)\disk.obj \ 95 $(OBJDIR)\directory.obj \ 96 $(OBJDIR)\hmmmap.obj \ 97 $(OBJDIR)\oslibexcept.obj \ 98 $(OBJDIR)\cpu.obj \ 99 $(OBJDIR)\process.obj \ 100 $(OBJDIR)\stubs.obj \ 101 $(OBJDIR)\ordinals.obj \ 102 $(OBJDIR)\interlock.obj \ 103 $(OBJDIR)\toolhelp.obj \ 104 $(OBJDIR)\codepage.obj \ 105 $(OBJDIR)\debug.obj \ 106 $(OBJDIR)\oslibdebug.obj \ 107 $(OBJDIR)\dbglocal.obj \ 108 $(OBJDIR)\registry.obj \ 109 $(OBJDIR)\queue.obj \ 110 $(OBJDIR)\hmthread.obj \ 111 $(OBJDIR)\hmnpipe.obj \ 112 $(OBJDIR)\hmdisk.obj \ 113 $(OBJDIR)\version.obj \ 114 !ifdef DEBUG 115 $(OBJDIR)\exceptstackdump.obj \ 116 !endif 117 $(OBJDIR)\module.obj \ 118 $(OBJDIR)\kernelrsrc.obj 12 13 # dummy all rule - invoking nmake withtout target caused it to do all of the targets below.. 14 _all: all 119 15 120 16 121 # 122 # Libraries. One space before the '\'. 123 # (Note! the order here is important!) 124 # 125 LIBS = \ 126 $(ODIN32_LIB)/$(ODINCRT).lib \ 127 $(ODIN32_LIB)\PMWINX.LIB \ 128 $(ODIN32_LIB)\LIBULS.LIB \ 129 $(ODIN32_LIB)\LIBCONV.LIB \ 130 $(ODIN32_LIB)\WIN32K.LIB \ 131 OS2386.LIB \ 132 $(RTLLIB_O) 17 # Subdirectories. 18 SUBDIRS = \ 19 unicode 133 20 134 21 135 # 136 # OS/2 resourcefiles 137 # 138 OS2RES = \ 139 $(OBJDIR)\console.res 22 # All the common rules like all, lib, clean and dep. 23 $(COMMONRULES): 24 $(DODIRS) "$(SUBDIRS)" $(MAKE_CMD) $@ 25 $(MAKE_CMD) -f kernel32.mak $@ 140 26 141 27 142 #143 # Target name - name of the dll without extention and path.144 #145 TARGET = kernel32146 147 148 #149 # Includes the common rules.150 #151 !include $(ODIN32_POST_INC)152 153 154 #155 # Override flags for exceptions.cpp156 # Hmm. This is compiler depended!157 #158 $(OBJDIR)\exceptions.obj: exceptions.cpp159 !if "$(VAC3)" == "1" || "$(VAC36)" == "1"160 $(CXX) $(CXXFLAGS) $(CINCLUDES) $(CDEFINES) -O- \161 -Fo$(OBJDIR)\$(@B).obj -c exceptions.cpp162 !else163 # Since this only turns off stack optimizations I take it's a VAC only fix.164 # -kso (2001-02-17)165 # ! error "Compiler is not supported yet."166 !endif167 -
trunk/src/kernel32/ole2nls.cpp
r5155 r5451 1 /* $Id: ole2nls.cpp,v 1. 8 2001-02-17 19:44:59sandervl Exp $ */1 /* $Id: ole2nls.cpp,v 1.9 2001-04-03 14:10:48 sandervl Exp $ */ 2 2 3 3 /* … … 1348 1348 } 1349 1349 1350 1351 ODINFUNCTION5(BOOL, GetStringTypeExW,1352 LCID, locale,1353 DWORD, dwInfoType,1354 LPCWSTR, lpSrcStr,1355 int, cchSrc,1356 LPWORD, lpCharType)1357 {1358 int i;1359 1360 dprintf(("KERNEL32: GetStringTypeW, not properly implemented\n"));1361 if((DWORD)lpSrcStr == (DWORD)lpCharType ||1362 !lpSrcStr ||1363 !lpCharType)1364 {1365 SetLastError(ERROR_INVALID_PARAMETER);1366 return(FALSE);1367 }1368 1369 if(cchSrc == -1)1370 cchSrc = lstrlenW(lpSrcStr);1371 1372 switch(dwInfoType)1373 {1374 case CT_CTYPE1:1375 for(i=0;i<cchSrc;i++)1376 {1377 lpCharType[i] = 0;1378 if (isdigit(lpSrcStr[i])) lpCharType[i]|=C1_DIGIT;1379 if (isalpha(lpSrcStr[i])) lpCharType[i]|=C1_ALPHA;1380 if (islower(lpSrcStr[i])) lpCharType[i]|=C1_LOWER;1381 if (isupper(lpSrcStr[i])) lpCharType[i]|=C1_UPPER;1382 if (isspace(lpSrcStr[i])) lpCharType[i]|=C1_SPACE;1383 if (ispunct(lpSrcStr[i])) lpCharType[i]|=C1_PUNCT;1384 if (iscntrl(lpSrcStr[i])) lpCharType[i]|=C1_CNTRL;1385 if ( (lpSrcStr[i] == ' ') ||1386 (lpSrcStr[i] == '\t') )1387 lpCharType[i]|=C1_BLANK;1388 }1389 return TRUE;1390 break;1391 1392 case CT_CTYPE2:1393 case CT_CTYPE3: //not supported right now1394 return FALSE;1395 break;1396 }1397 1398 return FALSE;1399 }1400 1401 ODINFUNCTION4(BOOL, GetStringTypeW,1402 DWORD, dwInfoType,1403 LPCWSTR, lpSrcStr,1404 int, cchSrc,1405 LPWORD, lpCharType)1406 {1407 return CALL_ODINFUNC(GetStringTypeExW)(0,1408 dwInfoType,1409 lpSrcStr,1410 cchSrc,1411 lpCharType);1412 }1413 1414 1415 1416 1350 /*********************************************************************** 1417 1351 * VerLanguageNameA [KERNEL32.709][VERSION.9] -
trunk/src/kernel32/stubs.cpp
r5308 r5451 967 967 968 968 /***************************************************************************** 969 * Name : BOOL WIN32API EnumSystemCodePagesA970 * Purpose : The EnumSystemCodePagesA function enumerates the code pages that971 * are either installed on or supported by a system. The dwFlags972 * parameter determines whether the function enumerates installed973 * or supported code pages. The function enumerates the code pages974 * by passing code page identifiers, one at a time, to the specified975 * application-defined callback function. This continues until all976 * of the installed or supported code page identifiers have been977 * passed to the callback function, or the callback function978 * returns FALSE979 * Parameters: CODEPAGE_ENUMPROCA lpCodePageEnumProc pointer to enumeration980 * callback function981 * DWORD dwFlags indicates which code pages982 * to enumerate983 * Variables :984 * Result : If the function succeeds, the return value is nonzero.985 * If the function fails, the return value is zero986 * Remark :987 * Status : UNTESTED STUB988 *989 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]990 *****************************************************************************/991 992 BOOL WIN32API EnumSystemCodePagesA(CODEPAGE_ENUMPROCA lpCodePageEnumProc,993 DWORD dwFlags)994 {995 996 dprintf(("KERNEL32: EnumSystemCodePagesA(%08x,%08x) not implemented\n",997 lpCodePageEnumProc, dwFlags998 ));999 1000 return (FALSE);1001 }1002 1003 /*****************************************************************************1004 * Name : BOOL WIN32API EnumSystemCodePagesW1005 * Purpose : The EnumSystemCodePagesW function enumerates the code pages that1006 * are either installed on or supported by a system. The dwFlags1007 * parameter determines whether the function enumerates installed1008 * or supported code pages. The function enumerates the code pages1009 * by passing code page identifiers, one at a time, to the specified1010 * application-defined callback function. This continues until all1011 * of the installed or supported code page identifiers have been1012 * passed to the callback function, or the callback function1013 * returns FALSE1014 * Parameters: CODEPAGE_ENUMPROCW lpCodePageEnumProc pointer to enumeration1015 * callback function1016 * DWORD dwFlags indicates which code pages1017 * to enumerate1018 * Variables :1019 * Result : If the function succeeds, the return value is nonzero.1020 * If the function fails, the return value is zero1021 * Remark :1022 * Status : UNTESTED STUB1023 *1024 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1025 *****************************************************************************/1026 1027 BOOL WIN32API EnumSystemCodePagesW(CODEPAGE_ENUMPROCW lpCodePageEnumProc,1028 DWORD dwFlags)1029 {1030 1031 dprintf(("KERNEL32: EnumSystemCodePagesA(%08x,%08x) not implemented\n",1032 lpCodePageEnumProc, dwFlags1033 ));1034 1035 return (FALSE);1036 }1037 1038 /*****************************************************************************1039 969 * Name : DWORD WIN32API EraseTape 1040 970 * Purpose : The EraseTape function erases all or part of a tape. -
trunk/src/kernel32/unicode.cpp
r4964 r5451 1 /* $Id: unicode.cpp,v 1.2 4 2001-01-18 18:14:16sandervl Exp $ */1 /* $Id: unicode.cpp,v 1.25 2001-04-03 14:10:48 sandervl Exp $ */ 2 2 3 3 /* … … 46 46 } 47 47 */ 48 /*********************************************************************** 49 * MultiByteToWideChar (KERNEL32.534) 50 * 51 * PARAMS 52 * page [in] Codepage character set to convert from 53 * flags [in] Character mapping flags 54 * src [in] Source string buffer 55 * srclen [in] Length of source string buffer 56 * dst [in] Destination buffer 57 * dstlen [in] Length of destination buffer 58 * 59 * NOTES 60 * The returned length includes the null terminator character. 61 * 62 * RETURNS 63 * Success: If dstlen > 0, number of characters written to destination 64 * buffer. If dstlen == 0, number of characters needed to do 65 * conversion. 66 * Failure: 0. Occurs if not enough space is available. 67 * 68 * ERRORS 69 * ERROR_INSUFFICIENT_BUFFER 70 * ERROR_INVALID_FLAGS (not yet implemented) 71 * ERROR_INVALID_PARAMETER (not yet implemented) 72 * 73 * BUGS 74 * Does not properly handle codepage conversions. 75 * Does not properly handle flags. 76 * 77 */ 78 INT WINAPI MultiByteToWideChar(UINT page, DWORD flags, 79 LPCSTR src, INT srclen, 80 LPWSTR dst, INT dstlen) 81 { 82 int ret; 83 84 dprintf2(("MultiByteToWideChar: %d %x (%s %d) (%x %d)", page, flags, src, srclen, dst, dstlen)); 85 86 if (!src || (!dst && dstlen)) 87 { 88 SetLastError( ERROR_INVALID_PARAMETER ); 89 return 0; 90 } 91 //-1 means the input string is null terminated and we need to calculate 92 //its length 93 if (srclen == -1) 94 srclen = lstrlenA(src)+1; 95 96 if (!dstlen) 97 return srclen; 98 99 ret = srclen; 100 while (srclen && dstlen) { 101 *dst = (WCHAR)(unsigned char)*src; 102 dst++; src++; 103 dstlen--; srclen--; 104 } 105 if (!dstlen && srclen) { 106 SetLastError(ERROR_INSUFFICIENT_BUFFER); 107 return 0; 108 } 109 return ret; 110 } 111 112 /*********************************************************************** 113 * WideCharToMultiByte (KERNEL32.727) 114 * 115 * PARAMS 116 * page [in] Codepage character set to convert to 117 * flags [in] Character mapping flags 118 * src [in] Source string buffer 119 * srclen [in] Length of source string buffer 120 * dst [in] Destination buffer 121 * dstlen [in] Length of destination buffer 122 * defchar [in] Default character to use for conversion if no exact 123 * conversion can be made 124 * used [out] Set if default character was used in the conversion 125 * 126 * NOTES 127 * The returned length includes the null terminator character. 128 * 129 * RETURNS 130 * Success: If dstlen > 0, number of characters written to destination 131 * buffer. If dstlen == 0, number of characters needed to do 132 * conversion. 133 * Failure: 0. Occurs if not enough space is available. 134 * 135 * ERRORS 136 * ERROR_INSUFFICIENT_BUFFER 137 * ERROR_INVALID_FLAGS (not yet implemented) 138 * 139 * BUGS 140 * Does not properly handle codepage conversions. 141 * Does not properly handle flags. 142 * 143 */ 144 INT WIN32API WideCharToMultiByte(UINT page, DWORD flags, LPCWSTR src, 145 INT srclen,LPSTR dst, INT dstlen, 146 LPCSTR defchar, BOOL *used) 147 { 148 int count = 0; 149 int eos = 0; 150 int care_for_eos=0; 151 int dont_copy= (dstlen==0); 152 153 dprintf2(("WideCharToMultiByte: %d %x (%x %d) (%x %d)", page, flags, src, srclen, dst, dstlen)); 154 155 if ((!src) || ((!dst) && (!dont_copy)) ) 156 { 157 SetLastError(ERROR_INVALID_PARAMETER); 158 return 0; 159 } 160 161 if (page!=GetACP() && page!=CP_OEMCP && page!=CP_ACP) 162 dprintf(("WideCharToMultiByte, Conversion in CP %d not supported\n",page)); 163 #if 0 164 if (flags) 165 dprintf(("WideCharToMultiByte, flags %lx not supported\n",flags)); 166 #endif 167 if(used) 168 *used=0; 169 if (srclen == -1) 170 { 171 srclen = lstrlenW(src)+1; 172 care_for_eos=1; 173 } 174 while(srclen && (dont_copy || dstlen)) 175 { 176 if(!dont_copy){ 177 if(*src<256) 178 *dst = *src; 179 else 180 { 181 /* ??? The WC_DEFAULTCHAR flag only gets used in 182 * combination with the WC_COMPOSITECHECK flag or at 183 * least this is what it seems from using the function 184 * on NT4.0 in combination with reading the documentation. 185 */ 186 *dst = defchar ? *defchar : '?'; 187 if(used)*used=1; 188 } 189 dstlen--; 190 dst++; 191 } 192 count++; 193 srclen--; 194 if((!*src) && care_for_eos) { 195 eos = 1; 196 break; 197 } 198 src++; 199 } 200 if (dont_copy) 201 return count; 202 203 if (!eos && srclen > 0) { 204 SetLastError(ERROR_INSUFFICIENT_BUFFER); 205 return 0; 206 } 207 return count; 208 } 209 //****************************************************************************** 210 //****************************************************************************** 211 BOOL WIN32API GetCPInfo(UINT uCodePage, CPINFO *lpCPInfo) 212 { 213 dprintf(("GetCPInfo (%d), not correctly implemented\n", uCodePage)); 214 memset(lpCPInfo, 0, sizeof(CPINFO)); 215 lpCPInfo->MaxCharSize = 1; 216 lpCPInfo->DefaultChar[0] = 'a'; 217 218 return(TRUE); 219 } 220 48 //****************************************************************************** 221 49 //****************************************************************************** 222 50 // unilen: length of astring buffer (including 0 terminator)
Note:
See TracChangeset
for help on using the changeset viewer.