1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for InitializeLpkHooks
5  * PROGRAMMERS:     Magnus Olsen
6  */
7 
8 #include "precomp.h"
9 
10 typedef struct _LPK_LPEDITCONTROL_LIST
11 {
12     PVOID EditCreate;
13     PVOID EditIchToXY;
14     PVOID EditMouseToIch;
15     PVOID EditCchInWidth;
16     PVOID EditGetLineWidth;
17     PVOID EditDrawText;
18     PVOID EditHScroll;
19     PVOID EditMoveSelection;
20     PVOID EditVerifyText;
21     PVOID EditNextWord;
22     PVOID EditSetMenu;
23     PVOID EditProcessMenu;
24     PVOID EditCreateCaret;
25     PVOID EditAdjustCaret;
26 } LPK_LPEDITCONTROL_LIST, *PLPK_LPEDITCONTROL_LIST;
27 
28 
29 static DWORD (APIENTRY *fpLpkTabbedTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
30 static DWORD (APIENTRY *fpLpkPSMTextOut) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
31 static DWORD (APIENTRY *fpLpkDrawTextEx) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID);
32 static PLPK_LPEDITCONTROL_LIST (APIENTRY *fpLpkEditControl) ();
33 
34 static int Count_myLpkTabbedTextOut = 0;
35 static int Count_myLpkPSMTextOut = 0;
36 static int Count_myLpkDrawTextEx = 0;
37 
38 DWORD WINAPI myLpkTabbedTextOut (LPVOID x1,LPVOID x2,LPVOID x3, LPVOID x4, LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8,
39                                    LPVOID x9, LPVOID x10, LPVOID x11, LPVOID x12)
40 {
41     Count_myLpkTabbedTextOut++;
42     return fpLpkTabbedTextOut(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12);
43 }
44 
45 DWORD myLpkPSMTextOut (LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5,LPVOID x6)
46 {
47     Count_myLpkPSMTextOut++;
48     return fpLpkPSMTextOut ( x1,  x2,  x3,  x4,  x5,  x6);
49 }
50 
51 DWORD myLpkDrawTextEx(LPVOID x1,LPVOID x2,LPVOID x3,LPVOID x4,LPVOID x5, LPVOID x6, LPVOID x7, LPVOID x8, LPVOID x9,LPVOID x10)
52 {
53     Count_myLpkDrawTextEx++;
54     return fpLpkDrawTextEx(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10);
55 }
56 
57 
58 typedef struct _USER32_INTERN_INITIALIZEHOOKS
59 {
60     PVOID fpLpkTabbedTextOut;
61     PVOID fpLpkPSMTextOut;
62     PVOID fpLpkDrawTextEx;
63     PLPK_LPEDITCONTROL_LIST fpListLpkEditControl;
64 } USER32_INTERN_INITIALIZEHOOKS, *PUSER32_INTERN_INITIALIZEHOOKS;
65 
66 VOID WINAPI InitializeLpkHooks (PUSER32_INTERN_INITIALIZEHOOKS);
67 
68 void Test_InitializeLpkHooks()
69 {
70     USER32_INTERN_INITIALIZEHOOKS setup;
71     HMODULE lib = LoadLibrary("LPK.DLL");
72 
73     ok(lib != NULL, "lib = 0\n");
74     if (lib != NULL)
75     {
76         fpLpkTabbedTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID, LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkTabbedTextOut");
77         fpLpkPSMTextOut = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "fpLpkPSMTextOut");
78         fpLpkDrawTextEx = (DWORD (APIENTRY *) (LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID,LPVOID)) GetProcAddress(lib, "LpkDrawTextEx");
79         fpLpkEditControl = (PLPK_LPEDITCONTROL_LIST (APIENTRY *) (VOID)) GetProcAddress(lib, "LpkEditControl");
80 
81         setup.fpLpkTabbedTextOut = myLpkTabbedTextOut;
82         setup.fpLpkPSMTextOut = myLpkPSMTextOut;
83         setup.fpLpkDrawTextEx = myLpkDrawTextEx;
84 
85         /* we have not add any test to this api */
86         setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
87 
88         /* use our own api that we just made */
89         InitializeLpkHooks(&setup);
90 
91         /* FIXME add test now */
92 
93         /* restore */
94         setup.fpLpkTabbedTextOut = fpLpkTabbedTextOut;
95         setup.fpLpkPSMTextOut = fpLpkPSMTextOut;
96         setup.fpLpkDrawTextEx = fpLpkDrawTextEx;
97         setup.fpListLpkEditControl = (PLPK_LPEDITCONTROL_LIST)fpLpkEditControl;
98         InitializeLpkHooks(&setup);
99     }
100 
101 }
102 
103 START_TEST(InitializeLpkHooks)
104 {
105     Test_InitializeLpkHooks();
106 }
107