You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src-native/THNETII.WinApi.Headers.WinNls/NLSSTRING_FLAGS.cs
+46-1Lines changed: 46 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,8 +3,11 @@
3
3
namespaceTHNETII.WinApi.Native.WinNls
4
4
{
5
5
[Flags]
6
-
publicenumCSTR_FLAGS:int
6
+
publicenumNLSSTRING_FLAGS:int
7
7
{
8
+
//
9
+
// String Flags.
10
+
//
8
11
/// <summary>
9
12
/// Ignore case. For many scripts (notably Latin scripts), <see cref="NORM_IGNORECASE"/> coincides with <see cref="LINGUISTIC_IGNORECASE"/>.
10
13
/// <para><note><see cref="NORM_IGNORECASE"/> ignores any tertiary distinction, whether it is actually linguistic case or not. For example, in Arabic and Indic scripts, this distinguishes alternate forms of a character, but the differences do not correspond to linguistic case. <see cref="LINGUISTIC_IGNORECASE"/> causes the function to ignore only actual linguistic casing, instead of ignoring the third sorting weight.</note></para>
@@ -37,6 +40,48 @@ public enum CSTR_FLAGS : int
37
40
/// <summary>Use the default linguistic rules for casing, instead of file system rules. Note that most scenarios for <see cref="CompareStringEx"/> use this flag. This flag does not have to be used when your application calls <see cref="CompareStringOrdinal"/>.</summary>
[Obsolete("DEPRECATED: StringApiSetFunction.CompareStringEx is preferred")]
330
330
publicstaticCSTR_RESULTCompareStringA(
331
331
intLocale,
332
-
CSTR_FLAGSdwCmpFlags,
332
+
NLSSTRING_FLAGSdwCmpFlags,
333
333
stringlpString1,
334
334
stringlpString2
335
335
)=>
@@ -351,7 +351,7 @@ string lpString2
351
351
privatestaticexternCSTR_RESULTCompareStringA(
352
352
[In]intLocale,
353
353
[In,MarshalAs(UnmanagedType.I4)]
354
-
CSTR_FLAGSdwCmpFlags,
354
+
NLSSTRING_FLAGSdwCmpFlags,
355
355
[In]stringlpString1,
356
356
[In]intcchCount1,
357
357
[In]stringlpString2,
@@ -362,7 +362,7 @@ [In] int cchCount2
362
362
[Obsolete("DEPRECATED: StringApiSetFunction.CompareStringEx is preferred")]
363
363
publicunsafestaticCSTR_RESULTCompareStringA(
364
364
intLocale,
365
-
CSTR_FLAGSdwCmpFlags,
365
+
NLSSTRING_FLAGSdwCmpFlags,
366
366
ReadOnlySpan<byte>lpString1,
367
367
intcchCount1,
368
368
ReadOnlySpan<byte>lpString2,
@@ -391,7 +391,7 @@ int cchCount2
391
391
publicstaticexternCSTR_RESULTCompareStringA(
392
392
[In]intLocale,
393
393
[In,MarshalAs(UnmanagedType.I4)]
394
-
CSTR_FLAGSdwCmpFlags,
394
+
NLSSTRING_FLAGSdwCmpFlags,
395
395
[In]LPCSTRlpString1,
396
396
[In]intcchCount1,
397
397
[In]LPCSTRlpString2,
@@ -403,7 +403,7 @@ [In] int cchCount2
403
403
/// <inheritdoc cref="CompareString"/>
404
404
publicstaticCSTR_RESULTCompareStringW(
405
405
intLocale,
406
-
CSTR_FLAGSdwCmpFlags,
406
+
NLSSTRING_FLAGSdwCmpFlags,
407
407
stringlpString1,
408
408
stringlpString2
409
409
)=>
@@ -421,7 +421,7 @@ string lpString2
421
421
privatestaticexternCSTR_RESULTCompareStringW(
422
422
[In]intLocale,
423
423
[In,MarshalAs(UnmanagedType.I4)]
424
-
CSTR_FLAGSdwCmpFlags,
424
+
NLSSTRING_FLAGSdwCmpFlags,
425
425
[In]stringlpString1,
426
426
[In]intcchCount1,
427
427
[In]stringlpString2,
@@ -431,7 +431,7 @@ [In] int cchCount2
431
431
/// <inheritdoc cref="CompareString"/>
432
432
publicunsafestaticCSTR_RESULTCompareStringW(
433
433
intLocale,
434
-
CSTR_FLAGSdwCmpFlags,
434
+
NLSSTRING_FLAGSdwCmpFlags,
435
435
ReadOnlySpan<char>lpString1,
436
436
ReadOnlySpan<char>lpString2
437
437
)
@@ -454,7 +454,7 @@ ReadOnlySpan<char> lpString2
454
454
publicstaticexternCSTR_RESULTCompareStringW(
455
455
[In]intLocale,
456
456
[In,MarshalAs(UnmanagedType.I4)]
457
-
CSTR_FLAGSdwCmpFlags,
457
+
NLSSTRING_FLAGSdwCmpFlags,
458
458
[In]LPCWSTRlpString1,
459
459
[In]intcchCount1,
460
460
[In]LPCWSTRlpString2,
@@ -492,7 +492,7 @@ [In] int cchCount2
492
492
/// <remarks>
493
493
/// <para>See Remarks for <see cref="CompareStringEx"/>.</para>
494
494
/// <para>If your application is calling the ANSI version of <see cref="CompareString"/>, the function converts parameters via the default code page of the supplied locale. Thus, an application can never use <see cref="CompareString"/> to handle UTF-8 text.</para>
495
-
/// <para>Normally, for case-insensitive comparisons, <see cref="CompareString"/> maps the lowercase <c>"i"</c> to the uppercase <c>"I"</c>, even when the locale is Turkish or Azerbaijani. The <see cref="CSTR_FLAGS.NORM_LINGUISTIC_CASING"/> flag overrides this behavior for Turkish or Azerbaijani. If this flag is specified in conjunction with Turkish or Azerbaijani, <c>LATIN SMALL LETTER DOTLESS I (U+0131)</c> is the lowercase form of <c>LATIN CAPITAL LETTER I (U+0049)</c> and <c>LATIN SMALL LETTER I (U+0069)</c> is the lowercase form of <c>LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130)</c>.</para>
495
+
/// <para>Normally, for case-insensitive comparisons, <see cref="CompareString"/> maps the lowercase <c>"i"</c> to the uppercase <c>"I"</c>, even when the locale is Turkish or Azerbaijani. The <see cref="NLSSTRING_FLAGS.NORM_LINGUISTIC_CASING"/> flag overrides this behavior for Turkish or Azerbaijani. If this flag is specified in conjunction with Turkish or Azerbaijani, <c>LATIN SMALL LETTER DOTLESS I (U+0131)</c> is the lowercase form of <c>LATIN CAPITAL LETTER I (U+0049)</c> and <c>LATIN SMALL LETTER I (U+0069)</c> is the lowercase form of <c>LATIN CAPITAL LETTER I WITH DOT ABOVE (U+0130)</c>.</para>
/// <exception cref="DllNotFoundException">The native library containg the function could not be found.</exception>
506
506
/// <exception cref="EntryPointNotFoundException">Unable to find the entry point for the function in the native library.</exception>
507
+
/// <seealso cref="CompareStringEx"/>
508
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/handling-sorting-in-your-applications">Handling Sorting in Your Applications</seealso>
509
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/national-language-support">National Language Support</seealso>
510
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/national-language-support-functions">National Language Support Functions</seealso>
511
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/security-considerations--international-features">Security Considerations: International Features</seealso>
512
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/using-unicode-normalization-to-represent-strings">Using Unicode Normalization to Represent Strings</seealso>
507
513
[Obsolete("DEPRECATED: StringApiSetFunction.CompareStringEx is preferred")]
508
514
publicstaticCSTR_RESULTCompareString(
509
515
intLocale,
510
-
CSTR_FLAGSdwCmpFlags,
516
+
NLSSTRING_FLAGSdwCmpFlags,
511
517
stringlpString1,
512
518
stringlpString2
513
519
)=>
@@ -534,7 +540,7 @@ private static
534
540
CSTR_RESULTCompareString(
535
541
[In]intLocale,
536
542
[In,MarshalAs(UnmanagedType.I4)]
537
-
CSTR_FLAGSdwCmpFlags,
543
+
NLSSTRING_FLAGSdwCmpFlags,
538
544
[In]stringlpString1,
539
545
[In]intcchCount1,
540
546
[In]stringlpString2,
@@ -557,7 +563,7 @@ [In] int cchCount2
557
563
[Obsolete("DEPRECATED: StringApiSetFunction.CompareStringEx is preferred")]
558
564
publicunsafestaticCSTR_RESULTCompareString(
559
565
intLocale,
560
-
CSTR_FLAGSdwCmpFlags,
566
+
NLSSTRING_FLAGSdwCmpFlags,
561
567
ReadOnlySpan<byte>lpString1,
562
568
intcchCount1,
563
569
ReadOnlySpan<byte>lpString2,
@@ -591,7 +597,7 @@ public static
591
597
CSTR_RESULTCompareString(
592
598
[In]intLocale,
593
599
[In,MarshalAs(UnmanagedType.I4)]
594
-
CSTR_FLAGSdwCmpFlags,
600
+
NLSSTRING_FLAGSdwCmpFlags,
595
601
[In]LPCTSTRlpString1,
596
602
[In]intcchCount1,
597
603
[In]LPCTSTRlpString2,
@@ -614,7 +620,136 @@ [In] int cchCount2
614
620
#endregion
615
621
// C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um\WinNls.h, line 1626
616
622
#region FindNLSString function
623
+
/// <summary>
624
+
/// Locates a Unicode string (wide characters) or its equivalent in another Unicode string for a locale specified by identifier.
625
+
/// <para><note type="caution">Because strings with very different binary representations can compare as identical, this function can raise certain security concerns. For more information, see the discussion of comparison functions in <a href="https://docs.microsoft.com/windows/desktop/Intl/security-considerations--international-features">Security Considerations: International Features</a>.</note></para>
626
+
/// <para><note>For interoperability reasons, the application should prefer the <see cref="FindNLSStringEx"/> function because Microsoft is migrating toward the use of locale names instead of locale identifiers for new locales. Although <see cref="FindNLSString"/> supports custom locales, most applications should use <see cref="FindNLSStringEx"/> for this type of support.</note></para>
627
+
/// </summary>
628
+
/// <param name="Locale">
629
+
/// <a href="https://docs.microsoft.com/windows/desktop/Intl/locale-identifiers">Locale identifier</a> that specifies the locale. You can use the <see cref="MAKELCID"/> macro to create an identifier or use one of the following predefined values.
/// <param name="dwFindNLSStringFlags">Flags specifying details of the find operation. For detailed definitions, see the <em>dwFindNLSStringFlags</em> parameter of <see cref="FindNLSStringEx"/>.</param>
643
+
/// <param name="lpStringSource">
644
+
/// The source string, in which the function searches for the string specified by <paramref name="lpStringValue"/>.
645
+
/// <para>The application cannot specify <c>0</c> (zero) or any negative number other than <c>-1</c> for the parameter specifying the length of the string (if any). The application specifies <c>-1</c> for the length if the source string is null-terminated and the function should calculate the size automatically.</para>
646
+
/// </param>
647
+
/// <param name="lpStringValue">
648
+
/// The search string, for which the function searches in the source string.
649
+
/// <para>The application cannot specify <c>0</c> (zero) or any negative number other than <c>-1</c> for the parameter specifying the length of the string (if any). The application specifies <c>-1</c> for the length if the source string is null-terminated and the function should calculate the size automatically.</para>
650
+
/// </param>
651
+
/// <param name="pcchFound">Receives the length of the string that the function finds. For details, see the <em>pcchFound</em> parameter of <see cref="FindNLSStringEx"/>.</param>
652
+
/// <returns>
653
+
/// <para>Returns a 0-based index into the source string indicated by <paramref name="lpStringSource"/> if successful. In combination with the value in <paramref name="pcchFound"/>, this index provides the exact location of the entire found string in the source string. A return value of <c>0</c> (zero) is an error-free index into the source string, and the matching string is in the source string at offset <c>0</c>.</para>
654
+
/// <para>
655
+
/// The function returns <c>-1</c> if it does not succeed. To get extended error information, the application can call <see cref="Marshal.GetLastWin32Error"/>, which can return one of the following error codes:
/// <exception cref="DllNotFoundException">The native library containg the function could not be found.</exception>
676
+
/// <exception cref="EntryPointNotFoundException">Unable to find the entry point for the function in the native library.</exception>
677
+
/// <seealso cref="CompareString"/>
678
+
/// <seealso cref="FindNLSStringEx"/>
679
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/handling-sorting-in-your-applications">Handling Sorting in Your Applications</seealso>
680
+
/// <seealso cref="LCMapString"/>
681
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/national-language-support">National Language Support</seealso>
682
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/national-language-support-functions">National Language Support Functions</seealso>
683
+
/// <seealso href="https://docs.microsoft.com/windows/desktop/Intl/security-considerations--international-features">Security Considerations: International Features</seealso>
684
+
[Obsolete("DEPRECATED: FindNLSStringEx is preferred")]
685
+
publicstaticintFindNLSString(
686
+
intLocale,
687
+
NLSSTRING_FLAGSdwFindNLSStringFlags,
688
+
stringlpStringSource,
689
+
stringlpStringValue,
690
+
outintpcchFound
691
+
)=>
692
+
FindNLSString(
693
+
Locale,
694
+
dwFindNLSStringFlags,
695
+
lpStringSource,
696
+
lpStringSource?.Length??0,
697
+
lpStringValue,
698
+
lpStringValue?.Length??0,
699
+
outpcchFound
700
+
);
701
+
702
+
[Obsolete("DEPRECATED: FindNLSStringEx is preferred")]
0 commit comments