[CSRSRV]
[reactos.git] / base / applications / winhlp32 / callback.c
1 /*
2 * Help Viewer - DLL callback into WineHelp
3 *
4 * Copyright 2004 Eric Pouech
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include <stdarg.h>
22 #include <windef.h>
23 #include <wingdi.h>
24 #include <winuser.h>
25 #include <wine/debug.h>
26
27 #include "winhelp.h"
28
29 WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
30
31 static WORD CALLBACK WHD_GetFSError(void)
32 {
33 WINE_FIXME("()\n");
34 return 0;
35 }
36
37 static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
38 {
39 unsigned mode = 0;
40
41 WINE_FIXME("(%s %x)\n", wine_dbgstr_a(name), flags);
42 switch (flags)
43 {
44 case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
45 case 2: mode = GENERIC_READ; break;
46 default: WINE_FIXME("Undocumented flags %x\n", flags);
47 }
48 return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
49 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
50 }
51
52 static WORD CALLBACK WHD_Close(HANDLE fs)
53 {
54 WINE_FIXME("(%p)\n", fs);
55 CloseHandle(fs);
56 return 0;
57 }
58
59 static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
60 {
61 WINE_FIXME("(%p %s %x)\n", fs, name, flags);
62 return NULL;
63 }
64
65 static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
66 {
67 WINE_FIXME("()\n");
68 return NULL;
69 }
70
71 static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
72 {
73 WINE_FIXME("()\n");
74 return 0;
75 }
76
77 static LONG CALLBACK WHD_TellBag(HANDLE bag)
78 {
79 WINE_FIXME("()\n");
80 return 0;
81 }
82
83 static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
84 {
85 WINE_FIXME("()\n");
86 return 0;
87 }
88
89 static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
90 {
91 WINE_FIXME("()\n");
92 return FALSE;
93 }
94
95 static LONG CALLBACK WHD_SizeBag(HANDLE bag)
96 {
97 WINE_FIXME("()\n");
98 return 0;
99 }
100
101 static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
102 {
103 WINE_FIXME("()\n");
104 return FALSE;
105 }
106
107 static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
108 {
109 WINE_FIXME("()\n");
110 return 0;
111 }
112
113 static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
114 {
115 WINE_FIXME("()\n");
116 return 0;
117 }
118
119 static void CALLBACK WHD_Error(int err)
120 {
121 WINE_FIXME("()\n");
122 }
123
124 static void CALLBACK WHD_ErrorString(LPSTR err)
125 {
126 WINE_FIXME("()\n");
127 }
128
129 static ULONG_PTR CALLBACK WHD_GetInfo(WORD what, HWND hnd)
130 {
131 ULONG_PTR ret = 0;
132
133 WINE_TRACE("(%x %p)\n", what, hnd);
134 switch (what)
135 {
136 case 0: break;
137 case 1: /* instance */ ret = (ULONG_PTR)Globals.hInstance; break;
138 case 3: /* current window */ ret = (ULONG_PTR)Globals.active_win->hMainWnd; break;
139 case 2: /* main window */
140 case 4: /* handle to opened file */
141 case 5: /* foreground color */
142 case 6: /* background color */
143 case 7: /* topic number */
144 case 8: /* current opened file name */
145 WINE_FIXME("NIY %u\n", what);
146 break;
147 default:
148 WINE_FIXME("Undocumented %u\n", what);
149 break;
150 }
151 return ret;
152 }
153
154 static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
155 {
156 WINE_FIXME("()\n");
157 return 0;
158 }
159
160 const struct winhelp_callbacks Callbacks =
161 {
162 WHD_GetFSError,
163 WHD_Open,
164 WHD_Close,
165 WHD_OpenBag,
166 WHD_CloseBag,
167 WHD_ReadBag,
168 WHD_TellBag,
169 WHD_SeekBag,
170 WHD_IsEofBag,
171 WHD_SizeBag,
172 WHD_Access,
173 WHD_LLInfoFromBag,
174 WHD_LLInfoFromFile,
175 WHD_Error,
176 WHD_ErrorString,
177 WHD_GetInfo,
178 WHD_API
179 };