This file is indexed.

/usr/include/wine/windows/msctf.idl is in wine1.6-dev 1:1.6.2-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
/*
 * Copyright 2008 Aric Stewart, CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef DO_NO_IMPORTS
import "oaidl.idl";
import "comcat.idl";
import "textstor.idl";
import "ctfutb.idl";
#endif
cpp_quote("#include <winuser.h>")

cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)")
cpp_quote("#define TF_E_DISCONNECTED    MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)")
cpp_quote("#define TF_E_ALREADY_EXISTS  MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0506)")
cpp_quote("#define TF_E_NOLOCK          MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0201)")

cpp_quote("HRESULT WINAPI SetInputScope(HWND hwnd, INT inputscope);")
cpp_quote("HRESULT WINAPI SetInputScopes(HWND hwnd, const INT *pInputScopes, UINT cInputScopes, WCHAR **ppszPhraseList, UINT cPhrases, WCHAR *pszRegExp, WCHAR *pszSRGS);")
cpp_quote("HRESULT WINAPI TF_CreateThreadMgr(ITfThreadMgr **pptim);")
cpp_quote("HRESULT WINAPI TF_GetThreadMgr(ITfThreadMgr **pptim);")
cpp_quote("HRESULT WINAPI TF_CreateInputProcessorProfiles(ITfInputProcessorProfiles **ppipr);")
cpp_quote("HRESULT WINAPI TF_CreateLangBarMgr(ITfLangBarMgr **pppbm);")
cpp_quote("HRESULT WINAPI TF_CreateLangBarItemMgr(ITfLangBarItemMgr **pplbim);")
cpp_quote("HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(void);")

cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;")
cpp_quote("DEFINE_GUID(GUID_PROP_ATTRIBUTE,0x34b45670,0x7526,0x11d2,0xa1,0x47,0x00,0x10,0x5a,0x27,0x99,0xb5);")
cpp_quote("EXTERN_C const GUID GUID_PROP_LANGID;")
cpp_quote("EXTERN_C const GUID GUID_PROP_READING;")
cpp_quote("EXTERN_C const GUID GUID_PROP_COMPOSING;")

cpp_quote("EXTERN_C const CLSID CLSID_TF_ThreadMgr;")
cpp_quote("EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles;")
cpp_quote("EXTERN_C const CLSID CLSID_TF_LangBarMgr;")
cpp_quote("EXTERN_C const CLSID CLSID_TF_CategoryMgr;")
cpp_quote("EXTERN_C const CLSID CLSID_TF_DisplayAttributeMgr;")

/* GUIDs for Compartments */
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_DISABLED;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_KEYBOARD_OPENCLOSE;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_HANDWRITING_OPENCLOSE;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_DISABLED;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_OPENCLOSE;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_GLOBALSTATE;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_PERSISTMENUENABLED;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_EMPTYCONTEXT;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_TIPUISTATUS;")

/* GUIDs for Categories */
cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD;")
cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH;")
cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING;")
cpp_quote("EXTERN_C const GUID GUID_TFCAT_DISPLAYATTRIBUTEPROVIDER;")

typedef [uuid(7213778c-7bb0-4270-b050-6189ee594e97)]  DWORD TfEditCookie;
typedef [uuid(de403c21-89fd-4f85-8b87-64584d063fbc)] DWORD TfClientId;
typedef [uuid(88a9c478-f3ec-4763-8345-cd9250443f8d)] DWORD TfGuidAtom;

cpp_quote("#define TF_MOD_ALT                   0x0001")
cpp_quote("#define TF_MOD_CONTROL               0x0002")
cpp_quote("#define TF_MOD_SHIFT                 0x0004")
cpp_quote("#define TF_MOD_RALT                  0x0008")
cpp_quote("#define TF_MOD_RCONTROL              0x0010")
cpp_quote("#define TF_MOD_RSHIFT                0x0020")
cpp_quote("#define TF_MOD_LALT                  0x0040")
cpp_quote("#define TF_MOD_LCONTROL              0x0080")
cpp_quote("#define TF_MOD_LSHIFT                0x0100")
cpp_quote("#define TF_MOD_ON_KEYUP              0x0200")
cpp_quote("#define TF_MOD_IGNORE_ALL_MODIFIER   0x0400")

cpp_quote("#define TF_PROFILETYPE_INPUTPROCESSOR  0x0001")
cpp_quote("#define TF_PROFILETYPE_KEYBOARDLAYOUT  0x0002")

interface ITfDocumentMgr;
interface ITfContext;
interface IEnumTfDocumentMgrs;
interface IEnumTfContexts;
interface ITfFunctionProvider;
interface IEnumTfFunctionProviders;
interface ITfCompartmentMgr;
interface ITfEditSession;
interface ITfRange;
interface ITfContextView;
interface IEnumTfContextViews;
interface ITfProperty;
interface ITfReadOnlyProperty;
interface IEnumTfProperties;
interface ITfRangeBackup;
interface IEnumTfLanguageProfiles;
interface ITfEditRecord;
interface ITfCompositionView;
interface ITfKeyEventSink;

cpp_quote("#if 0")
typedef [uuid(4f5d560f-5ab5-4dde-8c4d-404592857ab0)] UINT_PTR HKL;
cpp_quote("#endif")

typedef [uuid(e26d9e1d-691e-4f29-90d7-338dcf1f8cef)] struct TF_PERSISTENT_PROPERTY_HEADER_ACP
{
    GUID guidType;
    LONG ichStart;
    LONG cch;
    ULONG cb;
    DWORD dwPrivate;
    CLSID clsidTIP;
} TF_PERSISTENT_PROPERTY_HEADER_ACP;

typedef [uuid(e1b5808d-1e46-4c19-84dc-68c5f5978cc8)] struct TF_LANGUAGEPROFILE
{
    CLSID clsid;
    LANGID langid;
    GUID catid;
    BOOL fActive;
    GUID guidProfile;
} TF_LANGUAGEPROFILE;

