winhlp32: Avoid Unicode macros.

This commit is contained in:
Alexandre Julliard 2012-01-20 12:50:15 +01:00
parent edf44bfb1e
commit e12d39dc10
6 changed files with 174 additions and 175 deletions

View File

@ -1,5 +1,6 @@
MODULE = winhlp32.exe MODULE = winhlp32.exe
APPMODE = -mwindows APPMODE = -mwindows
EXTRADEFS = -DWINE_NO_UNICODE_MACROS
IMPORTS = user32 gdi32 IMPORTS = user32 gdi32
DELAYIMPORTS = shell32 comctl32 comdlg32 DELAYIMPORTS = shell32 comctl32 comdlg32

View File

@ -46,7 +46,7 @@ static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
case 2: mode = GENERIC_READ; break; case 2: mode = GENERIC_READ; break;
default: WINE_FIXME("Undocumented flags %x\n", flags); default: WINE_FIXME("Undocumented flags %x\n", flags);
} }
return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, return CreateFileA(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
} }

View File

@ -902,7 +902,7 @@ static BOOL HLPFILE_RtfAddTransparentBitmap(struct RtfData* rd, const BITMAPINFO
DeleteDC(hdcMem); DeleteDC(hdcMem);
/* we create the bitmap on the fly */ /* we create the bitmap on the fly */
hdcEMF = CreateEnhMetaFile(NULL, NULL, NULL, NULL); hdcEMF = CreateEnhMetaFileW(NULL, NULL, NULL, NULL);
hdcMem = CreateCompatibleDC(hdcEMF); hdcMem = CreateCompatibleDC(hdcEMF);
/* sets to RGB(0,0,0) the transparent bits in final bitmap */ /* sets to RGB(0,0,0) the transparent bits in final bitmap */
@ -2014,7 +2014,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1);
if (!hlpfile->lpszTitle) return FALSE; if (!hlpfile->lpszTitle) return FALSE;
lstrcpy(hlpfile->lpszTitle, str); strcpy(hlpfile->lpszTitle, str);
WINE_TRACE("Title: %s\n", hlpfile->lpszTitle); WINE_TRACE("Title: %s\n", hlpfile->lpszTitle);
/* Nothing more to parse */ /* Nothing more to parse */
return TRUE; return TRUE;
@ -2028,7 +2028,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
if (hlpfile->lpszTitle) {WINE_WARN("title\n"); break;} if (hlpfile->lpszTitle) {WINE_WARN("title\n"); break;}
hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1);
if (!hlpfile->lpszTitle) return FALSE; if (!hlpfile->lpszTitle) return FALSE;
lstrcpy(hlpfile->lpszTitle, str); strcpy(hlpfile->lpszTitle, str);
WINE_TRACE("Title: %s\n", hlpfile->lpszTitle); WINE_TRACE("Title: %s\n", hlpfile->lpszTitle);
break; break;
@ -2036,7 +2036,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
if (hlpfile->lpszCopyright) {WINE_WARN("copyright\n"); break;} if (hlpfile->lpszCopyright) {WINE_WARN("copyright\n"); break;}
hlpfile->lpszCopyright = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); hlpfile->lpszCopyright = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1);
if (!hlpfile->lpszCopyright) return FALSE; if (!hlpfile->lpszCopyright) return FALSE;
lstrcpy(hlpfile->lpszCopyright, str); strcpy(hlpfile->lpszCopyright, str);
WINE_TRACE("Copyright: %s\n", hlpfile->lpszCopyright); WINE_TRACE("Copyright: %s\n", hlpfile->lpszCopyright);
break; break;
@ -2047,10 +2047,10 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile)
break; break;
case 4: case 4:
macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + lstrlen(str) + 1); macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + strlen(str) + 1);
if (!macro) break; if (!macro) break;
p = (char*)macro + sizeof(HLPFILE_MACRO); p = (char*)macro + sizeof(HLPFILE_MACRO);
lstrcpy(p, str); strcpy(p, str);
macro->lpszMacro = p; macro->lpszMacro = p;
macro->next = 0; macro->next = 0;
for (m = &hlpfile->first_macro; *m; m = &(*m)->next); for (m = &hlpfile->first_macro; *m; m = &(*m)->next);
@ -2734,7 +2734,7 @@ HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath)
} }
hlpfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, hlpfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(HLPFILE) + lstrlen(lpszPath) + 1); sizeof(HLPFILE) + strlen(lpszPath) + 1);
if (!hlpfile) return 0; if (!hlpfile) return 0;
hlpfile->lpszPath = (char*)hlpfile + sizeof(HLPFILE); hlpfile->lpszPath = (char*)hlpfile + sizeof(HLPFILE);

View File

@ -90,7 +90,7 @@ typedef struct
typedef struct typedef struct
{ {
LOGFONT LogFont; LOGFONTA LogFont;
HFONT hFont; HFONT hFont;
COLORREF color; COLORREF color;
} HLPFILE_FONT; } HLPFILE_FONT;

View File

