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