typedef [uuid(77c12f95-b783-450d-879f-1cd2362c6521)] struct TF_PRESERVEDKEY
{
    UINT uVKey;
    UINT uModifiers;
} TF_PRESERVEDKEY;

typedef [uuid(5a886226-ae9a-489b-b991-2b1e25ee59a9)]  enum { TF_ANCHOR_START = 0, TF_ANCHOR_END = 1 } TfAnchor;

[
    object,
    uuid(aa80e801-2021-11d2-93e0-0060b067b86e),
    pointer_default(unique)
]
interface ITfThreadMgr: IUnknown
{
    HRESULT Activate(
        [out] TfClientId *ptid);

    HRESULT Deactivate();

    HRESULT CreateDocumentMgr(
        [out] ITfDocumentMgr **ppdim);

    HRESULT EnumDocumentMgrs(
        [out] IEnumTfDocumentMgrs **ppEnum);

    HRESULT GetFocus(
        [out] ITfDocumentMgr **ppdimFocus);

    HRESULT SetFocus(
        [in] ITfDocumentMgr *pdimFocus);

    HRESULT AssociateFocus(
        [in] HWND hwnd,
        [in, unique] ITfDocumentMgr *pdimNew,
        [out] ITfDocumentMgr **ppdimPrev);

    HRESULT IsThreadFocus(
        [out] BOOL *pfThreadFocus);

    HRESULT GetFunctionProvider(
        [in] REFCLSID clsid,
        [out] ITfFunctionProvider **ppFuncProv);

    HRESULT EnumFunctionProviders(
        [out] IEnumTfFunctionProviders **ppEnum);

    HRESULT GetGlobalCompartment(
        [out] ITfCompartmentMgr **ppCompMgr);
};

[
    object,
    uuid(d7540241-f9a1-4364-befc-dbcd2c4395b7),
    pointer_default(unique)
]
interface ITfCompositionView : IUnknown
{
    HRESULT GetOwnerClsid([out] CLSID *pclsid);

    HRESULT GetRange([out] ITfRange **ppRange);
}

[
    object,
    uuid(aa80e7f4-2021-11d2-93e0-0060b067b86e),
    pointer_default(unique)
]
interface ITfDocumentMgr: IUnknown
{
    HRESULT CreateContext(
        [in] TfClientId tidOwner,
        [in] DWORD dwFlags,
        [in, unique] IUnknown *punk,
        [out] ITfContext **ppic,
        [out] TfEditCookie *pecTextStore);

    HRESULT Push(
        [in] ITfContext *pic);

    const DWORD TF_POPF_ALL = 0x0001;

    HRESULT Pop(
        [in] DWORD dwFlags);

    HRESULT GetTop(
        [out] ITfContext **ppic);

    HRESULT GetBase(
        [out] ITfContext **ppic);

    HRESULT EnumContexts(
        [out] IEnumTfContexts **ppEnum);
};

[
    object,
    uuid(aa80e7fd-2021-11d2-93e0-0060b067b86e),
    pointer_default(unique)
]
interface ITfContext : IUnknown
{
    const DWORD TF_ES_ASYNCDONTCARE = 0x0;
    const DWORD TF_ES_SYNC          = 0x1;
    const DWORD TF_ES_READ          = 0x2;
    const DWORD TF_ES_READWRITE     = 0x6;
    const DWORD TF_ES_ASYNC         = 0x8;

    HRESULT RequestEditSession(
        [in] TfClientId tid,
        [in] ITfEditSession *pes,
        [in] DWORD dwFlags,
        [out] HRESULT *phrSession);

    HRESULT InWriteSession(
        [in] TfClientId tid,
        [out] BOOL *pfWriteSession);

    typedef [uuid(1690be9b-d3e9-49f6-8d8b-51b905af4c43)] enum { TF_AE_NONE, TF_AE_START, TF_AE_END } TfActiveSelEnd;

    typedef [uuid(36ae42a4-6989-4bdc-b48a-6137b7bf2e42)] struct TF_SELECTIONSTYLE
    {
        TfActiveSelEnd ase;
        BOOL fInterimChar;
    } TF_SELECTIONSTYLE;

    typedef [uuid(75eb22f2-b0bf-46a8-8006-975a3b6efcf1)] struct TF_SELECTION
    {
        ITfRange *range;
        TF_SELECTIONSTYLE style;
    } TF_SELECTION;

    const ULONG TF_DEFAULT_SELECTION =  TS_DEFAULT_SELECTION;

    HRESULT GetSelection(
        [in] TfEditCookie ec,
        [in] ULONG ulIndex,
        [in] ULONG ulCount,
        [out, size_is(ulCount), length_is(*pcFetched)] TF_SELECTION *pSelection,
        [out] ULONG *pcFetched);

    HRESULT SetSelection(
        [in] TfEditCookie ec,
        [in] ULONG ulCount,
        [in, size_is(ulCount)] const TF_SELECTION *pSelection);

    HRESULT GetStart(
        [in] TfEditCookie ec,
        [out] ITfRange **ppStart);

    HRESULT GetEnd(
        [in] TfEditCookie ec,
        [out] ITfRange **ppEnd);

    typedef [uuid(bc7d979a-846a-444d-afef-0a9bfa82b961)] TS_STATUS TF_STATUS;
    const DWORD TF_SD_READONLY    = TS_SD_READONLY;
    const DWORD TF_SD_LOADING     = TS_SD_LOADING;
    const DWORD TF_SS_DISJOINTSEL = TS_SS_DISJOINTSEL;
    const DWORD TF_SS_REGIONS     = TS_SS_REGIONS;
    const DWORD TF_SS_TRANSITORY  = TS_SS_TRANSITORY;


    HRESULT GetActiveView(
        [out] ITfContextView **ppView);