@ -61,7 +61,7 @@ static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR na
WINHELP_BUTTON** b; WINHELP_BUTTON** b;
for (b = &win->first_button; *b; b = &(*b)->next) for (b = &win->first_button; *b; b = &(*b)->next)
if (!lstrcmpi(name, (*b)->lpszID)) break; if (!lstrcmpiA(name, (*b)->lpszID)) break;
return b; return b;
} }
@ -79,7 +79,7 @@ void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro); WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro);
size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3; size = sizeof(WINHELP_BUTTON) + strlen(id) + strlen(name) + strlen(macro) + 3;
button = HeapAlloc(GetProcessHeap(), 0, size); button = HeapAlloc(GetProcessHeap(), 0, size);
if (!button) return; if (!button) return;
@ -89,15 +89,15 @@ void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON); ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, id); strcpy(ptr, id);
button->lpszID = ptr; button->lpszID = ptr;
ptr += lstrlen(id) + 1; ptr += strlen(id) + 1;
lstrcpy(ptr, name); strcpy(ptr, name);
button->lpszName = ptr; button->lpszName = ptr;
ptr += lstrlen(name) + 1; ptr += strlen(name) + 1;
lstrcpy(ptr, macro); strcpy(ptr, macro);
button->lpszMacro = ptr; button->lpszMacro = ptr;
button->wParam = WH_FIRST_BUTTON; button->wParam = WH_FIRST_BUTTON;
@ -236,8 +236,8 @@ static void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
b = MACRO_LookupButton(win, id); b = MACRO_LookupButton(win, id);
if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;} if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
size = sizeof(WINHELP_BUTTON) + lstrlen(id) + size = sizeof(WINHELP_BUTTON) + strlen(id) +
lstrlen((*b)->lpszName) + lstrlen(macro) + 3; strlen((*b)->lpszName) + strlen(macro) + 3;
button = HeapAlloc(GetProcessHeap(), 0, size); button = HeapAlloc(GetProcessHeap(), 0, size);
if (!button) return; if (!button) return;
@ -248,15 +248,15 @@ static void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON); ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, id); strcpy(ptr, id);
button->lpszID = ptr; button->lpszID = ptr;
ptr += lstrlen(id) + 1; ptr += strlen(id) + 1;
lstrcpy(ptr, (*b)->lpszName); strcpy(ptr, (*b)->lpszName);
button->lpszName = ptr; button->lpszName = ptr;
ptr += lstrlen((*b)->lpszName) + 1; ptr += strlen((*b)->lpszName) + 1;
lstrcpy(ptr, macro); strcpy(ptr, macro);
button->lpszMacro = ptr; button->lpszMacro = ptr;
*b = button; *b = button;
@ -291,7 +291,7 @@ static void CALLBACK MACRO_CloseSecondarys(void)
for (win = Globals.win_list; win; win = next) for (win = Globals.win_list; win; win = next)
{ {
next = win->next; next = win->next;
if (lstrcmpi(win->info->name, "main")) if (lstrcmpiA(win->info->name, "main"))
WINHELP_ReleaseWindow(win); WINHELP_ReleaseWindow(win);
} }
} }
@ -308,7 +308,7 @@ static void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
for (win = Globals.win_list; win; win = next) for (win = Globals.win_list; win; win = next)
{ {
next = win->next; next = win->next;
if (!lstrcmpi(win->info->name, lpszWindow)) if (!lstrcmpiA(win->info->name, lpszWindow))
WINHELP_ReleaseWindow(win); WINHELP_ReleaseWindow(win);
} }
} }
@ -415,7 +415,7 @@ static void CALLBACK MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3,
static BOOL CALLBACK MACRO_FileExist(LPCSTR str) static BOOL CALLBACK MACRO_FileExist(LPCSTR str)
{ {
WINE_TRACE("(\"%s\")\n", str); WINE_TRACE("(\"%s\")\n", str);
return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES; return GetFileAttributesA(str) != INVALID_FILE_ATTRIBUTES;
} }
void CALLBACK MACRO_FileOpen(void) void CALLBACK MACRO_FileOpen(void)
@ -457,7 +457,7 @@ static void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main"; if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
for (win = Globals.win_list; win; win = win->next) for (win = Globals.win_list; win; win = win->next)
if (!lstrcmpi(win->info->name, lpszWindow)) if (!lstrcmpiA(win->info->name, lpszWindow))
SetFocus(win->hMainWnd); SetFocus(win->hMainWnd);
} }
@ -494,7 +494,7 @@ void CALLBACK MACRO_HelpOnTop(void)
HMENU menu; HMENU menu;
for (win = Globals.win_list; win; win = win->next) for (win = Globals.win_list; win; win = win->next)
if (!lstrcmpi(win->info->name, "main")) if (!lstrcmpiA(win->info->name, "main"))
main_wnd = win->hMainWnd; main_wnd = win->hMainWnd;
if (!main_wnd) if (!main_wnd)
{ {
@ -519,7 +519,7 @@ void CALLBACK MACRO_History(void)
if (Globals.active_win && !Globals.active_win->hHistoryWnd) if (Globals.active_win && !Globals.active_win->hHistoryWnd)
{ {
HWND hWnd = CreateWindow(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW, HWND hWnd = CreateWindowA(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW,
0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win); 0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win);
ShowWindow(hWnd, SW_NORMAL); ShowWindow(hWnd, SW_NORMAL);
} }
@ -714,7 +714,7 @@ static void CALLBACK MACRO_Prev(void)
void CALLBACK MACRO_Print(void) void CALLBACK MACRO_Print(void)
{ {
PRINTDLG printer; PRINTDLGW printer;
WINE_TRACE("()\n"); WINE_TRACE("()\n");
@ -738,7 +738,7 @@ void CALLBACK MACRO_Print(void)
printer.hPrintTemplate = 0; printer.hPrintTemplate = 0;
printer.hSetupTemplate = 0; printer.hSetupTemplate = 0;
if (PrintDlgA(&printer)) { if (PrintDlgW(&printer)) {
WINE_FIXME("Print()\n"); WINE_FIXME("Print()\n");
} }
} }
@ -765,7 +765,7 @@ static void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR
} }
if (!dll) if (!dll)
{ {
HANDLE hLib = LoadLibrary(dll_name); HANDLE hLib = LoadLibraryA(dll_name);
/* FIXME: the library will not be unloaded until exit of program /* FIXME: the library will not be unloaded until exit of program
* We don't send the DW_TERM message * We don't send the DW_TERM message

View File

@ -58,15 +58,15 @@ WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL,
*/ */
static void WINHELP_InitFonts(HWND hWnd) static void WINHELP_InitFonts(HWND hWnd)
{ {
WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
LOGFONT logfontlist[] = { LOGFONTW logfontlist[] = {
{-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}},
{ -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}}; { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}};
#define FONTS_LEN (sizeof(logfontlist)/sizeof(*logfontlist)) #define FONTS_LEN (sizeof(logfontlist)/sizeof(*logfontlist))
static HFONT fonts[FONTS_LEN]; static HFONT fonts[FONTS_LEN];
@ -81,7 +81,7 @@ static void WINHELP_InitFonts(HWND hWnd)
for (i = 0; i < FONTS_LEN; i++) for (i = 0; i < FONTS_LEN; i++)
{ {
fonts[i] = CreateFontIndirect(&logfontlist[i]); fonts[i] = CreateFontIndirectW(&logfontlist[i]);
} }
init = 1; init = 1;
@ -104,12 +104,13 @@ static DWORD CALLBACK WINHELP_RtfStreamIn(DWORD_PTR cookie, BYTE* buff,
static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative) static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative)
{ {
static const WCHAR emptyW[1];
/* At first clear area - needed by EM_POSFROMCHAR/EM_SETSCROLLPOS */ /* At first clear area - needed by EM_POSFROMCHAR/EM_SETSCROLLPOS */
SendMessage(hTextWnd, WM_SETTEXT, 0, (LPARAM)""); SendMessageW(hTextWnd, WM_SETTEXT, 0, (LPARAM)emptyW);
SendMessage(hTextWnd, WM_SETREDRAW, FALSE, 0); SendMessageW(hTextWnd, WM_SETREDRAW, FALSE, 0);
SendMessage(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color); SendMessageW(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color);
/* set word-wrap to window size (undocumented) */ /* set word-wrap to window size (undocumented) */
SendMessage(hTextWnd, EM_SETTARGETDEVICE, 0, 0); SendMessageW(hTextWnd, EM_SETTARGETDEVICE, 0, 0);
if (win->page) if (win->page)
{ {
struct RtfData rd; struct RtfData rd;
@ -131,11 +132,11 @@ static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative
} }
/* FIXME: else leaking potentially the rd.first_link chain */ /* FIXME: else leaking potentially the rd.first_link chain */
HeapFree(GetProcessHeap(), 0, rd.data); HeapFree(GetProcessHeap(), 0, rd.data);
SendMessage(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0); SendMessageW(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0);
pt.x = 0; pt.y = ptl.y; pt.x = 0; pt.y = ptl.y;
SendMessage(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt); SendMessageW(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt);
} }
SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); SendMessageW(hTextWnd, WM_SETREDRAW, TRUE, 0);
RedrawWindow(hTextWnd, NULL, NULL, RDW_FRAME|RDW_INVALIDATE); RedrawWindow(hTextWnd, NULL, NULL, RDW_FRAME|RDW_INVALIDATE);
} }
@ -145,28 +146,28 @@ static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative
*/ */
BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len) BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len)
{ {
OPENFILENAME openfilename; OPENFILENAMEA openfilename;
CHAR szDir[MAX_PATH]; CHAR szDir[MAX_PATH];
CHAR szzFilter[2 * MAX_STRING_LEN + 100]; CHAR szzFilter[2 * MAX_STRING_LEN + 100];
LPSTR p = szzFilter; LPSTR p = szzFilter;
WINE_TRACE("()\n"); WINE_TRACE("()\n");
LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN); LoadStringA(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN);
p += strlen(p) + 1; p += strlen(p) + 1;
lstrcpy(p, "*.hlp"); strcpy(p, "*.hlp");
p += strlen(p) + 1; p += strlen(p) + 1;
LoadString(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN); LoadStringA(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN);
p += strlen(p) + 1; p += strlen(p) + 1;
lstrcpy(p, "*.*"); strcpy(p, "*.*");
p += strlen(p) + 1; p += strlen(p) + 1;
*p = '\0'; *p = '\0';
GetCurrentDirectory(sizeof(szDir), szDir); GetCurrentDirectoryA(sizeof(szDir), szDir);
lpszFile[0]='\0'; lpszFile[0]='\0';
openfilename.lStructSize = sizeof(OPENFILENAME); openfilename.lStructSize = sizeof(openfilename);
openfilename.hwndOwner = (Globals.active_win ? Globals.active_win->hMainWnd : 0); openfilename.hwndOwner = (Globals.active_win ? Globals.active_win->hMainWnd : 0);
openfilename.hInstance = Globals.hInstance; openfilename.hInstance = Globals.hInstance;
openfilename.lpstrFilter = szzFilter; openfilename.lpstrFilter = szzFilter;
@ -187,7 +188,7 @@ BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len)
openfilename.lpfnHook = 0; openfilename.lpfnHook = 0;
openfilename.lpTemplateName = 0; openfilename.lpTemplateName = 0;
return GetOpenFileName(&openfilename); return GetOpenFileNameA(&openfilename);
} }
/*********************************************************************** /***********************************************************************
@ -199,10 +200,10 @@ static INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WO
CHAR text[MAX_STRING_LEN]; CHAR text[MAX_STRING_LEN];
CHAR newtext[MAX_STRING_LEN + MAX_PATH]; CHAR newtext[MAX_STRING_LEN + MAX_PATH];
LoadString(Globals.hInstance, ids_text, text, sizeof(text)); LoadStringA(Globals.hInstance, ids_text, text, sizeof(text));
wsprintf(newtext, text, str); wsprintfA(newtext, text, str);
return MessageBox(0, newtext, MAKEINTRESOURCE(ids_title), type); return MessageBoxA(0, newtext, MAKEINTRESOURCEA(ids_title), type);
} }
/*********************************************************************** /***********************************************************************
@ -230,8 +231,8 @@ HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile)
/* /*
* FIXME: Should we swap conditions? * FIXME: Should we swap conditions?
*/ */
if (!SearchPath(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) && if (!SearchPathA(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) &&
!SearchPath(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL)) !SearchPathA(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL))
{ {
if (WINHELP_MessageBoxIDS_s(STID_FILE_NOT_FOUND_s, lpszFile, STID_WHERROR, if (WINHELP_MessageBoxIDS_s(STID_FILE_NOT_FOUND_s, lpszFile, STID_WHERROR,
MB_YESNO|MB_ICONQUESTION) != IDYES) MB_YESNO|MB_ICONQUESTION) != IDYES)
@ -261,7 +262,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
if (hlpfile) if (hlpfile)
for (i = 0; i < hlpfile->numWindows; i++) for (i = 0; i < hlpfile->numWindows; i++)
if (!lstrcmpi(hlpfile->windows[i].name, name)) if (!lstrcmpiA(hlpfile->windows[i].name, name))
return &hlpfile->windows[i]; return &hlpfile->windows[i];
if (strcmp(name, "main") != 0) if (strcmp(name, "main") != 0)
@ -277,12 +278,12 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
if (hlpfile && hlpfile->lpszTitle[0]) if (hlpfile && hlpfile->lpszTitle[0])
{ {
char tmp[128]; char tmp[128];
LoadString(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp)); LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s", snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
hlpfile->lpszTitle, tmp, hlpfile->lpszPath); hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
} }
else else
LoadString(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption)); LoadStringA(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption));
mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT; mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
mwi.style = SW_SHOW; mwi.style = SW_SHOW;
mwi.win_style = WS_OVERLAPPEDWINDOW; mwi.win_style = WS_OVERLAPPEDWINDOW;
@ -551,7 +552,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
break; break;
} }
} }
bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->info->name, "main")); bExit = (Globals.wVersion >= 4 && !lstrcmpiA(win->info->name, "main"));
if (Globals.active_win == win) if (Globals.active_win == win)
{ {
@ -564,8 +565,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
Globals.active_popup = NULL; Globals.active_popup = NULL;
hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT); hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
SetWindowLongPtr(hTextWnd, GWLP_WNDPROC, SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC, (LONG_PTR)win->origRicheditWndProc);
(LONG_PTR)win->origRicheditWndProc);
WINHELP_DeleteButtons(win); WINHELP_DeleteButtons(win);
@ -671,7 +671,7 @@ static HLPFILE_LINK* WINHELP_FindLink(WINHELP_WINDOW* win, LPARAM pos)
static LRESULT CALLBACK WINHELP_RicheditWndProc(HWND hWnd, UINT msg, static LRESULT CALLBACK WINHELP_RicheditWndProc(HWND hWnd, UINT msg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtr(GetParent(hWnd), 0); WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtrW(GetParent(hWnd), 0);
DWORD messagePos; DWORD messagePos;
POINT pt; POINT pt;
switch(msg) switch(msg)
@ -703,14 +703,14 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
HICON hIcon; HICON hIcon;
HWND hTextWnd = NULL; HWND hTextWnd = NULL;
bPrimary = !lstrcmpi(wpage->wininfo->name, "main"); bPrimary = !lstrcmpiA(wpage->wininfo->name, "main");
bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP); bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP);
if (!bPopup) if (!bPopup)
{ {
for (win = Globals.win_list; win; win = win->next) for (win = Globals.win_list; win; win = win->next)
{ {
if (!lstrcmpi(win->info->name, wpage->wininfo->name)) if (!lstrcmpiA(win->info->name, wpage->wininfo->name))
{ {
if (win->page == wpage->page && win->info == wpage->wininfo) if (win->page == wpage->page && win->info == wpage->wininfo)
{ {
@ -722,7 +722,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
} }
WINHELP_DeleteButtons(win); WINHELP_DeleteButtons(win);
bReUsed = TRUE; bReUsed = TRUE;
SetWindowText(win->hMainWnd, WINHELP_GetCaption(wpage)); SetWindowTextA(win->hMainWnd, WINHELP_GetCaption(wpage));
if (win->info != wpage->wininfo) if (win->info != wpage->wininfo)
{ {
POINT pt = {0, 0}; POINT pt = {0, 0};
@ -793,43 +793,43 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
{ {
CHAR buffer[MAX_STRING_LEN]; CHAR buffer[MAX_STRING_LEN];
LoadString(Globals.hInstance, STID_CONTENTS, buffer, sizeof(buffer)); LoadStringA(Globals.hInstance, STID_CONTENTS, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()"); MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()");
LoadString(Globals.hInstance, STID_INDEX, buffer, sizeof(buffer)); LoadStringA(Globals.hInstance, STID_INDEX, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_INDEX", buffer, "Finder()"); MACRO_CreateButton("BTN_INDEX", buffer, "Finder()");
LoadString(Globals.hInstance, STID_BACK, buffer, sizeof(buffer)); LoadStringA(Globals.hInstance, STID_BACK, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_BACK", buffer, "Back()"); MACRO_CreateButton("BTN_BACK", buffer, "Back()");
if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK"); if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
} }
if (!bReUsed) if (!bReUsed)
{ {
win->hMainWnd = CreateWindowEx((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME, win->hMainWnd = CreateWindowExA((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME,
WINHELP_GetCaption(wpage), WINHELP_GetCaption(wpage),
bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style, bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style,
wpage->wininfo->origin.x, wpage->wininfo->origin.y, wpage->wininfo->origin.x, wpage->wininfo->origin.y,
wpage->wininfo->size.cx, wpage->wininfo->size.cy, wpage->wininfo->size.cx, wpage->wininfo->size.cy,
bPopup ? Globals.active_win->hMainWnd : NULL, bPopup ? Globals.active_win->hMainWnd : NULL,
bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0, bPrimary ? LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(MAIN_MENU)) : 0,
Globals.hInstance, win); Globals.hInstance, win);
if (!bPopup) if (!bPopup)
/* Create button box and text Window */ /* Create button box and text Window */
CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE, CreateWindowA(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL); 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL);
hTextWnd = CreateWindow(RICHEDIT_CLASS, NULL, hTextWnd = CreateWindowA(RICHEDIT_CLASS20A, NULL,
ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL); 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
SendMessage(hTextWnd, EM_SETEVENTMASK, 0, SendMessageW(hTextWnd, EM_SETEVENTMASK, 0,
SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS); SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS);
win->origRicheditWndProc = (WNDPROC)SetWindowLongPtr(hTextWnd, GWLP_WNDPROC, win->origRicheditWndProc = (WNDPROC)SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC,
(LONG_PTR)WINHELP_RicheditWndProc); (LONG_PTR)WINHELP_RicheditWndProc);
} }
hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL; hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL;
if (!hIcon) hIcon = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP), IMAGE_ICON, if (!hIcon) hIcon = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED);
SendMessage(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon); SendMessageW(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon);
/* Initialize file specific pushbuttons */ /* Initialize file specific pushbuttons */
if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page) if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
@ -846,22 +846,22 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
*/ */
for (win = Globals.win_list; win; win = win->next) for (win = Globals.win_list; win; win = win->next)
{ {
if (!lstrcmpi(win->info->name, wpage->wininfo->name)) break; if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) break;
} }
if (!win || !WINHELP_ReleaseWindow(win)) return TRUE; if (!win || !WINHELP_ReleaseWindow(win)) return TRUE;
if (bPopup) if (bPopup)
{ {
DWORD mask = SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0); DWORD mask = SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0);
win->font_scale = Globals.active_win->font_scale; win->font_scale = Globals.active_win->font_scale;
WINHELP_SetupText(hTextWnd, win, wpage->relative); WINHELP_SetupText(hTextWnd, win, wpage->relative);
/* we need the window to be shown for richedit to compute the size */ /* we need the window to be shown for richedit to compute the size */
ShowWindow(win->hMainWnd, nCmdShow); ShowWindow(win->hMainWnd, nCmdShow);
SendMessage(hTextWnd, EM_SETEVENTMASK, 0, mask | ENM_REQUESTRESIZE); SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask | ENM_REQUESTRESIZE);
SendMessage(hTextWnd, EM_REQUESTRESIZE, 0, 0); SendMessageW(hTextWnd, EM_REQUESTRESIZE, 0, 0);
SendMessage(hTextWnd, EM_SETEVENTMASK, 0, mask); SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask);
} }
else else
{ {
@ -1009,11 +1009,11 @@ static LRESULT CALLBACK WINHELP_ButtonWndProc(HWND hWnd, UINT msg, WPARAM wParam
case VK_PRIOR: case VK_PRIOR:
case VK_NEXT: case VK_NEXT:
case VK_ESCAPE: case VK_ESCAPE:
return SendMessage(GetParent(hWnd), msg, wParam, lParam); return SendMessageA(GetParent(hWnd), msg, wParam, lParam);
} }
} }
return CallWindowProc(Globals.button_proc, hWnd, msg, wParam, lParam); return CallWindowProcA(Globals.button_proc, hWnd, msg, wParam, lParam);
} }
/*********************************************************************** /***********************************************************************
@ -1034,7 +1034,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
{ {
case WM_WINDOWPOSCHANGING: case WM_WINDOWPOSCHANGING:
winpos = (WINDOWPOS*) lParam; winpos = (WINDOWPOS*) lParam;
win = (WINHELP_WINDOW*) GetWindowLongPtr(GetParent(hWnd), 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(GetParent(hWnd), 0);
/* Update buttons */ /* Update buttons */
button_size.cx = 0; button_size.cx = 0;
@ -1045,7 +1045,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
SIZE textsize; SIZE textsize;
if (!button->hWnd) if (!button->hWnd)
{ {
button->hWnd = CreateWindow(STRING_BUTTON, button->lpszName, button->hWnd = CreateWindowA(STRING_BUTTON, button->lpszName,
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, 0, 0, 0, 0, 0, 0,
hWnd, (HMENU) button->wParam, hWnd, (HMENU) button->wParam,
@ -1055,21 +1055,20 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
if (Globals.button_proc == NULL) if (Globals.button_proc == NULL)
{ {
NONCLIENTMETRICSW ncm; NONCLIENTMETRICSW ncm;
Globals.button_proc = (WNDPROC) GetWindowLongPtr(button->hWnd, GWLP_WNDPROC); Globals.button_proc = (WNDPROC) GetWindowLongPtrA(button->hWnd, GWLP_WNDPROC);
ncm.cbSize = sizeof(NONCLIENTMETRICSW); ncm.cbSize = sizeof(NONCLIENTMETRICSW);
SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICSW), &ncm, 0); sizeof(NONCLIENTMETRICSW), &ncm, 0);
Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont); Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont);
} }
SetWindowLongPtr(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc); SetWindowLongPtrA(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc);
if (Globals.hButtonFont) if (Globals.hButtonFont)
SendMessage(button->hWnd, WM_SETFONT, (WPARAM)Globals.hButtonFont, TRUE); SendMessageW(button->hWnd, WM_SETFONT, (WPARAM)Globals.hButtonFont, TRUE);
} }
} }
hDc = GetDC(button->hWnd); hDc = GetDC(button->hWnd);
GetTextExtentPoint(hDc, button->lpszName, GetTextExtentPointA(hDc, button->lpszName, strlen(button->lpszName), &textsize);
lstrlen(button->lpszName), &textsize);
ReleaseDC(button->hWnd, hDc); ReleaseDC(button->hWnd, hDc);
button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX); button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX);
@ -1091,7 +1090,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
break; break;
case WM_COMMAND: case WM_COMMAND:
SendMessage(GetParent(hWnd), msg, wParam, lParam); SendMessageW(GetParent(hWnd), msg, wParam, lParam);
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
@ -1102,12 +1101,12 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa
case VK_PRIOR: case VK_PRIOR:
case VK_NEXT: case VK_NEXT:
case VK_ESCAPE: case VK_ESCAPE:
return SendMessage(GetParent(hWnd), msg, wParam, lParam); return SendMessageA(GetParent(hWnd), msg, wParam, lParam);
} }
break; break;
} }
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProcA(hWnd, msg, wParam, lParam);
} }
/****************************************************************** /******************************************************************
@ -1120,26 +1119,26 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
WINHELP_WINDOW* win; WINHELP_WINDOW* win;
PAINTSTRUCT ps; PAINTSTRUCT ps;
HDC hDc; HDC hDc;
TEXTMETRIC tm; TEXTMETRICW tm;
unsigned int i; unsigned int i;
RECT r; RECT r;
switch (msg) switch (msg)
{ {
case WM_NCCREATE: case WM_NCCREATE:
win = (WINHELP_WINDOW*)((LPCREATESTRUCT)lParam)->lpCreateParams; win = (WINHELP_WINDOW*)((LPCREATESTRUCTA)lParam)->lpCreateParams;
SetWindowLongPtr(hWnd, 0, (ULONG_PTR)win); SetWindowLongPtrW(hWnd, 0, (ULONG_PTR)win);
win->hHistoryWnd = hWnd; win->hHistoryWnd = hWnd;
break; break;
case WM_CREATE: case WM_CREATE:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
hDc = GetDC(hWnd); hDc = GetDC(hWnd);
GetTextMetrics(hDc, &tm); GetTextMetricsW(hDc, &tm);
GetWindowRect(hWnd, &r); GetWindowRect(hWnd, &r);
r.right = r.left + 30 * tm.tmAveCharWidth; r.right = r.left + 30 * tm.tmAveCharWidth;
r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight; r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight;
AdjustWindowRect(&r, GetWindowLong(hWnd, GWL_STYLE), FALSE); AdjustWindowRect(&r, GetWindowLongW(hWnd, GWL_STYLE), FALSE);
if (r.left < 0) {r.right -= r.left; r.left = 0;} if (r.left < 0) {r.right -= r.left; r.left = 0;}
if (r.top < 0) {r.bottom -= r.top; r.top = 0;} if (r.top < 0) {r.bottom -= r.top; r.top = 0;}
@ -1147,9 +1146,9 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
ReleaseDC(hWnd, hDc); ReleaseDC(hWnd, hDc);
break; break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
hDc = GetDC(hWnd); hDc = GetDC(hWnd);
GetTextMetrics(hDc, &tm); GetTextMetricsW(hDc, &tm);
i = HIWORD(lParam) / tm.tmHeight; i = HIWORD(lParam) / tm.tmHeight;
if (i < Globals.history.index) if (i < Globals.history.index)
WINHELP_CreateHelpWindow(&Globals.history.set[i], SW_SHOW, TRUE); WINHELP_CreateHelpWindow(&Globals.history.set[i], SW_SHOW, TRUE);
@ -1157,14 +1156,14 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
break; break;
case WM_PAINT: case WM_PAINT:
hDc = BeginPaint(hWnd, &ps); hDc = BeginPaint(hWnd, &ps);
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
GetTextMetrics(hDc, &tm); GetTextMetricsW(hDc, &tm);
for (i = 0; i < Globals.history.index; i++) for (i = 0; i < Globals.history.index; i++)
{ {
if (Globals.history.set[i].page->file == Globals.active_win->page->file) if (Globals.history.set[i].page->file == Globals.active_win->page->file)
{ {
TextOut(hDc, 0, i * tm.tmHeight, TextOutA(hDc, 0, i * tm.tmHeight,
Globals.history.set[i].page->lpszTitle, Globals.history.set[i].page->lpszTitle,
strlen(Globals.history.set[i].page->lpszTitle)); strlen(Globals.history.set[i].page->lpszTitle));
} }
@ -1185,18 +1184,18 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
if (len < sizeof(buffer)) buffer[len++] = ':'; if (len < sizeof(buffer)) buffer[len++] = ':';
strncpy(&buffer[len], Globals.history.set[i].page->lpszTitle, sizeof(buffer) - len); strncpy(&buffer[len], Globals.history.set[i].page->lpszTitle, sizeof(buffer) - len);
buffer[sizeof(buffer) - 1] = '\0'; buffer[sizeof(buffer) - 1] = '\0';
TextOut(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer)); TextOutA(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer));
} }
} }
EndPaint(hWnd, &ps); EndPaint(hWnd, &ps);
break; break;
case WM_DESTROY: case WM_DESTROY:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
if (hWnd == win->hHistoryWnd) if (hWnd == win->hHistoryWnd)
win->hHistoryWnd = 0; win->hHistoryWnd = 0;
break; break;
} }
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProcA(hWnd, msg, wParam, lParam);
} }
/************************************************************************** /**************************************************************************
@ -1211,9 +1210,9 @@ static void cb_KWBTree(void *p, void **next, void *cookie)
int count; int count;
WINE_TRACE("Adding '%s' to search list\n", (char *)p); WINE_TRACE("Adding '%s' to search list\n", (char *)p);
SendMessage(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p); SendMessageA(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p);
count = SendMessage(hListWnd, LB_GETCOUNT, 0, 0); count = SendMessageW(hListWnd, LB_GETCOUNT, 0, 0);
SendMessage(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p); SendMessageW(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p);
*next = (char*)p + strlen((char*)p) + 7; *next = (char*)p + strlen((char*)p) + 7;
} }
@ -1236,7 +1235,7 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
switch (msg) switch (msg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
id = (struct index_data*)((PROPSHEETPAGE*)lParam)->lParam; id = (struct index_data*)((PROPSHEETPAGEA*)lParam)->lParam;
HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree, HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree,
GetDlgItem(hWnd, IDC_INDEXLIST)); GetDlgItem(hWnd, IDC_INDEXLIST));
id->jump = FALSE; id->jump = FALSE;
@ -1247,7 +1246,7 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
{ {
case LBN_DBLCLK: case LBN_DBLCLK:
if (LOWORD(wParam) == IDC_INDEXLIST) if (LOWORD(wParam) == IDC_INDEXLIST)
SendMessage(GetParent(hWnd), PSM_PRESSBUTTON, PSBTN_OK, 0); SendMessageW(GetParent(hWnd), PSM_PRESSBUTTON, PSBTN_OK, 0);
break; break;
} }
break; break;
@ -1255,31 +1254,30 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam,
switch (((NMHDR*)lParam)->code) switch (((NMHDR*)lParam)->code)
{ {
case PSN_APPLY: case PSN_APPLY:
sel = SendDlgItemMessage(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0); sel = SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0);
if (sel != LB_ERR) if (sel != LB_ERR)
{ {
BYTE *p; BYTE *p;
int count; int count;
p = (BYTE*)SendDlgItemMessage(hWnd, IDC_INDEXLIST, p = (BYTE*)SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETITEMDATA, sel, 0);
LB_GETITEMDATA, sel, 0);
count = *(short*)((char *)p + strlen((char *)p) + 1); count = *(short*)((char *)p + strlen((char *)p) + 1);
if (count > 1) if (count > 1)
{ {
MessageBox(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP); MessageBoxA(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP);
SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_INVALID);
return TRUE; return TRUE;
} }
id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3); id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3);
id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9); id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9);
if (id->offset == 0xFFFFFFFF) if (id->offset == 0xFFFFFFFF)
{ {
MessageBox(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP); MessageBoxA(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP);
SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_INVALID);
return TRUE; return TRUE;
} }
id->jump = TRUE; id->jump = TRUE;
SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR);
} }
return TRUE; return TRUE;
default: default:
@ -1306,7 +1304,7 @@ static INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam
switch (((NMHDR*)lParam)->code) switch (((NMHDR*)lParam)->code)
{ {
case PSN_APPLY: case PSN_APPLY:
SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR);
return TRUE; return TRUE;
default: default:
return FALSE; return FALSE;
@ -1334,19 +1332,19 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
switch (msg) switch (msg)
{ {
case WM_NCCREATE: case WM_NCCREATE:
win = (WINHELP_WINDOW*) ((LPCREATESTRUCT) lParam)->lpCreateParams; win = (WINHELP_WINDOW*) ((LPCREATESTRUCTA) lParam)->lpCreateParams;
SetWindowLongPtr(hWnd, 0, (ULONG_PTR) win); SetWindowLongPtrW(hWnd, 0, (ULONG_PTR) win);
if (!win->page && Globals.isBook) if (!win->page && Globals.isBook)
PostMessage(hWnd, WM_COMMAND, MNID_FILE_OPEN, 0); PostMessageW(hWnd, WM_COMMAND, MNID_FILE_OPEN, 0);
win->hMainWnd = hWnd; win->hMainWnd = hWnd;
break; break;
case WM_WINDOWPOSCHANGED: case WM_WINDOWPOSCHANGED:
WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0)); WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0));
break; break;
case WM_COMMAND: case WM_COMMAND:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
/* Menu FILE */ /* Menu FILE */
@ -1357,7 +1355,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
/* Menu EDIT */ /* Menu EDIT */
case MNID_EDIT_COPYDLG: case MNID_EDIT_COPYDLG:
SendMessage(GetDlgItem(hWnd, CTL_ID_TEXT), WM_COPY, 0, 0); SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0);
break; break;
case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break; case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break;
@ -1376,7 +1374,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case MNID_OPTS_HISTORY: MACRO_History(); break; case MNID_OPTS_HISTORY: MACRO_History(); break;
case MNID_OPTS_FONTS_SMALL: case MNID_OPTS_FONTS_SMALL:
case MNID_CTXT_FONTS_SMALL: case MNID_CTXT_FONTS_SMALL:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
if (win->font_scale != 0) if (win->font_scale != 0)
{ {
win->font_scale = 0; win->font_scale = 0;
@ -1385,7 +1383,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
break; break;
case MNID_OPTS_FONTS_NORMAL: case MNID_OPTS_FONTS_NORMAL:
case MNID_CTXT_FONTS_NORMAL: case MNID_CTXT_FONTS_NORMAL:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
if (win->font_scale != 1) if (win->font_scale != 1)
{ {
win->font_scale = 1; win->font_scale = 1;
@ -1394,7 +1392,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
break; break;
case MNID_OPTS_FONTS_LARGE: case MNID_OPTS_FONTS_LARGE:
case MNID_CTXT_FONTS_LARGE: case MNID_CTXT_FONTS_LARGE:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
if (win->font_scale != 2) if (win->font_scale != 2)
{ {
win->font_scale = 2; win->font_scale = 2;
@ -1409,8 +1407,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
if (button) if (button)
MACRO_ExecuteMacro(win, button->lpszMacro); MACRO_ExecuteMacro(win, button->lpszMacro);
else if (!HIWORD(wParam)) else if (!HIWORD(wParam))
MessageBox(0, MAKEINTRESOURCE(STID_NOT_IMPLEMENTED), MessageBoxW(0, MAKEINTRESOURCEW(STID_NOT_IMPLEMENTED),
MAKEINTRESOURCE(STID_WHERROR), MB_OK); MAKEINTRESOURCEW(STID_WHERROR), MB_OK);
break; break;
} }
break; break;
@ -1423,28 +1421,28 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case WM_CHAR: case WM_CHAR:
if (wParam == 3) if (wParam == 3)
{ {
SendMessage(GetDlgItem(hWnd, CTL_ID_TEXT), WM_COPY, 0, 0); SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0);
return 0; return 0;
} }
break; break;
case WM_KEYDOWN: case WM_KEYDOWN:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT); hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
switch (wParam) switch (wParam)
{ {
case VK_UP: case VK_UP:
SendMessage(hTextWnd, EM_SCROLL, SB_LINEUP, 0); SendMessageW(hTextWnd, EM_SCROLL, SB_LINEUP, 0);
return 0; return 0;
case VK_DOWN: case VK_DOWN:
SendMessage(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0); SendMessageW(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0);
return 0; return 0;
case VK_PRIOR: case VK_PRIOR:
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEUP, 0); SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEUP, 0);
return 0; return 0;
case VK_NEXT: case VK_NEXT:
SendMessage(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0); SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0);
return 0; return 0;
case VK_ESCAPE: case VK_ESCAPE:
MACRO_Exit(); MACRO_Exit();
@ -1466,15 +1464,15 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
{ {
case WM_KEYUP: case WM_KEYUP:
if (msgf->wParam == VK_ESCAPE) if (msgf->wParam == VK_ESCAPE)
WINHELP_ReleaseWindow((WINHELP_WINDOW*)GetWindowLongPtr(hWnd, 0)); WINHELP_ReleaseWindow((WINHELP_WINDOW*)GetWindowLongPtrW(hWnd, 0));
break; break;
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
{ {
HMENU hMenu; HMENU hMenu;
POINT pt; POINT pt;
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
hMenu = LoadMenu(Globals.hInstance, (LPSTR)CONTEXT_MENU); hMenu = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(CONTEXT_MENU));
switch (win->font_scale) switch (win->font_scale)
{ {
case 0: case 0:
@ -1501,7 +1499,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
} }
break; break;
default: default:
return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLongPtr(hWnd, 0), return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLongPtrW(hWnd, 0),
msgf->msg, msgf->lParam); msgf->msg, msgf->lParam);
} }
} }
@ -1509,8 +1507,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
case EN_REQUESTRESIZE: case EN_REQUESTRESIZE:
rc = ((REQRESIZE*)lParam)->rc; rc = ((REQRESIZE*)lParam)->rc;
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
AdjustWindowRect(&rc, GetWindowLong(win->hMainWnd, GWL_STYLE), AdjustWindowRect(&rc, GetWindowLongW(win->hMainWnd, GWL_STYLE),
FALSE); FALSE);
SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0, SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0,
rc.right - rc.left, rc.bottom - rc.top, rc.right - rc.left, rc.bottom - rc.top,
@ -1522,7 +1520,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
break; break;
case WM_INITMENUPOPUP: case WM_INITMENUPOPUP:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_SMALL, CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_SMALL,
MF_BYCOMMAND | (win->font_scale == 0) ? MF_CHECKED : 0); MF_BYCOMMAND | (win->font_scale == 0) ? MF_CHECKED : 0);
CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_NORMAL, CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_NORMAL,
@ -1531,11 +1529,11 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
MF_BYCOMMAND | (win->font_scale == 2) ? MF_CHECKED : 0); MF_BYCOMMAND | (win->font_scale == 2) ? MF_CHECKED : 0);
break; break;
case WM_DESTROY: case WM_DESTROY:
win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0);
WINHELP_DeleteWindow(win); WINHELP_DeleteWindow(win);
break; break;
} }
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProcA(hWnd, msg, wParam, lParam);
} }
/************************************************************************** /**************************************************************************
@ -1547,8 +1545,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
BOOL WINHELP_CreateIndexWindow(BOOL is_search) BOOL WINHELP_CreateIndexWindow(BOOL is_search)
{ {
HPROPSHEETPAGE psPage[3]; HPROPSHEETPAGE psPage[3];
PROPSHEETPAGE psp; PROPSHEETPAGEA psp;
PROPSHEETHEADER psHead; PROPSHEETHEADERA psHead;
struct index_data id; struct index_data id;
char buf[256]; char buf[256];
@ -1571,20 +1569,20 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search)
psp.dwFlags = 0; psp.dwFlags = 0;
psp.hInstance = Globals.hInstance; psp.hInstance = Globals.hInstance;
psp.u.pszTemplate = MAKEINTRESOURCE(IDD_INDEX); psp.u.pszTemplate = MAKEINTRESOURCEA(IDD_INDEX);
psp.lParam = (LPARAM)&id; psp.lParam = (LPARAM)&id;
psp.pfnDlgProc = WINHELP_IndexDlgProc; psp.pfnDlgProc = WINHELP_IndexDlgProc;
psPage[0] = CreatePropertySheetPage(&psp); psPage[0] = CreatePropertySheetPageA(&psp);
psp.u.pszTemplate = MAKEINTRESOURCE(IDD_SEARCH); psp.u.pszTemplate = MAKEINTRESOURCEA(IDD_SEARCH);
psp.lParam = (LPARAM)&id; psp.lParam = (LPARAM)&id;
psp.pfnDlgProc = WINHELP_SearchDlgProc; psp.pfnDlgProc = WINHELP_SearchDlgProc;
psPage[1] = CreatePropertySheetPage(&psp); psPage[1] = CreatePropertySheetPageA(&psp);
memset(&psHead, 0, sizeof(psHead)); memset(&psHead, 0, sizeof(psHead));
psHead.dwSize = sizeof(psHead); psHead.dwSize = sizeof(psHead);
LoadString(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf)); LoadStringA(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf));
strcat(buf, Globals.active_win->info->caption); strcat(buf, Globals.active_win->info->caption);
psHead.pszCaption = buf; psHead.pszCaption = buf;
@ -1594,7 +1592,7 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search)
psHead.u3.phpage = psPage; psHead.u3.phpage = psPage;
psHead.dwFlags = PSH_NOAPPLYNOW; psHead.dwFlags = PSH_NOAPPLYNOW;
PropertySheet(&psHead); PropertySheetA(&psHead);
if (id.jump) if (id.jump)
{ {
WINE_TRACE("got %d as an offset\n", id.offset); WINE_TRACE("got %d as an offset\n", id.offset);
@ -1610,7 +1608,7 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search)
*/ */
static BOOL WINHELP_RegisterWinClasses(void) static BOOL WINHELP_RegisterWinClasses(void)
{ {
WNDCLASSEX class_main, class_button_box, class_history; WNDCLASSEXA class_main, class_button_box, class_history;
class_main.cbSize = sizeof(class_main); class_main.cbSize = sizeof(class_main);
class_main.style = CS_HREDRAW | CS_VREDRAW; class_main.style = CS_HREDRAW | CS_VREDRAW;
@ -1618,12 +1616,12 @@ static BOOL WINHELP_RegisterWinClasses(void)
class_main.cbClsExtra = 0; class_main.cbClsExtra = 0;
class_main.cbWndExtra = sizeof(WINHELP_WINDOW *); class_main.cbWndExtra = sizeof(WINHELP_WINDOW *);
class_main.hInstance = Globals.hInstance; class_main.hInstance = Globals.hInstance;
class_main.hIcon = LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP)); class_main.hIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP));
class_main.hCursor = LoadCursor(0, IDC_ARROW); class_main.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW);
class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
class_main.lpszMenuName = 0; class_main.lpszMenuName = 0;
class_main.lpszClassName = MAIN_WIN_CLASS_NAME; class_main.lpszClassName = MAIN_WIN_CLASS_NAME;
class_main.hIconSm = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP), IMAGE_ICON, class_main.hIconSm = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP), IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
LR_SHARED); LR_SHARED);
@ -1637,9 +1635,9 @@ static BOOL WINHELP_RegisterWinClasses(void)
class_history.lpfnWndProc = WINHELP_HistoryWndProc; class_history.lpfnWndProc = WINHELP_HistoryWndProc;
class_history.lpszClassName = HISTORY_WIN_CLASS_NAME; class_history.lpszClassName = HISTORY_WIN_CLASS_NAME;
return (RegisterClassEx(&class_main) && return (RegisterClassExA(&class_main) &&
RegisterClassEx(&class_button_box) && RegisterClassExA(&class_button_box) &&
RegisterClassEx(&class_history)); RegisterClassExA(&class_history));
} }
/*********************************************************************** /***********************************************************************
@ -1658,9 +1656,9 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
Globals.hInstance = hInstance; Globals.hInstance = hInstance;
if (LoadLibrary("riched20.dll") == NULL) if (LoadLibraryA("riched20.dll") == NULL)
return MessageBox(0, MAKEINTRESOURCE(STID_NO_RICHEDIT), return MessageBoxW(0, MAKEINTRESOURCEW(STID_NO_RICHEDIT),
MAKEINTRESOURCE(STID_WHERROR), MB_OK); MAKEINTRESOURCEW(STID_WHERROR), MB_OK);
/* Get options */ /* Get options */
while (*cmdline && (*cmdline == ' ' || *cmdline == '-')) while (*cmdline && (*cmdline == ' ' || *cmdline == '-'))
@ -1727,13 +1725,13 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
/* Message loop */ /* Message loop */
hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(MAIN_ACCEL)); hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(MAIN_ACCEL));
while ((Globals.win_list || Globals.active_popup) && GetMessage(&msg, 0, 0, 0)) while ((Globals.win_list || Globals.active_popup) && GetMessageW(&msg, 0, 0, 0))
{ {
HWND hWnd = Globals.active_win ? Globals.active_win->hMainWnd : NULL; HWND hWnd = Globals.active_win ? Globals.active_win->hMainWnd : NULL;
if (!TranslateAcceleratorW(hWnd, hAccel, &msg)) if (!TranslateAcceleratorW(hWnd, hAccel, &msg))
{ {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessageW(&msg);
} }
} }
for (dll = Globals.dlls; dll; dll = dll->next) for (dll = Globals.dlls; dll; dll = dll->next)