Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Interop.cs
Go to the documentation of this file.
3
4internal static class Interop
5{
6 internal enum BOOL
7 {
8 FALSE,
9 TRUE
10 }
11
12 internal static class Kernel32
13 {
14 [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
15 private struct CPINFOEXW
16 {
17 internal uint MaxCharSize;
18
19 internal unsafe fixed byte DefaultChar[2];
20
21 internal unsafe fixed byte LeadByte[12];
22
23 internal char UnicodeDefaultChar;
24
25 internal uint CodePage;
26
27 internal unsafe fixed char CodePageName[260];
28 }
29
30 [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
31 private unsafe static extern BOOL GetCPInfoExW(uint CodePage, uint dwFlags, CPINFOEXW* lpCPInfoEx);
32
33 internal unsafe static bool TryGetACPCodePage(out int codePage)
34 {
35 Unsafe.SkipInit(out CPINFOEXW cPINFOEXW);
36 if (GetCPInfoExW(0u, 0u, &cPINFOEXW) != 0)
37 {
38 codePage = (int)cPINFOEXW.CodePage;
39 return true;
40 }
41 codePage = 0;
42 return false;
43 }
44 }
45}
static unsafe bool TryGetACPCodePage(out int codePage)
Definition Interop.cs:33
static unsafe BOOL GetCPInfoExW(uint CodePage, uint dwFlags, CPINFOEXW *lpCPInfoEx)
unsafe fixed char CodePageName[260]
Definition Interop.cs:22
unsafe fixed byte LeadByte[12]
Definition Interop.cs:16
unsafe fixed byte DefaultChar[2]
Definition Interop.cs:14