    {-# LINE 1 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
    {-# LANGUAGE CPP #-}
    {-# LANGUAGE Trustworthy #-}
    -----------------------------------------------------------------------------

    -- |

    -- Module      :  System.Win32.NLS

    -- Copyright   :  (c) Alastair Reid, 1997-2003

    -- License     :  BSD-style (see the file libraries/base/LICENSE)

    --

    -- Maintainer  :  Esa Ilari Vuokko <ei@vuokko.info>

    -- Stability   :  provisional

    -- Portability :  portable

    --

    -- A collection of FFI declarations for interfacing with Win32.

    --

    -----------------------------------------------------------------------------

    module System.Win32.NLS  (
            module System.Win32.NLS,

    {-# LINE 20 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
            CodePage,

    {-# LINE 22 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

            -- defined in System.Win32.Types

            LCID, LANGID, SortID, SubLANGID, PrimaryLANGID,
            mAKELCID, lANGIDFROMLCID, sORTIDFROMLCID,
            mAKELANGID, pRIMARYLANGID, sUBLANGID
            ) where

    import System.Win32.String (withTStringBufferLen)
    import System.Win32.Types
    import System.Win32.Utils (trySized)

    {-# LINE 36 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
    import Control.Monad (when)
    import Data.IORef (modifyIORef, newIORef, readIORef)
    import Foreign
    import Foreign.C

    {-# LINE 41 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
    import GHC.IO.Encoding.CodePage (CodePage)

    {-# LINE 43 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
    import Text.Printf (printf)

    #include "windows_cconv.h"

    -- Somewhere, WINVER and _WIN32_WINNT are being defined as less than 0x0600 -

    -- that is, before Windows Vista. Support for Windows XP was dropped in

    -- GHC 8.0.1 of May 2016. This forces them to be at least 0x0600.

    {-# LINE 54 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    {-# LINE 58 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    type NLS_FUNCTION = DWORD

    lOCALE_SYSTEM_DEFAULT  :: LCID
    lOCALE_SYSTEM_DEFAULT :: DWORD
    lOCALE_SYSTEM_DEFAULT  =  DWORD
    2048
    lOCALE_USER_DEFAULT    :: LCID
    lOCALE_USER_DEFAULT :: DWORD
    lOCALE_USER_DEFAULT    =  DWORD
    1024
    lOCALE_NEUTRAL         :: LCID
    lOCALE_NEUTRAL :: DWORD
    lOCALE_NEUTRAL         =  DWORD
    0

    {-# LINE 73 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    foreign import WINDOWS_CCONV unsafe "windows.h ConvertDefaultLocale"
      convertDefaultLocale :: LCID -> IO LCID

    -- TODO: various enum functions.

    {-# LINE 82 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    cP_ACP        :: CodePage
    cP_ACP :: DWORD
    cP_ACP        =  DWORD
    0
    cP_MACCP      :: CodePage
    cP_MACCP :: DWORD
    cP_MACCP      =  DWORD
    2
    cP_OEMCP      :: CodePage
    cP_OEMCP :: DWORD
    cP_OEMCP      =  DWORD
    1

    {-# LINE 88 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    foreign import WINDOWS_CCONV unsafe "windows.h GetACP"
      getACP :: IO CodePage

    foreign import WINDOWS_CCONV unsafe "windows.h SetThreadLocale"
      setThreadLocale :: LCID -> IO ()

    type LCTYPE = UINT

    -- The following locale information constants are excluded from the `enum` list

    -- below, for the reason indicated:

    -- LOCALE_IDIALINGCODE -- Introduced in Windows 10 but not supported. Synonym

                           -- for LOCALE_ICOUNTRY.

    -- LOCALE_INEGATIVEPERCENT -- Introduced in Windows 7 but not supported.

    -- LOCALE_IPOSITIVEPERCENT -- Introduced in Windows 7 but not supported.

    -- LOCALE_IREADINGLAYOUT -- Introduced in Windows 7 but not supported.

    -- LOCALE_SAM -- Introduced by Windows 10 but not supported. Synonym for

                  -- LOCALE_S1159.

    -- LOCALE_SENGLISHDISPLAYNAME -- Introduced in Windows 7 but not supported.

    -- LOCALE_SIETFLANGUAGE -- Not supported (deprecated from Windows Vista).

    -- LOCALE_SNATIVEDISPLAYNAME -- Introduced in Windows 7 but not supported.

    -- LOCALE_SNATIVELANGUAGENAME -- Introduced in Windows 7 but not supported.

    -- LOCALE_SPERCENT -- Introduced in Windows 7 but not supported.

    -- LOCALE_SPM -- Introduced in Windows 10 but not supported. Synonym for

                  -- LOCALE_S2359.

    -- LOCALE_SSHORTESTAM -- Not supported.

    -- LOCALE_SSHORTESTPM -- Not supported.

    -- LOCALE_SSHORTTIME -- Introduced in Windows 7 but not supported.

    -- The following locale information constant is included in the list below, but

    -- note:

    -- LOCALE_IINTLCURRDIGITS -- Not supported by Windows 10, use

                              -- LOCALE_ICURRDIGITS.

    lOCALE_FONTSIGNATURE  :: LCTYPE
    lOCALE_FONTSIGNATURE :: DWORD
    lOCALE_FONTSIGNATURE  =  DWORD
    88
    lOCALE_ICALENDARTYPE  :: LCTYPE
    lOCALE_ICALENDARTYPE :: DWORD
    lOCALE_ICALENDARTYPE  =  DWORD
    4105
    lOCALE_ICENTURY       :: LCTYPE
    lOCALE_ICENTURY :: DWORD
    lOCALE_ICENTURY       =  DWORD
    36
    lOCALE_ICOUNTRY       :: LCTYPE
    lOCALE_ICOUNTRY :: DWORD
    lOCALE_ICOUNTRY       =  DWORD
    5
    lOCALE_ICURRDIGITS    :: LCTYPE
    lOCALE_ICURRDIGITS :: DWORD
    lOCALE_ICURRDIGITS    =  DWORD
    25
    lOCALE_ICURRENCY      :: LCTYPE
    lOCALE_ICURRENCY :: DWORD
    lOCALE_ICURRENCY      =  DWORD
    27
    lOCALE_IDATE          :: LCTYPE
    lOCALE_IDATE :: DWORD
    lOCALE_IDATE          =  DWORD
    33
    lOCALE_IDAYLZERO      :: LCTYPE
    lOCALE_IDAYLZERO :: DWORD
    lOCALE_IDAYLZERO      =  DWORD
    38
    lOCALE_IDEFAULTANSICODEPAGE  :: LCTYPE
    lOCALE_IDEFAULTANSICODEPAGE :: DWORD
    lOCALE_IDEFAULTANSICODEPAGE  =  DWORD
    4100
    lOCALE_IDEFAULTCODEPAGE  :: LCTYPE
    lOCALE_IDEFAULTCODEPAGE :: DWORD
    lOCALE_IDEFAULTCODEPAGE  =  DWORD
    11
    lOCALE_IDEFAULTCOUNTRY  :: LCTYPE
    lOCALE_IDEFAULTCOUNTRY :: DWORD
    lOCALE_IDEFAULTCOUNTRY  =  DWORD
    10
    lOCALE_IDEFAULTEBCDICCODEPAGE  :: LCTYPE
    lOCALE_IDEFAULTEBCDICCODEPAGE :: DWORD
    lOCALE_IDEFAULTEBCDICCODEPAGE  =  DWORD
    4114
    lOCALE_IDEFAULTLANGUAGE  :: LCTYPE
    lOCALE_IDEFAULTLANGUAGE :: DWORD
    lOCALE_IDEFAULTLANGUAGE  =  DWORD
    9
    lOCALE_IDEFAULTMACCODEPAGE  :: LCTYPE
    lOCALE_IDEFAULTMACCODEPAGE :: DWORD
    lOCALE_IDEFAULTMACCODEPAGE  =  DWORD
    4113
    lOCALE_IDIGITS        :: LCTYPE
    lOCALE_IDIGITS :: DWORD
    lOCALE_IDIGITS        =  DWORD
    17
    lOCALE_IDIGITSUBSTITUTION  :: LCTYPE
    lOCALE_IDIGITSUBSTITUTION :: DWORD
    lOCALE_IDIGITSUBSTITUTION  =  DWORD
    4116
    lOCALE_IFIRSTDAYOFWEEK  :: LCTYPE
    lOCALE_IFIRSTDAYOFWEEK :: DWORD
    lOCALE_IFIRSTDAYOFWEEK  =  DWORD
    4108
    lOCALE_IFIRSTWEEKOFYEAR  :: LCTYPE
    lOCALE_IFIRSTWEEKOFYEAR :: DWORD
    lOCALE_IFIRSTWEEKOFYEAR  =  DWORD
    4109
    lOCALE_IGEOID         :: LCTYPE
    lOCALE_IGEOID :: DWORD
    lOCALE_IGEOID         =  DWORD
    91
    lOCALE_IINTLCURRDIGITS  :: LCTYPE
    lOCALE_IINTLCURRDIGITS :: DWORD
    lOCALE_IINTLCURRDIGITS  =  DWORD
    26
    lOCALE_ILANGUAGE      :: LCTYPE
    lOCALE_ILANGUAGE :: DWORD
    lOCALE_ILANGUAGE      =  DWORD
    1
    lOCALE_ILDATE         :: LCTYPE
    lOCALE_ILDATE :: DWORD
    lOCALE_ILDATE         =  DWORD
    34
    lOCALE_ILZERO         :: LCTYPE
    lOCALE_ILZERO :: DWORD
    lOCALE_ILZERO         =  DWORD
    18
    lOCALE_IMEASURE       :: LCTYPE
    lOCALE_IMEASURE :: DWORD
    lOCALE_IMEASURE       =  DWORD
    13
    lOCALE_IMONLZERO      :: LCTYPE
    lOCALE_IMONLZERO :: DWORD
    lOCALE_IMONLZERO      =  DWORD
    39
    lOCALE_INEGCURR       :: LCTYPE
    lOCALE_INEGCURR :: DWORD
    lOCALE_INEGCURR       =  DWORD
    28
    lOCALE_INEGNUMBER     :: LCTYPE
    lOCALE_INEGNUMBER :: DWORD
    lOCALE_INEGNUMBER     =  DWORD
    4112
    lOCALE_INEGSEPBYSPACE  :: LCTYPE
    lOCALE_INEGSEPBYSPACE :: DWORD
    lOCALE_INEGSEPBYSPACE  =  DWORD
    87
    lOCALE_INEGSIGNPOSN    :: LCTYPE
    lOCALE_INEGSIGNPOSN :: DWORD
    lOCALE_INEGSIGNPOSN    =  DWORD
    83
    lOCALE_INEGSYMPRECEDES  :: LCTYPE
    lOCALE_INEGSYMPRECEDES :: DWORD
    lOCALE_INEGSYMPRECEDES  =  DWORD
    86
    lOCALE_IOPTIONALCALENDAR  :: LCTYPE
    lOCALE_IOPTIONALCALENDAR :: DWORD
    lOCALE_IOPTIONALCALENDAR  =  DWORD
    4107
    lOCALE_PAPERSIZE      :: LCTYPE
    lOCALE_PAPERSIZE :: DWORD
    lOCALE_PAPERSIZE      =  DWORD
    4106
    lOCALE_IPOSSEPBYSPACE  :: LCTYPE
    lOCALE_IPOSSEPBYSPACE :: DWORD
    lOCALE_IPOSSEPBYSPACE  =  DWORD
    85
    lOCALE_IPOSSIGNPOSN   :: LCTYPE
    lOCALE_IPOSSIGNPOSN :: DWORD
    lOCALE_IPOSSIGNPOSN   =  DWORD
    82
    lOCALE_IPSSYMPRECEDES  :: LCTYPE
    lOCALE_IPSSYMPRECEDES :: DWORD
    lOCALE_IPSSYMPRECEDES  =  DWORD
    84
    lOCALE_ITIME          :: LCTYPE
    lOCALE_ITIME :: DWORD
    lOCALE_ITIME          =  DWORD
    35
    lOCALE_ITIMEMARKPOSN  :: LCTYPE
    lOCALE_ITIMEMARKPOSN :: DWORD
    lOCALE_ITIMEMARKPOSN  =  DWORD
    4101
    lOCALE_ITLZERO        :: LCTYPE
    lOCALE_ITLZERO :: DWORD
    lOCALE_ITLZERO        =  DWORD
    37
    lOCALE_RETURN_NUMBER  :: LCTYPE
    lOCALE_RETURN_NUMBER :: DWORD
    lOCALE_RETURN_NUMBER  =  DWORD
    536870912
    lOCALE_S1159          :: LCTYPE
    lOCALE_S1159 :: DWORD
    lOCALE_S1159          =  DWORD
    40
    lOCALE_S2359          :: LCTYPE
    lOCALE_S2359 :: DWORD
    lOCALE_S2359          =  DWORD
    41
    lOCALE_SABBREVCTRYNAME  :: LCTYPE
    lOCALE_SABBREVCTRYNAME :: DWORD
    lOCALE_SABBREVCTRYNAME  =  DWORD
    7
    lOCALE_SABBREVDAYNAME1  :: LCTYPE
    lOCALE_SABBREVDAYNAME1 :: DWORD
    lOCALE_SABBREVDAYNAME1  =  DWORD
    49
    lOCALE_SABBREVDAYNAME2  :: LCTYPE
    lOCALE_SABBREVDAYNAME2 :: DWORD
    lOCALE_SABBREVDAYNAME2  =  DWORD
    50
    lOCALE_SABBREVDAYNAME3  :: LCTYPE
    lOCALE_SABBREVDAYNAME3 :: DWORD
    lOCALE_SABBREVDAYNAME3  =  DWORD
    51
    lOCALE_SABBREVDAYNAME4  :: LCTYPE
    lOCALE_SABBREVDAYNAME4 :: DWORD
    lOCALE_SABBREVDAYNAME4  =  DWORD
    52
    lOCALE_SABBREVDAYNAME5  :: LCTYPE
    lOCALE_SABBREVDAYNAME5 :: DWORD
    lOCALE_SABBREVDAYNAME5  =  DWORD
    53
    lOCALE_SABBREVDAYNAME6  :: LCTYPE
    lOCALE_SABBREVDAYNAME6 :: DWORD
    lOCALE_SABBREVDAYNAME6  =  DWORD
    54
    lOCALE_SABBREVDAYNAME7  :: LCTYPE
    lOCALE_SABBREVDAYNAME7 :: DWORD
    lOCALE_SABBREVDAYNAME7  =  DWORD
    55
    lOCALE_SABBREVLANGNAME  :: LCTYPE
    lOCALE_SABBREVLANGNAME :: DWORD
    lOCALE_SABBREVLANGNAME  =  DWORD
    3
    lOCALE_SABBREVMONTHNAME1  :: LCTYPE
    lOCALE_SABBREVMONTHNAME1 :: DWORD
    lOCALE_SABBREVMONTHNAME1  =  DWORD
    68
    lOCALE_SABBREVMONTHNAME2  :: LCTYPE
    lOCALE_SABBREVMONTHNAME2 :: DWORD
    lOCALE_SABBREVMONTHNAME2  =  DWORD
    69
    lOCALE_SABBREVMONTHNAME3  :: LCTYPE
    lOCALE_SABBREVMONTHNAME3 :: DWORD
    lOCALE_SABBREVMONTHNAME3  =  DWORD
    70
    lOCALE_SABBREVMONTHNAME4  :: LCTYPE
    lOCALE_SABBREVMONTHNAME4 :: DWORD
    lOCALE_SABBREVMONTHNAME4  =  DWORD
    71
    lOCALE_SABBREVMONTHNAME5  :: LCTYPE
    lOCALE_SABBREVMONTHNAME5 :: DWORD
    lOCALE_SABBREVMONTHNAME5  =  DWORD
    72
    lOCALE_SABBREVMONTHNAME6  :: LCTYPE
    lOCALE_SABBREVMONTHNAME6 :: DWORD
    lOCALE_SABBREVMONTHNAME6  =  DWORD
    73
    lOCALE_SABBREVMONTHNAME7  :: LCTYPE
    lOCALE_SABBREVMONTHNAME7 :: DWORD
    lOCALE_SABBREVMONTHNAME7  =  DWORD
    74
    lOCALE_SABBREVMONTHNAME8  :: LCTYPE
    lOCALE_SABBREVMONTHNAME8 :: DWORD
    lOCALE_SABBREVMONTHNAME8  =  DWORD
    75
    lOCALE_SABBREVMONTHNAME9  :: LCTYPE
    lOCALE_SABBREVMONTHNAME9 :: DWORD
    lOCALE_SABBREVMONTHNAME9  =  DWORD
    76
    lOCALE_SABBREVMONTHNAME10  :: LCTYPE
    lOCALE_SABBREVMONTHNAME10 :: DWORD
    lOCALE_SABBREVMONTHNAME10  =  DWORD
    77
    lOCALE_SABBREVMONTHNAME11  :: LCTYPE
    lOCALE_SABBREVMONTHNAME11 :: DWORD
    lOCALE_SABBREVMONTHNAME11  =  DWORD
    78
    lOCALE_SABBREVMONTHNAME12  :: LCTYPE
    lOCALE_SABBREVMONTHNAME12 :: DWORD
    lOCALE_SABBREVMONTHNAME12  =  DWORD
    79
    lOCALE_SABBREVMONTHNAME13  :: LCTYPE
    lOCALE_SABBREVMONTHNAME13 :: DWORD
    lOCALE_SABBREVMONTHNAME13  =  DWORD
    4111
    lOCALE_SCONSOLEFALLBACKNAME  :: LCTYPE
    lOCALE_SCONSOLEFALLBACKNAME :: DWORD
    lOCALE_SCONSOLEFALLBACKNAME  =  DWORD
    110
    lOCALE_SCURRENCY      :: LCTYPE
    lOCALE_SCURRENCY :: DWORD
    lOCALE_SCURRENCY      =  DWORD
    20
    lOCALE_SDATE          :: LCTYPE
    lOCALE_SDATE :: DWORD
    lOCALE_SDATE          =  DWORD
    29
    lOCALE_SDAYNAME1      :: LCTYPE
    lOCALE_SDAYNAME1 :: DWORD
    lOCALE_SDAYNAME1      =  DWORD
    42
    lOCALE_SDAYNAME2      :: LCTYPE
    lOCALE_SDAYNAME2 :: DWORD
    lOCALE_SDAYNAME2      =  DWORD
    43
    lOCALE_SDAYNAME3      :: LCTYPE
    lOCALE_SDAYNAME3 :: DWORD
    lOCALE_SDAYNAME3      =  DWORD
    44
    lOCALE_SDAYNAME4      :: LCTYPE
    lOCALE_SDAYNAME4 :: DWORD
    lOCALE_SDAYNAME4      =  DWORD
    45
    lOCALE_SDAYNAME5      :: LCTYPE
    lOCALE_SDAYNAME5 :: DWORD
    lOCALE_SDAYNAME5      =  DWORD
    46
    lOCALE_SDAYNAME6      :: LCTYPE
    lOCALE_SDAYNAME6 :: DWORD
    lOCALE_SDAYNAME6      =  DWORD
    47
    lOCALE_SDAYNAME7      :: LCTYPE
    lOCALE_SDAYNAME7 :: DWORD
    lOCALE_SDAYNAME7      =  DWORD
    48
    lOCALE_SDECIMAL       :: LCTYPE
    lOCALE_SDECIMAL :: DWORD
    lOCALE_SDECIMAL       =  DWORD
    14
    lOCALE_SDURATION      :: LCTYPE
    lOCALE_SDURATION :: DWORD
    lOCALE_SDURATION      =  DWORD
    93
    lOCALE_SENGCURRNAME   :: LCTYPE
    lOCALE_SENGCURRNAME :: DWORD
    lOCALE_SENGCURRNAME   =  DWORD
    4103
    lOCALE_SENGLISHCOUNTRYNAME  :: LCTYPE
    lOCALE_SENGLISHCOUNTRYNAME :: DWORD
    lOCALE_SENGLISHCOUNTRYNAME  =  DWORD
    4098
    lOCALE_SENGLISHLANGUAGENAME  :: LCTYPE
    lOCALE_SENGLISHLANGUAGENAME :: DWORD
    lOCALE_SENGLISHLANGUAGENAME  =  DWORD
    4097
    lOCALE_SGROUPING      :: LCTYPE
    lOCALE_SGROUPING :: DWORD
    lOCALE_SGROUPING      =  DWORD
    16
    lOCALE_SINTLSYMBOL    :: LCTYPE
    lOCALE_SINTLSYMBOL :: DWORD
    lOCALE_SINTLSYMBOL    =  DWORD
    21
    lOCALE_SISO3166CTRYNAME  :: LCTYPE
    lOCALE_SISO3166CTRYNAME :: DWORD
    lOCALE_SISO3166CTRYNAME  =  DWORD
    90
    lOCALE_SISO3166CTRYNAME2  :: LCTYPE
    lOCALE_SISO3166CTRYNAME2 :: DWORD
    lOCALE_SISO3166CTRYNAME2  =  DWORD
    104
    lOCALE_SISO639LANGNAME  :: LCTYPE
    lOCALE_SISO639LANGNAME :: DWORD
    lOCALE_SISO639LANGNAME  =  DWORD
    89
    lOCALE_SISO639LANGNAME2  :: LCTYPE
    lOCALE_SISO639LANGNAME2 :: DWORD
    lOCALE_SISO639LANGNAME2  =  DWORD
    103
    lOCALE_SKEYBOARDSTOINSTALL  :: LCTYPE
    lOCALE_SKEYBOARDSTOINSTALL :: DWORD
    lOCALE_SKEYBOARDSTOINSTALL  =  DWORD
    94
    lOCALE_SLIST          :: LCTYPE
    lOCALE_SLIST :: DWORD
    lOCALE_SLIST          =  DWORD
    12
    lOCALE_SLONGDATE      :: LCTYPE
    lOCALE_SLONGDATE :: DWORD
    lOCALE_SLONGDATE      =  DWORD
    32
    lOCALE_SMONDECIMALSEP  :: LCTYPE
    lOCALE_SMONDECIMALSEP :: DWORD
    lOCALE_SMONDECIMALSEP  =  DWORD
    22
    lOCALE_SMONGROUPING   :: LCTYPE
    lOCALE_SMONGROUPING :: DWORD
    lOCALE_SMONGROUPING   =  DWORD
    24
    lOCALE_SMONTHNAME1    :: LCTYPE
    lOCALE_SMONTHNAME1 :: DWORD
    lOCALE_SMONTHNAME1    =  DWORD
    56
    lOCALE_SMONTHNAME2    :: LCTYPE
    lOCALE_SMONTHNAME2 :: DWORD
    lOCALE_SMONTHNAME2    =  DWORD
    57
    lOCALE_SMONTHNAME3    :: LCTYPE
    lOCALE_SMONTHNAME3 :: DWORD
    lOCALE_SMONTHNAME3    =  DWORD
    58
    lOCALE_SMONTHNAME4    :: LCTYPE
    lOCALE_SMONTHNAME4 :: DWORD
    lOCALE_SMONTHNAME4    =  DWORD
    59
    lOCALE_SMONTHNAME5    :: LCTYPE
    lOCALE_SMONTHNAME5 :: DWORD
    lOCALE_SMONTHNAME5    =  DWORD
    60
    lOCALE_SMONTHNAME6    :: LCTYPE
    lOCALE_SMONTHNAME6 :: DWORD
    lOCALE_SMONTHNAME6    =  DWORD
    61
    lOCALE_SMONTHNAME7    :: LCTYPE
    lOCALE_SMONTHNAME7 :: DWORD
    lOCALE_SMONTHNAME7    =  DWORD
    62
    lOCALE_SMONTHNAME8    :: LCTYPE
    lOCALE_SMONTHNAME8 :: DWORD
    lOCALE_SMONTHNAME8    =  DWORD
    63
    lOCALE_SMONTHNAME9    :: LCTYPE
    lOCALE_SMONTHNAME9 :: DWORD
    lOCALE_SMONTHNAME9    =  DWORD
    64
    lOCALE_SMONTHNAME10   :: LCTYPE
    lOCALE_SMONTHNAME10   =  65
    lOCALE_SMONTHNAME11   :: LCTYPE
    lOCALE_SMONTHNAME11   =  66
    lOCALE_SMONTHNAME12   :: LCTYPE
    lOCALE_SMONTHNAME12   =  67
    lOCALE_SMONTHNAME13   :: LCTYPE
    lOCALE_SMONTHNAME13 :: DWORD
    lOCALE_SMONTHNAME13   =  4110
    lOCALE_SMONTHOUSANDSEP  :: LCTYPE
    lOCALE_SMONTHOUSANDSEP :: DWORD
    lOCALE_SMONTHOUSANDSEP  =  DWORD
    23
    lOCALE_SNAME          :: LCTYPE
    lOCALE_SNAME :: DWORD
    lOCALE_SNAME          =  DWORD
    92
    lOCALE_SNAN           :: LCTYPE
    lOCALE_SNAN           =  105
    lOCALE_SNATIVECOUNTRYNAME  :: LCTYPE
    lOCALE_SNATIVECOUNTRYNAME :: DWORD
    lOCALE_SNATIVECOUNTRYNAME  =  DWORD
    8
    lOCALE_SNATIVECURRNAME  :: LCTYPE
    lOCALE_SNATIVECURRNAME :: DWORD
    lOCALE_SNATIVECURRNAME  =  DWORD
    4104
    lOCALE_SNATIVEDIGITS  :: LCTYPE
    lOCALE_SNATIVEDIGITS :: DWORD
    lOCALE_SNATIVEDIGITS  =  DWORD
    19
    lOCALE_SNEGATIVESIGN  :: LCTYPE
    lOCALE_SNEGATIVESIGN :: DWORD
    lOCALE_SNEGATIVESIGN  =  DWORD
    81
    lOCALE_SNEGINFINITY   :: LCTYPE
    lOCALE_SNEGINFINITY :: DWORD
    lOCALE_SNEGINFINITY   =  DWORD
    107
    lOCALE_SPARENT        :: LCTYPE
    lOCALE_SPARENT :: DWORD
    lOCALE_SPARENT        =  DWORD
    109
    lOCALE_SPOSINFINITY   :: LCTYPE
    lOCALE_SPOSINFINITY :: DWORD
    lOCALE_SPOSINFINITY   =  DWORD
    106
    lOCALE_SPOSITIVESIGN  :: LCTYPE
    lOCALE_SPOSITIVESIGN :: DWORD
    lOCALE_SPOSITIVESIGN  =  80
    lOCALE_SSCRIPTS       :: LCTYPE
    lOCALE_SSCRIPTS :: DWORD
    lOCALE_SSCRIPTS       =  DWORD
    108
    lOCALE_SSHORTDATE     :: LCTYPE
    lOCALE_SSHORTDATE :: DWORD
    lOCALE_SSHORTDATE     =  31
    lCMAP_SIMPLIFIED_CHINESE :: DWORD
    lOCALE_SSHORTESTDAYNAME1  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME1 :: DWORD
    lOCALE_SSHORTESTDAYNAME1  =  DWORD
    96
    lOCALE_SSHORTESTDAYNAME2  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME2 :: DWORD
    lOCALE_SSHORTESTDAYNAME2  =  DWORD
    97
    lOCALE_SSHORTESTDAYNAME3  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME3 :: DWORD
    lOCALE_SSHORTESTDAYNAME3  =  DWORD
    98
    lOCALE_SSHORTESTDAYNAME4  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME4 :: DWORD
    lOCALE_SSHORTESTDAYNAME4  =  DWORD
    99
    lOCALE_SSHORTESTDAYNAME5  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME5 :: DWORD
    lOCALE_SSHORTESTDAYNAME5  =  DWORD
    100
    lOCALE_SSHORTESTDAYNAME6  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME6 :: DWORD
    lOCALE_SSHORTESTDAYNAME6  =  DWORD
    101
    lOCALE_SSHORTESTDAYNAME7  :: LCTYPE
    lOCALE_SSHORTESTDAYNAME7 :: DWORD
    lOCALE_SSHORTESTDAYNAME7  =  DWORD
    102
    lOCALE_SSORTNAME      :: LCTYPE
    lOCALE_SSORTNAME :: DWORD
    lOCALE_SSORTNAME      =  DWORD
    4115
    lOCALE_STHOUSAND      :: LCTYPE
    lOCALE_STHOUSAND :: DWORD
    lOCALE_STHOUSAND      =  DWORD
    15
    lOCALE_STIME          :: LCTYPE
    lOCALE_STIME :: DWORD
    lOCALE_STIME          =  DWORD
    30
    lOCALE_STIMEFORMAT    :: LCTYPE
    lOCALE_STIMEFORMAT :: DWORD
    lOCALE_STIMEFORMAT    =  DWORD
    4099
    lOCALE_SYEARMONTH     :: LCTYPE
    lOCALE_SYEARMONTH :: DWORD
    lOCALE_SYEARMONTH     =  DWORD
    4102

    {-# LINE 251 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    -- |Type representing locale data

    data LCData
      -- | Data in the form of a Unicode string.

      = LCTextualData !String
      -- | Data in the form of a number. See 'lOCAL_RETURN_NUMBER' and @LOCAL_I*@

      -- locate information constants.

      | LCNumericData !DWORD
      -- | Data in the fomr of a 'LOCALESIGNATURE'. See 'lOCAL_FONTSIGNATURE' locale

      -- information constant.

      | LCSignatureData !LOCALESIGNATURE
      deriving (Eq, Show)

    data LOCALESIGNATURE = LOCALESIGNATURE
      { lsUsb :: !UnicodeSubsetBitfield
      , lsCsbDefault :: !DDWORD
      , lsCsbSupported :: !DDWORD
      } deriving (Eq, Show)

    instance Storable LOCALESIGNATURE where
      sizeOf = const (32)
    {-# LINE 272 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      alignment _ = 4
    {-# LINE 273 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      peek buf = do
        lsUsb'          <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf
    {-# LINE 275 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        lsCsbDefault'   <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) buf
    {-# LINE 276 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        lsCsbSupported' <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) buf
    {-# LINE 277 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        return $ LOCALESIGNATURE lsUsb' lsCsbDefault' lsCsbSupported'
      poke buf info = do
        ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) buf (lsUsb info)
    {-# LINE 280 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) buf (lsCsbDefault info)
    {-# LINE 281 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) buf (lsCsbSupported info)
    {-# LINE 282 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    -- | Type representing 128-bit Unicode subset bitfields, as the @base@ package

    -- does include a module exporting a 128-bit unsigned integer type.

    data UnicodeSubsetBitfield = UnicodeSubsetBitfield
      { usbLow :: !DDWORD
      , usbHigh :: !DDWORD
      } deriving (Eq, Show)

    instance Storable UnicodeSubsetBitfield where
      sizeOf _ = 2 * sizeOf (undefined :: DDWORD)
      alignment _ = alignment (undefined :: DWORD)
      peek buf = do
        usbLow'  <- (peekByteOff buf 0 :: IO DDWORD)
        usbHigh' <- (peekByteOff buf (sizeOf (undefined :: DDWORD)) :: IO DDWORD)
        return $ UnicodeSubsetBitfield usbLow' usbHigh'
      poke buf info = do
        pokeByteOff buf 0 (usbLow info)
        pokeByteOff buf (sizeOf (undefined :: DDWORD)) (usbHigh info)

    getLocaleInfoEx :: Maybe String -> LCTYPE -> IO LCData
    getLocaleInfoEx locale ty
      | ty == lOCALE_FONTSIGNATURE =
          getLocaleInfoEx' LCSignatureData localSigCharCount

      | ty .&. lOCALE_RETURN_NUMBER /= 0 =
          getLocaleInfoEx' LCNumericData dWORDCharCount

      | otherwise = maybeWith withTString locale $ \c_locale ->
          LCTextualData <$> trySized cFuncName (c_GetLocaleInfoEx c_locale ty)
     where
      cFuncName = "GetLocaleInfoEx"
      -- See https://docs.microsoft.com/en-us/windows/win32/api/winnls/nf-winnls-getlocaleinfoex

      localSigCharCount = ((32)) `div` ((2))
    {-# LINE 315 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      dWORDCharCount = ((4)) `div` ((2))
    {-# LINE 316 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

      getLocaleInfoEx' constructor bufSize = maybeWith withTString locale $
        \c_locale -> do
          value <- alloca $ \buf -> do
            _ <- failIfZero cFuncName
              $ c_GetLocaleInfoEx c_locale ty (castPtr buf) bufSize
            peek buf
          return $ constructor value

    foreign import WINDOWS_CCONV unsafe "windows.h GetLocaleInfoEx"
      c_GetLocaleInfoEx :: LPCWSTR -> LCTYPE -> LPWSTR -> CInt -> IO CInt

    setLocaleInfo :: LCID -> LCTYPE -> String -> IO ()
    setLocaleInfo locale ty info =
      withTString info $ \ c_info ->
      failIfFalse_ "SetLocaleInfo" $ c_SetLocaleInfo locale ty c_info
    foreign import WINDOWS_CCONV unsafe "windows.h SetLocaleInfoW"
      c_SetLocaleInfo :: LCID -> LCTYPE -> LPCTSTR -> IO Bool

    type LCMapFlags = DWORD

    lCMAP_BYTEREV               :: LCMapFlags
    lCMAP_BYTEREV               =  2048
    lCMAP_FULLWIDTH             :: LCMapFlags
    lCMAP_FULLWIDTH             =  8388608
    lCMAP_HALFWIDTH             :: LCMapFlags
    lCMAP_HALFWIDTH             =  4194304
    lCMAP_HIRAGANA              :: LCMapFlags
    lCMAP_HIRAGANA              =  1048576
    lCMAP_KATAKANA              :: LCMapFlags
    lCMAP_KATAKANA              =  2097152
    lCMAP_LINGUISTIC_CASING     :: LCMapFlags
    lCMAP_LINGUISTIC_CASING     =  16777216
    lCMAP_LOWERCASE             :: LCMapFlags
    lCMAP_LOWERCASE             =  256
    lCMAP_SIMPLIFIED_CHINESE    :: LCMapFlags
    lCMAP_SIMPLIFIED_CHINESE    =  33554432
    lCMAP_SORTKEY               :: LCMapFlags
    lCMAP_SORTKEY               =  1024
    lCMAP_TRADITIONAL_CHINESE   :: LCMapFlags
    lCMAP_TRADITIONAL_CHINESE   =  67108864
    lCMAP_UPPERCASE             :: LCMapFlags
    lCMAP_UPPERCASE             =  512
    lINGUISTIC_IGNORECASE       :: LCMapFlags
    lINGUISTIC_IGNORECASE       =  16
    lINGUISTIC_IGNOREDIACRITIC  :: LCMapFlags
    lINGUISTIC_IGNOREDIACRITIC  =  32
    nORM_IGNORECASE             :: LCMapFlags
    nORM_IGNORECASE             =  1
    nORM_IGNORENONSPACE         :: LCMapFlags
    nORM_IGNORENONSPACE         =  2
    nORM_IGNOREKANATYPE         :: LCMapFlags
    nORM_IGNOREKANATYPE         =  65536
    nORM_IGNORESYMBOLS          :: LCMapFlags
    nORM_IGNORESYMBOLS          =  4
    nORM_IGNOREWIDTH            :: LCMapFlags
    nORM_IGNOREWIDTH            =  131072
    nORM_LINGUISTIC_CASING      :: LCMapFlags
    nORM_LINGUISTIC_CASING      =  134217728
    sORT_STRINGSORT             :: LCMapFlags
    sORT_STRINGSORT             =  4096

    {-# LINE 359 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    data NLSVERSIONINFOEX = NLSVERSIONINFOEX
      { dwNLSVersionInfoSize :: DWORD
      , dwNLSVersion :: DWORD
      , dwDefinedVersion :: DWORD
      , dwEffectiveId :: DWORD
      , guidCustomVersion :: GUID
      } deriving (Eq, Show)

    instance Storable NLSVERSIONINFOEX where
      sizeOf = const (32)
    {-# LINE 370 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      alignment _ = 4
    {-# LINE 371 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      peek buf = do
        dwNLSVersionInfoSize' <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) buf
    {-# LINE 373 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        dwNLSVersion' <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) buf
    {-# LINE 374 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        dwDefinedVersion' <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) buf
    {-# LINE 375 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        dwEffectiveId' <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) buf
    {-# LINE 376 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        guidCustomVersion' <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) buf
    {-# LINE 377 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        return $ NLSVERSIONINFOEX dwNLSVersionInfoSize' dwNLSVersion'
                   dwDefinedVersion' dwEffectiveId' guidCustomVersion'
      poke buf info = do
        ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) buf
    {-# LINE 381 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
          (dwNLSVersionInfoSize info)
        ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) buf (dwNLSVersion info)
    {-# LINE 383 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) buf (dwDefinedVersion info)
    {-# LINE 384 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) buf (dwEffectiveId info)
    {-# LINE 385 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) buf (guidCustomVersion info)
    {-# LINE 386 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    -- Based on the `UnpackedUUID` type of package `uuid-types`.

    data GUID = GUID
      !Word32
      !Word16
      !Word16
      !Word8
      !Word8
      !Word8
      !Word8
      !Word8
      !Word8
      !Word8
      !Word8
      deriving (GUID -> GUID -> Bool
    (GUID -> GUID -> Bool) -> (GUID -> GUID -> Bool) -> Eq GUID
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: GUID -> GUID -> Bool
    == :: GUID -> GUID -> Bool
    $c/= :: GUID -> GUID -> Bool
    /= :: GUID -> GUID -> Bool
    Eq)

    instance Show GUID where
      show :: GUID -> String
    show (GUID DWORD
    data1 SubLANGID
    data2 SubLANGID
    data3 Word8
    b1 Word8
    b2 Word8
    b3 Word8
    b4 Word8
    b5 Word8
    b6 Word8
    b7 Word8
    b8) =
        String
    -> DWORD
    -> SubLANGID
    -> SubLANGID
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> String
    forall r. PrintfType r => String -> r
    printf String
    "{%.8x-%.4x-%.4x-%.2x%2x-%.2x%.2x%.2x%.2x%.2x%.2x}" DWORD
    data1 SubLANGID
    data2 SubLANGID
    data3 Word8
    b1 Word8
    b2 Word8
    b3 Word8
    b4 Word8
    b5 Word8
    b6 Word8
    b7 Word8
    b8

    instance Storable GUID where
      sizeOf :: GUID -> Int
    sizeOf GUID
    _ = Int
    16
      alignment :: GUID -> Int
    alignment GUID
    _ = Int
    4
      peekByteOff :: forall b. Ptr b -> Int -> IO GUID
    peekByteOff Ptr b
    p Int
    off = DWORD
    -> SubLANGID
    -> SubLANGID
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> Word8
    -> GUID
    GUID
        (DWORD
     -> SubLANGID
     -> SubLANGID
     -> Word8
     -> Word8
     -> Word8
     -> Word8
     -> Word8
     -> Word8
     -> Word8
     -> Word8
     -> GUID)
    -> IO DWORD
    -> IO
         (SubLANGID
          -> SubLANGID
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> GUID)
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> Ptr b -> Int -> IO DWORD
    forall b. Ptr b -> Int -> IO DWORD
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p Int
    off
        IO
      (SubLANGID
       -> SubLANGID
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> GUID)
    -> IO SubLANGID
    -> IO
         (SubLANGID
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO SubLANGID
    forall b. Ptr b -> Int -> IO SubLANGID
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    4)
        IO
      (SubLANGID
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> GUID)
    -> IO SubLANGID
    -> IO
         (Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> Word8
          -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO SubLANGID
    forall b. Ptr b -> Int -> IO SubLANGID
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    6)
        IO
      (Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> Word8
       -> GUID)
    -> IO Word8
    -> IO
         (Word8
          -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    8)
        IO
      (Word8
       -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    -> IO Word8
    -> IO (Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    9)
        IO (Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    -> IO Word8
    -> IO (Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    10)
        IO (Word8 -> Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    -> IO Word8 -> IO (Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    11)
        IO (Word8 -> Word8 -> Word8 -> Word8 -> GUID)
    -> IO Word8 -> IO (Word8 -> Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    12)
        IO (Word8 -> Word8 -> Word8 -> GUID)
    -> IO Word8 -> IO (Word8 -> Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    13)
        IO (Word8 -> Word8 -> GUID) -> IO Word8 -> IO (Word8 -> GUID)
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    14)
        IO (Word8 -> GUID) -> IO Word8 -> IO GUID
    forall a b. IO (a -> b) -> IO a -> IO b
    forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
    <*> Ptr b -> Int -> IO Word8
    forall b. Ptr b -> Int -> IO Word8
    forall a b. Storable a => Ptr b -> Int -> IO a
    peekByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    15)
      pokeByteOff :: forall b. Ptr b -> Int -> GUID -> IO ()
    pokeByteOff Ptr b
    p Int
    off (GUID DWORD
    data1 SubLANGID
    data2 SubLANGID
    data3 Word8
    b1 Word8
    b2 Word8
    b3 Word8
    b4 Word8
    b5 Word8
    b6 Word8
    b7 Word8
    b8) = do
        Ptr b -> Int -> DWORD -> IO ()
    forall b. Ptr b -> Int -> DWORD -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p Int
    off DWORD
    data1
        Ptr b -> Int -> SubLANGID -> IO ()
    forall b. Ptr b -> Int -> SubLANGID -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    4) SubLANGID
    data2
        Ptr b -> Int -> SubLANGID -> IO ()
    forall b. Ptr b -> Int -> SubLANGID -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    6) SubLANGID
    data3
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    8) Word8
    b1
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    9) Word8
    b2
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    10) Word8
    b3
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    11) Word8
    b4
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    12) Word8
    b5
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    13) Word8
    b6
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    14) Word8
    b7
        Ptr b -> Int -> Word8 -> IO ()
    forall b. Ptr b -> Int -> Word8 -> IO ()
    forall a b. Storable a => Ptr b -> Int -> a -> IO ()
    pokeByteOff Ptr b
    p (Int
    off Int -> Int -> Int
    forall a. Num a => a -> a -> a
    + Int
    15) Word8
    b8

    getNLSVersionEx :: Maybe String -> IO NLSVERSIONINFOEX
    getNLSVersionEx :: Maybe String -> IO NLSVERSIONINFOEX
    getNLSVersionEx Maybe String
    locale = (String
     -> (Ptr CWchar -> IO NLSVERSIONINFOEX) -> IO NLSVERSIONINFOEX)
    -> Maybe String
    -> (Ptr CWchar -> IO NLSVERSIONINFOEX)
    -> IO NLSVERSIONINFOEX
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith String
    -> (Ptr CWchar -> IO NLSVERSIONINFOEX) -> IO NLSVERSIONINFOEX
    forall a. String -> (Ptr CWchar -> IO a) -> IO a
    withTString Maybe String
    locale ((Ptr CWchar -> IO NLSVERSIONINFOEX) -> IO NLSVERSIONINFOEX)
    -> (Ptr CWchar -> IO NLSVERSIONINFOEX) -> IO NLSVERSIONINFOEX
    forall a b. (a -> b) -> a -> b
    $ \Ptr CWchar
    c_locale ->
      NLSVERSIONINFOEX
    -> (Ptr NLSVERSIONINFOEX -> IO NLSVERSIONINFOEX)
    -> IO NLSVERSIONINFOEX
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with NLSVERSIONINFOEX
    defaultVersionInfo ((Ptr NLSVERSIONINFOEX -> IO NLSVERSIONINFOEX)
     -> IO NLSVERSIONINFOEX)
    -> (Ptr NLSVERSIONINFOEX -> IO NLSVERSIONINFOEX)
    -> IO NLSVERSIONINFOEX
    forall a b. (a -> b) -> a -> b
    $ \Ptr NLSVERSIONINFOEX
    c_versionInfo -> do
        String -> IO Bool -> IO ()
    failIfFalse_ String
    "GetNLSVersionEx" (IO Bool -> IO ()) -> IO Bool -> IO ()
    forall a b. (a -> b) -> a -> b
    $
          DWORD -> Ptr CWchar -> Ptr NLSVERSIONINFOEX -> IO Bool
    c_GetNLSVersionEx DWORD
    function Ptr CWchar
    c_locale Ptr NLSVERSIONINFOEX
    c_versionInfo
        Ptr NLSVERSIONINFOEX -> IO NLSVERSIONINFOEX
    forall a. Storable a => Ptr a -> IO a
    peek Ptr NLSVERSIONINFOEX
    c_versionInfo
     where
      function :: DWORD
    function = DWORD
    1
    {-# LINE 442 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
      defaultVersionInfo = NLSVERSIONINFOEX
        { dwNLSVersionInfoSize = (32)
    {-# LINE 444 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}
        , dwNLSVersion = 0
        , dwDefinedVersion = 0
        , dwEffectiveId = 0
        , guidCustomVersion = GUID 0 0 0 0 0 0 0 0 0 0 0
        }
    foreign import WINDOWS_CCONV unsafe "windows.h GetNLSVersionEx"
      c_GetNLSVersionEx :: NLS_FUNCTION
                        -> LPCWSTR
                        -> Ptr NLSVERSIONINFOEX
                        -> IO Bool

    lCMapStringEx :: Maybe String
                  -> LCMapFlags
                  -> String
                  -> NLSVERSIONINFOEX
                  -> IO String
    lCMapStringEx :: Maybe String -> DWORD -> String -> NLSVERSIONINFOEX -> IO String
    lCMapStringEx Maybe String
    locale DWORD
    flags String
    src NLSVERSIONINFOEX
    versionInfo =
      (String -> (Ptr CWchar -> IO String) -> IO String)
    -> Maybe String -> (Ptr CWchar -> IO String) -> IO String
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith String -> (Ptr CWchar -> IO String) -> IO String
    forall a. String -> (Ptr CWchar -> IO a) -> IO a
    withTString Maybe String
    locale ((Ptr CWchar -> IO String) -> IO String)
    -> (Ptr CWchar -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \Ptr CWchar
    c_locale ->
        String -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a. String -> ((Ptr CWchar, Int) -> IO a) -> IO a
    withTStringLen String
    src (((Ptr CWchar, Int) -> IO String) -> IO String)
    -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \(Ptr CWchar
    c_src, Int
    src_len) ->
          NLSVERSIONINFOEX
    -> (Ptr NLSVERSIONINFOEX -> IO String) -> IO String
    forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
    with NLSVERSIONINFOEX
    versionInfo ((Ptr NLSVERSIONINFOEX -> IO String) -> IO String)
    -> (Ptr NLSVERSIONINFOEX -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \Ptr NLSVERSIONINFOEX
    c_versionInfo -> do
            let c_src_len :: CInt
    c_src_len = Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    src_len
                c_func :: Ptr CWchar -> CInt -> IO CInt
    c_func Ptr CWchar
    s CInt
    l = Ptr CWchar
    -> DWORD
    -> Ptr CWchar
    -> CInt
    -> Ptr CWchar
    -> CInt
    -> Ptr NLSVERSIONINFOEX
    -> LPVOID
    -> LPARAM
    -> IO CInt
    c_LCMapStringEx Ptr CWchar
    c_locale
                                             DWORD
    flags
                                             Ptr CWchar
    c_src CInt
    c_src_len
                                             Ptr CWchar
    s CInt
    l
                                             Ptr NLSVERSIONINFOEX
    c_versionInfo
                                             LPVOID
    forall a. Ptr a
    nullPtr -- Reserved, must be NULL

                                             LPARAM
    0 -- Reserved, must be 0

            String -> (Ptr CWchar -> CInt -> IO CInt) -> IO String
    trySized String
    "LCMapStringEx" Ptr CWchar -> CInt -> IO CInt
    c_func
    foreign import WINDOWS_CCONV unsafe "windows.h LCMapStringEx"
      c_LCMapStringEx :: LPCWSTR
                      -> LCMapFlags
                      -> LPCWSTR
                      -> CInt
                      -> LPWSTR
                      -> CInt
                      -> Ptr NLSVERSIONINFOEX
                      -> LPVOID
                      -> LPARAM
                      -> IO CInt

    lCMapString :: LCID -> LCMapFlags -> String -> Int -> IO String
    lCMapString :: DWORD -> DWORD -> String -> Int -> IO String
    lCMapString DWORD
    locale DWORD
    flags String
    src Int
    dest_size =
      String -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a. String -> ((Ptr CWchar, Int) -> IO a) -> IO a
    withTStringLen String
    src (((Ptr CWchar, Int) -> IO String) -> IO String)
    -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \ (Ptr CWchar
    c_src, Int
    src_len) ->
      Int -> (Ptr CWchar -> IO String) -> IO String
    forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
    allocaArray Int
    dest_size ((Ptr CWchar -> IO String) -> IO String)
    -> (Ptr CWchar -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \ Ptr CWchar
    c_dest -> do
      _ <- String -> IO Int -> IO Int
    forall a. (Eq a, Num a) => String -> IO a -> IO a
    failIfZero String
    "LCMapString" (IO Int -> IO Int) -> IO Int -> IO Int
    forall a b. (a -> b) -> a -> b
    $
        DWORD -> DWORD -> Ptr CWchar -> Int -> Ptr CWchar -> Int -> IO Int
    c_LCMapString DWORD
    locale DWORD
    flags Ptr CWchar
    c_src Int
    src_len Ptr CWchar
    c_dest Int
    dest_size
      peekTString c_dest
    foreign import WINDOWS_CCONV unsafe "windows.h LCMapStringW"
      c_LCMapString :: LCID -> LCMapFlags -> LPCTSTR -> Int -> LPCTSTR -> Int -> IO Int

    type LocaleTestFlags = DWORD

    lCID_INSTALLED        :: LocaleTestFlags
    lCID_INSTALLED :: DWORD
    lCID_INSTALLED        =  DWORD
    1
    lCID_SUPPORTED        :: LocaleTestFlags
    lCID_SUPPORTED :: DWORD
    lCID_SUPPORTED        =  DWORD
    2

    {-# LINE 501 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    isValidLocaleName :: Maybe String -> IO Bool
    isValidLocaleName :: Maybe String -> IO Bool
    isValidLocaleName Maybe String
    lpLocaleName =
      (String -> (Ptr CWchar -> IO Bool) -> IO Bool)
    -> Maybe String -> (Ptr CWchar -> IO Bool) -> IO Bool
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith String -> (Ptr CWchar -> IO Bool) -> IO Bool
    forall a. String -> (Ptr CWchar -> IO a) -> IO a
    withTString Maybe String
    lpLocaleName Ptr CWchar -> IO Bool
    c_IsValidLocaleName
    foreign import WINDOWS_CCONV unsafe "windows.h IsValidLocaleName"
      c_IsValidLocaleName :: LPCWSTR -> IO Bool

    foreign import WINDOWS_CCONV unsafe "windows.h IsValidLocale"
      isValidLocale :: LCID -> LocaleTestFlags -> IO Bool

    type EnumLocalesFlag = DWORD

    -- The following locale enumeration flag constants are excluded from the `enum`

    -- list below, for the reason indicated:

    -- LOCALE_NEUTRALDATA -- Introduced in Windows 7 but not supported.

    lOCALE_ALL              :: EnumLocalesFlag
    lOCALE_ALL :: DWORD
    lOCALE_ALL              =  DWORD
    0
    lOCALE_ALTERNATE_SORTS  :: EnumLocalesFlag
    lOCALE_ALTERNATE_SORTS :: DWORD
    lOCALE_ALTERNATE_SORTS  =  DWORD
    4
    lOCALE_REPLACEMENT      :: EnumLocalesFlag
    lOCALE_REPLACEMENT :: DWORD
    lOCALE_REPLACEMENT      =  DWORD
    8
    lOCALE_SUPPLEMENTAL     :: EnumLocalesFlag
    lOCALE_SUPPLEMENTAL :: DWORD
    lOCALE_SUPPLEMENTAL     =  DWORD
    2
    lOCALE_WINDOWS          :: EnumLocalesFlag
    lOCALE_WINDOWS :: DWORD
    lOCALE_WINDOWS          =  DWORD
    1

    {-# LINE 524 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    type LOCALE_ENUMPROCEX = LPWSTR -> EnumLocalesFlag -> LPARAM -> IO BOOL
    foreign import WINDOWS_CCONV "wrapper"
      mkLOCALE_ENUMPROCEX :: LOCALE_ENUMPROCEX -> IO (FunPtr LOCALE_ENUMPROCEX)

    enumSystemLocalesEx :: LOCALE_ENUMPROCEX -> EnumLocalesFlag -> LPARAM -> IO ()
    enumSystemLocalesEx :: LOCALE_ENUMPROCEX -> DWORD -> LPARAM -> IO ()
    enumSystemLocalesEx LOCALE_ENUMPROCEX
    callback DWORD
    dwFlags LPARAM
    lParam = do
      c_callback <- LOCALE_ENUMPROCEX -> IO (FunPtr LOCALE_ENUMPROCEX)
    mkLOCALE_ENUMPROCEX LOCALE_ENUMPROCEX
    callback
      failIfFalse_ "EnumSystemLocalesEx" $
        c_EnumSystemLocalesEx c_callback dwFlags lParam nullPtr
      freeHaskellFunPtr c_callback
    foreign import WINDOWS_CCONV safe "windows.h EnumSystemLocalesEx"
      c_EnumSystemLocalesEx :: (FunPtr LOCALE_ENUMPROCEX)
                            -> DWORD
                            -> LPARAM
                            -> LPVOID
                            -> IO Bool

    enumSystemLocalesEx' :: EnumLocalesFlag
                         -> Maybe Bool
                         -- ^ Maybe include (or exclude) replacement locales?

                         -> IO [String]
    enumSystemLocalesEx' :: DWORD -> Maybe Bool -> IO [String]
    enumSystemLocalesEx' DWORD
    dwFlags Maybe Bool
    mIsReplacement = do
      store <- [String] -> IO (IORef [String])
    forall a. a -> IO (IORef a)
    newIORef []
      let localeEnumProcEx Ptr CWchar
    c_locale DWORD
    arg2 p
    _ = do
            locale <- Ptr CWchar -> IO String
    peekTString Ptr CWchar
    c_locale
            case mIsReplacement of
              Maybe Bool
    Nothing -> IORef [String] -> ([String] -> [String]) -> IO ()
    forall a. IORef a -> (a -> a) -> IO ()
    modifyIORef IORef [String]
    store (String
    localeString -> [String] -> [String]
    forall a. a -> [a] -> [a]
    :)
              Just Bool
    isReplacement ->
                Bool -> IO () -> IO ()
    forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
    when (Bool
    isReplacement Bool -> Bool -> Bool
    forall a. Eq a => a -> a -> Bool
    == (DWORD
    arg2 DWORD -> DWORD -> DWORD
    forall a. Bits a => a -> a -> a
    .&. DWORD
    lOCALE_REPLACEMENT DWORD -> DWORD -> Bool
    forall a. Eq a => a -> a -> Bool
    /= DWORD
    0)) (IO () -> IO ()) -> IO () -> IO ()
    forall a b. (a -> b) -> a -> b
    $
                  IORef [String] -> ([String] -> [String]) -> IO ()
    forall a. IORef a -> (a -> a) -> IO ()
    modifyIORef IORef [String]
    store (String
    localeString -> [String] -> [String]
    forall a. a -> [a] -> [a]
    :)
            return True
      enumSystemLocalesEx localeEnumProcEx dwFlags 0
      reverse <$> readIORef store

    foreign import WINDOWS_CCONV unsafe "windows.h IsValidCodePage"
      isValidCodePage :: CodePage -> IO Bool

    foreign import WINDOWS_CCONV unsafe "windows.h GetUserDefaultLCID"
      getUserDefaultLCID :: LCID

    foreign import WINDOWS_CCONV unsafe "windows.h GetUserDefaultLangID"
      getUserDefaultLangID :: LANGID

    -- #define LOCALE_NAME_INVARIANT L""

    lOCALE_NAME_INVARIANT :: Maybe String
    lOCALE_NAME_INVARIANT :: Maybe String
    lOCALE_NAME_INVARIANT = String -> Maybe String
    forall a. a -> Maybe a
    Just String
    ""

     -- #define LOCALE_NAME_SYSTEM_DEFAULT L"!x-sys-default-locale"

    lOCALE_NAME_SYSTEM_DEFAULT :: Maybe String
    lOCALE_NAME_SYSTEM_DEFAULT :: Maybe String
    lOCALE_NAME_SYSTEM_DEFAULT = String -> Maybe String
    forall a. a -> Maybe a
    Just String
    "!x-sys-default-locale"

     -- #define LOCALE_NAME_USER_DEFAULT NULL

    lOCALE_NAME_USER_DEFAULT :: Maybe String
    lOCALE_NAME_USER_DEFAULT :: Maybe String
    lOCALE_NAME_USER_DEFAULT = Maybe String
    forall a. Maybe a
    Nothing

    getUserDefaultLocaleName :: IO String
    getUserDefaultLocaleName :: IO String
    getUserDefaultLocaleName =
      String -> (Ptr CWchar -> CInt -> IO CInt) -> IO String
    getDefaultLocaleName String
    "GetUserDefaultLocaleName" Ptr CWchar -> CInt -> IO CInt
    c_GetUserDefaultLocaleName
    foreign import WINDOWS_CCONV unsafe "windows.h GetUserDefaultLocaleName"
      c_GetUserDefaultLocaleName :: LPWSTR -> CInt -> IO CInt

    lOCALE_NAME_MAX_LENGTH  :: CInt
    lOCALE_NAME_MAX_LENGTH :: CInt
    lOCALE_NAME_MAX_LENGTH  =  CInt
    85

    {-# LINE 589 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    -- |Helper function for use with 'c_GetUserDefaultLocaleName' or

    -- 'c_GetSystemDefaultLocaleName'. See 'getUserDefaultLocaleName' and

    -- 'getSystemUserDefaultLocaleName'.

    getDefaultLocaleName :: String -> (LPWSTR -> CInt -> IO CInt) -> IO String
    getDefaultLocaleName :: String -> (Ptr CWchar -> CInt -> IO CInt) -> IO String
    getDefaultLocaleName String
    cDefaultLocaleFuncName Ptr CWchar -> CInt -> IO CInt
    cDefaultLocaleFunc =
      Int -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a. Int -> ((Ptr CWchar, Int) -> IO a) -> IO a
    withTStringBufferLen Int
    maxLength (((Ptr CWchar, Int) -> IO String) -> IO String)
    -> ((Ptr CWchar, Int) -> IO String) -> IO String
    forall a b. (a -> b) -> a -> b
    $ \(Ptr CWchar
    buf, Int
    len) -> do
        let c_len :: CInt
    c_len = Int -> CInt
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral Int
    len
        c_len' <- String -> IO CInt -> IO CInt
    forall a. (Eq a, Num a) => String -> IO a -> IO a
    failIfZero String
    cDefaultLocaleFuncName (IO CInt -> IO CInt) -> IO CInt -> IO CInt
    forall a b. (a -> b) -> a -> b
    $
          Ptr CWchar -> CInt -> IO CInt
    cDefaultLocaleFunc Ptr CWchar
    buf CInt
    c_len
        let len' = CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral CInt
    c_len'
        peekTStringLen (buf, len' - 1) -- Drop final null character

     where
      maxLength :: Int
    maxLength = CInt -> Int
    forall a b. (Integral a, Num b) => a -> b
    fromIntegral CInt
    lOCALE_NAME_MAX_LENGTH

    foreign import WINDOWS_CCONV unsafe "windows.h GetThreadLocale"
      getThreadLocale :: IO LCID

    foreign import WINDOWS_CCONV unsafe "windows.h GetSystemDefaultLCID"
      getSystemDefaultLCID :: LCID

    foreign import WINDOWS_CCONV unsafe "windows.h GetSystemDefaultLangID"
      getSystemDefaultLangID :: LANGID

    getSystemDefaultLocaleName :: IO String
    getSystemDefaultLocaleName :: IO String
    getSystemDefaultLocaleName =
      String -> (Ptr CWchar -> CInt -> IO CInt) -> IO String
    getDefaultLocaleName String
    "GetSystemDefaultLocaleName" Ptr CWchar -> CInt -> IO CInt
    c_GetSystemDefaultLocaleName
    foreign import WINDOWS_CCONV unsafe "windows.h GetSystemDefaultLocaleName"
      c_GetSystemDefaultLocaleName :: LPWSTR -> CInt -> IO CInt

    foreign import WINDOWS_CCONV unsafe "windows.h GetOEMCP"
      getOEMCP :: CodePage

    lANG_NEUTRAL          :: PrimaryLANGID
    lANG_NEUTRAL :: SubLANGID
    lANG_NEUTRAL          =  SubLANGID
    0
    lANG_BULGARIAN        :: PrimaryLANGID
    lANG_BULGARIAN :: SubLANGID
    lANG_BULGARIAN        =  SubLANGID
    2
    lANG_CHINESE          :: PrimaryLANGID
    lANG_CHINESE :: SubLANGID
    lANG_CHINESE          =  SubLANGID
    4
    lANG_CZECH            :: PrimaryLANGID
    lANG_CZECH :: SubLANGID
    lANG_CZECH            =  SubLANGID
    5
    lANG_DANISH           :: PrimaryLANGID
    lANG_DANISH :: SubLANGID
    lANG_DANISH           =  SubLANGID
    6
    lANG_GERMAN           :: PrimaryLANGID
    lANG_GERMAN :: SubLANGID
    lANG_GERMAN           =  SubLANGID
    7
    lANG_GREEK            :: PrimaryLANGID
    lANG_GREEK :: SubLANGID
    lANG_GREEK            =  SubLANGID
    8
    lANG_ENGLISH          :: PrimaryLANGID
    lANG_ENGLISH :: SubLANGID
    lANG_ENGLISH          =  SubLANGID
    9
    lANG_SPANISH          :: PrimaryLANGID
    lANG_SPANISH :: SubLANGID
    lANG_SPANISH          =  SubLANGID
    10
    lANG_FINNISH          :: PrimaryLANGID
    lANG_FINNISH :: SubLANGID
    lANG_FINNISH          =  SubLANGID
    11
    lANG_FRENCH           :: PrimaryLANGID
    lANG_FRENCH :: SubLANGID
    lANG_FRENCH           =  SubLANGID
    12
    lANG_HUNGARIAN        :: PrimaryLANGID
    lANG_HUNGARIAN :: SubLANGID
    lANG_HUNGARIAN        =  SubLANGID
    14
    lANG_ICELANDIC        :: PrimaryLANGID
    lANG_ICELANDIC :: SubLANGID
    lANG_ICELANDIC        =  SubLANGID
    15
    lANG_ITALIAN          :: PrimaryLANGID
    lANG_ITALIAN :: SubLANGID
    lANG_ITALIAN          =  SubLANGID
    16
    lANG_JAPANESE         :: PrimaryLANGID
    lANG_JAPANESE :: SubLANGID
    lANG_JAPANESE         =  SubLANGID
    17
    lANG_KOREAN           :: PrimaryLANGID
    lANG_KOREAN :: SubLANGID
    lANG_KOREAN           =  SubLANGID
    18
    lANG_DUTCH            :: PrimaryLANGID
    lANG_DUTCH :: SubLANGID
    lANG_DUTCH            =  SubLANGID
    19
    lANG_NORWEGIAN        :: PrimaryLANGID
    lANG_NORWEGIAN :: SubLANGID
    lANG_NORWEGIAN        =  SubLANGID
    20
    lANG_POLISH           :: PrimaryLANGID
    lANG_POLISH :: SubLANGID
    lANG_POLISH           =  SubLANGID
    21
    lANG_PORTUGUESE       :: PrimaryLANGID
    lANG_PORTUGUESE :: SubLANGID
    lANG_PORTUGUESE       =  SubLANGID
    22
    lANG_ROMANIAN         :: PrimaryLANGID
    lANG_ROMANIAN :: SubLANGID
    lANG_ROMANIAN         =  SubLANGID
    24
    lANG_RUSSIAN          :: PrimaryLANGID
    lANG_RUSSIAN :: SubLANGID
    lANG_RUSSIAN          =  SubLANGID
    25
    lANG_CROATIAN         :: PrimaryLANGID
    lANG_CROATIAN :: SubLANGID
    lANG_CROATIAN         =  SubLANGID
    26
    lANG_SLOVAK           :: PrimaryLANGID
    lANG_SLOVAK :: SubLANGID
    lANG_SLOVAK           =  SubLANGID
    27
    lANG_SWEDISH          :: PrimaryLANGID
    lANG_SWEDISH :: SubLANGID
    lANG_SWEDISH          =  SubLANGID
    29
    lANG_TURKISH          :: PrimaryLANGID
    lANG_TURKISH :: SubLANGID
    lANG_TURKISH          =  SubLANGID
    31
    lANG_SLOVENIAN        :: PrimaryLANGID
    lANG_SLOVENIAN :: SubLANGID
    lANG_SLOVENIAN        =  SubLANGID
    36
    lANG_ARABIC           :: PrimaryLANGID
    lANG_ARABIC :: SubLANGID
    lANG_ARABIC           =  SubLANGID
    1
    lANG_CATALAN          :: PrimaryLANGID
    lANG_CATALAN :: SubLANGID
    lANG_CATALAN          =  SubLANGID
    3
    lANG_HEBREW           :: PrimaryLANGID
    lANG_HEBREW :: SubLANGID
    lANG_HEBREW           =  SubLANGID
    13
    lANG_SERBIAN          :: PrimaryLANGID
    lANG_SERBIAN :: SubLANGID
    lANG_SERBIAN          =  SubLANGID
    26
    lANG_ALBANIAN         :: PrimaryLANGID
    lANG_ALBANIAN :: SubLANGID
    lANG_ALBANIAN         =  SubLANGID
    28
    lANG_THAI             :: PrimaryLANGID
    lANG_THAI :: SubLANGID
    lANG_THAI             =  SubLANGID
    30
    lANG_URDU             :: PrimaryLANGID
    lANG_URDU :: SubLANGID
    lANG_URDU             =  SubLANGID
    32
    lANG_INDONESIAN       :: PrimaryLANGID
    lANG_INDONESIAN :: SubLANGID
    lANG_INDONESIAN       =  SubLANGID
    33
    lANG_BELARUSIAN       :: PrimaryLANGID
    lANG_BELARUSIAN :: SubLANGID
    lANG_BELARUSIAN       =  SubLANGID
    35
    lANG_ESTONIAN         :: PrimaryLANGID
    lANG_ESTONIAN :: SubLANGID
    lANG_ESTONIAN         =  SubLANGID
    37
    sORT_DEFAULT :: SubLANGID
    lANG_LATVIAN          :: PrimaryLANGID
    lANG_LATVIAN :: SubLANGID
    lANG_LATVIAN          =  SubLANGID
    38
    lANG_LITHUANIAN       :: PrimaryLANGID
    lANG_LITHUANIAN :: SubLANGID
    lANG_LITHUANIAN       =  SubLANGID
    39
    lANG_FARSI            :: PrimaryLANGID
    lANG_FARSI :: SubLANGID
    lANG_FARSI            =  SubLANGID
    41
    lANG_VIETNAMESE       :: PrimaryLANGID
    lANG_VIETNAMESE :: SubLANGID
    lANG_VIETNAMESE       =  SubLANGID
    42
    lANG_ARMENIAN         :: PrimaryLANGID
    lANG_ARMENIAN :: SubLANGID
    lANG_ARMENIAN         =  SubLANGID
    43
    lANG_AZERI            :: PrimaryLANGID
    lANG_AZERI :: SubLANGID
    lANG_AZERI            =  SubLANGID
    44
    lANG_BASQUE           :: PrimaryLANGID
    lANG_BASQUE :: SubLANGID
    lANG_BASQUE           =  SubLANGID
    45
    lANG_MACEDONIAN       :: PrimaryLANGID
    lANG_MACEDONIAN :: SubLANGID
    lANG_MACEDONIAN       =  SubLANGID
    47
    lANG_AFRIKAANS        :: PrimaryLANGID
    lANG_AFRIKAANS :: SubLANGID
    lANG_AFRIKAANS        =  54
    lANG_GEORGIAN         :: PrimaryLANGID
    lANG_GEORGIAN :: SubLANGID
    lANG_GEORGIAN         =  55
    lANG_FAEROESE         :: PrimaryLANGID
    lANG_FAEROESE :: SubLANGID
    lANG_FAEROESE         =  56
    lANG_HINDI            :: PrimaryLANGID
    lANG_HINDI :: SubLANGID
    lANG_HINDI            =  SubLANGID
    57
    lANG_MALAY            :: PrimaryLANGID
    lANG_MALAY :: SubLANGID
    lANG_MALAY            =  SubLANGID
    62
    lANG_KAZAK            :: PrimaryLANGID
    lANG_KAZAK :: SubLANGID
    lANG_KAZAK            =  SubLANGID
    63
    lANG_SWAHILI          :: PrimaryLANGID
    lANG_SWAHILI :: SubLANGID
    lANG_SWAHILI          =  SubLANGID
    65
    lANG_UZBEK            :: PrimaryLANGID
    lANG_UZBEK :: SubLANGID
    lANG_UZBEK            =  SubLANGID
    67
    lANG_TATAR            :: PrimaryLANGID
    lANG_TATAR :: SubLANGID
    lANG_TATAR            =  SubLANGID
    68
    lANG_BENGALI          :: PrimaryLANGID
    lANG_BENGALI :: SubLANGID
    lANG_BENGALI          =  SubLANGID
    69
    lANG_PUNJABI          :: PrimaryLANGID
    lANG_PUNJABI :: SubLANGID
    lANG_PUNJABI          =  SubLANGID
    70
    lANG_GUJARATI         :: PrimaryLANGID
    lANG_GUJARATI :: SubLANGID
    lANG_GUJARATI         =  SubLANGID
    71
    lANG_ORIYA            :: PrimaryLANGID
    lANG_ORIYA :: SubLANGID
    lANG_ORIYA            =  SubLANGID
    72
    lANG_TAMIL            :: PrimaryLANGID
    lANG_TAMIL :: SubLANGID
    lANG_TAMIL            =  73
    lANG_TELUGU           :: PrimaryLANGID
    lANG_TELUGU :: SubLANGID
    lANG_TELUGU           =  SubLANGID
    74
    lANG_KANNADA          :: PrimaryLANGID
    lANG_KANNADA :: SubLANGID
    lANG_KANNADA          =  SubLANGID
    75
    sUBLANG_GERMAN :: SubLANGID
    lANG_MALAYALAM        :: PrimaryLANGID
    lANG_MALAYALAM :: SubLANGID
    lANG_MALAYALAM        =  SubLANGID
    76
    lANG_ASSAMESE         :: PrimaryLANGID
    lANG_ASSAMESE :: SubLANGID
    lANG_ASSAMESE         =  77
    lANG_MARATHI          :: PrimaryLANGID
    lANG_MARATHI :: SubLANGID
    lANG_MARATHI          =  SubLANGID
    78
    lANG_SANSKRIT         :: PrimaryLANGID
    lANG_SANSKRIT :: SubLANGID
    lANG_SANSKRIT         =  SubLANGID
    79
    lANG_KONKANI          :: PrimaryLANGID
    lANG_KONKANI :: SubLANGID
    lANG_KONKANI          =  87
    lANG_MANIPURI         :: PrimaryLANGID
    lANG_MANIPURI :: SubLANGID
    lANG_MANIPURI         =  88
    lANG_SINDHI           :: PrimaryLANGID
    lANG_SINDHI :: SubLANGID
    lANG_SINDHI           =  SubLANGID
    89
    lANG_KASHMIRI         :: PrimaryLANGID
    lANG_KASHMIRI :: SubLANGID
    lANG_KASHMIRI         =  SubLANGID
    96
    lANG_NEPALI           :: PrimaryLANGID
    lANG_NEPALI :: SubLANGID
    lANG_NEPALI           =  SubLANGID
    97

    {-# LINE 694 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    sORT_DEFAULT          :: SortID
    sORT_DEFAULT          =  0
    sORT_JAPANESE_XJIS    :: SortID
    sORT_JAPANESE_XJIS    =  0
    sORT_JAPANESE_UNICODE  :: SortID
    sORT_JAPANESE_UNICODE  =  1
    sORT_CHINESE_BIG5     :: SortID
    sORT_CHINESE_BIG5     =  0
    sORT_CHINESE_UNICODE  :: SortID
    sORT_CHINESE_UNICODE  =  1
    sORT_KOREAN_KSC       :: SortID
    sORT_KOREAN_KSC       =  0
    sORT_KOREAN_UNICODE   :: SortID
    sORT_KOREAN_UNICODE   =  1

    {-# LINE 704 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    sUBLANG_NEUTRAL                       :: SubLANGID
    sUBLANG_NEUTRAL                       =  0
    sUBLANG_DEFAULT                       :: SubLANGID
    sUBLANG_DEFAULT                       =  1
    sUBLANG_SYS_DEFAULT                   :: SubLANGID
    sUBLANG_SYS_DEFAULT                   =  2
    sUBLANG_CHINESE_TRADITIONAL           :: SubLANGID
    sUBLANG_CHINESE_TRADITIONAL           =  1
    sUBLANG_CHINESE_SIMPLIFIED            :: SubLANGID
    sUBLANG_CHINESE_SIMPLIFIED            =  2
    sUBLANG_CHINESE_HONGKONG              :: SubLANGID
    sUBLANG_CHINESE_HONGKONG              =  3
    sUBLANG_CHINESE_SINGAPORE             :: SubLANGID
    sUBLANG_CHINESE_SINGAPORE             =  4
    sUBLANG_DUTCH                         :: SubLANGID
    sUBLANG_DUTCH                         =  1
    sUBLANG_DUTCH_BELGIAN                 :: SubLANGID
    sUBLANG_DUTCH_BELGIAN                 =  2
    sUBLANG_ENGLISH_US                    :: SubLANGID
    sUBLANG_ENGLISH_US                    =  1
    sUBLANG_ENGLISH_UK                    :: SubLANGID
    sUBLANG_ENGLISH_UK                    =  2
    sUBLANG_ENGLISH_AUS                   :: SubLANGID
    sUBLANG_ENGLISH_AUS                   =  3
    sUBLANG_ENGLISH_CAN                   :: SubLANGID
    sUBLANG_ENGLISH_CAN                   =  4
    sUBLANG_ENGLISH_NZ                    :: SubLANGID
    sUBLANG_ENGLISH_NZ                    =  5
    sUBLANG_ENGLISH_EIRE                  :: SubLANGID
    sUBLANG_ENGLISH_EIRE                  =  6
    sUBLANG_FRENCH                        :: SubLANGID
    sUBLANG_FRENCH                        =  1
    sUBLANG_FRENCH_BELGIAN                :: SubLANGID
    sUBLANG_FRENCH_BELGIAN                =  2
    sUBLANG_FRENCH_CANADIAN               :: SubLANGID
    sUBLANG_FRENCH_CANADIAN               =  3
    sUBLANG_FRENCH_SWISS                  :: SubLANGID
    sUBLANG_FRENCH_SWISS                  =  4
    sUBLANG_GERMAN                        :: SubLANGID
    sUBLANG_GERMAN                        =  1
    sUBLANG_GERMAN_SWISS                  :: SubLANGID
    sUBLANG_GERMAN_SWISS                  =  2
    sUBLANG_GERMAN_AUSTRIAN               :: SubLANGID
    sUBLANG_GERMAN_AUSTRIAN               =  3
    sUBLANG_ITALIAN                       :: SubLANGID
    sUBLANG_ITALIAN                       =  1
    sUBLANG_ITALIAN_SWISS                 :: SubLANGID
    sUBLANG_ITALIAN_SWISS                 =  2
    sUBLANG_NORWEGIAN_BOKMAL              :: SubLANGID
    sUBLANG_NORWEGIAN_BOKMAL              =  1
    sUBLANG_NORWEGIAN_NYNORSK             :: SubLANGID
    sUBLANG_NORWEGIAN_NYNORSK             =  2
    sUBLANG_PORTUGUESE                    :: SubLANGID
    sUBLANG_PORTUGUESE                    =  2
    sUBLANG_PORTUGUESE_BRAZILIAN          :: SubLANGID
    sUBLANG_PORTUGUESE_BRAZILIAN          =  1
    sUBLANG_SPANISH                       :: SubLANGID
    sUBLANG_SPANISH                       =  1
    sUBLANG_SPANISH_MEXICAN               :: SubLANGID
    sUBLANG_SPANISH_MEXICAN :: SubLANGID
    sUBLANG_SPANISH_MEXICAN               =  SubLANGID
    2
    sUBLANG_SPANISH_MODERN                :: SubLANGID
    sUBLANG_SPANISH_MODERN :: SubLANGID
    sUBLANG_SPANISH_MODERN                =  SubLANGID
    3
    sUBLANG_ARABIC_SAUDI_ARABIA           :: SubLANGID
    sUBLANG_ARABIC_SAUDI_ARABIA :: SubLANGID
    sUBLANG_ARABIC_SAUDI_ARABIA           =  SubLANGID
    1
    sUBLANG_ARABIC_IRAQ                   :: SubLANGID
    sUBLANG_ARABIC_IRAQ :: SubLANGID
    sUBLANG_ARABIC_IRAQ                   =  SubLANGID
    2
    sUBLANG_ARABIC_EGYPT                  :: SubLANGID
    sUBLANG_ARABIC_EGYPT :: SubLANGID
    sUBLANG_ARABIC_EGYPT                  =  SubLANGID
    3
    sUBLANG_ARABIC_LIBYA                  :: SubLANGID
    sUBLANG_ARABIC_LIBYA :: SubLANGID
    sUBLANG_ARABIC_LIBYA                  =  SubLANGID
    4
    sUBLANG_ARABIC_ALGERIA                :: SubLANGID
    sUBLANG_ARABIC_ALGERIA :: SubLANGID
    sUBLANG_ARABIC_ALGERIA                =  SubLANGID
    5
    sUBLANG_ARABIC_MOROCCO                :: SubLANGID
    sUBLANG_ARABIC_MOROCCO :: SubLANGID
    sUBLANG_ARABIC_MOROCCO                =  SubLANGID
    6
    sUBLANG_ARABIC_TUNISIA                :: SubLANGID
    sUBLANG_ARABIC_TUNISIA :: SubLANGID
    sUBLANG_ARABIC_TUNISIA                =  SubLANGID
    7
    sUBLANG_ARABIC_OMAN                   :: SubLANGID
    sUBLANG_ARABIC_OMAN :: SubLANGID
    sUBLANG_ARABIC_OMAN                   =  SubLANGID
    8
    sUBLANG_ARABIC_YEMEN                  :: SubLANGID
    sUBLANG_ARABIC_YEMEN :: SubLANGID
    sUBLANG_ARABIC_YEMEN                  =  SubLANGID
    9
    sUBLANG_ARABIC_SYRIA                  :: SubLANGID
    sUBLANG_ARABIC_SYRIA :: SubLANGID
    sUBLANG_ARABIC_SYRIA                  =  SubLANGID
    10
    sUBLANG_ARABIC_JORDAN                 :: SubLANGID
    sUBLANG_ARABIC_JORDAN :: SubLANGID
    sUBLANG_ARABIC_JORDAN                 =  SubLANGID
    11
    sUBLANG_ARABIC_LEBANON                :: SubLANGID
    sUBLANG_ARABIC_LEBANON :: SubLANGID
    sUBLANG_ARABIC_LEBANON                =  SubLANGID
    12
    sUBLANG_ARABIC_KUWAIT                 :: SubLANGID
    sUBLANG_ARABIC_KUWAIT :: SubLANGID
    sUBLANG_ARABIC_KUWAIT                 =  SubLANGID
    13
    sUBLANG_ARABIC_UAE                    :: SubLANGID
    sUBLANG_ARABIC_UAE :: SubLANGID
    sUBLANG_ARABIC_UAE                    =  SubLANGID
    14
    sUBLANG_ARABIC_BAHRAIN                :: SubLANGID
    sUBLANG_ARABIC_BAHRAIN :: SubLANGID
    sUBLANG_ARABIC_BAHRAIN                =  SubLANGID
    15
    sUBLANG_ARABIC_QATAR                  :: SubLANGID
    sUBLANG_ARABIC_QATAR :: SubLANGID
    sUBLANG_ARABIC_QATAR                  =  SubLANGID
    16
    sUBLANG_AZERI_CYRILLIC                :: SubLANGID
    sUBLANG_AZERI_CYRILLIC :: SubLANGID
    sUBLANG_AZERI_CYRILLIC                =  SubLANGID
    2
    sUBLANG_AZERI_LATIN                   :: SubLANGID
    sUBLANG_AZERI_LATIN :: SubLANGID
    sUBLANG_AZERI_LATIN                   =  SubLANGID
    1
    sUBLANG_CHINESE_MACAU                 :: SubLANGID
    sUBLANG_CHINESE_MACAU :: SubLANGID
    sUBLANG_CHINESE_MACAU                 =  SubLANGID
    5
    sUBLANG_ENGLISH_SOUTH_AFRICA          :: SubLANGID
    sUBLANG_ENGLISH_SOUTH_AFRICA :: SubLANGID
    sUBLANG_ENGLISH_SOUTH_AFRICA          =  SubLANGID
    7
    sUBLANG_ENGLISH_JAMAICA               :: SubLANGID
    sUBLANG_ENGLISH_JAMAICA               =  8
    sUBLANG_ENGLISH_CARIBBEAN             :: SubLANGID
    sUBLANG_ENGLISH_CARIBBEAN :: SubLANGID
    sUBLANG_ENGLISH_CARIBBEAN             =  SubLANGID
    9
    sUBLANG_ENGLISH_BELIZE                :: SubLANGID
    sUBLANG_ENGLISH_BELIZE :: SubLANGID
    sUBLANG_ENGLISH_BELIZE                =  SubLANGID
    10
    sUBLANG_ENGLISH_TRINIDAD              :: SubLANGID
    sUBLANG_ENGLISH_TRINIDAD :: SubLANGID
    sUBLANG_ENGLISH_TRINIDAD              =  SubLANGID
    11
    sUBLANG_ENGLISH_PHILIPPINES           :: SubLANGID
    sUBLANG_ENGLISH_PHILIPPINES           =  13
    sUBLANG_ENGLISH_ZIMBABWE              :: SubLANGID
    sUBLANG_ENGLISH_ZIMBABWE              =  12
    sUBLANG_FRENCH_LUXEMBOURG             :: SubLANGID
    sUBLANG_FRENCH_LUXEMBOURG             =  5
    sUBLANG_FRENCH_MONACO                 :: SubLANGID
    sUBLANG_FRENCH_MONACO :: SubLANGID
    sUBLANG_FRENCH_MONACO                 =  SubLANGID
    6
    sUBLANG_GERMAN_LUXEMBOURG             :: SubLANGID
    sUBLANG_GERMAN_LUXEMBOURG             =  4
    sUBLANG_GERMAN_LIECHTENSTEIN          :: SubLANGID
    sUBLANG_GERMAN_LIECHTENSTEIN          =  5
    sUBLANG_KASHMIRI_INDIA                :: SubLANGID
    sUBLANG_KASHMIRI_INDIA                =  2
    sUBLANG_KOREAN                        :: SubLANGID
    sUBLANG_KOREAN :: SubLANGID
    sUBLANG_KOREAN                        =  SubLANGID
    1
    sUBLANG_LITHUANIAN                    :: SubLANGID
    sUBLANG_LITHUANIAN :: SubLANGID
    sUBLANG_LITHUANIAN                    =  SubLANGID
    1
    sUBLANG_MALAY_MALAYSIA                :: SubLANGID
    sUBLANG_MALAY_MALAYSIA :: SubLANGID
    sUBLANG_MALAY_MALAYSIA                =  SubLANGID
    1
    sUBLANG_MALAY_BRUNEI_DARUSSALAM       :: SubLANGID
    sUBLANG_MALAY_BRUNEI_DARUSSALAM :: SubLANGID
    sUBLANG_MALAY_BRUNEI_DARUSSALAM       =  SubLANGID
    2
    sUBLANG_NEPALI_INDIA                  :: SubLANGID
    sUBLANG_NEPALI_INDIA :: SubLANGID
    sUBLANG_NEPALI_INDIA                  =  SubLANGID
    2
    sUBLANG_SERBIAN_LATIN                 :: SubLANGID
    sUBLANG_SERBIAN_LATIN :: SubLANGID
    sUBLANG_SERBIAN_LATIN                 =  SubLANGID
    2
    sUBLANG_SERBIAN_CYRILLIC              :: SubLANGID
    sUBLANG_SERBIAN_CYRILLIC :: SubLANGID
    sUBLANG_SERBIAN_CYRILLIC              =  SubLANGID
    3
    sUBLANG_SPANISH_GUATEMALA             :: SubLANGID
    sUBLANG_SPANISH_GUATEMALA :: SubLANGID
    sUBLANG_SPANISH_GUATEMALA             =  SubLANGID
    4
    sUBLANG_SPANISH_COSTA_RICA            :: SubLANGID
    sUBLANG_SPANISH_COSTA_RICA :: SubLANGID
    sUBLANG_SPANISH_COSTA_RICA            =  SubLANGID
    5
    sUBLANG_SPANISH_PANAMA                :: SubLANGID
    sUBLANG_SPANISH_PANAMA :: SubLANGID
    sUBLANG_SPANISH_PANAMA                =  SubLANGID
    6
    sUBLANG_SPANISH_DOMINICAN_REPUBLIC    :: SubLANGID
    sUBLANG_SPANISH_DOMINICAN_REPUBLIC :: SubLANGID
    sUBLANG_SPANISH_DOMINICAN_REPUBLIC    =  SubLANGID
    7
    sUBLANG_SPANISH_VENEZUELA             :: SubLANGID
    sUBLANG_SPANISH_VENEZUELA :: SubLANGID
    sUBLANG_SPANISH_VENEZUELA             =  SubLANGID
    8
    sUBLANG_SPANISH_COLOMBIA              :: SubLANGID
    sUBLANG_SPANISH_COLOMBIA :: SubLANGID
    sUBLANG_SPANISH_COLOMBIA              =  SubLANGID
    9
    sUBLANG_SPANISH_PERU                  :: SubLANGID
    sUBLANG_SPANISH_PERU :: SubLANGID
    sUBLANG_SPANISH_PERU                  =  SubLANGID
    10
    sUBLANG_SPANISH_ARGENTINA             :: SubLANGID
    sUBLANG_SPANISH_ARGENTINA :: SubLANGID
    sUBLANG_SPANISH_ARGENTINA             =  SubLANGID
    11
    sUBLANG_SPANISH_ECUADOR               :: SubLANGID
    sUBLANG_SPANISH_ECUADOR :: SubLANGID
    sUBLANG_SPANISH_ECUADOR               =  SubLANGID
    12
    sUBLANG_SPANISH_CHILE                 :: SubLANGID
    sUBLANG_SPANISH_CHILE :: SubLANGID
    sUBLANG_SPANISH_CHILE                 =  SubLANGID
    13
    sUBLANG_SPANISH_URUGUAY               :: SubLANGID
    sUBLANG_SPANISH_URUGUAY :: SubLANGID
    sUBLANG_SPANISH_URUGUAY               =  SubLANGID
    14
    sUBLANG_SPANISH_PARAGUAY              :: SubLANGID
    sUBLANG_SPANISH_PARAGUAY :: SubLANGID
    sUBLANG_SPANISH_PARAGUAY              =  SubLANGID
    15
    sUBLANG_SPANISH_BOLIVIA               :: SubLANGID
    sUBLANG_SPANISH_BOLIVIA :: SubLANGID
    sUBLANG_SPANISH_BOLIVIA               =  SubLANGID
    16
    sUBLANG_SPANISH_EL_SALVADOR           :: SubLANGID
    sUBLANG_SPANISH_EL_SALVADOR :: SubLANGID
    sUBLANG_SPANISH_EL_SALVADOR           =  SubLANGID
    17
    sUBLANG_SPANISH_HONDURAS              :: SubLANGID
    sUBLANG_SPANISH_HONDURAS :: SubLANGID
    sUBLANG_SPANISH_HONDURAS              =  SubLANGID
    18
    sUBLANG_SPANISH_NICARAGUA             :: SubLANGID
    sUBLANG_SPANISH_NICARAGUA :: SubLANGID
    sUBLANG_SPANISH_NICARAGUA             =  SubLANGID
    19
    sUBLANG_SPANISH_PUERTO_RICO           :: SubLANGID
    sUBLANG_SPANISH_PUERTO_RICO :: SubLANGID
    sUBLANG_SPANISH_PUERTO_RICO           =  SubLANGID
    20
    sUBLANG_SWEDISH                       :: SubLANGID
    sUBLANG_SWEDISH :: SubLANGID
    sUBLANG_SWEDISH                       =  SubLANGID
    1
    sUBLANG_SWEDISH_FINLAND               :: SubLANGID
    sUBLANG_SWEDISH_FINLAND :: SubLANGID
    sUBLANG_SWEDISH_FINLAND               =  SubLANGID
    2
    sUBLANG_URDU_PAKISTAN                 :: SubLANGID
    sUBLANG_URDU_PAKISTAN :: SubLANGID
    sUBLANG_URDU_PAKISTAN                 =  SubLANGID
    1
    sUBLANG_URDU_INDIA                    :: SubLANGID
    sUBLANG_URDU_INDIA :: SubLANGID
    sUBLANG_URDU_INDIA                    =  SubLANGID
    2
    sUBLANG_UZBEK_LATIN                   :: SubLANGID
    sUBLANG_UZBEK_LATIN :: SubLANGID
    sUBLANG_UZBEK_LATIN                   =  SubLANGID
    1
    sUBLANG_UZBEK_CYRILLIC                :: SubLANGID
    sUBLANG_UZBEK_CYRILLIC :: SubLANGID
    sUBLANG_UZBEK_CYRILLIC                =  SubLANGID
    2

    {-# LINE 799 "libraries\\Win32\\System\\Win32\\NLS.hsc" #-}

    -- , SUBLANG_LITHUANIAN_CLASSIC (not in mingw-20001111)

    -- ----------------------------------------------------------------------------

    -- | The `System.IO` input functions (e.g., `getLine`) don't

    -- automatically convert to Unicode, so this function is provided to

    -- make the conversion from a multibyte string in the given code page

    -- to a proper Unicode string.  To get the code page for the console,

    -- use `getConsoleCP`.

    stringToUnicode :: CodePage -> String -> IO String
    stringToUnicode _cp "" = return ""
         -- MultiByteToWideChar doesn't handle empty strings (#1929)

    stringToUnicode cp mbstr =
      withCAStringLen mbstr $ \(cstr,len) -> do
        wchars <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar
                    cp
                    0
                    cstr
                    (fromIntegral len)
                    nullPtr 0
        -- wchars is the length of buffer required

        allocaArray (fromIntegral wchars) $ \cwstr -> do
          wchars' <- failIfZero "MultiByteToWideChar" $ multiByteToWideChar
                    cp
                    0
                    cstr
                    (fromIntegral len)
                    cwstr wchars
          peekCWStringLen (cwstr,fromIntegral wchars')  -- converts UTF-16 to [Char]

    foreign import WINDOWS_CCONV unsafe "MultiByteToWideChar"
      multiByteToWideChar
            :: CodePage
            -> DWORD   -- dwFlags,

            -> LPCSTR  -- lpMultiByteStr

            -> CInt    -- cbMultiByte

            -> LPWSTR  -- lpWideCharStr

            -> CInt    -- cchWideChar

            -> IO CInt