using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using Vanara.Extensions; using Vanara.InteropServices; namespace Vanara.PInvoke { public static partial class Kernel32 { /// Enumerate all calendars. public const CALID ENUM_ALL_CALENDARS = (CALID)0xffffffff; /// Indicates that no geographical location identifier has been set for the user. public const int GEOID_NOT_AVAILABLE = -1; /// public const ushort LANG_INVARIANT = 0x7f; /// public const ushort LANG_NEUTRAL = 0; /// Name of an invariant locale that provides stable locale and calendar data. public const string LOCALE_NAME_INVARIANT = ""; /// /// Maximum length of a locale name. The maximum number of characters allowed for this string is 85, including a terminating null character. /// public const int LOCALE_NAME_MAX_LENGTH = 85; /// Name of the current operating system locale. public const string LOCALE_NAME_SYSTEM_DEFAULT = "!x-sys-default-locale"; /// /// Name of the current user locale, matching the preference set in the regional and language options portion of Control Panel. This /// locale can be different from the locale for the current user interface language. /// public const string LOCALE_NAME_USER_DEFAULT = null; /// public const ushort SORT_DEFAULT = 0; /// public const ushort SUBLANG_CUSTOM_DEFAULT = 0x03; /// public const ushort SUBLANG_CUSTOM_UNSPECIFIED = 0x04; /// public const ushort SUBLANG_DEFAULT = 0x01; /// public const ushort SUBLANG_NEUTRAL = 0; /// public const ushort SUBLANG_SYS_DEFAULT = 0x02; /// public const ushort SUBLANG_UI_CUSTOM_DEFAULT = 0x05; /// public static readonly ushort LANG_SYSTEM_DEFAULT = MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT); /// public static readonly ushort LANG_USER_DEFAULT = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); /// public static readonly LCID LOCALE_CUSTOM_DEFAULT = MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT); /// public static readonly LCID LOCALE_CUSTOM_UI_DEFAULT = MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT); /// public static readonly LCID LOCALE_CUSTOM_UNSPECIFIED = MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT); /// public static readonly LCID LOCALE_INVARIANT = MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT); /// public static readonly LCID LOCALE_NEUTRAL = MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT); /// public static readonly LCID LOCALE_SYSTEM_DEFAULT = MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT); /// public static readonly LCID LOCALE_USER_DEFAULT = MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT); /// /// An application-defined callback function that processes enumerated calendar information provided by the EnumCalendarInfo /// function. The CALINFO_ENUMPROC type defines a pointer to this callback function. EnumCalendarInfoProc is a placeholder for /// the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated calendar information string. This string is formatted according to the calendar /// type passed to EnumCalendarInfo. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumCalendarInfoProc( _In_ LPTSTR lpCalendarInfoString); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317806(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317806")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumCalendarInfoProc(string lpCalendarInfoString); /// /// An application-defined callback function that processes enumerated calendar information provided by the EnumCalendarInfoEx /// function. The CALINFO_ENUMPROCEX type defines a pointer to this callback function. EnumCalendarInfoProcEx is a placeholder /// for the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated calendar information string. This string is formatted according to the calendar /// type passed to EnumCalendarInfoEx. /// /// Calendar identifier that specifies the calendar associated with the supplied information. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumCalendarInfoProcEx( _In_ LPTSTR lpCalendarInfoString, _In_ CALID Calendar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317807(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317807")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumCalendarInfoProcEx(string lpCalendarInfoString, CALID Calendar); /// /// An application-defined callback function that processes enumerated calendar information provided by the /// EnumCalendarInfoExEx function. The CALINFO_ENUMPROCEXEX type defines a pointer to this callback function. /// EnumCalendarInfoProcExEx is a placeholder for the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated calendar information string. This string is formatted according to the calendar /// type passed to EnumCalendarInfoExEx. /// /// Calendar identifier that specifies the calendar associated with the specified information. /// Reserved; must be NULL. /// /// An application-provided input parameter of EnumCalendarInfoExEx. This value is especially useful for multi-threaded /// applications, since it can be used to pass thread-specific data to this callback function. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumCalendarInfoProcExEx( _In_ LPWSTR lpCalendarInfoString, _In_ CALID Calendar, _In_ LPWSTR lpReserved, _In_ LPARAM // lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317808(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317808")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumCalendarInfoProcExEx(string lpCalendarInfoString, CALID Calendar, string lpReserved, IntPtr lParam); /// /// An application-defined callback function that processes enumerated code page information provided by the /// EnumSystemCodePages function. The CODEPAGE_ENUMPROC type defines a pointer to this callback function. /// EnumCodePagesProc is a placeholder for the application-defined function name. /// /// Pointer to a buffer containing a null-terminated code page identifier string. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumCodePagesProc( _In_ LPTSTR lpCodePageString); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317809(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317809")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumCodePagesProc(string lpCodePageString); /// /// An application-defined callback function that processes date format information provided by the EnumDateFormats function. /// The DATEFMT_ENUMPROC type defines a pointer to this callback function. EnumDateFormatsProc is a placeholder for the /// application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated date format string. This string is a long or short date format, depending on the /// value of the dwFlags parameter of EnumDateFormats. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumDateFormatsProc( _In_ LPTSTR lpDateFormatString); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317813(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317813")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumDateFormatsProc(string lpDateFormatString); /// /// An application-defined callback function that processes enumerated date format information provided by the /// EnumDateFormatsEx function. The DATEFMT_ENUMPROCEX type defines a pointer to this callback function. /// EnumDateFormatsProcEx is a placeholder for the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated date format string. This string is a long or short date format, depending on the /// value of the dwFlags parameter of EnumDateFormatsEx. /// /// Calendar identifier associated with the date format string. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumDateFormatsProcEx( _In_ LPTSTR lpDateFormatString, _In_ CALID CalendarID); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317814(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317814")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumDateFormatsProcEx(string lpDateFormatString, CALID CalendarID); /// /// An application-defined function that processes enumerated date format information provided by the EnumDateFormatsExEx /// function. The DATEFMT_ENUMPROCEXEX type defines a pointer to this callback function. EnumDateFormatsProcExEx is a /// placeholder for the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated date format string. This string is a long or short date format, depending on the /// value of the dwFlags parameter passed to EnumDateFormatsExEx. /// /// Calendar identifier associated with the specified date format string. /// /// An application-provided input parameter of EnumDateFormatsExEx. This parameter is especially useful for multi-threaded /// applications, since it can be used to pass thread-specific data to this callback function. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumDateFormatsProcExEx( _In_ LPWSTR lpDateFormatString, _In_ CALID CalendarID, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317815(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317815")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumDateFormatsProcExEx(string lpDateFormatString, CALID CalendarID, IntPtr lParam); /// /// An application-defined callback function that processes enumerated geographical location information provided by the /// EnumSystemGeoID function. The GEO_ENUMPROC type defines a pointer to this callback function. EnumGeoInfoProc is a /// placeholder for the application-defined function name. /// /// Identifier of the geographical location to check. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumGeoInfoProc( _In_ GEOID GeoId); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317817(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi)] [PInvokeData("Winnls.h", MSDNShortId = "dd317817")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumGeoInfoProc(int GeoId); /// /// An application-defined callback function that processes enumerated language group locale information provided by the /// EnumLanguageGroupLocales function. The LANGGROUPLOCALE_ENUMPROC type defines a pointer to this callback function. /// EnumLanguageGroupLocalesProc is a placeholder for the application-defined function name. /// /// Identifier of the language group. This parameter can have one of the following values: /// /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// Pointer to a buffer containing a null-terminated locale identifier string. /// /// Application-defined value passed to the EnumLanguageGroupLocales function. This parameter can be used for error checking. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumLanguageGroupLocalesProc( _In_ LGRPID LanguageGroup, _In_ LCID Locale, _In_ LPTSTR lpLocaleString, _In_ LONG_PTR // lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317820(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317820")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumLanguageGroupLocalesProc(LGRPID LanguageGroup, LCID Locale, string lpLocaleString, IntPtr lParam); /// /// An application-defined callback function that processes enumerated language group information provided by the /// EnumSystemLanguageGroups function. The LANGUAGEGROUP_ENUMPROC type defines a pointer to this callback function. /// EnumLanguageGroupsProc is a placeholder for the application-defined function name. /// /// Language group identifier. This parameter can have one of the following values: /// Pointer to a buffer containing a null-terminated language group identifier string. /// Pointer to a buffer containing a null-terminated language group name string. /// /// /// Flag specifying whether the language group identifier is supported or installed. This parameter can have one of the following values. /// /// /// /// /// Value /// Meaning /// /// /// /// /// /// /// LGRPID_INSTALLED = 1 /// Language group identifier is installed. /// /// /// LGRPID_SUPPORTED = 2 /// Language group identifier is both supported and installed. /// /// /// /// /// Application-defined parameter. This parameter can be used for error checking. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumLanguageGroupsProc( _In_ LGRPID LanguageGroup, _In_ LPTSTR lpLanguageGroupString, _In_ LPTSTR // lpLanguageGroupNameString, _In_ DWORD dwFlags, _In_ LONG_PTR lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317821(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317821")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumLanguageGroupsProc(LGRPID LanguageGroup, string lpLanguageGroupString, string lpLanguageGroupNameString, LGRPID_FLAGS dwFlags, IntPtr lParam); /// /// An application-defined callback function that processes enumerated locale information provided by the EnumSystemLocales /// function. The LOCALE_ENUMPROC type defines a pointer to this callback function. EnumLocalesProc is a placeholder for the /// application-defined function name. /// /// Pointer to a buffer containing a null-terminated locale identifier string. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumLocalesProc( _In_ LPTSTR lpLocaleString); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317822(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317822")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumLocalesProc(string lpLocaleString); /// /// An application-defined callback function that processes enumerated locale information provided by the EnumSystemLocalesEx /// function. The LOCALE_ENUMPROCEX type defines a pointer to this callback function. EnumLocalesProcEx is a placeholder for /// the application-defined function name. /// /// Pointer to a buffer containing a null-terminated locale name string. /// /// Flags defining locale information. Values for this parameter can include a binary OR of flags, but some flag combinations never /// occur. If the application specifies LOCALE_WINDOWS or LOCALE_ALTERNATE_SORTS, it can also specify LOCALE_REPLACEMENT so that the /// EnumSystemLocalesEx function can test to see if the locale is a replacement. /// /// /// An application-provided input parameter of EnumSystemLocalesEx. This value is especially useful for multi-threaded /// applications, since it can be used to pass thread-specific data to this callback function. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumLocalesProcEx( _In_ LPWSTR lpLocaleString, _In_ DWORD dwFlags, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317823(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317823")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumLocalesProcEx(string lpLocaleString, LOCALE_FLAGS dwFlags, IntPtr lParam); /// /// An application-defined callback function that processes enumerated time format information provided by the EnumTimeFormats /// function. The TIMEFMT_ENUMPROC type defines a pointer to this callback function. EnumTimeFormatsProc is a placeholder for /// the application-defined function name. /// /// Pointer to a buffer containing a null-terminated time format string. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumTimeFormatsProc( _In_ LPTSTR lpTimeFormatString); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317832(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317832")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumTimeFormatsProc(string lpTimeFormatString); /// /// An application-defined callback function that processes enumerated time format information provided by the /// EnumTimeFormatsEx function. The TIMEFMT_ENUMPROCEX type defines a pointer to this callback function. /// EnumTimeFormatsProcEx is a placeholder for the application-defined function name. /// /// Pointer to a buffer containing a null-terminated time format string. /// /// An application-provided input parameter of EnumTimeFormatsEx. This value is especially useful for multi-threaded /// applications, since it can be used to pass thread-specific data to this callback function. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumTimeFormatsProcEx( _In_ LPWSTR lpTimeFormatString, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317833(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317833")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumTimeFormatsProcEx(string lpTimeFormatString, IntPtr lParam); /// /// An application-defined callback function that processes enumerated user interface language information provided by the /// EnumUILanguages function. The UILANGUAGE_ENUMPROC type defines a pointer to this callback function. /// EnumUILanguagesProc is a placeholder for the application-defined function name. /// /// /// Pointer to a buffer containing a null-terminated string representing a user interface language identifier or language name, /// depending on the value for the dwFlags parameter passed in the call to EnumUILanguages. /// /// Application-defined value. /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK EnumUILanguagesProc( _In_ LPTSTR lpUILanguageString, _In_ LONG_PTR lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317835(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317835")] [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Auto)] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool EnumUILanguagesProc(string lpUILanguageString, IntPtr lParam); /// /// An application-defined callback function that processes enumerated geographical location information provided by the /// EnumSystemGeoNames function. The GEO_ENUMNAMEPROC type defines a pointer to this callback function. /// Geo_EnumNameProc is a placeholder for the application-defined function name. /// /// /// A two-letter International Organization for Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 /// (M.49) code for a geographical location that is available on the operating system. /// /// /// Application-specific information that was specified by the data parameter when the application called the /// EnumSystemGeoNames function. /// /// Returns TRUE to continue enumeration or FALSE otherwise. // BOOL CALLBACK Geo_EnumNameProc( _In_ PWSTR GeoName, LPARAM data); https://msdn.microsoft.com/en-us/library/windows/desktop/mt826488(v=vs.85).aspx [UnmanagedFunctionPointer(CallingConvention.Winapi, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "mt826488")] [return: MarshalAs(UnmanagedType.Bool)] public delegate bool Geo_EnumNameProc(string GeoName, IntPtr data); private delegate bool GetLangFunc(TEnum dwFlags, out uint pulNumLanguages, IntPtr pwszLanguagesBuffer, ref uint pcchLanguagesBuffer) where TEnum : Enum; /// /// Deprecated. Specifies the date units for adjusting the CALDATETIME structure. /// // https://docs.microsoft.com/en-us/windows/desktop/intl/caldatetime-dateunit enum CALDATETIME_DATEUNIT { EraUnit, YearUnit, // MonthUnit, WeekUnit, DayUnit, HourUnit, MinuteUnit, SecondUnit, TickUnit }; [PInvokeData("", MSDNShortId = "20d0cd7a-6e6b-4c82-9cfa-e4f4315d6362")] public enum CALDATETIME_DATEUNIT { /// The era date time unit. EraUnit, /// The year date time unit. YearUnit, /// The month date time unit. MonthUnit, /// The week date time unit. WeekUnit, /// The day date time unit. DayUnit, /// The hour date time unit. HourUnit, /// The minute date time unit. MinuteUnit, /// SecondUnit, /// TickUnit } /// /// The calendar identifiers (data type CALID) that are used to specify different calendars. Your applications can use these /// identifiers when using the following NLS functions and callback functions, which have parameters that take the CALID data type. /// [PInvokeData("", MSDNShortId = "ba2e841e-e24e-476a-851e-a29b3af4f04d")] public enum CALID : uint { /// Gregorian (localized) CAL_GREGORIAN = 1, /// Gregorian (English strings always) CAL_GREGORIAN_US = 2, /// Japanese Emperor Era CAL_JAPAN = 3, /// Taiwan calendar CAL_TAIWAN = 4, /// Korean Tangun Era CAL_KOREA = 5, /// Hijri (Arabic Lunar) CAL_HIJRI = 6, /// Thai CAL_THAI = 7, /// Hebrew (Lunar) CAL_HEBREW = 8, /// Gregorian Middle East French CAL_GREGORIAN_ME_FRENCH = 9, /// Gregorian Arabic CAL_GREGORIAN_ARABIC = 10, /// Gregorian transliterated English CAL_GREGORIAN_XLIT_ENGLISH = 11, /// Gregorian transliterated French CAL_GREGORIAN_XLIT_FRENCH = 12, /// Windows Vista and later: Persian CAL_PERSIAN = 22, /// Windows Vista and later: Um Al Qura (Arabic lunar) calendar CAL_UMALQURA = 23, } /// Type of calendar information to retrieve. [Flags] public enum CALTYPE : uint { /// Windows Me/98, Windows 2000: Use the system default instead of the user's choice. CAL_NOUSEROVERRIDE = LCTYPE.LOCALE_NOUSEROVERRIDE, /// /// Windows Me/98, Windows 2000: Use the system ANSI code page (ACP) instead of the locale code page for string translation. This /// is only relevant for ANSI versions of functions, for example, EnumCalendarInfoA. /// CAL_USE_CP_ACP = LCTYPE.LOCALE_USE_CP_ACP, /// /// Windows Me/98, Windows 2000: Retrieve the result from GetCalendarInfo as a number instead of a string. This is only valid for /// values beginning with CAL_I. /// CAL_RETURN_NUMBER = LCTYPE.LOCALE_RETURN_NUMBER, /// /// Windows 7 and later: Retrieve the result from GetCalendarInfo in the form of genitive names of months, which are the names /// used when the month names are combined with other items. For example, in Ukrainian the equivalent of January is written /// "Січень" when the month is named alone. However, when the month name is used in combination, for example, in a date such as /// January 5th, 2003, the genitive form of the name is used. For the Ukrainian example, the genitive month name is displayed as /// "5 січня 2003". For more information, see LOCALE_RETURN_GENITIVE_NAMES. /// CAL_RETURN_GENITIVE_NAMES = LCTYPE.LOCALE_RETURN_GENITIVE_NAMES, /// An integer value indicating the calendar type of the alternate calendar. CAL_ICALINTVALUE = 0x00000001, /// Native name of the alternate calendar. CAL_SCALNAME = 0x00000002, /// /// One or more null-terminated strings that specify the year offsets for each of the era ranges. The last string has an extra /// terminating null character. This value varies in format depending on the type of optional calendar. /// CAL_IYEAROFFSETRANGE = 0x00000003, /// /// One or more null-terminated strings that specify each of the Unicode code points specifying the era associated with /// CAL_IYEAROFFSETRANGE. The last string has an extra terminating null character. This value varies in format depending on the /// type of optional calendar. /// CAL_SERASTRING = 0x00000004, /// Short date formats for the calendar type. CAL_SSHORTDATE = 0x00000005, /// Long date formats for the calendar type. CAL_SLONGDATE = 0x00000006, /// Native name of the first day of the week. CAL_SDAYNAME1 = 0x00000007, /// Native name of the second day of the week. CAL_SDAYNAME2 = 0x00000008, /// Native name of the third day of the week. CAL_SDAYNAME3 = 0x00000009, /// Native name of the fourth day of the week. CAL_SDAYNAME4 = 0x0000000a, /// Native name of the fifth day of the week. CAL_SDAYNAME5 = 0x0000000b, /// Native name of the sixth day of the week. CAL_SDAYNAME6 = 0x0000000c, /// Native name of the seventh day of the week. CAL_SDAYNAME7 = 0x0000000d, /// Abbreviated native name of the first day of the week. CAL_SABBREVDAYNAME1 = 0x0000000e, /// Abbreviated native name of the second day of the week. CAL_SABBREVDAYNAME2 = 0x0000000f, /// Abbreviated native name of the third day of the week. CAL_SABBREVDAYNAME3 = 0x00000010, /// Abbreviated native name of the fourth day of the week. CAL_SABBREVDAYNAME4 = 0x00000011, /// Abbreviated native name of the fifth day of the week. CAL_SABBREVDAYNAME5 = 0x00000012, /// Abbreviated native name of the sixth day of the week. CAL_SABBREVDAYNAME6 = 0x00000013, /// Abbreviated native name of the seventh day of the week. CAL_SABBREVDAYNAME7 = 0x00000014, /// Native name of the first month of the year. CAL_SMONTHNAME1 = 0x00000015, /// Native name of the second month of the year. CAL_SMONTHNAME2 = 0x00000016, /// Native name of the third month of the year. CAL_SMONTHNAME3 = 0x00000017, /// Native name of the fourth month of the year. CAL_SMONTHNAME4 = 0x00000018, /// Native name of the fifth month of the year. CAL_SMONTHNAME5 = 0x00000019, /// Native name of the sixth month of the year. CAL_SMONTHNAME6 = 0x0000001a, /// Native name of the seventh month of the year. CAL_SMONTHNAME7 = 0x0000001b, /// Native name of the eighth month of the year. CAL_SMONTHNAME8 = 0x0000001c, /// Native name of the ninth month of the year. CAL_SMONTHNAME9 = 0x0000001d, /// Native name of the tenth month of the year. CAL_SMONTHNAME10 = 0x0000001e, /// Native name of the eleventh month of the year. CAL_SMONTHNAME11 = 0x0000001f, /// Native name of the twelfth month of the year. CAL_SMONTHNAME12 = 0x00000020, /// Native name of the thirteenth month of the year, if it exists. CAL_SMONTHNAME13 = 0x00000021, /// Abbreviated native name of the first month of the year. CAL_SABBREVMONTHNAME1 = 0x00000022, /// Abbreviated native name of the second month of the year. CAL_SABBREVMONTHNAME2 = 0x00000023, /// Abbreviated native name of the third month of the year. CAL_SABBREVMONTHNAME3 = 0x00000024, /// Abbreviated native name of the fourth month of the year. CAL_SABBREVMONTHNAME4 = 0x00000025, /// Abbreviated native name of the fifth month of the year. CAL_SABBREVMONTHNAME5 = 0x00000026, /// Abbreviated native name of the sixth month of the year. CAL_SABBREVMONTHNAME6 = 0x00000027, /// Abbreviated native name of the seventh month of the year. CAL_SABBREVMONTHNAME7 = 0x00000028, /// Abbreviated native name of the eighth month of the year. CAL_SABBREVMONTHNAME8 = 0x00000029, /// Abbreviated native name of the ninth month of the year. CAL_SABBREVMONTHNAME9 = 0x0000002a, /// Abbreviated native name of the tenth month of the year. CAL_SABBREVMONTHNAME10 = 0x0000002b, /// Abbreviated native name of the eleventh month of the year. CAL_SABBREVMONTHNAME11 = 0x0000002c, /// Abbreviated native name of the twelfth month of the year. CAL_SABBREVMONTHNAME12 = 0x0000002d, /// Abbreviated native name of the thirteenth month of the year, if it exists. CAL_SABBREVMONTHNAME13 = 0x0000002e, /// Windows Me/98, Windows 2000: The year/month formats for the specified calendars. CAL_SYEARMONTH = 0x0000002f, /// Windows Me/98, Windows 2000: An integer value indicating the upper boundary of the two-digit year range. CAL_ITWODIGITYEARMAX = 0x00000030, /// CAL_SSHORTESTDAYNAME1 = 0x00000031, /// CAL_SSHORTESTDAYNAME2 = 0x00000032, /// CAL_SSHORTESTDAYNAME3 = 0x00000033, /// CAL_SSHORTESTDAYNAME4 = 0x00000034, /// CAL_SSHORTESTDAYNAME5 = 0x00000035, /// CAL_SSHORTESTDAYNAME6 = 0x00000036, /// CAL_SSHORTESTDAYNAME7 = 0x00000037, /// /// Windows 7 and later: Format of the month and day for the calendar type. The formatting is similar to that for CAL_SLONGDATE. /// For example, if the Month/Day pattern is the full month name followed by the day number with leading zeros, for example, /// "September 03", the format is "MMMM dd". Single quotation marks can be used to insert non-format characters, for example, /// 'de' in Spanish. /// CAL_SMONTHDAY = 0x00000038, /// Windows 7 and later: Abbreviated native name of an era. The full era is represented by the CAL_SERASTRING constant. CAL_SABBREVERASTRING = 0x00000039, /// CAL_SRELATIVELONGDATE = 0x0000003a, /// CAL_SENGLISHERANAME = 0x0000003b, /// CAL_SENGLISHABBREVERANAME = 0x0000003c, } /// Flags specifying the character type information to retrieve. [PInvokeData("Winnls.h")] public enum CHAR_TYPE_INFO { /// Retrieve character type information. [CorrespondingType(typeof(Ctype1))] CT_CTYPE1 = 1, /// Retrieve bidirectional layout information. [CorrespondingType(typeof(Ctype2))] CT_CTYPE2 = 2, /// Retrieve text processing information. [CorrespondingType(typeof(Ctype3))] CT_CTYPE3 = 4, } /// Flag specifying the code pages to enumerate. public enum CP_FLAGS { /// Enumerate only installed code pages. CP_INSTALLED = 1, /// Enumerate all supported code pages. CP_SUPPORTED = 2 } /// /// These types support ANSI C and POSIX (LC_CTYPE) character typing functions. A bitwise-OR of these values is retrieved in the /// array in the output buffer when dwInfoType is set to CT_CTYPE1. For DBCS locales, the type attributes apply to both narrow /// characters and wide characters. The Japanese hiragana and katakana characters, and the kanji ideograph characters all have the /// C1_ALPHA attribute. /// [PInvokeData("Winnls.h")] [Flags] public enum Ctype1 : ushort { /// Uppercase C1_UPPER = 0x0001, /// Lowercase C1_LOWER = 0x0002, /// Decimal digits C1_DIGIT = 0x0004, /// Space characters C1_SPACE = 0x0008, /// Punctuation C1_PUNCT = 0x0010, /// Control characters C1_CNTRL = 0x0020, /// Blank characters C1_BLANK = 0x0040, /// Hexadecimal digits C1_XDIGIT = 0x0080, /// Any linguistic character: alphabetical, syllabary, or ideographic C1_ALPHA = 0x0100, /// A defined character, but not one of the other C1_* types C1_DEFINED = 0x0200, } /// /// These types support proper layout of Unicode text. For DBCS locales, the character type applies to both narrow and wide /// characters. The direction attributes are assigned so that the bidirectional layout algorithm standardized by Unicode produces /// accurate results. These types are mutually exclusive. /// [PInvokeData("Winnls.h")] public enum Ctype2 : ushort { /// No implicit directionality (for example, control codes) C2_NOTAPPLICABLE = 0x0000, /// Left to right C2_LEFTTORIGHT = 0x0001, /// Right to left C2_RIGHTTOLEFT = 0x0002, /// European number, European digit C2_EUROPENUMBER = 0x0003, /// European numeric separator C2_EUROPESEPARATOR = 0x0004, /// European numeric terminator C2_EUROPETERMINATOR = 0x0005, /// Arabic number C2_ARABICNUMBER = 0x0006, /// Common numeric separator C2_COMMONSEPARATOR = 0x0007, /// Block separator C2_BLOCKSEPARATOR = 0x0008, /// Segment separator C2_SEGMENTSEPARATOR = 0x0009, /// White space C2_WHITESPACE = 0x000A, /// Other neutrals C2_OTHERNEUTRAL = 0x000B, } /// /// These types are intended to be placeholders for extensions to the POSIX types required for general text processing or for the /// standard C library functions. A bitwise-OR of these values is retrieved when dwInfoType is set to CT_CTYPE3. For DBCS locales, /// the Ctype 3 attributes apply to both narrow characters and wide characters. The Japanese hiragana and katakana characters, and /// the kanji ideograph characters all have the C3_ALPHA attribute. /// [PInvokeData("Winnls.h")] [Flags] public enum Ctype3 : ushort { /// Not applicable C3_NOTAPPLICABLE = 0x0000, /// Nonspacing mark C3_NONSPACING = 0x0001, /// Diacritic nonspacing mark C3_DIACRITIC = 0x0002, /// Vowel nonspacing mark C3_VOWELMARK = 0x0004, /// Symbol C3_SYMBOL = 0x0008, /// Katakana character C3_KATAKANA = 0x0010, /// Hiragana character C3_HIRAGANA = 0x0020, /// Half-width (narrow) character C3_HALFWIDTH = 0x0040, /// Full-width (wide) character C3_FULLWIDTH = 0x0080, /// Ideographic character C3_IDEOGRAPH = 0x0100, /// Arabic kashida character C3_KASHIDA = 0x0200, /// /// Punctuation which is counted as part of the word (kashida, hyphen, feminine/masculine ordinal indicators, equal sign, and so forth) /// C3_LEXICAL = 0x0400, /// Windows Vista: High surrogate code unit C3_HIGHSURROGATE = 0x0800, /// Windows Vista: Low surrogate code unit C3_LOWSURROGATE = 0x1000, /// All linguistic characters (alphabetical, syllabary, and ideographic) C3_ALPHA = 0x8000, } /// Flag specifying date formats. [Flags] public enum DATE_FORMAT { /// Use short date formats. This value cannot be used with any of the other flag values. DATE_SHORTDATE = 0x00000001, /// Use long date formats. This value cannot be used with any of the other flag values. DATE_LONGDATE = 0x00000002, /// /// Use the alternate calendar, if one exists, to format the date string. If this flag is set, the function uses the default /// format for that alternate calendar, rather than using any user overrides. The user overrides will be used only in the event /// that there is no default format for the specified alternate calendar. /// DATE_USE_ALT_CALENDAR = 0x00000004, /// Use year/month formats. This value cannot be used with any of the other flag values. DATE_YEARMONTH = 0x00000008, /// Add marks for left-to-right reading layout. This value cannot be used with DATE_RTLREADING. DATE_LTRREADING = 0x00000010, /// Add marks for right-to-left reading layout. This value cannot be used with DATE_LTRREADING DATE_RTLREADING = 0x00000020, /// /// Windows 7 and later: Detect the need for right-to-left and left-to-right reading layout using the locale and calendar /// information, and add marks accordingly. This value cannot be used with DATE_LTRREADING or DATE_RTLREADING. DATE_AUTOLAYOUT is /// preferred over DATE_LTRREADING and DATE_RTLREADING because it uses the locales and calendars to determine the correct /// addition of marks. /// DATE_AUTOLAYOUT = 0x00000040, /// Use month/day formats. This value cannot be used with any of the other flag values. DATE_MONTHDAY = 0x00000080, } /// Flags specifying options for script retrieval. public enum GetStringScriptsFlag { /// /// Ignores any inherited or common characters in the input string indicated by lpString. Neither "Qaii" nor "Zyyy" appears in /// the script string, even if the input string contains such characters. /// GSS_IGNORE_INHERITED_COMMON = 0x0000, /// /// Retrieve "Qaii" (INHERITED) and "Zyyy" (COMMON) script information. This flag does not affect the processing of unassigned /// characters. These characters in the input string always cause a "Zzzz" (UNASSIGNED script) to appear in the script string. /// GSS_ALLOW_INHERITED_COMMON = 0x0001, } /// Flags specifying conversion options. [Flags] public enum IDN_FLAGS { /// /// Allow unassigned code points to be included in the input string. The default is to not allow unassigned code points, and fail /// with an extended error code of ERROR_INVALID_NAME.This flag allows the function to process characters that are not currently /// legal in IDNs, but might be legal in later versions of the IDNA standard. If your application encodes unassigned code points /// as Punycode, the resulting domain names should be illegal. Security can be compromised if a later version of IDNA makes these /// names legal or if an application filters out the illegal characters to try to create a legal domain name. For more /// information, see Handling Internationalized Domain Names (IDNs). /// IDN_ALLOW_UNASSIGNED = 0x01, /// /// Filter out ASCII characters that are not allowed in STD3 names. The only ASCII characters allowed in the input Unicode string /// are letters, digits, and the hyphen-minus. The string cannot begin or end with the hyphen-minus. The function fails if the /// input Unicode string contains ASCII characters, such as &quot;[&quot;, &quot;]&quot;, or /// &quot;/&quot;, that cannot occur in domain names.The function fails if the input Unicode string contains control /// characters (U+0001 through U+0020) or the &quot;delete&quot; character (U+007F). In either case, this flag has no /// effect on the non-ASCII characters that are allowed in the Unicode string. /// IDN_USE_STD3_ASCII_RULES = 0x02, /// /// Starting with Windows 8: Enable EAI algorithmic fallback for the local parts of email addresses (such as /// &lt;local&gt;@microsoft.com). The default is for this function to fail when an email address has an invalid address /// or syntax.An application can set this flag to enable Email Address Internationalization (EAI) to return a discoverable /// fallback address, if possible. For more information, see the IETF Email Address Internationalization (eai) Charter. /// IDN_EMAIL_ADDRESS = 0x04, /// Starting with Windows 8: Disable the validation and mapping of Punycode. IDN_RAW_PUNYCODE = 0x08, } /// Flags specifying the locale identifiers to enumerate. [Flags] public enum LCID_FLAGS { /// Enumerate only installed locale identifiers. This value cannot be used with LCID_SUPPORTED. LCID_INSTALLED = 0x00000001, /// Enumerate all supported locale identifiers. This value cannot be used with LCID_INSTALLED. LCID_SUPPORTED = 0x00000002, /// /// Enumerate only the alternate sort locale identifiers. If this value is used with either LCID_INSTALLED or LCID_SUPPORTED, the /// installed or supported locales are retrieved, as well as the alternate sort locale identifiers. /// LCID_ALTERNATE_SORTS = 0x00000004, } /// Flag specifying the type of transformation to use during string mapping or the type of sort key to generate. [Flags] public enum LCMAP { /// For locales and scripts capable of handling uppercase and lowercase, map all characters to lowercase. LCMAP_LOWERCASE = 0x00000100, /// For locales and scripts capable of handling uppercase and lowercase, map all characters to uppercase. LCMAP_UPPERCASE = 0x00000200, /// Windows 7: Map all characters to title case, in which the first letter of each major word is capitalized. LCMAP_TITLECASE = 0x00000300, /// /// Produce a normalized sort key. If the LCMAP_SORTKEY flag is not specified, the function performs string mapping. For details /// of sort key generation and string mapping, see the Remarks section. /// LCMAP_SORTKEY = 0x00000400, /// Use byte reversal. For example, if the application passes in 0x3450 0x4822, the result is 0x5034 0x2248. LCMAP_BYTEREV = 0x00000800, /// Map all katakana characters to hiragana. This flag and LCMAP_KATAKANA are mutually exclusive. LCMAP_HIRAGANA = 0x00100000, /// Map all hiragana characters to katakana. This flag and LCMAP_HIRAGANA are mutually exclusive. LCMAP_KATAKANA = 0x00200000, /// Use narrow characters where applicable. This flag and LCMAP_FULLWIDTH are mutually exclusive. LCMAP_HALFWIDTH = 0x00400000, /// /// Use Unicode (wide) characters where applicable. This flag and LCMAP_HALFWIDTH are mutually exclusive. With this flag, the /// mapping may use Normalization Form C even if an input character is already full-width. For example, the string "は゛" (which is /// already full-width) is normalized to "ば". See Unicode normalization forms. /// LCMAP_FULLWIDTH = 0x00800000, /// /// Use linguistic rules for casing, instead of file system rules (default). This flag is valid with LCMAP_LOWERCASE or /// LCMAP_UPPERCASE only. /// LCMAP_LINGUISTIC_CASING = 0x01000000, /// /// Map traditional Chinese characters to simplified Chinese characters. This flag and LCMAP_TRADITIONAL_CHINESE are mutually exclusive. /// LCMAP_SIMPLIFIED_CHINESE = 0x02000000, /// /// Map simplified Chinese characters to traditional Chinese characters. This flag and LCMAP_SIMPLIFIED_CHINESE are mutually exclusive. /// LCMAP_TRADITIONAL_CHINESE = 0x04000000, } /// Locale Types. [Flags] public enum LCTYPE : uint { /// /// No user override. In several functions, for example, GetLocaleInfo and GetLocaleInfoEx, this constant causes /// the function to bypass any user override and use the system default value for any other constant specified in the function /// call. The information is retrieved from the locale database, even if the identifier indicates the current locale and the user /// has changed some of the values using the Control Panel, or if an application has changed these values by using /// SetLocaleInfo. If this constant is not specified, any values that the user has configured from the Control Panel or /// that an application has configured using SetLocaleInfo take precedence over the database settings for the current /// system default locale. /// LOCALE_NOUSEROVERRIDE = 0x80000000, /// /// Windows Me/98, Windows 2000: System default Windows ANSI code page (ACP) instead of the locale code page used for /// string translation. See Code Page Identifiers for a list of ANSI and other code pages. /// LOCALE_USE_CP_ACP = 0x40000000, /// /// Windows Me/98, Windows NT 4.0 and later: Retrieve a number. This constant causes GetLocaleInfo or GetLocaleInfoEx to retrieve /// a value as a number instead of as a string. The buffer that receives the value must be at least the length of a DWORD value. /// This constant can be combined with any other constant having a name that begins with "LOCALE_I". /// LOCALE_RETURN_NUMBER = 0x20000000, /// /// Windows 7 and later: Retrieve the genitive names of months, which are the names used when the month names are combined with /// other items. For example, in Ukrainian the equivalent of January is written "Січень" when the month is named alone. However, /// when the month name is used in combination, for example, in a date such as January 5th, 2003, the genitive form of the name /// is used. For the Ukrainian example, the genitive month name is displayed as "5 січня 2003". The list of genitive month names /// begins with January and is semicolon-delimited. If there is no 13th month, use a semicolon in its place at the end of the list. /// LOCALE_RETURN_GENITIVE_NAMES = 0x10000000, /// /// Windows 7 and later: Allow the return of neutral names or LCIDs when converting between locale names and locale identifiers. /// LOCALE_ALLOW_NEUTRAL_NAMES = 0x08000000, /// /// Windows 7 and later: Full localized name of the locale for the user interface language, for example, Deutsch (Deutschland) /// for German (Germany)" There is no limit on the number of characters allowed for this string. Since this name is based on the /// localization of the product, it changes for each localized version. /// LOCALE_SLOCALIZEDDISPLAYNAME = 0x00000002, /// /// Windows 7 and later: Display name of the locale in English. Usually the display name consists of the language and the /// country/region, for example, German (Germany) for Deutsch (Deutschland). /// LOCALE_SENGLISHDISPLAYNAME = 0x00000072, /// /// Windows Vista: Full localized primary name of the user interface language included in a localized display name, for example, /// Deutsch representing German. Since this name is based on the localization of the product, it changes for each localized version. /// LOCALE_SLOCALIZEDLANGUAGENAME = 0x0000006f, /// /// Windows 7 and later: English name of the language in English, for example, German for Deutsch, from International ISO /// Standard 639. This name is always restricted to characters that can be mapped into the ASCII 127-character subset. /// LOCALE_SENGLISHLANGUAGENAME = 0x00001001, /// /// Windows 7 and later: Full localized name of the country/region, for example, Deutschland for Germany. The maximum number of /// characters allowed for this string is 80, including a terminating null character. Since this name is based on the /// localization of the product, it changes for each localized version. /// LOCALE_SLOCALIZEDCOUNTRYNAME = 0x00000006, /// /// Windows 7 and later: English name of the country/region, for example, Germany for Deutschland. This name is always restricted /// to characters that can be mapped into the ASCII 127-character subset. /// LOCALE_SENGLISHCOUNTRYNAME = 0x00001002, /// /// Windows Me/98/95, Windows NT 4.0: A specific bit pattern that determines the relationship between the character /// coverage needed to support the locale and the font contents. Note that LOCALE_FONTSIGNATURE data takes a different form from /// all other locale information. All other locale information can be expressed in a string form or as a number. /// LOCALE_FONTSIGNATURE data is retrieved in a LOCALESIGNATURE structure. /// LOCALE_FONTSIGNATURE = 0x00000058, /// /// /// A 2-digit or 4-digit century for the short date only. The century can have one of the following values. It is preferred for /// your application to use LOCALE_SSHORTDATE instead of LOCALE_ICENTURY. /// /// /// /// Value /// Meaning /// /// /// 0 /// Abbreviated 2-digit century /// /// /// 1 /// Full 4-digit century /// /// /// LOCALE_ICENTURY = 0x00000024, /// /// /// Country/region code, based on international phone codes, also referred to as IBM country/region codes. The maximum number of /// characters allowed for this string is six, including a terminating null character. /// /// /// Windows 10 added LOCALE_IDIALINGCODE as a more accurately-named synonym for LOCALE_ICOUNTRY. We encourage you to use the new /// name in order to improve code readability. /// /// LOCALE_ICOUNTRY = LOCALE_IDIALINGCODE, /// /// Number of fractional digits for the local monetary format. The maximum number of characters allowed for this string is two, /// including the values 0-9 and a terminating null character. For example, 200.00 has a value of 2 because there are two /// fractional digits, while 200 has a value of 0 because there are no fractional digits displayed. /// LOCALE_ICURRDIGITS = 0x00000019, /// /// Position of the monetary symbol in the positive currency mode. /// /// /// Value /// Meaning /// /// /// 0 /// Prefix, no separation, for example, $1.1 /// /// /// 1 /// Suffix, no separation, for example, 1.1$ /// /// /// 2 /// Prefix, 1-character separation, for example, $ 1.1 /// /// /// 3 /// Suffix, 1-character separation, for example, 1.1 $ /// /// /// LOCALE_ICURRENCY = 0x0000001B, /// /// /// Short date format-ordering specifier. The specifier must be one of the following values. No user-specified values are /// allowed. It is preferred for your application to use LOCALE_SSHORTDATE instead of LOCALE_IDATE. /// /// /// /// Value /// Meaning /// /// /// 0 /// Month-Day-Year /// /// /// 1 /// Day-Month-Year /// /// /// 2 /// Year-Month-Day /// /// /// LOCALE_IDATE = 0x00000021, /// /// /// Specifier for leading zeros in day fields for a short date only. The maximum number of characters allowed for this string is /// two, including a terminating null character. It is preferred for your application to use the LOCALE_SSHORTDATE constant /// instead of LOCALE_IDAYLZERO. /// /// /// /// Value /// Meaning /// /// /// 0 /// No leading zeros for days /// /// /// 1 /// Leading zeros for days /// /// /// LOCALE_IDAYLZERO = 0x00000026, /// /// The ANSI code page used by a locale for applications that do not support Unicode. The maximum number of characters allowed /// for this string is six, including a terminating null character. If no ANSI code page is available, only Unicode can be used /// for the locale. In this case, the value is CP_ACP (0). Such a locale cannot be set as the system locale. Applications that do /// not support Unicode do not work correctly with locales marked as "Unicode only". For a list of ANSI and other code pages, see /// Code Page Identifiers. /// LOCALE_IDEFAULTANSICODEPAGE = 0x00001004, /// /// Original equipment manufacturer (OEM) code page associated with the country/region. The OEM code page is used for conversion /// from MS-DOS-based, text-mode applications. If the locale does not use an OEM code page, the value is CP_OEMCP (1). The /// maximum number of characters allowed for this string is six, including a terminating null character. For a list of OEM and /// other code pages, see Code Page Identifiers. /// LOCALE_IDEFAULTCODEPAGE = 0x0000000B, /// /// Obsolete. Do not use. This value was provided so that partially specified locales could be completed with default values. /// Partially specified locales are now deprecated. /// LOCALE_IDEFAULTCOUNTRY = 0x0000000A, /// /// Windows 2000: Default Extended Binary Coded Decimal Interchange Code (EBCDIC) code page associated with the locale. The /// maximum number of characters allowed for this string is six, including a terminating null character. For a list of EBCDIC and /// other code pages, see Code Page Identifiers. /// LOCALE_IDEFAULTEBCDICCODEPAGE = 0x00001012, /// /// Obsolete. Do not use. This value was provided so that partially specified locales could be completed with default values. /// Partially specified locales are now deprecated. /// LOCALE_IDEFAULTLANGUAGE = 0x00000009, /// /// Default Macintosh code page associated with the locale. The maximum number of characters allowed for this string is six, /// including a terminating null character. If the locale does not use a Macintosh code page, the value is CP_MACCP (2). For a /// list of Macintosh (MAC) and other code pages, see Code Page Identifiers. /// LOCALE_IDEFAULTMACCODEPAGE = 0x00001011, /// /// /// Country/region code, based on international phone codes, also referred to as IBM country/region codes. The maximum number of /// characters allowed for this string is six, including a terminating null character. /// /// /// Windows 10 added LOCALE_IDIALINGCODE as a more accurately-named synonym for LOCALE_ICOUNTRY. We encourage you to use the new /// name in order to improve code readability. /// /// LOCALE_IDIALINGCODE = 0x00000005, /// /// Number of fractional digits placed after the decimal separator. The maximum number of characters allowed for this string is /// two, including a terminating null character. For example, 2 for 5.00, 1 for 5.0. /// LOCALE_IDIGITS = 0x00000011, /// /// /// Windows 2000: The shape of digits. For example, Arabic, Thai, and Indic digits have classical shapes different from /// European digits. For locales with LOCALE_SNATIVEDIGITS specified as values other than ASCII 0-9, this value specifies whether /// preference should be given to those other digits for display purposes. For example, if a value of 2 is chosen, the digits /// specified by LOCALE_SNATIVEDIGITS are always used. If a 1 is chosen, the ASCII 0-9 digits are always used. If a 0 is chosen, /// ASCII is used in some circumstances and the digits specified by LOCALE_SNATIVEDIGITS are used in others, depending on the context. /// /// /// /// Value /// Meaning /// /// /// 0 /// /// Context-based substitution. Digits are displayed based on the previous text in the same output. European digits follow Latin /// scripts, Arabic-Indic digits follow Arabic text, and other national digits follow text written in various other scripts. When /// there is no preceding text, the locale and the displayed reading order determine digit substitution, as shown in the /// following table. /// /// /// /// 1 /// No substitution used. Full Unicode compatibility. /// /// /// 2 /// Native digit substitution. National shapes are displayed according to LOCALE_SNATIVEDIGITS. /// /// /// LOCALE_IDIGITSUBSTITUTION = 0x00001014, /// /// The first day of the calendar week. /// /// /// Value /// Meaning /// /// /// 0 /// LOCALE_SDAYNAME1 (Monday) /// /// /// 1 /// LOCALE_SDAYNAME2 (Tuesday) /// /// /// 2 /// LOCALE_SDAYNAME3 (Wednesday) /// /// /// 3 /// LOCALE_SDAYNAME4 (Thursday) /// /// /// 4 /// LOCALE_SDAYNAME5 (Friday) /// /// /// 5 /// LOCALE_SDAYNAME6 (Saturday) /// /// /// 6 /// LOCALE_SDAYNAME7 (Sunday) /// /// /// LOCALE_IFIRSTDAYOFWEEK = 0x0000100C, /// /// The first week of the year. /// /// /// Value /// Meaning /// /// /// 0 /// /// Week containing 1/1 is the first week of the year. Note that this can be a single day, if 1/1 falls on the last day of the week. /// /// /// /// 1 /// First full week following 1/1 is the first week of the year. /// /// /// 2 /// First week containing at least four days is the first week of the year. /// /// /// LOCALE_IFIRSTWEEKOFYEAR = 0x0000100D, /// /// A 32-bit signed number that uniquely identifies a geographical location. The application uses this constant to provide /// locale-specific services to customers. For example, it can be used as a key to access a database record that contains /// specific information about a country/region. /// LOCALE_IGEOID = 0x0000005B, /// /// [LOCALE_IINTLCURRDIGITS is not supported and may be altered or unavailable in the future. Instead, use LOCALE_ICURRDIGITS.] /// /// Number of fractional digits for the international monetary format. The maximum number of characters allowed for this string /// is three, including a terminating null character. For example, the number of fractional digits for the international monetary /// format of US Dollars is 2, as in $345.25. /// /// LOCALE_IINTLCURRDIGITS = 0x0000001A, /// /// /// Language identifier with a hexadecimal value. For example, English (United States) has the value 0409, which indicates 0x0409 /// hexadecimal, and is equivalent to 1033 decimal. The maximum number of characters allowed for this string is five, including a /// terminating null character. /// /// /// Windows Vista and later: Use of this constant can cause GetLocaleInfo to return an invalid locale identifier. /// Your application should use the LOCALE_SNAME constant when calling this function. /// /// LOCALE_ILANGUAGE = 0x00000001, /// /// /// Long date format-ordering specifier. It is preferred for your application to use the LOCALE_SLONGDATE constant instead of LOCALE_ILDATE. /// /// /// /// Value /// Meaning /// /// /// 0 /// Month-Day-Year /// /// /// 1 /// Day-Month-Year /// /// /// 2 /// Year-Month-Day /// /// /// LOCALE_ILDATE = 0x00000022, /// /// Specifier for leading zeros in decimal fields. /// /// /// Value /// Meaning /// /// /// 0 /// No leading zeros /// /// /// 1 /// Leading zeros /// /// /// LOCALE_ILZERO = 0x00000012, /// /// System of measurement. The maximum number of characters allowed for this string is two, including a terminating null /// character. This value is 0 if the metric system (Systéme International d'Units, or S.I.) is used, and 1 if the United States /// system is used. /// LOCALE_IMEASURE = 0x0000000D, /// /// /// Specifier for leading zeros in month fields for a short date only. It is preferred for your application to use the /// LOCALE_SSHORTDATE constant instead of LOCALE_IMONLZERO. /// /// /// /// Value /// Meaning /// /// /// 0 /// No leading zeros for months /// /// /// 1 /// Leading zeros for months /// /// /// LOCALE_IMONLZERO = 0x00000027, /// /// /// Windows 7 and later: Negative percentage formatting pattern for the locale. Only one pattern can be indicated. If more /// than one format is used for the locale, choose the preferred option. For example, if a negative percentage is displayed "-9 /// %" for "negative nine percent", the appropriate choice for this constant is 0. /// /// /// /// Value /// Format /// /// /// 0 /// Negative sign, number, space, percent; for example, -# % /// /// /// 1 /// Negative sign, number, percent; for example, -#% /// /// /// 2 /// Negative sign, percent, number; for example, -%# /// /// /// 3 /// Percent, negative sign, number; for example, %-# /// /// /// 4 /// Percent, number, negative sign; for example, %#- /// /// /// 5 /// Number, negative sign, percent; for example, #-% /// /// /// 6 /// Number, percent, negative sign; for example, #%- /// /// /// 7 /// Negative sign, percent, space, number; for example, -% # /// /// /// 8 /// Number, space, percent, negative sign; for example, # %- /// /// /// 9 /// Percent, space, number, negative sign; for example, % #- /// /// /// 10 /// Percent, space, negative sign, number; for example, % -# /// /// /// 11 /// Number, negative sign, space, percent; for example, #- % /// /// /// LOCALE_INEGATIVEPERCENT = 0x00000074, /// Negative currency mode. LOCALE_INEGCURR = 0x0000001C, /// Negative number mode, that is, the format for a negative number. LOCALE_INEGNUMBER = 0x00001010, /// /// Separation of the negative sign in a monetary value. This value is 1 if the monetary symbol is separated by a space from the /// negative amount, or 0 if it is not. /// LOCALE_INEGSEPBYSPACE = 0x00000057, /// Formatting index for the negative sign in currency values. LOCALE_INEGSIGNPOSN = 0x00000053, /// /// Position of the monetary symbol in a negative monetary value. This value is 1 if the monetary symbol precedes the negative /// amount, or 0 if the symbol follows the amount. /// LOCALE_INEGSYMPRECEDES = 0x00000056, /// /// Windows 7 and later: Locale type. Set this constant to 0 for a specific locale, or to 1 for a neutral locale. /// LOCALE_INEUTRAL = 0x00000071, /// /// /// An optional calendar type that is available for a locale. The calendar type can only represent an optional calendar that is /// available for the corresponding locale. To retrieve all optional calendars available for a locale, the application can use /// the following NLS functions: /// /// /// /// EnumCalendarInfo /// /// /// EnumCalendarInfoEx /// /// /// EnumCalendarInfoExEx /// /// /// LOCALE_IOPTIONALCALENDAR = 0x0000100B, /// /// /// Windows 2000: Default paper size associated with the locale. The size typically has one of the following values, /// although it can be set to any of the defined paper sizes that are understood by the spooler. /// /// /// /// Value /// Meaning /// /// /// 1 /// US Letter /// /// /// 5 /// US legal /// /// /// 8 /// A3 /// /// /// 9 /// A4 /// /// /// LOCALE_IPAPERSIZE = 0x0000100A, /// /// Windows 7 and later: Positive percentage formatting pattern for the locale. Only one pattern can be indicated. /// /// /// Value /// Format /// /// /// 0 /// Number, space, percent; for example, # % /// /// /// 1 /// Number, percent; for example, #% /// /// /// 2 /// Percent, number; for example, %# /// /// /// 3 /// Percent, space, number; for example, % # /// /// /// LOCALE_IPOSITIVEPERCENT = 0x00000075, /// /// Separation of monetary symbol in a positive monetary value. This value is 1 if the monetary symbol is separated by a space /// from a positive amount, 0 if it is not. /// LOCALE_IPOSSEPBYSPACE = 0x00000055, /// /// Formatting index for positive values. The index uses the same values as LOCALE_INEGSIGNPOSN, except that it does not use the /// zero index. /// LOCALE_IPOSSIGNPOSN = 0x00000052, /// /// Position of the monetary symbol in a positive monetary value. This value is 1 if the monetary symbol precedes the positive /// amount, or 0 if the symbol follows the amount. /// LOCALE_IPOSSYMPRECEDES = 0x00000054, /// /// Windows 7 and later: The reading layout for text. Possible values are defined in the following table. /// /// /// Value /// Meaning /// /// /// 0 /// Read from left to right, as for the English (United States) locale. /// /// /// 1 /// Read from right to left, as for Arabic locales. /// /// /// 2 /// /// Either read vertically from top to bottom with columns going from right to left, or read in horizontal rows from left to /// right, as for the Japanese (Japan) locale. /// /// /// /// 3 /// Read vertically from top to bottom with columns going from left to right, as for the Mongolian (Mongolian) locale. /// /// /// LOCALE_IREADINGLAYOUT = 0x00000070, /// /// /// Time format specification. The specification is one of the following values. It is preferred for your application to use the /// LOCALE_STIMEFORMAT constant instead of LOCALE_ITIME. /// /// /// /// Value /// Description /// /// /// 0 /// AM/PM 12-hour format /// /// /// 1 /// 24-hour format /// /// /// LOCALE_ITIME = 0x00000023, /// /// /// Specifier indicating whether the time marker string (AM or PM) precedes or follows the time string. The registry value is /// iTimePrefix for compatibility with previous Asian versions of Windows. The specifier must have one of the following values. /// No user-specified values are allowed. It is preferred for your application to use the LOCALE_STIMEFORMAT constant instead of LOCALE_ITIMEMARKPOSN. /// /// /// /// Value /// Meaning /// /// /// 0 /// Use as suffix. /// /// /// 1 /// Use as prefix. /// /// /// LOCALE_ITIMEMARKPOSN = 0x00001005, /// /// /// Specifier for leading zeros in time fields. It is preferred for your application to use the LOCALE_STIMEFORMAT constant /// instead of LOCALE_ITLZERO. /// /// /// /// Value /// Meaning /// /// /// 0 /// No leading zeros for hours /// /// /// 1 /// Leading zeros for hours /// /// /// LOCALE_ITLZERO = 0x00000025, /// /// /// String for the AM designator (first 12 hours of the day). The maximum number of characters allowed for this string, including /// a terminating null character, is different for different releases of Windows. /// /// /// Windows XP: Thirteen including a terminating null character for SetLocaleInfo. Fifteen including a terminating /// null character for GetLocaleInfo. /// /// Windows Me/98/95, Windows NT 4.0, Windows 2000: Nine including a terminating null character. /// Windows Server 2003 and later: Fifteen including a terminating null character. /// Windows 10 added the value LOCALE_SAM as a more readable synonym for LOCALE_S1159. /// LOCALE_S1159 = LOCALE_SAM, /// /// /// String for the PM designator (second 12 hours of the day). The maximum number of characters allowed for this string is /// different for different releases of Windows. /// /// /// Windows XP: Thirteen including a terminating null character for SetLocaleInfo. Fifteen including a terminating /// null character for GetLocaleInfo. /// /// Windows Me/98/95, Windows NT 4.0, Windows 2000: Nine including a terminating null character. /// Windows Server 2003 and later: Fifteen including a terminating null character. /// Windows 10 added the value LOCALE_SPM as a more readable synonym for LOCALE_S2359. /// LOCALE_S2359 = LOCALE_SPM, /// /// Abbreviated name of the country/region, mostly based on the ISO Standard 3166. The maximum number of characters allowed for /// this string is nine, including a terminating null character. /// LOCALE_SABBREVCTRYNAME = 0x00000007, /// /// Native abbreviated name for Monday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME1 = 0x00000031, /// /// Native abbreviated name for Tuesday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME2 = 0x00000032, /// /// Native abbreviated name for Wednesday. The maximum number of characters allowed for this string is 80, including a /// terminating null character. /// LOCALE_SABBREVDAYNAME3 = 0x00000033, /// /// Native abbreviated name for Thursday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME4 = 0x00000034, /// /// Native abbreviated name for Friday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME5 = 0x00000035, /// /// Native abbreviated name for Saturday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME6 = 0x00000036, /// /// Native abbreviated name for Sunday. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVDAYNAME7 = 0x00000037, /// /// Abbreviated name of the language. In most cases, the name is created by taking the two-letter language abbreviation from ISO /// Standard 639 and adding a third letter, as appropriate, to indicate the sublanguage. For example, the abbreviated name for /// the language corresponding to the English (United States) locale is ENU. /// LOCALE_SABBREVLANGNAME = 0x00000003, /// /// Native abbreviated name for January. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME1 = 0x00000044, /// /// Native abbreviated name for February. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME2 = 0x00000045, /// /// Native abbreviated name for March. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME3 = 0x00000046, /// /// Native abbreviated name for April. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME4 = 0x00000047, /// /// Native abbreviated name for May. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SABBREVMONTHNAME5 = 0x00000048, /// /// Native abbreviated name for June. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME6 = 0x00000049, /// /// Native abbreviated name for July. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME7 = 0x0000004A, /// /// Native abbreviated name for August. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME8 = 0x0000004B, /// /// Native abbreviated name for September. The maximum number of characters allowed for this string is 80, including a /// terminating null character. /// LOCALE_SABBREVMONTHNAME9 = 0x0000004C, /// /// Native abbreviated name for October. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME10 = 0x0000004D, /// /// Native abbreviated name for November. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME11 = 0x0000004E, /// /// Native abbreviated name for December. The maximum number of characters allowed for this string is 80, including a terminating /// null character. /// LOCALE_SABBREVMONTHNAME12 = 0x0000004F, /// /// Native abbreviated name for a 13th month, if it exists. The maximum number of characters allowed for this string is 80, /// including a terminating null character. /// LOCALE_SABBREVMONTHNAME13 = 0x0000100F, /// /// /// String for the AM designator (first 12 hours of the day). The maximum number of characters allowed for this string, including /// a terminating null character, is different for different releases of Windows. /// /// /// Windows XP: Thirteen including a terminating null character for SetLocaleInfo. Fifteen including a terminating /// null character for GetLocaleInfo. /// /// Windows Me/98/95, Windows NT 4.0, Windows 2000: Nine including a terminating null character. /// Windows Server 2003 and later: Fifteen including a terminating null character. /// Windows 10 added the value LOCALE_SAM as a more readable synonym for LOCALE_S1159. /// LOCALE_SAM = 0x00000028, /// /// /// Windows Vista and later: Preferred locale to use for console display. The maximum number of characters allowed for /// this string is 85, including a terminating null character. /// /// /// If the language corresponding to this locale is supported in the console, the value is the same as that for LOCALE_SNAME, /// that is, the locale itself can be used for console display. However, the console cannot display languages that can be /// rendered only with Uniscribe. For example, the console cannot display Arabic or the various Indic languages. Therefore, the /// LOCALE_SCONSOLEFALLBACKNAME value for locales corresponding to these languages is different from the value for LOCALE_SNAME. /// /// /// For predefined locales, if the fallback value is different from the value for the locale itself, the value for the neutral /// locale is used. A specific locale is associated with both a language and a country/region, while a neutral locale is /// associated with a language but is not associated with any country/region. For example, ar-SA falls back to "en", not to /// "en-US". This policy of using neutral locales is implemented consistently for predefined locales and is strongly recommended /// for custom locales. However, the policy is not enforced. For a custom locale, your application can use a specific locale /// instead of a neutral locale as a fallback. /// /// LOCALE_SCONSOLEFALLBACKNAME = 0x0000006e, /// Deprecated for Windows 7 and later. Full localized name of the country/region. See LOCALE_SLOCALIZEDCOUNTRYNAME. LOCALE_SCOUNTRY = LOCALE_SLOCALIZEDCOUNTRYNAME, /// /// String used as the local monetary symbol. The maximum number of characters allowed for this string is 13, including a /// terminating null character. For example, in the United States, this symbol is "$". /// LOCALE_SCURRENCY = 0x00000014, /// /// /// Character(s) for the date separator. The maximum number of characters allowed for this string is four, including a /// terminating null character. /// /// /// Windows Vista and later: This constant is deprecated. Use LOCALE_SSHORTDATE instead. A custom locale might not have a /// single, uniform separator character. For example, a format such as "12/31, 2006" is valid. /// /// LOCALE_SDATE = 0x0000001D, /// /// Native long name for Monday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME1 = 0x0000002A, /// /// Native long name for Tuesday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME2 = 0x0000002B, /// /// Native long name for Wednesday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME3 = 0x0000002C, /// /// Native long name for Thursday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME4 = 0x0000002D, /// /// Native long name for Friday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME5 = 0x0000002E, /// /// Native long name for Saturday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME6 = 0x0000002F, /// /// Native long name for Sunday. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SDAYNAME7 = 0x00000030, /// /// Character(s) used for the decimal separator, for example, "." in "3.14" or "," in "3,14". The maximum number of characters /// allowed for this string is four, including a terminating null character. /// LOCALE_SDECIMAL = 0x0000000E, /// /// /// Windows Vista and later: Time duration format composed of format pictures listed in the following table. The format is /// similar to the format for LOCALE_STIMEFORMAT. As for LOCALE_STIMEFORMAT, this format can also include any string of /// characters enclosed in single quotes. Formats can include, for example, "h:mm:ss", or "d'd 'h'h 'm'm 's.fff's'". In /// comparison with LOCALE_STIMEFORMAT, there are additional format pictures for fractions of a second. Because this format is /// for duration, not time, it does not specify a 12- or 24-hour clock system, or include an AM/PM indicator. This constant might /// be used, for example, for a multi-media application that displays file time or a sporting event application that displays /// finish times. /// /// /// /// Value /// Meaning /// /// /// h /// Hours without leading zeros for single-digit hours /// /// /// hh /// Hours with leading zeros for single-digit hours /// /// /// m /// Minutes without leading zeros for single-digit minutes /// /// /// mm /// Minutes with leading zeros for single-digit minutes /// /// /// s /// Seconds without leading zeros for single-digit seconds /// /// /// ss /// Seconds with leading zeros for single-digit seconds /// /// /// f /// Tenths of a second /// /// /// ff /// Hundredths of a second /// /// /// fff /// /// Thousandths of a second; character "f" can occur up to nine consecutive times (fffffffff), although support for frequency /// timers is limited to 100 nanoseconds; if nine characters are present, the last two digits are always zero /// /// /// /// LOCALE_SDURATION = 0x0000005d, /// Deprecated for Windows 7 and later. Full English name of the country/region. See LOCALE_SENGLISHCOUNTRYNAME. LOCALE_SENGCOUNTRY = LOCALE_SENGLISHCOUNTRYNAME, /// /// Windows Me/98, Windows 2000: The full English name of the currency associated with the locale. There is no limit on the /// number of characters allowed for this string. /// LOCALE_SENGCURRNAME = 0x00001007, /// Deprecated for Windows 7 and later. Full English name of the language from ISO Standard 639. See LOCALE_SENGLISHLANGUAGENAME. LOCALE_SENGLANGUAGE = LOCALE_SENGLISHLANGUAGENAME, /// /// /// Sizes for each group of digits to the left of the decimal. The maximum number of characters allowed for this string is ten, /// including a terminating null character. An explicit size is needed for each group, and sizes are separated by semicolons. If /// the last value is 0, the preceding value is repeated. For example, to group thousands, specify 3;0. Indic locales group the /// first thousand and then group by hundreds. For example, 12,34,56,789 is represented by 3;2;0. /// /// Further examples: /// /// /// Specification /// Resulting string /// /// /// 3;0 /// 3,000,000,000,000 /// /// /// 3;2;0 /// 30,00,00,00,00,000 /// /// /// 3 /// 3000000000,000 /// /// /// 3;2 /// 30000000,00,000 /// /// /// LOCALE_SGROUPING = 0x00000010, /// /// Three characters of the international monetary symbol specified in ISO 4217, followed by the character separating this string /// from the amount. The maximum number of characters allowed for this string is nine, including a terminating null character. /// LOCALE_SINTLSYMBOL = 0x00000015, /// /// Windows Me/98, Windows NT 4.0: Country/region name, based on ISO Standard 3166, such as "US" for the United States. This can /// also return a number, such as "029" for Caribbean. The maximum number of characters allowed for this string is nine, /// including a terminating null character. /// LOCALE_SISO3166CTRYNAME = 0x0000005A, /// /// Windows Vista and later: Three-letter ISO region name (ISO 3166 three-letter code for the country/region), such as "USA" for /// the United States. This can also return a number, such as "029" for Caribbean. The maximum number of characters allowed for /// this string is nine, including a terminating null character. /// LOCALE_SISO3166CTRYNAME2 = 0x00000068, /// /// Windows Me/98, Windows NT 4.0: The abbreviated name of the language based entirely on the ISO Standard 639 values, in /// lowercase form, such as "en" for English. This can be a 3-letter code for languages that don't have a 2-letter code, such as /// "haw" for Hawaiian. The maximum number of characters allowed for this string is nine, including a terminating null character. /// LOCALE_SISO639LANGNAME = 0x00000059, /// /// Windows Vista and later: Three-letter ISO language name, in lowercase form (ISO 639-2 three-letter code for the language), /// such as "eng" for English. The maximum number of characters allowed for this string is nine, including a terminating null character. /// LOCALE_SISO639LANGNAME2 = 0x00000067, /// /// Windows Vista and later: A semicolon-delimited list of keyboards to potentially install for the locale and to be used /// internally by Windows. There is no limit on the number of characters allowed for this string. To retrieve the name of the /// active input locale identifier (formerly called the keyboard layout), your application can call the /// GetKeyboardLayoutName function. /// LOCALE_SKEYBOARDSTOINSTALL = 0x0000005e, /// Deprecated for Windows 7 and later. Primary language name included in a localized display name. See LOCALE_SLOCALIZEDDISPLAYNAME. LOCALE_SLANGDISPLAYNAME = LOCALE_SLOCALIZEDLANGUAGENAME, /// Deprecated for Windows 7 and later. Full localized name of the language. See LOCALE_SLOCALIZEDLANGUAGENAME. LOCALE_SLANGUAGE = LOCALE_SLOCALIZEDDISPLAYNAME, /// /// Character(s) used to separate list items, for example, a comma is used in many locales. The maximum number of characters /// allowed for this string is four, including a terminating null character. /// LOCALE_SLIST = 0x0000000C, /// /// /// Long date formatting string for the locale. The maximum number of characters allowed for this string is 80, including a /// terminating null character. The string can consist of a combination of day, month, year, and era format pictures and any /// string of characters enclosed in single quotes. Characters in single quotes remain as specified. For example, the Spanish /// (Spain) long date is "dddd, dd' de 'MMMM' de 'yyyy". Locales can define multiple long date formats. /// /// To get all of the long date formats for a locale, use EnumDateFormats, EnumDateFormatsEx, or EnumDateFormatsExEx. /// LOCALE_SLONGDATE = 0x00000020, /// /// Character(s) used as the monetary decimal separator. The maximum number of characters allowed for this string is four, /// including a terminating null character. For example, if a monetary amount is displayed as "$3.40", just as "three dollars and /// forty cents" is displayed in the United States, then the monetary decimal separator is ".". /// LOCALE_SMONDECIMALSEP = 0x00000016, /// /// Sizes for each group of monetary digits to the left of the decimal. The maximum number of characters allowed for this string /// is ten, including a terminating null character. An explicit size is needed for each group, and sizes are separated by /// semicolons. If the last value is 0, the preceding value is repeated. For example, to group thousands, specify 3;0. Indic /// languages group the first thousand and then group by hundreds. For example 12,34,56,789 is represented by 3;2;0. /// LOCALE_SMONGROUPING = 0x00000018, /// /// Character(s) used as the monetary separator between groups of digits to the left of the decimal. The maximum number of /// characters allowed for this string is four, including a terminating null character. Typically, the groups represent /// thousands. However, depending on the value specified for LOCALE_SMONGROUPING, they can represent something else. /// LOCALE_SMONTHOUSANDSEP = 0x00000017, /// /// Windows 7 and later: Format string for displaying only the month and the day. The formatting is similar to that /// defined for LOCALE_SLONGDATE. For example, if the month/day pattern is the full month name followed by the day number with /// leading zeros, as in "September 03", the format string is "MMMM dd". The string can consist of a combination of day and month /// format pictures and any string of characters enclosed in single quotes. Characters in single quotes remain as specified, for /// example, 'de' for Spanish (Spain). A locale can specify only one month/day format. /// LOCALE_SMONTHDAY = 0x00000078, /// /// Native long name for January. The maximum number of characters allowed for this string is 80, including a terminating null character. /// LOCALE_SMONTHNAME1 = 0x00000038, /// /// Native long name for February. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME2 = 0x00000039, /// /// Native long name for March. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME3 = 0x0000003A, /// /// Native long name for April. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME4 = 0x0000003B, /// /// Native long name for May. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME5 = 0x0000003C, /// /// Native long name for June. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME6 = 0x0000003D, /// /// Native long name for July. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME7 = 0x0000003E, /// /// Native long name for August. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME8 = 0x0000003F, /// /// Native long name for September. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME9 = 0x00000040, /// /// Native long name for October. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME10 = 0x00000041, /// /// Native long name for November. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME11 = 0x00000042, /// /// Native long name for December. The maximum number of characters allowed for this string is 80, including a terminating null /// character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME12 = 0x00000043, /// /// Native name for a 13th month, if it exists. The maximum number of characters allowed for this string is 80, including a /// terminating null character. See note for LOCALE_SMONTHNAME1. /// LOCALE_SMONTHNAME13 = 0x0000100E, /// /// Windows Vista and later: Locale name, a multi-part tag to uniquely identify the locale. The maximum number of /// characters allowed for this string is 85, including a terminating null character. The tag is based on the language tagging /// conventions of RFC 4646. The pattern to use is described in Locale Names. /// LOCALE_SNAME = 0x0000005c, /// /// Windows Vista and later: String value for "Not a number", for example, "Nan" for the English (United States) locale. /// There is no limit on the number of characters allowed for this string. /// LOCALE_SNAN = 0x00000069, /// /// Windows 7 and later: Native name of the country/region, for example, España for Spain. The maximum number of characters /// allowed for this string is 80, including a terminating null character. /// LOCALE_SNATIVECOUNTRYNAME = 0x00000008, /// Deprecated for Windows 7 and later. Native name of the country/region. See LOCALE_SNATIVECOUNTRYNAME. LOCALE_SNATIVECTRYNAME = LOCALE_SNATIVECOUNTRYNAME, /// /// Windows Me/98, Windows 2000: The native name of the currency associated with the locale, in the native language of the /// locale. There is no limit on the number of characters allowed for this string. /// LOCALE_SNATIVECURRNAME = 0x00001008, /// /// Native equivalents of ASCII 0 through 9. The maximum number of characters allowed for this string is eleven, including a /// terminating null character. For example, Arabic uses "٠١٢٣٤٥ ٦٧٨٩". See also LOCALE_IDIGITSUBSTITUTION. /// LOCALE_SNATIVEDIGITS = 0x00000013, /// /// Windows 7 and later: Display name of the locale in its native language, for example, Deutsch (Deutschland) for the locale /// German (Germany). /// LOCALE_SNATIVEDISPLAYNAME = 0x00000073, /// Deprecated for Windows 7 and later. Native name of the language. See LOCALE_SNATIVELANGUAGENAME. LOCALE_SNATIVELANGNAME = LOCALE_SNATIVELANGUAGENAME, /// /// Windows 7 and later: Native name of the language, for example, Հայերեն for Armenian (Armenia). The maximum number of /// characters allowed for this string is 80, including a terminating null character. /// LOCALE_SNATIVELANGUAGENAME = 0x00000004, /// /// String value for the negative sign, for example, "-" for the English (United States) locale. The maximum number of characters /// allowed for this string is five, including a terminating null character. /// LOCALE_SNEGATIVESIGN = 0x00000051, /// /// Windows Vista and later: String value for "negative infinity", for example, "-Infinity" for the English (United /// States) locale. There is no limit on the number of characters allowed for this string. /// LOCALE_SNEGINFINITY = 0x0000006b, /// /// Windows 7 and later: OpenType language tag used to retrieve culturally appropriate typographic features from a font. /// For more information, see OPENTYPE_TAG. /// LOCALE_SOPENTYPELANGUAGETAG = 0x0000007a, /// /// /// Windows Vista and later: Fallback locale, used by the resource loader. The maximum number of characters allowed for /// this string is 85, including a terminating null character. /// /// /// Locales have a hierarchy in which the parent of a specific locale is a neutral locale. A specific locale is associated with /// both a language and a country/region, while a neutral locale is associated with a language but is not associated with any /// country/region. The parent locale is used to decide the first fallback to be tried when a resource for a specific locale is /// not available. For example, the parent locale for "en-US" (0x0409) is "en" (0x0009). When a resource is not available for the /// specific "en-US" locale, the resource loader falls back to use the resource that is available for the neutral "en" locale. /// See User Interface Language Management for further details of the resource loader fallback strategy. /// /// /// This pattern is consistent for predefined locales. However, the parent locale is not determined by any manipulation of the /// locale name. That is, GetLocaleInfo and GetLocaleInfoEx do not parse a string such as "en-US" to get the value /// "en". Instead, they look at the stored locale data. For predefined locales, the value follows the expected pattern, in which /// the parent of a specific locale is the corresponding neutral locale and the parent of a neutral locale is the invariant /// locale. While it is recommended that custom locales follow a similar strategy in terms of defining their parent locale, this /// is not enforced. The application implementing a custom locale can specify a less obviously appropriate parent. /// /// LOCALE_SPARENT = 0x0000006d, /// /// Windows 7 and later: Symbol used to indicate percentage, for example, "%". The value is a single string of 0 to 3 characters. /// LOCALE_SPERCENT = 0x00000076, /// Windows 7 and later: Symbol used to indicate the permille (U+2030) symbol, that is, ‰. LOCALE_SPERMILLE = 0x00000077, /// /// /// String for the PM designator (second 12 hours of the day). The maximum number of characters allowed for this string is /// different for different releases of Windows. /// /// /// Windows XP: Thirteen including a terminating null character for SetLocaleInfo. Fifteen including a terminating /// null character for GetLocaleInfo. /// /// Windows Me/98/95, Windows NT 4.0, Windows 2000: Nine including a terminating null character. /// Windows Server 2003 and later: Fifteen including a terminating null character. /// Windows 10 added the value LOCALE_SPM as a more readable synonym for LOCALE_S2359. /// LOCALE_SPM = 0x00000029, /// /// Windows Vista and later: String value for "positive infinity", for example, "Infinity" for the English (United States) /// locale. There is no limit on the number of characters allowed for the string. /// LOCALE_SPOSINFINITY = 0x0000006a, /// /// Localized string value for the positive sign for the locale. For example, LOCALE_SPOSITIVESIGN is considered to be "+" /// for the English (United States) locale. Note that the presence of data for this string does not mean that a positive sign is /// necessarily used when formatting a number. If this the data is blank/empty then a "+" is assumed to be used. The maximum /// number of characters allowed for this string is five, including a terminating null character. /// LOCALE_SPOSITIVESIGN = 0x00000050, /// LOCALE_SRELATIVELONGDATE = 0x0000007c, /// /// /// Windows Vista and later: A string representing a list of scripts, using the 4-character notation used in ISO 15924. /// Each script name consists of four Latin characters and the list is arranged in alphabetical order with each name, including /// the last, followed by a semicolon. /// /// /// GetLocaleInfo or GetLocaleInfoEx can be called with LCType set to LOCALE_SSCRIPTS as part of a strategy to /// mitigate security issues related to Internationalized Domain Names (IDNs). Here are some example values: /// /// /// /// Locale /// Locale/language name /// Value /// /// /// English (United States) /// en-US /// Latn; /// /// /// Hindi (India) /// hi-IN /// Deva; /// /// /// Japanese (Japan) /// ja-JP /// Windows 7 and later: Hani;Hira;Jpan;Kana; Windows Vista: Hani;Hira;Kana; /// /// /// /// A compound script value does not include the Latin script unless it is an essential part of the writing system used for the /// particular locale. Latin characters are often used in the context of locales for which they are not native, for example, for /// a foreign business name. In the example above for Hindi in India, the only script value is "Deva" (for "Devanagari"), /// although Latin characters can also appear in Hindi text. The VerifyScripts function has a special flag to address this case. /// /// LOCALE_SSCRIPTS = 0x0000006c, /// /// /// Short date formatting string for the locale. The maximum number of characters allowed for this string is 80, including a /// terminating null character. The string can consist of a combination of day, month, year, and era format pictures. For /// example, "M/d/yyyy" indicates that September 3, 2004 is written 9/3/2004. /// /// /// Locales can define multiple short date formats. To get all of the short date formats for this locale, use EnumDateFormats, /// EnumDateFormatsEx, or EnumDateFormatsExEx. /// /// LOCALE_SSHORTDATE = 0x0000001F, /// /// String for the shortest possible AM indicator for a locale. For English that could be as short as "a"; however other /// languages could have more codepoints. /// LOCALE_SSHORTESTAM = 0x0000007e, /// /// Windows Vista and later: Short native name of the first day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME1, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME1 = 0x00000060, /// /// Windows Vista and later: Short native name of the second day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME2, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME2 = 0x00000061, /// /// Windows Vista and later: Short native name of the third day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME3, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME3 = 0x00000062, /// /// Windows Vista and later: Short native name of the fourth day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME4, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME4 = 0x00000063, /// /// Windows Vista and later: Short native name of the fifth day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME5, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME5 = 0x00000064, /// /// Windows Vista and later: Short native name of the sixth day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME6, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME6 = 0x00000065, /// /// Windows Vista and later: Short native name of the seventh day of the week. This name is often shorter than /// LOCALE_SABBREVDAYNAME7, and it is useful for calendar titles. /// LOCALE_SSHORTESTDAYNAME7 = 0x00000066, /// /// String for the shortest possible PM indicator for a locale. For English that could be as short as "p"; however other /// languages could have more codepoints. /// LOCALE_SSHORTESTPM = 0x0000007f, /// /// Windows 7 and later: Short time formatting string for the locale. Patterns are typically derived by removing the "ss" /// (seconds) value from the long time format pattern. For example, if the long time format is "h:mm:ss tt", the short time /// format is most likely "h:mm tt". This constant can specify multiple formats in a semicolon-delimited list. However, the /// preferred short time format should be the first value listed. /// LOCALE_SSHORTTIME = 0x00000079, /// Windows 7 and later: Name of the locale to use for sorting or casing behavior. LOCALE_SSORTLOCALE = 0x0000007b, /// /// Windows Me/98, Windows 2000: The full localized name of the sort for the specified locale identifier, dependent on the /// language of the shell. This constant is used to determine casing and sorting behavior. /// LOCALE_SSORTNAME = 0x00001013, /// /// Characters that are used to separate groups of digits to the left of the decimal. The maximum number of characters allowed /// for this string is four, including a terminating null character. Typically, these groups represent thousands. However, /// depending on the value specified for LOCALE_SGROUPING, they can represent something else. /// LOCALE_STHOUSAND = 0x0000000F, /// /// Character(s) for the time separator. The maximum number of characters allowed for this string is four, including a /// terminating null character. Windows Vista and later: This constant is deprecated. Use LOCALE_STIMEFORMAT instead. A custom /// locale might not have a single, uniform separator character. For example, a format such as "03:56'23" is valid. /// LOCALE_STIME = 0x0000001E, /// /// Time formatting strings for the locale. The maximum number of characters allowed for this string is 80, including a /// terminating null character. The string can consist of a combination of hour, minute, and second format pictures. /// LOCALE_STIMEFORMAT = 0x00001003, /// /// Windows Me/98, Windows 2000: The year-month formatting string for the locale. The maximum number of characters allowed /// for this string is 80, including a terminating null character. This string shows the proper format for a date string that /// contains only the year and the month, using format pictures as defined in Day, Month, Year, and Era Format Pictures. /// LOCALE_SYEARMONTH = 0x00001006, } /// Language Group Identifier. public enum LGRPID : uint { /// Western Europe and U.S. LGRPID_WESTERN_EUROPE = 0x0001, /// Central Europe LGRPID_CENTRAL_EUROPE = 0x0002, /// Baltic LGRPID_BALTIC = 0x0003, /// Greek LGRPID_GREEK = 0x0004, /// Cyrillic LGRPID_CYRILLIC = 0x0005, /// Turkic LGRPID_TURKIC = 0x0006, /// Turkish LGRPID_TURKISH = 0x0006, /// Japanese LGRPID_JAPANESE = 0x0007, /// Korean LGRPID_KOREAN = 0x0008, /// Traditional Chinese LGRPID_TRADITIONAL_CHINESE = 0x0009, /// Simplified Chinese LGRPID_SIMPLIFIED_CHINESE = 0x000a, /// Thai LGRPID_THAI = 0x000b, /// Hebrew LGRPID_HEBREW = 0x000c, /// Arabic LGRPID_ARABIC = 0x000d, /// Vietnamese LGRPID_VIETNAMESE = 0x000e, /// Indic LGRPID_INDIC = 0x000f, /// Georgian LGRPID_GEORGIAN = 0x0010, /// Armenian LGRPID_ARMENIAN = 0x0011, } /// Flag specifying whether the language group identifier is supported or installed. public enum LGRPID_FLAGS { /// Language group identifier is installed. LGRPID_INSTALLED = 0x00000001, /// Language group identifier is both supported and installed. LGRPID_SUPPORTED = 0x00000002, } /// Flags identifying the locales to enumerate. [Flags] public enum LOCALE_FLAGS { /// /// Windows Vista and later: Enumerate all locales. Using this constant is equivalent to using LOCALE_WINDOWS | /// LOCALE_SUPPLEMENTAL | LOCALE_ALTERNATE_SORTS | LOCALE_NEUTRALDATA. /// LOCALE_ALL = 0, /// /// Windows Vista and later: Enumerate all locales that come with the operating system, including replacement locales, but /// excluding alternate sorts. For more information, see Custom Locales. /// LOCALE_WINDOWS = 0x00000001, /// Windows Vista and later: Enumerate supplemental locales. LOCALE_SUPPLEMENTAL = 0x00000002, /// Windows Vista and later: Enumerate only the alternate sorts, locales with a nonzero sort order identifier. LOCALE_ALTERNATE_SORTS = 0x00000004, /// Windows Vista and later: Enumerate replacement locales. This constant is valid input only for EnumLocalesProcEx. LOCALE_REPLACEMENT = 0x00000008, /// /// Windows 7 and later: Neutral locale data, that is, data defined by language only. Country/region data uses the default. /// LOCALE_NEUTRALDATA = 0x00000010, /// Windows 7 and later: Locale data specified by both language and country/region. LOCALE_SPECIFICDATA = 0x00000020, } /// Flags controlling currency format. public enum LOCALE_FORMAT_FLAG : uint { /// Formats the string using user overrides to the default currency format for the locale. LOCALE_UNSPECIFIED = 0, /// Format the string using the system default currency format for the specified locale. LOCALE_NOUSEROVERRIDE = 0x80000000 } /// The MUI file type flags. [PInvokeData("Winnls.h", MSDNShortId = "dd318039")] [Flags] public enum MUI_FILETYPE : uint { /// /// The input file does not have resource configuration data. This file type is typical for older executable files. If this file /// type is specified, the other file types will not provide useful information. /// MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL = 0x001, /// The input file is an LN file. MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN = 0x002, /// The input file is a language-specific resource file. MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI = 0x004, } /// Flags indicating attributes of the input language list. [Flags] public enum MUI_LANGUAGE { /// The language is fully localized. MUI_FULL_LANGUAGE = 1, /// The language is fully localized. MUI_PARTIAL_LANGUAGE = 2, /// The language is an LIP language. MUI_LIP_LANGUAGE = 4, /// The language is installed on this computer. MUI_LANGUAGE_INSTALLED = 32, /// The language is appropriately licensed for the current user. MUI_LANGUAGE_LICENSED = 64, } /// Flags identifying language format and filtering. [Flags] public enum MUI_LANGUAGE_ENUM : uint { /// Pass the language identifier in the language string to the callback function. MUI_LANGUAGE_ID = 4, /// Pass the language name in the language string to the callback function. MUI_LANGUAGE_NAME = 8 } /// Flags identifying language format and filtering. [Flags] public enum MUI_LANGUAGE_FILTER : uint { /// Pass the language identifier in the language string to the callback function. MUI_LANGUAGE_ID = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_ID, /// Pass the language name in the language string to the callback function. MUI_LANGUAGE_NAME = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_NAME, /// /// Use the system fallback to retrieve a list that corresponds exactly to the language list used by the resource loader. This /// flag can be used only in combination with MUI_MERGE_USER_FALLBACK. Using the flags in combination alters the usual effect of /// MUI_MERGE_USER_FALLBACK by including fallback and neutral languages in the list. /// MUI_MERGE_SYSTEM_FALLBACK = 0x10, /// /// Retrieve a composite list consisting of the thread preferred UI languages, followed by process preferred UI languages, /// followed by any user preferred UI languages that are distinct from these, followed by the system default UI language, if it /// is not already in the list. If the user preferred UI languages list is empty, the function retrieves the system preferred UI /// languages. This flag cannot be combined with MUI_THREAD_LANGUAGES. /// MUI_MERGE_USER_FALLBACK = 0x20, /// /// Retrieve a complete thread preferred UI languages list along with associated fallback and neutral languages. Use of this flag /// is equivalent to combining MUI_MERGE_SYSTEM_FALLBACK and MUI_MERGE_USER_FALLBACK. (Applicable only for Windows 7 and later). /// MUI_UI_FALLBACK = MUI_MERGE_SYSTEM_FALLBACK | MUI_MERGE_USER_FALLBACK, /// /// Retrieve a composite list consisting of the thread preferred UI languages, followed by process preferred UI languages, /// followed by any user preferred UI languages that are distinct from these, followed by the system default UI language, if it /// is not already in the list. If the user preferred UI languages list is empty, the function retrieves the system preferred UI /// languages. This flag cannot be combined with MUI_THREAD_LANGUAGES. /// MUI_THREAD_LANGUAGES = 0x40, } /// Flags identifying language format and filtering. [Flags] public enum MUI_LANGUAGE_FLAGS : uint { /// Pass the language identifier in the language string to the callback function. MUI_LANGUAGE_ID = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_ID, /// Pass the language name in the language string to the callback function. MUI_LANGUAGE_NAME = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_NAME, /// /// GetThreadPreferredUILanguages should replace with the appropriate fallback all languages that cannot display properly in a /// console window with the current operating system settings. When this flag is specified, NULL must be passed for all other parameters. /// MUI_CONSOLE_FILTER = 0x100, /// /// GetThreadPreferredUILanguages should replace with the appropriate fallback all languages having complex scripts. When this /// flag is specified, NULL must be passed for all other parameters. /// MUI_COMPLEX_SCRIPT_FILTER = 0x200, /// /// Reset the filtering for the language list by removing any other filter settings. When this flag is specified, NULL must be /// passed for all other parameters. After setting this flag, the application can call GetThreadPreferredUILanguages to retrieve /// the complete unfiltered list. /// MUI_RESET_FILTERS = 0x001, } /// Flags identifying language format and filtering. [Flags] public enum MUI_LANGUAGE_PATH : uint { /// Pass the language identifier in the language string to the callback function. MUI_LANGUAGE_ID = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_ID, /// Pass the language name in the language string to the callback function. MUI_LANGUAGE_NAME = MUI_LANGUAGE_ENUM.MUI_LANGUAGE_NAME, /// /// Retrieve only the files that implement languages in the fallback list. Successive calls enumerate the successive fallbacks, /// in the appropriate order. The first file indicated by the output value of pcchFileMUIPath should be the best fit. This flag /// is relevant only if the application supplies a null string for pwszLanguage. /// MUI_USER_PREFERRED_UI_LANGUAGES = 0x10, /// /// Retrieve only the files for the languages installed on the computer. This flag is relevant only if the application supplies a /// null string for pwszLanguage. /// MUI_USE_INSTALLED_LANGUAGES = 0x20, /// /// Retrieve all language-specific resource files for the path indicated by pcwszFilePath, without considering file licensing. /// This flag is relevant only if the application supplies a null string for pwszLanguage. /// MUI_USE_SEARCH_ALL_LANGUAGES = 0x40, /// /// Do not verify the file passed in pcwszFilePath and append &quot;.mui&quot; to the file name before processing. For /// example, change Abc.exe to Abc.exe.mui. /// MUI_LANG_NEUTRAL_PE_FILE = 0x100, /// /// Do not verify the file passed in pcwszFilePath and do not append &quot;.mui&quot; to the file name before processing. /// For example, use Abc.txt or Abc.chm. /// MUI_NON_LANG_NEUTRAL_FILE = 0x200, /// MUI_MACHINE_LANGUAGE_SETTINGS = 0x400, } /// Flags specifying the information to retrieve in GetFileMUIInfo. [Flags] public enum MUI_QUERY { /// /// Retrieve one of the following values in the dwFileType member of FILEMUIINFO: /// /// /// /// MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL: The specified input file does not have resource configuration data. Thus it is neither an /// LN file nor a language-specific resource file. This type of file is typical for older executable files. If this file type is /// specified, the function will not retrieve useful information for the other types. /// /// /// /// MUI_FILETYPE_LANGUAGE_NEUTRAL_MAIN. The input file is an LN file. /// /// /// MUI_FILETYPE_LANGUAGE_NEUTRAL_MUI. The input file is a language-specific resource file associated with an LN file. /// /// /// MUI_QUERY_TYPE = 0x001, /// /// Retrieve the resource checksum of the input file in the pChecksum member of FILEMUIINFO. If the input file does not have /// resource configuration data, this member of the structure contains 0. /// MUI_QUERY_CHECKSUM = 0x002, /// /// Retrieve the language associated with the input file. For a language-specific resource file, this flag requests the /// associated language. For an LN file, this flag requests the language of the ultimate fallback resources for the module, which /// can be either in the LN file or in a separate language-specific resource file referenced by the resource configuration data /// of the LN file. For more information, see the Remarks section. /// MUI_QUERY_LANGUAGE_NAME = 0x004, /// /// Retrieve lists of resource types in the language-specific resource files and LN files as they are specified in the resource /// configuration data. See the Remarks section for a way to access this information. /// MUI_QUERY_RESOURCE_TYPES = 0x008, } /// Specifies the supported normalization forms. // typedef enum _NORM_FORM { NormalizationOther = 0, NormalizationC = 0x1, NormalizationD = 0x2, NormalizationKC = 0x5, // NormalizationKD = 0x6} NORM_FORM; https://msdn.microsoft.com/en-us/library/windows/desktop/dd319094(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd319094")] public enum NORM_FORM { /// Not supported. NormalizationOther = 0, /// /// Unicode normalization form C, canonical composition. Transforms each decomposed grouping, consisting of a base character plus /// combining characters, to the canonical precomposed equivalent. For example, A + ¨ becomes Ä. /// NormalizationC = 1, /// /// Unicode normalization form D, canonical decomposition. Transforms each precomposed character to its canonical decomposed /// equivalent. For example, Ä becomes A + ¨. /// NormalizationD = 2, /// /// Unicode normalization form KC, compatibility composition. Transforms each base plus combining characters to the canonical /// precomposed equivalent and all compatibility characters to their equivalents. For example, the ligature fi becomes f + i; /// similarly, A + ¨ + fi + n becomes Ä + f + i + n. /// NormalizationKC = 5, /// /// Unicode normalization form KD, compatibility decomposition. Transforms each precomposed character to its canonical decomposed /// equivalent and all compatibility characters to their equivalents. For example, Ä + fi + n becomes A + ¨ + f + i + n. /// NormalizationKD = 6, } /// Specifies the geographical location class. // enum SYSGEOCLASS { GEOCLASS_NATION = 16, GEOCLASS_REGION = 14, GEOCLASS_ALL = 0 }; https://msdn.microsoft.com/en-us/library/windows/desktop/dd374070(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd374070")] public enum SYSGEOCLASS { /// Class for nation geographical location identifiers. GEOCLASS_NATION = 16, /// Class for region geographical location identifiers. GEOCLASS_REGION = 14, /// Starting with Windows 8: Class for all geographical location identifiers. GEOCLASS_ALL = 0 } /// /// Defines the type of geographical location information requested in the GetGeoInfo or GetGeoInfoEx function. /// // enum SYSGEOTYPE { GEO_NATION = 0x0001, GEO_LATITUDE = 0x0002, GEO_LONGITUDE = 0x0003, GEO_ISO2 = 0x0004, GEO_ISO3 = 0x0005, // GEO_RFC1766 = 0x0006, GEO_LCID = 0x0007, GEO_FRIENDLYNAME = 0x0008, GEO_OFFICIALNAME = 0x0009, GEO_TIMEZONES = 0x000A, // GEO_OFFICIALLANGUAGES = 0x000B, GEO_ISO_UN_NUMBER = 0x000C, GEO_PARENT = 0x000D, GEO_DIALINGCODE = 0x000E, GEO_CURRENCYCODE = // 0x000F, GEO_CURRENCYSYMBOL = 0x0010, GEO_NAME = 0x0011, GEO_ID = 0x000E }; https://msdn.microsoft.com/en-us/library/windows/desktop/dd374071(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd374071")] public enum SYSGEOTYPE { /// /// The geographical location identifier (GEOID) of a nation. This value is stored in a long integer. /// /// Starting with Windows 10, version 1709: This value is not supported for the GetGeoInfoEx function, and should /// not be used. /// /// GEO_NATION = 1, /// The latitude of the location. This value is stored in a floating-point number. GEO_LATITUDE, /// The longitude of the location. This value is stored in a floating-point number. GEO_LONGITUDE, /// The ISO 2-letter country/region code. This value is stored in a string. GEO_ISO2, /// The ISO 3-letter country/region code. This value is stored in a string. GEO_ISO3, /// /// /// The name for a string, compliant with RFC 4646 (starting with Windows Vista), that is derived from the GetGeoInfo /// parameters language and GeoId. /// /// /// Starting with Windows 10, version 1709: This value is not supported for the GetGeoInfoEx function, and should /// not be used. /// /// GEO_RFC1766, /// /// A locale identifier derived using GetGeoInfo. /// /// Starting with Windows 10, version 1709: This value is not supported for the GetGeoInfoEx function, and should /// not be used. /// /// GEO_LCID, /// The friendly name of the nation, for example, Germany. This value is stored in a string. GEO_FRIENDLYNAME, /// The official name of the nation, for example, Federal Republic of Germany. This value is stored in a string. GEO_OFFICIALNAME, /// Not implemented. GEO_TIMEZONES, /// Not implemented. GEO_OFFICIALLANGUAGES, /// Starting with Windows 8: The ISO 3-digit country/region code. This value is stored in a string. GEO_ISO_UN_NUMBER, /// /// Starting with Windows 8: The geographical location identifier of the parent region of a country/region. This value is /// stored in a string. /// GEO_PARENT, /// /// Starting with Windows 10, version 1709: The dialing code to use with telephone numbers in the geographic location. For /// example, 1 for the United States. /// GEO_DIALINGCODE, /// /// Starting with Windows 10, version 1709: The three-letter code for the currency that the geographic location uses. For /// example, USD for United States dollars. /// GEO_CURRENCYCODE, /// /// Starting with Windows 10, version 1709: The symbol for the currency that the geographic location uses. For example, /// the dollar sign ($). /// GEO_CURRENCYSYMBOL, /// /// /// Starting with Windows 10, version 1709: The two-letter International Organization for Standardization (ISO) 3166-1 /// code or numeric United Nations (UN) Series M, Number 49 (M.49) code for the geographic region. /// /// /// For information about two-letter ISO 3166-1 codes, see Country Codes - ISO 3166. For information about numeric UN M.49 codes, /// see Standard country or area codes for statistical use (M49). /// /// GEO_NAME, /// /// Starting with Windows 10, version 1709: The Windows geographical location identifiers (GEOID) for the region. This /// value is provided for backward compatibility. Do not use this value in new applications, but use GEO_NAME instead. /// GEO_ID, } /// Specifies NLS function capabilities. // enum SYSNLS_FUNCTION { COMPARE_STRING = 0x0001 }; https://msdn.microsoft.com/en-us/library/windows/desktop/dd374072(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd374072")] public enum SYSNLS_FUNCTION { /// /// Value indicating comparison of two strings in the manner of the CompareString function or LCMapString with the LCMAP_SORTKEY /// flag specified. /// COMPARE_STRING = 0x0001 } /// The time format. [Flags] public enum TIME_FORMAT_ENUM { /// Use the current user's long time format. USE_CURRENT = 0, /// Windows 7 and later: Use the current user's short time format. TIME_NOSECONDS = 2, /// /// Specified with the ANSI version of this function, EnumTimeFormatsA (not recommended), to use the system default Windows ANSI /// code page (ACP) instead of the locale code page. /// LOCAL_USE_CP_ACP = 0x40000000 } /// Flags specifying script verification options. public enum VS_FLAGS { /// No flags NONE, /// Allow &quot;Latn&quot; (Latin script) in the test list even if it is not in the locale list. VS_ALLOW_LATIN } /// Deprecated. Adjusts a date by a specified number of years, months, weeks, or days. /// Pointer to a CALDATETIME structure that contains the date and calendar information to adjust. /// The CALDATETIME_DATEUNIT enumeration value indicating the date unit, for example, DayUnit. /// The amount by which to adjust the specified date. /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// /// ERROR_DATE_OUT_OF_RANGE. The specified date was out of range. /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with the module handle and the name of this /// function to get the function address. /// // https://docs.microsoft.com/en-us/windows/win32/intl/adjustcalendardate BOOL AdjustCalendarDate( _Inout_ LPCALDATETIME // lpCalDateTime, _In_ CALDATETIME_DATEUNIT calUnit, _Out_ INT amount ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "be8d61fd-efa3-4386-969f-30216c282ebc")] // [return: MarshalAs(UnmanagedType.Bool)] public static extern bool AdjustCalendarDate(Inout_ LPCALDATETIME lpCalDateTime, In_ // CALDATETIME_DATEUNIT calUnit, Out_ int amount); [return: MarshalAs(UnmanagedType.Bool)] public static extern bool AdjustCalendarDate(ref CALDATETIME lpCalDateTime, CALDATETIME_DATEUNIT calUnit, int amount); /// /// Deprecated. Converts a specified CALDATETIME structure to a SYSTEMTIME structure. /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// ERROR_DATE_OUT_OF_RANGE. The specified date was out of range. /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with the module handle and the name of this /// function to get the function address. /// /// // https://docs.microsoft.com/en-us/windows/desktop/Intl/convertcaldatetimetosystemtime BOOL ConvertCalDateTimeToSystemTime( _In_ // const LPCALDATETIME lpCalDateTime, _Out_ SYSTEMTIME *lpSysTime ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "0c3f602d-62de-4c27-95d9-d35738f3279d")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ConvertCalDateTimeToSystemTime(in CALDATETIME lpCalDateTime, out SYSTEMTIME lpSysTime); /// Converts a default locale value to an actual locale identifier. /// /// /// Default locale identifier value to convert. You can use the MAKELCID macro to create a locale identifier or use one of the /// following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Returns the appropriate locale identifier if successful. /// /// This function returns the value of the Locale parameter if it does not succeed. The function fails when the Locale value is not /// one of the default values listed above. /// /// // LCID ConvertDefaultLocale( _In_ LCID Locale); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317768(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd317768")] public static extern LCID ConvertDefaultLocale(LCID Locale); /// /// Deprecated. Converts a specified SYSTEMTIME structure to a CALDATETIME structure. /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// The earliest date supported by this function is January 1, 1601. /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with the module handle and the name of this /// function to get the function address. /// /// // https://docs.microsoft.com/en-us/windows/desktop/Intl/convertsystemtimetocaldatetime BOOL ConvertSystemTimeToCalDateTime( _In_ // const SYSTEMTIME lpSysTime, _In_ CALID calId, _Out_ LPCALDATETIME lpCalDateTime ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "d21f75bc-1a93-4cb9-8b9b-6fa0e81886bf")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ConvertSystemTimeToCalDateTime(SYSTEMTIME lpSysTime, CALID calId, out CALDATETIME lpCalDateTime); /// Enumerates calendar information for a specified locale. /// Pointer to an application-defined callback function. For more information, see EnumCalendarInfoProc. /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to /// create a locale identifier or use one of the following predefined values. /// /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumCalendarInfo( _In_ CALINFO_ENUMPROC pCalInfoEnumProc, _In_ LCID Locale, _In_ CALID Calendar, _In_ CALTYPE CalType); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317803(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317803")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumCalendarInfo(EnumCalendarInfoProc pCalInfoEnumProc, LCID Locale, CALID Calendar, CALTYPE CalType); /// Enumerates calendar information for a specified locale. /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to /// create a locale identifier or use one of the following predefined values. /// /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// The requested list of calendar information. [PInvokeData("Winnls.h", MSDNShortId = "dd317803")] public static IEnumerable EnumCalendarInfo(LCID Locale, CALID Calendar, CALTYPE CalType) { var l = new List(); if (!EnumCalendarInfo(s => { l.Add(s); return true; }, Locale, Calendar, CalType)) Win32Error.ThrowLastError(); return l; } /// Enumerates calendar information for a locale specified by identifier. /// Pointer to an application-defined callback function. For more information, see EnumCalendarInfoProcEx. /// /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to /// create an identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumCalendarInfoEx( _In_ CALINFO_ENUMPROCEX pCalInfoEnumProcEx, _In_ LCID Locale, _In_ CALID Calendar, _In_ CALTYPE CalType); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317804(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317804")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumCalendarInfoEx(EnumCalendarInfoProcEx pCalInfoEnumProcEx, LCID Locale, CALID Calendar, CALTYPE CalType); /// Enumerates calendar information for a locale specified by identifier. /// /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to /// create an identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// The requested list of calendar information. [PInvokeData("Winnls.h", MSDNShortId = "dd317804")] public static IEnumerable<(CALID, string)> EnumCalendarInfoEx(LCID Locale, CALID Calendar, CALTYPE CalType) { var l = new List<(CALID, string)>(); if (!EnumCalendarInfoEx((s, c) => { l.Add((c, s)); return true; }, Locale, Calendar, CalType)) Win32Error.ThrowLastError(); return l; } /// Enumerates calendar information for a locale specified by name. /// Pointer to an application-defined callback function. For more information, see EnumCalendarInfoProcExEx. /// Pointer to a locale name, or one of the following predefined values. /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// Reserved; must be NULL. /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// /// Application-provided parameter to pass to the callback function. This value is especially useful for multi-threaded applications. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumCalendarInfoExEx( _In_ CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, _In_opt_ LPCWSTR lpLocaleName, _In_ CALID Calendar, // _In_opt_ LPCWSTR lpReserved, _In_ CALTYPE CalType, _In_ LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317805(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317805")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumCalendarInfoExEx(EnumCalendarInfoProcExEx pCalInfoEnumProcExEx, string lpLocaleName, CALID Calendar, [Optional] string lpReserved, CALTYPE CalType, [Optional] IntPtr lParam); /// Enumerates calendar information for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Calendar identifier that specifies the calendar for which information is requested. Note that this identifier can be /// ENUM_ALL_CALENDARS, to enumerate all calendars that are associated with the locale. /// /// /// Type of calendar information. For more information, see Calendar Type Information. Only one calendar type can be specified per /// call to this function, except where noted. /// /// The requested list of calendar information. [PInvokeData("Winnls.h", MSDNShortId = "dd317805")] public static IEnumerable<(CALID, string)> EnumCalendarInfoExEx(string lpLocaleName, CALID Calendar, CALTYPE CalType) { var l = new List<(CALID, string)>(); if (!EnumCalendarInfoExEx((s, c, i, p) => { l.Add((c, s)); return true; }, lpLocaleName, Calendar, null, CalType)) Win32Error.ThrowLastError(); return l; } /// Enumerates the long date, short date, or year/month formats that are available for a specified locale. /// Pointer to an application-defined callback function. For more information, see EnumDateFormatsProc. /// /// Locale identifier that specifies the locale for which to retrieve date format information. You can use the MAKELCID macro /// to create an identifier or use one of the following predefined values. /// /// Flag specifying date formats. For detailed definitions, see the dwFlags parameter of EnumDateFormatsExEx. /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumDateFormats( _In_ DATEFMT_ENUMPROC lpDateFmtEnumProc, _In_ LCID Locale, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317810(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317810")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumDateFormats(EnumDateFormatsProc lpDateFmtEnumProc, LCID Locale, DATE_FORMAT dwFlags); /// Enumerates the long date, short date, or year/month formats that are available for a specified locale. /// /// Locale identifier that specifies the locale for which to retrieve date format information. You can use the MAKELCID macro /// to create an identifier or use one of the following predefined values. /// /// Flag specifying date formats. For detailed definitions, see the dwFlags parameter of EnumDateFormatsExEx. /// Returns the list of requested formats. [PInvokeData("Winnls.h", MSDNShortId = "dd317810")] public static IEnumerable EnumDateFormats(LCID Locale, DATE_FORMAT dwFlags) { var l = new List(); if (!EnumDateFormats(s => { l.Add(s); return true; }, Locale, dwFlags)) Win32Error.ThrowLastError(); return l; } /// Enumerates the long date, short date, or year/month formats that are available for a specified locale. /// Pointer to an application-defined callback function. For more information, see EnumDateFormatsProcEx. /// /// /// Locale identifier that specifies the locale for which to retrieve date format information. You can use the MAKELCID macro /// to create an identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// Flag specifying date formats. For detailed definitions, see the dwFlags parameter of EnumDateFormatsExEx. /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumDateFormatsEx( _In_ DATEFMT_ENUMPROCEX lpDateFmtEnumProcEx, _In_ LCID Locale, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317811(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317811")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumDateFormatsEx(EnumDateFormatsProcEx lpDateFmtEnumProcEx, LCID Locale, DATE_FORMAT dwFlags); /// Enumerates the long date, short date, or year/month formats that are available for a specified locale. /// /// /// Locale identifier that specifies the locale for which to retrieve date format information. You can use the MAKELCID macro /// to create an identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// Flag specifying date formats. For detailed definitions, see the dwFlags parameter of EnumDateFormatsExEx. /// Returns the list of requested formats. [PInvokeData("Winnls.h", MSDNShortId = "dd317811")] public static IEnumerable<(CALID, string)> EnumDateFormatsEx(LCID Locale, DATE_FORMAT dwFlags) { var l = new List<(CALID, string)>(); if (!EnumDateFormatsEx((s, c) => { l.Add((c, s)); return true; }, Locale, dwFlags)) Win32Error.ThrowLastError(); return l; } /// Enumerates the long date, short date, or year/month formats that are available for a locale specified by name. /// Pointer to an application-defined callback function. For more information, see EnumDateFormatsProcExEx. /// Pointer to a locale name, or one of the following predefined values. /// /// Flag specifying date formats. The application can supply one of the following values or the LOCALE_USE_CP_ACP constant. /// /// /// /// Value /// Meaning /// /// /// DATE_SHORTDATE /// Use short date formats. This value cannot be used with any of the other flag values. /// /// /// DATE_LONGDATE /// Use long date formats. This value cannot be used with any of the other flag values. /// /// /// DATE_YEARMONTH /// Use year/month formats. This value cannot be used with any of the other flag values. /// /// /// DATE_MONTHDAY /// Use month/day formats. This value cannot be used with any of the other flag values. /// /// /// /// /// /// An application-provided parameter to pass to the callback function. This value is especially useful for multi-threaded applications. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumDateFormatsExEx( _In_ DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ // LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317812(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317812")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumDateFormatsExEx(EnumDateFormatsProcExEx lpDateFmtEnumProcExEx, string lpLocaleName, DATE_FORMAT dwFlags, [Optional] IntPtr lParam); /// Enumerates the long date, short date, or year/month formats that are available for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Flag specifying date formats. The application can supply one of the following values or the LOCALE_USE_CP_ACP constant. /// /// /// /// Value /// Meaning /// /// /// DATE_SHORTDATE /// Use short date formats. This value cannot be used with any of the other flag values. /// /// /// DATE_LONGDATE /// Use long date formats. This value cannot be used with any of the other flag values. /// /// /// DATE_YEARMONTH /// Use year/month formats. This value cannot be used with any of the other flag values. /// /// /// DATE_MONTHDAY /// Use month/day formats. This value cannot be used with any of the other flag values. /// /// /// /// /// Returns the list of requested formats. public static IEnumerable<(CALID, string)> EnumDateFormatsExEx(string lpLocaleName, DATE_FORMAT dwFlags) { var l = new List<(CALID, string)>(); if (!EnumDateFormatsExEx((s, c, p) => { l.Add((c, s)); return true; }, lpLocaleName, dwFlags)) Win32Error.ThrowLastError(); return l; } /// Enumerates the locales in a specified language group. /// Pointer to an application-defined callback function. For more information, see EnumLanguageGroupLocalesProc. /// /// Identifier of the language group for which to enumerate locales. This parameter can have one of the following values: /// /// Reserved; must be 0. /// /// An application-defined value to pass to the callback function. This value can be used for error checking. It can also be used to /// ensure thread safety in the callback function. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumLanguageGroupLocales( _In_ LANGGROUPLOCALE_ENUMPROC lpLangGroupLocaleEnumProc, _In_ LGRPID LanguageGroup, _In_ DWORD // dwFlags, _In_ LONG_PTR lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317819(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317819")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumLanguageGroupLocales(EnumLanguageGroupLocalesProc lpLangGroupLocaleEnumProc, LGRPID LanguageGroup, [Optional] uint dwFlags, [Optional] IntPtr lParam); /// Enumerates the locales in a specified language group. /// /// Identifier of the language group for which to enumerate locales. This parameter can have one of the following values: /// /// Returns the list of requested group locales. [PInvokeData("Winnls.h", MSDNShortId = "dd317819")] public static IEnumerable<(LGRPID, LCID, string)> EnumLanguageGroupLocales(LGRPID LanguageGroup) { var list = new List<(LGRPID, LCID, string)>(); if (!EnumLanguageGroupLocales((g, l, s, p) => { list.Add((g, l, s)); return true; }, LanguageGroup)) Win32Error.ThrowLastError(); return list; } /// Enumerates the code pages that are either installed on or supported by an operating system. /// /// Pointer to an application-defined callback function. The EnumSystemCodePages function enumerates code pages by making /// repeated calls to this callback function. For more information, see EnumCodePagesProc. /// /// /// Flag specifying the code pages to enumerate. This parameter can have one of the following values, which are mutually exclusive. /// /// /// /// Value /// Meaning /// /// /// CP_INSTALLED /// Enumerate only installed code pages. /// /// /// CP_SUPPORTED /// Enumerate all supported code pages. /// /// /// /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumSystemCodePages( _In_ CODEPAGE_ENUMPROC lpCodePageEnumProc, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317825(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317825")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemCodePages(EnumCodePagesProc lpCodePageEnumProc, CP_FLAGS dwFlags); /// Enumerates the code pages that are either installed on or supported by an operating system. /// /// Flag specifying the code pages to enumerate. This parameter can have one of the following values, which are mutually exclusive. /// /// /// /// Value /// Meaning /// /// /// CP_INSTALLED /// Enumerate only installed code pages. /// /// /// CP_SUPPORTED /// Enumerate all supported code pages. /// /// /// /// /// List of code pages. [PInvokeData("Winnls.h", MSDNShortId = "dd317825")] public static IEnumerable EnumSystemCodePages(CP_FLAGS dwFlags) { var list = new List(); if (!EnumSystemCodePages(s => { list.Add(s); return true; }, dwFlags)) Win32Error.ThrowLastError(); return list; } /// /// /// [ EnumSystemGeoID is available for use in the operating systems specified in the Requirements section. It may be altered /// or unavailable in subsequent versions. Instead, use EnumSystemGeoNames.] /// /// Enumerates the geographical location identifiers (type GEOID) that are available on the operating system. /// /// /// Geographical location class for which to enumerate the identifiers. At present, only GEOCLASS_NATION is supported. This type /// causes the function to enumerate all geographical identifiers for nations on the operating system. /// /// Reserved. This parameter must be 0. /// /// Pointer to the application-defined callback function EnumGeoInfoProc. The EnumSystemGeoID function makes repeated /// calls to this callback function until it returns FALSE. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumSystemGeoID( _In_ GEOCLASS GeoClass, _In_ GEOID ParentGeoId, _In_ GEO_ENUMPROC lpGeoEnumProc); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317826(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd317826")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemGeoID(SYSGEOCLASS GeoClass, [Optional] int ParentGeoId, EnumGeoInfoProc lpGeoEnumProc); /// /// /// [ EnumSystemGeoID is available for use in the operating systems specified in the Requirements section. It may be altered /// or unavailable in subsequent versions. Instead, use EnumSystemGeoNames.] /// /// Enumerates the geographical location identifiers (type GEOID) that are available on the operating system. /// /// /// Geographical location class for which to enumerate the identifiers. At present, only GEOCLASS_NATION is supported. This type /// causes the function to enumerate all geographical identifiers for nations on the operating system. /// /// List of geographical location identifiers. [PInvokeData("Winnls.h", MSDNShortId = "dd317826")] public static IEnumerable EnumSystemGeoID(SYSGEOCLASS GeoClass = 0) { var list = new List(); if (!EnumSystemGeoID(GeoClass, 0, i => { list.Add(i); return true; })) Win32Error.ThrowLastError(); return list; } /// /// Enumerates the two-letter International Organization for Standardization (ISO) 3166-1 codes or numeric United Nations (UN) Series /// M, Number 49 (M.49) codes for geographical locations that are available on the operating system. /// /// /// The geographical location class for which to enumerate the available two-letter ISO 3166-1 or numeric UN M.49 codes. /// /// /// Pointer to the application-defined callback function Geo_EnumNameProc. The EnumSystemGeoNames function calls this callback /// function for each of the two-letter ISO 3166-1 or numeric UN M.49 codes for geographical locations that are available on the /// operating system until callback function returns FALSE. /// /// Application-specific information to pass to the callback function that the genEnumProc parameter specifies. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, call GetLastError, which can /// return one of the following error codes: /// /// /// /// /// Return code /// Description /// /// /// ERROR_INVALID_FLAGS /// The values supplied for flags were not valid. /// /// /// ERROR_INVALID_PARAMETER /// A parameter value was not valid. /// /// /// /// // BOOL WINAPI EnumSystemGeoNames( _In_ GEOCLASS geoClass, _In_ GEO_ENUMNAMEPROC geoEnumProc, _In_opt_ LPARAM data); https://msdn.microsoft.com/en-us/library/windows/desktop/mt826465(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "mt826465")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemGeoNames(SYSGEOCLASS geoClass, Geo_EnumNameProc geoEnumProc, [Optional] IntPtr data); /// /// Enumerates the two-letter International Organization for Standardization (ISO) 3166-1 codes or numeric United Nations (UN) Series /// M, Number 49 (M.49) codes for geographical locations that are available on the operating system. /// /// /// The geographical location class for which to enumerate the available two-letter ISO 3166-1 or numeric UN M.49 codes. /// /// /// List of the two-letter International Organization for Standardization (ISO) 3166-1 codes or numeric United Nations (UN) Series M, /// Number 49 (M.49) codes for geographical locations /// [PInvokeData("Winnls.h", MSDNShortId = "mt826465")] public static IEnumerable EnumSystemGeoNames(SYSGEOCLASS geoClass = 0) { var list = new List(); if (!EnumSystemGeoNames(geoClass, (s, p) => { list.Add(s); return true; })) Win32Error.ThrowLastError(); return list; } /// Enumerates the language groups that are either installed on or supported by an operating system. /// Pointer to an application-defined callback function. For more information, see EnumLanguageGroupsProc. /// /// Flags specifying the language group identifiers to enumerate. This parameter can have one of the following values. /// /// /// /// Value /// Meaning /// /// /// LGRPID_INSTALLED /// Enumerate only installed language group identifiers. /// /// /// LGRPID_SUPPORTED /// Enumerate all supported language group identifiers. /// /// /// /// /// /// Application-defined value to pass to the callback function. This parameter can be used in error checking. It can also be used to /// ensure thread safety in the callback function. /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumSystemLanguageGroups( _In_ LANGUAGEGROUP_ENUMPROC lpLanguageGroupEnumProc, _In_ DWORD dwFlags, _In_ LONG_PTR lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317827(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317827")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemLanguageGroups(EnumLanguageGroupsProc lpLanguageGroupEnumProc, LGRPID_FLAGS dwFlags, [Optional] IntPtr lParam); /// Enumerates the language groups that are either installed on or supported by an operating system. /// /// Flags specifying the language group identifiers to enumerate. This parameter can have one of the following values. /// /// /// /// Value /// Meaning /// /// /// LGRPID_INSTALLED /// Enumerate only installed language group identifiers. /// /// /// LGRPID_SUPPORTED /// Enumerate all supported language group identifiers. /// /// /// /// /// List of the language groups. public static IEnumerable<(LGRPID LanguageGroup, string lpLanguageGroupString, string lpLanguageGroupNameString, LGRPID_FLAGS dwFlags)> EnumSystemLanguageGroups(LGRPID_FLAGS dwFlags = 0) { var list = new List<(LGRPID LanguageGroup, string lpLanguageGroupString, string lpLanguageGroupNameString, LGRPID_FLAGS dwFlags)>(); if (!EnumSystemLanguageGroups((g, gs, gn, f, p) => { list.Add((g, gs, gn, f)); return true; }, dwFlags)) Win32Error.ThrowLastError(); return list; } /// Enumerates the locales that are either installed on or supported by an operating system. /// Pointer to an application-defined callback function. For more information, see EnumLocalesProc. /// /// /// Flags specifying the locale identifiers to enumerate. The flags can be used singly or combined using a binary OR. If the /// application specifies 0 for this parameter, the function behaves as for LCID_SUPPORTED. /// /// /// /// /// Value /// Meaning /// /// /// LCID_INSTALLED /// Enumerate only installed locale identifiers. This value cannot be used with LCID_SUPPORTED. /// /// /// LCID_SUPPORTED /// Enumerate all supported locale identifiers. This value cannot be used with LCID_INSTALLED. /// /// /// LCID_ALTERNATE_SORTS /// /// Enumerate only the alternate sort locale identifiers. If this value is used with either LCID_INSTALLED or LCID_SUPPORTED, the /// installed or supported locales are retrieved, as well as the alternate sort locale identifiers. /// /// /// /// /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumSystemLocales( _In_ LOCALE_ENUMPROC lpLocaleEnumProc, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317828(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317828")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemLocales(EnumLocalesProc lpLocaleEnumProc, LCID_FLAGS dwFlags); /// Enumerates the locales that are either installed on or supported by an operating system. /// /// /// Flags specifying the locale identifiers to enumerate. The flags can be used singly or combined using a binary OR. If the /// application specifies 0 for this parameter, the function behaves as for LCID_SUPPORTED. /// /// /// /// /// Value /// Meaning /// /// /// LCID_INSTALLED /// Enumerate only installed locale identifiers. This value cannot be used with LCID_SUPPORTED. /// /// /// LCID_SUPPORTED /// Enumerate all supported locale identifiers. This value cannot be used with LCID_INSTALLED. /// /// /// LCID_ALTERNATE_SORTS /// /// Enumerate only the alternate sort locale identifiers. If this value is used with either LCID_INSTALLED or LCID_SUPPORTED, the /// installed or supported locales are retrieved, as well as the alternate sort locale identifiers. /// /// /// /// /// /// List of system locales. [PInvokeData("Winnls.h", MSDNShortId = "dd317828")] public static IEnumerable EnumSystemLocales(LCID_FLAGS dwFlags) { var list = new List(); if (!EnumSystemLocales(s => { list.Add(s); return true; }, dwFlags)) Win32Error.ThrowLastError(); return list; } /// Enumerates the locales that are either installed on or supported by an operating system. /// /// Pointer to an application-defined callback function. The EnumSystemLocalesEx function enumerates locales by making /// repeated calls to this callback function. For more information, see EnumLocalesProcEx. /// /// /// Flags identifying the locales to enumerate. The flags can be used singly or combined using a binary OR. If the application /// specifies 0 for this parameter, the function behaves as for LOCALE_ALL. /// /// /// An application-provided parameter to be passed to the callback function. This is especially useful for multi-threaded applications. /// /// Reserved; must be NULL. /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumSystemLocalesEx( _In_ LOCALE_ENUMPROCEX lpLocaleEnumProcEx, _In_ DWORD dwFlags, _In_ LPARAM lParam, _In_opt_ LPVOID // lpReserved); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317829(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317829")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumSystemLocalesEx(EnumLocalesProcEx lpLocaleEnumProcEx, LOCALE_FLAGS dwFlags, [Optional] IntPtr lParam, [Optional] IntPtr lpReserved); /// Enumerates the locales that are either installed on or supported by an operating system. /// /// Flags identifying the locales to enumerate. The flags can be used singly or combined using a binary OR. If the application /// specifies 0 for this parameter, the function behaves as for LOCALE_ALL. /// /// A sequence of locale string and flags. public static IEnumerable<(string lpLocaleString, LOCALE_FLAGS dwFlags)> EnumSystemLocalesEx(LOCALE_FLAGS dwFlags) { var list = new List<(string, LOCALE_FLAGS)>(); if (!EnumSystemLocalesEx((s, f, p) => { list.Add((s, f)); return true; }, dwFlags)) Win32Error.ThrowLastError(); return list; } /// Enumerates the time formats that are available for a locale specified by identifier. /// Pointer to an application-defined callback function. For more information, see EnumTimeFormatsProc. /// /// Locale identifier that specifies the locale for which to retrieve time format information. You can use the MAKELCID macro /// to create a locale identifier or use one of the following predefined values. /// /// /// The time format. This parameter can specify a combination of any of the following values. /// /// /// /// Flag /// Meaning /// /// /// 0 /// Use the current user's long time format. /// /// /// TIME_NOSECONDS /// Windows 7 and later: Use the current user's short time format. /// /// /// LOCAL_USE_CP_ACP /// /// Specified with the ANSI version of this function, EnumTimeFormatsA (not recommended), to use the system default Windows ANSI code /// page (ACP) instead of the locale code page. /// /// /// /// /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumTimeFormats( _In_ TIMEFMT_ENUMPROC lpTimeFmtEnumProc, _In_ LCID Locale, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317830(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317830")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumTimeFormats(EnumTimeFormatsProc lpTimeFmtEnumProc, LCID Locale, TIME_FORMAT_ENUM dwFlags); /// Enumerates the time formats that are available for a locale specified by identifier. /// /// Locale identifier that specifies the locale for which to retrieve time format information. You can use the MAKELCID macro /// to create a locale identifier or use one of the following predefined values. /// /// /// The time format. This parameter can specify a combination of any of the following values. /// /// /// /// Flag /// Meaning /// /// /// 0 /// Use the current user's long time format. /// /// /// TIME_NOSECONDS /// Windows 7 and later: Use the current user's short time format. /// /// /// LOCAL_USE_CP_ACP /// /// Specified with the ANSI version of this function, EnumTimeFormatsA (not recommended), to use the system default Windows ANSI code /// page (ACP) instead of the locale code page. /// /// /// /// /// /// List of time formats. [PInvokeData("Winnls.h", MSDNShortId = "dd317830")] public static IEnumerable EnumTimeFormats(LCID Locale, TIME_FORMAT_ENUM dwFlags) { var list = new List(); if (!EnumTimeFormats(s => { list.Add(s); return true; }, Locale, dwFlags)) Win32Error.ThrowLastError(); return list; } /// Enumerates the time formats that are available for a locale specified by name. /// Pointer to an application-defined callback function. For more information, see EnumTimeFormatsProcEx. /// Pointer to a locale name, or one of the following predefined values. /// /// The time format. Set to 0 to use the current user's long time format, or TIME_NOSECONDS (starting with Windows 7) to use the /// short time format. /// /// /// An application-provided parameter to be passed to the callback function. This is especially useful for multi-threaded applications. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumTimeFormatsEx( _In_ TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ // LPARAM lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317831(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd317831")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumTimeFormatsEx(EnumTimeFormatsProcEx lpTimeFmtEnumProcEx, string lpLocaleName, TIME_FORMAT_ENUM dwFlags, [Optional] IntPtr lParam); /// Enumerates the time formats that are available for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// The time format. Set to 0 to use the current user's long time format, or TIME_NOSECONDS (starting with Windows 7) to use the /// short time format. /// /// List of time formats. [PInvokeData("Winnls.h", MSDNShortId = "dd317831")] public static IEnumerable EnumTimeFormatsEx(string lpLocaleName, TIME_FORMAT_ENUM dwFlags) { var list = new List(); if (!EnumTimeFormatsEx((s, p) => { list.Add(s); return true; }, lpLocaleName, dwFlags)) Win32Error.ThrowLastError(); return list; } /// /// Enumerates the user interface languages that are available on the operating system and calls the callback function with every /// language in the list. /// /// /// Pointer to an application-defined EnumUILanguagesProc callback function. EnumUILanguages calls this function /// repeatedly to enumerate the languages in the list. /// /// /// /// Flags identifying language format and filtering. The following flags specify the format of the language to pass to the callback /// function. The format flags are mutually exclusive, and MUI_LANGUAGE_ID is the default. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Pass the language identifier in the language string to the callback function. /// /// /// MUI_LANGUAGE_NAME /// Pass the language name in the language string to the callback function. /// /// /// /// /// The following flags specify the filtering for the function to use in enumerating the languages. The filtering flags are mutually /// exclusive, and the default is MUI_LICENSED_LANGUAGES. /// /// /// /// /// Value /// Meaning /// /// /// MUI_ALL_INSTALLED_LANGUAGES /// Enumerate all installed languages available to the operating system. /// /// /// MUI_LICENSED_LANGUAGES /// Enumerate all installed languages that are available and licensed for use. /// /// /// MUI_GROUP_POLICY /// Enumerate all installed languages that are available and licensed, and that are allowed by the group policy. /// /// /// /// /// Windows Vista and later: The application can set dwFlags to 0, or to one or more of the specified flags. A setting of 0 /// causes the parameter value to default to MUI_LANGUAGE_ID | MUI_LICENSED_LANGUAGES. /// /// Windows 2000, Windows XP, Windows Server 2003: The application must set dwFlags to 0. /// /// Application-defined value. /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL EnumUILanguages( _In_ UILANGUAGE_ENUMPROC lpUILanguageEnumProc, _In_ DWORD dwFlags, _In_ LONG_PTR lParam); https://msdn.microsoft.com/en-us/library/windows/desktop/dd317834(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd317834")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumUILanguages(EnumUILanguagesProc lpUILanguageEnumProc, MUI_LANGUAGE_ENUM dwFlags, [Optional] IntPtr lParam); /// /// Enumerates the user interface languages that are available on the operating system and calls the callback function with every /// language in the list. /// /// /// /// Flags identifying language format and filtering. The following flags specify the format of the language to pass to the callback /// function. The format flags are mutually exclusive, and MUI_LANGUAGE_ID is the default. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Pass the language identifier in the language string to the callback function. /// /// /// MUI_LANGUAGE_NAME /// Pass the language name in the language string to the callback function. /// /// /// /// /// The following flags specify the filtering for the function to use in enumerating the languages. The filtering flags are mutually /// exclusive, and the default is MUI_LICENSED_LANGUAGES. /// /// /// /// /// Value /// Meaning /// /// /// MUI_ALL_INSTALLED_LANGUAGES /// Enumerate all installed languages available to the operating system. /// /// /// MUI_LICENSED_LANGUAGES /// Enumerate all installed languages that are available and licensed for use. /// /// /// MUI_GROUP_POLICY /// Enumerate all installed languages that are available and licensed, and that are allowed by the group policy. /// /// /// /// /// Windows Vista and later: The application can set dwFlags to 0, or to one or more of the specified flags. A setting of 0 /// causes the parameter value to default to MUI_LANGUAGE_ID | MUI_LICENSED_LANGUAGES. /// /// Windows 2000, Windows XP, Windows Server 2003: The application must set dwFlags to 0. /// /// List of UI languages. [PInvokeData("Winnls.h", MSDNShortId = "dd317834")] public static IEnumerable EnumUILanguages(MUI_LANGUAGE_ENUM dwFlags) { var list = new List(); if (!EnumUILanguages((s, p) => { list.Add(s); return true; }, dwFlags)) Win32Error.ThrowLastError(); return list; } /// /// Locates a Unicode string (wide characters) or its equivalent in another Unicode string for a locale specified by identifier. /// /// /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create an identifier or use one of the /// following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Flags specifying details of the find operation. For detailed definitions, see the dwFindNLSStringFlags parameter of FindNLSStringEx. /// /// Pointer to the source string, in which the function searches for the string specified by lpStringValue. /// /// Size, in characters excluding the terminating null character, of the string indicated by lpStringSource. The application cannot /// specify 0 or any negative number other than -1 for this parameter. The application specifies -1 if the source string is /// null-terminated and the function should calculate the size automatically. /// /// Pointer to the search string, for which the function searches in the source string. /// /// Size, in characters excluding the terminating null character, of the string indicated by lpStringValue. The application cannot /// specify 0 or any negative number other than -1 for this parameter. The application specifies -1 if the search string is /// null-terminated and the function should calculate the size automatically. /// /// /// Pointer to a buffer containing the length of the string that the function finds. For details, see the pcchFound parameter of FindNLSStringEx. /// /// /// /// Returns a 0-based index into the source string indicated by lpStringSource if successful. In combination with the value in /// pcchFound, this index provides the exact location of the entire found string in the source string. A return value of 0 is an /// error-free index into the source string, and the matching string is in the source string at offset 0. /// /// /// The function returns -1 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int FindNLSString( _In_ LCID Locale, _In_ DWORD dwFindNLSStringFlags, _In_ LPCWSTR lpStringSource, _In_ int cchSource, _In_ // LPCWSTR lpStringValue, _In_ int cchValue, _Out_opt_ LPINT pcchFound); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318056(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318056")] public static extern int FindNLSString(LCID Locale, COMPARE_STRING dwFindNLSStringFlags, string lpStringSource, int cchSource, string lpStringValue, int cchValue, out int pcchFound); /// /// Locates a Unicode string (wide characters) or its equivalent in another Unicode string for a locale specified by name. /// /// Pointer to a locale name, or one of the following predefined values. /// /// /// Flags specifying details of the find operation. These flags are mutually exclusive, with FIND_FROMSTART being the default. The /// application can specify just one of the find flags with any of the filtering flags defined in the next table. If the application /// does not specify a flag, the function uses the default comparison for the specified locale. As discussed in Handling Sorting in /// Your Applications, there is no binary comparison mode. /// /// /// /// /// Value /// Meaning /// /// /// FIND_FROMSTART /// Search the string, starting with the first character of the string. /// /// /// FIND_FROMEND /// Search the string in the reverse direction, starting with the last character of the string. /// /// /// FIND_STARTSWITH /// Test to find out if the value specified by lpStringValue is the first value in the source string indicated by lpStringSource. /// /// /// FIND_ENDSWITH /// Test to find out if the value specified by lpStringValue is the last value in the source string indicated by lpStringSource. /// /// /// /// The application can use the filtering flags defined below in combination with a find flag. /// /// /// /// Value /// Meaning /// /// /// LINGUISTIC_IGNORECASE /// Ignore case in the search, as linguistically appropriate. For more information, see the Remarks section. /// /// /// LINGUISTIC_IGNOREDIACRITIC /// Ignore diacritics, as linguistically appropriate. For more information, see the Remarks section. /// /// /// NORM_IGNORECASE /// Ignore case in the search. For more information, see the Remarks section. /// /// /// NORM_IGNOREKANATYPE /// /// Do not differentiate between hiragana and katakana characters. Corresponding hiragana and katakana characters compare as equal. /// /// /// /// NORM_IGNORENONSPACE /// Ignore nonspacing characters. For more information, see the Remarks section. /// /// /// NORM_IGNORESYMBOLS /// Ignore symbols and punctuation. /// /// /// NORM_IGNOREWIDTH /// /// Ignore the difference between half-width and full-width characters, for example, C a t == cat. The full-width form is a /// formatting distinction used in Chinese and Japanese scripts. /// /// /// /// NORM_LINGUISTIC_CASING /// Use linguistic rules for casing, instead of file system rules (default). For more information, see the Remarks section. /// /// /// /// /// Pointer to the source string, in which the function searches for the string specified by lpStringValue. /// /// Size, in characters excluding the terminating null character, of the string indicated by lpStringSource. The application cannot /// specify 0 or any negative number other than -1 for this parameter. The application specifies -1 if the source string is /// null-terminated and the function should calculate the size automatically. /// /// Pointer to the search string, for which the function searches in the source string. /// /// Size, in characters excluding the terminating null character, of the string indicated by lpStringValue. The application cannot /// specify 0 or any negative number other than -1 for this parameter. The application specifies -1 if the search string is /// null-terminated and the function should calculate the size automatically. /// /// /// /// Pointer to a buffer containing the length of the string that the function finds. The string can be either longer or shorter than /// the search string. If the function fails to find the search string, this parameter is not modified. /// /// /// The function can retrieve NULL in this parameter. In this case, the function makes no indication if the length of the /// found string differs from the length of the source string. /// /// /// Note that the value of pcchFound is often identical to the value provided in cchValue, but can differ in the following cases: /// /// /// Reserved; must be NULL. /// Reserved; must be NULL. /// Reserved; must be 0. /// /// /// Returns a 0-based index into the source string indicated by lpStringSource if successful. In combination with the value in /// pcchFound, this index provides the exact location of the entire found string in the source string. A return value of 0 is an /// error-free index into the source string, and the matching string is in the source string at offset 0. /// /// /// The function returns -1 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int FindNLSStringEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFindNLSStringFlags, _In_ LPCWSTR lpStringSource, _In_ int // cchSource, _In_ LPCWSTR lpStringValue, _In_ int cchValue, _Out_opt_ LPINT pcchFound, _In_opt_ LPNLSVERSIONINFO // lpVersionInformation, _In_opt_ LPVOID lpReserved, _In_opt_ LPARAM sortHandle); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318059(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318059")] public static extern int FindNLSStringEx(string lpLocaleName, COMPARE_STRING dwFindNLSStringFlags, string lpStringSource, int cchSource, string lpStringValue, int cchValue, out int pcchFound, [Optional] IntPtr lpVersionInformation, [Optional] IntPtr lpReserved, [Optional] IntPtr sortHandle); /// Retrieves the current Windows ANSI code page identifier for the operating system. /// /// Returns the current Windows ANSI code page (ACP) identifier for the operating system. See Code Page Identifiers for a list of /// identifiers for Windows ANSI code pages and other code pages. /// // UINT GetACP(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318070(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318070")] public static extern uint GetACP(); /// /// Deprecated. Retrieves a properly formatted date string for the specified locale using the specified date and calendar. The user /// can specify the short date format, the long date format, the year month format, or a custom format pattern. /// /// /// Pointer to a locale name, or one of the following predefined values. /// /// /// LOCALE_NAME_INVARIANT /// /// /// LOCALE_NAME_SYSTEM_DEFAULT /// /// /// LOCALE_NAME_USER_DEFAULT /// /// /// /// /// Flags specifying date format options. If lpFormat is not set to NULL, this parameter must be set to 0. If lpFormat is set to /// NULL, the application can specify a combination of the following values and LOCALE_NOUSEROVERRIDE. /// /// Pointer to a CALDATETIME structure that contains the date and calendar information to format. /// /// Pointer to a format picture string that is used to form the date string. Possible values for the format picture string are /// defined in Day, Month, Year, and Era Format Pictures. /// /// The format picture string must be null-terminated.The function uses the locale only for information not specified in the format /// picture string, for example, the day and month names for the locale.The application sets this parameter to NULL if the function /// is to use the date format of the specified locale. /// /// /// Pointer to a buffer in which this function receives the formatted date string. /// /// Size, in characters, of the lpDateStr buffer. Alternatively, the application can set this parameter to 0. In this case, the /// function returns the number of characters required to hold the formatted date string, and the lpDateStr parameter is not used. /// /// /// /// Returns the number of characters written to the lpDateStr buffer if successful. If the cchDate parameter is set to 0, the /// function returns the number of characters required to hold the formatted date string, including the terminating null character. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// /// /// ERROR_DATE_OUT_OF_RANGE. The specified date was out of range. /// /// /// ERROR_INSUFFICIENT_BUFFER. A supplied buffer size was not large enough, or it was incorrectly set to NULL. /// /// /// ERROR_INVALID_FLAGS. The values supplied for flags were not valid. /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// The earliest date supported by this function is January 1, 1601. /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with that module handle and the name of /// this function to get the function address. /// /// // https://docs.microsoft.com/en-us/windows/desktop/Intl/getcalendardateformatex BOOL GetCalendarDateFormatEx( _In_ LPCWSTR // lpszLocale, _In_ DWORD dwFlags, _In_ const LPCALDATETIME lpCalDateTime, _In_ LPCWSTR lpFormat, _Out_ LPWSTR lpDateStr, _In_ int // cchDate ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("", MSDNShortId = "eb2622bc-a98d-42bd-ab59-7a849000d79d")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetCalendarDateFormatEx(string lpszLocale, DATE_FORMAT dwFlags, in CALDATETIME lpCalDateTime, string lpFormat, StringBuilder lpDateStr, int cchDate); /// /// Retrieves information about a calendar for a locale specified by identifier. For interoperability reasons, the /// application should prefer the GetCalendarInfoEx function to GetCalendarInfo because Microsoft is migrating toward the use of /// locale names instead of locale identifiers for new locales. Any application that runs only on Windows Vista and later should use GetCalendarInfoEx. /// /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to create /// a locale identifier or use one of the following predefined values. /// /// Calendar identifier. /// /// Type of information to retrieve. For more information, see Calendar Type Information. /// CAL_USE_CP_ACP is relevant only for the ANSI version of this function. /// /// For CAL_NOUSEROVERRIDE, the function ignores any value set by SetCalendarInfo and uses the database settings for the /// current system default locale. This type is relevant only in the combination CAL_NOUSEROVERRIDE | CAL_ITWODIGITYEARMAX. /// CAL_ITWODIGITYEARMAX is the only value that can be set by SetCalendarInfo. /// /// /// /// Pointer to a buffer in which this function retrieves the requested data as a string. If CAL_RETURN_NUMBER is specified in /// CalType, this parameter must retrieve NULL. /// /// /// Size, in characters, of the lpCalData buffer. The application can set this parameter to 0 to return the required size for the /// calendar data buffer. In this case, the lpCalData parameter is not used. If CAL_RETURN_NUMBER is specified for CalType, the value /// of cchData must be 0. /// /// /// Pointer to a variable that receives the requested data as a number. If CAL_RETURN_NUMBER is specified in CalType, then lpValue /// must not be NULL. If CAL_RETURN_NUMBER is not specified in CalType, then lpValue must be NULL. /// /// /// /// Returns the number of characters retrieved in the lpCalData buffer if successful. If the function succeeds, cchData is set to 0, /// and CAL_RETURN_NUMBER is not specified, the return value is the size of the buffer required to hold the locale information. If /// the function succeeds, cchData is set to 0, and CAL_RETURN_NUMBER is specified, the return value is the size of the value written /// to the lpValue parameter. This size is always 2. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCalendarInfo( _In_ LCID Locale, _In_ CALID Calendar, _In_ CALTYPE CalType, _Out_opt_ LPTSTR lpCalData, _In_ int cchData, // _Out_opt_ LPDWORD lpValue); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318072(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318072")] public static extern int GetCalendarInfo(LCID Locale, CALID Calendar, CALTYPE CalType, [Optional] IntPtr lpCalData, [Optional] int cchData, out uint lpValue); /// /// Retrieves information about a calendar for a locale specified by identifier. For interoperability reasons, the /// application should prefer the GetCalendarInfoEx function to GetCalendarInfo because Microsoft is migrating toward the use of /// locale names instead of locale identifiers for new locales. Any application that runs only on Windows Vista and later should use GetCalendarInfoEx. /// /// /// Locale identifier that specifies the locale for which to retrieve calendar information. You can use the MAKELCID macro to create /// a locale identifier or use one of the following predefined values. /// /// Calendar identifier. /// /// Type of information to retrieve. For more information, see Calendar Type Information. /// CAL_USE_CP_ACP is relevant only for the ANSI version of this function. /// /// For CAL_NOUSEROVERRIDE, the function ignores any value set by SetCalendarInfo and uses the database settings for the /// current system default locale. This type is relevant only in the combination CAL_NOUSEROVERRIDE | CAL_ITWODIGITYEARMAX. /// CAL_ITWODIGITYEARMAX is the only value that can be set by SetCalendarInfo. /// /// /// /// Pointer to a buffer in which this function retrieves the requested data as a string. If CAL_RETURN_NUMBER is specified in /// CalType, this parameter must retrieve NULL. /// /// /// Size, in characters, of the lpCalData buffer. The application can set this parameter to 0 to return the required size for the /// calendar data buffer. In this case, the lpCalData parameter is not used. If CAL_RETURN_NUMBER is specified for CalType, the value /// of cchData must be 0. /// /// /// Pointer to a variable that receives the requested data as a number. If CAL_RETURN_NUMBER is specified in CalType, then lpValue /// must not be NULL. If CAL_RETURN_NUMBER is not specified in CalType, then lpValue must be NULL. /// /// /// /// Returns the number of characters retrieved in the lpCalData buffer if successful. If the function succeeds, cchData is set to 0, /// and CAL_RETURN_NUMBER is not specified, the return value is the size of the buffer required to hold the locale information. If /// the function succeeds, cchData is set to 0, and CAL_RETURN_NUMBER is specified, the return value is the size of the value written /// to the lpValue parameter. This size is always 2. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCalendarInfo( _In_ LCID Locale, _In_ CALID Calendar, _In_ CALTYPE CalType, _Out_opt_ LPTSTR lpCalData, _In_ int cchData, // _Out_opt_ LPDWORD lpValue); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318072(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318072")] public static extern int GetCalendarInfo(LCID Locale, CALID Calendar, CALTYPE CalType, StringBuilder lpCalData, int cchData, [Optional] IntPtr lpValue); /// Retrieves information about a calendar for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// Calendar identifier. /// Reserved; must be NULL. /// /// Type of information to retrieve. For more information, see Calendar Type Information. /// /// For CAL_NOUSEROVERRIDE, the function ignores any value set by SetCalendarInfo and uses the database settings for the /// current system default locale. This type is relevant only in the combination CAL_NOUSEROVERRIDE | CAL_ITWODIGITYEARMAX. /// CAL_ITWODIGITYEARMAX is the only value that can be set by SetCalendarInfo. /// /// /// /// Pointer to a buffer in which this function retrieves the requested data as a string. If CAL_RETURN_NUMBER is specified in /// CalType, this parameter must retrieve NULL. /// /// /// Size, in characters, of the lpCalData buffer. The application can set this parameter to 0 to return the required size for the /// calendar data buffer. In this case, the lpCalData parameter is not used. If CAL_RETURN_NUMBER is specified for CalType, the value /// of cchData must be 0. /// /// /// Pointer to a variable that receives the requested data as a number. If CAL_RETURN_NUMBER is specified in CalType, then lpValue /// must not be NULL. If CAL_RETURN_NUMBER is not specified in CalType, then lpValue must be NULL. /// /// /// /// Returns the number of characters retrieved in the lpCalData buffer if successful. If the function succeeds, cchData is set to 0, /// and CAL_RETURN_NUMBER is not specified, the return value is the size of the buffer required to hold the locale information. If /// the function succeeds, cchData is set to 0, and CAL_RETURN_NUMBER is specified, the return value is the size of the value written /// to the lpValue parameter. This size is always 2. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCalendarInfoEx( _In_opt_ LPCWSTR lpLocaleName, _In_ CALID Calendar, _In_opt_ LPCWSTR lpReserved, _In_ CALTYPE CalType, // _Out_opt_ LPWSTR lpCalData, _In_ int cchData, _Out_opt_ LPDWORD lpValue); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318075(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318075")] public static extern int GetCalendarInfoEx(string lpLocaleName, CALID Calendar, [Optional] string lpReserved, CALTYPE CalType, [Optional] IntPtr lpCalData, [Optional] int cchData, out uint lpValue); /// Retrieves information about a calendar for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// Calendar identifier. /// Reserved; must be NULL. /// /// Type of information to retrieve. For more information, see Calendar Type Information. /// /// For CAL_NOUSEROVERRIDE, the function ignores any value set by SetCalendarInfo and uses the database settings for the /// current system default locale. This type is relevant only in the combination CAL_NOUSEROVERRIDE | CAL_ITWODIGITYEARMAX. /// CAL_ITWODIGITYEARMAX is the only value that can be set by SetCalendarInfo. /// /// /// /// Pointer to a buffer in which this function retrieves the requested data as a string. If CAL_RETURN_NUMBER is specified in /// CalType, this parameter must retrieve NULL. /// /// /// Size, in characters, of the lpCalData buffer. The application can set this parameter to 0 to return the required size for the /// calendar data buffer. In this case, the lpCalData parameter is not used. If CAL_RETURN_NUMBER is specified for CalType, the value /// of cchData must be 0. /// /// /// Pointer to a variable that receives the requested data as a number. If CAL_RETURN_NUMBER is specified in CalType, then lpValue /// must not be NULL. If CAL_RETURN_NUMBER is not specified in CalType, then lpValue must be NULL. /// /// /// /// Returns the number of characters retrieved in the lpCalData buffer if successful. If the function succeeds, cchData is set to 0, /// and CAL_RETURN_NUMBER is not specified, the return value is the size of the buffer required to hold the locale information. If /// the function succeeds, cchData is set to 0, and CAL_RETURN_NUMBER is specified, the return value is the size of the value written /// to the lpValue parameter. This size is always 2. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCalendarInfoEx( _In_opt_ LPCWSTR lpLocaleName, _In_ CALID Calendar, _In_opt_ LPCWSTR lpReserved, _In_ CALTYPE CalType, // _Out_opt_ LPWSTR lpCalData, _In_ int cchData, _Out_opt_ LPDWORD lpValue); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318075(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318075")] public static extern int GetCalendarInfoEx(string lpLocaleName, CALID Calendar, [Optional] string lpReserved, CALTYPE CalType, StringBuilder lpCalData, int cchData, [Optional] IntPtr lpValue); /// Deprecated. Gets the supported date range for a specified calendar. /// The calendar. /// The lp cal minimum date time. /// The lp cal maximum date time. /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// The earliest date supported by this function is January 1, 1601. /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with the module handle and the name of this /// function to get the function address. /// /// // https://docs.microsoft.com/en-us/windows/desktop/Intl/getcalendarsupporteddaterange BOOL GetCalendarSupportedDateRange( _In_ CALID // Calendar, _Out_ LPCALDATETIME lpCalMinDateTime, _Out_ LPCALDATETIME lpCalMaxDateTime ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "fe036ac5-77c0-4e83-8d70-db3fa0f7c803")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetCalendarSupportedDateRange(CALID Calendar, out CALDATETIME lpCalMinDateTime, out CALDATETIME lpCalMaxDateTime); /// Retrieves information about any valid installed or available code page. /// /// Identifier for the code page for which to retrieve information. For details, see the CodePage parameter of GetCPInfoEx. /// /// /// Pointer to a CPINFO structure that receives information about the code page. See the Remarks section. /// /// /// Returns 1 if successful, or 0 otherwise. To get extended error information, the application can call GetLastError, which /// can return one of the following error codes: /// // BOOL GetCPInfo( _In_ UINT CodePage, _Out_ LPCPINFO lpCPInfo); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318078(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318078")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetCPInfo(uint CodePage, out CPINFO lpCPInfo); /// Retrieves information about any valid installed or available code page. /// /// /// Identifier for the code page for which to retrieve information. The application can specify the code page identifier for any /// installed or available code page, or one of the following predefined values. See Code Page Identifiers for a list of identifiers /// for ANSI and other code pages. /// /// /// /// /// Value /// Meaning /// /// /// CP_ACP /// Use the system default Windows ANSI code page. /// /// /// CP_MACCP /// Use the system default Macintosh code page. /// /// /// CP_OEMCP /// Use the system default OEM code page. /// /// /// CP_THREAD_ACP /// Use the current thread's ANSI code page. /// /// /// /// /// Reserved; must be 0. /// Pointer to a CPINFOEX structure that receives information about the code page. /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL GetCPInfoEx( _In_ UINT CodePage, _In_ DWORD dwFlags, _Out_ LPCPINFOEX lpCPInfoEx); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318081(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318081")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetCPInfoEx(uint CodePage, [Optional] uint dwFlags, out CPINFOEX lpCPInfoEx); /// Formats a number string as a currency string for a locale specified by identifier. /// /// Locale identifier that specifies the locale for which this function formats the currency string. You can use the MAKELCID /// macro to create a locale identifier or use one of the following predefined values. /// /// /// Flags controlling currency format. The application must set this parameter to 0 if lpFormat is not set to NULL. In this /// case, the function formats the string using user overrides to the default currency format for the locale. If lpFormat is set to /// NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default currency format for /// the specified locale. /// /// For details, see the lpValue parameter of GetCurrencyFormatEx. /// /// Pointer to a CURRENCYFMT structure that contains currency formatting information. All members of the structure must /// contain appropriate values. The application can set this parameter to NULL if function is to use the currency format of /// the specified locale. If this parameter is not set to NULL, the function uses the specified locale only for formatting /// information not specified in the CURRENCYFMT structure, for example, the string value for the negative sign used by the locale. /// /// Pointer to a buffer in which this function retrieves the formatted currency string. /// /// Size, in characters, of the lpCurrencyStr buffer. The application sets this parameter to 0 if the function is to return the size /// of the buffer required to hold the formatted currency string. In this case, the lpCurrencyStr parameter is not used. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpCurrencyStr if successful. If the cchCurrency parameter /// is set to 0, the function returns the size of the buffer required to hold the formatted currency string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCurrencyFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_ LPCTSTR lpValue, _In_opt_ const CURRENCYFMT *lpFormat, _Out_opt_ // LPTSTR lpCurrencyStr, _In_ int cchCurrency); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318083(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318083")] public static extern int GetCurrencyFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, [Optional] string lpValue, in CURRENCYFMT lpFormat, StringBuilder lpCurrencyStr, int cchCurrency); /// Formats a number string as a currency string for a locale specified by identifier. /// /// Locale identifier that specifies the locale for which this function formats the currency string. You can use the MAKELCID /// macro to create a locale identifier or use one of the following predefined values. /// /// /// Flags controlling currency format. The application must set this parameter to 0 if lpFormat is not set to NULL. In this /// case, the function formats the string using user overrides to the default currency format for the locale. If lpFormat is set to /// NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default currency format for /// the specified locale. /// /// For details, see the lpValue parameter of GetCurrencyFormatEx. /// /// Pointer to a CURRENCYFMT structure that contains currency formatting information. All members of the structure must /// contain appropriate values. The application can set this parameter to NULL if function is to use the currency format of /// the specified locale. If this parameter is not set to NULL, the function uses the specified locale only for formatting /// information not specified in the CURRENCYFMT structure, for example, the string value for the negative sign used by the locale. /// /// Pointer to a buffer in which this function retrieves the formatted currency string. /// /// Size, in characters, of the lpCurrencyStr buffer. The application sets this parameter to 0 if the function is to return the size /// of the buffer required to hold the formatted currency string. In this case, the lpCurrencyStr parameter is not used. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpCurrencyStr if successful. If the cchCurrency parameter /// is set to 0, the function returns the size of the buffer required to hold the formatted currency string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCurrencyFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_ LPCTSTR lpValue, _In_opt_ const CURRENCYFMT *lpFormat, _Out_opt_ // LPTSTR lpCurrencyStr, _In_ int cchCurrency); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318083(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318083")] public static extern int GetCurrencyFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, [Optional] string lpValue, [Optional] IntPtr lpFormat, StringBuilder lpCurrencyStr, int cchCurrency); /// Formats a number string as a currency string for a locale specified by name. /// Pointer to a locale name or one of the following predefined values. /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default currency format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// currency format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can contain only the following /// characters. All other characters are invalid. The function returns an error if the string deviates from these rules. /// /// /// Pointer to a CURRENCYFMT structure that contains currency formatting information. All members of the structure must /// contain appropriate values. The application can set this parameter to NULL if function is to use the currency format of /// the specified locale. If this parameter is not set to NULL, the function uses the specified locale only for formatting /// information not specified in the CURRENCYFMT structure, for example, the string value for the negative sign used by the locale. /// /// Pointer to a buffer in which this function retrieves the formatted currency string. /// /// Size, in characters, of the lpCurrencyStr buffer. The application can set this parameter to 0 to return the size of the buffer /// required to hold the formatted currency string. In this case, the buffer indicated by lpCurrencyStr is not used. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpCurrencyStr if successful. If the cchCurrency parameter /// is 0, the function returns the size of the buffer required to hold the formatted currency string, including a terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCurrencyFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ LPCWSTR lpValue, _In_opt_ const CURRENCYFMT // *lpFormat, _Out_opt_ LPWSTR lpCurrencyStr, _In_ int cchCurrency); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318084(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318084")] public static extern int GetCurrencyFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, [Optional] string lpValue, in CURRENCYFMT lpFormat, StringBuilder lpCurrencyStr, int cchCurrency); /// Formats a number string as a currency string for a locale specified by name. /// Pointer to a locale name or one of the following predefined values. /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default currency format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// currency format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can contain only the following /// characters. All other characters are invalid. The function returns an error if the string deviates from these rules. /// /// /// Pointer to a CURRENCYFMT structure that contains currency formatting information. All members of the structure must /// contain appropriate values. The application can set this parameter to NULL if function is to use the currency format of /// the specified locale. If this parameter is not set to NULL, the function uses the specified locale only for formatting /// information not specified in the CURRENCYFMT structure, for example, the string value for the negative sign used by the locale. /// /// Pointer to a buffer in which this function retrieves the formatted currency string. /// /// Size, in characters, of the lpCurrencyStr buffer. The application can set this parameter to 0 to return the size of the buffer /// required to hold the formatted currency string. In this case, the buffer indicated by lpCurrencyStr is not used. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpCurrencyStr if successful. If the cchCurrency parameter /// is 0, the function returns the size of the buffer required to hold the formatted currency string, including a terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetCurrencyFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ LPCWSTR lpValue, _In_opt_ const CURRENCYFMT // *lpFormat, _Out_opt_ LPWSTR lpCurrencyStr, _In_ int cchCurrency); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318084(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318084")] public static extern int GetCurrencyFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, [Optional] string lpValue, [Optional] IntPtr lpFormat, StringBuilder lpCurrencyStr, int cchCurrency); /// Formats a duration of time as a time string for a locale specified by identifier. /// /// /// Locale identifier that specifies the locale for which this function formats the duration. You can use the MAKELCID macro /// to create a locale identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Flags specifying function options. If lpFormat is not set to NULL, this parameter must be set to 0. If lpFormat is set to /// NULL, your application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default duration format for /// the specified locale. /// /// /// Pointer to a SYSTEMTIME structure that contains the time duration information to format. If this pointer is NULL, /// the function ignores this parameter and uses ullDuration. /// /// /// 64-bit unsigned integer that represents the number of 100-nanosecond intervals in the duration. If both lpDuration and /// ullDuration are present, lpDuration takes precedence. If lpDuration is set to NULL and ullDuration is set to 0, the /// duration is zero. /// /// Pointer to the format string. For details, see the lpFormat parameter of GetDurationFormatEx. /// /// Pointer to the buffer in which the function retrieves the duration string. /// /// Alternatively, this parameter can contain NULL if cchDuration is set to 0. In this case, the function returns the required /// size for the duration string buffer. /// /// /// /// Size, in characters, of the buffer indicated by lpDurationStr. /// /// Alternatively, the application can set this parameter to 0. In this case, the function retrieves NULL in lpDurationStr and /// returns the required size for the duration string buffer. /// /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpDurationStr if successful. If lpDurationStr is set to /// NULL and cchDuration is set to 0, the function returns the required size for the duration string buffer, including the /// null terminating character. For example, if 10 characters are written to the buffer, the function returns 11 to include the /// terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetDurationFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDuration, _In_ ULONGLONG ullDuration, // _In_opt_ LPCWSTR lpFormat, _Out_opt_ LPWSTR lpDurationStr, _In_ int cchDuration); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318091(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318091")] public static extern int GetDurationFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, in SYSTEMTIME lpDuration, [Optional] ulong ullDuration, [Optional] string lpFormat, StringBuilder lpDurationStr, int cchDuration); /// Formats a duration of time as a time string for a locale specified by identifier. /// /// /// Locale identifier that specifies the locale for which this function formats the duration. You can use the MAKELCID macro /// to create a locale identifier or use one of the following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Flags specifying function options. If lpFormat is not set to NULL, this parameter must be set to 0. If lpFormat is set to /// NULL, your application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default duration format for /// the specified locale. /// /// /// Pointer to a SYSTEMTIME structure that contains the time duration information to format. If this pointer is NULL, /// the function ignores this parameter and uses ullDuration. /// /// /// 64-bit unsigned integer that represents the number of 100-nanosecond intervals in the duration. If both lpDuration and /// ullDuration are present, lpDuration takes precedence. If lpDuration is set to NULL and ullDuration is set to 0, the /// duration is zero. /// /// Pointer to the format string. For details, see the lpFormat parameter of GetDurationFormatEx. /// /// Pointer to the buffer in which the function retrieves the duration string. /// /// Alternatively, this parameter can contain NULL if cchDuration is set to 0. In this case, the function returns the required /// size for the duration string buffer. /// /// /// /// Size, in characters, of the buffer indicated by lpDurationStr. /// /// Alternatively, the application can set this parameter to 0. In this case, the function retrieves NULL in lpDurationStr and /// returns the required size for the duration string buffer. /// /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpDurationStr if successful. If lpDurationStr is set to /// NULL and cchDuration is set to 0, the function returns the required size for the duration string buffer, including the /// null terminating character. For example, if 10 characters are written to the buffer, the function returns 11 to include the /// terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetDurationFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDuration, _In_ ULONGLONG ullDuration, // _In_opt_ LPCWSTR lpFormat, _Out_opt_ LPWSTR lpDurationStr, _In_ int cchDuration); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318091(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318091")] public static extern int GetDurationFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, [Optional] IntPtr lpDuration, [Optional] ulong ullDuration, [Optional] string lpFormat, StringBuilder lpDurationStr, int cchDuration); /// Formats a duration of time as a time string for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Flags specifying function options. If lpFormat is not set to NULL, this parameter must be set to 0. If lpFormat is set to /// NULL, your application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default duration format for /// the specified locale. /// /// /// Pointer to a SYSTEMTIME structure that contains the time duration information to format. The application sets this /// parameter to NULL if the function is to ignore it and use ullDuration. /// /// /// 64-bit unsigned integer that represents the number of 100-nanosecond intervals in the duration. If both lpDuration and /// ullDuration are set, the lpDuration parameter takes precedence. If lpDuration is set to NULL and ullDuration is set to 0, /// the duration is 0. /// /// /// /// Pointer to the format string with characters as shown below. The application can set this parameter to NULL if the /// function is to format the string according to the duration format for the specified locale. If lpFormat is not set to /// NULL, the function uses the locale only for information not specified in the format picture string. /// /// /// /// /// Value /// Meaning /// /// /// d /// days /// /// /// h or H /// hours /// /// /// hh or HH /// hours; if less than ten, prepend a leading zero /// /// /// m /// minutes /// /// /// mm /// minutes; if less than ten, prepend a leading zero /// /// /// s /// seconds /// /// /// ss /// seconds; if less than ten, prepend a leading zero /// /// /// f /// fractions of a second /// /// /// /// /// /// Pointer to the buffer in which the function retrieves the duration string. /// /// Alternatively, this parameter retrieves NULL if cchDuration is set to 0. In this case, the function returns the required /// size for the duration string buffer. /// /// /// /// Size, in characters, of the buffer indicated by lpDurationStr. /// /// Alternatively, the application can set this parameter to 0. In this case, the function retrieves NULL in lpDurationStr and /// returns the required size for the duration string buffer. /// /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpDurationStr if successful. If lpDurationStr is set to /// NULL and cchDuration is set to 0, the function returns the required size for the duration string buffer, including the /// terminating null character. For example, if 10 characters are written to the buffer, the function returns 11 to include the /// terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetDurationFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDuration, _In_ ULONGLONG // ullDuration, _In_opt_ LPCWSTR lpFormat, _Out_opt_ LPWSTR lpDurationStr, _In_ int cchDuration); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318092(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318092")] public static extern int GetDurationFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, in SYSTEMTIME lpDuration, [Optional] ulong ullDuration, [Optional] string lpFormat, StringBuilder lpDurationStr, int cchDuration); /// Formats a duration of time as a time string for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Flags specifying function options. If lpFormat is not set to NULL, this parameter must be set to 0. If lpFormat is set to /// NULL, your application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default duration format for /// the specified locale. /// /// /// Pointer to a SYSTEMTIME structure that contains the time duration information to format. The application sets this /// parameter to NULL if the function is to ignore it and use ullDuration. /// /// /// 64-bit unsigned integer that represents the number of 100-nanosecond intervals in the duration. If both lpDuration and /// ullDuration are set, the lpDuration parameter takes precedence. If lpDuration is set to NULL and ullDuration is set to 0, /// the duration is 0. /// /// /// /// Pointer to the format string with characters as shown below. The application can set this parameter to NULL if the /// function is to format the string according to the duration format for the specified locale. If lpFormat is not set to /// NULL, the function uses the locale only for information not specified in the format picture string. /// /// /// /// /// Value /// Meaning /// /// /// d /// days /// /// /// h or H /// hours /// /// /// hh or HH /// hours; if less than ten, prepend a leading zero /// /// /// m /// minutes /// /// /// mm /// minutes; if less than ten, prepend a leading zero /// /// /// s /// seconds /// /// /// ss /// seconds; if less than ten, prepend a leading zero /// /// /// f /// fractions of a second /// /// /// /// /// /// Pointer to the buffer in which the function retrieves the duration string. /// /// Alternatively, this parameter retrieves NULL if cchDuration is set to 0. In this case, the function returns the required /// size for the duration string buffer. /// /// /// /// Size, in characters, of the buffer indicated by lpDurationStr. /// /// Alternatively, the application can set this parameter to 0. In this case, the function retrieves NULL in lpDurationStr and /// returns the required size for the duration string buffer. /// /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpDurationStr if successful. If lpDurationStr is set to /// NULL and cchDuration is set to 0, the function returns the required size for the duration string buffer, including the /// terminating null character. For example, if 10 characters are written to the buffer, the function returns 11 to include the /// terminating null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetDurationFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_opt_ const SYSTEMTIME *lpDuration, _In_ ULONGLONG // ullDuration, _In_opt_ LPCWSTR lpFormat, _Out_opt_ LPWSTR lpDurationStr, _In_ int cchDuration); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318092(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318092")] public static extern int GetDurationFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, [Optional] IntPtr lpDuration, [Optional] ulong ullDuration, [Optional] string lpFormat, StringBuilder lpDurationStr, int cchDuration); /// Retrieves resource-related information about a file. /// /// /// Flags specifying the information to retrieve. Any combination of the following flags is allowed. The default value of the flags /// is MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM. /// /// /// /// /// Value /// Meaning /// /// /// MUI_QUERY_TYPE /// Retrieve one of the following values in the dwFileType member of FILEMUIINFO: /// /// /// MUI_QUERY_CHECKSUM /// /// Retrieve the resource checksum of the input file in the pChecksum member of FILEMUIINFO. If the input file does not have resource /// configuration data, this member of the structure contains 0. /// /// /// /// MUI_QUERY_LANGUAGE_NAME /// /// Retrieve the language associated with the input file. For a language-specific resource file, this flag requests the associated /// language. For an LN file, this flag requests the language of the ultimate fallback resources for the module, which can be either /// in the LN file or in a separate language-specific resource file referenced by the resource configuration data of the LN file. For /// more information, see the Remarks section. /// /// /// /// MUI_QUERY_RESOURCE_TYPES /// /// Retrieve lists of resource types in the language-specific resource files and LN files as they are specified in the resource /// configuration data. See the Remarks section for a way to access this information. /// /// /// /// /// /// /// Pointer to a null-terminated string indicating the path to the file. Typically the file is either an LN file or a /// language-specific resource file. If it is not one of these types, the only significant value that the function retrieves is /// MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL. The function only retrieves this value if the MUI_QUERY_RESOURCE_TYPES flag is set. /// /// /// /// Pointer to a buffer containing file information in a FILEMUIINFO structure and possibly in data following that structure. /// The information buffer might have to be much larger than the size of the structure itself. Depending on flag settings, the /// function can store considerable information following the structure, at offsets retrieved in the structure. For more information, /// see the Remarks section. /// /// /// Alternatively, the application can set this parameter to NULL if pcbFileMUIInfo is set to 0. In this case, the function /// retrieves the required size for the information buffer in pcbFileMUIInfo. /// /// /// /// /// Pointer to the buffer size, in bytes, for the file information indicated by pFileMUIInfo. On successful return from the function, /// this parameter contains the size of the retrieved file information buffer and the FILEMUIINFO structure that contains it. /// /// /// Alternatively, the application can set this parameter to 0 if it sets NULL in pFileMUIInfo. In this case, the function /// retrieves the required file information buffer size in pcbFileMUIInfo. To allocate the correct amount of memory, this value /// should be added to the size of the FILEMUIINFO structure itself. /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call GetLastError. /// // BOOL GetFileMUIInfo( _In_ DWORD dwFlags, _In_ PCWSTR pcwszFilePath, _Inout_opt_ PFILEMUIINFO pFileMUIInfo, _Inout_ DWORD // *pcbFileMUIInfo); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318095(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318095")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetFileMUIInfo(MUI_QUERY dwFlags, string pcwszFilePath, ref FILEMUIINFO pFileMUIInfo, ref uint pcbFileMUIInfo); /// Retrieves resource-related information about a file. /// /// /// Flags specifying the information to retrieve. Any combination of the following flags is allowed. The default value of the flags /// is MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM. /// /// /// /// /// Value /// Meaning /// /// /// MUI_QUERY_TYPE /// Retrieve one of the following values in the dwFileType member of FILEMUIINFO: /// /// /// MUI_QUERY_CHECKSUM /// /// Retrieve the resource checksum of the input file in the pChecksum member of FILEMUIINFO. If the input file does not have resource /// configuration data, this member of the structure contains 0. /// /// /// /// MUI_QUERY_LANGUAGE_NAME /// /// Retrieve the language associated with the input file. For a language-specific resource file, this flag requests the associated /// language. For an LN file, this flag requests the language of the ultimate fallback resources for the module, which can be either /// in the LN file or in a separate language-specific resource file referenced by the resource configuration data of the LN file. For /// more information, see the Remarks section. /// /// /// /// MUI_QUERY_RESOURCE_TYPES /// /// Retrieve lists of resource types in the language-specific resource files and LN files as they are specified in the resource /// configuration data. See the Remarks section for a way to access this information. /// /// /// /// /// /// /// Pointer to a null-terminated string indicating the path to the file. Typically the file is either an LN file or a /// language-specific resource file. If it is not one of these types, the only significant value that the function retrieves is /// MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL. The function only retrieves this value if the MUI_QUERY_RESOURCE_TYPES flag is set. /// /// Class containing file information corresponding to a FILEMUIINFO structure. public static SafeFILEMUIINFO GetFileMUIInfo(MUI_QUERY dwFlags, string pcwszFilePath) { var ret = new SafeFILEMUIINFO(); bool success; var sz = 180U; // Magic number that appears to be the initial size for many MUI files. do { ret.dwSize = sz; success = GetFileMUIInfo(dwFlags, pcwszFilePath, ret, ref sz); } while (!success && Win32Error.GetLastError() == Win32Error.ERROR_INSUFFICIENT_BUFFER); if (!success) Win32Error.ThrowLastError(); return ret; } /// Retrieves resource-related information about a file. /// /// /// Flags specifying the information to retrieve. Any combination of the following flags is allowed. The default value of the flags /// is MUI_QUERY_TYPE | MUI_QUERY_CHECKSUM. /// /// /// /// /// Value /// Meaning /// /// /// MUI_QUERY_TYPE /// Retrieve one of the following values in the dwFileType member of FILEMUIINFO: /// /// /// MUI_QUERY_CHECKSUM /// /// Retrieve the resource checksum of the input file in the pChecksum member of FILEMUIINFO. If the input file does not have resource /// configuration data, this member of the structure contains 0. /// /// /// /// MUI_QUERY_LANGUAGE_NAME /// /// Retrieve the language associated with the input file. For a language-specific resource file, this flag requests the associated /// language. For an LN file, this flag requests the language of the ultimate fallback resources for the module, which can be either /// in the LN file or in a separate language-specific resource file referenced by the resource configuration data of the LN file. For /// more information, see the Remarks section. /// /// /// /// MUI_QUERY_RESOURCE_TYPES /// /// Retrieve lists of resource types in the language-specific resource files and LN files as they are specified in the resource /// configuration data. See the Remarks section for a way to access this information. /// /// /// /// /// /// /// Pointer to a null-terminated string indicating the path to the file. Typically the file is either an LN file or a /// language-specific resource file. If it is not one of these types, the only significant value that the function retrieves is /// MUI_FILETYPE_NOT_LANGUAGE_NEUTRAL. The function only retrieves this value if the MUI_QUERY_RESOURCE_TYPES flag is set. /// /// /// /// Pointer to a buffer containing file information in a FILEMUIINFO structure and possibly in data following that structure. /// The information buffer might have to be much larger than the size of the structure itself. Depending on flag settings, the /// function can store considerable information following the structure, at offsets retrieved in the structure. For more information, /// see the Remarks section. /// /// /// Alternatively, the application can set this parameter to NULL if pcbFileMUIInfo is set to 0. In this case, the function /// retrieves the required size for the information buffer in pcbFileMUIInfo. /// /// /// /// /// Pointer to the buffer size, in bytes, for the file information indicated by pFileMUIInfo. On successful return from the function, /// this parameter contains the size of the retrieved file information buffer and the FILEMUIINFO structure that contains it. /// /// /// Alternatively, the application can set this parameter to 0 if it sets NULL in pFileMUIInfo. In this case, the function /// retrieves the required file information buffer size in pcbFileMUIInfo. To allocate the correct amount of memory, this value /// should be added to the size of the FILEMUIINFO structure itself. /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call GetLastError. /// // BOOL GetFileMUIInfo( _In_ DWORD dwFlags, _In_ PCWSTR pcwszFilePath, _Inout_opt_ PFILEMUIINFO pFileMUIInfo, _Inout_ DWORD // *pcbFileMUIInfo); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318095(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318095")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetFileMUIInfo(MUI_QUERY dwFlags, string pcwszFilePath, [Optional] IntPtr pFileMUIInfo, ref uint pcbFileMUIInfo); /// /// Retrieves the path to all language-specific resource files associated with the supplied LN file. The application must call this /// function repeatedly to get the path for each resource file. /// /// /// /// Flags identifying language format and filtering. The following flags specify the format of the language indicated by /// pwszLanguage. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language string in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language string in language name format. /// /// /// /// /// The following flags specify the filtering for the function to use in locating language-specific resource files if pwszLanguage is /// set to NULL. The filtering flags are mutually exclusive, and the default is MUI_USER_PREFERRED_UI_LANGUAGES. /// /// /// /// /// Value /// Meaning /// /// /// MUI_USE_SEARCH_ALL_LANGUAGES /// /// Retrieve all language-specific resource files for the path indicated by pcwszFilePath, without considering file licensing. This /// flag is relevant only if the application supplies a null string for pwszLanguage. /// /// /// /// MUI_USER_PREFERRED_UI_LANGUAGES /// /// Retrieve only the files that implement languages in the fallback list. Successive calls enumerate the successive fallbacks, in /// the appropriate order. The first file indicated by the output value of pcchFileMUIPath should be the best fit. This flag is /// relevant only if the application supplies a null string for pwszLanguage. /// /// /// /// MUI_USE_INSTALLED_LANGUAGES /// /// Retrieve only the files for the languages installed on the computer. This flag is relevant only if the application supplies a /// null string for pwszLanguage. /// /// /// /// /// /// The following flags allow the user to indicate the type of file that is specified by pcwszFilePath so that the function can /// determine if it must add ".mui" to the file name. The flags are mutually exclusive. If the application passes both flags, the /// function fails. If the application passes neither flag, the function checks the file in the root folder to verify the file type /// and decide on file naming. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANG_NEUTRAL_PE_FILE /// /// Do not verify the file passed in pcwszFilePath and append &quot;.mui&quot; to the file name before processing. For /// example, change Abc.exe to Abc.exe.mui. /// /// /// /// MUI_NON_LANG_NEUTRAL_FILE /// /// Do not verify the file passed in pcwszFilePath and do not append &quot;.mui&quot; to the file name before processing. For /// example, use Abc.txt or Abc.chm. /// /// /// /// /// /// /// Pointer to a null-terminated string specifying a file path. The path is either for an existing LN file or for a file such as a /// .txt, .inf, or .msc file. If the file is an LN file, the function looks for files containing the associated language-specific /// resources. For all other types of files, the function seeks files that correspond exactly to the file name and path indicated. /// Your application can overwrite the behavior of the file type check by using the MUI_LANG_NEUTRAL_PE_FILE or /// MUI_NON_LANG_NEUTRAL_FILE flag. For more information, see the Remarks section. /// /// /// /// Pointer to a buffer containing a language string. On input, this buffer contains the language identifier or language name for /// which the application should find language-specific resource files, depending on the settings of dwFlags. On successful return /// from the function, this parameter contains the language of the language-specific resource file that the function has found. /// /// /// Alternatively, the application can set this parameter to NULL, with the value referenced by pcchLanguage set to 0. In this /// case, the function retrieves the required buffer size in pcchLanguage. /// /// /// /// Pointer to the buffer size, in characters, for the language string indicated by pwszLanguage. If the application sets the value /// referenced by this parameter to 0 and passes NULL for pwszLanguage, then the required buffer size will be returned in /// pcchLanguage and the returned buffer size is always LOCALE_NAME_MAX_LENGTH, because the function is typically called multiple /// times in succession. The function cannot determine the exact size of the language name for all successive calls, and cannot /// extend the buffer on subsequent calls. Thus LOCALE_NAME_MAX_LENGTH is the only safe maximum. /// /// /// /// Pointer to a buffer containing the path to the language-specific resource file. It is strongly recommended to allocate this /// buffer to be of size MAX_PATH. /// /// /// Alternatively, this parameter can retrieve NULL if the value referenced by pcchFileMUIPath is set to 0. In this case, the /// function retrieves the required size for the file path buffer in pcchFileMUIPath. /// /// /// /// Pointer to the buffer size, in characters, for the file path indicated by pwszFileMUIPath. On successful return from the /// function, this parameter indicates the size of the retrieved file path. If the application sets the value referenced by this /// parameter to 0, the function retrieves NULL for pwszFileMUIPath, the required buffer size will be returned in /// pcchFileMUIPath and the returned buffer size is always MAX_PATH, because the function is typically called multiple times in /// succession. The function cannot determine the exact size of the path for all successive calls, and cannot extend the buffer on /// subsequent calls. Thus MAX_PATH is the only safe maximum. /// /// /// Pointer to an enumeration variable. The first time this function is called, the value of the variable should be 0. Between /// subsequent calls, the application should not change the value of this parameter. After the function retrieves all possible /// language-specific resource file paths, it returns FALSE. /// /// /// Returns TRUE if successful or FALSE otherwise. If the function fails, the output parameters do not change. /// /// To get extended error information, the application can call GetLastError, which can return the following error codes: /// /// // BOOL GetFileMUIPath( _In_ DWORD dwFlags, _In_ PCWSTR pcwszFilePath, _Inout_opt_ PWSTR pwszLanguage, _Inout_ PULONG pcchLanguage, // _Out_opt_ PWSTR pwszFileMUIPath, _Inout_ PULONG pcchFileMUIPath, _Inout_ PULONGLONG pululEnumerator); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318097(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318097")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetFileMUIPath(MUI_LANGUAGE_PATH dwFlags, string pcwszFilePath, StringBuilder pwszLanguage, ref uint pcchLanguage, StringBuilder pwszFileMUIPath, ref uint pcchFileMUIPath, ref ulong pululEnumerator); /// /// /// [ GetGeoInfo is available for use in the operating systems specified in the Requirements section. It may be altered or /// unavailable in subsequent versions. Instead, use GetGeoInfoEx.] /// /// Retrieves information about a specified geographical location. /// /// /// Identifier for the geographical location for which to get information. For more information, see Table of Geographical Locations. /// You can obtain the available values by calling EnumSystemGeoID. /// /// /// /// Type of information to retrieve. Possible values are defined by the SYSGEOTYPE enumeration. If the value of GeoType is /// GEO_LCID, the function retrieves a locale identifier. If the value of GeoType is GEO_RFC1766, the function retrieves a string /// name that is compliant with RFC 4646 (Windows Vista). For more information, see the Remarks section. /// /// Windows XP: When GeoType is set to GEO_LCID, the retrieved string is an 8-digit hexadecimal value. /// Windows Me: When GeoType is set to GEO_LCID, the retrieved string is a decimal value. /// /// Pointer to the buffer in which this function retrieves the information. /// /// Size of the buffer indicated by lpGeoData. The size is the number of bytes for the ANSI version of the function, or the number of /// words for the Unicode version. The application can set this parameter to 0 if the function is to return the required size of the buffer. /// /// /// Identifier for the language, used with the value of Location. The application can set this parameter to 0, with GEO_RFC1766 or /// GEO_LCID specified for GeoType. This setting causes the function to retrieve the language identifier by calling GetUserDefaultLangID. /// /// /// /// Returns the number of bytes (ANSI) or words (Unicode) of geographical location information retrieved in the output buffer. If /// cchData is set to 0, the function returns the required size for the buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetGeoInfo( _In_ GEOID Location, _In_ GEOTYPE GeoType, _Out_opt_ LPTSTR lpGeoData, _In_ int cchData, _In_ LANGID LangId); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318099(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318099")] public static extern int GetGeoInfo(int Location, SYSGEOTYPE GeoType, StringBuilder lpGeoData, int cchData, ushort LangId); /// /// Retrieves information about a geographic location that you specify by using a two-letter International Organization for /// Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code. /// /// /// The two-letter ISO 3166-1 or numeric UN M.49 code for the geographic location for which to get information. To get the codes that /// are available on the operating system, call EnumSystemGeoNames. /// /// The type of information you want to retrieve. Possible values are defined by the SYSGEOTYPE enumeration. /// A pointer to the buffer in which GetGeoInfoEx should write the requested information. /// /// The size of the buffer to which the GeoData parameter points, in characters. Set this parameter to 0 to specify that the function /// should only return the size of the buffer required to store the requested information without writing the requested information /// to the buffer. /// /// /// The number of bytes of geographical location information that the function wrote the output buffer. If geoDataCount is 0, the /// function returns the size of the buffer required to hold the information without writing the information to the buffer. /// 0 indicates that the function did not succeed.To get extended error information, call GetLastError. /// // int WINAPI GetGeoInfoEx( _In_ PWSTR location, _In_ GEOTYPE geoType, _Out_opt_ PWSTR geoData, _In_ int geoDataCount ); https://msdn.microsoft.com/en-us/library/windows/desktop/mt826489(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "mt826489")] public static extern int GetGeoInfoEx(string location, SYSGEOTYPE geoType, StringBuilder geoData, int geoDataCount); /// Retrieves information about a locale specified by identifier. /// /// Locale identifier for which to retrieve information. You can use the MAKELCID macro to create a locale identifier or use /// one of the following predefined values. /// /// The locale information to retrieve. For detailed definitions, see the LCType parameter of GetLocaleInfoEx. /// /// Pointer to a buffer in which this function retrieves the requested locale information. This pointer is not used if cchData is set /// to 0. For more information, see the Remarks section. /// /// /// Size, in TCHAR values, of the data buffer indicated by lpLCData. Alternatively, the application can set this parameter to 0. In /// this case, the function does not use the lpLCData parameter and returns the required buffer size, including the terminating null character. /// /// /// /// Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the /// function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer /// retrieved in the data buffer; that is, 2 for the Unicode version of the function or 4 for the ANSI version. If the function /// succeeds and the value of cchData is 0, the return value is the required size, in characters including a null character, for the /// locale data buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetLocaleInfo( _In_ LCID Locale, _In_ LCTYPE LCType, _Out_opt_ LPTSTR lpLCData, _In_ int cchData); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318101(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318101")] public static extern int GetLocaleInfo(LCID Locale, LCTYPE LCType, StringBuilder lpLCData, int cchData); /// Retrieves information about a locale specified by identifier. /// /// Locale identifier for which to retrieve information. You can use the MAKELCID macro to create a locale identifier or use /// one of the following predefined values. /// /// The locale information to retrieve. For detailed definitions, see the LCType parameter of GetLocaleInfoEx. /// /// Pointer to a buffer in which this function retrieves the requested locale information. This pointer is not used if cchData is set /// to 0. For more information, see the Remarks section. /// /// /// Size, in TCHAR values, of the data buffer indicated by lpLCData. Alternatively, the application can set this parameter to 0. In /// this case, the function does not use the lpLCData parameter and returns the required buffer size, including the terminating null character. /// /// /// /// Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the /// function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer /// retrieved in the data buffer; that is, 2 for the Unicode version of the function or 4 for the ANSI version. If the function /// succeeds and the value of cchData is 0, the return value is the required size, in characters including a null character, for the /// locale data buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetLocaleInfo( _In_ LCID Locale, _In_ LCTYPE LCType, _Out_opt_ LPTSTR lpLCData, _In_ int cchData); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318101(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318101")] public static extern int GetLocaleInfo(LCID Locale, LCTYPE LCType, IntPtr lpLCData, int cchData); /// Retrieves information about a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// /// The locale information to retrieve. For possible values, see the "Constants Used in the LCType Parameter of GetLocaleInfo, /// GetLocaleInfoEx, and SetLocaleInfo" section in Locale Information Constants. Note that only one piece of locale information can /// be specified per call. /// /// /// The application can use the binary OR operator to combine LOCALE_RETURN_NUMBER with any other allowed constant. In this case, the /// function retrieves the value as a number instead of a string. The buffer that receives the value must be at least the length of a /// DWORD value, which is 2. /// /// If LCType is set to LOCALE_IOPTIONALCALENDAR, the function retrieves only the first alternate calendar. /// /// Starting with Windows Vista, your applications should not use LOCALE_ILANGUAGE in the LCType parameter to avoid failure or /// retrieval of unexpected data. Instead, it is recommended for your applications to call GetLocaleInfoEx. /// /// /// /// Pointer to a buffer in which this function retrieves the requested locale information. This pointer is not used if cchData is set /// to 0. /// /// /// Size, in characters, of the data buffer indicated by lpLCData. Alternatively, the application can set this parameter to 0. In /// this case, the function does not use the lpLCData parameter and returns the required buffer size, including the terminating null character. /// /// /// /// Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the /// function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer /// retrieved in the data buffer, that is, 2. If the function succeeds and the value of cchData is 0, the return value is the /// required size, in characters including a null character, for the locale data buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetLocaleInfoEx( _In_opt_ LPCWSTR lpLocaleName, _In_ LCTYPE LCType, _Out_opt_ LPWSTR lpLCData, _In_ int cchData); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318103(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318103")] public static extern int GetLocaleInfoEx(string lpLocaleName, LCTYPE LCType, StringBuilder lpLCData, int cchData); /// Retrieves information about a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// /// The locale information to retrieve. For possible values, see the "Constants Used in the LCType Parameter of GetLocaleInfo, /// GetLocaleInfoEx, and SetLocaleInfo" section in Locale Information Constants. Note that only one piece of locale information can /// be specified per call. /// /// /// The application can use the binary OR operator to combine LOCALE_RETURN_NUMBER with any other allowed constant. In this case, the /// function retrieves the value as a number instead of a string. The buffer that receives the value must be at least the length of a /// DWORD value, which is 2. /// /// If LCType is set to LOCALE_IOPTIONALCALENDAR, the function retrieves only the first alternate calendar. /// /// Starting with Windows Vista, your applications should not use LOCALE_ILANGUAGE in the LCType parameter to avoid failure or /// retrieval of unexpected data. Instead, it is recommended for your applications to call GetLocaleInfoEx. /// /// /// /// Pointer to a buffer in which this function retrieves the requested locale information. This pointer is not used if cchData is set /// to 0. /// /// /// Size, in characters, of the data buffer indicated by lpLCData. Alternatively, the application can set this parameter to 0. In /// this case, the function does not use the lpLCData parameter and returns the required buffer size, including the terminating null character. /// /// /// /// Returns the number of characters retrieved in the locale data buffer if successful and cchData is a nonzero value. If the /// function succeeds, cchData is nonzero, and LOCALE_RETURN_NUMBER is specified, the return value is the size of the integer /// retrieved in the data buffer, that is, 2. If the function succeeds and the value of cchData is 0, the return value is the /// required size, in characters including a null character, for the locale data buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetLocaleInfoEx( _In_opt_ LPCWSTR lpLocaleName, _In_ LCTYPE LCType, _Out_opt_ LPWSTR lpLCData, _In_ int cchData); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318103(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318103")] public static extern int GetLocaleInfoEx(string lpLocaleName, LCTYPE LCType, IntPtr lpLCData, int cchData); /// Retrieves information about the current version of a specified NLS capability for a locale specified by identifier. /// The NLS capability to query. This value must be COMPARE_STRING. See the SYSNLS_FUNCTION enumeration. /// /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create an identifier or use one of the /// following predefined values. /// /// Windows Vista and later: The following custom locale identifiers are also supported. /// /// /// Pointer to an NLSVERSIONINFO structure. The application must initialize the dwNLSVersionInfoSize member to . /// /// /// Returns TRUE if and only if the application has supplied valid values in lpVersionInformation, or FALSE otherwise. /// To get extended error information, the application can call GetLastError, which can return one of the following error codes: /// // BOOL GetNLSVersion( _In_ NLS_FUNCTION Function, _In_ LCID Locale, _Inout_ LPNLSVERSIONINFO lpVersionInformation); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318105(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318105")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetNLSVersion(SYSNLS_FUNCTION Function, LCID Locale, ref NLSVERSIONINFO lpVersionInformation); /// Retrieves information about the current version of a specified NLS capability for a locale specified by name. /// The NLS capability to query. This value must be COMPARE_STRING. See the SYSNLS_FUNCTION enumeration. /// Pointer to a locale name, or one of the following predefined values. /// /// Pointer to an NLSVERSIONINFOEX structure. The application must initialize the dwNLSVersionInfoSize member to . /// /// /// Returns TRUE if and only if the application has supplied valid values in lpVersionInformation, or FALSE otherwise. /// To get extended error information, the application can call GetLastError, which can return one of the following error codes: /// // BOOL GetNLSVersionEx( _In_ NLS_FUNCTION function, _In_opt_ LPCWSTR lpLocaleName, _Inout_ LPNLSVERSIONINFOEX lpVersionInformation); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318107(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318107")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetNLSVersionEx(SYSNLS_FUNCTION function, string lpLocaleName, ref NLSVERSIONINFOEX lpVersionInformation); /// Formats a number string as a number string customized for a locale specified by identifier. /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default number format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// number format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can only contain the following /// characters. All other characters are invalid. The function returns an error if the string indicated by lpValue deviates from /// these rules. /// /// /// Pointer to a NUMBERFMT structure that contains number formatting information, with all members set to appropriate values. /// If this parameter does is not set to NULL, the function uses the locale only for formatting information not specified in /// the structure, for example, the locale-specific string value for the negative sign. /// /// Pointer to a buffer in which this function retrieves the formatted number string. /// /// Size, in TCHAR values, for the number string buffer indicated by lpNumberStr. Alternatively, the application can set this /// parameter to 0. In this case, the function returns the required size for the number string buffer, and does not use the /// lpNumberStr parameter. /// /// /// /// Returns the number of TCHAR values retrieved in the buffer indicated by lpNumberStr if successful. If the cchNumber parameter is /// set to 0, the function returns the number of characters required to hold the formatted number string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetNumberFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_ LPCTSTR lpValue, _In_opt_ const NUMBERFMT *lpFormat, _Out_opt_ // LPTSTR lpNumberStr, _In_ int cchNumber); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318110(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318110")] public static extern int GetNumberFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, string lpValue, in NUMBERFMT lpFormat, StringBuilder lpNumberStr, int cchNumber); /// Formats a number string as a number string customized for a locale specified by identifier. /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default number format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// number format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can only contain the following /// characters. All other characters are invalid. The function returns an error if the string indicated by lpValue deviates from /// these rules. /// /// /// Pointer to a NUMBERFMT structure that contains number formatting information, with all members set to appropriate values. /// If this parameter does is not set to NULL, the function uses the locale only for formatting information not specified in /// the structure, for example, the locale-specific string value for the negative sign. /// /// Pointer to a buffer in which this function retrieves the formatted number string. /// /// Size, in TCHAR values, for the number string buffer indicated by lpNumberStr. Alternatively, the application can set this /// parameter to 0. In this case, the function returns the required size for the number string buffer, and does not use the /// lpNumberStr parameter. /// /// /// /// Returns the number of TCHAR values retrieved in the buffer indicated by lpNumberStr if successful. If the cchNumber parameter is /// set to 0, the function returns the number of characters required to hold the formatted number string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetNumberFormat( _In_ LCID Locale, _In_ DWORD dwFlags, _In_ LPCTSTR lpValue, _In_opt_ const NUMBERFMT *lpFormat, _Out_opt_ // LPTSTR lpNumberStr, _In_ int cchNumber); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318110(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318110")] public static extern int GetNumberFormat(LCID Locale, LOCALE_FORMAT_FLAG dwFlags, string lpValue, [Optional] IntPtr lpFormat, StringBuilder lpNumberStr, int cchNumber); /// Formats a number string as a number string customized for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default number format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// number format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can only contain the following /// characters. All other characters are invalid. The function returns an error if the string indicated by lpValue deviates from /// these rules. /// /// /// Pointer to a NUMBERFMT structure that contains number formatting information, with all members set to appropriate values. /// If the application does not set this parameter to NULL, the function uses the locale only for formatting information not /// specified in the structure, for example, the locale string value for the negative sign. /// /// /// Pointer to a buffer in which this function retrieves the formatted number string. Alternatively, this parameter contains /// NULL if cchNumber is set to 0. In this case, the function returns the required size for the number string buffer. /// /// /// Size, in characters, for the number string buffer indicated by lpNumberStr. Alternatively, the application can set this parameter /// to 0. In this case, the function returns the required size for the number string buffer and does not use the lpNumberStr parameter. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpNumberStr if successful. If the cchNumber parameter is /// set to 0, the function returns the number of characters required to hold the formatted number string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetNumberFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ LPCWSTR lpValue, _In_opt_ const NUMBERFMT // *lpFormat, _Out_opt_ LPWSTR lpNumberStr, _In_ int cchNumber); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318113(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318113")] public static extern int GetNumberFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, string lpValue, in NUMBERFMT lpFormat, StringBuilder lpNumberStr, int cchNumber); /// Formats a number string as a number string customized for a locale specified by name. /// Pointer to a locale name, or one of the following predefined values. /// /// Flags controlling the operation of the function. The application must set this parameter to 0 if lpFormat is not set to /// NULL. In this case, the function formats the string using user overrides to the default number format for the locale. If /// lpFormat is set to NULL, the application can specify LOCALE_NOUSEROVERRIDE to format the string using the system default /// number format for the specified locale. /// /// /// Pointer to a null-terminated string containing the number string to format. This string can only contain the following /// characters. All other characters are invalid. The function returns an error if the string indicated by lpValue deviates from /// these rules. /// /// /// Pointer to a NUMBERFMT structure that contains number formatting information, with all members set to appropriate values. /// If the application does not set this parameter to NULL, the function uses the locale only for formatting information not /// specified in the structure, for example, the locale string value for the negative sign. /// /// /// Pointer to a buffer in which this function retrieves the formatted number string. Alternatively, this parameter contains /// NULL if cchNumber is set to 0. In this case, the function returns the required size for the number string buffer. /// /// /// Size, in characters, for the number string buffer indicated by lpNumberStr. Alternatively, the application can set this parameter /// to 0. In this case, the function returns the required size for the number string buffer and does not use the lpNumberStr parameter. /// /// /// /// Returns the number of characters retrieved in the buffer indicated by lpNumberStr if successful. If the cchNumber parameter is /// set to 0, the function returns the number of characters required to hold the formatted number string, including a terminating /// null character. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetNumberFormatEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwFlags, _In_ LPCWSTR lpValue, _In_opt_ const NUMBERFMT // *lpFormat, _Out_opt_ LPWSTR lpNumberStr, _In_ int cchNumber); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318113(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318113")] public static extern int GetNumberFormatEx(string lpLocaleName, LOCALE_FORMAT_FLAG dwFlags, string lpValue, [Optional] IntPtr lpFormat, StringBuilder lpNumberStr, int cchNumber); /// Returns the current original equipment manufacturer (OEM) code page identifier for the operating system. /// Returns the current OEM code page identifier for the operating system. // UINT GetOEMCP(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318114(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318114")] public static extern uint GetOEMCP(); /// Retrieves the process preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying the language format to use for the process preferred UI languages. The flags are mutually exclusive, and the /// default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// Pointer to the number of languages retrieved in pwszLanguagesBuffer. /// /// /// Optional. Pointer to a double null-terminated multi-string buffer in which the function retrieves an ordered, null-delimited list /// in preference order, starting with the most preferable. /// /// /// Alternatively if this parameter is set to NULL and pcchLanguagesBuffer is set to 0, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. The required size includes the two null characters. /// /// /// /// /// Pointer to the size, in characters, for the language buffer indicated by pwszLanguagesBuffer. On successful return from the /// function, the parameter contains the size of the retrieved language buffer. /// /// /// Alternatively if this parameter is set to 0 and pwszLanguagesBuffer is set to NULL, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// If the process preferred UI language list is empty or if the languages specified for the process are not valid, the function /// succeeds and returns an empty multistring in pwszLanguagesBuffer and 2 in the pcchLanguagesBuffer parameter. /// /// // BOOL GetProcessPreferredUILanguages( _In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_opt_ PZZWSTR pwszLanguagesBuffer, // _Inout_ PULONG pcchLanguagesBuffer); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318115(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318115")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetProcessPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags, out uint pulNumLanguages, IntPtr pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); /// Retrieves the process preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying the language format to use for the process preferred UI languages. The flags are mutually exclusive, and the /// default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// An ordered, null-delimited list in preference order, starting with the most preferable. [PInvokeData("Winnls.h", MSDNShortId = "dd318115")] public static IEnumerable GetProcessPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags) => GetLanguages(dwFlags, GetProcessPreferredUILanguages); /// Provides a list of scripts used in the specified Unicode string. /// /// Flags specifying options for script retrieval. /// /// /// /// Value /// Meaning /// /// /// GSS_ALLOW_INHERITED_COMMON /// /// Retrieve "Qaii" (INHERITED) and "Zyyy" (COMMON) script information. This flag does not affect the processing of unassigned /// characters. These characters in the input string always cause a "Zzzz" (UNASSIGNED script) to appear in the script string. /// /// /// /// By default, GetStringScripts ignores any inherited or common characters in the input string indicated by /// lpString. If GSS_ALLOW_INHERITED_COMMON is not set, neither "Qaii" nor "Zyyy" appears in the script string, even if the input /// string contains such characters. If GSS_ALLOW_INHERITED_COMMON is set, and if the input string contains inherited and/or common /// characters, "Qaii" and/or "Zyyy", respectively, appear in the script string. See the Remarks section. /// /// /// Pointer to the Unicode string to analyze. /// /// Size, in characters, of the Unicode string indicated by lpString. The application sets this parameter to -1 if the Unicode string /// is null-terminated. If the application sets this parameter to 0, the function retrieves a null Unicode string (L"\0") in /// lpScripts and returns 1. /// /// /// /// Pointer to a buffer in which this function retrieves a null-terminated string representing a list of scripts, using the /// 4-character notation used in ISO 15924. Each script name consists of four Latin characters, and the names are retrieved in /// alphabetical order. Each name, including the last, is followed by a semicolon. /// /// /// Alternatively, this parameter contains NULL if cchScripts is set to 0. In this case, the function returns the required /// size for the script buffer. /// /// /// /// Size, in characters, of the script buffer indicated by lpScripts. /// /// Alternatively, the application can set this parameter to 0. In this case, the function retrieves NULL in lpScripts and /// returns the required size for the script buffer. /// /// /// /// /// Returns the number of characters retrieved in the output buffer, including a terminating null character, if successful and /// cchScripts is set to a nonzero value. The function returns 1 to indicate that no script has been found, for example, when the /// input string only contains COMMON or INHERITED characters and GSS_ALLOW_INHERITED_COMMON is not set. Given that each found script /// adds five characters (four characters + delimiter), a simple mathematical operation provides the script count as (return_code - /// 1) / 5. /// /// /// If the function succeeds and the value of cchScripts is 0, the function returns the required size, in characters including a /// terminating null character, for the script buffer. The script count is as described above. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetStringScripts( _In_ DWORD dwFlags, _In_ LPCWSTR lpString, _In_ int cchString, _Out_opt_ LPWSTR lpScripts, _In_ int // cchScripts); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318116(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318116")] public static extern int GetStringScripts(GetStringScriptsFlag dwFlags, string lpString, int cchString, StringBuilder lpScripts, int cchScripts); /// Returns the language identifier for the system locale. /// /// /// Returns the language identifier for the system locale. This is the language used when displaying text in programs that do not /// support Unicode. It is set by the Administrator under Control Panel > Clock, Language, and Region > Change /// date, time, or number formats > Administrative tab. /// /// For more information on language identifiers, see Language Identifier Constants and Strings. /// // LANGID GetSystemDefaultLangID(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318120(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318120")] public static extern ushort GetSystemDefaultLangID(); /// Returns the locale identifier for the system locale. /// Returns the locale identifier for the system default locale, identified by LOCALE_SYSTEM_DEFAULT. // LCID GetSystemDefaultLCID(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318121(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318121")] public static extern LCID GetSystemDefaultLCID(); /// Retrieves the system default locale name. /// Pointer to a buffer in which this function retrieves the locale name. /// /// Size, in characters, of the output buffer indicated by lpLocaleName. The maximum possible character length of a locale name /// (including a terminating null character) is the value of LOCALE_NAME_MAX_LENGTH. This is the recommended size. /// /// /// /// Returns a value greater than 0 that indicates the length of the locale name, including the terminating null character, if successful. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetSystemDefaultLocaleName( _Out_ LPWSTR lpLocaleName, _In_ int cchLocaleName); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318122(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318122")] public static extern int GetSystemDefaultLocaleName(StringBuilder lpLocaleName, int cchLocaleName); /// /// Retrieves the language identifier for the system default UI language of the operating system, also known as the "install /// language" on Windows Vista and later. For more information, see User Interface Language Management. /// /// /// Returns the language identifier for the system default UI language of the operating system. For more information, see the Remarks section. /// // LANGID GetSystemDefaultUILanguage(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318123(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318123")] public static extern ushort GetSystemDefaultUILanguage(); /// Retrieves the system preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying language format and filtering. The following flags specify the format to use for the system preferred UI /// languages. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// The following flag specifies whether the function is to validate the list of languages (default) or retrieve the system preferred /// UI languages list exactly as it is stored in the registry. /// /// /// /// /// Value /// Meaning /// /// /// MUI_MACHINE_LANGUAGE_SETTINGS /// /// Retrieve the stored system preferred UI languages list, checking only to ensure that each language name corresponds to a valid /// NLS locale. If this flag is not set, the function retrieves the system preferred UI languages in pwszLanguagesBuffer, as long as /// the list is non-empty and meets the validation criteria. Otherwise, the function retrieves the system default user interface /// language in the language buffer. /// /// /// /// /// /// Pointer to the number of languages retrieved in pwszLanguagesBuffer. /// /// /// Optional. Pointer to a buffer in which this function retrieves an ordered, null-delimited system preferred UI languages list, in /// the format specified by dwFlags. This list ends with two null characters. /// /// /// Alternatively if this parameter is set to NULL and pcchLanguagesBuffer is set to 0, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. The required size includes the two null characters /// /// /// /// /// Pointer to the size, in characters, for the language buffer indicated by pwszLanguagesBuffer. On successful return from the /// function, the parameter contains the size of the retrieved language buffer. /// /// /// Alternatively if this parameter is set to 0 and pwszLanguagesBuffer is set to NULL, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// If the function fails for any other reason, the parameters pulNumLanguages and pcchLanguagesBuffer are undefined. /// // BOOL GetSystemPreferredUILanguages( _In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_opt_ PZZWSTR pwszLanguagesBuffer, // _Inout_ PULONG pcchLanguagesBuffer); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318124(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318124")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetSystemPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags, out uint pulNumLanguages, IntPtr pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); /// Retrieves the system preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying language format and filtering. The following flags specify the format to use for the system preferred UI /// languages. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// The following flag specifies whether the function is to validate the list of languages (default) or retrieve the system preferred /// UI languages list exactly as it is stored in the registry. /// /// /// /// /// Value /// Meaning /// /// /// MUI_MACHINE_LANGUAGE_SETTINGS /// /// Retrieve the stored system preferred UI languages list, checking only to ensure that each language name corresponds to a valid /// NLS locale. If this flag is not set, the function retrieves the system preferred UI languages in pwszLanguagesBuffer, as long as /// the list is non-empty and meets the validation criteria. Otherwise, the function retrieves the system default user interface /// language in the language buffer. /// /// /// /// /// /// An ordered, null-delimited system preferred UI languages list, in the format specified by dwFlags. [PInvokeData("Winnls.h", MSDNShortId = "dd318124")] public static IEnumerable GetSystemPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags) => GetLanguages(dwFlags, GetSystemPreferredUILanguages); /// Returns the locale identifier of the current locale for the calling thread. /// /// Returns the locale identifier of the locale associated with the current thread. /// /// Windows Vista: This function can return the identifier of a custom locale. If the current thread locale is a custom /// locale, the function returns LOCALE_CUSTOM_DEFAULT. If the current thread locale is a supplemental custom locale, the function /// can return LOCALE_CUSTOM_UNSPECIFIED. All supplemental locales share this locale identifier. /// /// // LCID GetThreadLocale(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318127(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318127")] public static extern LCID GetThreadLocale(); /// /// Retrieves the thread preferred UI languages for the current thread. For more information, see User Interface Language Management. /// /// /// /// Flags identifying language format and filtering. The following flags specify the language format to use for the thread preferred /// UI languages. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// The following flags specify filtering for the function to use in retrieving the thread preferred UI languages. The default flag /// is MUI_MERGE_USER_FALLBACK. /// /// /// /// /// Value /// Meaning /// /// /// MUI_MERGE_SYSTEM_FALLBACK /// /// Use the system fallback to retrieve a list that corresponds exactly to the language list used by the resource loader. This flag /// can be used only in combination with MUI_MERGE_USER_FALLBACK. Using the flags in combination alters the usual effect of /// MUI_MERGE_USER_FALLBACK by including fallback and neutral languages in the list. /// /// /// /// MUI_MERGE_USER_FALLBACK /// /// Retrieve a composite list consisting of the thread preferred UI languages, followed by process preferred UI languages, followed /// by any user preferred UI languages that are distinct from these, followed by the system default UI language, if it is not already /// in the list. If the user preferred UI languages list is empty, the function retrieves the system preferred UI languages. This /// flag cannot be combined with MUI_THREAD_LANGUAGES. /// /// /// /// MUI_THREAD_LANGUAGES /// /// Retrieve only the thread preferred UI languages for the current thread, or an empty list if no preferred languages are set for /// the current thread. This flag cannot be combined with MUI_MERGE_USER_FALLBACK or MUI_MERGE_SYSTEM_FALLBACK. /// /// /// /// MUI_UI_FALLBACK /// /// Retrieve a complete thread preferred UI languages list along with associated fallback and neutral languages. Use of this flag is /// equivalent to combining MUI_MERGE_SYSTEM_FALLBACK and MUI_MERGE_USER_FALLBACK. (Applicable only for Windows 7 and later). /// /// /// /// /// /// Pointer to the number of languages retrieved in pwszLanguagesBuffer. /// /// /// Optional. Pointer to a buffer in which this function retrieves an ordered, null-delimited thread preferred UI languages list, in /// the format specified by dwFlags. This list ends with two null characters. /// /// /// Alternatively if this parameter is set to NULL and pcchLanguagesBuffer is set to 0, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. The required size includes the two null characters. /// /// /// /// /// Pointer to the size, in characters, for the language buffer indicated by pwszLanguagesBuffer. On successful return from the /// function, the parameter contains the size of the retrieved language buffer. /// /// /// Alternatively if this parameter is set to 0 and pwszLanguagesBuffer is set to NULL, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which returns one of the following error codes: /// /// If the function fails for any other reason, the parameters pulNumLanguages and pcchLanguagesBuffer are undefined. /// // BOOL GetThreadPreferredUILanguages( _In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_opt_ PZZWSTR pwszLanguagesBuffer, // _Inout_ PULONG pcchLanguagesBuffer); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318128(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318128")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetThreadPreferredUILanguages(MUI_LANGUAGE_FILTER dwFlags, out uint pulNumLanguages, IntPtr pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); /// /// Retrieves the thread preferred UI languages for the current thread. For more information, see User Interface Language Management. /// /// /// /// Flags identifying language format and filtering. The following flags specify the language format to use for the thread preferred /// UI languages. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// The following flags specify filtering for the function to use in retrieving the thread preferred UI languages. The default flag /// is MUI_MERGE_USER_FALLBACK. /// /// /// /// /// Value /// Meaning /// /// /// MUI_MERGE_SYSTEM_FALLBACK /// /// Use the system fallback to retrieve a list that corresponds exactly to the language list used by the resource loader. This flag /// can be used only in combination with MUI_MERGE_USER_FALLBACK. Using the flags in combination alters the usual effect of /// MUI_MERGE_USER_FALLBACK by including fallback and neutral languages in the list. /// /// /// /// MUI_MERGE_USER_FALLBACK /// /// Retrieve a composite list consisting of the thread preferred UI languages, followed by process preferred UI languages, followed /// by any user preferred UI languages that are distinct from these, followed by the system default UI language, if it is not already /// in the list. If the user preferred UI languages list is empty, the function retrieves the system preferred UI languages. This /// flag cannot be combined with MUI_THREAD_LANGUAGES. /// /// /// /// MUI_THREAD_LANGUAGES /// /// Retrieve only the thread preferred UI languages for the current thread, or an empty list if no preferred languages are set for /// the current thread. This flag cannot be combined with MUI_MERGE_USER_FALLBACK or MUI_MERGE_SYSTEM_FALLBACK. /// /// /// /// MUI_UI_FALLBACK /// /// Retrieve a complete thread preferred UI languages list along with associated fallback and neutral languages. Use of this flag is /// equivalent to combining MUI_MERGE_SYSTEM_FALLBACK and MUI_MERGE_USER_FALLBACK. (Applicable only for Windows 7 and later). /// /// /// /// /// /// An ordered, null-delimited thread preferred UI languages list, in the format specified by dwFlags. [PInvokeData("Winnls.h", MSDNShortId = "dd318128")] public static IEnumerable GetThreadPreferredUILanguages(MUI_LANGUAGE_FILTER dwFlags) => GetLanguages(dwFlags, GetThreadPreferredUILanguages); /// Returns the language identifier of the first user interface language for the current thread. /// /// Returns the identifier for a language explicitly associated with the thread by SetThreadUILanguage or /// SetThreadPreferredUILanguages. Alternatively, if no language has been explicitly associated with the current thread, the /// identifier can indicate a user or system user interface language. /// // LANGID GetThreadUILanguage(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318129(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318129")] public static extern ushort GetThreadUILanguage(); /// Retrieves a variety of information about an installed UI language: /// /// Flags defining the format of the specified language. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// /// Pointer to languages for which the function is to retrieve information. This parameter indicates an ordered, null-delimited list /// of language identifiers or language names, depending on the flag setting. For information on the use of this parameter, see the /// Remarks section. /// /// /// /// Pointer to a buffer in which this function retrieves an ordered, null-delimited list of fallback languages, formatted as defined /// by the setting for dwFlags. This list ends with two null characters. /// /// /// Alternatively if this parameter is set to NULL and pcchLanguagesBuffer is set to 0, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. The required size includes the two null characters. /// /// /// /// /// Pointer to the size, in characters, for the language buffer indicated by pwszFallbackLanguages. On successful return from the /// function, the parameter contains the size of the retrieved language buffer. /// /// /// Alternatively if this parameter is set to 0 and pwszLanguagesBuffer is set to NULL, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. /// /// /// /// /// Pointer to flags indicating attributes of the input language list. The function always retrieves the flag characterizing the last /// language listed. /// /// /// /// /// Value /// Meaning /// /// /// MUI_FULL_LANGUAGE /// The language is fully localized. /// /// /// MUI_PARTIAL_LANGUAGE /// The language is partially localized. /// /// /// MUI_LIP_LANGUAGE /// The language is an LIP language. /// /// /// /// In addition, pdwAttributes includes one or both of the following flags, as appropriate. /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_INSTALLED /// The language is installed on this computer. /// /// /// MUI_LANGUAGE_LICENSED /// The language is appropriately licensed for the current user. /// /// /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return the following error codes: /// /// If GetLastError returns any other error code, the parameters pcchFallbackLanguages and pdwAttributes are undefined. /// // BOOL GetUILanguageInfo( _In_ DWORD dwFlags, _In_ PCZZWSTR pwmszLanguage, _Out_opt_ PZZWSTR pwszFallbackLanguages, _Inout_opt_ // PDWORD pcchFallbackLanguages, _Out_ PDWORD pdwAttributes); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318133(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318133")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetUILanguageInfo(MUI_LANGUAGE_ENUM dwFlags, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NullTermStringArrayMarshaler), MarshalCookie = "Unicode")] string[] pwmszLanguage, IntPtr pwszFallbackLanguages, ref uint pcchFallbackLanguages, out MUI_LANGUAGE pdwAttributes); /// /// Retrieves the two-letter International Organization for Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series /// M, Number 49 (M.49) code for the default geographical location of the user. /// /// /// Pointer to a buffer in which this function should write the null-terminated two-letter ISO 3166-1 or numeric UN M.49 code for the /// default geographic location of the user. /// /// /// The size of the buffer that the geoName parameter specifies. If this value is zero, the function only returns the number of /// characters that function would copy to the output buffer, but does not write the name of the default geographic location of the /// user to the buffer. /// /// /// /// The number of characters the function would copy to the output buffer, if the value of the geoNameCount parameter is zero. /// Otherwise, the number of characters that the function copied to the buffer that the geoName parameter specifies. /// /// /// Zero indicates that the function failed. To get extended error information, call GetLastError, which can return one of the /// following error codes: /// /// /// /// /// Return code /// Description /// /// /// ERROR_INVALID_PARAMETER /// A parameter value was not valid. /// /// /// ERROR_BADDB /// The function could not read information from the registry. /// /// /// ERROR_INSUFFICIENT_BUFFER /// The buffer that the geoName parameter specifies is too small for the string. /// /// /// /// // int WINAPI GetUserDefaultGeoName( _Out_ LPWSTR geoName, _In_ geoNameCount int); https://msdn.microsoft.com/en-us/library/windows/desktop/mt826490(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "mt826490")] public static extern int GetUserDefaultGeoName(StringBuilder geoName, int geoNameCount); /// Returns the language identifier of the Region Format setting for the current user. /// /// /// Returns the language identifier for the current user as set under Control Panel > Clock, Language, and Region /// > Change date, time, or number formats > Formats tab > Format dropdown. /// /// For more information on language identifiers, see Language Identifier Constants and Strings. /// // LANGID GetUserDefaultLangID(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318134(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318134")] public static extern ushort GetUserDefaultLangID(); /// Returns the locale identifier for the user default locale. /// /// Returns the locale identifier for the user default locale, represented as LOCALE_USER_DEFAULT. If the user default locale is a /// custom locale, this function always returns LOCALE_CUSTOM_DEFAULT, regardless of the custom locale that is selected. For example, /// whether the user locale is Hawaiian (US), haw-US, or Fijiian (Fiji), fj-FJ, the function returns the same value. /// // LCID GetUserDefaultLCID(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318135(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318135")] public static extern LCID GetUserDefaultLCID(); /// Retrieves the user default locale name. /// Pointer to a buffer in which this function retrieves the locale name. /// /// Size, in characters, of the buffer indicated by lpLocaleName. The maximum possible length of a locale name, including a /// terminating null character, is LOCALE_NAME_MAX_LENGTH. This is the recommended size to supply in this parameter. /// /// /// Returns the size of the buffer containing the locale name, including the terminating null character, if successful. /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int GetUserDefaultLocaleName( _Out_ LPWSTR lpLocaleName, _In_ int cchLocaleName); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318136(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318136")] public static extern int GetUserDefaultLocaleName(StringBuilder lpLocaleName, int cchLocaleName); /// /// Returns the language identifier for the user UI language for the current user. If the current user has not set a language, /// GetUserDefaultUILanguage returns the preferred language set for the system. If there is no preferred language set for the /// system, then the system default UI language (also known as "install language") is returned. For more information about the user /// UI language, see User Interface Language Management. /// /// Returns the language identifier for the user UI language for the current user. // LANGID GetUserDefaultUILanguage(void); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318137(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318137")] public static extern ushort GetUserDefaultUILanguage(); /// /// /// [ GetUserGeoID is available for use in the operating systems specified in the Requirements section. It may be altered or /// unavailable in subsequent versions. Instead, use GetUserDefaultGeoName.] /// /// Retrieves information about the geographical location of the user. For more information, see Table of Geographical Locations. /// /// Geographical location class to return. Possible values are defined by the SYSGEOCLASS enumeration. /// /// Returns the geographical location identifier of the user if SetUserGeoID has been called before to set the identifier. /// If no geographical location identifier has been set for the user, the function returns GEOID_NOT_AVAILABLE. /// // GEOID GetUserGeoID( _In_ GEOCLASS GeoClass); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318138(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318138")] public static extern int GetUserGeoID(SYSGEOCLASS GeoClass); /// Retrieves information about the user preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying language format and filtering. The following flags specify the language format to use for the user preferred UI /// languages list. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// Pointer to the number of languages retrieved in pwszLanguagesBuffer. /// /// /// Optional. Pointer to a buffer in which this function retrieves an ordered, null-delimited user preferred UI languages list, in /// the format specified by dwflags. This list ends with two null characters. /// /// /// Alternatively if this parameter is set to NULL and pcchLanguagesBuffer is set to 0, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. The required size includes the two null characters. /// /// /// /// /// Pointer to the size, in characters, for the language buffer indicated by pwszLanguagesBuffer. On successful return from the /// function, the parameter contains the size of the retrieved language buffer. /// /// /// Alternatively if this parameter is set to 0 and pwszLanguagesBuffer is set to NULL, the function retrieves the required /// size of the language buffer in pcchLanguagesBuffer. /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// If the function fails for any other reason, the values of pulNumLanguages and pcchLanguagesBuffer are undefined. /// // BOOL GetUserPreferredUILanguages( _In_ DWORD dwFlags, _Out_ PULONG pulNumLanguages, _Out_opt_ PZZWSTR pwszLanguagesBuffer, _Inout_ // PULONG pcchLanguagesBuffer); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318139(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318139")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool GetUserPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags, out uint pulNumLanguages, IntPtr pwszLanguagesBuffer, ref uint pcchLanguagesBuffer); /// Retrieves information about the user preferred UI languages. For more information, see User Interface Language Management. /// /// /// Flags identifying language format and filtering. The following flags specify the language format to use for the user preferred UI /// languages list. The flags are mutually exclusive, and the default is MUI_LANGUAGE_NAME. /// /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// Retrieve the language strings in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// Retrieve the language strings in language name format. /// /// /// /// /// An ordered, null-delimited user preferred UI languages list, in the format specified by dwflags. [PInvokeData("Winnls.h", MSDNShortId = "dd318139")] public static IEnumerable GetUserPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags) => GetLanguages(dwFlags, GetUserPreferredUILanguages); /// /// Converts an internationalized domain name (IDN) or another internationalized label to a Unicode (wide character) representation /// of the ASCII string that represents the name in the Punycode transfer encoding syntax. /// /// /// Flags specifying conversion options. The following table lists the possible values. /// /// /// /// Value /// Meaning /// /// /// IDN_ALLOW_UNASSIGNED /// /// Allow unassigned code points to be included in the input string. The default is to not allow unassigned code points, and fail /// with an extended error code of ERROR_INVALID_NAME.This flag allows the function to process characters that are not currently /// legal in IDNs, but might be legal in later versions of the IDNA standard. If your application encodes unassigned code points as /// Punycode, the resulting domain names should be illegal. Security can be compromised if a later version of IDNA makes these names /// legal or if an application filters out the illegal characters to try to create a legal domain name. For more information, see /// Handling Internationalized Domain Names (IDNs). /// /// /// /// IDN_USE_STD3_ASCII_RULES /// /// Filter out ASCII characters that are not allowed in STD3 names. The only ASCII characters allowed in the input Unicode string are /// letters, digits, and the hyphen-minus. The string cannot begin or end with the hyphen-minus. The function fails if the input /// Unicode string contains ASCII characters, such as &quot;[&quot;, &quot;]&quot;, or &quot;/&quot;, that /// cannot occur in domain names.The function fails if the input Unicode string contains control characters (U+0001 through U+0020) /// or the &quot;delete&quot; character (U+007F). In either case, this flag has no effect on the non-ASCII characters that /// are allowed in the Unicode string. /// /// /// /// IDN_EMAIL_ADDRESS /// /// Starting with Windows 8: Enable EAI algorithmic fallback for the local parts of email addresses (such as /// &lt;local&gt;@microsoft.com). The default is for this function to fail when an email address has an invalid address or /// syntax.An application can set this flag to enable Email Address Internationalization (EAI) to return a discoverable fallback /// address, if possible. For more information, see the IETF Email Address Internationalization (eai) Charter. /// /// /// /// IDN_RAW_PUNYCODE /// Starting with Windows 8: Disable the validation and mapping of Punycode. /// /// /// /// /// Pointer to a Unicode string representing an IDN or another internationalized label. /// Count of characters in the input Unicode string indicated by lpUnicodeCharStr. /// /// Pointer to a buffer that receives a Unicode string consisting only of characters in the ASCII character set. On return from this /// function, the buffer contains the ASCII string equivalent of the string provided in lpUnicodeCharStr under Punycode. /// Alternatively, the function can retrieve NULL for this parameter, if cchASCIIChar is set to 0. In this case, the function /// returns the size required for this buffer. /// /// /// Size of the buffer indicated by lpASCIICharStr. The application can set the parameter to 0 to retrieve NULL in lpASCIICharStr. /// /// /// /// Returns the number of characters retrieved in lpASCIICharStr if successful. The retrieved string is null-terminated only if the /// input Unicode string is null-terminated. /// /// /// If the function succeeds and the value of cchASCIIChar is 0, the function returns the required size, in characters including a /// terminating null character if it was part of the input buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int IdnToAscii( _In_ DWORD dwFlags, _In_ LPCWSTR lpUnicodeCharStr, _In_ int cchUnicodeChar, _Out_opt_ LPWSTR lpASCIICharStr, _In_ // int cchASCIIChar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318149(v=vs.85).aspx [DllImport(Lib.Normaliz, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318149")] public static extern int IdnToAscii(IDN_FLAGS dwFlags, string lpUnicodeCharStr, int cchUnicodeChar, [Out] StringBuilder lpASCIICharStr, int cchASCIIChar); /// /// Converts an internationalized domain name (IDN) or another internationalized label to the NamePrep form specified by Network /// Working Group RFC 3491, but does not perform the additional conversion to Punycode. For more information and links to related /// draft standards, see Handling Internationalized Domain Names (IDNs). /// /// Flags specifying conversion options. For detailed definitions, see the dwFlags parameter of IdnToAscii. /// Pointer to a Unicode string representing an IDN or another internationalized label. /// Count of Unicode characters in the input Unicode string indicated by lpUnicodeCharStr. /// /// Pointer to a buffer that receives a version of the input Unicode string converted through NamePrep processing. Alternatively, the /// function can retrieve NULL for this parameter, if cchNameprepChar is set to 0. In this case, the function returns the size /// required for this buffer. /// /// /// Size, in characters, of the buffer indicated by lpNameprepCharStr. The application can set the size to 0 to retrieve NULL /// in lpNameprepCharStr and have the function return the required buffer size. /// /// /// /// Returns the number of characters retrieved in lpNameprepCharStr if successful. The retrieved string is null-terminated only if /// the input Unicode string is null-terminated. /// /// /// If the function succeeds and the value of cchNameprepChar is 0, the function returns the required size, in characters including a /// terminating null character if it was part of the input buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int IdnToNameprepUnicode( _In_ DWORD dwFlags, _In_ LPCWSTR lpUnicodeCharStr, _In_ int cchUnicodeChar, _Out_opt_ LPWSTR // lpNameprepCharStr, _In_ int cchNameprepChar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318150(v=vs.85).aspx [DllImport(Lib.Normaliz, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318150")] public static extern int IdnToNameprepUnicode(IDN_FLAGS dwFlags, string lpUnicodeCharStr, int cchUnicodeChar, [Out] StringBuilder lpNameprepCharStr, int cchNameprepChar); /// /// Converts the Punycode form of an internationalized domain name (IDN) or another internationalized label to the normal Unicode /// UTF-16 encoding syntax. /// /// Flags specifying conversion options. For detailed definitions, see the dwFlags parameter of IdnToAscii. /// /// Pointer to a string representing the Punycode encoding of an IDN or another internationalized label. This string must consist /// only of ASCII characters, and can include Punycode-encoded Unicode. The function decodes Punycode values to their UTF-16 values. /// /// Count of characters in the input string indicated by lpASCIICharStr. /// /// Pointer to a buffer that receives a normal Unicode UTF-16 encoding equivalent to the Punycode value of the input string. /// Alternatively, the function can retrieve NULL for this parameter, if cchUnicodeChar set to 0. In this case, the function /// returns the size required for this buffer. /// /// /// Size, in characters, of the buffer indicated by lpUnicodeCharStr. The application can set the size to 0 to retrieve NULL /// in lpUnicodeCharStr and have the function return the required buffer size. /// /// /// /// Returns the number of characters retrieved in lpUnicodeCharStr if successful. The retrieved string is null-terminated only if the /// input string is null-terminated. /// /// /// If the function succeeds and the value of cchUnicodeChar is 0, the function returns the required size, in characters including a /// terminating null character if it was part of the input buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int IdnToUnicode( _In_ DWORD dwFlags, _In_ LPCWSTR lpASCIICharStr, _In_ int cchASCIIChar, _Out_opt_ LPWSTR lpUnicodeCharStr, _In_ // int cchUnicodeChar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318151(v=vs.85).aspx [DllImport(Lib.Normaliz, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318151")] public static extern int IdnToUnicode(IDN_FLAGS dwFlags, string lpASCIICharStr, int cchASCIIChar, [Out] StringBuilder lpUnicodeCharStr, int cchUnicodeChar); /// /// Determines if a specified character is a lead byte for the system default Windows ANSI code page ( CP_ACP). A lead byte is /// the first byte of a two-byte character in a double-byte character set (DBCS) for the code page. /// /// The character to test. /// /// Returns a nonzero value if the test character is potentially a lead byte. The function returns 0 if the test character is not a /// lead byte or if it is a single-byte character. To get extended error information, the application can call GetLastError. /// // BOOL IsDBCSLeadByte( _In_ BYTE TestChar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318664(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318664")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsDBCSLeadByte(byte TestChar); /// /// Determines if a specified character is potentially a lead byte. A lead byte is the first byte of a two-byte character in a /// double-byte character set (DBCS) for the code page. /// /// /// /// Identifier of the code page used to check lead byte ranges. This parameter can be one of the code page identifiers defined in /// Unicode and Character Set Constants or one of the following predefined values. This function validates lead byte values only in /// code pages 932, 936, 949, 950, and 1361. /// /// /// /// /// Value /// Meaning /// /// /// CP_ACP /// Use system default Windows ANSI code page. /// /// /// CP_MACCP /// Use the system default Macintosh code page. /// /// /// CP_OEMCP /// Use system default OEM code page. /// /// /// CP_THREAD_ACP /// Use the Windows ANSI code page for the current thread. /// /// /// /// /// The character to test. /// /// Returns a nonzero value if the byte is a lead byte. The function returns 0 if the byte is not a lead byte or if the character is /// a single-byte character. To get extended error information, the application can call GetLastError. /// // BOOL IsDBCSLeadByteEx( _In_ UINT CodePage, _In_ BYTE TestChar); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318667(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318667")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsDBCSLeadByteEx(uint CodePage, byte TestChar); /// Determines if each character in a string has a defined result for a specified NLS capability. /// NLS capability to query. This value must be COMPARE_STRING. See the SYSNLS_FUNCTION enumeration. /// Flags defining the function. Must be 0. /// /// Pointer to an NLSVERSIONINFO structure containing version information. Typically, the information is obtained by calling /// GetNLSVersion. The application sets this parameter to NULL if the function is to use the current version. /// /// Pointer to the UTF-16 string to examine. /// /// /// Number of UTF-16 characters in the string indicated by lpString. This count can include a terminating null character. If the /// terminating null character is included in the character count, it does not affect the checking behavior because the terminating /// null character is always defined. /// /// /// The application should supply -1 to indicate that the string is null-terminated. In this case, the function itself calculates the /// string length. /// /// /// /// Returns TRUE if successful, only if the input string is valid, or FALSE otherwise. To get extended error /// information, the application can call GetLastError, which can return one of the following error codes: /// // BOOL IsNLSDefinedString( _In_ NLS_FUNCTION Function, _In_ DWORD dwFlags, _In_ LPNLSVERSIONINFO lpVersionInformation, _In_ LPCWSTR // lpString, _In_ INT cchStr); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318669(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318669")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsNLSDefinedString(SYSNLS_FUNCTION Function, [Optional] uint dwFlags, ref NLSVERSIONINFO lpVersionInformation, string lpString, int cchStr = -1); /// Determines if each character in a string has a defined result for a specified NLS capability. /// NLS capability to query. This value must be COMPARE_STRING. See the SYSNLS_FUNCTION enumeration. /// Flags defining the function. Must be 0. /// /// Pointer to an NLSVERSIONINFO structure containing version information. Typically, the information is obtained by calling /// GetNLSVersion. The application sets this parameter to NULL if the function is to use the current version. /// /// Pointer to the UTF-16 string to examine. /// /// /// Number of UTF-16 characters in the string indicated by lpString. This count can include a terminating null character. If the /// terminating null character is included in the character count, it does not affect the checking behavior because the terminating /// null character is always defined. /// /// /// The application should supply -1 to indicate that the string is null-terminated. In this case, the function itself calculates the /// string length. /// /// /// /// Returns TRUE if successful, only if the input string is valid, or FALSE otherwise. To get extended error /// information, the application can call GetLastError, which can return one of the following error codes: /// // BOOL IsNLSDefinedString( _In_ NLS_FUNCTION Function, _In_ DWORD dwFlags, _In_ LPNLSVERSIONINFO lpVersionInformation, _In_ LPCWSTR // lpString, _In_ INT cchStr); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318669(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318669")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsNLSDefinedString(SYSNLS_FUNCTION Function, [Optional] uint dwFlags, [Optional] IntPtr lpVersionInformation, string lpString, int cchStr = -1); /// /// Verifies that a string is normalized according to Unicode 4.0 TR#15. For more information, see Using Unicode Normalization to /// Represent Strings. /// /// Normalization form to use. NORM_FORM specifies the standard Unicode normalization forms. /// Pointer to the string to test. /// /// Length, in characters, of the input string, including a null terminating character. If this value is -1, the function assumes the /// string to be null-terminated and calculates the length automatically. /// /// /// /// Returns TRUE if the input string is already normalized to the appropriate form, or FALSE otherwise. To get extended /// error information, the application can call GetLastError, which can return one of the following error codes: /// /// If you need to reliably determine FALSE from an error condition, then it must call SetLastError(ERROR_SUCCESS). /// // BOOL IsNormalizedString( _In_ NORM_FORM NormForm, _In_ LPCWSTR lpString, _In_ int cwLength); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318671(v=vs.85).aspx [DllImport(Lib.Normaliz, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318671")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsNormalizedString(NORM_FORM NormForm, string lpString, int cwLength = -1); /// Determines if a specified code page is valid. /// Code page identifier for the code page to check. /// Returns a nonzero value if the code page is valid, or 0 if the code page is invalid. // BOOL IsValidCodePage( _In_ UINT CodePage); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318674(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318674")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsValidCodePage(uint CodePage); /// /// Determines if a language group is installed or supported on the operating system. For more information, see NLS Terminology. /// /// Identifier of language group to validate. This parameter can have one of the following values: /// /// /// Flag specifying the validity test to apply to the language group identifier. This parameter can be set to one of the following values. /// /// /// /// /// Value /// Meaning /// /// /// LGRPID_INSTALLED /// Determine if language group identifier is both supported and installed. /// /// /// LGRPID_SUPPORTED /// Determine if language group identifier is supported. /// /// /// /// /// Returns TRUE if the language group identifier passes the specified validity test, or FALSE otherwise. // BOOL IsValidLanguageGroup( _In_ LGRPID LanguageGroup, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318677(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318677")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsValidLanguageGroup(LGRPID LanguageGroup, LGRPID_FLAGS dwFlags = 0); /// /// /// [ IsValidLocale is available for use in the operating systems specified in the Requirements section. It may be altered or /// unavailable in subsequent versions. Instead, use IsValidLocaleName to determine the validity of a supplemental locale.] /// /// /// Determines if the specified locale is installed or supported on the operating system. For more information, see Locales and Languages. /// /// /// /// Locale identifier of the locale to validate. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// /// Flag specifying the validity test to apply to the locale identifier. This parameter can have one of the following values. /// /// /// /// Value /// Meaning /// /// /// LCID_INSTALLED /// Determine if the locale identifier is both supported and installed. /// /// /// LCID_SUPPORTED /// Determine if the locale identifier is supported. /// /// /// 0x39 /// /// Do not use. Instead, use LCID_INSTALLED.Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP and Windows 2000: /// Setting dwFlags to 0x39 is a special case that can behave like LCID_INSTALLED for some locales on some versions of Windows. /// /// /// /// /// /// /// Returns a nonzero value if the locale identifier passes the specified validity test. The function returns 0 if it does not succeed. /// // BOOL IsValidLocale( _In_ LCID Locale, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318679(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318679")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsValidLocale(LCID Locale, LCID_FLAGS dwFlags); /// Determines if the specified locale name is valid for a locale that is installed or supported on the operating system. /// Pointer to the locale name to validate. /// Returns a nonzero value if the locale name is valid, or returns 0 for an invalid name. // BOOL IsValidLocaleName( _In_ LPCWSTR lpLocaleName); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318681(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318681")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsValidLocaleName(string lpLocaleName); /// Determines if the NLS version is valid for a given NLS function. /// The NLS capability to query. This value must be COMPARE_STRING. See the SYSNLS_FUNCTION enumeration. /// Pointer to a locale name, or one of the following predefined values. /// /// Pointer to an NLSVERSIONINFOEX structure. The application must initialize the dwNLSVersionInfoSize member to . /// /// Returns a nonzero value if the NLS version is valid, or zero if the version is invalid. // DWORD IsValidNLSVersion( _In_ NLS_FUNCTION function, _In_opt_ LPCWSTR lpLocaleName, _In_ LPNLSVERSIONINFOEX lpVersionInformation); https://msdn.microsoft.com/en-us/library/windows/desktop/hh706739(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "hh706739")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool IsValidNLSVersion(SYSNLS_FUNCTION function, string lpLocaleName, ref NLSVERSIONINFOEX lpVersionInformation); /// Converts a locale identifier to a locale name. /// /// /// Locale identifier to translate. You can use the MAKELCID macro to create a locale identifier or use one of the following /// predefined values. /// /// Windows Vista: The following custom locale identifiers are also supported. /// /// /// Pointer to a buffer in which this function retrieves the locale name, or one of the following predefined values. /// /// /// /// Size, in characters, of the locale name buffer. The maximum possible length of a locale name, including a terminating null /// character, is LOCALE_NAME_MAX_LENGTH. This is the recommended size to supply for this parameter. /// /// /// Alternatively, the application can set this parameter to 0. In this case, the function returns the required size for the locale /// name buffer. /// /// /// /// Before Windows 7: Reserved; should always be 0. /// Starting with Windows 7: Can be set to LOCALE_ALLOW_NEUTRAL_NAMES to allow the return of a neutral name. /// /// /// /// Returns the count of characters, including the terminating null character, in the locale name if successful. If the function /// succeeds and the value of cchName is 0, the return value is the required size, in characters (including nulls), for the locale /// name buffer. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int LCIDToLocaleName( _In_ LCID Locale, _Out_opt_ LPWSTR lpName, _In_ int cchName, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318698(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd318698")] public static extern int LCIDToLocaleName(LCID Locale, StringBuilder lpName, int cchName, LCTYPE dwFlags); /// /// For a locale specified by identifier, maps one input character string to another using a specified transformation, or generates a /// sort key for the input string. /// /// /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// The following custom locale identifiers are also supported. /// /// /// Flags specifying the type of transformation to use during string mapping or the type of sort key to generate. For detailed /// definitions, see the dwMapFlags parameter of LCMapStringEx. /// /// /// Pointer to a source string that the function maps or uses for sort key generation. This string cannot have a size of 0. /// /// /// /// Size, in characters, of the source string indicated by lpSrcStr. The size of the source string can include the terminating null /// character, but does not have to. If the terminating null character is included, the mapping behavior of the function is not /// greatly affected because the terminating null character is considered to be unsortable and always maps to itself. /// /// /// The application can set the parameter to any negative value to specify that the source string is null-terminated. In this case, /// if LCMapString is being used in its string-mapping mode, the function calculates the string length itself, and /// null-terminates the mapped string indicated by lpDestStr. /// /// The application cannot set this parameter to 0. /// /// /// Pointer to a buffer in which this function retrieves the mapped string or a sort key. When the application uses this function to /// generate a sort key, the destination string can contain an odd number of bytes. The LCMAP_BYTEREV flag only reverses an even /// number of bytes. The last byte (odd-positioned) in the sort key is not reversed. /// /// /// /// Size, in characters, of the destination string indicated by lpDestStr. If the application is using the function for string /// mapping, it supplies a character count for this parameter. If space for a terminating null character is included in cchSrc, /// cchDest must also include space for a terminating null character. /// /// /// If the application is using the function to generate a sort key, it supplies a byte count for the size. This byte count must /// include space for the sort key 0x00 terminator. /// /// /// The application can set cchDest to 0. In this case, the function does not use the lpDestStr parameter and returns the required /// buffer size for the mapped string or sort key. /// /// /// /// /// Returns the number of characters or bytes in the translated string or sort key, including a terminating null character, if /// successful. If the function succeeds and the value of cchDest is 0, the return value is the size of the buffer required to hold /// the translated string or sort key, including a terminating null character. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int LCMapString( _In_ LCID Locale, _In_ DWORD dwMapFlags, _In_ LPCTSTR lpSrcStr, _In_ int cchSrc, _Out_opt_ LPTSTR lpDestStr, _In_ // int cchDest); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318700(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd318700")] public static extern int LCMapString(LCID Locale, uint dwMapFlags, string lpSrcStr, int cchSrc, StringBuilder lpDestStr, int cchDest); /// /// For a locale specified by name, maps an input character string to another using a specified transformation, or generates a sort /// key for the input string. /// /// Pointer to a locale name, or one of the following predefined values. /// /// /// Flag specifying the type of transformation to use during string mapping or the type of sort key to generate. This parameter can /// have the following values. /// /// /// /// /// Flag /// Meaning /// /// /// LCMAP_BYTEREV /// Use byte reversal. For example, if the application passes in 0x3450 0x4822, the result is 0x5034 0x2248. /// /// /// LCMAP_FULLWIDTH /// /// Use Unicode (wide) characters where applicable. This flag and LCMAP_HALFWIDTH are mutually exclusive. With this flag, the mapping /// may use Normalization Form C even if an input character is already full-width. For example, the string &quot;は゛&quot; /// (which is already full-width) is normalized to &quot;ば&quot;. See Unicode normalization forms. /// /// /// /// LCMAP_HALFWIDTH /// Use narrow characters where applicable. This flag and LCMAP_FULLWIDTH are mutually exclusive. /// /// /// LCMAP_HIRAGANA /// Map all katakana characters to hiragana. This flag and LCMAP_KATAKANA are mutually exclusive. /// /// /// LCMAP_KATAKANA /// Map all hiragana characters to katakana. This flag and LCMAP_HIRAGANA are mutually exclusive. /// /// /// LCMAP_LINGUISTIC_CASING /// /// Use linguistic rules for casing, instead of file system rules (default). This flag is valid with LCMAP_LOWERCASE or /// LCMAP_UPPERCASE only. /// /// /// /// LCMAP_LOWERCASE /// For locales and scripts capable of handling uppercase and lowercase, map all characters to lowercase. /// /// /// LCMAP_SIMPLIFIED_CHINESE /// /// Map traditional Chinese characters to simplified Chinese characters. This flag and LCMAP_TRADITIONAL_CHINESE are mutually exclusive. /// /// /// /// LCMAP_SORTKEY /// /// Produce a normalized sort key. If the LCMAP_SORTKEY flag is not specified, the function performs string mapping. For details of /// sort key generation and string mapping, see the Remarks section. /// /// /// /// LCMAP_TITLECASE /// Windows 7: Map all characters to title case, in which the first letter of each major word is capitalized. /// /// /// LCMAP_TRADITIONAL_CHINESE /// /// Map simplified Chinese characters to traditional Chinese characters. This flag and LCMAP_SIMPLIFIED_CHINESE are mutually exclusive. /// /// /// /// LCMAP_UPPERCASE /// For locales and scripts capable of handling uppercase and lowercase, map all characters to uppercase. /// /// /// /// /// The following flags can be used alone, with one another, or with the LCMAP_SORTKEY and/or LCMAP_BYTEREV flags. However, they /// cannot be combined with the other flags listed above. /// /// /// /// /// Flag /// Meaning /// /// /// NORM_IGNORENONSPACE /// Ignore nonspacing characters. For many scripts (notably Latin scripts), NORM_IGNORENONSPACE coincides with LINGUISTIC_IGNOREDIACRITIC. /// /// /// NORM_IGNORESYMBOLS /// Ignore symbols and punctuation. /// /// /// /// The flags listed below are used only with the LCMAP_SORTKEY flag. /// /// /// /// Flag /// Meaning /// /// /// LINGUISTIC_IGNORECASE /// Ignore case, as linguistically appropriate. /// /// /// LINGUISTIC_IGNOREDIACRITIC /// Ignore nonspacing characters, as linguistically appropriate. /// /// /// NORM_IGNORECASE /// Ignore case. For many scripts (notably Latin scripts), NORM_IGNORECASE coincides with LINGUISTIC_IGNORECASE. /// /// /// NORM_IGNOREKANATYPE /// /// Do not differentiate between hiragana and katakana characters. Corresponding hiragana and katakana characters compare as equal. /// /// /// /// NORM_IGNOREWIDTH /// /// Ignore the difference between half-width and full-width characters, for example, C a t == cat. The full-width form is a /// formatting distinction used in Chinese and Japanese scripts. /// /// /// /// NORM_LINGUISTIC_CASING /// Use linguistic rules for casing, instead of file system rules (default). /// /// /// SORT_DIGITSASNUMBERS /// Windows 7: Treat digits as numbers during sorting, for example, sort &quot;2&quot; before &quot;10&quot;. /// /// /// SORT_STRINGSORT /// Treat punctuation the same as symbols. /// /// /// /// /// /// Pointer to a source string that the function maps or uses for sort key generation. This string cannot have a size of 0. /// /// /// /// Size, in characters, of the source string indicated by lpSrcStr. The size of the source string can include the terminating null /// character, but does not have to. If the terminating null character is included, the mapping behavior of the function is not /// greatly affected because the terminating null character is considered to be unsortable and always maps to itself. /// /// /// The application can set this parameter to any negative value to specify that the source string is null-terminated. In this case, /// if LCMapStringEx is being used in its string-mapping mode, the function calculates the string length itself, and /// null-terminates the mapped string indicated by lpDestStr. /// /// The application cannot set this parameter to 0. /// /// /// Pointer to a buffer in which this function retrieves the mapped string or sort key. If the application specifies LCMAP_SORTKEY, /// the function stores a sort key in the buffer as an opaque array of byte values that can include embedded 0 bytes. /// /// /// /// Size, in characters, of the buffer indicated by lpDestStr. If the application is using the function for string mapping, it /// supplies a character count for this parameter. If space for a terminating null character is included in cchSrc, cchDest must also /// include space for a terminating null character. /// /// /// If the application is using the function to generate a sort key, it supplies a byte count for the size. This byte count must /// include space for the sort key 0x00 terminator. /// /// /// The application can set cchDest to 0. In this case, the function does not use the lpDestStr parameter and returns the required /// buffer size for the mapped string or sort key. /// /// /// /// /// Pointer to an NLSVERSIONINFOEX structure that contains the version information about the relevant NLS capability; usually /// retrieved from GetNLSVersionEx. /// /// Windows Vista, Windows 7: Reserved; must set to NULL. /// /// Reserved; must be NULL. /// Reserved; must be 0. /// /// /// Returns the number of characters or bytes in the translated string or sort key, including a terminating null character, if /// successful. If the function succeeds and the value of cchDest is 0, the return value is the size of the buffer required to hold /// the translated string or sort key, including a terminating null character if the input was null terminated. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int LCMapStringEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwMapFlags, _In_ LPCWSTR lpSrcStr, _In_ int cchSrc, _Out_opt_ LPWSTR // lpDestStr, _In_ int cchDest, _In_opt_ LPNLSVERSIONINFO lpVersionInformation, _In_opt_ LPVOID lpReserved, _In_opt_ LPARAM // sortHandle); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318702")] public static extern int LCMapStringEx(string lpLocaleName, uint dwMapFlags, string lpSrcStr, int cchSrc, StringBuilder lpDestStr, int cchDest, ref NLSVERSIONINFO lpVersionInformation, [Optional] IntPtr lpReserved, [Optional] IntPtr sortHandle); /// /// For a locale specified by name, maps an input character string to another using a specified transformation, or generates a sort /// key for the input string. /// /// Pointer to a locale name, or one of the following predefined values. /// /// /// Flag specifying the type of transformation to use during string mapping or the type of sort key to generate. This parameter can /// have the following values. /// /// /// /// /// Flag /// Meaning /// /// /// LCMAP_BYTEREV /// Use byte reversal. For example, if the application passes in 0x3450 0x4822, the result is 0x5034 0x2248. /// /// /// LCMAP_FULLWIDTH /// /// Use Unicode (wide) characters where applicable. This flag and LCMAP_HALFWIDTH are mutually exclusive. With this flag, the mapping /// may use Normalization Form C even if an input character is already full-width. For example, the string &quot;は゛&quot; /// (which is already full-width) is normalized to &quot;ば&quot;. See Unicode normalization forms. /// /// /// /// LCMAP_HALFWIDTH /// Use narrow characters where applicable. This flag and LCMAP_FULLWIDTH are mutually exclusive. /// /// /// LCMAP_HIRAGANA /// Map all katakana characters to hiragana. This flag and LCMAP_KATAKANA are mutually exclusive. /// /// /// LCMAP_KATAKANA /// Map all hiragana characters to katakana. This flag and LCMAP_HIRAGANA are mutually exclusive. /// /// /// LCMAP_LINGUISTIC_CASING /// /// Use linguistic rules for casing, instead of file system rules (default). This flag is valid with LCMAP_LOWERCASE or /// LCMAP_UPPERCASE only. /// /// /// /// LCMAP_LOWERCASE /// For locales and scripts capable of handling uppercase and lowercase, map all characters to lowercase. /// /// /// LCMAP_SIMPLIFIED_CHINESE /// /// Map traditional Chinese characters to simplified Chinese characters. This flag and LCMAP_TRADITIONAL_CHINESE are mutually exclusive. /// /// /// /// LCMAP_SORTKEY /// /// Produce a normalized sort key. If the LCMAP_SORTKEY flag is not specified, the function performs string mapping. For details of /// sort key generation and string mapping, see the Remarks section. /// /// /// /// LCMAP_TITLECASE /// Windows 7: Map all characters to title case, in which the first letter of each major word is capitalized. /// /// /// LCMAP_TRADITIONAL_CHINESE /// /// Map simplified Chinese characters to traditional Chinese characters. This flag and LCMAP_SIMPLIFIED_CHINESE are mutually exclusive. /// /// /// /// LCMAP_UPPERCASE /// For locales and scripts capable of handling uppercase and lowercase, map all characters to uppercase. /// /// /// /// /// The following flags can be used alone, with one another, or with the LCMAP_SORTKEY and/or LCMAP_BYTEREV flags. However, they /// cannot be combined with the other flags listed above. /// /// /// /// /// Flag /// Meaning /// /// /// NORM_IGNORENONSPACE /// Ignore nonspacing characters. For many scripts (notably Latin scripts), NORM_IGNORENONSPACE coincides with LINGUISTIC_IGNOREDIACRITIC. /// /// /// NORM_IGNORESYMBOLS /// Ignore symbols and punctuation. /// /// /// /// The flags listed below are used only with the LCMAP_SORTKEY flag. /// /// /// /// Flag /// Meaning /// /// /// LINGUISTIC_IGNORECASE /// Ignore case, as linguistically appropriate. /// /// /// LINGUISTIC_IGNOREDIACRITIC /// Ignore nonspacing characters, as linguistically appropriate. /// /// /// NORM_IGNORECASE /// Ignore case. For many scripts (notably Latin scripts), NORM_IGNORECASE coincides with LINGUISTIC_IGNORECASE. /// /// /// NORM_IGNOREKANATYPE /// /// Do not differentiate between hiragana and katakana characters. Corresponding hiragana and katakana characters compare as equal. /// /// /// /// NORM_IGNOREWIDTH /// /// Ignore the difference between half-width and full-width characters, for example, C a t == cat. The full-width form is a /// formatting distinction used in Chinese and Japanese scripts. /// /// /// /// NORM_LINGUISTIC_CASING /// Use linguistic rules for casing, instead of file system rules (default). /// /// /// SORT_DIGITSASNUMBERS /// Windows 7: Treat digits as numbers during sorting, for example, sort &quot;2&quot; before &quot;10&quot;. /// /// /// SORT_STRINGSORT /// Treat punctuation the same as symbols. /// /// /// /// /// /// Pointer to a source string that the function maps or uses for sort key generation. This string cannot have a size of 0. /// /// /// /// Size, in characters, of the source string indicated by lpSrcStr. The size of the source string can include the terminating null /// character, but does not have to. If the terminating null character is included, the mapping behavior of the function is not /// greatly affected because the terminating null character is considered to be unsortable and always maps to itself. /// /// /// The application can set this parameter to any negative value to specify that the source string is null-terminated. In this case, /// if LCMapStringEx is being used in its string-mapping mode, the function calculates the string length itself, and /// null-terminates the mapped string indicated by lpDestStr. /// /// The application cannot set this parameter to 0. /// /// /// Pointer to a buffer in which this function retrieves the mapped string or sort key. If the application specifies LCMAP_SORTKEY, /// the function stores a sort key in the buffer as an opaque array of byte values that can include embedded 0 bytes. /// /// /// /// Size, in characters, of the buffer indicated by lpDestStr. If the application is using the function for string mapping, it /// supplies a character count for this parameter. If space for a terminating null character is included in cchSrc, cchDest must also /// include space for a terminating null character. /// /// /// If the application is using the function to generate a sort key, it supplies a byte count for the size. This byte count must /// include space for the sort key 0x00 terminator. /// /// /// The application can set cchDest to 0. In this case, the function does not use the lpDestStr parameter and returns the required /// buffer size for the mapped string or sort key. /// /// /// /// /// Pointer to an NLSVERSIONINFOEX structure that contains the version information about the relevant NLS capability; usually /// retrieved from GetNLSVersionEx. /// /// Windows Vista, Windows 7: Reserved; must set to NULL. /// /// Reserved; must be NULL. /// Reserved; must be 0. /// /// /// Returns the number of characters or bytes in the translated string or sort key, including a terminating null character, if /// successful. If the function succeeds and the value of cchDest is 0, the return value is the size of the buffer required to hold /// the translated string or sort key, including a terminating null character if the input was null terminated. /// /// /// This function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int LCMapStringEx( _In_opt_ LPCWSTR lpLocaleName, _In_ DWORD dwMapFlags, _In_ LPCWSTR lpSrcStr, _In_ int cchSrc, _Out_opt_ LPWSTR // lpDestStr, _In_ int cchDest, _In_opt_ LPNLSVERSIONINFO lpVersionInformation, _In_opt_ LPVOID lpReserved, _In_opt_ LPARAM // sortHandle); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318702(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318702")] public static extern int LCMapStringEx(string lpLocaleName, uint dwMapFlags, string lpSrcStr, int cchSrc, StringBuilder lpDestStr, int cchDest, [Optional] IntPtr lpVersionInformation, [Optional] IntPtr lpReserved, [Optional] IntPtr sortHandle); /// /// Unsupported. LoadStringByReference may be altered or unavailable. Instead, use SHLoadIndirectString. /// /// /// Reserved. /// /// /// The language. /// /// /// The source string reference. /// /// /// The buffer to receive the string. /// /// /// The size of Buffer, in characters. /// /// /// The directory path to SourceString. /// /// /// The number of characters written to Buffer. /// /// /// A BOOL datatype. /// /// /// LoadStringByReference is not supported and may be altered or unavailable in the future. Instead, use SHLoadIndirectString. /// // https://docs.microsoft.com/en-us/windows/desktop/api/winnls/nf-winnls-loadstringbyreference BOOL LoadStringByReference( DWORD // Flags, PCWSTR Language, PCWSTR SourceString, PWSTR Buffer, ULONG cchBuffer, PCWSTR Directory, PULONG pcchBufferOut ); [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("winnls.h", MSDNShortId = "4E0470ED-512F-4B76-A3E4-31C8B269CD5C")] [Obsolete] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool LoadStringByReference([Optional] uint Flags, string Language, string SourceString, StringBuilder Buffer, uint cchBuffer, string Directory, out uint pcchBufferOut); /// Converts a locale name to a locale identifier. /// Pointer to a null-terminated string representing a locale name, or one of the following predefined values. /// /// Prior to Windows 7: Reserved; should always be 0. /// Beginning in Windows 7: Can be set to LOCALE_ALLOW_NEUTRAL_NAMES to allow the return of a neutral LCID. /// /// /// /// Returns the locale identifier corresponding to the locale name if successful. If the supplied locale name corresponds to a custom /// locale that is the user default, this function returns LOCALE_CUSTOM_DEFAULT. If the locale name corresponds to a custom locale /// that is not the user default, the function returns LOCALE_CUSTOM_UNSPECIFIED. /// /// /// If the locale provided is a transient locale or a CLDR (Unicode Common Locale Data Repository) locale, then the LCID returned is 0x1000. /// /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // LCID LocaleNameToLCID( _In_ LPCWSTR lpName, _In_ DWORD dwFlags); https://msdn.microsoft.com/en-us/library/windows/desktop/dd318711(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd318711")] public static extern LCID LocaleNameToLCID(string lpName, LCTYPE dwFlags); /// Creates a language identifier from a primary language identifier and a sublanguage identifier. /// /// Primary language identifier. This identifier can be a predefined value or a value for a user-defined primary language. For a /// user-defined language, the identifier is a value in the range 0x0200 to 0x03FF. All other values are reserved for operating /// system use. For more information, see Language Identifier Constants and Strings. /// /// /// Sublanguage identifier. This parameter can be a predefined sublanguage identifier or a user-defined sublanguage. For a /// user-defined sublanguage, the identifier is a value in the range 0x20 to 0x3F. All other values are reserved for operating system /// use. For more information, see Language Identifier Constants and Strings. /// /// Returns the language identifier. // WORD MAKELANGID( USHORT usPrimaryLanguage, USHORT usSubLanguage); https://msdn.microsoft.com/en-us/library/windows/desktop/dd373908(v=vs.85).aspx [PInvokeData("Winnt.h", MSDNShortId = "dd373908")] public static ushort MAKELANGID(ushort usPrimaryLanguage, ushort usSubLanguage) => (ushort)(usSubLanguage << 10 | PRIMARYLANGID(usPrimaryLanguage)); /// Creates a locale identifier from a language identifier and a sort order identifier. /// /// Language identifier. This identifier is a combination of a primary language identifier and a sublanguage identifier and is /// usually created by using the MAKELANGID macro. /// /// Sort order identifier. /// Returns the locale identifier. // DWORD MAKELCID( WORD wLanguageID, WORD wSortID); https://msdn.microsoft.com/en-us/library/windows/desktop/dd319052(v=vs.85).aspx [PInvokeData("Winnt.h", MSDNShortId = "dd319052")] public static uint MAKELCID(ushort wLanguageID, ushort wSortID) => Macros.MAKELONG(wLanguageID, (ushort)(wSortID & 0xf)); /// Constructs a locale identifier (LCID) from a language identifier, a sort order identifier, and the sort version. /// /// Language identifier. This parameter is a combination of a primary language identifier and a sublanguage identifier and is usually /// created by using the MAKELANGID macro. /// /// Sort order identifier. /// Reserved; must be 0. /// Returns the LCID. // DWORD MAKESORTLCID( WORD wLanguageID, WORD wSortID, WORD wSortVersion); https://msdn.microsoft.com/en-us/library/windows/desktop/dd319053(v=vs.85).aspx [PInvokeData("Winnt.h", MSDNShortId = "dd319053")] public static uint MAKESORTLCID(ushort wLanguageID, ushort wSortID, ushort wSortVersion) => MAKELCID(wLanguageID, wSortID) | (((uint)wSortVersion & 0xf) << 20); /// /// Normalizes characters of a text string according to Unicode 4.0 TR#15. For more information, see Using Unicode Normalization to /// Represent Strings. /// /// Normalization form to use. NORM_FORM specifies the standard Unicode normalization forms. /// Pointer to the non-normalized source string. /// /// Length, in characters, of the buffer containing the source string. The application can set this parameter to -1 if the function /// should assume the string to be null-terminated and calculate the length automatically. /// /// /// Pointer to a buffer in which the function retrieves the destination string. Alternatively, this parameter contains NULL if /// cwDstLength is set to 0. /// /// /// Length, in characters, of the buffer containing the destination string. Alternatively, the application can set this parameter to /// 0 to request the function to return the required size for the destination buffer. /// /// /// /// Returns the length of the normalized string in the destination buffer. If cwDstLength is set to 0, the function returns the /// estimated buffer length required to do the actual conversion. /// /// /// If the string in the input buffer is null-terminated or if cwSrcLength is -1, the string written to the destination buffer is /// null-terminated and the returned string length includes the terminating null character. /// /// /// The function returns a value that is less than or equal to 0 if it does not succeed. To get extended error information, the /// application can call GetLastError, which can return one of the following error codes: /// /// // int NormalizeString( _In_ NORM_FORM NormForm, _In_ LPCWSTR lpSrcString, _In_ int cwSrcLength, _Out_opt_ LPWSTR lpDstString, _In_ // int cwDstLength); https://msdn.microsoft.com/en-us/library/windows/desktop/dd319093(v=vs.85).aspx [DllImport(Lib.Normaliz, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd319093")] public static extern int NormalizeString(NORM_FORM NormForm, string lpSrcString, int cwSrcLength, StringBuilder lpDstString, int cwDstLength); /// Extracts a primary language identifier from a language identifier. /// /// Language identifier. This value is a combination of a primary language identifier and a sublanguage identifier and is usually /// created by using the MAKELANGID macro. /// /// /// Returns the primary language identifier. It can be one of the predefined primary language identifiers or a user-defined primary /// language identifier. For more information, see MAKELANGID. /// // WORD PRIMARYLANGID( WORD lgid); https://msdn.microsoft.com/en-us/library/windows/desktop/dd319102(v=vs.85).aspx [PInvokeData("Winnt.h", MSDNShortId = "dd319102")] public static ushort PRIMARYLANGID(ushort lgid) => (ushort)(lgid & 0x3ff); /// Finds a possible locale name match for the supplied name. /// Pointer to a name to resolve, for example, "en-FJ" for English (Fiji). /// /// Pointer to a buffer in which this function retrieves the locale name that is the match for the input name. For example, the match /// for the name "en-FJ" is "en-US" for English (United States). /// /// /// Size, in characters, of the buffer indicated by lpLocaleName. The maximum possible length of a locale name, including a /// terminating null character, is the value of LOCALE_NAME_MAX_LENGTH. This is the recommended size to supply in this parameter. /// /// /// Returns the size of the buffer containing the locale name, including the terminating null character, if successful. /// /// The function returns 0 if it does not succeed. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// // int ResolveLocaleName( _In_opt_ LPCWSTR lpNameToResolve, _Out_opt_ LPWSTR lpLocaleName, _In_ int cchLocaleName); https://msdn.microsoft.com/en-us/library/windows/desktop/dd319112(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd319112")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool ResolveLocaleName(string lpNameToResolve, StringBuilder lpLocaleName, int cchLocaleName); /// Sets an item of locale information for a calendar. For more information, see Date and Calendar. /// /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of the /// following predefined values. /// /// /// /// LOCALE_INVARIANT /// /// /// LOCALE_SYSTEM_DEFAULT /// /// /// LOCALE_USER_DEFAULT /// /// /// The following custom locale identifiers are also supported. /// /// /// LOCALE_CUSTOM_DEFAULT /// /// /// LOCALE_CUSTOM_UI_DEFAULT /// /// /// LOCALE_CUSTOM_UNSPECIFIED /// /// /// /// Calendar identifier for the calendar for which to set information. /// /// /// Type of calendar information to set. Only the following CALTYPE values are valid for this function. The CAL_USE_CP_ACP constant /// is only meaningful for the ANSI version of the function. /// /// /// /// CAL_USE_CP_ACP /// /// /// CAL_ITWODIGITYEARMAX /// /// /// /// The application can specify only one calendar identifier per call to this function. An exception can be made if the application /// uses the binary OR operator to combine CAL_USE_CP_ACP with any valid CALTYPE value defined in /// /// Calendar Type Information /// . /// /// /// Pointer to a null-terminated calendar information string. The information must be in the format of the specified calendar type. /// /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call GetLastError, /// which can return one of the following error codes: /// /// /// /// ERROR_INTERNAL_ERROR. An unexpected error occurred in the function. /// /// /// ERROR_INVALID_FLAGS. The values supplied for flags were not valid. /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// This function only affects the user override portion of the calendar settings. It does not set the system defaults. /// /// Calendar information is always passed as a null-terminated Unicode string in the Unicode version of this function, and as a /// null-terminated ANSI string in the ANSI version. No integers are allowed by this function. Any numeric values must be specified /// as either Unicode or ANSI text. /// /// /// When the ANSI version of this function is used with a Unicode-only locale identifier, the function can succeed because the /// operating system uses the system code page. However, characters that are undefined in the system code page appear in the string /// as a question mark (?). /// /// /// CAL_ITWODIGITYEARMAX can be used with any calendar, even if the calendar is not supported for the specified locale. To avoid /// complications, the application should call EnumCalendarInfo to ensure that the calendar is supported for the locale of interest. /// /// // https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-setcalendarinfoa BOOL SetCalendarInfoA( LCID Locale, CALID // Calendar, CALTYPE CalType, LPCSTR lpCalData ); [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winnls.h", MSDNShortId = "3599f68f-5b7c-4bf9-9c42-452047c0731f")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetCalendarInfo(LCID Locale, CALID Calendar, CALTYPE CalType, string lpCalData); /// /// Sets an item of information in the user override portion of the current locale. This function does not set the system defaults. /// /// /// /// For the ANSI version of the function, the locale identifier of the locale with the code page used when interpreting the lpLCData /// information. For the Unicode version, this parameter is ignored. /// /// You can use the MAKELCID macro to create a locale identifier or use one of the following predefined values. /// The following custom locale identifiers are also supported. /// /// /// Type of locale information to set. For valid constants see "Constants Used in the LCType Parameter of GetLocaleInfo, /// GetLocaleInfoEx, and SetLocaleInfo" section of Locale Information Constants. The application can specify only one value per call, /// but it can use the binary OR operator to combine LOCALE_USE_CP_ACP with any other constant. /// /// /// Pointer to a null-terminated string containing the locale information to set. The information must be in the format specific to /// the specified constant. The application uses a Unicode string for the Unicode version of the function, and an ANSI string for the /// ANSI version. /// /// /// Returns a nonzero value if successful, or 0 otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// // BOOL SetLocaleInfo( _In_ LCID Locale, _In_ LCTYPE LCType, _In_ LPCTSTR lpLCData); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374049(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("Winnls.h", MSDNShortId = "dd374049")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetLocaleInfo(LCID Locale, LCTYPE LCType, string lpLCData); /// /// Sets the process preferred UI languages for the application process. For more information, see User Interface Language Management. /// /// /// /// Flags identifying the language format to use for the process preferred UI languages. The flags are mutually exclusive, and the /// default is MUI_LANGUAGE_NAME. /// /// We recommend that you use MUI_LANGUAGE_NAME instead of MUI_LANGUAGE_ID. /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// The input parameter language strings are in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// The input parameter language strings are in language name format. /// /// /// /// /// /// /// Pointer to a double null-terminated multi-string buffer that contains an ordered, null-delimited list in decreasing order of /// preference. If there are more than five languages in the buffer, the function only sets the first five valid languages. /// /// /// Alternatively, this parameter can contain NULL if no language list is required. In this case, the function clears the /// preferred UI languages for the process. /// /// /// /// Pointer to the number of languages that has been set in the process language list from the input buffer, up to a maximum of five. /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return the following error code: /// /// /// If the process preferred UI languages list is empty or if the languages specified for the process are not valid, the function /// succeeds and sets 0 in the pulNumLanguages parameter. /// /// // BOOL SetProcessPreferredUILanguages( _In_ DWORD dwFlags, _In_opt_ PCZZWSTR pwszLanguagesBuffer, _Out_opt_ PULONG pulNumLanguages); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374050(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd374050")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetProcessPreferredUILanguages(MUI_LANGUAGE_ENUM dwFlags, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NullTermStringArrayMarshaler), MarshalCookie = "Unicode")] string[] pwszLanguagesBuffer, out uint pulNumLanguages); /// Sets the current locale of the calling thread. /// /// Locale identifier that specifies the locale. You can use the MAKELCID macro to create a locale identifier or use one of /// the following predefined values. /// /// The function should return an LCID on success. This is the LCID of the previous thread locale. // BOOL SetThreadLocale( _In_ LCID Locale); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374051(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd374051")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetThreadLocale(LCID Locale); /// /// Sets the thread preferred UI languages for the current thread. For more information, see User Interface Language Management. /// /// /// Flags identifying format and filtering for the languages to set. /// /// The following format flags specify the language format to use for the thread preferred UI languages. The flags are mutually /// exclusive, and the default is MUI_LANGUAGE_NAME. /// /// We recommend that you use MUI_LANGUAGE_NAME instead of MUI_LANGUAGE_ID. /// /// /// /// Value /// Meaning /// /// /// MUI_LANGUAGE_ID /// The input parameter language strings are in language identifier format. /// /// /// MUI_LANGUAGE_NAME /// The input parameter language strings are in language name format. /// /// /// /// /// The following filtering flags specify filtering for the language list. The flags are mutually exclusive. By default, neither /// MUI_COMPLEX_SCRIPT_FILTER nor MUI_CONSOLE_FILTER is set. For more information about the filtering flags, see the Remarks section. /// /// /// /// /// Value /// Meaning /// /// /// MUI_COMPLEX_SCRIPT_FILTER /// /// GetThreadPreferredUILanguages should replace with the appropriate fallback all languages having complex scripts. When this flag /// is specified, NULL must be passed for all other parameters. /// /// /// /// MUI_CONSOLE_FILTER /// /// GetThreadPreferredUILanguages should replace with the appropriate fallback all languages that cannot display properly in a /// console window with the current operating system settings. When this flag is specified, NULL must be passed for all other parameters. /// /// /// /// MUI_RESET_FILTERS /// /// Reset the filtering for the language list by removing any other filter settings. When this flag is specified, NULL must be passed /// for all other parameters. After setting this flag, the application can call GetThreadPreferredUILanguages to retrieve the /// complete unfiltered list. /// /// /// /// /// /// /// /// Pointer to a double null-terminated multi-string buffer that contains an ordered, null-delimited list, in the format specified by dwFlags. /// /// /// To clear the thread preferred UI languages list, an application sets this parameter to a null string or an empty double /// null-terminated string. If an application clears a language list, it should specify either a format flag or 0 for the dwFlags parameter. /// /// /// When the application specifies one of the filtering flags, it must set this parameter to NULL. In this case, the function /// succeeds, but does not reset the thread preferred languages. /// /// /// /// Pointer to the number of languages that the function has set in the thread preferred UI languages list. When the application /// specifies one of the filtering flags, the function must set this parameter to NULL. /// /// Returns TRUE if the function succeeds or FALSE otherwise. // BOOL SetThreadPreferredUILanguages( _In_ DWORD dwFlags, _In_opt_ PCZZWSTR pwszLanguagesBuffer, _Out_opt_ PULONG pulNumLanguages); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374052(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd374052")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetThreadPreferredUILanguages(MUI_LANGUAGE_FLAGS dwFlags, [In, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(NullTermStringArrayMarshaler), MarshalCookie = "Unicode")] string[] pwszLanguagesBuffer, out uint pulNumLanguages); /// /// Sets the user interface language for the current thread. /// /// Windows Vista and later: This function cannot clear the thread preferred UI languages list. Your MUI application should /// call SetThreadPreferredUILanguages to clear the language list. /// /// /// Windows XP: This function is limited to allowing the operating system to identify and set a value that is safe to use on /// the Windows console. /// /// /// /// Language identifier for the user interface language for the thread. /// /// Windows Vista and later: The application can specify a language identifier of 0 or a nonzero identifier. For more /// information, see the Remarks section. /// /// /// Windows XP: The application can only set this parameter to 0. This setting causes the function to select the language that /// best supports the console display. For more information, see the Remarks section. /// /// /// /// /// Returns the input language identifier if successful. If the input identifier is nonzero, the function returns that value. If the /// language identifier is 0, the function always succeeds and returns the identifier of the language that best supports the Windows /// console. See the Remarks section. /// /// /// If the input language identifier is nonzero and the function fails, the return value differs from the input language identifier. /// To get extended error information, the application can call GetLastError. /// /// // LANGID SetThreadUILanguage( _In_ LANGID LangId); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374053(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd374053")] public static extern ushort SetThreadUILanguage(ushort LangId); /// /// /// [ SetUserGeoID is available for use in the operating systems specified in the Requirements section. It may be altered or /// unavailable in subsequent versions. Instead, use SetUserGeoName.] /// /// /// Sets the geographical location identifier for the user. This identifier should have one of the values described in Table of /// Geographical Locations. /// /// /// Identifier for the geographical location of the user. /// /// Returns TRUE if successful or FALSE otherwise. /// /// Windows XP, Windows Server 2003: This function does not supply extended error information. Thus it is not appropriate for /// an application to call GetLastError after this function. If the application does call GetLastError, it can return a /// value set by some previously called function. /// /// /// If this function does not succeed, the application can call GetLastError, which can return one of the following error codes: /// /// // BOOL SetUserGeoID( _In_ GEOID GeoId); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374055(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("Winnls.h", MSDNShortId = "dd374055")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetUserGeoID(int GeoId); /// /// Sets the geographic location for the current user to the specified two-letter International Organization for Standardization /// (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code. /// /// /// The two-letter ISO 3166-1 or numeric UN M.49 code for the geographic location to set for the current user. To get the codes that /// are available on the operating system, call EnumSystemGeoNames. /// /// Returns TRUE if successful or FALSE otherwise. // BOOL WINAPI SetUserGeoName(_In_ PWSTR geoName); https://msdn.microsoft.com/en-us/library/windows/desktop/mt812045(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "mt812045")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool SetUserGeoName(string geoName); /// Extracts a sublanguage identifier from a language identifier. /// /// Language identifier. You can supply predefined values for this parameter, or create an identifier using the MAKELANGID macro. /// /// /// Returns a sublanguage identifier. This can be a predefined sublanguage identifier or a user-defined sublanguage identifier. /// // WORD SUBLANGID( WORD lgid); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374066(v=vs.85).aspx [PInvokeData("Winnt.h", MSDNShortId = "dd374066")] public static ushort SUBLANGID(ushort lgid) => (ushort)(lgid >> 10); /// /// /// Deprecated. Gets the day of the week that corresponds to a specified day and populates the DayOfWeek member in the /// specified CALDATETIME structure with that value. /// /// /// /// /// Returns TRUE if successful or FALSE otherwise. To get extended error information, the application can call /// GetLastError, which can return one of the following error codes: /// /// /// /// ERROR_DATE_OUT_OF_RANGE. The specified date was out of range. /// /// /// ERROR_INVALID_PARAMETER. Any of the parameter values was invalid. /// /// /// /// /// /// This function does not have an associated header file or library file. The application can call LoadLibrary with the DLL /// name (Kernel32.dll) to obtain a module handle. It can then call GetProcAddress with that module handle and the name of /// this function to get the function address. /// /// // https://docs.microsoft.com/en-us/windows/desktop/intl/updatecalendardayofweek BOOL UpdateCalendarDayOfWeek( _Inout_ LPCALDATETIME // lpCalDateTime ); [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true)] [PInvokeData("", MSDNShortId = "b9ae250a-73bb-4ec2-bb0d-e1f8b25c173c")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool UpdateCalendarDayOfWeek(ref CALDATETIME lpCalDateTime); /// Compares two enumerated lists of scripts. /// /// Flags specifying script verification options. /// /// /// /// Value /// Meaning /// /// /// VS_ALLOW_LATIN /// Allow &quot;Latn&quot; (Latin script) in the test list even if it is not in the locale list. /// /// /// /// /// /// Pointer to the locale list, the enumerated list of scripts for a given locale. This list is typically populated by calling /// GetLocaleInfoEx with LCType set to LOCALE_SSCRIPTS. /// /// /// Size, in characters, of the string indicated by lpLocaleScripts. The application sets this parameter to -1 if the string is /// null-terminated. If this parameter is set to 0, the function fails. /// /// /// Pointer to the test list, a second enumerated list of scripts. This list is typically populated by calling GetStringScripts. /// /// /// Size, in characters, of the string indicated by lpTestScripts. The application sets this parameter to -1 if the string is /// null-terminated. If this parameter is set to 0, the function fails. /// /// /// /// Returns TRUE if the test list is non-empty and all items in the list are also included in the locale list. The function /// still returns TRUE if the locale list contains more scripts than the test list, but all the test list scripts must be /// contained in the locale list. If VS_ALLOW_LATIN is specified in dwFlags, the function behaves as if "Latn;" is always in the /// locale list. /// /// /// In all other cases, the function returns FALSE. This return can indicate that the test list contains an item that is not /// in the locale list, or it can indicate an error. To distinguish between these two cases, the application should call /// GetLastError, which can return one of the following error codes: /// /// // BOOL VerifyScripts( _In_ DWORD dwFlags, _In_ LPCWSTR lpLocaleScripts, _In_ int cchLocaleScripts, _In_ LPCWSTR lpTestScripts, _In_ // int cchTestScripts); https://msdn.microsoft.com/en-us/library/windows/desktop/dd374129(v=vs.85).aspx [DllImport(Lib.Kernel32, SetLastError = true, ExactSpelling = true, CharSet = CharSet.Unicode)] [PInvokeData("Winnls.h", MSDNShortId = "dd374129")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool VerifyScripts(VS_FLAGS dwFlags, string lpLocaleScripts, int cchLocaleScripts, string lpTestScripts, int cchTestScripts); private static IEnumerable GetLanguages(TEnum dwFlags, GetLangFunc func) where TEnum : Enum { var sz = 0U; if (!func(dwFlags, out _, default, ref sz) && sz == 0) Win32Error.ThrowLastError(); using (var mem = new SafeHGlobalHandle(sz)) { if (!func(dwFlags, out var c, mem, ref sz)) Win32Error.ThrowLastError(); return c == 0 ? new string[0] : mem.ToStringEnum(CharSet.Unicode).ToArray(); } } /// /// Deprecated. Represents an instant in time, typically expressed as a date and time of day and a corresponding calendar. /// // https://docs.microsoft.com/en-us/windows/desktop/Intl/caldatetime typedef struct _caldatetime { CALID CalId; UINT Era; UINT Year; // UINT Month; UINT Day; UINT DayOfWeek; UINT Hour; UINT Minute; UINT Second; ULONG Tick; } CALDATETIME, *LPCALDATETIME; [PInvokeData("", MSDNShortId = "a714ff32-2b1f-4256-931e-324d64daf2ac")] [StructLayout(LayoutKind.Sequential)] public struct CALDATETIME { /// The calendar identifier for the instant in time. public CALID CalId; /// The era information for the instant in time. public uint Era; /// The year for the instant in time. public uint Year; /// The month for the instant in time. public uint Month; /// The day for the instant in time. public uint Day; /// The day of the week for the instant in time. public uint DayOfWeek; /// The hour for the instant in time. public uint Hour; /// The minute for the instant in time. public uint Minute; /// The second for the instant in time. public uint Second; /// The tick for the instant in time. public uint Tick; } /// Contains information about a code page. This structure is used by the GetCPInfo function. // typedef struct _cpinfo { UINT MaxCharSize; BYTE DefaultChar[MAX_DEFAULTCHAR]; BYTE LeadByte[MAX_LEADBYTES];} CPINFO, *LPCPINFO; https://msdn.microsoft.com/en-us/library/windows/desktop/dd317780(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317780")] [StructLayout(LayoutKind.Sequential)] public struct CPINFO { /// /// Maximum length, in bytes, of a character in the code page. The length can be 1 for a single-byte character set (SBCS), 2 for /// a double-byte character set (DBCS), or a value larger than 2 for other character set types. The function cannot use the size /// to distinguish an SBCS or a DBCS from other character sets because of other factors, for example, the use of ISCII or /// ISO-2022-xx code pages. /// public uint MaxCharSize; /// /// Default character used when translating character strings to the specific code page. This character is used by the /// WideCharToMultiByte function if an explicit default character is not specified. The default is usually the "?" /// character for the code page. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] DefaultChar; /// /// A fixed-length array of lead byte ranges, for which the number of lead byte ranges is variable. If the code page has no lead /// bytes, every element of the array is set to NULL. If the code page has lead bytes, the array specifies a starting /// value and an ending value for each range. Ranges are inclusive, and the maximum number of ranges for any code page is five. /// The array uses two bytes to describe each range, with two null bytes as a terminator after the last range. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] LeadByte; } /// Contains information about a code page. This structure is used by the GetCPInfoEx function. /// /// /// Lead bytes are unique to DBCS code pages that allow for more than 256 characters. A lead byte is the first byte of a 2-byte /// character in a DBCS. On each DBCS code page, the lead bytes occupy a specific range of byte values. This range is different for /// different code pages. /// /// /// The lead byte information is not very helpful for most code pages, and is not even provided for many multi-byte encodings, for /// example, UTF-8 and GB18030. Your applications are discouraged from using this information to predict what the MultiByteToWideChar /// or WideCharToMultiByte function will do. The function might end up using a default character or performing other default behavior /// if the bytes following the lead byte are not as expected. /// /// // https://docs.microsoft.com/en-us/windows/desktop/api/winnls/ns-winnls-_cpinfoexa typedef struct _cpinfoexA { UINT MaxCharSize; // BYTE DefaultChar[MAX_DEFAULTCHAR]; BYTE LeadByte[MAX_LEADBYTES]; WCHAR UnicodeDefaultChar; UINT CodePage; CHAR // CodePageName[MAX_PATH]; } CPINFOEXA, *LPCPINFOEXA; [PInvokeData("winnls.h", MSDNShortId = "9639bb11-477e-45ee-b9fb-d5d099925e00")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct CPINFOEX { /// /// Maximum length, in bytes, of a character in the code page. The length can be 1 for a single-byte character set (SBCS), 2 for /// a double-byte character set (DBCS), or a value larger than 2 for other character set types. The function cannot use the size /// to distinguish an SBCS or a DBCS from other character sets because of other factors, for example, the use of ISCII or /// ISO-2022-xx code pages. /// public uint MaxCharSize; /// /// Default character used when translating character strings to the specific code page. This character is used by the /// WideCharToMultiByte function if an explicit default character is not specified. The default is usually the "?" character for /// the code page. /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public byte[] DefaultChar; /// /// /// A fixed-length array of lead byte ranges, for which the number of lead byte ranges is variable. If the code page has no lead /// bytes, every element of the array is set to NULL. If the code page has lead bytes, the array specifies a starting /// value and an ending value for each range. Ranges are inclusive, and the maximum number of ranges for any code page is five. /// The array uses two bytes to describe each range, with two null bytes as a terminator after the last range. /// /// /// Note Some code pages use lead bytes and a combination of other encoding mechanisms. This member is usually only /// populated for a subset of the code pages that use lead bytes in some form. For more information, see the Remarks section. /// /// [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] LeadByte; /// /// Unicode default character used in translations from the specific code page. The default is usually the "?" character or the /// katakana middle dot character. The Unicode default character is used by the MultiByteToWideChar function. /// public ushort UnicodeDefaultChar; /// /// Code page value. This value reflects the code page passed to the GetCPInfoEx function. See Code Page Identifiers for a list /// of ANSI and other code pages. /// public uint CodePage; /// /// Full name of the code page. Note that this name is localized and is not guaranteed for uniqueness or consistency between /// operating system versions or computers. /// [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string CodePageName; } /// /// Contains information that defines the format of a currency string. The GetCurrencyFormat function uses this information to /// customize a currency string for a specified locale. /// // typedef struct _currencyfmt { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPTSTR lpDecimalSep; LPTSTR lpThousandSep; UINT // NegativeOrder; UINT PositiveOrder; LPTSTR lpCurrencySymbol;} CURRENCYFMT, *LPCURRENCYFMT; https://msdn.microsoft.com/en-us/library/windows/desktop/dd317784(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd317784")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct CURRENCYFMT { /// Number of fractional digits. This number is equivalent to LOCALE_ICURRDIGITS. public uint NumDigits; /// Value indicating if leading zeros should be used in decimal fields. This value is equivalent to LOCALE_ILZERO. public uint LeadingZero; /// /// Number of digits in each group of numbers to the left of the decimal separator specified by lpDecimalSep. The most /// significant grouping digit indicates the number of digits in the least significant group immediately to the left of the /// decimal separator. Each subsequent grouping digit indicates the next significant group of digits to the left of the previous /// group. If the last value supplied is not 0, the remaining groups repeat the last group. Typical examples of settings for this /// member are: 0 to group digits as in 123456789.00; 3 to group digits as in 123,456,789.00; and 32 to group digits as in 12,34,56,789.00. /// public uint Grouping; /// Pointer to a null-terminated decimal separator string. public string lpDecimalSep; /// Pointer to a null-terminated thousand separator string. public string lpThousandSep; /// Negative currency mode. This mode is equivalent to LOCALE_INEGCURR. public uint NegativeOrder; /// Positive currency mode. This mode is equivalent to LOCALE_ICURRENCY. public uint PositiveOrder; /// Pointer to a null-terminated currency symbol string. public string lpCurrencySymbol; } /// /// Contains information about a file, related to its use with MUI. Most of this data is stored in the resource configuration data /// for the particular file. When this structure is retrieved by GetFileMUIInfo, not all fields are necessarily filled in. The /// fields used depend on the flags that the application has passed to that function. /// // typedef struct _FILEMUIINFO { DWORD dwSize; DWORD dwVersion; DWORD dwFileType; BYTE pChecksum[16]; BYTE pServiceChecksum[16]; // DWORD dwLanguageNameOffset; DWORD dwTypeIDMainSize; DWORD dwTypeIDMainOffset; DWORD dwTypeNameMainOffset; DWORD dwTypeIDMUISize; // DWORD dwTypeIDMUIOffset; DWORD dwTypeNameMUIOffset; BYTE abBuffer[8];} FILEMUIINFO, *PFILEMUIINFO; https://msdn.microsoft.com/en-us/library/windows/desktop/dd318039(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd318039")] [StructLayout(LayoutKind.Sequential)] public struct FILEMUIINFO { /// /// Size of the structure, including the buffer, which can be extended past the 8 bytes declared. The minimum value allowed is . /// public uint dwSize; /// Version of the structure. The current version is 0x001. public uint dwVersion; /// The file type. Possible values are: public MUI_FILETYPE dwFileType; /// Pointer to a 128-bit checksum for the file, if it is either an LN file or a language-specific resource file. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] pChecksum; /// Pointer to a 128-bit checksum for the file, used for servicing. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] pServiceChecksum; /// /// Offset, in bytes, from the beginning of the structure to the language name string for a language-specific resource file, or /// to the ultimate fallback language name string for an LN file. /// public uint dwLanguageNameOffset; /// /// Size of the array for which the offset is indicated by dwTypeIDMainOffset. The size also corresponds to the number of strings /// in the multi-string array indicated by dwTypeNameMainOffset. /// public uint dwTypeIDMainSize; /// /// Offset, in bytes, from the beginning of the structure to a DWORD array enumerating the resource types contained in the LN file. /// public uint dwTypeIDMainOffset; /// /// Offset, in bytes, from the beginning of the structure to a series of null-terminated strings in a multi-string array /// enumerating the resource names contained in the LN file. /// public uint dwTypeNameMainOffset; /// /// Size of the array with the offset indicated by dwTypeIDMUIOffset. The size also corresponds to the number of strings in the /// series of strings indicated by dwTypeNameMUIOffset. /// public uint dwTypeIDMUISize; /// /// Offset, in bytes, from the beginning of the structure to a DWORD array enumerating the resource types contained in the LN file. /// public uint dwTypeIDMUIOffset; /// /// Offset, in bytes, from the beginning of the structure to a multi-string array enumerating the resource names contained in the /// LN file. /// public uint dwTypeNameMUIOffset; /// Remainder of the allocated memory for this structure. See the Remarks section for correct use of this array. [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] abBuffer; /// The default instance of this structure with size and version fields preset. public static readonly FILEMUIINFO Default = new FILEMUIINFO { dwSize = (uint)Marshal.SizeOf(typeof(FILEMUIINFO)), dwVersion = 1 }; } /// /// Deprecated. Contains version information about an NLS capability. /// Starting with Windows 8, your app should use NLSVERSIONINFOEX instead of NLSVERSIONINFO. /// // typedef struct _nlsversioninfo { DWORD dwNLSVersionInfoSize; DWORD dwNLSVersion; DWORD dwDefinedVersion;} NLSVERSIONINFO, // *LPNLSVERSIONINFO; https://msdn.microsoft.com/en-us/library/windows/desktop/dd319086(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd319086")] [StructLayout(LayoutKind.Sequential)] public struct NLSVERSIONINFO { /// Size, in bytes, of the structure. public uint dwNLSVersionInfoSize; /// /// NLS version. This value is used to track changes and additions to the set of code points that have the indicated capability /// for a particular locale. The value is locale-specific, and increments when the capability changes. For example, using the /// COMPARE_STRING capability defined by the SYSNLS_FUNCTION enumeration, the version changes if sorting weights are /// assigned to code points that previously had no weights defined for the locale. /// public uint dwNLSVersion; /// /// Defined version. This value is used to track changes in the repertoire of Unicode code points. The value increments when the /// Unicode repertoire is extended, for example, if more characters are defined. /// public uint dwDefinedVersion; /// The default instance of this structure with size field preset. public static readonly NLSVERSIONINFO Default = new NLSVERSIONINFO { dwNLSVersionInfoSize = (uint)Marshal.SizeOf(typeof(NLSVERSIONINFO)) }; } /// Contains version information about an NLS capability. // typedef struct _nlsversioninfoex { DWORD dwNLSVersionInfoSize; DWORD dwNLSVersion; DWORD dwDefinedVersion; DWORD dwEffectiveId; // GUID guidCustomVersion;} NLSVERSIONINFOEX, *LPNLSVERSIONINFOEX; https://msdn.microsoft.com/en-us/library/windows/desktop/dd319087(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd319087")] [StructLayout(LayoutKind.Sequential)] public struct NLSVERSIONINFOEX { /// Size, in bytes, of the structure. public uint dwNLSVersionInfoSize; /// /// Version. This value is used to track changes and additions to the set of code points that have the indicated capability for a /// particular locale. The value is locale-specific, and increments when the capability changes. For example, using the /// COMPARE_STRING capability defined by the SYSNLS_FUNCTION enumeration, the version changes if sorting weights are /// assigned to code points that previously had no weights defined for the locale. /// public uint dwNLSVersion; /// /// /// Defined version. This value is used to track changes in the repertoire of Unicode code points. The value increments when the /// Unicode repertoire is extended, for example, if more characters are defined. /// /// Starting with Windows 8: Deprecated. Use dwNLSVersion instead. /// public uint dwDefinedVersion; /// /// /// Identifier of the sort order used for the input locale for the represented version. For example, for a custom locale en-Mine /// that uses 0409 for a sort order identifier, this member contains "0409". If this member specifies a "real" sort, /// guidCustomVersion is set to an empty GUID. /// /// Starting with Windows 8: Deprecated. Use guidCustomVersion instead. /// public uint dwEffectiveId; /// Unique GUID for the behavior of a custom sort used by the locale for the represented version. public Guid guidCustomVersion; /// The default instance of this structure with size field preset. public static readonly NLSVERSIONINFOEX Default = new NLSVERSIONINFOEX { dwNLSVersionInfoSize = (uint)Marshal.SizeOf(typeof(NLSVERSIONINFOEX)) }; } /// /// Contains information that defines the format of a number string. The GetNumberFormat function uses this information to /// customize a number string for a specified locale. /// // typedef struct _numberfmt { UINT NumDigits; UINT LeadingZero; UINT Grouping; LPTSTR lpDecimalSep; LPTSTR lpThousandSep; UINT // NegativeOrder;} NUMBERFMT, *LPNUMBERFMT; https://msdn.microsoft.com/en-us/library/windows/desktop/dd319095(v=vs.85).aspx [PInvokeData("Winnls.h", MSDNShortId = "dd319095")] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct NUMBERFMT { /// Number of fractional digits. This value is equivalent to the locale information specified by the value LOCALE_IDIGITS. public uint NumDigits; /// /// A value indicating if leading zeros should be used in decimal fields. This value is equivalent to the locale information /// specified by the value LOCALE_ILZERO. /// public uint LeadingZero; /// /// Number of digits in each group of numbers to the left of the decimal separator specified by lpDecimalSep. Values in /// the range 0 through 9 and 32 are valid. The most significant grouping digit indicates the number of digits in the least /// significant group immediately to the left of the decimal separator. Each subsequent grouping digit indicates the next /// significant group of digits to the left of the previous group. If the last value supplied is not 0, the remaining groups /// repeat the last group. Typical examples of settings for this member are: 0 to group digits as in 123456789.00; 3 to group /// digits as in 123,456,789.00; and 32 to group digits as in 12,34,56,789.00. /// public uint Grouping; /// Pointer to a null-terminated decimal separator string. public string lpDecimalSep; /// Pointer to a null-terminated thousand separator string. public string lpThousandSep; /// Negative number mode. This mode is equivalent to the locale information specified by the value LOCALE_INEGNUMBER. public uint NegativeOrder; } /// /// A safe instance of FILEMUIINFO that holds its own memory and handles the funky pointer magic required to get the values. /// public class SafeFILEMUIINFO : IDisposable { internal SafeHeapBlock mem; private const uint minSz = 72; /// Initializes a new instance of the class. public SafeFILEMUIINFO() { } /// The file type. Possible values are: public MUI_FILETYPE dwFileType => (MUI_FILETYPE)Marshal.ReadInt32(mem, 8); /// /// Size of the structure, including the buffer, which can be extended past the 8 bytes declared. The minimum value allowed is . /// public uint dwSize { get => mem?.Size ?? 0; set { if (value == dwSize) return; if (mem is null) { mem = new SafeHeapBlock(value); Marshal.WriteInt32(mem, 4, (int)dwVersion); } else mem.Size = value; Marshal.WriteInt32(mem, mem.Size); // dwSize } } /// Version of the structure. The current version is 0x001. public uint dwVersion { get; } = 1; /// An array enumerating the resource types contained in the LN file. public uint[] lpTypeIDMain { get { if (dwSize < minSz) return new uint[0]; var len = Marshal.ReadInt32(mem, 48); var offset = Marshal.ReadInt32(mem, 52); if (len + offset > mem.Size) throw new OutOfMemoryException(); return offset == 0 ? new uint[0] : mem.DangerousGetHandle().ToArray(len, offset); } } /// An array enumerating the resource types contained in the LN file. public uint[] lpTypeIDMUI { get { if (dwSize < minSz) return new uint[0]; var len = Marshal.ReadInt32(mem, 60); var offset = Marshal.ReadInt32(mem, 64); if (len + offset > mem.Size) throw new OutOfMemoryException(); return offset == 0 ? new uint[0] : mem.DangerousGetHandle().ToArray(len, offset); } } /// A multi-string array enumerating the resource names contained in the LN file. public string[] lpTypeNameMain { get { if (dwSize < minSz) return new string[0]; //var len = Marshal.ReadInt32(mem, 48); var offset = Marshal.ReadInt32(mem, 56); if (offset > mem.Size) throw new OutOfMemoryException(); return offset == 0 ? new string[0] : mem.DangerousGetHandle().ToStringEnum(CharSet.Unicode, offset).ToArray(); } } /// A multi-string array enumerating the resource names contained in the LN file. public string[] lpTypeNameMUI { get { if (dwSize < minSz) return new string[0]; //var len = Marshal.ReadInt32(mem, 60); var offset = Marshal.ReadInt32(mem, 68); if (offset > mem.Size) throw new OutOfMemoryException(); return offset == 0 ? new string[0] : mem.DangerousGetHandle().ToStringEnum(CharSet.Unicode, offset).ToArray(); } } /// Pointer to a 128-bit checksum for the file, if it is either an LN file or a language-specific resource file. public byte[] pChecksum => dwSize < minSz ? new byte[0] : mem.DangerousGetHandle().ToArray(16, 12); /// Pointer to a 128-bit checksum for the file, used for servicing. public byte[] pServiceChecksum => dwSize < minSz ? new byte[0] : mem.DangerousGetHandle().ToArray(16, 28); /// /// The language name string for a language-specific resource file, or to the ultimate fallback language name string for an LN file. /// public string szLanguageName { get { if (dwSize < minSz) return null; var offset = Marshal.ReadInt32(mem, 44); return offset == 0 ? null : StringHelper.GetString(mem.DangerousGetHandle().Offset(offset), CharSet.Unicode, mem.Size - offset); } } /// Performs an implicit conversion from to . /// The instance. /// The result of the conversion. public static implicit operator IntPtr(SafeFILEMUIINFO fmi) => fmi?.mem?.DangerousGetHandle() ?? IntPtr.Zero; /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { mem?.Dispose(); mem = null; } } } }