Ignore:
Timestamp:
Sep 15, 2001, 11:47:44 AM (24 years ago)
Author:
sandervl
Message:

restored old version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/NTDLL/rtlstr.c

    r6648 r6712  
    1 /* $Id: rtlstr.c,v 1.4 2001-09-05 13:14:08 bird Exp $ */
    21/*
    32 * Rtl string functions
     
    2423
    2524/**************************************************************************
    26  *  RtlInitAnsiString   (NTDLL.@)
     25 *      RtlInitAnsiString   (NTDLL.@)
    2726 */
    2827void WINAPI RtlInitAnsiString( PSTRING target, LPCSTR source)
     
    3837
    3938/**************************************************************************
    40  *  RtlInitString   (NTDLL.@)
     39 *      RtlInitString   (NTDLL.@)
    4140 */
    4241void WINAPI RtlInitString( PSTRING target, LPCSTR source )
     
    4746
    4847/**************************************************************************
    49  *  RtlFreeAnsiString   (NTDLL.@)
     48 *      RtlFreeAnsiString   (NTDLL.@)
    5049 */
    5150void WINAPI RtlFreeAnsiString( PSTRING str )
     
    5655
    5756/**************************************************************************
    58  *  RtlFreeOemString   (NTDLL.@)
     57 *      RtlFreeOemString   (NTDLL.@)
    5958 */
    6059void WINAPI RtlFreeOemString( PSTRING str )
     
    6564
    6665/**************************************************************************
    67  *  RtlCopyString   (NTDLL.@)
     66 *      RtlCopyString   (NTDLL.@)
    6867 */
    6968void WINAPI RtlCopyString( STRING *dst, const STRING *src )
     
    8079
    8180/**************************************************************************
    82  *  RtlInitUnicodeString   (NTDLL.@)
     81 *      RtlInitUnicodeString   (NTDLL.@)
    8382 */
    8483void WINAPI RtlInitUnicodeString( PUNICODE_STRING target, LPCWSTR source )
     
    9493
    9594/**************************************************************************
    96  *  RtlCreateUnicodeString   (NTDLL.@)
     95 *      RtlCreateUnicodeString   (NTDLL.@)
    9796 */
    9897BOOLEAN WINAPI RtlCreateUnicodeString( PUNICODE_STRING target, LPCWSTR src )
     
    108107
    109108/**************************************************************************
    110  *  RtlCreateUnicodeStringFromAsciiz   (NTDLL.@)
     109 *      RtlCreateUnicodeStringFromAsciiz   (NTDLL.@)
    111110 */
    112111BOOLEAN WINAPI RtlCreateUnicodeStringFromAsciiz( PUNICODE_STRING target, LPCSTR src )
     
    119118
    120119/**************************************************************************
    121  *  RtlFreeUnicodeString   (NTDLL.@)
     120 *      RtlFreeUnicodeString   (NTDLL.@)
    122121 */
    123122void WINAPI RtlFreeUnicodeString( PUNICODE_STRING str )
     
    128127
    129128/**************************************************************************
    130  *  RtlCopyUnicodeString   (NTDLL.@)
     129 *      RtlCopyUnicodeString   (NTDLL.@)
    131130 */
    132131void WINAPI RtlCopyUnicodeString( UNICODE_STRING *dst, const UNICODE_STRING *src )
     
    145144
    146145/**************************************************************************
    147  *  RtlEraseUnicodeString   (NTDLL.@)
     146 *      RtlEraseUnicodeString   (NTDLL.@)
    148147 */
    149148void WINAPI RtlEraseUnicodeString( UNICODE_STRING *str )
     
    161160
    162161/******************************************************************************
    163  *  RtlCompareString   (NTDLL.@)
     162 *      RtlCompareString   (NTDLL.@)
    164163 */
    165164LONG WINAPI RtlCompareString( const STRING *s1, const STRING *s2, BOOLEAN CaseInsensitive )
     
    187186
    188187/******************************************************************************
    189  *  RtlCompareUnicodeString   (NTDLL.@)
     188 *      RtlCompareUnicodeString   (NTDLL.@)
    190189 */
    191190LONG WINAPI RtlCompareUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2,
     
    214213
    215214/**************************************************************************
    216  *  RtlEqualString   (NTDLL.@)
     215 *      RtlEqualString   (NTDLL.@)
    217216 */
    218217BOOLEAN WINAPI RtlEqualString( const STRING *s1, const STRING *s2, BOOLEAN CaseInsensitive )
     
    224223
    225224/**************************************************************************
    226  *  RtlEqualUnicodeString   (NTDLL.@)
     225 *      RtlEqualUnicodeString   (NTDLL.@)
    227226 */
    228227BOOLEAN WINAPI RtlEqualUnicodeString( const UNICODE_STRING *s1, const UNICODE_STRING *s2,
     
    235234
    236235/**************************************************************************
    237  *  RtlPrefixString   (NTDLL.@)
     236 *      RtlPrefixString   (NTDLL.@)
    238237 *
    239238 * Test if s1 is a prefix in s2
     
    259258
    260259/**************************************************************************
    261  *  RtlPrefixUnicodeString   (NTDLL.@)
     260 *      RtlPrefixUnicodeString   (NTDLL.@)
    262261 *
    263262 * Test if s1 is a prefix in s2
     
    285284
    286285/*
    287     COPY BETWEEN ANSI_STRING or UNICODE_STRING
    288     there is no parameter checking, it just crashes
     286        COPY BETWEEN ANSI_STRING or UNICODE_STRING
     287        there is no parameter checking, it just crashes
    289288*/
    290289
    291290
    292291/**************************************************************************
    293  *  RtlAnsiStringToUnicodeString   (NTDLL.@)
     292 *      RtlAnsiStringToUnicodeString   (NTDLL.@)
    294293 *
    295294 * NOTES:
     
    319318
    320319/**************************************************************************
    321  *  RtlOemStringToUnicodeString   (NTDLL.@)
     320 *      RtlOemStringToUnicodeString   (NTDLL.@)
    322321 *
    323322 * NOTES
     
    348347
    349348/**************************************************************************
    350  *  RtlUnicodeStringToAnsiString   (NTDLL.@)
     349 *      RtlUnicodeStringToAnsiString   (NTDLL.@)
    351350 *
    352351 * NOTES
     
    382381
    383382/**************************************************************************
    384  *  RtlUnicodeStringToOemString   (NTDLL.@)
     383 *      RtlUnicodeStringToOemString   (NTDLL.@)
    385384 *
    386385 * NOTES
     
    416415
    417416/**************************************************************************
    418  *  RtlMultiByteToUnicodeN   (NTDLL.@)
     417 *      RtlMultiByteToUnicodeN   (NTDLL.@)
    419418 *
    420419 * NOTES
     
    432431
    433432/**************************************************************************
    434  *  RtlOemToUnicodeN   (NTDLL.@)
     433 *      RtlOemToUnicodeN   (NTDLL.@)
    435434 */
    436435NTSTATUS WINAPI RtlOemToUnicodeN( LPWSTR dst, DWORD dstlen, LPDWORD reslen,
     
    445444
    446445/**************************************************************************
    447  *  RtlUnicodeToMultiByteN   (NTDLL.@)
     446 *      RtlUnicodeToMultiByteN   (NTDLL.@)
    448447 */
    449448NTSTATUS WINAPI RtlUnicodeToMultiByteN( LPSTR dst, DWORD dstlen, LPDWORD reslen,
     
    459458
    460459/**************************************************************************
    461  *  RtlUnicodeToOemN   (NTDLL.@)
     460 *      RtlUnicodeToOemN   (NTDLL.@)
    462461 */
    463462NTSTATUS WINAPI RtlUnicodeToOemN( LPSTR dst, DWORD dstlen, LPDWORD reslen,
     
    477476
    478477/**************************************************************************
    479  *  RtlUpperString   (NTDLL.@)
     478 *      RtlUpperString   (NTDLL.@)
    480479 */
    481480void WINAPI RtlUpperString( STRING *dst, const STRING *src )
     
    489488
    490489/**************************************************************************
    491  *  RtlUpcaseUnicodeString   (NTDLL.@)
     490 *      RtlUpcaseUnicodeString   (NTDLL.@)
    492491 *
    493492 * NOTES:
     
    516515
    517516/**************************************************************************
    518  *  RtlUpcaseUnicodeStringToAnsiString   (NTDLL.@)
     517 *      RtlUpcaseUnicodeStringToAnsiString   (NTDLL.@)
    519518 *
    520519 * NOTES
     
    538537
    539538/**************************************************************************
    540  *  RtlUpcaseUnicodeStringToOemString   (NTDLL.@)
     539 *      RtlUpcaseUnicodeStringToOemString   (NTDLL.@)
    541540 *
    542541 * NOTES
     
    560559
    561560/**************************************************************************
    562  *  RtlUpcaseUnicodeToMultiByteN   (NTDLL.@)
     561 *      RtlUpcaseUnicodeToMultiByteN   (NTDLL.@)
    563562 */
    564563NTSTATUS WINAPI RtlUpcaseUnicodeToMultiByteN( LPSTR dst, DWORD dstlen, LPDWORD reslen,
     
    578577
    579578/**************************************************************************
    580  *  RtlUpcaseUnicodeToOemN   (NTDLL.@)
     579 *      RtlUpcaseUnicodeToOemN   (NTDLL.@)
    581580 */
    582581NTSTATUS WINAPI RtlUpcaseUnicodeToOemN( LPSTR dst, DWORD dstlen, LPDWORD reslen,
     
    596595
    597596/*
    598     STRING SIZE
     597        STRING SIZE
    599598*/
    600599
     
    742741
    743742/*
    744     MISC
     743        MISC
    745744*/
    746745
    747746/**************************************************************************
    748  *  RtlIsTextUnicode
    749  *
    750  *  Apply various feeble heuristics to guess whether
    751  *  the text buffer contains Unicode.
    752  *  FIXME: should implement more tests.
     747 *      RtlIsTextUnicode
     748 *
     749 *      Apply various feeble heuristics to guess whether
     750 *      the text buffer contains Unicode.
     751 *      FIXME: should implement more tests.
    753752 */
    754753DWORD WINAPI RtlIsTextUnicode(
    755     LPVOID buf,
    756     DWORD len,
    757     DWORD *pf)
    758 {
    759     LPWSTR s = buf;
    760     DWORD flags = -1, out_flags = 0;
    761 
    762     if (!len)
    763         goto out;
    764     if (pf)
    765         flags = *pf;
    766     /*
    767     * Apply various tests to the text string. According to the
    768     * docs, each test "passed" sets the corresponding flag in
    769     * the output flags. But some of the tests are mutually
    770     * exclusive, so I don't see how you could pass all tests ...
    771     */
    772 
    773     /* Check for an odd length ... pass if even. */
    774     if (!(len & 1))
    775         out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
    776 
    777     /* Check for the special unicode marker byte. */
    778     if (*s == 0xFEFF)
    779         out_flags |= IS_TEXT_UNICODE_SIGNATURE;
    780 
    781     /*
    782     * Check whether the string passed all of the tests.
    783     */
    784     flags &= ITU_IMPLEMENTED_TESTS;
    785     if ((out_flags & flags) != flags)
    786         len = 0;
     754        LPVOID buf,
     755        DWORD len,
     756        DWORD *pf)
     757{
     758        LPWSTR s = buf;
     759        DWORD flags = -1, out_flags = 0;
     760
     761        if (!len)
     762                goto out;
     763        if (pf)
     764                flags = *pf;
     765        /*
     766        * Apply various tests to the text string. According to the
     767        * docs, each test "passed" sets the corresponding flag in
     768        * the output flags. But some of the tests are mutually
     769        * exclusive, so I don't see how you could pass all tests ...
     770        */
     771
     772        /* Check for an odd length ... pass if even. */
     773        if (!(len & 1))
     774                out_flags |= IS_TEXT_UNICODE_ODD_LENGTH;
     775
     776        /* Check for the special unicode marker byte. */
     777        if (*s == 0xFEFF)
     778                out_flags |= IS_TEXT_UNICODE_SIGNATURE;
     779
     780        /*
     781        * Check whether the string passed all of the tests.
     782        */
     783        flags &= ITU_IMPLEMENTED_TESTS;
     784        if ((out_flags & flags) != flags)
     785                len = 0;
    787786out:
    788     if (pf)
    789         *pf = out_flags;
    790     return len;
    791 }
     787        if (pf)
     788                *pf = out_flags;
     789        return len;
     790}
Note: See TracChangeset for help on using the changeset viewer.