    HRESULT EnumViews(
        [out] IEnumTfContextViews **ppEnum);

    HRESULT GetStatus(
        [out] TF_STATUS *pdcs);

    HRESULT GetProperty(
        [in] REFGUID guidProp,
        [out] ITfProperty **ppProp);

    HRESULT GetAppProperty(
        [in] REFGUID guidProp,
        [out] ITfReadOnlyProperty **ppProp);

    HRESULT TrackProperties(
        [in, size_is(cProp)] const GUID **prgProp,
        [in] ULONG cProp,
        [in, size_is(cAppProp)] const GUID **prgAppProp,
        [in] ULONG cAppProp,
        [out] ITfReadOnlyProperty **ppProperty);

    HRESULT EnumProperties(
        [out] IEnumTfProperties **ppEnum);

    HRESULT GetDocumentMgr(
        [out] ITfDocumentMgr **ppDm);

    HRESULT CreateRangeBackup(
        [in] TfEditCookie ec,
        [in] ITfRange *pRange,
        [out] ITfRangeBackup **ppBackup);

};

[
  object,
  uuid(4ea48a35-60ae-446f-8fd6-e6a8d82459f7),
  pointer_default(unique)
]
interface ITfSource : IUnknown
{
    HRESULT AdviseSink(
        [in] REFIID riid,
        [in, iid_is(riid)] IUnknown *punk,
        [out] DWORD *pdwCookie);

    HRESULT UnadviseSink(
        [in] DWORD dwCookie);
};

[
  object,
  local,
  uuid(1F02B6C5-7842-4EE6-8A0B-9A24183A95CA),
  pointer_default(unique)
]
interface ITfInputProcessorProfiles : IUnknown
{
    HRESULT Register(
        [in] REFCLSID rclsid);

    HRESULT Unregister(
        [in] REFCLSID rclsid);

    HRESULT AddLanguageProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in, size_is(cchDesc)] const WCHAR *pchDesc,
        [in] ULONG cchDesc,
        [in, size_is(cchFile)] const WCHAR *pchIconFile,
        [in] ULONG cchFile,
        [in] ULONG uIconIndex);

    HRESULT RemoveLanguageProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile);

    HRESULT EnumInputProcessorInfo(
        [out] IEnumGUID **ppEnum);

    HRESULT GetDefaultLanguageProfile(
        [in] LANGID langid,
        [in] REFGUID catid,
        [out] CLSID *pclsid,
        [out] GUID *pguidProfile);

    HRESULT SetDefaultLanguageProfile(
        [in] LANGID langid,
        [in] REFCLSID rclsid,
        [in] REFGUID guidProfiles);

    HRESULT ActivateLanguageProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfiles);

    HRESULT GetActiveLanguageProfile(
        [in] REFCLSID rclsid,
        [out] LANGID *plangid,
        [out] GUID *pguidProfile);

    HRESULT GetLanguageProfileDescription(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [out] BSTR *pbstrProfile);

    HRESULT GetCurrentLanguage(
        [out] LANGID *plangid);

    HRESULT ChangeCurrentLanguage(
        [in] LANGID langid);

    HRESULT GetLanguageList(
        [out] LANGID **ppLangId,
        [out] ULONG *pulCount);

    HRESULT EnumLanguageProfiles(
        [in] LANGID langid,
        [out] IEnumTfLanguageProfiles **ppEnum);

    HRESULT EnableLanguageProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in] BOOL fEnable);

    HRESULT IsEnabledLanguageProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [out] BOOL *pfEnable);

    HRESULT EnableLanguageProfileByDefault(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in] BOOL fEnable);

    HRESULT SubstituteKeyboardLayout(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in] HKL hKL);
};

typedef [uuid(44d2825a-10e5-43b2-877f-6cb2f43b7e7e)]
struct TF_INPUTPROCESSORPROFILE {
    DWORD dwProfileType;
    LANGID langid;
    CLSID clsid;
    GUID guidProfile;
    GUID catid;
    HKL hklSubstitute;
    DWORD dwCaps;
    HKL hkl;
    DWORD dwFlags;
} TF_INPUTPROCESSORPROFILE;

[
    object,
    uuid(71c6e74d-0f28-11d8-a82a-00065b84435c),
    pointer_default(unique)
]
interface IEnumTfInputProcessorProfiles : IUnknown
{
    HRESULT Clone(
        [out] IEnumTfInputProcessorProfiles **ppEnum);

    HRESULT Next(
        [in] ULONG ulCount,
        [out, size_is(ulCount), length_is(*pcFetch)] TF_INPUTPROCESSORPROFILE *pProfile,
        [out] ULONG *pcFetch);

    HRESULT Reset();

    HRESULT Skip(
        [in] ULONG ulCount);
}

[
    object,
    uuid(71c6e74c-0f28-11d8-a82a-00065b84435c),
    pointer_default(unique)
]
interface ITfInputProcessorProfileMgr : IUnknown
{
    HRESULT ActivateProfile(
        [in] DWORD dwProfileType,
        [in] LANGID langid,
        [in] REFCLSID clsid,
        [in] REFGUID guidProfile,
        [in] HKL hkl,
        [in] DWORD dwFlags);

    HRESULT DeactivateProfile(
        [in] DWORD dwProfileType,
        [in] LANGID langid,
        [in] REFCLSID clsid,
        [in] REFGUID guidProfile,
        [in] HKL hkl,
        [in] DWORD dwFlags);

    HRESULT GetProfile(
        [in] DWORD dwProfileType,
        [in] LANGID langid,
        [in] REFCLSID clsid,
        [in] REFGUID guidProfile,
        [in] HKL hkl,
        [out] TF_INPUTPROCESSORPROFILE *pProfile);


    HRESULT EnumProfiles(
        [in] LANGID langid,
        [out] IEnumTfInputProcessorProfiles **ppEnum);

