| 1 | /* $Id: heapstring.cpp,v 1.11 1999-09-18 15:59:29 sandervl Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 5 | *
|
|---|
| 6 | * Win32 compatibility string functions for OS/2
|
|---|
| 7 | *
|
|---|
| 8 | * Copyright 1999 Patrick Haller
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | /*****************************************************************************
|
|---|
| 12 | * Includes *
|
|---|
| 13 | *****************************************************************************/
|
|---|
| 14 |
|
|---|
| 15 | #include <os2win.h>
|
|---|
| 16 | #include <stdlib.h>
|
|---|
| 17 | #include <string.h>
|
|---|
| 18 | #include <winnls.h>
|
|---|
| 19 | #include <unicode.h>
|
|---|
| 20 | #include <ctype.h>
|
|---|
| 21 | #include <wcstr.h>
|
|---|
| 22 | #include "heap.h"
|
|---|
| 23 | #include <heapstring.h>
|
|---|
| 24 | #include "misc.h"
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 | /*****************************************************************************
|
|---|
| 28 | * Defines *
|
|---|
| 29 | *****************************************************************************/
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | /*****************************************************************************
|
|---|
| 33 | * Name :
|
|---|
| 34 | * Purpose :
|
|---|
| 35 | * Parameters:
|
|---|
| 36 | * Variables :
|
|---|
| 37 | * Result :
|
|---|
| 38 | * Remark :
|
|---|
| 39 | * Status :
|
|---|
| 40 | *
|
|---|
| 41 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 42 | *****************************************************************************/
|
|---|
| 43 |
|
|---|
| 44 | static UconvObject uconv_object = NULL;
|
|---|
| 45 |
|
|---|
| 46 | static BOOL getUconvObject( void )
|
|---|
| 47 | {
|
|---|
| 48 | int rc;
|
|---|
| 49 | BOOL ret;
|
|---|
| 50 |
|
|---|
| 51 | if ( uconv_object )
|
|---|
| 52 | ret = TRUE;
|
|---|
| 53 | else
|
|---|
| 54 | {
|
|---|
| 55 | rc = UniCreateUconvObject( (UniChar*)L"",
|
|---|
| 56 | &uconv_object );
|
|---|
| 57 | if ( rc == ULS_SUCCESS )
|
|---|
| 58 | ret = TRUE;
|
|---|
| 59 | else
|
|---|
| 60 | {
|
|---|
| 61 | uconv_object = NULL; // to make sure
|
|---|
| 62 | return FALSE;
|
|---|
| 63 | }
|
|---|
| 64 | dprintf(("KERNEL32: HeapString: UniCreateUconvObject(%d)\n",
|
|---|
| 65 | rc));
|
|---|
| 66 | }
|
|---|
| 67 | return ret;
|
|---|
| 68 | }
|
|---|
| 69 |
|
|---|
| 70 |
|
|---|
| 71 | /*****************************************************************************
|
|---|
| 72 | * Name :
|
|---|
| 73 | * Purpose :
|
|---|
| 74 | * Parameters:
|
|---|
| 75 | * Variables :
|
|---|
| 76 | * Result :
|
|---|
| 77 | * Remark :
|
|---|
| 78 | * Status :
|
|---|
| 79 | *
|
|---|
| 80 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 81 | *****************************************************************************/
|
|---|
| 82 |
|
|---|
| 83 | int WIN32API lstrlenA(LPCSTR arg1)
|
|---|
| 84 | {
|
|---|
| 85 | dprintf(("KERNEL32: lstrlenA(%s)\n",
|
|---|
| 86 | arg1));
|
|---|
| 87 |
|
|---|
| 88 | return O32_lstrlen(arg1);
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 | /*****************************************************************************
|
|---|
| 93 | * Name :
|
|---|
| 94 | * Purpose :
|
|---|
| 95 | * Parameters:
|
|---|
| 96 | * Variables :
|
|---|
| 97 | * Result :
|
|---|
| 98 | * Remark :
|
|---|
| 99 | * Status :
|
|---|
| 100 | *
|
|---|
| 101 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 102 | *****************************************************************************/
|
|---|
| 103 |
|
|---|
| 104 | int WIN32API lstrlenW(LPCWSTR arg1)
|
|---|
| 105 | {
|
|---|
| 106 | int rc;
|
|---|
| 107 |
|
|---|
| 108 | rc = UniStrlen( (UniChar*)arg1);
|
|---|
| 109 | dprintf(("KERNEL32: lstrlenW(%08xh) returns %d\n",
|
|---|
| 110 | arg1,
|
|---|
| 111 | rc));
|
|---|
| 112 | return rc;
|
|---|
| 113 | }
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 | /*****************************************************************************
|
|---|
| 117 | * Name :
|
|---|
| 118 | * Purpose :
|
|---|
| 119 | * Parameters:
|
|---|
| 120 | * Variables :
|
|---|
| 121 | * Result :
|
|---|
| 122 | * Remark :
|
|---|
| 123 | * Status :
|
|---|
| 124 | *
|
|---|
| 125 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 126 | *****************************************************************************/
|
|---|
| 127 |
|
|---|
| 128 | LPSTR WIN32API lstrcatA(LPSTR arg1, LPCSTR arg2)
|
|---|
| 129 | {
|
|---|
| 130 | dprintf(("KERNEL32: lstrcat(%s,%s)\n",
|
|---|
| 131 | arg1,
|
|---|
| 132 | arg2));
|
|---|
| 133 |
|
|---|
| 134 | return O32_lstrcat(arg1, arg2);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 |
|
|---|
| 138 | /*****************************************************************************
|
|---|
| 139 | * Name :
|
|---|
| 140 | * Purpose :
|
|---|
| 141 | * Parameters:
|
|---|
| 142 | * Variables :
|
|---|
| 143 | * Result :
|
|---|
| 144 | * Remark :
|
|---|
| 145 | * Status :
|
|---|
| 146 | *
|
|---|
| 147 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 148 | *****************************************************************************/
|
|---|
| 149 |
|
|---|
| 150 | LPWSTR WIN32API lstrcatW(LPWSTR arg1, LPCWSTR arg2)
|
|---|
| 151 | {
|
|---|
| 152 | dprintf(("KERNEL32: OS2lstrcatW(%08xh,%08xh)\n",
|
|---|
| 153 | arg1,
|
|---|
| 154 | arg2));
|
|---|
| 155 |
|
|---|
| 156 | UniStrcat( (UniChar*) arg1, (UniChar*) arg2 );
|
|---|
| 157 | return arg1;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 | /*****************************************************************************
|
|---|
| 162 | * Name :
|
|---|
| 163 | * Purpose :
|
|---|
| 164 | * Parameters:
|
|---|
| 165 | * Variables :
|
|---|
| 166 | * Result :
|
|---|
| 167 | * Remark :
|
|---|
| 168 | * Status :
|
|---|
| 169 | *
|
|---|
| 170 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 171 | *****************************************************************************/
|
|---|
| 172 |
|
|---|
| 173 | int WIN32API lstrcmpA(LPCSTR arg1, LPCSTR arg2)
|
|---|
| 174 | {
|
|---|
| 175 | dprintf(("KERNEL32: OS2lstrcmpA(%s,%s)\n",
|
|---|
| 176 | arg1,
|
|---|
| 177 | arg2));
|
|---|
| 178 |
|
|---|
| 179 | return O32_lstrcmp(arg1, arg2);
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 | /*****************************************************************************
|
|---|
| 184 | * Name :
|
|---|
| 185 | * Purpose :
|
|---|
| 186 | * Parameters:
|
|---|
| 187 | * Variables :
|
|---|
| 188 | * Result :
|
|---|
| 189 | * Remark :
|
|---|
| 190 | * Status :
|
|---|
| 191 | *
|
|---|
| 192 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 193 | *****************************************************************************/
|
|---|
| 194 |
|
|---|
| 195 | int WIN32API lstrncmpA(LPCSTR arg1, LPCSTR arg2, int l)
|
|---|
| 196 | {
|
|---|
| 197 | dprintf(("KERNEL32: OS2lstrncmpA(%s,%s,%d)\n",
|
|---|
| 198 | arg1,
|
|---|
| 199 | arg2,
|
|---|
| 200 | l));
|
|---|
| 201 |
|
|---|
| 202 | return strncmp(arg1, arg2, l);
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | /*****************************************************************************
|
|---|
| 206 | * Name : lstrncmpiA
|
|---|
| 207 | * Purpose :
|
|---|
| 208 | * Parameters:
|
|---|
| 209 | * Variables :
|
|---|
| 210 | * Result :
|
|---|
| 211 | * Remark :
|
|---|
| 212 | * Status :
|
|---|
| 213 | *
|
|---|
| 214 | * Author : Przemyslaw Dobrowolski
|
|---|
| 215 | *****************************************************************************/
|
|---|
| 216 | INT WINAPI lstrncmpiA( LPCSTR str1, LPCSTR str2, INT n )
|
|---|
| 217 | {
|
|---|
| 218 | INT firstch,lastch;
|
|---|
| 219 | INT result = 0;
|
|---|
| 220 |
|
|---|
| 221 | if (n)
|
|---|
| 222 | {
|
|---|
| 223 | do
|
|---|
| 224 | {
|
|---|
| 225 | firstch = tolower(*str1);
|
|---|
| 226 | lastch = tolower(*str2);
|
|---|
| 227 | str1++;
|
|---|
| 228 | str2++;
|
|---|
| 229 | } while (--n && str1 && str2 && firstch == lastch);
|
|---|
| 230 |
|
|---|
| 231 | result = firstch - lastch;
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 | return(result);
|
|---|
| 235 | }
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 | /*****************************************************************************
|
|---|
| 239 | * Name :
|
|---|
| 240 | * Purpose :
|
|---|
| 241 | * Parameters:
|
|---|
| 242 | * Variables :
|
|---|
| 243 | * Result :
|
|---|
| 244 | * Remark :
|
|---|
| 245 | * Status :
|
|---|
| 246 | *
|
|---|
| 247 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 248 | *****************************************************************************/
|
|---|
| 249 |
|
|---|
| 250 | int WIN32API lstrcmpW(LPCWSTR arg1, LPCWSTR arg2)
|
|---|
| 251 | {
|
|---|
| 252 | dprintf(("KERNEL32: lstrcmpW (%08xh-%ls, %08xh-%ls\n",
|
|---|
| 253 | arg1,
|
|---|
| 254 | arg1,
|
|---|
| 255 | arg2,
|
|---|
| 256 | arg2));
|
|---|
| 257 | // return UniStrcmp( (UniChar*)arg1,
|
|---|
| 258 | // (UniChar*)arg2 );
|
|---|
| 259 | return wcscmp( (wchar_t*)arg1,
|
|---|
| 260 | (wchar_t*)arg2 );
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 |
|
|---|
| 264 | /*****************************************************************************
|
|---|
| 265 | * Name :
|
|---|
| 266 | * Purpose :
|
|---|
| 267 | * Parameters:
|
|---|
| 268 | * Variables :
|
|---|
| 269 | * Result :
|
|---|
| 270 | * Remark :
|
|---|
| 271 | * Status :
|
|---|
| 272 | *
|
|---|
| 273 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 274 | *****************************************************************************/
|
|---|
| 275 |
|
|---|
| 276 | int WIN32API lstrncmpW(LPCWSTR arg1, LPCWSTR arg2, int l)
|
|---|
| 277 | {
|
|---|
| 278 | dprintf(("KERNEL32: OS2lstrncmpW(%08xh,%08xh,%d)\n",
|
|---|
| 279 | arg1,
|
|---|
| 280 | arg2,
|
|---|
| 281 | l));
|
|---|
| 282 |
|
|---|
| 283 | return wcsncmp((wchar_t*)arg1,
|
|---|
| 284 | (wchar_t*)arg2,
|
|---|
| 285 | l);
|
|---|
| 286 | }
|
|---|
| 287 |
|
|---|
| 288 | /*****************************************************************************
|
|---|
| 289 | * Name :
|
|---|
| 290 | * Purpose :
|
|---|
| 291 | * Parameters:
|
|---|
| 292 | * Variables :
|
|---|
| 293 | * Result :
|
|---|
| 294 | * Remark :
|
|---|
| 295 | * Status :
|
|---|
| 296 | *
|
|---|
| 297 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 298 | *****************************************************************************/
|
|---|
| 299 |
|
|---|
| 300 | LPSTR WIN32API lstrcpyA(LPSTR arg1, LPCSTR arg2)
|
|---|
| 301 | {
|
|---|
| 302 | dprintf(("KERNEL32: lstrcpy(%08xh,%s)\n",
|
|---|
| 303 | arg1,
|
|---|
| 304 | arg2));
|
|---|
| 305 |
|
|---|
| 306 | return O32_lstrcpy(arg1, arg2);
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 | /*****************************************************************************
|
|---|
| 311 | * Name :
|
|---|
| 312 | * Purpose :
|
|---|
| 313 | * Parameters:
|
|---|
| 314 | * Variables :
|
|---|
| 315 | * Result :
|
|---|
| 316 | * Remark :
|
|---|
| 317 | * Status :
|
|---|
| 318 | *
|
|---|
| 319 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 320 | *****************************************************************************/
|
|---|
| 321 |
|
|---|
| 322 | LPWSTR WIN32API lstrcpyW(LPWSTR dest, LPCWSTR src)
|
|---|
| 323 | {
|
|---|
| 324 | dprintf(("KERNEL32: lstrcpyW(%08xh,%08xh)",
|
|---|
| 325 | dest,
|
|---|
| 326 | src));
|
|---|
| 327 |
|
|---|
| 328 | UniStrcpy( (UniChar*)dest,
|
|---|
| 329 | (UniChar*)src );
|
|---|
| 330 | return dest;
|
|---|
| 331 | }
|
|---|
| 332 |
|
|---|
| 333 |
|
|---|
| 334 | /*****************************************************************************
|
|---|
| 335 | * Name :
|
|---|
| 336 | * Purpose :
|
|---|
| 337 | * Parameters:
|
|---|
| 338 | * Variables :
|
|---|
| 339 | * Result :
|
|---|
| 340 | * Remark :
|
|---|
| 341 | * Status :
|
|---|
| 342 | *
|
|---|
| 343 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 344 | *****************************************************************************/
|
|---|
| 345 |
|
|---|
| 346 | LPSTR WIN32API lstrcpynA(LPSTR arg1, LPCSTR arg2, int arg3)
|
|---|
| 347 | {
|
|---|
| 348 | register LPSTR p1 = arg1;
|
|---|
| 349 | register LPSTR p2 = (LPSTR)arg2;
|
|---|
| 350 |
|
|---|
| 351 | dprintf(("KERNEL32: OS2lstrcpyA(%08xh, %08xh, %08xh)\n",
|
|---|
| 352 | arg1,
|
|---|
| 353 | arg2,
|
|---|
| 354 | arg3));
|
|---|
| 355 |
|
|---|
| 356 | //PH: looks like either \0 or arg3 terminate the copy
|
|---|
| 357 | //return strncpy(arg1, arg2, arg3);
|
|---|
| 358 | arg3--; // pre-decrement to avoid exceeding buffer length
|
|---|
| 359 | // results in better code than (arg1 > 1)
|
|---|
| 360 |
|
|---|
| 361 | for (;*p2 && arg3; arg3--)
|
|---|
| 362 | *p1++ = *p2++;
|
|---|
| 363 |
|
|---|
| 364 | *p1 = 0; //CB: copy arg-1, set end 0
|
|---|
| 365 |
|
|---|
| 366 | return arg1;
|
|---|
| 367 | }
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 | /*****************************************************************************
|
|---|
| 371 | * Name :
|
|---|
| 372 | * Purpose :
|
|---|
| 373 | * Parameters:
|
|---|
| 374 | * Variables :
|
|---|
| 375 | * Result :
|
|---|
| 376 | * Remark :
|
|---|
| 377 | * Status :
|
|---|
| 378 | *
|
|---|
| 379 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 380 | *****************************************************************************/
|
|---|
| 381 |
|
|---|
| 382 | LPWSTR WIN32API lstrcpynW(LPWSTR dest, LPCWSTR src, int arg3)
|
|---|
| 383 | {
|
|---|
| 384 | dprintf(("KERNEL32: lstrcpynW(%08xh,%08xh,%08xh)",
|
|---|
| 385 | dest,
|
|---|
| 386 | src,
|
|---|
| 387 | arg3));
|
|---|
| 388 |
|
|---|
| 389 | if (arg3 == 0)
|
|---|
| 390 | return NULL;
|
|---|
| 391 |
|
|---|
| 392 | UniStrncpy( (UniChar*)dest,
|
|---|
| 393 | (UniChar*)src,
|
|---|
| 394 | arg3-1); //CB: copy arg3-1 characters
|
|---|
| 395 | dest[arg3-1] = 0; //CB: set end
|
|---|
| 396 | return dest;
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 | /*****************************************************************************
|
|---|
| 401 | * Name :
|
|---|
| 402 | * Purpose :
|
|---|
| 403 | * Parameters:
|
|---|
| 404 | * Variables :
|
|---|
| 405 | * Result :
|
|---|
| 406 | * Remark :
|
|---|
| 407 | * Status :
|
|---|
| 408 | *
|
|---|
| 409 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 410 | *****************************************************************************/
|
|---|
| 411 |
|
|---|
| 412 | int WIN32API lstrcmpiA(LPCSTR arg1, LPCSTR arg2)
|
|---|
| 413 | {
|
|---|
| 414 | dprintf(("KERNEL32: lstrcmpiA(%s,%s)\n",
|
|---|
| 415 | arg1,
|
|---|
| 416 | arg2));
|
|---|
| 417 |
|
|---|
| 418 | return O32_lstrcmpi(arg1, arg2);
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 |
|
|---|
| 422 | /*****************************************************************************
|
|---|
| 423 | * Name :
|
|---|
| 424 | * Purpose :
|
|---|
| 425 | * Parameters:
|
|---|
| 426 | * Variables :
|
|---|
| 427 | * Result :
|
|---|
| 428 | * Remark :
|
|---|
| 429 | * Status :
|
|---|
| 430 | *
|
|---|
| 431 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 432 | *****************************************************************************/
|
|---|
| 433 |
|
|---|
| 434 | int WIN32API lstrcmpiW(LPCWSTR arg1, LPCWSTR arg2)
|
|---|
| 435 | {
|
|---|
| 436 | char *astr1, *astr2;
|
|---|
| 437 | int rc;
|
|---|
| 438 |
|
|---|
| 439 | dprintf(("KERNEL32: lstrcmpiW(%08xh,%08xh)\n",
|
|---|
| 440 | arg1,
|
|---|
| 441 | arg2));
|
|---|
| 442 |
|
|---|
| 443 | // NOTE: This function has no equivalent in uunidef.h
|
|---|
| 444 | astr1 = UnicodeToAsciiString((LPWSTR)arg1);
|
|---|
| 445 | astr2 = UnicodeToAsciiString((LPWSTR)arg2);
|
|---|
| 446 | rc = O32_lstrcmpi(astr1, astr2);
|
|---|
| 447 | FreeAsciiString(astr2);
|
|---|
| 448 | FreeAsciiString(astr1);
|
|---|
| 449 | return(rc);
|
|---|
| 450 | }
|
|---|
| 451 |
|
|---|
| 452 |
|
|---|
| 453 | /*****************************************************************************
|
|---|
| 454 | * Name :
|
|---|
| 455 | * Purpose :
|
|---|
| 456 | * Parameters:
|
|---|
| 457 | * Variables :
|
|---|
| 458 | * Result :
|
|---|
| 459 | * Remark :
|
|---|
| 460 | * Status :
|
|---|
| 461 | *
|
|---|
| 462 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 463 | *****************************************************************************/
|
|---|
| 464 |
|
|---|
| 465 | // unilen: length of astring buffer (including 0 terminator)
|
|---|
| 466 | // returns string length
|
|---|
| 467 |
|
|---|
| 468 | int WIN32API lstrcpynWtoA(LPSTR astring,
|
|---|
| 469 | LPWSTR ustring,
|
|---|
| 470 | int unilen)
|
|---|
| 471 | {
|
|---|
| 472 | int i;
|
|---|
| 473 | int rc;
|
|---|
| 474 | size_t uni_chars_left;
|
|---|
| 475 | size_t out_bytes_left;
|
|---|
| 476 | size_t num_subs;
|
|---|
| 477 | UniChar* in_buf;
|
|---|
| 478 | char* out_buf;
|
|---|
| 479 |
|
|---|
| 480 | if (ustring == NULL)
|
|---|
| 481 | {
|
|---|
| 482 | if (astring != NULL && unilen > 0)
|
|---|
| 483 | astring[0] = 0;
|
|---|
| 484 | return 0;
|
|---|
| 485 | }
|
|---|
| 486 |
|
|---|
| 487 | if (astring == NULL || unilen <= 0)
|
|---|
| 488 | return 0;
|
|---|
| 489 |
|
|---|
| 490 | if (getUconvObject())
|
|---|
| 491 | {
|
|---|
| 492 | if (unilen == 1)
|
|---|
| 493 | {
|
|---|
| 494 | astring[0] = 0;
|
|---|
| 495 | return 0; //no data
|
|---|
| 496 | }
|
|---|
| 497 |
|
|---|
| 498 | uni_chars_left = unilen-1; //elements
|
|---|
| 499 | out_bytes_left = uni_chars_left; //size in bytes == elements
|
|---|
| 500 | in_buf = (UniChar*)ustring;
|
|---|
| 501 | out_buf = astring;
|
|---|
| 502 | rc = UniUconvFromUcs(uconv_object,
|
|---|
| 503 | &in_buf, &uni_chars_left,
|
|---|
| 504 | (void**)&out_buf, &out_bytes_left,
|
|---|
| 505 | &num_subs);
|
|---|
| 506 |
|
|---|
| 507 | unilen -= 1+out_bytes_left; //end + left bytes
|
|---|
| 508 | astring[unilen] = 0; //terminate
|
|---|
| 509 |
|
|---|
| 510 | return unilen;
|
|---|
| 511 |
|
|---|
| 512 | }
|
|---|
| 513 | else
|
|---|
| 514 | {
|
|---|
| 515 | /* idiots unicode conversion :) */
|
|---|
| 516 | for (i = 0; i < unilen-1; i++)
|
|---|
| 517 | {
|
|---|
| 518 | astring[i] = (ustring[i] > 255) ? (char)20 : (char)ustring[i]; //CB: handle invalid characters as space
|
|---|
| 519 | if (ustring[i] == 0) return i; //asta la vista, baby
|
|---|
| 520 | }
|
|---|
| 521 |
|
|---|
| 522 | astring[unilen-1] = 0; // @@@PH: 1999/06/09 fix - always terminate string
|
|---|
| 523 |
|
|---|
| 524 | return(unilen-1);
|
|---|
| 525 | }
|
|---|
| 526 | }
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 | /*****************************************************************************
|
|---|
| 530 | * Name :
|
|---|
| 531 | * Purpose :
|
|---|
| 532 | * Parameters:
|
|---|
| 533 | * Variables :
|
|---|
| 534 | * Result :
|
|---|
| 535 | * Remark :
|
|---|
| 536 | * Status :
|
|---|
| 537 | *
|
|---|
| 538 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 539 | *****************************************************************************/
|
|---|
| 540 |
|
|---|
| 541 | // asciilen: max length of unicode buffer (including end 0)
|
|---|
| 542 |
|
|---|
| 543 | int WIN32API lstrcpynAtoW(LPWSTR unicode,
|
|---|
| 544 | LPSTR ascii,
|
|---|
| 545 | int asciilen)
|
|---|
| 546 | {
|
|---|
| 547 | int rc;
|
|---|
| 548 | int i;
|
|---|
| 549 | size_t uni_chars_left;
|
|---|
| 550 | size_t in_bytes_left;
|
|---|
| 551 | size_t num_subs;
|
|---|
| 552 | UniChar* out_buf;
|
|---|
| 553 | char* in_buf;
|
|---|
| 554 |
|
|---|
| 555 | dprintf(("KERNEL32: HeapString: lstrcpynAtoW(%s,%08xh)\n",
|
|---|
| 556 | ascii,
|
|---|
| 557 | unicode));
|
|---|
| 558 |
|
|---|
| 559 | //CB: no input, set at least terminator
|
|---|
| 560 | if (ascii == NULL)
|
|---|
| 561 | {
|
|---|
| 562 | if (unicode != NULL && asciilen > 0) unicode[0] = 0;
|
|---|
| 563 | return 0;
|
|---|
| 564 | }
|
|---|
| 565 |
|
|---|
| 566 | if (unicode == NULL || asciilen <= 0)
|
|---|
| 567 | return 0; //nothing to do
|
|---|
| 568 |
|
|---|
| 569 | if (getUconvObject())
|
|---|
| 570 | {
|
|---|
| 571 | if (asciilen == 1)
|
|---|
| 572 | {
|
|---|
| 573 | unicode[0] = 0;
|
|---|
| 574 | return 0;
|
|---|
| 575 | }
|
|---|
| 576 |
|
|---|
| 577 | in_buf = ascii;
|
|---|
| 578 | in_bytes_left = asciilen-1; //buffer size in bytes
|
|---|
| 579 | out_buf = (UniChar*)unicode;
|
|---|
| 580 |
|
|---|
| 581 | uni_chars_left = in_bytes_left; //elements
|
|---|
| 582 |
|
|---|
| 583 | rc = UniUconvToUcs( uconv_object,
|
|---|
| 584 | (void**)&in_buf, &in_bytes_left,
|
|---|
| 585 | &out_buf, &uni_chars_left,
|
|---|
| 586 | &num_subs );
|
|---|
| 587 |
|
|---|
| 588 | unicode[asciilen-1-in_bytes_left] = 0;
|
|---|
| 589 |
|
|---|
| 590 | //if (rc != ULS_SUCCESS && in_bytes_left > 0) //CB: never the case during my tests
|
|---|
| 591 | // dprintf(("KERNEL32: AsciiToUnicode failed, %d bytes left!\n",in_bytes_left));
|
|---|
| 592 | return asciilen - 1;
|
|---|
| 593 | }
|
|---|
| 594 | else
|
|---|
| 595 | { //poor man's conversion
|
|---|
| 596 |
|
|---|
| 597 | for(i = 0;i < asciilen-1;i++)
|
|---|
| 598 | {
|
|---|
| 599 | unicode[i] = ascii[i];
|
|---|
| 600 | if (ascii[i] == 0)
|
|---|
| 601 | return i-1; //work done
|
|---|
| 602 | }
|
|---|
| 603 |
|
|---|
| 604 | unicode[asciilen-1] = 0;
|
|---|
| 605 | return asciilen-1;
|
|---|
| 606 | }
|
|---|
| 607 | }
|
|---|
| 608 |
|
|---|
| 609 |
|
|---|
| 610 | /*****************************************************************************
|
|---|
| 611 | * Name :
|
|---|
| 612 | * Purpose : Converts unicode string to ascii string
|
|---|
| 613 | * Parameters:
|
|---|
| 614 | * Variables :
|
|---|
| 615 | * Result : returns length of ascii string
|
|---|
| 616 | * Remark :
|
|---|
| 617 | * Status :
|
|---|
| 618 | *
|
|---|
| 619 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 620 | *****************************************************************************/
|
|---|
| 621 |
|
|---|
| 622 | LPSTR WIN32API lstrcpyWtoA(LPSTR ascii, LPWSTR unicode)
|
|---|
| 623 | {
|
|---|
| 624 | if (unicode == NULL)
|
|---|
| 625 | {
|
|---|
| 626 | if (unicode != NULL) unicode[0] = 0; //CB: set at least end
|
|---|
| 627 | return NULL;
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | if (unicode == NULL)
|
|---|
| 631 | return NULL; /* garbage in, garbage out ! */
|
|---|
| 632 |
|
|---|
| 633 | /* forward to function with len parameter */
|
|---|
| 634 | lstrcpynWtoA(ascii,
|
|---|
| 635 | unicode,
|
|---|
| 636 | UniStrlen((UniChar*)unicode)+1); //end included
|
|---|
| 637 |
|
|---|
| 638 | return ascii;
|
|---|
| 639 | }
|
|---|
| 640 |
|
|---|
| 641 |
|
|---|
| 642 | /*****************************************************************************
|
|---|
| 643 | * Name :
|
|---|
| 644 | * Purpose : Copies the full string from ascii to unicode
|
|---|
| 645 | * Parameters:
|
|---|
| 646 | * Variables :
|
|---|
| 647 | * Result :
|
|---|
| 648 | * Remark :
|
|---|
| 649 | * Status :
|
|---|
| 650 | *
|
|---|
| 651 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 652 | *****************************************************************************/
|
|---|
| 653 |
|
|---|
| 654 | LPWSTR WIN32API lstrcpyAtoW(LPWSTR unicode, LPSTR ascii)
|
|---|
| 655 | {
|
|---|
| 656 | /* achimha for security, strlen might trap if garbage in */
|
|---|
| 657 | /* @@@PH 98/06/07 */
|
|---|
| 658 | if (ascii == NULL)
|
|---|
| 659 | {
|
|---|
| 660 | if (unicode != NULL) unicode[0] = 0; //CB: set at least end
|
|---|
| 661 | return NULL;
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 | if (unicode == NULL)
|
|---|
| 665 | return NULL; /* garbage in, garbage out ! */
|
|---|
| 666 |
|
|---|
| 667 | /* forward to call with length parameter */
|
|---|
| 668 | lstrcpynAtoW(unicode, ascii, strlen(ascii)+1); //end included
|
|---|
| 669 | return (unicode);
|
|---|
| 670 | }
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 | /*****************************************************************************
|
|---|
| 676 | * Name :
|
|---|
| 677 | * Purpose :
|
|---|
| 678 | * Parameters:
|
|---|
| 679 | * Variables :
|
|---|
| 680 | * Result :
|
|---|
| 681 | * Remark :
|
|---|
| 682 | * Status :
|
|---|
| 683 | *
|
|---|
| 684 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 685 | *****************************************************************************/
|
|---|
| 686 |
|
|---|
| 687 | LPVOID WIN32API HEAP_xalloc( HANDLE heap, DWORD flags, DWORD size )
|
|---|
| 688 | {
|
|---|
| 689 | LPVOID p = HeapAlloc( heap, flags, size );
|
|---|
| 690 | if (!p)
|
|---|
| 691 | {
|
|---|
| 692 | dprintf(("KERNEL32: HEAP_xalloc(%08xh,%08xh,%08xh) out of memory.\n",
|
|---|
| 693 | heap,
|
|---|
| 694 | flags,
|
|---|
| 695 | size));
|
|---|
| 696 | }
|
|---|
| 697 | return p;
|
|---|
| 698 | }
|
|---|
| 699 |
|
|---|
| 700 |
|
|---|
| 701 | /*****************************************************************************
|
|---|
| 702 | * Name :
|
|---|
| 703 | * Purpose :
|
|---|
| 704 | * Parameters:
|
|---|
| 705 | * Variables :
|
|---|
| 706 | * Result :
|
|---|
| 707 | * Remark :
|
|---|
| 708 | * Status :
|
|---|
| 709 | *
|
|---|
| 710 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 711 | *****************************************************************************/
|
|---|
| 712 |
|
|---|
| 713 | LPVOID WIN32API HEAP_xrealloc( HANDLE heap, DWORD flags, LPVOID lpMem, DWORD size )
|
|---|
| 714 | {
|
|---|
| 715 | LPVOID p = HeapReAlloc( heap, flags, lpMem, size );
|
|---|
| 716 | if (!p)
|
|---|
| 717 | {
|
|---|
| 718 | dprintf(("KERNEL32: HEAP_xrealloc(%08xh,%08xh,%08xh,%08xh) out of memory.\n",
|
|---|
| 719 | heap,
|
|---|
| 720 | flags,
|
|---|
| 721 | lpMem,
|
|---|
| 722 | size));
|
|---|
| 723 | }
|
|---|
| 724 | return p;
|
|---|
| 725 | }
|
|---|
| 726 |
|
|---|
| 727 |
|
|---|
| 728 | /*****************************************************************************
|
|---|
| 729 | * Name :
|
|---|
| 730 | * Purpose :
|
|---|
| 731 | * Parameters:
|
|---|
| 732 | * Variables :
|
|---|
| 733 | * Result :
|
|---|
| 734 | * Remark :
|
|---|
| 735 | * Status :
|
|---|
| 736 | *
|
|---|
| 737 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 738 | *****************************************************************************/
|
|---|
| 739 |
|
|---|
| 740 | LPVOID WIN32API HEAP_malloc(DWORD size )
|
|---|
| 741 | {
|
|---|
| 742 | LPVOID p = HeapAlloc( GetProcessHeap(), 0, size );
|
|---|
| 743 | if (!p)
|
|---|
| 744 | {
|
|---|
| 745 | dprintf(("KERNEL32: HEAP_malloc(%08xh) out of memory.\n",
|
|---|
| 746 | size));
|
|---|
| 747 | }
|
|---|
| 748 | return p;
|
|---|
| 749 | }
|
|---|
| 750 |
|
|---|
| 751 |
|
|---|
| 752 | /*****************************************************************************
|
|---|
| 753 | * Name :
|
|---|
| 754 | * Purpose :
|
|---|
| 755 | * Parameters:
|
|---|
| 756 | * Variables :
|
|---|
| 757 | * Result :
|
|---|
| 758 | * Remark :
|
|---|
| 759 | * Status :
|
|---|
| 760 | *
|
|---|
| 761 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 762 | *****************************************************************************/
|
|---|
| 763 |
|
|---|
| 764 | LPVOID WIN32API HEAP_realloc(LPVOID lpMem, DWORD size )
|
|---|
| 765 | {
|
|---|
| 766 | LPVOID p = HeapReAlloc( GetProcessHeap(), 0, lpMem, size );
|
|---|
| 767 | if (!p)
|
|---|
| 768 | {
|
|---|
| 769 | dprintf(("KERNEL32: HEAP_realloc(%08xh,%08xh) out of memory.\n",
|
|---|
| 770 | lpMem,
|
|---|
| 771 | size));
|
|---|
| 772 | }
|
|---|
| 773 | return p;
|
|---|
| 774 | }
|
|---|
| 775 |
|
|---|
| 776 |
|
|---|
| 777 | /*****************************************************************************
|
|---|
| 778 | * Name :
|
|---|
| 779 | * Purpose :
|
|---|
| 780 | * Parameters:
|
|---|
| 781 | * Variables :
|
|---|
| 782 | * Result :
|
|---|
| 783 | * Remark :
|
|---|
| 784 | * Status :
|
|---|
| 785 | *
|
|---|
| 786 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 787 | *****************************************************************************/
|
|---|
| 788 |
|
|---|
| 789 | VOID WIN32API HEAP_free(LPVOID lpMem)
|
|---|
| 790 | {
|
|---|
| 791 | dprintf(("KERNEL32: HEAP_free(%08xh)\n",
|
|---|
| 792 | lpMem));
|
|---|
| 793 |
|
|---|
| 794 | HeapFree( GetProcessHeap(), 0, lpMem);
|
|---|
| 795 | }
|
|---|
| 796 |
|
|---|
| 797 |
|
|---|
| 798 | /*****************************************************************************
|
|---|
| 799 | * Name :
|
|---|
| 800 | * Purpose :
|
|---|
| 801 | * Parameters:
|
|---|
| 802 | * Variables :
|
|---|
| 803 | * Result :
|
|---|
| 804 | * Remark :
|
|---|
| 805 | * Status :
|
|---|
| 806 | *
|
|---|
| 807 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 808 | *****************************************************************************/
|
|---|
| 809 |
|
|---|
| 810 | LPSTR WIN32API HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
|
|---|
| 811 | {
|
|---|
| 812 | LPSTR p = (LPSTR)HEAP_xalloc( heap, flags, strlen(str) + 1 );
|
|---|
| 813 | strcpy( p, str );
|
|---|
| 814 | return p;
|
|---|
| 815 | }
|
|---|
| 816 |
|
|---|
| 817 |
|
|---|
| 818 | /*****************************************************************************
|
|---|
| 819 | * Name :
|
|---|
| 820 | * Purpose :
|
|---|
| 821 | * Parameters:
|
|---|
| 822 | * Variables :
|
|---|
| 823 | * Result :
|
|---|
| 824 | * Remark :
|
|---|
| 825 | * Status :
|
|---|
| 826 | *
|
|---|
| 827 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 828 | *****************************************************************************/
|
|---|
| 829 |
|
|---|
| 830 | LPWSTR WIN32API HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str )
|
|---|
| 831 | {
|
|---|
| 832 | INT len = lstrlenW(str) + 1;
|
|---|
| 833 | LPWSTR p = (LPWSTR)HEAP_xalloc( heap, flags, len * sizeof(WCHAR) );
|
|---|
| 834 | lstrcpyW( p, str );
|
|---|
| 835 | return p;
|
|---|
| 836 | }
|
|---|
| 837 |
|
|---|
| 838 |
|
|---|
| 839 | /*****************************************************************************
|
|---|
| 840 | * Name :
|
|---|
| 841 | * Purpose :
|
|---|
| 842 | * Parameters:
|
|---|
| 843 | * Variables :
|
|---|
| 844 | * Result :
|
|---|
| 845 | * Remark :
|
|---|
| 846 | * Status :
|
|---|
| 847 | *
|
|---|
| 848 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 849 | *****************************************************************************/
|
|---|
| 850 |
|
|---|
| 851 | LPWSTR WIN32API HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
|
|---|
| 852 | {
|
|---|
| 853 | LPWSTR ret;
|
|---|
| 854 |
|
|---|
| 855 | if (!str) return NULL;
|
|---|
| 856 | ret = (LPWSTR)HEAP_xalloc( heap, flags, (strlen(str)+1) * sizeof(WCHAR) );
|
|---|
| 857 | lstrcpyAtoW( ret, (LPSTR)str );
|
|---|
| 858 | return ret;
|
|---|
| 859 | }
|
|---|
| 860 |
|
|---|
| 861 |
|
|---|
| 862 | /*****************************************************************************
|
|---|
| 863 | * Name :
|
|---|
| 864 | * Purpose :
|
|---|
| 865 | * Parameters:
|
|---|
| 866 | * Variables :
|
|---|
| 867 | * Result :
|
|---|
| 868 | * Remark :
|
|---|
| 869 | * Status :
|
|---|
| 870 | *
|
|---|
| 871 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 872 | *****************************************************************************/
|
|---|
| 873 |
|
|---|
| 874 | LPSTR WIN32API HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
|
|---|
| 875 | {
|
|---|
| 876 | LPSTR ret;
|
|---|
| 877 |
|
|---|
| 878 | if (!str) return NULL;
|
|---|
| 879 | ret = (LPSTR)HEAP_xalloc( heap, flags, lstrlenW(str) + 1 );
|
|---|
| 880 | lstrcpyWtoA( ret, (LPWSTR)str );
|
|---|
| 881 | return ret;
|
|---|
| 882 | }
|
|---|
| 883 |
|
|---|
| 884 |
|
|---|
| 885 | /*****************************************************************************
|
|---|
| 886 | * Name : WideCharToLocal
|
|---|
| 887 | * Purpose : similar lstrcpyWtoA, should handle codepages properly
|
|---|
| 888 | * Parameters:
|
|---|
| 889 | * Variables :
|
|---|
| 890 | * Result : strlen of the destination string
|
|---|
| 891 | * Remark :
|
|---|
| 892 | * Status :
|
|---|
| 893 | *
|
|---|
| 894 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 895 | *****************************************************************************/
|
|---|
| 896 |
|
|---|
| 897 | INT WIN32API WideCharToLocal(LPSTR pLocal, LPWSTR pWide, INT dwChars)
|
|---|
| 898 | {
|
|---|
| 899 | dprintf(("KERNEL32: WideCharToLocal(%08xh,%08xh,%08xh)\n",
|
|---|
| 900 | pLocal,
|
|---|
| 901 | pWide,
|
|---|
| 902 | dwChars));
|
|---|
| 903 |
|
|---|
| 904 | *pLocal = 0;
|
|---|
| 905 | WideCharToMultiByte(CP_ACP,
|
|---|
| 906 | 0,
|
|---|
| 907 | pWide,
|
|---|
| 908 | -1,
|
|---|
| 909 | pLocal,
|
|---|
| 910 | dwChars,
|
|---|
| 911 | NULL,
|
|---|
| 912 | NULL);
|
|---|
| 913 |
|
|---|
| 914 | return strlen(pLocal);
|
|---|
| 915 | }
|
|---|
| 916 |
|
|---|
| 917 |
|
|---|
| 918 | /*****************************************************************************
|
|---|
| 919 | * Name : LocalToWideChar
|
|---|
| 920 | * Purpose : similar lstrcpyAtoW, should handle codepages properly
|
|---|
| 921 | * Parameters:
|
|---|
| 922 | * Variables :
|
|---|
| 923 | * Result : strlen of the destination string
|
|---|
| 924 | * Remark :
|
|---|
| 925 | * Status :
|
|---|
| 926 | *
|
|---|
| 927 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 928 | *****************************************************************************/
|
|---|
| 929 |
|
|---|
| 930 | INT WIN32API LocalToWideChar(LPWSTR pWide, LPSTR pLocal, INT dwChars)
|
|---|
| 931 | {
|
|---|
| 932 | *pWide = 0;
|
|---|
| 933 |
|
|---|
| 934 | dprintf(("KERNEL32: LocalToWideChar(%08xh,%08xh,%08xh)\n",
|
|---|
| 935 | pLocal,
|
|---|
| 936 | pWide,
|
|---|
| 937 | dwChars));
|
|---|
| 938 |
|
|---|
| 939 | MultiByteToWideChar(CP_ACP,
|
|---|
| 940 | 0,
|
|---|
| 941 | pLocal,
|
|---|
| 942 | -1,
|
|---|
| 943 | pWide,
|
|---|
| 944 | dwChars);
|
|---|
| 945 |
|
|---|
| 946 | return lstrlenW(pWide);
|
|---|
| 947 | }
|
|---|
| 948 |
|
|---|
| 949 |
|
|---|
| 950 |
|
|---|
| 951 |
|
|---|
| 952 |
|
|---|
| 953 |
|
|---|
| 954 | #if 0
|
|---|
| 955 |
|
|---|
| 956 |
|
|---|
| 957 | /*****************************************************************************
|
|---|
| 958 | * Name :
|
|---|
| 959 | * Purpose :
|
|---|
| 960 | * Parameters:
|
|---|
| 961 | * Variables :
|
|---|
| 962 | * Result :
|
|---|
| 963 | * Remark :
|
|---|
| 964 | * Status :
|
|---|
| 965 | *
|
|---|
| 966 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 967 | *****************************************************************************/
|
|---|
| 968 |
|
|---|
| 969 | // Converts unicode string to ascii string
|
|---|
| 970 | // returns pointer to ascii string
|
|---|
| 971 | char * WIN32API UnicodeToAsciiString(WCHAR *ustring)
|
|---|
| 972 | {
|
|---|
| 973 | char *astring;
|
|---|
| 974 |
|
|---|
| 975 | if(ustring == NULL) return(NULL);
|
|---|
| 976 |
|
|---|
| 977 | astring = (char *)malloc( 1 + UniStrlen((UniChar*)ustring) );
|
|---|
| 978 | UnicodeToAscii( ustring, astring );
|
|---|
| 979 | return(astring);
|
|---|
| 980 | }
|
|---|
| 981 |
|
|---|
| 982 |
|
|---|
| 983 | /*****************************************************************************
|
|---|
| 984 | * Name :
|
|---|
| 985 | * Purpose :
|
|---|
| 986 | * Parameters:
|
|---|
| 987 | * Variables :
|
|---|
| 988 | * Result :
|
|---|
| 989 | * Remark :
|
|---|
| 990 | * Status :
|
|---|
| 991 | *
|
|---|
| 992 | * Author : Patrick Haller [Thu, 1999/08/05 20:46]
|
|---|
| 993 | *****************************************************************************/
|
|---|
| 994 |
|
|---|
| 995 | // Converts ascii string to unicode string
|
|---|
| 996 | // returns pointer to unicode string
|
|---|
| 997 | WCHAR * WIN32API AsciiToUnicodeString(char *astring)
|
|---|
| 998 | {
|
|---|
| 999 | WCHAR *ustring;
|
|---|
| 1000 |
|
|---|
| 1001 | if(astring == NULL)
|
|---|
| 1002 | return(NULL);
|
|---|
| 1003 |
|
|---|
| 1004 | ustring = (WCHAR *)malloc( 1 + strlen(astring) << 1 );
|
|---|
| 1005 | AsciiToUnicode( astring, ustring );
|
|---|
| 1006 | return(ustring);
|
|---|
| 1007 | }
|
|---|
| 1008 |
|
|---|
| 1009 | #endif
|
|---|
| 1010 |
|
|---|
| 1011 |
|
|---|
| 1012 |
|
|---|