ReactOS 0.4.16-dev-853-g88d9285
CompareStringW.cpp
Go to the documentation of this file.
1/***
2*w_cmp.c - W versions of CompareString.
3*
4* Copyright (c) Microsoft Corporation. All rights reserved.
5*
6*Purpose:
7* Wrapper for CompareStringW.
8*
9*******************************************************************************/
10#include <corecrt_internal.h>
11
12/***
13*int __cdecl __acrt_CompareStringW - Get type information about a wide string.
14*
15*Purpose:
16* Internal support function. Assumes info in wide string format.
17*
18*Entry:
19* LPCWSTR LocaleName - locale context for the comparison.
20* DWORD dwCmpFlags - see NT\Chicago docs
21* LPCWSTR lpStringn - wide string to be compared
22* int cchCountn - wide char (word) count (NOT including nullptr)
23* (-1 if nullptr terminated)
24*
25*Exit:
26* Success: 1 - if lpString1 < lpString2
27* 2 - if lpString1 == lpString2
28* 3 - if lpString1 > lpString2
29* Failure: 0
30*
31*Exceptions:
32*
33*******************************************************************************/
34
37 DWORD dwCmpFlags,
38 PCWCH lpString1,
39 int cchCount1,
40 PCWCH lpString2,
41 int cchCount2
42 )
43{
44 /*
45 * CompareString will compare past nullptr. Must find nullptr if in string
46 * before cchCountn wide characters.
47 */
48
49 if (cchCount1 > 0)
50 cchCount1= (int) wcsnlen(lpString1, cchCount1);
51 if (cchCount2 > 0)
52 cchCount2= (int) wcsnlen(lpString2, cchCount2);
53
54 if (!cchCount1 || !cchCount2)
55 return (cchCount1 - cchCount2 == 0) ? 2 :
56 (cchCount1 - cchCount2 < 0) ? 1 : 3;
57
59 dwCmpFlags,
60 lpString1,
61 cchCount1,
62 lpString2,
63 cchCount2,
64 nullptr,
65 nullptr,
66 0);
67}
int __cdecl __acrt_CompareStringW(LPCWSTR LocaleName, DWORD dwCmpFlags, PCWCH lpString1, int cchCount1, PCWCH lpString2, int cchCount2)
static _In_ LPCWSTR LocaleName
#define __cdecl
Definition: accygwin.h:79
int WINAPI __acrt_CompareStringEx(_In_opt_ LPCWSTR locale_name, _In_ DWORD flags, _In_NLS_string_(string1_count) LPCWCH string1, _In_ int string1_count, _In_NLS_string_(string2_count) LPCWCH string2, _In_ int string2_count, _Reserved_ LPNLSVERSIONINFO version, _Reserved_ LPVOID reserved, _Reserved_ LPARAM param)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
CONST WCHAR * PCWCH
Definition: ntbasedef.h:419
size_t __cdecl wcsnlen(wchar_t const *const string, size_t const maximum_count)
Definition: strnlen.cpp:210
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185