[HHCTRL.OCX] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-15 12:19:43 +01:00
parent 1a951aa4e6
commit 96f371dcdb
15 changed files with 204 additions and 92 deletions

View file

@ -15,7 +15,7 @@ list(APPEND SOURCE
search.c
stream.c
webbrowser.c
hhctrl.h)
precomp.h)
add_library(hhctrl SHARED
${SOURCE}
@ -34,5 +34,5 @@ set_module_type(hhctrl win32ocx)
target_link_libraries(hhctrl uuid wine)
add_importlibs(hhctrl advapi32 comctl32 shlwapi ole32 oleaut32 user32 gdi32 msvcrt kernel32 ntdll)
add_dependencies(hhctrl stdole2 wineheaders)
add_pch(hhctrl hhctrl.h SOURCE)
add_pch(hhctrl precomp.h SOURCE)
add_cd_file(TARGET hhctrl DESTINATION reactos/system32 FOR all)

View file

@ -20,9 +20,13 @@
*/
#include "hhctrl.h"
#include "stream.h"
#include <winreg.h>
#include <shlwapi.h>
#include "winreg.h"
#include "shlwapi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
/* Reads a string from the #STRINGS section in the CHM file */
static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
@ -304,15 +308,31 @@ void MergeChmProperties(HH_WINTYPEW *src, HHInfo *info, BOOL override)
#endif
}
static inline WCHAR *ConvertChmString(HHInfo *info, const WCHAR **str)
static inline WCHAR *ConvertChmString(HHInfo *info, DWORD id)
{
WCHAR *ret = NULL;
if(*str)
*str = ret = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)*str));
if(id)
ret = strdupAtoW(GetChmString(info->pCHMInfo, id));
return ret;
}
static inline void wintype_free(HH_WINTYPEW *wintype)
{
heap_free((void *)wintype->pszType);
heap_free((void *)wintype->pszCaption);
heap_free(wintype->paInfoTypes);
heap_free((void *)wintype->pszToc);
heap_free((void *)wintype->pszIndex);
heap_free((void *)wintype->pszFile);
heap_free((void *)wintype->pszHome);
heap_free((void *)wintype->pszJump1);
heap_free((void *)wintype->pszJump2);
heap_free((void *)wintype->pszUrlJump1);
heap_free((void *)wintype->pszUrlJump2);
heap_free((void *)wintype->pszCustomTabs);
}
/* Loads the HH_WINTYPE data from the CHM file
*
* FIXME: There may be more than one window type in the file, so
@ -321,8 +341,6 @@ static inline WCHAR *ConvertChmString(HHInfo *info, const WCHAR **str)
BOOL LoadWinTypeFromCHM(HHInfo *info)
{
LARGE_INTEGER liOffset;
WCHAR *pszType = NULL, *pszFile = NULL, *pszToc = NULL, *pszIndex = NULL, *pszCaption = NULL;
WCHAR *pszHome = NULL, *pszJump1 = NULL, *pszJump2 = NULL, *pszUrlJump1 = NULL, *pszUrlJump2 = NULL;
IStorage *pStorage = info->pCHMInfo->pStorage;
IStream *pStream = NULL;
HH_WINTYPEW wintype;
@ -330,11 +348,57 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
DWORD cbRead;
BOOL ret = FALSE;
static const WCHAR null[] = {0};
static const WCHAR empty[] = {0};
static const WCHAR toc_extW[] = {'h','h','c',0};
static const WCHAR index_extW[] = {'h','h','k',0};
static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0};
/* HH_WINTYPE as stored on disk. It's identical to HH_WINTYPE except that the pointer fields
have been changed to DWORDs, so that the layout on 64-bit remains unchanged. */
struct file_wintype
{
int cbStruct;
BOOL fUniCodeStrings;
DWORD pszType;
DWORD fsValidMembers;
DWORD fsWinProperties;
DWORD pszCaption;
DWORD dwStyles;
DWORD dwExStyles;
RECT rcWindowPos;
int nShowState;
DWORD hwndHelp;
DWORD hwndCaller;
DWORD paInfoTypes;
DWORD hwndToolBar;
DWORD hwndNavigation;
DWORD hwndHTML;
int iNavWidth;
RECT rcHTML;
DWORD pszToc;
DWORD pszIndex;
DWORD pszFile;
DWORD pszHome;
DWORD fsToolBarFlags;
BOOL fNotExpanded;
int curNavType;
int tabpos;
int idNotify;
BYTE tabOrder[HH_MAX_TABS+1];
int cHistory;
DWORD pszJump1;
DWORD pszJump2;
DWORD pszUrlJump1;
DWORD pszUrlJump2;
RECT rcMinSize;
int cbInfoTypes;
DWORD pszCustomTabs;
} file_wintype;
memset(&wintype, 0, sizeof(wintype));
wintype.cbStruct = sizeof(wintype);
wintype.fUniCodeStrings = TRUE;
hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream);
if (SUCCEEDED(hr))
{
@ -345,31 +409,45 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
if (FAILED(hr)) goto done;
/* read the HH_WINTYPE struct data */
hr = IStream_Read(pStream, &wintype, sizeof(wintype), &cbRead);
hr = IStream_Read(pStream, &file_wintype, sizeof(file_wintype), &cbRead);
if (FAILED(hr)) goto done;
/* convert the #STRINGS offsets to actual strings */
pszType = ConvertChmString(info, &wintype.pszType);
pszFile = ConvertChmString(info, &wintype.pszFile);
pszToc = ConvertChmString(info, &wintype.pszToc);
pszIndex = ConvertChmString(info, &wintype.pszIndex);
pszCaption = ConvertChmString(info, &wintype.pszCaption);
pszHome = ConvertChmString(info, &wintype.pszHome);
pszJump1 = ConvertChmString(info, &wintype.pszJump1);
pszJump2 = ConvertChmString(info, &wintype.pszJump2);
pszUrlJump1 = ConvertChmString(info, &wintype.pszUrlJump1);
pszUrlJump2 = ConvertChmString(info, &wintype.pszUrlJump2);
wintype.pszType = ConvertChmString(info, file_wintype.pszType);
wintype.fsValidMembers = file_wintype.fsValidMembers;
wintype.fsWinProperties = file_wintype.fsWinProperties;
wintype.pszCaption = ConvertChmString(info, file_wintype.pszCaption);
wintype.dwStyles = file_wintype.dwStyles;
wintype.dwExStyles = file_wintype.dwExStyles;
wintype.rcWindowPos = file_wintype.rcWindowPos;
wintype.nShowState = file_wintype.nShowState;
wintype.iNavWidth = file_wintype.iNavWidth;
wintype.rcHTML = file_wintype.rcHTML;
wintype.pszToc = ConvertChmString(info, file_wintype.pszToc);
wintype.pszIndex = ConvertChmString(info, file_wintype.pszIndex);
wintype.pszFile = ConvertChmString(info, file_wintype.pszFile);
wintype.pszHome = ConvertChmString(info, file_wintype.pszHome);
wintype.fsToolBarFlags = file_wintype.fsToolBarFlags;
wintype.fNotExpanded = file_wintype.fNotExpanded;
wintype.curNavType = file_wintype.curNavType;
wintype.tabpos = file_wintype.tabpos;
wintype.idNotify = file_wintype.idNotify;
memcpy(&wintype.tabOrder, file_wintype.tabOrder, sizeof(wintype.tabOrder));
wintype.cHistory = file_wintype.cHistory;
wintype.pszJump1 = ConvertChmString(info, file_wintype.pszJump1);
wintype.pszJump2 = ConvertChmString(info, file_wintype.pszJump2);
wintype.pszUrlJump1 = ConvertChmString(info, file_wintype.pszUrlJump1);
wintype.pszUrlJump2 = ConvertChmString(info, file_wintype.pszUrlJump2);
wintype.rcMinSize = file_wintype.rcMinSize;
wintype.cbInfoTypes = file_wintype.cbInfoTypes;
}
else
{
/* no defined window types so use (hopefully) sane defaults */
static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'};
memset(&wintype, 0, sizeof(wintype));
wintype.cbStruct = sizeof(wintype);
wintype.fUniCodeStrings = TRUE;
wintype.pszType = pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
wintype.pszToc = pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : null);
wintype.pszIndex = pszIndex = strdupW(null);
wintype.pszType = strdupW(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW);
wintype.pszToc = strdupW(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty);
wintype.pszIndex = strdupW(empty);
wintype.fsValidMembers = 0;
wintype.fsWinProperties = HHWIN_PROP_TRI_PANE;
wintype.dwStyles = WS_POPUP;
@ -381,24 +459,15 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
/* merge the new data with any pre-existing HH_WINTYPE structure */
MergeChmProperties(&wintype, info, FALSE);
if (!info->WinType.pszCaption)
info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : null);
info->WinType.pszCaption = info->stringsW.pszCaption = strdupW(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty);
if (!info->WinType.pszFile)
info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : null);
info->WinType.pszFile = info->stringsW.pszFile = strdupW(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty);
if (!info->WinType.pszToc)
info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW);
if (!info->WinType.pszIndex)
info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW);
heap_free(pszType);
heap_free(pszFile);
heap_free(pszToc);
heap_free(pszIndex);
heap_free(pszCaption);
heap_free(pszHome);
heap_free(pszJump1);
heap_free(pszJump2);
heap_free(pszUrlJump1);
heap_free(pszUrlJump2);
wintype_free(&wintype);
ret = TRUE;
done:

