[FASTFAT]
[reactos.git] / rostests / apitests / user32api / tests / InitializeLpkHooks.c
1
2 typedef struct _LPK_LPEDITCONTROL_LIST
3 {
4 PVOID EditCreate;
5 PVOID EditIchToXY;
6 PVOID EditMouseToIch;
7 PVOID EditCchInWidth;
8 PVOID EditGetLineWidth;
9 PVOID EditDrawText;
10 PVOID EditHScroll;
11 PVOID EditMoveSelection;
12 PVOID EditVerifyText;
13 PVOID EditNextWord;
14 PVOID EditSetMenu;
15 PVOID EditProcessMenu;
16 PVOID EditCreateCaret;
17 PVOID EditAdjustCaret;
18 } LPK_LPEDITCONTROL_LIST, *PLPK_LPEDITCONTROL_LIST;
19
20
21 DWORD (APIENTRY *fpLpkTabbedTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
22 DWORD (APIENTRY *fpLpkPSMTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
23 DWORD (APIENTRY *fpLpkDrawTextEx) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
24 PLPK_LPEDITCONTROL_LIST (APIENTRY *fpLpkEditControl) ();
25
26 int Count_myLpkTabbedTextOut = 0;
27 int Count_myLpkPSMTextOut = 0;
28 int Count_myLpkDrawTextEx = 0;
29
30 DWORD WINAPI myLpkTabbedTextOut (LPVOID x1,LPVOID x2,LPVOID x3, LPVOID x4, LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8,
31 LPVOID x9, LPVOID x10, LPVOID x11, LPVOID x12)
32 {
33 Count_myLpkTabbedTextOut++;
34 return fpLpkTabbedTextOut(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12);
35 }
36
37 DWORD myLpkPSMTextOut (LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5,LPVOID x6)
38 {
39 Count_myLpkPSMTextOut++;
40 return fpLpkPSMTextOut ( x1, x2, x3, x4, x5, x6);
41 }
42
43 DWORD myLpkDrawTextEx(LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8, LPVOID x9,LPVOID x10)
44 {
45 Count_myLpkDrawTextEx++;
46 return fpLpkDrawTextEx(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10);
47 }
48
49
50 typedef struct _USER32_INTERN_INITALIZEHOOKS
51 {
52 PVOID fpLpkTabbedTextOut;
53 PVOID fpLpkPSMTextOut;
54 PVOID fpLpkDrawTextEx;
55 PLPK_LPEDITCONTROL_LIST fpListLpkEditControl;
56 } USER32_INTERN_INITALIZEHOOKS, *PUSER32_INTERN_INITALIZEHOOKS;
57
58 VOID WINAPI InitializeLpkHooks (PUSER32_INTERN_INITALIZEHOOKS);
59
60 INT
61 Test_InitializeLpkHooks(PTESTINFO pti)
62 {
63 USER32_INTERN_INITALIZEHOOKS setup;
64 HMODULE lib = LoadLibrary("LPK.DLL");
65
66 TEST(lib != NULL);
67 if (lib != NULL)
68 {
69 fpLpkTabbedTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID, LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkTabbedTextOut");
70 fpLpkPSMTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "fpLpkPSMTextOut");
71 fpLpkDrawTextEx = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkDrawTextEx");
72 fpLpkEditControl = (PLPK_LPEDITCONTROL_LIST (APIENTRY *) (VOID)) GetProcAddress(lib, "LpkEditControl");
73
74 setup.fpLpkTabbedTextOut = myLpkTabbedTextOut;
75 setup.fpLpkPSMTextOut = myLpkPSMTextOut;
76 setup.fpLpkDrawTextEx = myLpkDrawTextEx;
77
78 /* we have not add any test to this api */
79 setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
80
81 /* use our own api that we just made */
82 InitializeLpkHooks(&setup);
83
84 /* FIXME add test now */
85
86 /* restore */
87 setup.fpLpkTabbedTextOut = fpLpkTabbedTextOut;
88 setup.fpLpkPSMTextOut = fpLpkPSMTextOut;
89 setup.fpLpkDrawTextEx = fpLpkDrawTextEx;
90 setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
91 InitializeLpkHooks(&setup);
92 }
93
94 return APISTATUS_NORMAL;
95 }
96