- Timestamp:
- Sep 3, 2000, 8:05:40 PM (25 years ago)
- Location:
- trunk/src/kernel32
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/KERNEL32.CPP
r4134 r4174 1 /* $Id: KERNEL32.CPP,v 1.5 1 2000-08-31 12:47:51 sandervlExp $ */1 /* $Id: KERNEL32.CPP,v 1.52 2000-09-03 18:04:55 phaller Exp $ */ 2 2 3 3 /* … … 184 184 //****************************************************************************** 185 185 //****************************************************************************** 186 187 static const unsigned char CT_CType2_LUT[] = {188 C2_NOTAPPLICABLE, /* - 0 */189 C2_NOTAPPLICABLE, /* - 1 */190 C2_NOTAPPLICABLE, /* - 2 */191 C2_NOTAPPLICABLE, /* - 3 */192 C2_NOTAPPLICABLE, /* - 4 */193 C2_NOTAPPLICABLE, /* - 5 */194 C2_NOTAPPLICABLE, /* - 6 */195 C2_NOTAPPLICABLE, /* - 7 */196 C2_NOTAPPLICABLE, /* - 8 */197 C2_SEGMENTSEPARATOR, /* - 9 */198 C2_NOTAPPLICABLE, /* - 10 */199 C2_NOTAPPLICABLE, /* - 11 */200 C2_NOTAPPLICABLE, /* - 12 */201 C2_NOTAPPLICABLE, /* - 13 */202 C2_NOTAPPLICABLE, /* - 14 */203 C2_NOTAPPLICABLE, /* - 15 */204 C2_NOTAPPLICABLE, /* - 16 */205 C2_NOTAPPLICABLE, /* - 17 */206 C2_NOTAPPLICABLE, /* - 18 */207 C2_NOTAPPLICABLE, /* - 19 */208 C2_NOTAPPLICABLE, /* - 20 */209 C2_NOTAPPLICABLE, /* - 21 */210 C2_NOTAPPLICABLE, /* - 22 */211 C2_NOTAPPLICABLE, /* - 23 */212 C2_NOTAPPLICABLE, /* - 24 */213 C2_NOTAPPLICABLE, /* - 25 */214 C2_NOTAPPLICABLE, /* - 26 */215 C2_NOTAPPLICABLE, /* - 27 */216 C2_NOTAPPLICABLE, /* - 28 */217 C2_NOTAPPLICABLE, /* - 29 */218 C2_NOTAPPLICABLE, /* - 30 */219 C2_NOTAPPLICABLE, /* - 31 */220 C2_WHITESPACE, /* - 32 */221 C2_OTHERNEUTRAL, /* ! - 33 */222 C2_OTHERNEUTRAL, /* " - 34 */ /* " */223 C2_EUROPETERMINATOR, /* # - 35 */224 C2_EUROPETERMINATOR, /* $ - 36 */225 C2_EUROPETERMINATOR, /* % - 37 */226 C2_LEFTTORIGHT, /* & - 38 */227 C2_OTHERNEUTRAL, /* ' - 39 */228 C2_OTHERNEUTRAL, /* ( - 40 */229 C2_OTHERNEUTRAL, /* ) - 41 */230 C2_OTHERNEUTRAL, /* * - 42 */231 C2_EUROPETERMINATOR, /* + - 43 */232 C2_COMMONSEPARATOR, /* , - 44 */233 C2_EUROPETERMINATOR, /* - - 45 */234 C2_EUROPESEPARATOR, /* . - 46 */235 C2_EUROPESEPARATOR, /* / - 47 */236 C2_EUROPENUMBER, /* 0 - 48 */237 C2_EUROPENUMBER, /* 1 - 49 */238 C2_EUROPENUMBER, /* 2 - 50 */239 C2_EUROPENUMBER, /* 3 - 51 */240 C2_EUROPENUMBER, /* 4 - 52 */241 C2_EUROPENUMBER, /* 5 - 53 */242 C2_EUROPENUMBER, /* 6 - 54 */243 C2_EUROPENUMBER, /* 7 - 55 */244 C2_EUROPENUMBER, /* 8 - 56 */245 C2_EUROPENUMBER, /* 9 - 57 */246 C2_COMMONSEPARATOR, /* : - 58 */247 C2_OTHERNEUTRAL, /* ; - 59 */248 C2_OTHERNEUTRAL, /* < - 60 */249 C2_OTHERNEUTRAL, /* = - 61 */250 C2_OTHERNEUTRAL, /* > - 62 */251 C2_OTHERNEUTRAL, /* ? - 63 */252 C2_LEFTTORIGHT, /* @ - 64 */253 C2_LEFTTORIGHT, /* A - 65 */254 C2_LEFTTORIGHT, /* B - 66 */255 C2_LEFTTORIGHT, /* C - 67 */256 C2_LEFTTORIGHT, /* D - 68 */257 C2_LEFTTORIGHT, /* E - 69 */258 C2_LEFTTORIGHT, /* F - 70 */259 C2_LEFTTORIGHT, /* G - 71 */260 C2_LEFTTORIGHT, /* H - 72 */261 C2_LEFTTORIGHT, /* I - 73 */262 C2_LEFTTORIGHT, /* J - 74 */263 C2_LEFTTORIGHT, /* K - 75 */264 C2_LEFTTORIGHT, /* L - 76 */265 C2_LEFTTORIGHT, /* M - 77 */266 C2_LEFTTORIGHT, /* N - 78 */267 C2_LEFTTORIGHT, /* O - 79 */268 C2_LEFTTORIGHT, /* P - 80 */269 C2_LEFTTORIGHT, /* Q - 81 */270 C2_LEFTTORIGHT, /* R - 82 */271 C2_LEFTTORIGHT, /* S - 83 */272 C2_LEFTTORIGHT, /* T - 84 */273 C2_LEFTTORIGHT, /* U - 85 */274 C2_LEFTTORIGHT, /* V - 86 */275 C2_LEFTTORIGHT, /* W - 87 */276 C2_LEFTTORIGHT, /* X - 88 */277 C2_LEFTTORIGHT, /* Y - 89 */278 C2_LEFTTORIGHT, /* Z - 90 */279 C2_OTHERNEUTRAL, /* [ - 91 */280 C2_OTHERNEUTRAL, /* \ - 92 */281 C2_OTHERNEUTRAL, /* ] - 93 */282 C2_OTHERNEUTRAL, /* ^ - 94 */283 C2_OTHERNEUTRAL, /* _ - 95 */284 C2_OTHERNEUTRAL, /* ` - 96 */285 C2_LEFTTORIGHT, /* a - 97 */286 C2_LEFTTORIGHT, /* b - 98 */287 C2_LEFTTORIGHT, /* c - 99 */288 C2_LEFTTORIGHT, /* d - 100 */289 C2_LEFTTORIGHT, /* e - 101 */290 C2_LEFTTORIGHT, /* f - 102 */291 C2_LEFTTORIGHT, /* g - 103 */292 C2_LEFTTORIGHT, /* h - 104 */293 C2_LEFTTORIGHT, /* i - 105 */294 C2_LEFTTORIGHT, /* j - 106 */295 C2_LEFTTORIGHT, /* k - 107 */296 C2_LEFTTORIGHT, /* l - 108 */297 C2_LEFTTORIGHT, /* m - 109 */298 C2_LEFTTORIGHT, /* n - 110 */299 C2_LEFTTORIGHT, /* o - 111 */300 C2_LEFTTORIGHT, /* p - 112 */301 C2_LEFTTORIGHT, /* q - 113 */302 C2_LEFTTORIGHT, /* r - 114 */303 C2_LEFTTORIGHT, /* s - 115 */304 C2_LEFTTORIGHT, /* t - 116 */305 C2_LEFTTORIGHT, /* u - 117 */306 C2_LEFTTORIGHT, /* v - 118 */307 C2_LEFTTORIGHT, /* w - 119 */308 C2_LEFTTORIGHT, /* x - 120 */309 C2_LEFTTORIGHT, /* y - 121 */310 C2_LEFTTORIGHT, /* z - 122 */311 C2_OTHERNEUTRAL, /* { - 123 */312 C2_OTHERNEUTRAL, /* | - 124 */313 C2_OTHERNEUTRAL, /* } - 125 */314 C2_OTHERNEUTRAL, /* ~ - 126 */315 C2_NOTAPPLICABLE, /* - 127 */316 C2_NOTAPPLICABLE, /* - 128 */317 C2_NOTAPPLICABLE, /* - 129 */318 C2_OTHERNEUTRAL, /* - 130 */319 C2_LEFTTORIGHT, /* - 131 */320 C2_OTHERNEUTRAL, /* - 132 */321 C2_OTHERNEUTRAL, /*322 - 133 */323 C2_OTHERNEUTRAL, /* - 134 */324 C2_OTHERNEUTRAL, /* - 135 */325 C2_LEFTTORIGHT, /* - 136 */326 C2_EUROPETERMINATOR, /* - 137 */327 C2_LEFTTORIGHT, /* - 138 */328 C2_OTHERNEUTRAL, /* - 139 */329 C2_LEFTTORIGHT, /* - 140 */330 C2_NOTAPPLICABLE, /* - 141 */331 C2_NOTAPPLICABLE, /* - 142 */332 C2_NOTAPPLICABLE, /* - 143 */333 C2_NOTAPPLICABLE, /* - 144 */334 C2_OTHERNEUTRAL, /* - 145 */335 C2_OTHERNEUTRAL, /* - 146 */336 C2_OTHERNEUTRAL, /* - 147 */337 C2_OTHERNEUTRAL, /* - 148 */338 C2_OTHERNEUTRAL, /* - 149 */339 C2_OTHERNEUTRAL, /* - 150 */340 C2_OTHERNEUTRAL, /* - 151 */341 C2_LEFTTORIGHT, /* - 152 */342 C2_OTHERNEUTRAL, /* - 153 */343 C2_LEFTTORIGHT, /* - 154 */344 C2_OTHERNEUTRAL, /* - 155 */345 C2_LEFTTORIGHT, /* - 156 */346 C2_NOTAPPLICABLE, /* - 157 */347 C2_NOTAPPLICABLE, /* - 158 */348 C2_LEFTTORIGHT, /* - 159 */349 C2_WHITESPACE, /* - 160 */350 C2_OTHERNEUTRAL, /* ¡ - 161 */351 C2_EUROPETERMINATOR, /* ¢ - 162 */352 C2_EUROPETERMINATOR, /* £ - 163 */353 C2_EUROPETERMINATOR, /* € - 164 */354 C2_EUROPETERMINATOR, /* ¥ - 165 */355 C2_OTHERNEUTRAL, /* Š - 166 */356 C2_OTHERNEUTRAL, /* § - 167 */357 C2_OTHERNEUTRAL, /* š - 168 */358 C2_OTHERNEUTRAL, /* © - 169 */359 C2_OTHERNEUTRAL, /* ª - 170 */360 C2_OTHERNEUTRAL, /* « - 171 */361 C2_OTHERNEUTRAL, /* ¬ - 172 */362 C2_OTHERNEUTRAL, /* - 173 */363 C2_OTHERNEUTRAL, /* ® - 174 */364 C2_OTHERNEUTRAL, /* ¯ - 175 */365 C2_EUROPETERMINATOR, /* ° - 176 */366 C2_EUROPETERMINATOR, /* ± - 177 */367 C2_EUROPENUMBER, /* ² - 178 */368 C2_EUROPENUMBER, /* ³ - 179 */369 C2_OTHERNEUTRAL, /* Ž - 180 */370 C2_OTHERNEUTRAL, /* µ - 181 */371 C2_OTHERNEUTRAL, /* ¶ - 182 */372 C2_OTHERNEUTRAL, /* · - 183 */373 C2_OTHERNEUTRAL, /* ž - 184 */374 C2_EUROPENUMBER, /* ¹ - 185 */375 C2_OTHERNEUTRAL, /* º - 186 */376 C2_OTHERNEUTRAL, /* » - 187 */377 C2_OTHERNEUTRAL, /* Œ - 188 */378 C2_OTHERNEUTRAL, /* œ - 189 */379 C2_OTHERNEUTRAL, /* Ÿ - 190 */380 C2_OTHERNEUTRAL, /* ¿ - 191 */381 C2_LEFTTORIGHT, /* À - 192 */382 C2_LEFTTORIGHT, /* Á - 193 */383 C2_LEFTTORIGHT, /*  - 194 */384 C2_LEFTTORIGHT, /* à - 195 */385 C2_LEFTTORIGHT, /* Ä - 196 */386 C2_LEFTTORIGHT, /* Å - 197 */387 C2_LEFTTORIGHT, /* Æ - 198 */388 C2_LEFTTORIGHT, /* Ç - 199 */389 C2_LEFTTORIGHT, /* È - 200 */390 C2_LEFTTORIGHT, /* É - 201 */391 C2_LEFTTORIGHT, /* Ê - 202 */392 C2_LEFTTORIGHT, /* Ë - 203 */393 C2_LEFTTORIGHT, /* Ì - 204 */394 C2_LEFTTORIGHT, /* Í - 205 */395 C2_LEFTTORIGHT, /* Î - 206 */396 C2_LEFTTORIGHT, /* Ï - 207 */397 C2_LEFTTORIGHT, /* Ð - 208 */398 C2_LEFTTORIGHT, /* Ñ - 209 */399 C2_LEFTTORIGHT, /* Ò - 210 */400 C2_LEFTTORIGHT, /* Ó - 211 */401 C2_LEFTTORIGHT, /* Ô - 212 */402 C2_LEFTTORIGHT, /* Õ - 213 */403 C2_LEFTTORIGHT, /* Ö - 214 */404 C2_OTHERNEUTRAL, /* × - 215 */405 C2_LEFTTORIGHT, /* Ø - 216 */406 C2_LEFTTORIGHT, /* Ù - 217 */407 C2_LEFTTORIGHT, /* Ú - 218 */408 C2_LEFTTORIGHT, /* Û - 219 */409 C2_LEFTTORIGHT, /* Ü - 220 */410 C2_LEFTTORIGHT, /* Ý - 221 */411 C2_LEFTTORIGHT, /* Þ - 222 */412 C2_LEFTTORIGHT, /* ß - 223 */413 C2_LEFTTORIGHT, /* à - 224 */414 C2_LEFTTORIGHT, /* á - 225 */415 C2_LEFTTORIGHT, /* â - 226 */416 C2_LEFTTORIGHT, /* ã - 227 */417 C2_LEFTTORIGHT, /* ä - 228 */418 C2_LEFTTORIGHT, /* å - 229 */419 C2_LEFTTORIGHT, /* æ - 230 */420 C2_LEFTTORIGHT, /* ç - 231 */421 C2_LEFTTORIGHT, /* è - 232 */422 C2_LEFTTORIGHT, /* é - 233 */423 C2_LEFTTORIGHT, /* ê - 234 */424 C2_LEFTTORIGHT, /* ë - 235 */425 C2_LEFTTORIGHT, /* ì - 236 */426 C2_LEFTTORIGHT, /* í - 237 */427 C2_LEFTTORIGHT, /* î - 238 */428 C2_LEFTTORIGHT, /* ï - 239 */429 C2_LEFTTORIGHT, /* ð - 240 */430 C2_LEFTTORIGHT, /* ñ - 241 */431 C2_LEFTTORIGHT, /* ò - 242 */432 C2_LEFTTORIGHT, /* ó - 243 */433 C2_LEFTTORIGHT, /* ô - 244 */434 C2_LEFTTORIGHT, /* õ - 245 */435 C2_LEFTTORIGHT, /* ö - 246 */436 C2_OTHERNEUTRAL, /* ÷ - 247 */437 C2_LEFTTORIGHT, /* ø - 248 */438 C2_LEFTTORIGHT, /* ù - 249 */439 C2_LEFTTORIGHT, /* ú - 250 */440 C2_LEFTTORIGHT, /* û - 251 */441 C2_LEFTTORIGHT, /* ü - 252 */442 C2_LEFTTORIGHT, /* ý - 253 */443 C2_LEFTTORIGHT, /* þ - 254 */444 C2_LEFTTORIGHT /* ÿ - 255 */445 };446 447 const WORD OLE2NLS_CT_CType3_LUT[] = {448 0x0000, /* - 0 */449 0x0000, /* - 1 */450 0x0000, /* - 2 */451 0x0000, /* - 3 */452 0x0000, /* - 4 */453 0x0000, /* - 5 */454 0x0000, /* - 6 */455 0x0000, /* - 7 */456 0x0000, /* - 8 */457 0x0008, /* - 9 */458 0x0008, /* - 10 */459 0x0008, /* - 11 */460 0x0008, /* - 12 */461 0x0008, /* - 13 */462 0x0000, /* - 14 */463 0x0000, /* - 15 */464 0x0000, /* - 16 */465 0x0000, /* - 17 */466 0x0000, /* - 18 */467 0x0000, /* - 19 */468 0x0000, /* - 20 */469 0x0000, /* - 21 */470 0x0000, /* - 22 */471 0x0000, /* - 23 */472 0x0000, /* - 24 */473 0x0000, /* - 25 */474 0x0000, /* - 26 */475 0x0000, /* - 27 */476 0x0000, /* - 28 */477 0x0000, /* - 29 */478 0x0000, /* - 30 */479 0x0000, /* - 31 */480 0x0048, /* - 32 */481 0x0048, /* ! - 33 */482 0x0448, /* " - 34 */ /* " */483 0x0048, /* # - 35 */484 0x0448, /* $ - 36 */485 0x0048, /* % - 37 */486 0x0048, /* & - 38 */487 0x0440, /* ' - 39 */488 0x0048, /* ( - 40 */489 0x0048, /* ) - 41 */490 0x0048, /* * - 42 */491 0x0048, /* + - 43 */492 0x0048, /* , - 44 */493 0x0440, /* - - 45 */494 0x0048, /* . - 46 */495 0x0448, /* / - 47 */496 0x0040, /* 0 - 48 */497 0x0040, /* 1 - 49 */498 0x0040, /* 2 - 50 */499 0x0040, /* 3 - 51 */500 0x0040, /* 4 - 52 */501 0x0040, /* 5 - 53 */502 0x0040, /* 6 - 54 */503 0x0040, /* 7 - 55 */504 0x0040, /* 8 - 56 */505 0x0040, /* 9 - 57 */506 0x0048, /* : - 58 */507 0x0048, /* ; - 59 */508 0x0048, /* < - 60 */509 0x0448, /* = - 61 */510 0x0048, /* > - 62 */511 0x0048, /* ? - 63 */512 0x0448, /* @ - 64 */513 0x8040, /* A - 65 */514 0x8040, /* B - 66 */515 0x8040, /* C - 67 */516 0x8040, /* D - 68 */517 0x8040, /* E - 69 */518 0x8040, /* F - 70 */519 0x8040, /* G - 71 */520 0x8040, /* H - 72 */521 0x8040, /* I - 73 */522 0x8040, /* J - 74 */523 0x8040, /* K - 75 */524 0x8040, /* L - 76 */525 0x8040, /* M - 77 */526 0x8040, /* N - 78 */527 0x8040, /* O - 79 */528 0x8040, /* P - 80 */529 0x8040, /* Q - 81 */530 0x8040, /* R - 82 */531 0x8040, /* S - 83 */532 0x8040, /* T - 84 */533 0x8040, /* U - 85 */534 0x8040, /* V - 86 */535 0x8040, /* W - 87 */536 0x8040, /* X - 88 */537 0x8040, /* Y - 89 */538 0x8040, /* Z - 90 */539 0x0048, /* [ - 91 */540 0x0448, /* \ - 92 */541 0x0048, /* ] - 93 */542 0x0448, /* ^ - 94 */543 0x0448, /* _ - 95 */544 0x0448, /* ` - 96 */545 0x8040, /* a - 97 */546 0x8040, /* b - 98 */547 0x8040, /* c - 99 */548 0x8040, /* d - 100 */549 0x8040, /* e - 101 */550 0x8040, /* f - 102 */551 0x8040, /* g - 103 */552 0x8040, /* h - 104 */553 0x8040, /* i - 105 */554 0x8040, /* j - 106 */555 0x8040, /* k - 107 */556 0x8040, /* l - 108 */557 0x8040, /* m - 109 */558 0x8040, /* n - 110 */559 0x8040, /* o - 111 */560 0x8040, /* p - 112 */561 0x8040, /* q - 113 */562 0x8040, /* r - 114 */563 0x8040, /* s - 115 */564 0x8040, /* t - 116 */565 0x8040, /* u - 117 */566 0x8040, /* v - 118 */567 0x8040, /* w - 119 */568 0x8040, /* x - 120 */569 0x8040, /* y - 121 */570 0x8040, /* z - 122 */571 0x0048, /* { - 123 */572 0x0048, /* | - 124 */573 0x0048, /* } - 125 */574 0x0448, /* ~ - 126 */575 0x0000, /* - 127 */576 0x0000, /* - 128 */577 0x0000, /* - 129 */578 0x0008, /* - 130 */579 0x8000, /* - 131 */580 0x0008, /* - 132 */581 0x0008, /*582 - 133 */583 0x0008, /* - 134 */584 0x0008, /* - 135 */585 0x0001, /* - 136 */586 0x0008, /* - 137 */587 0x8003, /* - 138 */588 0x0008, /* - 139 */589 0x8000, /* - 140 */590 0x0000, /* - 141 */591 0x0000, /* - 142 */592 0x0000, /* - 143 */593 0x0000, /* - 144 */594 0x0088, /* - 145 */595 0x0088, /* - 146 */596 0x0088, /* - 147 */597 0x0088, /* - 148 */598 0x0008, /* - 149 */599 0x0400, /* - 150 */600 0x0400, /* - 151 */601 0x0408, /* - 152 */602 0x0000, /* - 153 */603 0x8003, /* - 154 */604 0x0008, /* - 155 */605 0x8000, /* - 156 */606 0x0000, /* - 157 */607 0x0000, /* - 158 */608 0x8003, /* - 159 */609 0x0008, /* - 160 */610 0x0008, /* ¡ - 161 */611 0x0048, /* ¢ - 162 */612 0x0048, /* £ - 163 */613 0x0008, /* € - 164 */614 0x0048, /* ¥ - 165 */615 0x0048, /* Š - 166 */616 0x0008, /* § - 167 */617 0x0408, /* š - 168 */618 0x0008, /* © - 169 */619 0x0400, /* ª - 170 */620 0x0008, /* « - 171 */621 0x0048, /* ¬ - 172 */622 0x0408, /* - 173 */623 0x0008, /* ® - 174 */624 0x0448, /* ¯ - 175 */625 0x0008, /* ° - 176 */626 0x0008, /* ± - 177 */627 0x0000, /* ² - 178 */628 0x0000, /* ³ - 179 */629 0x0408, /* Ž - 180 */630 0x0008, /* µ - 181 */631 0x0008, /* ¶ - 182 */632 0x0008, /* · - 183 */633 0x0408, /* ž - 184 */634 0x0000, /* ¹ - 185 */635 0x0400, /* º - 186 */636 0x0008, /* » - 187 */637 0x0000, /* Œ - 188 */638 0x0000, /* œ - 189 */639 0x0000, /* Ÿ - 190 */640 0x0008, /* ¿ - 191 */641 0x8003, /* À - 192 */642 0x8003, /* Á - 193 */643 0x8003, /*  - 194 */644 0x8003, /* à - 195 */645 0x8003, /* Ä - 196 */646 0x8003, /* Å - 197 */647 0x8000, /* Æ - 198 */648 0x8003, /* Ç - 199 */649 0x8003, /* È - 200 */650 0x8003, /* É - 201 */651 0x8003, /* Ê - 202 */652 0x8003, /* Ë - 203 */653 0x8003, /* Ì - 204 */654 0x8003, /* Í - 205 */655 0x8003, /* Î - 206 */656 0x8003, /* Ï - 207 */657 0x8000, /* Ð - 208 */658 0x8003, /* Ñ - 209 */659 0x8003, /* Ò - 210 */660 0x8003, /* Ó - 211 */661 0x8003, /* Ô - 212 */662 0x8003, /* Õ - 213 */663 0x8003, /* Ö - 214 */664 0x0008, /* × - 215 */665 0x8003, /* Ø - 216 */666 0x8003, /* Ù - 217 */667 0x8003, /* Ú - 218 */668 0x8003, /* Û - 219 */669 0x8003, /* Ü - 220 */670 0x8003, /* Ý - 221 */671 0x8000, /* Þ - 222 */672 0x8000, /* ß - 223 */673 0x8003, /* à - 224 */674 0x8003, /* á - 225 */675 0x8003, /* â - 226 */676 0x8003, /* ã - 227 */677 0x8003, /* ä - 228 */678 0x8003, /* å - 229 */679 0x8000, /* æ - 230 */680 0x8003, /* ç - 231 */681 0x8003, /* è - 232 */682 0x8003, /* é - 233 */683 0x8003, /* ê - 234 */684 0x8003, /* ë - 235 */685 0x8003, /* ì - 236 */686 0x8003, /* í - 237 */687 0x8003, /* î - 238 */688 0x8003, /* ï - 239 */689 0x8000, /* ð - 240 */690 0x8003, /* ñ - 241 */691 0x8003, /* ò - 242 */692 0x8003, /* ó - 243 */693 0x8003, /* ô - 244 */694 0x8003, /* õ - 245 */695 0x8003, /* ö - 246 */696 0x0008, /* ÷ - 247 */697 0x8003, /* ø - 248 */698 0x8003, /* ù - 249 */699 0x8003, /* ú - 250 */700 0x8003, /* û - 251 */701 0x8003, /* ü - 252 */702 0x8003, /* ý - 253 */703 0x8000, /* þ - 254 */704 0x8003 /* ÿ - 255 */705 };706 707 708 709 710 ODINFUNCTION5(BOOL, GetStringTypeExW,711 LCID, locale,712 DWORD, dwInfoType,713 LPCWSTR, lpSrcStr,714 int, cchSrc,715 LPWORD, lpCharType)716 {717 int i;718 719 dprintf(("KERNEL32: GetStringTypeW, not properly implemented\n"));720 if((DWORD)lpSrcStr == (DWORD)lpCharType ||721 !lpSrcStr ||722 !lpCharType)723 {724 O32_SetLastError(ERROR_INVALID_PARAMETER);725 return(FALSE);726 }727 728 if(cchSrc == -1)729 cchSrc = UniStrlen((UniChar*)lpSrcStr);730 731 switch(dwInfoType)732 {733 case CT_CTYPE1:734 for(i=0;i<cchSrc;i++)735 {736 lpCharType[i] = 0;737 if (isdigit(lpSrcStr[i])) lpCharType[i]|=C1_DIGIT;738 if (isalpha(lpSrcStr[i])) lpCharType[i]|=C1_ALPHA;739 if (islower(lpSrcStr[i])) lpCharType[i]|=C1_LOWER;740 if (isupper(lpSrcStr[i])) lpCharType[i]|=C1_UPPER;741 if (isspace(lpSrcStr[i])) lpCharType[i]|=C1_SPACE;742 if (ispunct(lpSrcStr[i])) lpCharType[i]|=C1_PUNCT;743 if (iscntrl(lpSrcStr[i])) lpCharType[i]|=C1_CNTRL;744 if ( (lpSrcStr[i] == ' ') ||745 (lpSrcStr[i] == '\t') )746 lpCharType[i]|=C1_BLANK;747 }748 return TRUE;749 break;750 751 case CT_CTYPE2:752 case CT_CTYPE3: //not supported right now753 return FALSE;754 break;755 }756 757 return FALSE;758 }759 760 ODINFUNCTION4(BOOL, GetStringTypeW,761 DWORD, dwInfoType,762 LPCWSTR, lpSrcStr,763 int, cchSrc,764 LPWORD, lpCharType)765 {766 return ODIN_GetStringTypeExW(0,767 dwInfoType,768 lpSrcStr,769 cchSrc,770 lpCharType);771 }772 773 /******************************************************************************774 *GetStringTypeExA[KERNEL32.397]775 *776 * FIXME: Ignores the locale.777 */778 ODINFUNCTION5(BOOL, GetStringTypeExA,779 LCID, locale,780 DWORD, dwInfoType,781 LPCSTR, src,782 INT, cchSrc,783 LPWORD, chartype)784 {785 int i;786 787 if ((src==NULL) ||788 (chartype==NULL) ||789 (src==(LPSTR)chartype))790 {791 SetLastError(ERROR_INVALID_PARAMETER);792 return FALSE;793 }794 795 if (cchSrc==-1)796 cchSrc=lstrlenA(src)+1;797 798 switch (dwInfoType)799 {800 case CT_CTYPE1:801 for (i=0;i<cchSrc;i++)802 {803 chartype[i] = 0;804 if (isdigit(src[i])) chartype[i]|=C1_DIGIT;805 if (isalpha(src[i])) chartype[i]|=C1_ALPHA;806 if (islower(src[i])) chartype[i]|=C1_LOWER;807 if (isupper(src[i])) chartype[i]|=C1_UPPER;808 if (isspace(src[i])) chartype[i]|=C1_SPACE;809 if (ispunct(src[i])) chartype[i]|=C1_PUNCT;810 if (iscntrl(src[i])) chartype[i]|=C1_CNTRL;811 /* FIXME: isblank() is a GNU extension */812 /*if (isblank(src[i])) chartype[i]|=C1_BLANK; */813 if ((src[i] == ' ') || (src[i] == '\t')) chartype[i]|=C1_BLANK;814 /* C1_XDIGIT */815 }816 return TRUE;817 818 case CT_CTYPE2:819 for (i=0;i<cchSrc;i++)820 {821 chartype[i]=(WORD)CT_CType2_LUT[i];822 }823 return TRUE;824 825 case CT_CTYPE3:826 for (i=0;i<cchSrc;i++)827 {828 chartype[i]=OLE2NLS_CT_CType3_LUT[i];829 }830 return TRUE;831 832 default:833 dprintf(("Unknown dwInfoType:%ld\n",834 dwInfoType));835 return FALSE;836 }837 }838 839 //******************************************************************************840 //NOTE: This has one parameter more than the W version! (@#$@#$)841 //******************************************************************************842 ODINFUNCTION5(BOOL, GetStringTypeA,843 LCID, locale,844 DWORD, dwInfoType,845 LPCSTR, lpSrcStr,846 int, cchSrc,847 LPWORD, lpCharType)848 {849 return ODIN_GetStringTypeExA(locale,850 dwInfoType,851 lpSrcStr,852 cchSrc,853 lpCharType);854 }855 856 //******************************************************************************857 186 VOID WIN32API GlobalMemoryStatus( MEMORYSTATUS *arg1) 858 187 { … … 887 216 } 888 217 //****************************************************************************** 889 //TODO!890 //******************************************************************************891 int WIN32API LCMapStringW(892 DWORD /*LCID*/ Locale,893 DWORD dwMapFlags,894 LPCWSTR lpSrcStr,895 int cchSrc,896 LPWSTR lpDestStr,897 int cchDest)898 {899 // quick hack! this code is not done!900 dprintf(("LCMapStringW: NOT IMPLEMENTED!"));901 if(cchSrc == -1)902 cchSrc = strlen((const char *)lpSrcStr);903 if(!cchDest)904 return cchSrc;905 lstrcpynW(lpDestStr, lpSrcStr, max(cchSrc, cchDest));906 return max(cchSrc, cchDest);907 }908 //******************************************************************************909 //TODO!910 //******************************************************************************911 int WIN32API LCMapStringA(912 DWORD /*LCID*/ Locale,913 DWORD dwMapFlags,914 LPCSTR lpSrcStr,915 int cchSrc,916 LPSTR lpDestStr,917 int cchDest)918 {919 dprintf(("KERNEL32: LCMapStringA not implemented\n"));920 if(cchSrc == -1)921 cchSrc = strlen((const char *)lpSrcStr);922 if(!cchDest)923 return cchSrc;924 strncpy((char *)lpDestStr, (const char *)lpSrcStr, max(cchSrc, cchDest));925 return max(cchSrc, cchDest);926 }927 //******************************************************************************928 //SvL: 24-6-'97 - Added929 218 //****************************************************************************** 930 219 BOOL WIN32API Beep( DWORD arg1, DWORD arg2) … … 996 285 997 286 return O32_MulDiv(arg1, arg2, arg3); 998 }999 //******************************************************************************1000 UINT WIN32API CompareStringA(LCID lcid, DWORD fdwStyle, LPCSTR lpString1,1001 DWORD cch1, LPCSTR lpString2, DWORD cch2)1002 {1003 int i;1004 int fEqual = TRUE;1005 char *string1 = (char *)lpString1, *string2 = (char *)lpString2;1006 1007 SetLastError(0);1008 1009 #ifdef DEBUG1010 if(fdwStyle & SORT_STRINGSORT)1011 dprintf(("KERNEL32: SORT_STRINGSORT not supported!\n"));1012 if(fdwStyle & NORM_IGNORENONSPACE)1013 dprintf(("KERNEL32: NORM_IGNORENONSPACE not supported!\n"));1014 if(fdwStyle & NORM_IGNORESYMBOLS)1015 dprintf(("KERNEL32: NORM_IGNORESYMBOLS not supported!\n"));1016 #endif1017 1018 if(lpString1 == NULL || lpString2 == NULL)1019 {1020 dprintf(("CompareStringA: (s1=%s,s2=%s): Invalid NULL string\n", lpString1, lpString2));1021 SetLastError(ERROR_INVALID_PARAMETER);1022 return 0;1023 }1024 1025 if(cch1 == -1) cch1 = strlen(string1);1026 if(cch2 == -1) cch2 = strlen(string2);1027 1028 if(fdwStyle) {1029 //TODO!1030 if(fdwStyle != 0 && fdwStyle != NORM_IGNORECASE)1031 return(0); /*PLF Fri 98-03-13 04:09:32 was return 1 */1032 }1033 if(fdwStyle & NORM_IGNORECASE)1034 fEqual = strnicmp(string1, string2, min(cch1, cch2));1035 else1036 fEqual = strncmp(string1, string2, min(cch1, cch2));1037 1038 if (fEqual < 0 ) fEqual = 1;1039 else if(fEqual == 0) fEqual = 2;1040 else if(fEqual > 0) fEqual = 3;1041 1042 //If equal, but different length, largest one is the greatest in lexical value1043 if(fEqual == 2 && cch1 != cch2){1044 if(cch1 < cch2)1045 fEqual = 1;1046 else1047 fEqual = 3;1048 }1049 dprintf2(("KERNEL32: OS2CompareStringA '%s' - '%s' returned %d\n", lpString1, lpString2, fEqual));1050 return(fEqual);1051 }1052 1053 //******************************************************************************1054 //TODO: Not complete (fdwStyle flags specify compare method)1055 //******************************************************************************1056 UINT WIN32API CompareStringW(LCID lcid, DWORD fdwStyle, LPCWSTR lpString1,1057 DWORD cch1, LPCWSTR lpString2, DWORD cch2)1058 {1059 int i;1060 int fEqual = TRUE;1061 char *string1;1062 char *string2;1063 1064 dprintf2(("KERNEL32: OS2CompareStringW '%s' - '%s'\n", string1, string2));1065 1066 if(lpString1 == NULL || lpString2 == NULL)1067 {1068 dprintf(("CompareStringW: (s1=%s,s2=%s): Invalid NULL string\n", lpString1, lpString2));1069 SetLastError(ERROR_INVALID_PARAMETER);1070 return 0;1071 }1072 1073 if(cch1 == -1) cch1 = lstrlenW(lpString1);1074 if(cch2 == -1) cch2 = lstrlenW(lpString2);1075 1076 string1 = UnicodeToAsciiStringN((LPWSTR)lpString1, cch1);1077 string2 = UnicodeToAsciiStringN((LPWSTR)lpString2, cch2);1078 1079 fEqual = CompareStringA(lcid, fdwStyle, string1, cch1, string2, cch2);1080 FreeAsciiString(string1);1081 FreeAsciiString(string2);1082 1083 return(fEqual);1084 287 } 1085 288 //****************************************************************************** -
trunk/src/kernel32/heapstring.cpp
r3976 r4174 1 /* $Id: heapstring.cpp,v 1.3 1 2000-08-10 02:19:57phaller Exp $ */1 /* $Id: heapstring.cpp,v 1.32 2000-09-03 18:04:56 phaller Exp $ */ 2 2 3 3 /* … … 1189 1189 return nData; 1190 1190 } 1191 1192 1193 /*****************************************************************************1194 * Name : GetNumberFormat1195 * Purpose : format a given number string according to local settings1196 * Parameters:1197 * Variables :1198 * Result :1199 * Remark : KERNEL32.3551200 * Status :1201 *1202 * Author : Patrick Haller [Sun, 2000/06/12 12:46]1203 *****************************************************************************/1204 1205 1206 ODINFUNCTION6(INT, GetNumberFormatA,1207 LCID, locale,1208 DWORD, dwflags,1209 LPCSTR, lpvalue,1210 CONST NUMBERFMTA *,lpFormat,1211 LPSTR, lpNumberStr,1212 int, cchNumber)1213 {1214 dprintf(("not properly implemented.\n"));1215 1216 char sNumberDigits[3], sDecimalSymbol[5], sDigitsInGroup[11], sDigitGroupSymbol[5], sILZero[2];1217 INT nNumberDigits, nNumberDecimal, i, j, nCounter, nStep, nRuleIndex, nGrouping, nDigits, retVal, nLZ;1218 char sNumber[128], sDestination[128], sDigitsAfterDecimal[10], sDigitsBeforeDecimal[128];1219 char sRule[10], sSemiColumn[]=";", sBuffer[5], sNegNumber[2];1220 char *pStr = NULL, *pTmpStr = NULL;1221 LCID systemDefaultLCID;1222 BOOL bNegative = FALSE;1223 enum Operations1224 {1225 USE_PARAMETER,1226 USE_LOCALEINFO,1227 USE_SYSTEMDEFAULT,1228 RETURN_ERROR1229 } used_operation;1230 1231 strncpy(sNumber, lpvalue, 128);1232 sNumber[127] = '\0';1233 1234 /* Make sure we have a valid input string, get the number1235 * of digits before and after the decimal symbol, and check1236 * if this is a negative number.1237 */1238 if ( OLE_GetNumberComponents(sNumber, sDigitsBeforeDecimal, sDigitsAfterDecimal, &bNegative) != -1)1239 {1240 nNumberDecimal = strlen(sDigitsBeforeDecimal);1241 nDigits = strlen(sDigitsAfterDecimal);1242 }1243 else1244 {1245 SetLastError(ERROR_INVALID_PARAMETER);1246 return 0;1247 }1248 1249 /* Which source will we use to format the string */1250 used_operation = RETURN_ERROR;1251 if (lpFormat != NULL)1252 {1253 if (dwflags == 0)1254 used_operation = USE_PARAMETER;1255 }1256 else1257 {1258 if (dwflags & LOCALE_NOUSEROVERRIDE)1259 used_operation = USE_LOCALEINFO;1260 else1261 used_operation = USE_SYSTEMDEFAULT;1262 }1263 1264 /* Load the fields we need */1265 switch(used_operation)1266 {1267 case USE_LOCALEINFO:1268 GetLocaleInfoA(locale, LOCALE_IDIGITS, sNumberDigits, sizeof(sNumberDigits));1269 GetLocaleInfoA(locale, LOCALE_SDECIMAL, sDecimalSymbol, sizeof(sDecimalSymbol));1270 GetLocaleInfoA(locale, LOCALE_SGROUPING, sDigitsInGroup, sizeof(sDigitsInGroup));1271 GetLocaleInfoA(locale, LOCALE_STHOUSAND, sDigitGroupSymbol, sizeof(sDigitGroupSymbol));1272 GetLocaleInfoA(locale, LOCALE_ILZERO, sILZero, sizeof(sILZero));1273 GetLocaleInfoA(locale, LOCALE_INEGNUMBER, sNegNumber, sizeof(sNegNumber));1274 break;1275 case USE_PARAMETER:1276 sprintf(sNumberDigits, "%d",lpFormat->NumDigits);1277 strcpy(sDecimalSymbol, lpFormat->lpDecimalSep);1278 sprintf(sDigitsInGroup, "%d;0",lpFormat->Grouping);1279 strcpy(sDigitGroupSymbol, lpFormat->lpThousandSep);1280 sprintf(sILZero, "%d",lpFormat->LeadingZero);1281 sprintf(sNegNumber, "%d",lpFormat->NegativeOrder);1282 break;1283 case USE_SYSTEMDEFAULT:1284 systemDefaultLCID = GetSystemDefaultLCID();1285 GetLocaleInfoA(systemDefaultLCID, LOCALE_IDIGITS, sNumberDigits, sizeof(sNumberDigits));1286 GetLocaleInfoA(systemDefaultLCID, LOCALE_SDECIMAL, sDecimalSymbol, sizeof(sDecimalSymbol));1287 GetLocaleInfoA(systemDefaultLCID, LOCALE_SGROUPING, sDigitsInGroup, sizeof(sDigitsInGroup));1288 GetLocaleInfoA(systemDefaultLCID, LOCALE_STHOUSAND, sDigitGroupSymbol, sizeof(sDigitGroupSymbol));1289 GetLocaleInfoA(systemDefaultLCID, LOCALE_ILZERO, sILZero, sizeof(sILZero));1290 GetLocaleInfoA(systemDefaultLCID, LOCALE_INEGNUMBER, sNegNumber, sizeof(sNegNumber));1291 break;1292 default:1293 SetLastError(ERROR_INVALID_PARAMETER);1294 return 0;1295 }1296 1297 nNumberDigits = atoi(sNumberDigits);1298 1299 /* Remove the ";" */1300 i=0;1301 j = 1;1302 for (nCounter=0; nCounter<strlen(sDigitsInGroup); nCounter++)1303 {1304 if ( memcmp(sDigitsInGroup + nCounter, sSemiColumn, 1) != 0 )1305 {1306 memcpy(sRule + j, sDigitsInGroup + nCounter, 1);1307 i++;1308 j++;1309 }1310 }1311 sprintf(sBuffer, "%d", i);1312 memcpy(sRule, sBuffer, 1); /* Number of digits in the groups ( used by OLE_GetGrouping() ) */1313 memcpy(sRule + j, "\0", 1);1314 1315 /* First, format the digits before the decimal. */1316 if ((nNumberDecimal>0) && (atoi(sDigitsBeforeDecimal) != 0))1317 {1318 /* Working on an inverted string is easier ! */1319 OLE_InvertString(sDigitsBeforeDecimal);1320 1321 nStep = nCounter = i = j = 0;1322 nRuleIndex = 1;1323 nGrouping = OLE_GetGrouping(sRule, nRuleIndex);1324 1325 /* Here, we will loop until we reach the end of the string.1326 * An internal counter (j) is used in order to know when to1327 * insert the "digit group symbol".1328 */1329 while (nNumberDecimal > 0)1330 {1331 i = nCounter + nStep;1332 memcpy(sDestination + i, sDigitsBeforeDecimal + nCounter, 1);1333 nCounter++;1334 j++;1335 if (j >= nGrouping)1336 {1337 j = 0;1338 if (nRuleIndex < sRule[0])1339 nRuleIndex++;1340 nGrouping = OLE_GetGrouping(sRule, nRuleIndex);1341 memcpy(sDestination + i+1, sDigitGroupSymbol, strlen(sDigitGroupSymbol));1342 nStep+= strlen(sDigitGroupSymbol);1343 }1344 1345 nNumberDecimal--;1346 }1347 1348 memcpy(sDestination + i+1, "\0", 1);1349 /* Get the string in the right order ! */1350 OLE_InvertString(sDestination);1351 }1352 else1353 {1354 nLZ = atoi(sILZero);1355 if (nLZ != 0)1356 {1357 /* Use 0.xxx instead of .xxx */1358 memcpy(sDestination, "0", 1);1359 memcpy(sDestination+1, "\0", 1);1360 }1361 else1362 memcpy(sDestination, "\0", 1);1363 1364 }1365 1366 /* Second, format the digits after the decimal. */1367 j = 0;1368 nCounter = nNumberDigits;1369 if ( (nDigits>0) && (pStr = strstr (sNumber, ".")) )1370 {1371 i = strlen(sNumber) - strlen(pStr) + 1;1372 strncpy ( sDigitsAfterDecimal, sNumber + i, nNumberDigits);1373 j = strlen(sDigitsAfterDecimal);1374 if (j < nNumberDigits)1375 nCounter = nNumberDigits-j;1376 }1377 for (i=0;i<nCounter;i++)1378 memcpy(sDigitsAfterDecimal+i+j, "0", 1);1379 memcpy(sDigitsAfterDecimal + nNumberDigits, "\0", 1);1380 1381 i = strlen(sDestination);1382 j = strlen(sDigitsAfterDecimal);1383 /* Finally, construct the resulting formatted string. */1384 1385 for (nCounter=0; nCounter<i; nCounter++)1386 memcpy(sNumber + nCounter, sDestination + nCounter, 1);1387 1388 memcpy(sNumber + nCounter, sDecimalSymbol, strlen(sDecimalSymbol));1389 1390 for (i=0; i<j; i++)1391 memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), sDigitsAfterDecimal + i, 1);1392 memcpy(sNumber + nCounter+i+strlen(sDecimalSymbol), "\0", 1);1393 1394 /* Is it a negative number */1395 if (bNegative == TRUE)1396 {1397 i = atoi(sNegNumber);1398 pStr = sDestination;1399 pTmpStr = sNumber;1400 switch (i)1401 {1402 case 0:1403 *pStr++ = '(';1404 while (*sNumber != '\0')1405 *pStr++ = *pTmpStr++;1406 *pStr++ = ')';1407 break;1408 case 1:1409 *pStr++ = '-';1410 while (*pTmpStr != '\0')1411 *pStr++ = *pTmpStr++;1412 break;1413 case 2:1414 *pStr++ = '-';1415 *pStr++ = ' ';1416 while (*pTmpStr != '\0')1417 *pStr++ = *pTmpStr++;1418 break;1419 case 3:1420 while (*pTmpStr != '\0')1421 *pStr++ = *pTmpStr++;1422 *pStr++ = '-';1423 break;1424 case 4:1425 while (*pTmpStr != '\0')1426 *pStr++ = *pTmpStr++;1427 *pStr++ = ' ';1428 *pStr++ = '-';1429 break;1430 default:1431 while (*pTmpStr != '\0')1432 *pStr++ = *pTmpStr++;1433 break;1434 }1435 }1436 else1437 strcpy(sDestination, sNumber);1438 1439 /* If cchNumber is zero, then returns the number of bytes or characters1440 * required to hold the formatted number string1441 */1442 if (cchNumber==0)1443 retVal = strlen(sDestination) + 1;1444 else1445 {1446 strncpy (lpNumberStr, sDestination, cchNumber);1447 lpNumberStr[cchNumber-1] = '\0'; /* ensure we got a NULL at the end */1448 retVal = strlen(lpNumberStr);1449 }1450 1451 return retVal;1452 }1453 1454 1455 1456 1457 /*****************************************************************************1458 * Name : GetNumberFormat1459 * Purpose : format a given number string according to local settings1460 * Parameters:1461 * Variables :1462 * Result :1463 * Remark :1464 * Status :1465 *1466 * Author : Patrick Haller [Sun, 2000/06/12 12:46]1467 *****************************************************************************/1468 1469 int WIN32API GetNumberFormatW(LCID Locale,1470 DWORD dwFlags,1471 LPCWSTR lpValue,1472 CONST NUMBERFMTW *lpFormat,1473 LPWSTR lpNumberStr,1474 int cchNumber)1475 {1476 dprintf(("GetNumberFormatW(%08x,%08x,%s,%08x,%s,%08x) not properly implemented.\n",1477 Locale,1478 dwFlags,1479 lpValue,1480 lpFormat,1481 lpNumberStr,1482 cchNumber));1483 1484 // @@@PH cheap ass emulation1485 lstrcpynW(lpNumberStr,1486 lpValue,1487 cchNumber);1488 1489 return lstrlenW(lpNumberStr);1490 }1491 -
trunk/src/kernel32/lang.cpp
r4050 r4174 1 /* $Id: lang.cpp,v 1.2 6 2000-08-19 18:36:41 sandervlExp $ */1 /* $Id: lang.cpp,v 1.27 2000-09-03 18:04:55 phaller Exp $ */ 2 2 /* 3 3 * Win32 language API functions for OS/2 … … 149 149 //****************************************************************************** 150 150 //****************************************************************************** 151 #if 0 152 PHS: disabled for ole2nls.cpp 151 153 LCID WIN32API GetUserDefaultLCID(void) 152 154 { … … 175 177 return(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US)); 176 178 } 179 #endif 177 180 178 181 //****************************************************************************** … … 883 886 //****************************************************************************** 884 887 //****************************************************************************** 885 BOOL WIN32API IsValidLocale(LCID Locale, DWORD dwFlags)886 {887 dprintf(("KERNEL32: IsValidLocale, always returns TRUE\n"));888 return(TRUE);889 }890 //******************************************************************************891 //******************************************************************************892 888 LCID WIN32API GetThreadLocale() 893 889 { … … 917 913 //****************************************************************************** 918 914 //****************************************************************************** 919 BOOL WIN32API EnumSystemLocalesA(LOCALE_ENUMPROCA lpLocaleEnumProc, 920 DWORD dwFlags) 921 { 922 char buffer[32]; 923 924 dprintf(("EnumSystemLocalesA %X %X\n", lpLocaleEnumProc, dwFlags)); 925 if(lpLocaleEnumProc == NULL || ((dwFlags & LCID_INSTALLED) && (dwFlags & LCID_SUPPORTED))) { 926 dprintf(("Invalid parameter\n")); 927 SetLastError(ERROR_INVALID_PARAMETER); 928 return(FALSE); 929 } 930 931 sprintf(buffer, "%08lx", GetUserDefaultLCID()); 932 lpLocaleEnumProc(buffer); 933 return(TRUE); 934 } 935 //****************************************************************************** 936 //****************************************************************************** 937 BOOL WIN32API EnumSystemLocalesW(LOCALE_ENUMPROCW lpLocaleEnumProc, 938 DWORD dwFlags) 939 { 940 WCHAR bufferW[32]; 941 char bufferA[32]; 942 943 dprintf(("EnumSystemLocalesW %X %X\n", lpLocaleEnumProc, dwFlags)); 944 if(lpLocaleEnumProc == NULL || ((dwFlags & LCID_INSTALLED) && (dwFlags & LCID_SUPPORTED))) { 945 dprintf(("Invalid parameter\n")); 946 SetLastError(ERROR_INVALID_PARAMETER); 947 return(FALSE); 948 } 949 sprintf(bufferA, "%08lx", GetUserDefaultLCID()); 950 lstrcpyAtoW(bufferW, bufferA); 951 952 lpLocaleEnumProc(bufferW); 953 return(TRUE); 954 } 955 //****************************************************************************** 956 //****************************************************************************** 957 915 916 917 918 #if 0 919 PHS: disabled for ole2nls.cpp 958 920 959 921 /***************************************************************************** … … 1125 1087 1126 1088 1089 #endif -
trunk/src/kernel32/makefile
r4167 r4174 1 # $Id: makefile,v 1.9 8 2000-09-02 21:14:50 birdExp $1 # $Id: makefile,v 1.99 2000-09-03 18:04:54 phaller Exp $ 2 2 3 3 # … … 53 53 $(OBJDIR)\oslibdos.obj \ 54 54 $(OBJDIR)\oslibmisc.obj \ 55 $(OBJDIR)\ole2nls.obj \ 55 56 $(OBJDIR)\MISC.OBJ \ 56 57 $(OBJDIR)\EXCEPTUTIL.OBJ \ -
trunk/src/kernel32/stubs.cpp
r3799 r4174 1 /* $Id: stubs.cpp,v 1.23 2000-07-04 08:41:13 sandervl Exp $ */2 1 3 2 /* … … 484 483 } 485 484 486 487 488 /*****************************************************************************489 * Name : LCID WIN32API ConvertDefaultLocale490 * Purpose : The ConvertDefaultLocale function converts a special default491 * locale value to an actual locale identifier.492 * Parameters: LCID Locale special default locale value to be converted493 * Value Description494 * LOCALE_SYSTEM_DEFAULT The system's default locale.495 * LOCALE_USER_DEFAULT The current user's default locale.496 * zero The language-neutral default locale.497 * This is equivalent to the locale identifier498 * created by calling the MAKELCID macro499 * with a language identifier consisting500 * of the LANG_NEUTRAL and SUBLANG_NEUTRAL501 * values.502 * Any sublanguage neutral default locale503 * A locale identifier constructed by504 * calling MAKELCID with a language505 * identifier consisting of a primary506 * language value, such as LANG_ENGLISH,507 * and the SUBLANG_NEUTRAL value.508 *509 * Variables :510 * Result : If the function succeeds, the return value is the appropriate511 * actual locale identifier.512 * If the function fails, the return value is the Locale parameter.513 * The function fails when Locale is not one of the special514 * default locale values listed above.515 * Remark : A call to ConvertDefaultLocale(LOCALE_SYSTEM_DEFAULT)516 * is equivalent to a call to GetSystemDefaultLCID.517 * A call to ConvertDefaultLocale(LOCALE_USER_DEFAULT)518 * is equivalent to a call to GetUserDefaultLCID.519 * Status : UNTESTED STUB520 *521 * Author : Markus Montkowski [Thu, 1998/05/19 11:46]522 *****************************************************************************/523 524 LCID WIN32API ConvertDefaultLocale(LCID Locale)525 {526 527 dprintf(("KERNEL32: ConvertDefaultLocale(%08x) partly implmented - returns input\n",528 Locale529 ));530 531 return (Locale);532 }533 485 534 486 /***************************************************************************** … … 1014 966 } 1015 967 1016 /*****************************************************************************1017 * Name : BOOL WIN32API EnumCalendarInfoA1018 * Purpose : The EnumCalendarInfoA function enumerates calendar information1019 * for a specified locale. The CalType parameter specifies the type1020 * of calendar information to enumerate. The function returns the1021 * specified calendar information for all applicable calendars for1022 * the locale, or for a single requested calendar, depending on the1023 * value of the Calendar parameter.1024 * The EnumCalendarInfo function enumerates the calendar information1025 * by calling an application-defined callback function. It passes1026 * the callback function a pointer to a string buffer containing1027 * the requested calendar information. This continues until either1028 * the last applicable calendar is found or the callback function1029 * returns FALSE.1030 * Parameters: CALINFO_ENUMPROCA lpCalInfoEnumProc pointer to enumeration1031 * callback function1032 * LCID Locale locale whose calendar information is of interest1033 * CALID Calendar calendar whose information is of interest1034 * CALTYPE CalType type of calendar information of interest1035 * Variables :1036 * Result : If the function succeeds, the return value is nonzero.1037 * If the function fails, the return value is zero1038 * Remark :1039 * Status : UNTESTED STUB1040 *1041 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1042 *****************************************************************************/1043 1044 BOOL WIN32API EnumCalendarInfoA(CALINFO_ENUMPROCA lpCalInfoEnumProc,1045 LCID Locale,1046 CALID Calendar,1047 CALTYPE CalType)1048 {1049 1050 dprintf(("KERNEL32: EnumCalendarInfoA(%08x,%08x,%08x,%08x)not implemented\n",1051 lpCalInfoEnumProc,1052 Locale,1053 Calendar,1054 CalType1055 ));1056 1057 return (FALSE);1058 }1059 1060 /*****************************************************************************1061 * Name : BOOL WIN32API EnumCalendarInfoW1062 * Purpose : The EnumCalendarInfoW function enumerates calendar information1063 * for a specified locale. The CalType parameter specifies the type1064 * of calendar information to enumerate. The function returns the1065 * specified calendar information for all applicable calendars for1066 * the locale, or for a single requested calendar, depending on the1067 * value of the Calendar parameter.1068 * The EnumCalendarInfo function enumerates the calendar information1069 * by calling an application-defined callback function. It passes1070 * the callback function a pointer to a string buffer containing1071 * the requested calendar information. This continues until either1072 * the last applicable calendar is found or the callback function1073 * returns FALSE.1074 * Parameters: CALINFO_ENUMPROCW lpCalInfoEnumProc pointer to enumeration1075 * callback function1076 * LCID Locale locale whose calendar information is of interest1077 * CALID Calendar calendar whose information is of interest1078 * CALTYPE CalType type of calendar information of interest1079 * Variables :1080 * Result : If the function succeeds, the return value is nonzero.1081 * If the function fails, the return value is zero1082 * Remark :1083 * Status : UNTESTED STUB1084 *1085 * Author : Markus Montkowski [Tha, 1998/05/21 17:46]1086 *****************************************************************************/1087 1088 BOOL WIN32API EnumCalendarInfoW(CALINFO_ENUMPROCW lpCalInfoEnumProc,1089 LCID Locale,1090 CALID Calendar,1091 CALTYPE CalType)1092 {1093 1094 dprintf(("KERNEL32: EnumCalendarInfoW(%08x,%08x,%08x,%08x)not implemented\n",1095 lpCalInfoEnumProc,1096 Locale,1097 Calendar,1098 CalType1099 ));1100 1101 return (FALSE);1102 }1103 968 1104 969 /***************************************************************************** … … 1380 1245 )); 1381 1246 1382 }1383 1384 1385 /*****************************************************************************1386 * Name : int GetCurrencyFormatA1387 * Purpose : The GetCurrencyFormatA function formats a number string as a1388 * currency string for a specified locale.1389 * Parameters: LCID Locale locale for which currency string is to be formatted1390 * DWORD dwFlags bit flag that controls the function's operation1391 * LPCTSTR lpValue pointer to input number string1392 * CONST CURRENCYFMT *lpFormat pointer to a formatting information structure1393 * LPTSTR lpCurrencyStr pointer to output buffer1394 * int cchCurrency size of output buffer1395 * Variables :1396 * Result : number of bytes written to buffer1397 * Remark :1398 * Status : UNTESTED STUB1399 *1400 * Author : Patrick Haller [Mon, 1998/06/15 08:00]1401 *****************************************************************************/1402 1403 int WIN32API GetCurrencyFormatA(LCID Locale,1404 DWORD dwFlags,1405 LPCTSTR lpValue,1406 CONST CURRENCYFMTA *lpFormat,1407 LPTSTR lpCurrencyStr,1408 int cchCurrency)1409 {1410 dprintf(("KERNEL32: GetCurrencyFormatA(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",1411 Locale,1412 dwFlags,1413 lpValue,1414 lpFormat,1415 lpCurrencyStr,1416 cchCurrency));1417 1418 if(lpValue && lpCurrencyStr) {1419 lstrcpyA(lpCurrencyStr, lpValue);1420 return lstrlenA(lpCurrencyStr);1421 }1422 return (0);1423 }1424 1425 1426 /*****************************************************************************1427 * Name : int GetCurrencyFormatW1428 * Purpose : The GetCurrencyFormatW function formats a number string as a1429 * currency string for a specified locale.1430 * Parameters: LCID Locale locale for which currency string is to be formatted1431 * DWORD dwFlags bit flag that controls the function's operation1432 * LPCWSTR lpValue pointer to input number string1433 * CONST CURRENCYFMT *lpFormat pointer to a formatting information structure1434 * LPWSTR lpCurrencyStr pointer to output buffer1435 * int cchCurrency size of output buffer1436 * Variables :1437 * Result : number of bytes written to buffer1438 * Remark :1439 * Status : UNTESTED STUB1440 *1441 * Author : Patrick Haller [Mon, 1998/06/15 08:00]1442 *****************************************************************************/1443 1444 int WIN32API GetCurrencyFormatW(LCID Locale,1445 DWORD dwFlags,1446 LPCWSTR lpValue,1447 CONST CURRENCYFMTW *lpFormat,1448 LPWSTR lpCurrencyStr,1449 int cchCurrency)1450 {1451 dprintf(("KERNEL32: GetCurrencyFormatW(%08xh,%08xh,%08xh,%08xh,%08xh,%08xh) not implemented\n",1452 Locale,1453 dwFlags,1454 lpValue,1455 lpFormat,1456 lpCurrencyStr,1457 cchCurrency));1458 1459 if(lpValue && lpCurrencyStr) {1460 lstrcpyW(lpCurrencyStr, lpValue);1461 return lstrlenW(lpCurrencyStr);1462 }1463 1464 return (0);1465 1247 } 1466 1248 -
trunk/src/kernel32/time.cpp
r3588 r4174 1 /* $Id: time.cpp,v 1. 8 2000-05-22 19:07:59 sandervlExp $ */1 /* $Id: time.cpp,v 1.9 2000-09-03 18:04:56 phaller Exp $ */ 2 2 3 3 /* … … 568 568 } 569 569 570 /****************************************************************************** 571 * OLE2NLS_CheckLocale [intern] 572 */ 573 static LCID OLE2NLS_CheckLocale (LCID locale) 574 { 575 if (!locale) 576 { locale = LOCALE_SYSTEM_DEFAULT; 577 } 578 579 if (locale == LOCALE_SYSTEM_DEFAULT) 580 { return GetSystemDefaultLCID(); 581 } 582 else if (locale == LOCALE_USER_DEFAULT) 583 { return GetUserDefaultLCID(); 584 } 585 else 586 { return locale; 587 } 588 } 589 590 /****************************************************************************** 591 * OLE_GetFormatA [Internal] 592 * 593 * FIXME 594 * If datelen == 0, it should return the reguired string length. 595 * 596 This function implements stuff for GetDateFormat() and 597 GetTimeFormat(). 598 d single-digit (no leading zero) day (of month) 599 dd two-digit day (of month) 600 ddd short day-of-week name 601 dddd long day-of-week name 602 M single-digit month 603 MM two-digit month 604 MMM short month name 605 MMMM full month name 606 y two-digit year, no leading 0 607 yy two-digit year 608 yyyy four-digit year 609 gg era string 610 h hours with no leading zero (12-hour) 611 hh hours with full two digits 612 H hours with no leading zero (24-hour) 613 HH hours with full two digits 614 m minutes with no leading zero 615 mm minutes with full two digits 616 s seconds with no leading zero 617 ss seconds with full two digits 618 t time marker (A or P) 619 tt time marker (AM, PM) 620 '' used to quote literal characters 621 '' (within a quoted string) indicates a literal ' 622 These functions REQUIRE valid locale, date, and format. 623 */ 624 static INT OLE_GetFormatA(LCID locale, 625 DWORD flags, 626 DWORD tflags, 627 LPSYSTEMTIME xtime, 628 LPCSTR _format, /*in*/ 629 LPSTR date, /*out*/ 630 INT datelen) 631 { 632 INT inpos, outpos; 633 int count, type, inquote, Overflow; 634 char buf[40]; 635 char format[40]; 636 char * pos; 637 int buflen; 638 const char * _dgfmt[] = { "%d", "%02d" }; 639 const char ** dgfmt = _dgfmt - 1; 640 dprintf(("KERNEL32: OLE_GetFormatA")); 641 642 if(datelen == 0) { 643 //FIXME_(ole)("datelen = 0, returning 255\n"); 644 return 255; 645 } 646 /* initalize state variables and output buffer */ 647 inpos = outpos = 0; 648 count = 0; inquote = 0; Overflow = 0; 649 type = '\0'; 650 date[0] = buf[0] = '\0'; 651 652 strcpy(format,_format); 653 /* alter the formatstring, while it works for all languages now in wine 654 its possible that it fails when the time looks like ss:mm:hh as example*/ 655 if (tflags & (TIME_NOMINUTESORSECONDS)) 656 { if ((pos = strstr ( format, ":mm")) != 0) 657 { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 ); 658 } 659 } 660 if (tflags & (TIME_NOSECONDS)) 661 { if ((pos = strstr ( format, ":ss")) != 0) 662 { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 ); 663 } 664 } 665 666 for (inpos = 0;; inpos++) { 667 /* TRACE(ole, "STATE inpos=%2d outpos=%2d count=%d inquote=%d type=%c buf,date = %c,%c\n", inpos, outpos, count, inquote, type, buf[inpos], date[outpos]); */ 668 if (inquote) { 669 if (format[inpos] == '\'') { 670 if (format[inpos+1] == '\'') { 671 inpos += 1; 672 date[outpos++] = '\''; 673 } else { 674 inquote = 0; 675 continue; /* we did nothing to the output */ 676 } 677 } else if (format[inpos] == '\0') { 678 date[outpos++] = '\0'; 679 if (outpos > datelen) Overflow = 1; 680 break; 681 } else { 682 date[outpos++] = format[inpos]; 683 if (outpos > datelen) { 684 Overflow = 1; 685 date[outpos-1] = '\0'; /* this is the last place where 686 it's safe to write */ 687 break; 688 } 689 } 690 } else if ( (count && (format[inpos] != type)) 691 || count == 4 692 || (count == 2 && strchr("ghHmst", type)) ) 693 { 694 if (type == 'd') { 695 if (count == 4) { 696 GetLocaleInfoA(locale, 697 LOCALE_SDAYNAME1 698 + xtime->wDayOfWeek - 1, 699 buf, sizeof(buf)); 700 } else if (count == 3) { 701 GetLocaleInfoA(locale, 702 LOCALE_SABBREVDAYNAME1 703 + xtime->wDayOfWeek - 1, 704 buf, sizeof(buf)); 705 } else { 706 sprintf(buf, dgfmt[count], xtime->wDay); 707 } 708 } else if (type == 'M') { 709 if (count == 3) { 710 GetLocaleInfoA(locale, 711 LOCALE_SABBREVMONTHNAME1 712 + xtime->wMonth - 1, 713 buf, sizeof(buf)); 714 } else if (count == 4) { 715 GetLocaleInfoA(locale, 716 LOCALE_SMONTHNAME1 717 + xtime->wMonth - 1, 718 buf, sizeof(buf)); 719 } else { 720 sprintf(buf, dgfmt[count], xtime->wMonth); 721 } 722 } else if (type == 'y') { 723 if (count == 4) { 724 sprintf(buf, "%d", xtime->wYear); 725 } else if (count == 3) { 726 strcpy(buf, "yyy"); 727 //WARN_(ole)("unknown format, c=%c, n=%d\n", type, count); 728 } else { 729 sprintf(buf, dgfmt[count], xtime->wYear % 100); 730 } 731 } else if (type == 'g') { 732 if (count == 2) { 733 //FIXME_(ole)("LOCALE_ICALENDARTYPE unimp.\n"); 734 strcpy(buf, "AD"); 735 } else { 736 strcpy(buf, "g"); 737 //WARN_(ole)("unknown format, c=%c, n=%d\n", type, count); 738 } 739 } else if (type == 'h') { 740 /* gives us hours 1:00 -- 12:00 */ 741 sprintf(buf, dgfmt[count], (xtime->wHour-1)%12 +1); 742 } else if (type == 'H') { 743 /* 24-hour time */ 744 sprintf(buf, dgfmt[count], xtime->wHour); 745 } else if ( type == 'm') { 746 sprintf(buf, dgfmt[count], xtime->wMinute); 747 } else if ( type == 's') { 748 sprintf(buf, dgfmt[count], xtime->wSecond); 749 } else if (type == 't') { 750 if (count == 1) { 751 sprintf(buf, "%c", (xtime->wHour < 12) ? 'A' : 'P'); 752 } else if (count == 2) { 753 /* sprintf(buf, "%s", (xtime->wHour < 12) ? "AM" : "PM"); */ 754 GetLocaleInfoA(locale, 755 (xtime->wHour<12) 756 ? LOCALE_S1159 : LOCALE_S2359, 757 buf, sizeof(buf)); 758 } 759 }; 760 /* we need to check the next char in the format string 761 again, no matter what happened */ 762 inpos--; 763 764 /* add the contents of buf to the output */ 765 buflen = strlen(buf); 766 if (outpos + buflen < datelen) { 767 date[outpos] = '\0'; /* for strcat to hook onto */ 768 strcat(date, buf); 769 outpos += buflen; 770 } else { 771 date[outpos] = '\0'; 772 strncat(date, buf, datelen - outpos); 773 date[datelen - 1] = '\0'; 774 SetLastError(ERROR_INSUFFICIENT_BUFFER); 775 //WARN_(ole)("insufficient buffer\n"); 776 return 0; 777 } 778 /* reset the variables we used to keep track of this item */ 779 count = 0; 780 type = '\0'; 781 } else if (format[inpos] == '\0') { 782 /* we can't check for this at the loop-head, because 783 that breaks the printing of the last format-item */ 784 date[outpos] = '\0'; 785 break; 786 } else if (count) { 787 /* continuing a code for an item */ 788 count +=1; 789 continue; 790 } else if (strchr("hHmstyMdg", format[inpos])) { 791 type = format[inpos]; 792 count = 1; 793 continue; 794 } else if (format[inpos] == '\'') { 795 inquote = 1; 796 continue; 797 } else { 798 date[outpos++] = format[inpos]; 799 } 800 /* now deal with a possible buffer overflow */ 801 if (outpos >= datelen) { 802 date[datelen - 1] = '\0'; 803 SetLastError(ERROR_INSUFFICIENT_BUFFER); 804 return 0; 805 } 806 } 807 808 if (Overflow) { 809 SetLastError(ERROR_INSUFFICIENT_BUFFER); 810 }; 811 /* finish it off with a string terminator */ 812 outpos++; 813 /* sanity check */ 814 if (outpos > datelen-1) outpos = datelen-1; 815 date[outpos] = '\0'; 816 817 //TRACE_(ole)("OLE_GetFormatA returns string '%s', len %d\n", 818 // date, outpos); 819 return outpos; 820 } 821 822 /****************************************************************************** 823 * OLE_GetFormatW [INTERNAL] 824 */ 825 static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags, 826 LPSYSTEMTIME xtime, 827 LPCWSTR format, 828 LPWSTR output, INT outlen) 829 { 830 INT inpos, outpos; 831 int count, type=0, inquote; 832 int Overflow; /* loop check */ 833 WCHAR buf[40]; 834 int buflen=0; 835 WCHAR arg0[] = {0}, arg1[] = {'%','d',0}; 836 WCHAR arg2[] = {'%','0','2','d',0}; 837 WCHAR *argarr[3]; 838 int datevars=0, timevars=0; 839 argarr[0] = arg0; 840 argarr[1] = arg1; 841 argarr[2] = arg2; 842 843 dprintf(("KERNEL32: OLE_GetFormatW")); 844 845 if(outlen == 0) { 846 //FIXME_(ole)("outlen = 0, returning 255\n"); 847 return 255; 848 } 849 /* initialize state variables */ 850 inpos = outpos = 0; 851 count = 0; 852 inquote = Overflow = 0; 853 /* this is really just a sanity check */ 854 output[0] = buf[0] = 0; 855 856 /* this loop is the core of the function */ 857 for (inpos = 0; /* we have several break points */ ; inpos++) { 858 if (inquote) { 859 if (format[inpos] == (WCHAR) '\'') { 860 if (format[inpos+1] == '\'') { 861 inpos++; 862 output[outpos++] = '\''; 863 } else { 864 inquote = 0; 865 continue; 866 } 867 } else if (format[inpos] == 0) { 868 output[outpos++] = 0; 869 if (outpos > outlen) Overflow = 1; 870 break; /* normal exit (within a quote) */ 871 } else { 872 output[outpos++] = format[inpos]; /* copy input */ 873 if (outpos > outlen) { 874 Overflow = 1; 875 output[outpos-1] = 0; 876 break; 877 } 878 } 879 } else if ( (count && (format[inpos] != type)) 880 || ( (count==4 && type =='y') || 881 (count==4 && type =='M') || 882 (count==4 && type =='d') || 883 (count==2 && type =='g') || 884 (count==2 && type =='h') || 885 (count==2 && type =='H') || 886 (count==2 && type =='m') || 887 (count==2 && type =='s') || 888 (count==2 && type =='t') ) ) { 889 if (type == 'd') { 890 if (count == 3) { 891 GetLocaleInfoW(locale, 892 LOCALE_SDAYNAME1 + xtime->wDayOfWeek -1, 893 buf, sizeof(buf)/sizeof(WCHAR) ); 894 } else if (count == 3) { 895 GetLocaleInfoW(locale, 896 LOCALE_SABBREVDAYNAME1 + 897 xtime->wDayOfWeek -1, 898 buf, sizeof(buf)/sizeof(WCHAR) ); 899 } else { 900 wsnprintfW(buf, 5, argarr[count], xtime->wDay ); 901 }; 902 } else if (type == 'M') { 903 if (count == 4) { 904 GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 + 905 xtime->wMonth -1, buf, 906 sizeof(buf)/sizeof(WCHAR) ); 907 } else if (count == 3) { 908 GetLocaleInfoW(locale, LOCALE_SABBREVMONTHNAME1 + 909 xtime->wMonth -1, buf, 910 sizeof(buf)/sizeof(WCHAR) ); 911 } else { 912 wsnprintfW(buf, 5, argarr[count], xtime->wMonth); 913 } 914 } else if (type == 'y') { 915 if (count == 4) { 916 wsnprintfW(buf, 6, argarr[1] /* "%d" */, 917 xtime->wYear); 918 } else if (count == 3) { 919 lstrcpynAtoW(buf, "yyy", 5); 920 } else { 921 wsnprintfW(buf, 6, argarr[count], 922 xtime->wYear % 100); 923 } 924 } else if (type == 'g') { 925 if (count == 2) { 926 //FIXME_(ole)("LOCALE_ICALENDARTYPE unimplemented\n"); 927 lstrcpynAtoW(buf, "AD", 5); 928 } else { 929 /* Win API sez we copy it verbatim */ 930 lstrcpynAtoW(buf, "g", 5); 931 } 932 } else if (type == 'h') { 933 /* hours 1:00-12:00 --- is this right? */ 934 wsnprintfW(buf, 5, argarr[count], 935 (xtime->wHour-1)%12 +1); 936 } else if (type == 'H') { 937 wsnprintfW(buf, 5, argarr[count], 938 xtime->wHour); 939 } else if (type == 'm' ) { 940 wsnprintfW(buf, 5, argarr[count], 941 xtime->wMinute); 942 } else if (type == 's' ) { 943 wsnprintfW(buf, 5, argarr[count], 944 xtime->wSecond); 945 } else if (type == 't') { 946 GetLocaleInfoW(locale, (xtime->wHour < 12) ? 947 LOCALE_S1159 : LOCALE_S2359, 948 buf, sizeof(buf) ); 949 if (count == 1) { 950 buf[1] = 0; 951 } 952 } 953 /* no matter what happened, we need to check this next 954 character the next time we loop through */ 955 inpos--; 956 /* cat buf onto the output */ 957 outlen = lstrlenW(buf); 958 if (outpos + buflen < outlen) { 959 lstrcpyW( output + outpos, buf ); 960 outpos += buflen; 961 } else { 962 lstrcpynW( output + outpos, buf, outlen - outpos ); 963 Overflow = 1; 964 break; /* Abnormal exit */ 965 } 966 /* reset the variables we used this time */ 967 count = 0; 968 type = '\0'; 969 } else if (format[inpos] == 0) { 970 /* we can't check for this at the beginning, because that 971 would keep us from printing a format spec that ended the 972 string */ 973 output[outpos] = 0; 974 break; /* NORMAL EXIT */ 975 } else if (count) { 976 /* how we keep track of the middle of a format spec */ 977 count++; 978 continue; 979 } else if ( (datevars && (format[inpos]=='d' || 980 format[inpos]=='M' || 981 format[inpos]=='y' || 982 format[inpos]=='g') ) || 983 (timevars && (format[inpos]=='H' || 984 format[inpos]=='h' || 985 format[inpos]=='m' || 986 format[inpos]=='s' || 987 format[inpos]=='t') ) ) { 988 type = format[inpos]; 989 count = 1; 990 continue; 991 } else if (format[inpos] == '\'') { 992 inquote = 1; 993 continue; 994 } else { 995 /* unquoted literals */ 996 output[outpos++] = format[inpos]; 997 } 998 } 999 if (Overflow) { 1000 SetLastError(ERROR_INSUFFICIENT_BUFFER); 1001 //WARN_(ole)(" buffer overflow\n"); 1002 }; 1003 /* final string terminator and sanity check */ 1004 outpos++; 1005 if (outpos > outlen-1) outpos = outlen-1; 1006 output[outpos] = '0'; 1007 //TRACE_(ole)(" returning %s\n", debugstr_w(output)); 1008 1009 return (!Overflow) ? outlen : 0; 1010 1011 } 1012 1013 /****************************************************************************** 1014 * GetTimeFormat32A [KERNEL32.422] 1015 * Makes an ASCII string of the time 1016 * 1017 * Formats date according to format, or locale default if format is 1018 * NULL. The format consists of literal characters and fields as follows: 1019 * 1020 * h hours with no leading zero (12-hour) 1021 * hh hours with full two digits 1022 * H hours with no leading zero (24-hour) 1023 * HH hours with full two digits 1024 * m minutes with no leading zero 1025 * mm minutes with full two digits 1026 * s seconds with no leading zero 1027 * ss seconds with full two digits 1028 * t time marker (A or P) 1029 * tt time marker (AM, PM) 1030 * 1031 */ 1032 INT WINAPI 1033 GetTimeFormatA(LCID locale, /* in */ 1034 DWORD flags, /* in */ 1035 LPSYSTEMTIME xtime, /* in */ 1036 LPCSTR format, /* in */ 1037 LPSTR timestr, /* out */ 1038 INT timelen /* in */) 1039 { char format_buf[40]; 1040 LPCSTR thisformat; 1041 SYSTEMTIME t; 1042 LPSYSTEMTIME thistime; 1043 LCID thislocale=0; 1044 DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */ 1045 INT ret; 1046 1047 dprintf(("KERNEL32: GetTimeFormatA")); 1048 //TRACE_(ole)("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen); 1049 thislocale = OLE2NLS_CheckLocale ( locale ); 1050 if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT )) 1051 { //FIXME_(ole)("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n"); 1052 } 1053 1054 flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/ 1055 if (format == NULL) 1056 { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/ 1057 { thislocale = GetSystemDefaultLCID(); 1058 } 1059 GetLocaleInfoA(thislocale, thisflags, format_buf, sizeof(format_buf)); 1060 thisformat = format_buf; 1061 } 1062 else 1063 { thisformat = format; 1064 } 1065 1066 if (xtime == NULL) /* NULL means use the current local time*/ 1067 { GetLocalTime(&t); 1068 thistime = &t; 1069 } 1070 else 1071 { thistime = xtime; 1072 } 1073 ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat, 1074 timestr, timelen); 1075 return ret; 1076 } 1077 1078 /****************************************************************************** 1079 * GetTimeFormat32W [KERNEL32.423] 1080 * Makes a Unicode string of the time 1081 */ 1082 INT WINAPI 1083 GetTimeFormatW(LCID locale, /* in */ 1084 DWORD flags, /* in */ 1085 LPSYSTEMTIME xtime, /* in */ 1086 LPCWSTR format, /* in */ 1087 LPWSTR timestr, /* out */ 1088 INT timelen /* in */) 1089 { WCHAR format_buf[40]; 1090 LPCWSTR thisformat; 1091 SYSTEMTIME t; 1092 LPSYSTEMTIME thistime; 1093 LCID thislocale=0; 1094 DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */ 1095 INT ret; 1096 1097 dprintf(("KERNEL32: GetTimeFormatW")); 1098 //TRACE_(ole)("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags, 1099 //xtime,debugstr_w(format),timestr,timelen); 1100 thislocale = OLE2NLS_CheckLocale ( locale ); 1101 if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT )) 1102 { //FIXME_(ole)("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n"); 1103 } 1104 1105 flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/ 1106 if (format == NULL) 1107 { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/ 1108 { thislocale = GetSystemDefaultLCID(); 1109 } 1110 GetLocaleInfoW(thislocale, thisflags, format_buf, 40); 1111 thisformat = format_buf; 1112 } 1113 else 1114 { thisformat = format; 1115 } 1116 1117 if (xtime == NULL) /* NULL means use the current local time*/ 1118 { GetSystemTime(&t); 1119 thistime = &t; 1120 } 1121 else 1122 { thistime = xtime; 1123 } 1124 ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat, 1125 timestr, timelen); 1126 return ret; 1127 } 1128 1129 /****************************************************************************** 1130 * GetDateFormat32A [KERNEL32.310] 1131 * Makes an ASCII string of the date 1132 * 1133 * This function uses format to format the date, or, if format 1134 * is NULL, uses the default for the locale. format is a string 1135 * of literal fields and characters as follows: 1136 * 1137 * - d single-digit (no leading zero) day (of month) 1138 * - dd two-digit day (of month) 1139 * - ddd short day-of-week name 1140 * - dddd long day-of-week name 1141 * - M single-digit month 1142 * - MM two-digit month 1143 * - MMM short month name 1144 * - MMMM full month name 1145 * - y two-digit year, no leading 0 1146 * - yy two-digit year 1147 * - yyyy four-digit year 1148 * - gg era string 1149 * 1150 */ 1151 INT WINAPI GetDateFormatA(LCID locale,DWORD flags, 1152 LPSYSTEMTIME xtime, 1153 LPCSTR format, LPSTR date,INT datelen) 1154 { 1155 char format_buf[40]; 1156 LPCSTR thisformat; 1157 SYSTEMTIME t; 1158 LPSYSTEMTIME thistime; 1159 LCID thislocale; 1160 INT ret; 1161 1162 dprintf(("KERNEL32: GetDateFormatA\n")); 1163 1164 if (!locale) { 1165 locale = LOCALE_SYSTEM_DEFAULT; 1166 }; 1167 1168 if (locale == LOCALE_SYSTEM_DEFAULT) { 1169 thislocale = GetSystemDefaultLCID(); 1170 } else if (locale == LOCALE_USER_DEFAULT) { 1171 thislocale = GetUserDefaultLCID(); 1172 } else { 1173 thislocale = locale; 1174 }; 1175 if (xtime == NULL) { 1176 GetSystemTime(&t); 1177 thistime = &t; 1178 } else { 1179 thistime = xtime; 1180 }; 1181 if (format == NULL) { 1182 GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE) 1183 ? LOCALE_SLONGDATE 1184 : LOCALE_SSHORTDATE), 1185 format_buf, sizeof(format_buf)); 1186 thisformat = format_buf; 1187 } else { 1188 thisformat = format; 1189 }; 1190 1191 ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat, 1192 date, datelen); 1193 1194 return ret; 1195 } 1196 /****************************************************************************** 1197 * GetDateFormat32W [KERNEL32.311] 1198 * Makes a Unicode string of the date 1199 * 1200 * Acts the same as GetDateFormat32A(), except that it's Unicode. 1201 * Accepts & returns sizes as counts of Unicode characters. 1202 * 1203 */ 1204 INT WINAPI GetDateFormatW(LCID locale,DWORD flags, 1205 LPSYSTEMTIME xtime, 1206 LPCWSTR format, 1207 LPWSTR date, INT datelen) 1208 { 1209 WCHAR format_buf[40]; 1210 LPWSTR thisformat; 1211 SYSTEMTIME t; 1212 LPSYSTEMTIME thistime; 1213 LCID thislocale; 1214 INT ret; 1215 1216 dprintf(("KERNEL32: GetDateFormatW\n")); 1217 1218 if (!locale) { 1219 locale = LOCALE_SYSTEM_DEFAULT; 1220 }; 1221 1222 if (locale == LOCALE_SYSTEM_DEFAULT) { 1223 thislocale = GetSystemDefaultLCID(); 1224 } else if (locale == LOCALE_USER_DEFAULT) { 1225 thislocale = GetUserDefaultLCID(); 1226 } else { 1227 thislocale = locale; 1228 }; 1229 if (xtime == NULL) { 1230 GetSystemTime(&t); 1231 thistime = &t; 1232 } else { 1233 thistime = xtime; 1234 }; 1235 if (format == NULL) { 1236 GetLocaleInfoW(thislocale, ((flags&DATE_LONGDATE) 1237 ? LOCALE_SLONGDATE 1238 : LOCALE_SSHORTDATE), 1239 format_buf, sizeof(format_buf)); 1240 thisformat = format_buf; 1241 } else { 1242 thisformat = (WCHAR*)format; 1243 }; 1244 1245 ret = OLE_GetFormatW(thislocale, flags, 0, thistime, thisformat, 1246 date, datelen); 1247 1248 return ret; 1249 } 1250 /************************************************************************** 1251 * EnumTimeFormats32A (KERNEL32.210) 1252 */ 1253 BOOL WINAPI EnumTimeFormatsA( 1254 TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags) 1255 { 1256 dprintf(("KERNEL32: EnumTimeFormatsA: only US English supported\n")); 1257 1258 if(!lpTimeFmtEnumProc) 1259 { 1260 SetLastError(ERROR_INVALID_PARAMETER); 1261 return FALSE; 1262 } 1263 if(dwFlags) 1264 { 1265 //FIXME_(ole)("Unknown time format (%ld)\n", dwFlags); 1266 } 1267 1268 if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE; 1269 if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE; 1270 if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE; 1271 if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE; 1272 1273 return TRUE; 1274 } 1275 /************************************************************************** 1276 * EnumTimeFormats32W (KERNEL32.211) 1277 */ 1278 BOOL WINAPI EnumTimeFormatsW( 1279 TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags) 1280 { 1281 WCHAR buf[20]; 1282 1283 dprintf(("KERNEL32: EnumTimeFormatsW: only US English supported\n")); 1284 1285 if(!lpTimeFmtEnumProc) 1286 { 1287 SetLastError(ERROR_INVALID_PARAMETER); 1288 return FALSE; 1289 } 1290 if(dwFlags) 1291 { 1292 //FIXME_(ole)("Unknown time format (%ld)\n", dwFlags); 1293 } 1294 1295 AsciiToUnicode("h:mm:ss tt",buf); 1296 if(!(*lpTimeFmtEnumProc)(buf)) return TRUE; 1297 AsciiToUnicode("hh:mm:ss tt",buf); 1298 if(!(*lpTimeFmtEnumProc)(buf)) return TRUE; 1299 AsciiToUnicode("H:mm:ss",buf); 1300 if(!(*lpTimeFmtEnumProc)(buf)) return TRUE; 1301 AsciiToUnicode("HH:mm:ss",buf); 1302 if(!(*lpTimeFmtEnumProc)(buf)) return TRUE; 1303 1304 return TRUE; 1305 } 570 1306 571 /***************************************************************************** 1307 572 * Name : DWORD GetSystemTimeAsFileTime … … 1327 592 SystemTimeToFileTime(&st, &ft); 1328 593 } 1329 /**************************************************************************1330 * EnumDateFormats32A (KERNEL32.198)1331 */1332 BOOL WINAPI EnumDateFormatsA(1333 DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)1334 {1335 dprintf(("KERNEL32: EnumDateFormatsA: only US English supported\n"));1336 1337 if(!lpDateFmtEnumProc)1338 {1339 SetLastError(ERROR_INVALID_PARAMETER);1340 return FALSE;1341 }1342 switch(dwFlags)1343 {1344 case DATE_SHORTDATE:1345 if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;1346 if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;1347 if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;1348 if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;1349 if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;1350 if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;1351 return TRUE;1352 case DATE_LONGDATE:1353 if(!(*lpDateFmtEnumProc)("dddd, MMMM dd, yyyy")) return TRUE;1354 if(!(*lpDateFmtEnumProc)("MMMM dd, yyyy")) return TRUE;1355 if(!(*lpDateFmtEnumProc)("dddd, dd MMMM, yyyy")) return TRUE;1356 if(!(*lpDateFmtEnumProc)("dd MMMM, yyyy")) return TRUE;1357 return TRUE;1358 default:1359 //FIXME_(ole)("Unknown date format (%ld)\n", dwFlags);1360 SetLastError(ERROR_INVALID_PARAMETER);1361 return FALSE;1362 }1363 }1364 /**************************************************************************1365 * EnumDateFormats32W (KERNEL32.199)1366 */1367 BOOL WINAPI EnumDateFormatsW(1368 DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)1369 {1370 WCHAR buf[50];1371 1372 dprintf(("KERNEL32: EnumDateFormatsW: only US English supported\n"));1373 1374 if(!lpDateFmtEnumProc)1375 {1376 SetLastError(ERROR_INVALID_PARAMETER);1377 return FALSE;1378 }1379 switch(dwFlags)1380 {1381 case DATE_SHORTDATE:1382 AsciiToUnicode("M/d/yy",buf);1383 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1384 AsciiToUnicode("M/d/yyyy",buf);1385 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1386 AsciiToUnicode("MM/dd/yy",buf);1387 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1388 AsciiToUnicode("MM/dd/yyyy",buf);1389 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1390 AsciiToUnicode("yy/MM/dd",buf);1391 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1392 AsciiToUnicode("dd-MMM-yy",buf);1393 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1394 return TRUE;1395 case DATE_LONGDATE:1396 AsciiToUnicode("dddd, MMMM dd, yyyy",buf);1397 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1398 AsciiToUnicode("MMMM dd, yyyy",buf);1399 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1400 AsciiToUnicode("dddd, dd MMMM, yyyy",buf);1401 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1402 AsciiToUnicode("dd MMMM, yyyy",buf);1403 if(!(*lpDateFmtEnumProc)(buf)) return TRUE;1404 return TRUE;1405 default:1406 //FIXME_(ole)("Unknown date format (%ld)\n", dwFlags);1407 SetLastError(ERROR_INVALID_PARAMETER);1408 return FALSE;1409 }1410 }1411
Note:
See TracChangeset
for help on using the changeset viewer.