View file

@ -17,7 +17,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define NONAMELESSUNION
#include "hhctrl.h"
#include "stream.h"
#include "resource.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
typedef enum {
INSERT_NEXT,

View file

@ -22,8 +22,15 @@
#include "hhctrl.h"
#include <wingdi.h>
#include <wininet.h>
#include "wingdi.h"
#include "commctrl.h"
#include "wininet.h"
#include "wine/debug.h"
#include "resource.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
static LRESULT Help_OnSize(HWND hWnd);
static void ExpandContract(HHInfo *pHHInfo);

View file

@ -19,9 +19,24 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wine/debug.h"
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "htmlhelp.h"
#include "ole2.h"
#include "rpcproxy.h"
#define INIT_GUID
#include "hhctrl.h"
#include <rpcproxy.h>
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
HINSTANCE hhctrl_hinstance;
BOOL hh_process = FALSE;

View file

@ -22,32 +22,26 @@
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define COBJMACROS
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <htmlhelp.h>
#include <ole2.h>
#include <exdisp.h>
#include <mshtmhst.h>
#include <commctrl.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "htmlhelp.h"
#include "ole2.h"
#include "exdisp.h"
#include "mshtmhst.h"
#include "commctrl.h"
#include <wine/itss.h>
#include <wine/unicode.h>
#include <wine/list.h>
#ifdef INIT_GUID
#include "initguid.h"
#endif
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
#include "resource.h"
#include "stream.h"
#include "wine/itss.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
#define WB_GOBACK 0
#define WB_GOFORWARD 1
@ -251,31 +245,11 @@ HHInfo *find_window(const WCHAR *window) DECLSPEC_HIDDEN;
/* memory allocation functions */
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
}
static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
}
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
}
static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len)
{
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline LPWSTR strdupW(LPCWSTR str)
{
LPWSTR ret;
@ -337,4 +311,4 @@ static inline LPSTR strdupWtoA(LPCWSTR str)
extern HINSTANCE hhctrl_hinstance DECLSPEC_HIDDEN;
extern BOOL hh_process DECLSPEC_HIDDEN;
#endif /* HHCTRL_H */
#endif

View file

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windef.h>
#include <htmlhelp.h>
#include "resource.h"
/* UTF-8 */
@ -115,7 +112,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define WINE_PRODUCTVERSION 5,2,3790,2744
#define WINE_PRODUCTVERSION_STR "5.2.3790.2744"
#include <wine/wine_common_ver.rc>
#include "wine/wine_common_ver.rc"
/* @makedep: hhtoolbar.bmp */
IDB_HHTOOLBAR BITMAP "res/hhtoolbar.bmp"

View file

@ -18,6 +18,11 @@
*/
#include "hhctrl.h"
#include "stream.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
/* Fill the TreeView object corresponding to the Index items */
static void fill_index_tree(HWND hwnd, IndexItem *item)

View file

@ -0,0 +1,19 @@
#ifndef _HHCTRL_PRECOMP_H
#define _HHCTRL_PRECOMP_H
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include "hhctrl.h"
#include <wine/debug.h>
#include "resource.h"
#include "stream.h"
#endif /* !_HHCTRL_PRECOMP_H */

View file

@ -20,6 +20,11 @@
#pragma once
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <htmlhelp.h>
#define IDS_CONTENTS 1
#define IDS_INDEX 2
#define IDS_SEARCH 3

View file

@ -17,6 +17,11 @@
*/
#include "hhctrl.h"
#include "stream.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
static SearchItem *SearchCHM_Folder(SearchItem *item, IStorage *pStorage,
const WCHAR *folder, const char *needle);

View file

@ -17,6 +17,11 @@
*/
#include "hhctrl.h"
#include "stream.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
void strbuf_init(strbuf_t *buf)
{

View file

@ -45,4 +45,4 @@ BOOL next_content(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
BOOL next_node(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
const char *get_attr(const char *node, const char *name, int *len) DECLSPEC_HIDDEN;
#endif /* HHCTRL_STREAM_H */
#endif

View file

@ -19,8 +19,11 @@
*/
#include "hhctrl.h"
#include "resource.h"
#include <mshtmhst.h>
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp);
static inline WebBrowserContainer *impl_from_IOleClientSite(IOleClientSite *iface)
{

View file

@ -69,7 +69,7 @@ reactos/dll/win32/faultrep # Synced to WineStaging-2.9
reactos/dll/win32/fontsub # Synced to WineStaging-2.9
reactos/dll/win32/fusion # Synced to WineStaging-3.3
reactos/dll/win32/gdiplus # Synced to WineStaging-3.3
reactos/dll/win32/hhctrl.ocx # Synced to Wine-3.0
reactos/dll/win32/hhctrl.ocx # Synced to WineStaging-3.3
reactos/dll/win32/hlink # Synced to Wine-3.0
reactos/dll/win32/hnetcfg # Synced to Wine-3.0
reactos/dll/win32/httpapi # Synced to WineStaging-2.9