    HRESULT ReleaseInputProcessor(
        [in] REFCLSID rclsid,
        [in] DWORD dwFlags);

    HRESULT RegisterProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in, size_is(cchDesc)] const WCHAR *pchDesc,
        [in] ULONG cchDesc,
        [in, size_is(cchFile)] const WCHAR *pchIconFile,
        [in] ULONG cchFile,
        [in] ULONG uIconIndex,
        [in] HKL hklsubstitute,
        [in] DWORD dwPreferredLayout,
        [in] BOOL bEnabledByDefault,
        [in] DWORD dwFlags);

    HRESULT UnregisterProfile(
        [in] REFCLSID rclsid,
        [in] LANGID langid,
        [in] REFGUID guidProfile,
        [in] DWORD dwFlags);

    HRESULT GetActiveProfile(
        [in] REFGUID catid,
        [out] TF_INPUTPROCESSORPROFILE *pProfile);
}

typedef [uuid(c4cc07f1-80cc-4a7b-bc54-98512782cbe3)]
enum {
    TF_LS_NONE      = 0,
    TF_LS_SOLID     = 1,
    TF_LS_DOT       = 2,
    TF_LS_DASH      = 3,
    TF_LS_SQUIGGLE  = 4
} TF_DA_LINESTYLE;

typedef [uuid(d9b92e21-084a-401b-9c64-1e6dad91a1ab)]
enum {
    TF_CT_NONE      = 0,
    TF_CT_SYSCOLOR  = 1,
    TF_CT_COLORREF  = 2
} TF_DA_COLORTYPE;

typedef [uuid(90d0cb5e-6520-4a0f-b47c-c39bd955f0d6)]
struct TF_DA_COLOR {
    TF_DA_COLORTYPE type;
    [switch_type(TF_DA_COLORTYPE), switch_is(type)]
    union {
        [case(TF_CT_SYSCOLOR)] int nIndex;
        [case(TF_CT_COLORREF)] COLORREF cr;
    };
} TF_DA_COLOR;

typedef [uuid(33d2fe4b-6c24-4f67-8d75-3bc1819e4126)]
enum {
    TF_ATTR_INPUT                = 0,
    TF_ATTR_TARGET_CONVERTED     = 1,
    TF_ATTR_CONVERTED            = 2,
    TF_ATTR_TARGET_NOTCONVERTED  = 3,
    TF_ATTR_INPUT_ERROR          = 4,
    TF_ATTR_FIXEDCONVERTED       = 5,
    TF_ATTR_OTHER                = -1
} TF_DA_ATTR_INFO;

typedef [uuid(1bf1c305-419b-4182-a4d2-9bfadc3f021f)]
struct TF_DISPLAYATTRIBUTE {
    TF_DA_COLOR      crText;
    TF_DA_COLOR      crBk;
    TF_DA_LINESTYLE  lsStyle;
    BOOL             fBoldLine;
    TF_DA_COLOR      crLine;
    TF_DA_ATTR_INFO  bAttr;
} TF_DISPLAYATTRIBUTE;

[
    object,
    uuid(70528852-2f26-4aea-8c96-215150578932),
    pointer_default(unique)
]
interface ITfDisplayAttributeInfo : IUnknown
{
    HRESULT GetGUID([out] GUID *pguid);

    HRESULT GetDescription([out] BSTR *pbstrDesc);

    HRESULT GetAttributeInfo([out] TF_DISPLAYATTRIBUTE *pda);

    HRESULT SetAttributeInfo([in] const TF_DISPLAYATTRIBUTE *pda);

    HRESULT Reset();
}

[
    object,
    uuid(7cef04d7-cb75-4e80-a7ab-5f5bc7d332de),
    pointer_default(unique)
]
interface IEnumTfDisplayAttributeInfo : IUnknown
{
    HRESULT Clone([out] IEnumTfDisplayAttributeInfo **ppEnum);

    HRESULT Next(
            [in] ULONG ulCount,
            [out, size_is(ulCount), length_is(*pcFetched)] ITfDisplayAttributeInfo **rgInfo,
            [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip([in] ULONG ulCount);
}

[
    object,
    local,
    uuid(8ded7393-5db1-475c-9e71-a39111b0ff67),
    pointer_default(unique)
]
interface ITfDisplayAttributeMgr : IUnknown
{
    HRESULT OnUpdateInfo();

    HRESULT EnumDisplayAttributeInfo([out] IEnumTfDisplayAttributeInfo **ppEnum);

    HRESULT GetDisplayAttributeInfo(
            [in] REFGUID guid,
            [out] ITfDisplayAttributeInfo **ppInfo,
            [out] CLSID *pclsidOwner);

}

[
  object,
  local,
  uuid(c3acefb5-f69d-4905-938f-fcadcf4be830),
  pointer_default(unique)
]
interface ITfCategoryMgr : IUnknown
{
    HRESULT RegisterCategory([in] REFCLSID rclsid,
                             [in] REFGUID rcatid,
                             [in] REFGUID rguid);

    HRESULT UnregisterCategory([in] REFCLSID rclsid,
                               [in] REFGUID rcatid,
                               [in] REFGUID rguid);

    HRESULT EnumCategoriesInItem([in] REFGUID rguid,
                                 [out] IEnumGUID **ppEnum);

    HRESULT EnumItemsInCategory([in] REFGUID rcatid,
                                [out] IEnumGUID **ppEnum);

    HRESULT FindClosestCategory([in] REFGUID rguid,
                                [out] GUID *pcatid,
                                [in, size_is(ulCount)] const GUID **ppcatidList,
                                [in] ULONG ulCount);

    HRESULT RegisterGUIDDescription([in] REFCLSID rclsid,
                                    [in] REFGUID rguid,
                                    [in, size_is(cch)] const WCHAR *pchDesc,
                                    [in] ULONG cch);

    HRESULT UnregisterGUIDDescription([in] REFCLSID rclsid,
                                      [in] REFGUID rguid);

    HRESULT GetGUIDDescription([in] REFGUID rguid,
                               [out] BSTR *pbstrDesc);

    HRESULT RegisterGUIDDWORD([in] REFCLSID rclsid,
                              [in] REFGUID rguid,
                              [in] DWORD dw);

    HRESULT UnregisterGUIDDWORD([in] REFCLSID rclsid,
                                [in] REFGUID rguid);

    HRESULT GetGUIDDWORD([in] REFGUID rguid,
                         [out] DWORD *pdw);

    HRESULT RegisterGUID([in] REFGUID rguid,
                         [out] TfGuidAtom *pguidatom);

    HRESULT GetGUID([in] TfGuidAtom guidatom,
                    [out] GUID *pguid);

    HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom,
                              [in] REFGUID rguid,
                              [out] BOOL *pfEqual);
};

[
  object,
  uuid(8127d409-ccd3-4683-967a-b43d5b482bf7),
  pointer_default(unique)
]
interface ITfTextEditSink : IUnknown
{
    HRESULT OnEndEdit(
        [in] ITfContext *pic,
        [in] TfEditCookie ecReadOnly,
        [in] ITfEditRecord *pEditRecord);
};

[
    object,
    uuid(5F20AA40-B57A-4F34-96AB-3576F377CC79),
    pointer_default(unique)
]
interface ITfContextOwnerCompositionSink : IUnknown
{
    HRESULT OnStartComposition(
        [in] ITfCompositionView *pComposition,
        [out] BOOL *pfOk);

