9fc006420932a0e867bdf273b3bce7bf89298db4
[reactos.git] / rosapps / applications / devutils / nls2txt / precomp.h
1 /*
2 * PROJECT: ReactOS NLS to TXT Converter
3 * LICENSE: GNU General Public License Version 2.0 or any later version
4 * FILE: devutils/nls2txt/precomp.h
5 * COPYRIGHT: Copyright 2016 Dmitry Chapyshev <dmitry@reactos.org>
6 */
7
8 #ifndef __PRECOMP_H
9 #define __PRECOMP_H
10
11 #include <windows.h>
12 #include <windowsx.h>
13 #include <commctrl.h>
14 #include <strsafe.h>
15
16 #define MAX_STR_LEN 256
17
18 #define MAXIMUM_LEADBYTES 12
19
20 typedef struct _NLS_FILE_HEADER
21 {
22 USHORT HeaderSize;
23 USHORT CodePage;
24 USHORT MaximumCharacterSize;
25 USHORT DefaultChar;
26 USHORT UniDefaultChar;
27 USHORT TransDefaultChar;
28 USHORT TransUniDefaultChar;
29 UCHAR LeadByte[MAXIMUM_LEADBYTES];
30 } NLS_FILE_HEADER, *PNLS_FILE_HEADER;
31
32 typedef struct _CPTABLEINFO
33 {
34 USHORT CodePage;
35 USHORT MaximumCharacterSize; /* 1 = SBCS, 2 = DBCS */
36 USHORT DefaultChar; /* Default MultiByte Character for the CP->Unicode conversion */
37 USHORT UniDefaultChar; /* Default Unicode Character for the CP->Unicode conversion */
38 USHORT TransDefaultChar; /* Default MultiByte Character for the Unicode->CP conversion */
39 USHORT TransUniDefaultChar; /* Default Unicode Character for the Unicode->CP conversion */
40 USHORT DBCSCodePage;
41 UCHAR LeadByte[MAXIMUM_LEADBYTES];
42 PUSHORT MultiByteTable; /* Table for CP->Unicode conversion */
43 PVOID WideCharTable; /* Table for Unicode->CP conversion */
44 PUSHORT DBCSRanges;
45 PUSHORT DBCSOffsets;
46 } CPTABLEINFO, *PCPTABLEINFO;
47
48 int WINAPI
49 GetUName(IN WORD wCharCode, OUT LPWSTR lpBuf);
50
51 /* nls.c */
52 PUSHORT
53 NLS_ReadFile(const WCHAR *pszFile, PCPTABLEINFO CodePageTable);
54
55 BOOL
56 NLS_IsDBCSCodePage(PCPTABLEINFO CodePageTable);
57
58 BOOL
59 NLS_IsGlyphTablePresent(PCPTABLEINFO CodePageTable);
60
61 BOOL
62 NLS_IsDefaultCharForMB(PCPTABLEINFO CodePageTable, UCHAR Char);
63
64 BOOL
65 NLS_IsDefaultCharForUnicode(PCPTABLEINFO CodePageTable, USHORT Char);
66
67 USHORT
68 NLS_RecordsCountForMBTable(PCPTABLEINFO CodePageTable);
69
70 USHORT
71 NLS_RecordsCountForUnicodeTable(PCPTABLEINFO CodePageTable);
72
73 USHORT
74 NLS_RecordsCountForGlyphTable(PCPTABLEINFO CodePageTable);
75
76 USHORT
77 NLS_RecordsCountForDBCSTable(PCPTABLEINFO CodePageTable, UCHAR LeadByte);
78
79 /* bestfit.c */
80 BOOL
81 BestFit_FromNLS(const WCHAR *pszNLSFile, const WCHAR *pszBestFitFile);
82
83 #endif