Support import from MS-IME user dictionary
With this CL, mozc_tool can import user dictionary from MS-IME when
running on Windows.
One tricky point is that NTDDI_VERSION needs to be NTDDI_WIN8 or
higher to use MSIME APIs/constants defined in <msime.h>. I believe
this is a bug in <msime.h>, but it seems that the only available
simple solution for us is to re-define NTDDI_VERSION (and _WIN32_WINNT
just in case) only while including <msime.h>.
Note that we can safely remove this hack once we stop supporting
Windows 7 and can bump _WIN32_WINNT to be WIN32_WINNT_WIN8 or higher.
REF_BUG=
REF_CL=186964780
REF_TIME=2018-02-26T11:37:53+09:00
REF_TIME_RAW=1519612673 +0900
Yohei Yukawa
6 years ago
29 | 29 |
|
30 | 30 |
MAJOR=2
|
31 | 31 |
MINOR=23
|
32 | |
BUILD=2813
|
|
32 |
BUILD=2814
|
33 | 33 |
REVISION=102
|
34 | 34 |
# This version represents the version of Mozc IME engine (converter, predictor,
|
35 | 35 |
# etc.). This version info is included both in the Mozc server and in the Mozc
|
30 | 30 |
|
31 | 31 |
#ifdef OS_WIN
|
32 | 32 |
#include <windows.h>
|
33 | |
#ifdef HAS_MSIME_HEADER
|
34 | |
#indlude <msime.h>
|
35 | |
#endif // HAS_MSIME_HEADER
|
36 | |
#endif // OS_WIN
|
37 | |
|
38 | |
#if defined(OS_WIN) && defined(HAS_MSIME_HEADER)
|
|
33 |
|
|
34 |
// In general, mixing different NTDDI_VERSION/_WIN32_WINNT values in a single
|
|
35 |
// executable file is not safe, but <msime.h> requires NTDDI_WIN8 to use COM
|
|
36 |
// interfaces and constants defined there, even though those APIs are available
|
|
37 |
// on older platforms such as Windows 7.
|
|
38 |
// To work around this limitation, here we intentionally re-define those macros.
|
|
39 |
// TODO(yukawa): Remove the following hack when we stop supporting Windows 7.
|
|
40 |
|
|
41 |
// Redefine NTDDI_VERSION with NTDDI_WIN8
|
|
42 |
#ifdef NTDDI_VERSION
|
|
43 |
#define MOZC_ORIGINAL_NTDDI_VERSION NTDDI_VERSION
|
|
44 |
#undef NTDDI_VERSION
|
|
45 |
#endif // NTDDI_VERSION
|
|
46 |
#define NTDDI_VERSION 0x06020000 // == NTDDI_WIN8
|
|
47 |
|
|
48 |
// Redefine _WIN32_WINNT with WIN32_WINNT_WIN8
|
|
49 |
#ifdef _WIN32_WINNT
|
|
50 |
#define MOZC_ORIGINAL_WIN32_WINNT _WIN32_WINNT
|
|
51 |
#undef _WIN32_WINNT
|
|
52 |
#endif // MOZC_ORIGINAL_WIN32_WINNT
|
|
53 |
#define _WIN32_WINNT 0x0602 // == WIN32_WINNT_WIN8
|
|
54 |
|
|
55 |
#include <msime.h>
|
|
56 |
|
|
57 |
// Restore NTDDI_VERSION
|
|
58 |
#ifdef MOZC_ORIGINAL_NTDDI_VERSION
|
|
59 |
#undef NTDDI_VERSION
|
|
60 |
#define NTDDI_VERSION MOZC_ORIGINAL_NTDDI_VERSION
|
|
61 |
#endif // MOZC_ORIGINAL_NTDDI_VERSION
|
|
62 |
|
|
63 |
// Restore _WIN32_WINNT
|
|
64 |
#ifdef MOZC_ORIGINAL_WIN32_WINNT
|
|
65 |
#undef _WIN32_WINNT
|
|
66 |
#define _WIN32_WINNT MOZC_ORIGINAL_WIN32_WINNT
|
|
67 |
#endif // MOZC_ORIGINAL_WIN32_WINNT
|
|
68 |
|
39 | 69 |
#include <algorithm>
|
40 | 70 |
#include <map>
|
41 | 71 |
#include <set>
|
|
262 | 292 |
} // namespace gui
|
263 | 293 |
} // namespace mozc
|
264 | 294 |
|
265 | |
#else // OS_WIN && HAS_MSIME_HEADER
|
|
295 |
#else // OS_WIN
|
266 | 296 |
|
267 | 297 |
namespace mozc {
|
268 | 298 |
namespace gui {
|
|
275 | 305 |
} // namespace gui
|
276 | 306 |
} // namespace mozc
|
277 | 307 |
|
278 | |
#endif // OS_WIN && HAS_MSIME_HEADER
|
|
308 |
#endif // OS_WIN
|