    HRESULT OnUpdateComposition(
        [in] ITfCompositionView *pComposition,
        [in] ITfRange *pRangeNew);

    HRESULT OnEndComposition(
        [in] ITfCompositionView *pComposition);
};

[
  object,
  uuid(3d61bf11-ac5f-42c8-a4cb-931bcc28c744),
  pointer_default(unique)
]
interface IEnumTfLanguageProfiles : IUnknown
{
    HRESULT Clone(
        [out] IEnumTfLanguageProfiles **ppEnum);

    HRESULT Next(
        [in] ULONG ulCount,
        [out, size_is(ulCount), length_is(*pcFetch)] TF_LANGUAGEPROFILE *pProfile,
        [out] ULONG *pcFetch);

    HRESULT Reset();

    HRESULT Skip(
        [in] ULONG ulCount);
};

[
  object,
  local,
  uuid(aa80e7f7-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfTextInputProcessor : IUnknown
{
    HRESULT Activate(
        [in] ITfThreadMgr *ptim,
        [in] TfClientId tid);

    HRESULT Deactivate();
};

[
  object,
  uuid(aa80e80e-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfThreadMgrEventSink : IUnknown
{
    HRESULT OnInitDocumentMgr(
        [in] ITfDocumentMgr *pdim);

    HRESULT OnUninitDocumentMgr(
        [in] ITfDocumentMgr *pdim);

    HRESULT OnSetFocus(
        [in] ITfDocumentMgr *pdimFocus,
        [in] ITfDocumentMgr *pdimPrevFocus);

    HRESULT OnPushContext(
        [in] ITfContext *pic);

    HRESULT OnPopContext(
        [in] ITfContext *pic);
};

[
  object,
  local,
  uuid(aa80e7f0-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfKeystrokeMgr : IUnknown
{
    HRESULT AdviseKeyEventSink(
        [in] TfClientId tid,
        [in] ITfKeyEventSink *pSink,
        [in] BOOL fForeground);

    HRESULT UnadviseKeyEventSink(
        [in] TfClientId tid);

    HRESULT GetForeground(
        [out] CLSID *pclsid);

    HRESULT TestKeyDown(
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT TestKeyUp(
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT KeyDown(
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT KeyUp(
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT GetPreservedKey(
        [in] ITfContext *pic,
        [in] const TF_PRESERVEDKEY *pprekey,
        [out] GUID *pguid);

    HRESULT IsPreservedKey(
        [in] REFGUID rguid,
        [in] const TF_PRESERVEDKEY *pprekey,
        [out] BOOL *pfRegistered);

    HRESULT PreserveKey(
        [in] TfClientId tid,
        [in] REFGUID rguid,
        [in] const TF_PRESERVEDKEY *prekey,
        [in, size_is(cchDesc)] const WCHAR *pchDesc,
        [in] ULONG cchDesc);

    HRESULT UnpreserveKey(
        [in] REFGUID rguid,
        [in] const TF_PRESERVEDKEY *pprekey);

    HRESULT SetPreservedKeyDescription(
        [in] REFGUID rguid,
        [in, size_is(cchDesc)] const WCHAR *pchDesc,
        [in] ULONG cchDesc);

    HRESULT GetPreservedKeyDescription(
        [in] REFGUID rguid,
        [out] BSTR *pbstrDesc);

    HRESULT SimulatePreservedKey(
        [in] ITfContext *pic,
        [in] REFGUID rguid,
        [out] BOOL *pfEaten);
};

[
  object,
  local,
  uuid(aa80e7f5-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfKeyEventSink : IUnknown
{
    HRESULT OnSetFocus(
        [in] BOOL fForeground);

    HRESULT OnTestKeyDown(
        [in] ITfContext *pic,
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT OnTestKeyUp(
        [in] ITfContext *pic,
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT OnKeyDown(
        [in] ITfContext *pic,
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT OnKeyUp(
        [in] ITfContext *pic,
        [in] WPARAM wParam,
        [in] LPARAM lParam,
        [out] BOOL *pfEaten);

    HRESULT OnPreservedKey(
        [in] ITfContext *pic,
        [in] REFGUID rguid,
        [out] BOOL *pfEaten);
};

[
  object,
  local,
  uuid(8f1b8ad8-0b6b-4874-90c5-bd76011e8f7c),
  pointer_default(unique)
]
interface ITfMessagePump : IUnknown
{
    HRESULT PeekMessageA(
        [out] LPMSG pMsg,
        [in] HWND hwnd,
        [in] UINT wMsgFilterMin,
        [in] UINT wMsgFilterMax,
        [in] UINT wRemoveMsg,
        [out] BOOL *pfResult);

    HRESULT GetMessageA(
        [out] LPMSG pMsg,
        [in] HWND hwnd,
        [in] UINT wMsgFilterMin,
        [in] UINT wMsgFilterMax,
        [out] BOOL *pfResult);

    HRESULT PeekMessageW(
        [out] LPMSG pMsg,
        [in] HWND hwnd,
        [in] UINT wMsgFilterMin,
        [in] UINT wMsgFilterMax,
        [in] UINT wRemoveMsg,
        [out] BOOL *pfResult);

    HRESULT GetMessageW(
        [out] LPMSG pMsg,
        [in] HWND hwnd,
        [in] UINT wMsgFilterMin,
        [in] UINT wMsgFilterMax,
        [out] BOOL *pfResult);
};

[
  object,
  local,
  uuid(d60a7b49-1b9f-4be2-b702-47e9dc05dec3),
  pointer_default(unique)
]
interface ITfClientId : IUnknown
{
    HRESULT GetClientId(
        [in] REFCLSID rclsid,
        [out] TfClientId *ptid);
};

[
  object,
  uuid(43c9fe15-f494-4c17-9de2-b8a4ac350aa8),
  pointer_default(unique)
]
interface ITfLanguageProfileNotifySink : IUnknown
{
    HRESULT OnLanguageChange(
        [in] LANGID langid,
        [out] BOOL *pfAccept);

    HRESULT OnLanguageChanged();
}

[
  object,
  uuid(aa80e803-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfEditSession : IUnknown
{
    HRESULT DoEditSession(
        [in] TfEditCookie ec);
}

[
  object,
  uuid(aa80e7ff-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface ITfRange : IUnknown
{
    const WCHAR TF_CHAR_EMBEDDED     = TS_CHAR_EMBEDDED;

    typedef [uuid(cf610f06-2882-46f6-abe5-298568b664c4)] enum { TF_GRAVITY_BACKWARD = 0, TF_GRAVITY_FORWARD = 1 } TfGravity;

    typedef [uuid(1e512533-bbdc-4530-9a8e-a1dc0af67468)] enum { TF_SD_BACKWARD = 0, TF_SD_FORWARD = 1 } TfShiftDir;

    const DWORD TF_HF_OBJECT         = 1;
    const DWORD TF_TF_MOVESTART      = 1;
    const DWORD TF_TF_IGNOREEND      = 2;
    const DWORD TF_ST_CORRECTION     = 1;
    const DWORD TF_IE_CORRECTION     = 1;

    typedef [uuid(49930d51-7d93-448c-a48c-fea5dac192b1)] struct  TF_HALTCOND
    {
        ITfRange *pHaltRange;
        TfAnchor aHaltPos;
        DWORD dwFlags;
    } TF_HALTCOND;

    HRESULT GetText(
        [in] TfEditCookie ec,
        [in] DWORD dwFlags,
        [out, size_is(cchMax), length_is(*pcch)] WCHAR *pchText,
        [in] ULONG cchMax,
        [out] ULONG *pcch);

    HRESULT SetText(
        [in] TfEditCookie ec,
        [in] DWORD dwFlags,
        [in, size_is(cch), unique] const WCHAR *pchText,
        [in] LONG cch);

    HRESULT GetFormattedText(
        [in] TfEditCookie ec,
        [out] IDataObject **ppDataObject);

    HRESULT GetEmbedded(
        [in] TfEditCookie ec,
        [in] REFGUID rguidService,
        [in] REFIID riid,
        [out, iid_is(riid)] IUnknown **ppunk);

    HRESULT InsertEmbedded(
        [in] TfEditCookie ec,
        [in] DWORD dwFlags,
        [in] IDataObject *pDataObject);

    HRESULT ShiftStart(
        [in] TfEditCookie ec,
        [in] LONG cchReq,
        [out] LONG *pcch,
        [in, unique] const TF_HALTCOND *pHalt);

    HRESULT ShiftEnd(
        [in] TfEditCookie ec,
        [in] LONG cchReq,
        [out] LONG *pcch,
        [in, unique] const TF_HALTCOND *pHalt);

    HRESULT ShiftStartToRange(
        [in] TfEditCookie ec,
        [in] ITfRange *pRange,
        [in] TfAnchor aPos);

    HRESULT ShiftEndToRange(
        [in] TfEditCookie ec,
        [in] ITfRange *pRange,
        [in] TfAnchor aPos);

    HRESULT ShiftStartRegion(
        [in] TfEditCookie ec,
        [in] TfShiftDir dir,
        [out] BOOL *pfNoRegion);

    HRESULT ShiftEndRegion(
        [in] TfEditCookie ec,
        [in] TfShiftDir dir,
        [out] BOOL *pfNoRegion);

    HRESULT IsEmpty(
        [in] TfEditCookie ec,
        [out] BOOL *pfEmpty);

    HRESULT Collapse(
        [in] TfEditCookie ec,
        [in] TfAnchor aPos);

    HRESULT IsEqualStart(
        [in] TfEditCookie ec,
        [in] ITfRange *pWith,
        [in] TfAnchor aPos,
        [out] BOOL *pfEqual);

    HRESULT IsEqualEnd(
        [in] TfEditCookie ec,
        [in] ITfRange *pWith,
        [in] TfAnchor aPos,
        [out] BOOL *pfEqual);

    HRESULT CompareStart(
        [in] TfEditCookie ec,
        [in] ITfRange *pWith,
        [in] TfAnchor aPos,
        [out] LONG *plResult);

    HRESULT CompareEnd(
        [in] TfEditCookie ec,
        [in] ITfRange *pWith,
        [in] TfAnchor aPos,
        [out] LONG *plResult);

    HRESULT AdjustForInsert(
        [in] TfEditCookie ec,
        [in] ULONG cchInsert,
        [out] BOOL *pfInsertOk);

    HRESULT GetGravity(
        [out] TfGravity *pgStart,
        [out] TfGravity *pgEnd);

    HRESULT SetGravity(
        [in] TfEditCookie ec,
        [in] TfGravity gStart,
        [in] TfGravity gEnd);

    HRESULT Clone(
        [out] ITfRange **ppClone);

    HRESULT GetContext(
        [out] ITfContext **ppContext);
};

[
    object,
    uuid(057a6296-029b-4154-b79a-0d461d4ea94c),
    pointer_default(unique)
]
interface ITfRangeACP : ITfRange
{
    HRESULT GetExtent([out] LONG *pacpAnchor,
                      [out] LONG *pcch);

    HRESULT SetExtent([in] LONG acpAnchor,
                      [in] LONG cch);
}

[
    object,
    uuid(55ce16ba-3014-41c1-9ceb-fade1446ac6c),
    pointer_default(unique)
]
interface ITfInsertAtSelection : IUnknown
{
    const DWORD TF_IAS_NOQUERY   = 0x1;
    const DWORD TF_IAS_QUERYONLY = 0x2;
    const DWORD TF_IAS_NO_DEFAULT_COMPOSITION = 0x80000000;

    HRESULT InsertTextAtSelection(
        [in] TfEditCookie ec,
        [in] DWORD dwFlags,
        [in, size_is(cch)] const WCHAR *pchText,
        [in] LONG cch,
        [out] ITfRange **ppRange);

    HRESULT InsertEmbeddedAtSelection(
        [in] TfEditCookie ec,
        [in] DWORD dwFlags,
        [in] IDataObject *pDataObject,
        [out] ITfRange **ppRange);
};

[
    object,
    uuid(6834b120-88cb-11d2-bf45-00105a2799b5),
    pointer_default(unique)
]
interface ITfPropertyStore : IUnknown
{
    const DWORD TF_TU_CORRECTION = 0x1;

    HRESULT GetType([out] GUID *pguid);

    HRESULT GetDataType([out] DWORD *pdwReserved);

    HRESULT GetData([out] VARIANT *pvarValue);

    HRESULT OnTextUpdated(
            [in] DWORD dwFlags,
            [in] ITfRange *pRangeNew,
            [out] BOOL *pfAccept);

    HRESULT Shrink(
            [in] ITfRange *pRangeNew,
            [out] BOOL *pfFree);

    HRESULT Divide(
            [in] ITfRange *pRangeThis,
            [in] ITfRange *pRangeNew,
            [out] ITfPropertyStore **ppPropStore);

    HRESULT Clone(
            [out] ITfPropertyStore **pPropStore);

    HRESULT GetPropertyRangeCreator(
            [out] CLSID *pclsid);

    HRESULT Serialize(
            [in] IStream *pStream,
            [out] ULONG *pcb);
}

[
    object,
    uuid(f99d3f40-8e32-11d2-bf46-00105a2799b5),
    pointer_default(unique)
]
interface IEnumTfRanges : IUnknown
{
    HRESULT Clone([out] IEnumTfRanges **ppEnum);

    HRESULT Next(
            [in] ULONG ulCount,
            [out, size_is(ulCount), length_is(*pcFetched)] ITfRange **ppRange,
            [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip(ULONG ulCount);
}

[
    object,
    uuid(5efd22Ba-7838-46cb-88e2-cadb14124f8f),
    pointer_default(unique)
]
interface IEnumITfCompositionView : IUnknown
{
    HRESULT Clone([out] IEnumITfCompositionView **ppEnum);

    HRESULT Next(
            [in] ULONG ulCount,
            [out, size_is(ulCount), length_is(*pcFetched)] ITfCompositionView **rgCompositionView,
            [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip([in] ULONG ulCount);
}

[
    object,
    uuid(20168d64-5a8f-4a5a-b7bd-cfa29f4D0fd9),
    pointer_default(unique)
]
interface ITfComposition : IUnknown
{
    HRESULT GetRange([out] ITfRange **ppRange);

    HRESULT ShiftStart(
            [in] TfEditCookie ecWrite,
            [in] ITfRange *pNewStart);

    HRESULT ShiftEnd(
            [in] TfEditCookie ecWrite,
            [in] ITfRange *pNewEnd);

    HRESULT EndComposition([in] TfEditCookie ecWrite);
}

[
    object,
    uuid(a781718c-579a-4b15-a280-32b8577acc5e),
    pointer_default(unique)
]
interface ITfCompositionSink : IUnknown
{
    HRESULT OnCompositionTerminated(
            [in] TfEditCookie ecWrite,
            [in] ITfComposition *pComposition);
}

[
    object,
    uuid(d40C8aae-aC92-4fc7-9a11-0ee0e23aa39b),
    pointer_default(unique)
]
interface ITfContextComposition : IUnknown
{
    HRESULT StartComposition(
            [in] TfEditCookie ecWrite,
            [in] ITfRange *pCompositionRange,
            [in] ITfCompositionSink *pSink,
            [out] ITfComposition **ppComposition);

    HRESULT EnumCompositions([out] IEnumITfCompositionView **ppEnum);

    HRESULT FindComposition(
            [in] TfEditCookie ecRead,
            [in] ITfRange *pTestRange,
            [out] IEnumITfCompositionView **ppEnum);

    HRESULT TakeOwnership(
            [in] TfEditCookie ecWrite,
            [in] ITfCompositionView *pComposition,
            [in] ITfCompositionSink *pSink,
            [out] ITfComposition **ppComposition);
}

[
    object,
    uuid(86462810-593b-4916-9764-19c08e9ce110),
    pointer_default(unique)
]
interface ITfContextOwnerCompositionServices : ITfContextComposition
{
    HRESULT TerminateComposition([in] ITfCompositionView *pComposition);
}

[
    object,
    uuid(4ef89150-0807-11d3-8df0-00105a2799b5),
    pointer_default(unique)
]
interface ITfPersistentPropertyLoaderACP : IUnknown
{
    HRESULT LoadProperty(
            [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
            [out] IStream **ppStream);
}

[
    object,
    uuid(b23eb630-3e1c-11d3-a745-0050040ab407),
    pointer_default(unique)
]
interface ITfContextOwnerServices : IUnknown
{
    HRESULT OnLayoutChange();

    HRESULT OnStatusChange([in] DWORD dwFlags);

    HRESULT OnAttributeChange([in] REFGUID rguidAttribute);

    HRESULT Serialize(
            [in] ITfProperty *pProp,
            [in] ITfRange *pRange,
            [out] TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
            [in] IStream *pStream);

    HRESULT Unserialize(
            [in] ITfProperty *pProp,
            [in] const TF_PERSISTENT_PROPERTY_HEADER_ACP *pHdr,
            [in] IStream *pStream,
            [in] ITfPersistentPropertyLoaderACP *pLoader);

    HRESULT ForceLoadProperty([in] ITfProperty *pProp);

    HRESULT CreateRange(
            [in] LONG acpStart,
            [in] LONG acpEnd,
            [out] ITfRangeACP **ppRange);
}

[
    object,
    uuid(17d49a3d-f8b8-4b2f-b254-52319dd64c53),
    pointer_default(unique)
]
interface ITfReadOnlyProperty : IUnknown
{
    HRESULT GetType([out] GUID *pguid);

    HRESULT EnumRanges(
            [in] TfEditCookie ec,
            [out] IEnumTfRanges **ppEnum,
            [in] ITfRange *pTargetRange);

    HRESULT GetValue(
            [in] TfEditCookie ec,
            [in] ITfRange *pRange,
            [out] VARIANT *pvarValue);

    HRESULT GetContext([out] ITfContext **ppContext);
}

[
    object,
    uuid(e2449660-9542-11d2-bf46-00105a2799b5),
    pointer_default(unique)
]
interface ITfProperty : ITfReadOnlyProperty
{
    HRESULT FindRange(
            [in] TfEditCookie ec,
            [in] ITfRange *pRange,
            [out] ITfRange **ppRange,
            [in] TfAnchor aPos);

    HRESULT SetValueStore(
            [in] TfEditCookie ec,
            [in] ITfRange *pRange,
            [in] ITfPropertyStore *pPropStore);

    HRESULT SetValue(
            [in] TfEditCookie ec,
            [in] ITfRange *pRange,
            [in] const VARIANT *pvarValue);

    HRESULT Clear(
            [in] TfEditCookie ec,
            [in] ITfRange *pRange);
}

[
  object,
  uuid(bb08f7a9-607a-4384-8623-056892b64371),
  pointer_default(unique)
]
interface ITfCompartment : IUnknown
{
    HRESULT SetValue(
        [in] TfClientId tid,
        [in] const VARIANT *pvarValue);

    HRESULT GetValue(
        [out] VARIANT *pvarValue);
};

[
  object,
  uuid(7dcf57ac-18ad-438b-824d-979bffb74b7c),
  pointer_default(unique)
]
interface ITfCompartmentMgr : IUnknown
{
    HRESULT GetCompartment(
        [in] REFGUID rguid,
        [out] ITfCompartment **ppcomp);

    HRESULT ClearCompartment(
        [in] TfClientId tid,
        [in] REFGUID rguid);

    HRESULT EnumCompartments(
        [out] IEnumGUID **ppEnum);
};

[
  object,
  uuid(743abd5f-f26d-48df-8cc5-238492419b64),
  pointer_default(unique)
]
interface ITfCompartmentEventSink : IUnknown
{
    HRESULT OnChange(
        [in] REFGUID rguid);
}

[
  object,
  uuid(8f1a7ea6-1654-4502-a86e-b2902344d507),
  pointer_default(unique)
]
interface IEnumTfContexts : IUnknown
{
    HRESULT Clone(
        [out] IEnumTfContexts **ppEnum);

    HRESULT Next(
        [in] ULONG ulCount,
        [out, size_is(ulCount), length_is(*pcFetched)] ITfContext **rgContext,
        [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip(
        [in] ULONG ulCount);
};

[
  object,
  uuid(aa80e808-2021-11d2-93e0-0060b067b86e),
  pointer_default(unique)
]
interface IEnumTfDocumentMgrs : IUnknown
{
    HRESULT Clone(
        [out] IEnumTfDocumentMgrs **ppEnum);

    HRESULT Next(
        [in] ULONG ulCount,
        [out, size_is(ulCount), length_is(*pcFetched)] ITfDocumentMgr **rgDocumentMgr,
        [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip(
        [in] ULONG ulCount);
};

[
  object,
  uuid(73131f9c-56a9-49dd-b0ee-d046633f7528),
  pointer_default(unique)
]
interface ITfSourceSingle : IUnknown
{
    HRESULT AdviseSingleSink(
        [in] TfClientId tid,
        [in] REFIID riid,
        [in, iid_is(riid)] IUnknown *punk);

    HRESULT UnadviseSingleSink(
        [in] TfClientId tid,
        [in] REFIID riid);
};

[
  object,
  local,
  uuid(c0f1db0c-3a20-405c-a303-96b6010a885f),
  pointer_default(unique)
]
interface ITfThreadFocusSink : IUnknown
{
    HRESULT OnSetThreadFocus();

    HRESULT OnKillThreadFocus();
};