From d47984be22c9df3cb880e13deea43de1c6e509b5 Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Fri, 4 Apr 2008 12:21:42 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=32840 --- reactos/dll/win32/hhctrl.ocx/El.rc | 58 +++++++++++++++++++ reactos/dll/win32/hhctrl.ocx/Ru.rc | 58 +++++++++++++++++++ reactos/dll/win32/hhctrl.ocx/chm.c | 37 +++++++++++- reactos/dll/win32/hhctrl.ocx/help.c | 11 ++-- reactos/dll/win32/hhctrl.ocx/hhctrl.c | 1 + reactos/dll/win32/hhctrl.ocx/hhctrl.h | 25 +++++++- .../dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild | 18 +++--- .../dll/win32/hhctrl.ocx/hhctrl.ocx_ros.diff | 16 ----- reactos/dll/win32/hhctrl.ocx/hhctrl.rc | 2 + 9 files changed, 189 insertions(+), 37 deletions(-) create mode 100644 reactos/dll/win32/hhctrl.ocx/El.rc create mode 100644 reactos/dll/win32/hhctrl.ocx/Ru.rc delete mode 100644 reactos/dll/win32/hhctrl.ocx/hhctrl.ocx_ros.diff diff --git a/reactos/dll/win32/hhctrl.ocx/El.rc b/reactos/dll/win32/hhctrl.ocx/El.rc new file mode 100644 index 00000000000..dd81eb68da2 --- /dev/null +++ b/reactos/dll/win32/hhctrl.ocx/El.rc @@ -0,0 +1,58 @@ +/* + * HTML Help resources + * Greek Language Support + * + * Copyright 2008 Apostolos Alexiadis + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_CONTENTS "&Ресйечьменб" + IDS_INDEX "I&ndex" + IDS_SEARCH "&БнбжЮфзуз" + IDS_FAVORITES "Б&гбрзмЭнб" +END + +STRINGTABLE +BEGIN + IDTB_EXPAND "ЕмцЬнйуз" + IDTB_CONTRACT "Брьксхшз" + IDTB_STOP "Фесмбфйумьт" + IDTB_REFRESH "БнбнЭщуз" + IDTB_BACK "РЯущ" + IDTB_HOME "Home" + IDTB_SYNC "Sync" + IDTB_PRINT "Екфэрщуз" + IDTB_OPTIONS "ЕрйлпгЭт" + IDTB_FORWARD "Forward" + IDTB_NOTES "IDTB_NOTES" + IDTB_BROWSE_FWD "IDTB_BROWSE_FWD" + IDTB_BROWSE_BACK "IDT_BROWSE_BACK" + IDTB_CONTENTS "IDTB_CONTENTS" + IDTB_INDEX "IDTB_INDEX" + IDTB_SEARCH "IDTB_SEARCH" + IDTB_HISTORY "IDTB_HISTORY" + IDTB_FAVORITES "IDTB_FAVORITES" + IDTB_JUMP1 "Jump1" + IDTB_JUMP2 "Jump2" + IDTB_CUSTOMIZE "Customize" + IDTB_ZOOM "Zoom" + IDTB_TOC_NEXT "IDTB_TOC_NEXT" + IDTB_TOC_PREV "IDTB_TOC_PREV" +END diff --git a/reactos/dll/win32/hhctrl.ocx/Ru.rc b/reactos/dll/win32/hhctrl.ocx/Ru.rc new file mode 100644 index 00000000000..43330336d2e --- /dev/null +++ b/reactos/dll/win32/hhctrl.ocx/Ru.rc @@ -0,0 +1,58 @@ +/* + * HTML Help resources + * Russia Language Support + * + * Copyright 2008 Vitaliy Margolen + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_CONTENTS "&Содержание" + IDS_INDEX "&Оглавление" + IDS_SEARCH "&Поиск" + IDS_FAVORITES "&Избранное" +END + +STRINGTABLE +BEGIN + IDTB_EXPAND "Показать" + IDTB_CONTRACT "Спрятать" + IDTB_STOP "Остановить" + IDTB_REFRESH "Обновить" + IDTB_BACK "Назад" + IDTB_HOME "В начало" + IDTB_SYNC "Синхронизировать" + IDTB_PRINT "Печять" + IDTB_OPTIONS "Настройки" + IDTB_FORWARD "В перёд" + IDTB_NOTES "Записки" + IDTB_BROWSE_FWD "Просмотр в перёд" + IDTB_BROWSE_BACK "Просмотр назад" + IDTB_CONTENTS "Содержание" + IDTB_INDEX "Оглавление" + IDTB_SEARCH "Поиск" + IDTB_HISTORY "История" + IDTB_FAVORITES "Избранное" + IDTB_JUMP1 "Переход 1" + IDTB_JUMP2 "Переход 2" + IDTB_CUSTOMIZE "Персонализовать" + IDTB_ZOOM "Масштаб" + IDTB_TOC_NEXT "Следующая глава" + IDTB_TOC_PREV "Предыдущая глава" +END diff --git a/reactos/dll/win32/hhctrl.ocx/chm.c b/reactos/dll/win32/hhctrl.ocx/chm.c index 013cb7dca8e..ece05f06202 100644 --- a/reactos/dll/win32/hhctrl.ocx/chm.c +++ b/reactos/dll/win32/hhctrl.ocx/chm.c @@ -113,11 +113,20 @@ static BOOL ReadChmSystem(CHMInfo *chm) break; switch(entry.code) { + case 0x0: + TRACE("TOC is %s\n", debugstr_an(buf, entry.len)); + heap_free(chm->defToc); + chm->defToc = strdupnAtoW(buf, entry.len); + break; case 0x2: TRACE("Default topic is %s\n", debugstr_an(buf, entry.len)); + heap_free(chm->defTopic); + chm->defTopic = strdupnAtoW(buf, entry.len); break; case 0x3: TRACE("Title is %s\n", debugstr_an(buf, entry.len)); + heap_free(chm->defTitle); + chm->defTitle = strdupnAtoW(buf, entry.len); break; case 0x5: TRACE("Default window is %s\n", debugstr_an(buf, entry.len)); @@ -212,7 +221,26 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream); if (FAILED(hr)) - return FALSE; + { + /* no defined window types so use (hopefully) sane defaults */ + static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'}; + static const WCHAR null[] = {0}; + memset((void*)&(info->WinType), 0, sizeof(info->WinType)); + info->WinType.cbStruct=sizeof(info->WinType); + info->WinType.fUniCodeStrings=TRUE; + info->WinType.pszType=strdupW(defaultwinW); + info->WinType.pszToc = strdupW(info->pCHMInfo->defToc); + info->WinType.pszIndex = strdupW(null); + info->WinType.fsValidMembers=0; + info->WinType.fsWinProperties=HHWIN_PROP_TRI_PANE; + info->WinType.pszCaption=strdupW(info->pCHMInfo->defTitle); + info->WinType.dwStyles=WS_POPUP; + info->WinType.dwExStyles=0; + info->WinType.nShowState=SW_SHOW; + info->WinType.pszFile=strdupW(info->pCHMInfo->defTopic); + info->WinType.curNavType=HHWIN_NAVTYPE_TOC; + return TRUE; + } /* jump past the #WINDOWS header */ liOffset.QuadPart = sizeof(DWORD) * 2; @@ -304,7 +332,7 @@ void SetChmPath(ChmPath *file, LPCWSTR base_file, LPCWSTR path) IStream *GetChmStream(CHMInfo *info, LPCWSTR parent_chm, ChmPath *chm_file) { IStorage *storage; - IStream *stream; + IStream *stream = NULL; HRESULT hres; TRACE("%s (%s :: %s)\n", debugstr_w(parent_chm), debugstr_w(chm_file->chm_file), @@ -342,7 +370,7 @@ CHMInfo *OpenCHM(LPCWSTR szFile) CHMInfo *ret = heap_alloc_zero(sizeof(CHMInfo)); - res = GetFullPathNameW(szFile, sizeof(file), file, NULL); + res = GetFullPathNameW(szFile, sizeof(file)/sizeof(file[0]), file, NULL); ret->szFile = strdupW(file); hres = CoCreateInstance(&CLSID_ITStorage, NULL, CLSCTX_INPROC_SERVER, @@ -393,6 +421,9 @@ CHMInfo *CloseCHM(CHMInfo *chm) } heap_free(chm->strings); + heap_free(chm->defTitle); + heap_free(chm->defTopic); + heap_free(chm->defToc); heap_free(chm); return NULL; diff --git a/reactos/dll/win32/hhctrl.ocx/help.c b/reactos/dll/win32/hhctrl.ocx/help.c index c49d3cff092..3ee522ef92f 100644 --- a/reactos/dll/win32/hhctrl.ocx/help.c +++ b/reactos/dll/win32/hhctrl.ocx/help.c @@ -51,13 +51,14 @@ static const WCHAR szEmpty[] = {0}; static LPWSTR HH_LoadString(DWORD dwID) { LPWSTR string = NULL; + LPCWSTR stringresource; int iSize; - iSize = LoadStringW(hhctrl_hinstance, dwID, NULL, 0); - iSize += 2; /* some strings (tab text) needs double-null termination */ + iSize = LoadStringW(hhctrl_hinstance, dwID, (LPWSTR)&stringresource, 0); - string = heap_alloc(iSize * sizeof(WCHAR)); - LoadStringW(hhctrl_hinstance, dwID, string, iSize); + string = heap_alloc((iSize + 2) * sizeof(WCHAR)); /* some strings (tab text) needs double-null termination */ + memcpy(string, stringresource, iSize*sizeof(WCHAR)); + string[iSize] = 0; return string; } @@ -115,7 +116,7 @@ BOOL NavigateToChm(HHInfo *info, LPCWSTR file, LPCWSTR index) if (!info->web_browser) return FALSE; - if(!GetFullPathNameW(file, sizeof(full_path), full_path, NULL)) { + if(!GetFullPathNameW(file, sizeof(full_path)/sizeof(full_path[0]), full_path, NULL)) { WARN("GetFullPathName failed: %u\n", GetLastError()); return FALSE; } diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.c b/reactos/dll/win32/hhctrl.ocx/hhctrl.c index f8b5c99dc6a..472b7cfc310 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.c +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.c @@ -114,6 +114,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat memcpy(chm_file, filename, (index-filename)*sizeof(WCHAR)); chm_file[index-filename] = 0; filename = chm_file; + index += 2; /* advance beyond "::" for calling NavigateToChm() later */ } else { diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.h b/reactos/dll/win32/hhctrl.ocx/hhctrl.h index 26c9d4da7eb..6f7c96b63c4 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.h +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.h @@ -74,6 +74,10 @@ typedef struct CHMInfo IStream *strings_stream; char **strings; DWORD strings_size; + + WCHAR *defTopic; + WCHAR *defTitle; + WCHAR *defToc; } CHMInfo; #define TAB_CONTENTS 0 @@ -177,7 +181,7 @@ static inline LPWSTR strdupW(LPCWSTR str) return ret; } -static inline LPWSTR strdupAtoW(LPCSTR str) +static inline LPWSTR strdupnAtoW(LPCSTR str, LONG lenA) { LPWSTR ret; DWORD len; @@ -185,13 +189,28 @@ static inline LPWSTR strdupAtoW(LPCSTR str) if(!str) return NULL; - len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + if (lenA > 0) + { + /* find length of string */ + LPCSTR eos = memchr(str, 0, lenA); + if (eos) lenA = eos - str; + } + + len = MultiByteToWideChar(CP_ACP, 0, str, lenA, NULL, 0)+1; /* +1 for null pad */ ret = heap_alloc(len*sizeof(WCHAR)); - MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + MultiByteToWideChar(CP_ACP, 0, str, lenA, ret, len); + ret[len-1] = 0; return ret; } +static inline LPWSTR strdupAtoW(LPCSTR str) +{ + return strdupnAtoW(str, -1); +} + + + extern HINSTANCE hhctrl_hinstance; extern BOOL hh_process; diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild b/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild index 676b04c3bb0..5156f631a8e 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild @@ -6,11 +6,17 @@ . include/reactos/wine - include/reactos 0x600 0x600 - wineheaders + chm.c + content.c + help.c + hhctrl.c + regsvr.c + webbrowser.c + hhctrl.rc + hhctrl.ocx.spec wine advapi32 comctl32 @@ -22,13 +28,5 @@ kernel32 uuid ntdll - chm.c - content.c - help.c - hhctrl.c - regsvr.c - webbrowser.c - hhctrl.rc - hhctrl.ocx.spec diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx_ros.diff b/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx_ros.diff deleted file mode 100644 index 63b8c99d2c7..00000000000 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.ocx_ros.diff +++ /dev/null @@ -1,16 +0,0 @@ -Index: hhctrl.ocx.rbuild -=================================================================== ---- hhctrl.ocx.rbuild (revision 27782) -+++ hhctrl.ocx.rbuild (working copy) -@@ -5,9 +5,11 @@ - - . - include/reactos/wine -+ include/reactos - - 0x600 - 0x600 -+ wineheaders - wine - advapi32 - comctl32 diff --git a/reactos/dll/win32/hhctrl.ocx/hhctrl.rc b/reactos/dll/win32/hhctrl.ocx/hhctrl.rc index 1b64557a21f..2c195d43d44 100644 --- a/reactos/dll/win32/hhctrl.ocx/hhctrl.rc +++ b/reactos/dll/win32/hhctrl.ocx/hhctrl.rc @@ -31,6 +31,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "Cs.rc" #include "De.rc" +#include "El.rc" #include "En.rc" #include "Fr.rc" #include "Fi.rc" @@ -39,5 +40,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "Nl.rc" #include "No.rc" #include "Pl.rc" +#include "Ru.rc" #include "Sv.rc" #include "Tr.rc"