Commit dff8de63 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

- added support plug-in DLLs for winhelp

- added preliminary support for plug-in callback into winhelp - rewrote all the macros accordingly (macro entry-point has to have WINAPI calling convention) - some fixes for embedded images decompression - misc cleanups
parent 2003c7ab
......@@ -8,10 +8,11 @@ IMPORTS = comdlg32 shell32 user32 gdi32 kernel32
PROGRAMS = hlp2sgml
C_SRCS = \
winhelp.c \
callback.c \
hlpfile.c \
macro.c \
string.c
string.c \
winhelp.c
EXTRA_SRCS = macro.lex.l
EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o
......
/*
* Help Viewer - DLL callback into WineHelp
*
* Copyright 2004 Eric Pouech
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "windows.h"
#include "winhelp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
static WORD CALLBACK WHD_GetFSError(void)
{
WINE_FIXME("()\n");
return 0;
}
static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
{
unsigned mode = 0;
WINE_FIXME("(%s %x)\n", wine_dbgstr_a(name), flags);
switch (flags)
{
case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
case 2: mode = GENERIC_READ; break;
default: WINE_FIXME("Undocumented flags %x\n", flags);
}
return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
static WORD CALLBACK WHD_Close(HANDLE fs)
{
WINE_FIXME("(%p)\n", fs);
CloseHandle(fs);
return 0;
}
static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
{
WINE_FIXME("(%p %s %x)\n", fs, name, flags);
return NULL;
}
static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
{
WINE_FIXME("()\n");
return NULL;
}
static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
{
WINE_FIXME("()\n");
return 0;
}
static LONG CALLBACK WHD_TellBag(HANDLE bag)
{
WINE_FIXME("()\n");
return 0;
}
static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
{
WINE_FIXME("()\n");
return 0;
}
static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
{
WINE_FIXME("()\n");
return FALSE;
}
static LONG CALLBACK WHD_SizeBag(HANDLE bag)
{
WINE_FIXME("()\n");
return 0;
}
static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
{
WINE_FIXME("()\n");
return FALSE;
}
static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
{
WINE_FIXME("()\n");
return 0;
}
static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
{
WINE_FIXME("()\n");
return 0;
}
static void CALLBACK WHD_Error(int err)
{
WINE_FIXME("()\n");
}
static void CALLBACK WHD_ErrorString(LPSTR err)
{
WINE_FIXME("()\n");
}
static LONG CALLBACK WHD_GetInfo(WORD what, HWND hnd)
{
LONG ret = 0;
WINE_TRACE("(%x %p)\n", what, hnd);
switch (what)
{
case 0: break;
case 1: /* instance */ ret = (LONG)Globals.hInstance; break;
case 3: /* current window */ ret = (LONG)Globals.active_win->hMainWnd; break;
case 2: /* main window */
case 4: /* handle to opened file */
case 5: /* foreground color */
case 6: /* background color */
case 7: /* topic number */
case 8: /* current opened file name */
WINE_FIXME("NIY %u\n", what);
break;
default:
WINE_FIXME("Undocumented %u\n", what);
break;
}
return ret;
}
static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
{
WINE_FIXME("()\n");
return 0;
}
FARPROC Callbacks[] =
{
(FARPROC)WHD_GetFSError,
(FARPROC)WHD_Open,
(FARPROC)WHD_Close,
(FARPROC)WHD_OpenBag,
(FARPROC)WHD_CloseBag,
(FARPROC)WHD_ReadBag,
(FARPROC)WHD_TellBag,
(FARPROC)WHD_SeekBag,
(FARPROC)WHD_IsEofBag,
(FARPROC)WHD_SizeBag,
(FARPROC)WHD_Access,
(FARPROC)WHD_LLInfoFromBag,
(FARPROC)WHD_LLInfoFromFile,
(FARPROC)WHD_Error,
(FARPROC)WHD_ErrorString,
(FARPROC)WHD_GetInfo,
(FARPROC)WHD_API
};
......@@ -91,11 +91,12 @@ static BOOL HLPFILE_Uncompress3(char*, const char*, const BYTE*, const BYTE*);
static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, unsigned dstsz);
static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile);
#if 0
/***********************************************************************
*
* HLPFILE_PageByNumber
*/
HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
static HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
{
HLPFILE_PAGE *page;
HLPFILE *hlpfile = HLPFILE_ReadHlpFile(lpszPath);
......@@ -110,6 +111,7 @@ HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
return page;
}
#endif
/* FIXME:
* this finds the page containing the offset. The offset can either
......@@ -534,7 +536,7 @@ static BYTE* HLPFILE_DecompressGfx(BYTE* src, unsigned csz, unsigned sz, BYTE
if (!dst) return NULL;
HLPFILE_UncompressRLE(src, src + csz, &tmp, sz);
if (tmp - dst != sz)
WINE_FIXME("Bogus gfx sizes (RunLen): %u/%u\n", tmp - dst, sz);
WINE_WARN("Bogus gfx sizes (RunLen): %u/%u\n", tmp - dst, sz);
break;
case 2: /* LZ77 */
sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz);
......@@ -671,7 +673,7 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa
hsoff = GET_UINT(ptr, 4);
ptr += 8;
WINE_FIXME("sz=%lu csz=%lu (%ld,%ld) offs=%lu/%u,%lu\n",
WINE_TRACE("sz=%lu csz=%lu (%ld,%ld) offs=%lu/%u,%lu\n",
size, csize, mfp.xExt, mfp.yExt, off, ptr - beg, hsoff);
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
......@@ -1785,10 +1787,10 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
while (src < end)
{
ch = *src++;
if (!(ch & 0x7F)) continue;
if (ch & 0x80)
{
ch &= 0x7F;
if (ch == 0) WINE_FIXME("Null length 1, next is %u\n", *src);
if ((*dst) + ch < sdst)
memcpy(*dst, src, ch);
src += ch;
......@@ -1796,18 +1798,13 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
else
{
if ((*dst) + ch < sdst)
memset(*dst, (char)*src, ch);
src++;
if (ch == 0)
{
WINE_FIXME("Null length 2, next is %u\n", *src);
}
memset(*dst, (char)*src++, ch);
}
*dst += ch;
}
if (*dst != sdst)
WINE_FIXME("Buffer X-flow: d(%u) instead of d(%u)\n",
*dst - (sdst - dstsz), dstsz);
WINE_WARN("Buffer X-flow: d(%u) instead of d(%u)\n",
*dst - (sdst - dstsz), dstsz);
}
/******************************************************************
......
......@@ -29,8 +29,7 @@ struct lexret {
BOOL bool;
LONG integer;
LPCSTR string;
BOOL (*bool_function)();
void (*void_function)();
FARPROC function;
};
extern struct lexret yylval;
......@@ -39,97 +38,97 @@ BOOL MACRO_ExecuteMacro(LPCSTR);
int MACRO_Lookup(const char* name, struct lexret* lr);
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
void MACRO_About(void);
void MACRO_AddAccelerator(LONG, LONG, LPCSTR);
void MACRO_ALink(LPCSTR, LONG, LPCSTR);
void MACRO_Annotate(void);
void MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
void MACRO_Back(void);
void MACRO_BackFlush(void);
void MACRO_BookmarkDefine(void);
void MACRO_BookmarkMore(void);
void MACRO_BrowseButtons(void);
void MACRO_ChangeButtonBinding(LPCSTR, LPCSTR);
void MACRO_ChangeEnable(LPCSTR, LPCSTR);
void MACRO_ChangeItemBinding(LPCSTR, LPCSTR);
void MACRO_CheckItem(LPCSTR);
void MACRO_CloseSecondarys(void);
void MACRO_CloseWindow(LPCSTR);
void MACRO_Compare(LPCSTR);
void MACRO_Contents(void);
void MACRO_ControlPanel(LPCSTR, LPCSTR, LONG);
void MACRO_CopyDialog(void);
void MACRO_CopyTopic(void);
void MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
void MACRO_DeleteItem(LPCSTR);
void MACRO_DeleteMark(LPCSTR);
void MACRO_DestroyButton(LPCSTR);
void MACRO_DisableButton(LPCSTR);
void MACRO_DisableItem(LPCSTR);
void MACRO_EnableButton(LPCSTR);
void MACRO_EnableItem(LPCSTR);
void MACRO_EndMPrint(void);
void MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR);
void MACRO_ExecProgram(LPCSTR, LONG);
void MACRO_Exit(void);
void MACRO_ExtAbleItem(LPCSTR, LONG);
void MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
void MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
BOOL MACRO_FileExist(LPCSTR);
void MACRO_FileOpen(void);
void MACRO_Find(void);
void MACRO_Finder(void);
void MACRO_FloatingMenu(void);
void MACRO_Flush(void);
void MACRO_FocusWindow(LPCSTR);
void MACRO_Generate(LPCSTR, LONG, LONG);
void MACRO_GotoMark(LPCSTR);
void MACRO_HelpOn(void);
void MACRO_HelpOnTop(void);
void MACRO_History(void);
void MACRO_IfThen(BOOL, LPCSTR);
void MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR);
BOOL MACRO_InitMPrint(void);
void MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
void MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL MACRO_IsBook(void);
BOOL MACRO_IsMark(LPCSTR);
BOOL MACRO_IsNotMark(LPCSTR);
void MACRO_JumpContents(LPCSTR, LPCSTR);
void MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHelpOn(void);
void MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR);
void MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR);
void MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR);
void MACRO_Menu(void);
void MACRO_MPrintHash(LONG);
void MACRO_MPrintID(LPCSTR);
void MACRO_Next(void);
void MACRO_NoShow(void);
void MACRO_PopupContext(LPCSTR, LONG);
void MACRO_PopupHash(LPCSTR, LONG);
void MACRO_PopupId(LPCSTR, LPCSTR);
void MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR);
void MACRO_Prev(void);
void MACRO_Print(void);
void MACRO_PrinterSetup(void);
void MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR);
void MACRO_RemoveAccelerator(LONG, LONG);
void MACRO_ResetMenu(void);
void MACRO_SaveMark(LPCSTR);
void MACRO_Search(void);
void MACRO_SetContents(LPCSTR, LONG);
void MACRO_SetHelpOnFile(LPCSTR);
void MACRO_SetPopupColor(LONG, LONG, LONG);
void MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR);
void MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR);
void MACRO_TCard(LONG);
void MACRO_Test(LONG);
BOOL MACRO_TestALink(LPCSTR);
BOOL MACRO_TestKLink(LPCSTR);
void MACRO_UncheckItem(LPCSTR);
void MACRO_UpdateWindow(LPCSTR, LPCSTR);
void CALLBACK MACRO_About(void);
void CALLBACK MACRO_AddAccelerator(LONG, LONG, LPCSTR);
void CALLBACK MACRO_ALink(LPCSTR, LONG, LPCSTR);
void CALLBACK MACRO_Annotate(void);
void CALLBACK MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_Back(void);
void CALLBACK MACRO_BackFlush(void);
void CALLBACK MACRO_BookmarkDefine(void);
void CALLBACK MACRO_BookmarkMore(void);
void CALLBACK MACRO_BrowseButtons(void);
void CALLBACK MACRO_ChangeButtonBinding(LPCSTR, LPCSTR);
void CALLBACK MACRO_ChangeEnable(LPCSTR, LPCSTR);
void CALLBACK MACRO_ChangeItemBinding(LPCSTR, LPCSTR);
void CALLBACK MACRO_CheckItem(LPCSTR);
void CALLBACK MACRO_CloseSecondarys(void);
void CALLBACK MACRO_CloseWindow(LPCSTR);
void CALLBACK MACRO_Compare(LPCSTR);
void CALLBACK MACRO_Contents(void);
void CALLBACK MACRO_ControlPanel(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_CopyDialog(void);
void CALLBACK MACRO_CopyTopic(void);
void CALLBACK MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_DeleteItem(LPCSTR);
void CALLBACK MACRO_DeleteMark(LPCSTR);
void CALLBACK MACRO_DestroyButton(LPCSTR);
void CALLBACK MACRO_DisableButton(LPCSTR);
void CALLBACK MACRO_DisableItem(LPCSTR);
void CALLBACK MACRO_EnableButton(LPCSTR);
void CALLBACK MACRO_EnableItem(LPCSTR);
void CALLBACK MACRO_EndMPrint(void);
void CALLBACK MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR);
void CALLBACK MACRO_ExecProgram(LPCSTR, LONG);
void CALLBACK MACRO_Exit(void);
void CALLBACK MACRO_ExtAbleItem(LPCSTR, LONG);
void CALLBACK MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
void CALLBACK MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
BOOL CALLBACK MACRO_FileExist(LPCSTR);
void CALLBACK MACRO_FileOpen(void);
void CALLBACK MACRO_Find(void);
void CALLBACK MACRO_Finder(void);
void CALLBACK MACRO_FloatingMenu(void);
void CALLBACK MACRO_Flush(void);
void CALLBACK MACRO_FocusWindow(LPCSTR);
void CALLBACK MACRO_Generate(LPCSTR, LONG, LONG);
void CALLBACK MACRO_GotoMark(LPCSTR);
void CALLBACK MACRO_HelpOn(void);
void CALLBACK MACRO_HelpOnTop(void);
void CALLBACK MACRO_History(void);
void CALLBACK MACRO_IfThen(BOOL, LPCSTR);
void CALLBACK MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR);
BOOL CALLBACK MACRO_InitMPrint(void);
void CALLBACK MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL CALLBACK MACRO_IsBook(void);
BOOL CALLBACK MACRO_IsMark(LPCSTR);
BOOL CALLBACK MACRO_IsNotMark(LPCSTR);
void CALLBACK MACRO_JumpContents(LPCSTR, LPCSTR);
void CALLBACK MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_JumpHelpOn(void);
void CALLBACK MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR);
void CALLBACK MACRO_Menu(void);
void CALLBACK MACRO_MPrintHash(LONG);
void CALLBACK MACRO_MPrintID(LPCSTR);
void CALLBACK MACRO_Next(void);
void CALLBACK MACRO_NoShow(void);
void CALLBACK MACRO_PopupContext(LPCSTR, LONG);
void CALLBACK MACRO_PopupHash(LPCSTR, LONG);
void CALLBACK MACRO_PopupId(LPCSTR, LPCSTR);
void CALLBACK MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR);
void CALLBACK MACRO_Prev(void);
void CALLBACK MACRO_Print(void);
void CALLBACK MACRO_PrinterSetup(void);
void CALLBACK MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_RemoveAccelerator(LONG, LONG);
void CALLBACK MACRO_ResetMenu(void);
void CALLBACK MACRO_SaveMark(LPCSTR);
void CALLBACK MACRO_Search(void);
void CALLBACK MACRO_SetContents(LPCSTR, LONG);
void CALLBACK MACRO_SetHelpOnFile(LPCSTR);
void CALLBACK MACRO_SetPopupColor(LONG, LONG, LONG);
void CALLBACK MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR);
void CALLBACK MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR);
void CALLBACK MACRO_TCard(LONG);
void CALLBACK MACRO_Test(LONG);
BOOL CALLBACK MACRO_TestALink(LPCSTR);
BOOL CALLBACK MACRO_TestKLink(LPCSTR);
void CALLBACK MACRO_UncheckItem(LPCSTR);
void CALLBACK MACRO_UpdateWindow(LPCSTR, LPCSTR);
/* Local Variables: */
/* c-file-style: "GNU" */
......
......@@ -132,7 +132,7 @@ static const char* ts(int t)
}
}
static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret);
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret);
/******************************************************************
* MACRO_CheckArgs
......@@ -173,7 +173,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
case 'B':
if (t != BOOL_FUNCTION)
{WINE_WARN("missing B\n");return -1;}
if (MACRO_CallBoolFunc(yylval.bool_function, yylval.proto, &pa[idx]) == 0)
if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0)
return -1;
break;
default:
......@@ -196,7 +196,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
* Invokes boolean function fn, which arguments are defined by args
* stores bool result into ret
*/
static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret)
static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
{
void* pa[2];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
......@@ -221,7 +221,7 @@ static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret)
*
*
*/
static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
{
void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
......@@ -229,7 +229,7 @@ static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
if (idx == -1) return 0;
if (!fn) return 1;
WINE_TRACE("calling with %u pmts\n", idx);
WINE_TRACE("calling %p with %u pmts\n", fn, idx);
switch (idx)
{
......@@ -260,7 +260,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
{
case VOID_FUNCTION:
WINE_TRACE("got type void func(%s)\n", yylval.proto);
MACRO_CallVoidFunc(yylval.void_function, yylval.proto);
MACRO_CallVoidFunc(yylval.function, yylval.proto);
break;
case BOOL_FUNCTION:
WINE_WARN("got type bool func(%s)\n", yylval.proto);
......
......@@ -54,7 +54,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd);
static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM);
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 1, 0, 0, NULL};
WINHELP_GLOBALS Globals = {3, NULL, NULL, 0, TRUE, NULL, NULL, NULL, NULL};
/***********************************************************************
*
......@@ -129,7 +129,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
*
*
*/
HLPFILE_WINDOWINFO* WINHELP_GetPopupWindowInfo(HLPFILE* hlpfile, HWND hParentWnd, POINT* mouse)
static HLPFILE_WINDOWINFO* WINHELP_GetPopupWindowInfo(HLPFILE* hlpfile, HWND hParentWnd, POINT* mouse)
{
static HLPFILE_WINDOWINFO wi;
......@@ -165,6 +165,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
LONG lHash = 0;
HLPFILE* hlpfile;
CHAR* quote;
WINHELP_DLL* dll;
Globals.hInstance = hInstance;
......@@ -205,7 +206,12 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
}
/* Create primary window */
WINHELP_RegisterWinClasses();
if (!WINHELP_RegisterWinClasses())
{
WINE_FIXME("Couldn't register classes\n");
return 0;
}
if (*cmdline)
{
if ((*cmdline == '"') && (quote = strchr(cmdline+1, '"')))
......@@ -226,6 +232,10 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
TranslateMessage(&msg);
DispatchMessage(&msg);
}
for (dll = Globals.dlls; dll; dll = dll->next)
{
if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
}
return 0;
}
......@@ -473,7 +483,7 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
sizeof(WINHELP_WINDOW) + strlen(wi->name) + 1);
if (!win) return FALSE;
win->next = Globals.win_list;
win->next = Globals.win_list;
Globals.win_list = win;
win->lpszName = (char*)win + sizeof(WINHELP_WINDOW);
......@@ -544,9 +554,10 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
}
hWnd = CreateWindow(bPopup ? TEXT_WIN_CLASS_NAME : MAIN_WIN_CLASS_NAME,
wi->caption, wi->win_style,
wi->caption,
bPrimary ? WS_OVERLAPPEDWINDOW : wi->win_style,
wi->origin.x, wi->origin.y, wi->size.cx, wi->size.cy,
0, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
NULL, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
Globals.hInstance, win);
ShowWindow(hWnd, nCmdShow);
......@@ -965,7 +976,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
if (CurPos > Max)
CurPos = Max;
else if (CurPos < Min)
CurPos = Min;
CurPos = Min;
dy = GetScrollPos(hWnd, SB_VERT) - CurPos;
SetScrollPos(hWnd, SB_VERT, CurPos, TRUE);
ScrollWindow(hWnd, 0, dy, NULL, NULL);
......
......@@ -122,6 +122,36 @@ typedef struct tagWinHelp
struct tagWinHelp* next;
} WINHELP_WINDOW;
#define DC_NOMSG 0x00000000
#define DC_MINMAX 0x00000001
#define DC_INITTERM 0x00000002
#define DC_JUMP 0x00000004
#define DC_ACTIVATE 0x00000008
#define DC_CALLBACKS 0x00000010
#define DW_NOTUSED 0
#define DW_WHATMSG 1
#define DW_MINMAX 2
#define DW_SIZE 3
#define DW_INIT 4
#define DW_TERM 5
#define DW_STARTJUMP 6
#define DW_ENDJUMP 7
#define DW_CHGFILE 8
#define DW_ACTIVATE 9
#define DW_CALLBACKS 10
typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);
typedef struct tagDll
{
HANDLE hLib;
const char* name;
WINHELP_LDLLHandler handler;
DWORD class;
struct tagDll* next;
} WINHELP_DLL;
typedef struct
{
UINT wVersion;
......@@ -132,9 +162,11 @@ typedef struct
WINHELP_WINDOW* active_win;
WINHELP_WINDOW* win_list;
WNDPROC button_proc;
WINHELP_DLL* dlls;
} WINHELP_GLOBALS;
extern WINHELP_GLOBALS Globals;
extern FARPROC Callbacks[];
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE*, HLPFILE_WINDOWINFO*, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment