Codebase list mozc / 5858072
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
2 changed file(s) with 39 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
2929
3030 MAJOR=2
3131 MINOR=23
32 BUILD=2813
32 BUILD=2814
3333 REVISION=102
3434 # This version represents the version of Mozc IME engine (converter, predictor,
3535 # etc.). This version info is included both in the Mozc server and in the Mozc
3030
3131 #ifdef OS_WIN
3232 #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
3969 #include <algorithm>
4070 #include <map>
4171 #include <set>
262292 } // namespace gui
263293 } // namespace mozc
264294
265 #else // OS_WIN && HAS_MSIME_HEADER
295 #else // OS_WIN
266296
267297 namespace mozc {
268298 namespace gui {
275305 } // namespace gui
276306 } // namespace mozc
277307
278 #endif // OS_WIN && HAS_MSIME_HEADER
308 #endif // OS_WIN