mirror of
https://github.com/reactos/reactos.git
synced 2025-06-06 01:40:36 +00:00
Autosyncing with Wine HEAD
svn path=/trunk/; revision=31776
This commit is contained in:
parent
3a6d558da6
commit
d33ed41a92
7 changed files with 89 additions and 75 deletions
|
@ -39,10 +39,10 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
|
||||||
|
|
||||||
if(chm->strings_size <= (offset >> BLOCK_BITS)) {
|
if(chm->strings_size <= (offset >> BLOCK_BITS)) {
|
||||||
if(chm->strings)
|
if(chm->strings)
|
||||||
chm->strings = hhctrl_realloc_zero(chm->strings,
|
chm->strings = heap_realloc_zero(chm->strings,
|
||||||
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
||||||
else
|
else
|
||||||
chm->strings = hhctrl_alloc_zero(
|
chm->strings = heap_alloc_zero(
|
||||||
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
chm->strings_size = ((offset >> BLOCK_BITS)+1)*sizeof(char*));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -59,13 +59,13 @@ static LPCSTR GetChmString(CHMInfo *chm, DWORD offset)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
chm->strings[offset >> BLOCK_BITS] = hhctrl_alloc(BLOCK_SIZE);
|
chm->strings[offset >> BLOCK_BITS] = heap_alloc(BLOCK_SIZE);
|
||||||
|
|
||||||
hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS],
|
hres = IStream_Read(chm->strings_stream, chm->strings[offset >> BLOCK_BITS],
|
||||||
BLOCK_SIZE, &read);
|
BLOCK_SIZE, &read);
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
WARN("Read failed: %08x\n", hres);
|
WARN("Read failed: %08x\n", hres);
|
||||||
hhctrl_free(chm->strings[offset >> BLOCK_BITS]);
|
heap_free(chm->strings[offset >> BLOCK_BITS]);
|
||||||
chm->strings[offset >> BLOCK_BITS] = NULL;
|
chm->strings[offset >> BLOCK_BITS] = NULL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||||
IStream_Read(stream, &ver, sizeof(ver), &read);
|
IStream_Read(stream, &ver, sizeof(ver), &read);
|
||||||
TRACE("version is %x\n", ver);
|
TRACE("version is %x\n", ver);
|
||||||
|
|
||||||
buf = hhctrl_alloc(8*sizeof(DWORD));
|
buf = heap_alloc(8*sizeof(DWORD));
|
||||||
buf_size = 8*sizeof(DWORD);
|
buf_size = 8*sizeof(DWORD);
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
@ -106,7 +106,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(entry.len > buf_size)
|
if(entry.len > buf_size)
|
||||||
buf = hhctrl_realloc(buf, buf_size=entry.len);
|
buf = heap_realloc(buf, buf_size=entry.len);
|
||||||
|
|
||||||
hres = IStream_Read(stream, buf, entry.len, &read);
|
hres = IStream_Read(stream, buf, entry.len, &read);
|
||||||
if(hres != S_OK)
|
if(hres != S_OK)
|
||||||
|
@ -142,7 +142,7 @@ static BOOL ReadChmSystem(CHMInfo *chm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hhctrl_free(buf);
|
heap_free(buf);
|
||||||
IStream_Release(stream);
|
IStream_Release(stream);
|
||||||
|
|
||||||
return SUCCEEDED(hres);
|
return SUCCEEDED(hres);
|
||||||
|
@ -171,12 +171,12 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = hhctrl_alloc(size);
|
buf = heap_alloc(size);
|
||||||
hres = IStream_Read(ivb_stream, buf, size, &read);
|
hres = IStream_Read(ivb_stream, buf, size, &read);
|
||||||
IStream_Release(ivb_stream);
|
IStream_Release(ivb_stream);
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
WARN("Read failed: %08x\n", hres);
|
WARN("Read failed: %08x\n", hres);
|
||||||
hhctrl_free(buf);
|
heap_free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hhctrl_free(buf);
|
heap_free(buf);
|
||||||
|
|
||||||
TRACE("returning %s\n", debugstr_a(ret));
|
TRACE("returning %s\n", debugstr_a(ret));
|
||||||
return strdupAtoW(ret);
|
return strdupAtoW(ret);
|
||||||
|
@ -200,10 +200,10 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
|
||||||
* FIXME: There may be more than one window type in the file, so
|
* FIXME: There may be more than one window type in the file, so
|
||||||
* add the ability to choose a certain window type
|
* add the ability to choose a certain window type
|
||||||
*/
|
*/
|
||||||
BOOL LoadWinTypeFromCHM(CHMInfo *pChmInfo, HH_WINTYPEW *pHHWinType)
|
BOOL LoadWinTypeFromCHM(HHInfo *info)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER liOffset;
|
LARGE_INTEGER liOffset;
|
||||||
IStorage *pStorage = pChmInfo->pStorage;
|
IStorage *pStorage = info->pCHMInfo->pStorage;
|
||||||
IStream *pStream;
|
IStream *pStream;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DWORD cbRead;
|
DWORD cbRead;
|
||||||
|
@ -221,26 +221,26 @@ BOOL LoadWinTypeFromCHM(CHMInfo *pChmInfo, HH_WINTYPEW *pHHWinType)
|
||||||
if (FAILED(hr)) goto done;
|
if (FAILED(hr)) goto done;
|
||||||
|
|
||||||
/* read the HH_WINTYPE struct data */
|
/* read the HH_WINTYPE struct data */
|
||||||
hr = IStream_Read(pStream, pHHWinType, sizeof(*pHHWinType), &cbRead);
|
hr = IStream_Read(pStream, &info->WinType, sizeof(info->WinType), &cbRead);
|
||||||
if (FAILED(hr)) goto done;
|
if (FAILED(hr)) goto done;
|
||||||
|
|
||||||
/* convert the #STRINGS offsets to actual strings */
|
/* convert the #STRINGS offsets to actual strings */
|
||||||
pHHWinType->pszType = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszType));
|
info->WinType.pszType = info->pszType = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszType));
|
||||||
pHHWinType->pszCaption = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszCaption));
|
info->WinType.pszCaption = info->pszCaption = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszCaption));
|
||||||
pHHWinType->pszToc = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszToc));
|
info->WinType.pszToc = info->pszToc = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszToc));
|
||||||
pHHWinType->pszIndex = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszIndex));
|
info->WinType.pszIndex = info->pszIndex = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszIndex));
|
||||||
pHHWinType->pszFile = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszFile));
|
info->WinType.pszFile = info->pszFile = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszFile));
|
||||||
pHHWinType->pszHome = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszHome));
|
info->WinType.pszHome = info->pszHome = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszHome));
|
||||||
pHHWinType->pszJump1 = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszJump1));
|
info->WinType.pszJump1 = info->pszJump1 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszJump1));
|
||||||
pHHWinType->pszJump2 = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszJump2));
|
info->WinType.pszJump2 = info->pszJump2 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszJump2));
|
||||||
pHHWinType->pszUrlJump1 = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszUrlJump1));
|
info->WinType.pszUrlJump1 = info->pszUrlJump1 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszUrlJump1));
|
||||||
pHHWinType->pszUrlJump2 = strdupAtoW(GetChmString(pChmInfo, (DWORD)pHHWinType->pszUrlJump2));
|
info->WinType.pszUrlJump2 = info->pszUrlJump2 = strdupAtoW(GetChmString(info->pCHMInfo, (DWORD_PTR)info->WinType.pszUrlJump2));
|
||||||
|
|
||||||
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
|
/* FIXME: pszCustomTabs is a list of multiple zero-terminated strings so ReadString won't
|
||||||
* work in this case
|
* work in this case
|
||||||
*/
|
*/
|
||||||
#if 0
|
#if 0
|
||||||
pHHWinType->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->pszCustomTabs);
|
info->WinType.pszCustomTabs = info->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD_PTR)info->WinType.pszCustomTabs);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -340,7 +340,7 @@ CHMInfo *OpenCHM(LPCWSTR szFile)
|
||||||
|
|
||||||
static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
|
static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0};
|
||||||
|
|
||||||
CHMInfo *ret = hhctrl_alloc_zero(sizeof(CHMInfo));
|
CHMInfo *ret = heap_alloc_zero(sizeof(CHMInfo));
|
||||||
|
|
||||||
res = GetFullPathNameW(szFile, sizeof(file), file, NULL);
|
res = GetFullPathNameW(szFile, sizeof(file), file, NULL);
|
||||||
ret->szFile = strdupW(file);
|
ret->szFile = strdupW(file);
|
||||||
|
@ -389,11 +389,11 @@ CHMInfo *CloseCHM(CHMInfo *chm)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0; i<chm->strings_size; i++)
|
for(i=0; i<chm->strings_size; i++)
|
||||||
hhctrl_free(chm->strings[i]);
|
heap_free(chm->strings[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
hhctrl_free(chm->strings);
|
heap_free(chm->strings);
|
||||||
hhctrl_free(chm);
|
heap_free(chm);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,10 +41,10 @@ static void free_content_item(ContentItem *item)
|
||||||
|
|
||||||
free_content_item(item->child);
|
free_content_item(item->child);
|
||||||
|
|
||||||
hhctrl_free(item->name);
|
heap_free(item->name);
|
||||||
hhctrl_free(item->local);
|
heap_free(item->local);
|
||||||
hhctrl_free(item->merge.chm_file);
|
heap_free(item->merge.chm_file);
|
||||||
hhctrl_free(item->merge.chm_index);
|
heap_free(item->merge.chm_index);
|
||||||
|
|
||||||
item = next;
|
item = next;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static void strbuf_init(strbuf_t *buf)
|
||||||
{
|
{
|
||||||
buf->size = 8;
|
buf->size = 8;
|
||||||
buf->len = 0;
|
buf->len = 0;
|
||||||
buf->buf = hhctrl_alloc(buf->size);
|
buf->buf = heap_alloc(buf->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void strbuf_zero(strbuf_t *buf)
|
static void strbuf_zero(strbuf_t *buf)
|
||||||
|
@ -70,14 +70,14 @@ static void strbuf_zero(strbuf_t *buf)
|
||||||
|
|
||||||
static void strbuf_free(strbuf_t *buf)
|
static void strbuf_free(strbuf_t *buf)
|
||||||
{
|
{
|
||||||
hhctrl_free(buf->buf);
|
heap_free(buf->buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void strbuf_append(strbuf_t *buf, const char *data, int len)
|
static void strbuf_append(strbuf_t *buf, const char *data, int len)
|
||||||
{
|
{
|
||||||
if(buf->len+len > buf->size) {
|
if(buf->len+len > buf->size) {
|
||||||
buf->size = buf->len+len;
|
buf->size = buf->len+len;
|
||||||
buf->buf = hhctrl_realloc(buf->buf, buf->size);
|
buf->buf = heap_realloc(buf->buf, buf->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(buf->buf+buf->len, data, len);
|
memcpy(buf->buf+buf->len, data, len);
|
||||||
|
@ -208,13 +208,13 @@ static void parse_obj_node_param(ContentItem *item, ContentItem *hhc_root, const
|
||||||
}
|
}
|
||||||
|
|
||||||
wlen = MultiByteToWideChar(CP_ACP, 0, ptr, len, NULL, 0);
|
wlen = MultiByteToWideChar(CP_ACP, 0, ptr, len, NULL, 0);
|
||||||
*param = hhctrl_alloc((wlen+1)*sizeof(WCHAR));
|
*param = heap_alloc((wlen+1)*sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, ptr, len, *param, wlen);
|
MultiByteToWideChar(CP_ACP, 0, ptr, len, *param, wlen);
|
||||||
(*param)[wlen] = 0;
|
(*param)[wlen] = 0;
|
||||||
|
|
||||||
if(param == &merge) {
|
if(param == &merge) {
|
||||||
SetChmPath(&item->merge, hhc_root->merge.chm_file, merge);
|
SetChmPath(&item->merge, hhc_root->merge.chm_file, merge);
|
||||||
hhctrl_free(merge);
|
heap_free(merge);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ static ContentItem *parse_sitemap_object(HHInfo *info, stream_t *stream, Content
|
||||||
strbuf_init(&node);
|
strbuf_init(&node);
|
||||||
strbuf_init(&node_name);
|
strbuf_init(&node_name);
|
||||||
|
|
||||||
item = hhctrl_alloc_zero(sizeof(ContentItem));
|
item = heap_alloc_zero(sizeof(ContentItem));
|
||||||
|
|
||||||
while(next_node(stream, &node)) {
|
while(next_node(stream, &node)) {
|
||||||
get_node_name(&node, &node_name);
|
get_node_name(&node, &node_name);
|
||||||
|
@ -421,7 +421,7 @@ void InitContent(HHInfo *info)
|
||||||
IStream *stream;
|
IStream *stream;
|
||||||
insert_type_t insert_type;
|
insert_type_t insert_type;
|
||||||
|
|
||||||
info->content = hhctrl_alloc_zero(sizeof(ContentItem));
|
info->content = heap_alloc_zero(sizeof(ContentItem));
|
||||||
SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc);
|
SetChmPath(&info->content->merge, info->pCHMInfo->szFile, info->WinType.pszToc);
|
||||||
|
|
||||||
stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge);
|
stream = GetChmStream(info->pCHMInfo, info->pCHMInfo->szFile, &info->content->merge);
|
||||||
|
|
|
@ -56,7 +56,7 @@ static LPWSTR HH_LoadString(DWORD dwID)
|
||||||
iSize = LoadStringW(hhctrl_hinstance, dwID, NULL, 0);
|
iSize = LoadStringW(hhctrl_hinstance, dwID, NULL, 0);
|
||||||
iSize += 2; /* some strings (tab text) needs double-null termination */
|
iSize += 2; /* some strings (tab text) needs double-null termination */
|
||||||
|
|
||||||
string = hhctrl_alloc(iSize * sizeof(WCHAR));
|
string = heap_alloc(iSize * sizeof(WCHAR));
|
||||||
LoadStringW(hhctrl_hinstance, dwID, string, iSize);
|
LoadStringW(hhctrl_hinstance, dwID, string, iSize);
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
|
@ -95,8 +95,8 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl)
|
||||||
SetChmPath(&chm_path, info->pCHMInfo->szFile, surl);
|
SetChmPath(&chm_path, info->pCHMInfo->szFile, surl);
|
||||||
ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index);
|
ret = NavigateToChm(info, chm_path.chm_file, chm_path.chm_index);
|
||||||
|
|
||||||
hhctrl_free(chm_path.chm_file);
|
heap_free(chm_path.chm_file);
|
||||||
hhctrl_free(chm_path.chm_index);
|
heap_free(chm_path.chm_index);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ static BOOL HH_AddToolbar(HHInfo *pHHInfo)
|
||||||
szBuf[dwLen + 2] = 0; /* Double-null terminate */
|
szBuf[dwLen + 2] = 0; /* Double-null terminate */
|
||||||
|
|
||||||
buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf);
|
buttons[dwIndex].iString = (DWORD)SendMessageW(hToolbar, TB_ADDSTRINGW, 0, (LPARAM)szBuf);
|
||||||
hhctrl_free(szBuf);
|
heap_free(szBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)&buttons);
|
SendMessageW(hToolbar, TB_ADDBUTTONSW, dwNumButtons, (LPARAM)&buttons);
|
||||||
|
@ -623,7 +623,7 @@ static DWORD NP_CreateTab(HINSTANCE hInstance, HWND hwndTabCtrl, DWORD index)
|
||||||
|
|
||||||
ret = SendMessageW( hwndTabCtrl, TCM_INSERTITEMW, index, (LPARAM)&tie );
|
ret = SendMessageW( hwndTabCtrl, TCM_INSERTITEMW, index, (LPARAM)&tie );
|
||||||
|
|
||||||
hhctrl_free(tabText);
|
heap_free(tabText);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -922,16 +922,16 @@ void ReleaseHelpViewer(HHInfo *info)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Free allocated strings */
|
/* Free allocated strings */
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszType);
|
heap_free(info->pszType);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszCaption);
|
heap_free(info->pszCaption);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszToc);
|
heap_free(info->pszToc);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszIndex);
|
heap_free(info->pszIndex);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszFile);
|
heap_free(info->pszFile);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszHome);
|
heap_free(info->pszHome);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszJump1);
|
heap_free(info->pszJump1);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszJump2);
|
heap_free(info->pszJump2);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszUrlJump1);
|
heap_free(info->pszUrlJump1);
|
||||||
hhctrl_free((LPWSTR)info->WinType.pszUrlJump2);
|
heap_free(info->pszUrlJump2);
|
||||||
|
|
||||||
if (info->pCHMInfo)
|
if (info->pCHMInfo)
|
||||||
CloseCHM(info->pCHMInfo);
|
CloseCHM(info->pCHMInfo);
|
||||||
|
@ -942,13 +942,13 @@ void ReleaseHelpViewer(HHInfo *info)
|
||||||
if(info->WinType.hwndHelp)
|
if(info->WinType.hwndHelp)
|
||||||
DestroyWindow(info->WinType.hwndHelp);
|
DestroyWindow(info->WinType.hwndHelp);
|
||||||
|
|
||||||
hhctrl_free(info);
|
heap_free(info);
|
||||||
OleUninitialize();
|
OleUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
HHInfo *CreateHelpViewer(LPCWSTR filename)
|
HHInfo *CreateHelpViewer(LPCWSTR filename)
|
||||||
{
|
{
|
||||||
HHInfo *info = hhctrl_alloc_zero(sizeof(HHInfo));
|
HHInfo *info = heap_alloc_zero(sizeof(HHInfo));
|
||||||
|
|
||||||
OleInitialize(NULL);
|
OleInitialize(NULL);
|
||||||
|
|
||||||
|
@ -958,7 +958,7 @@ HHInfo *CreateHelpViewer(LPCWSTR filename)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoadWinTypeFromCHM(info->pCHMInfo, &info->WinType)) {
|
if (!LoadWinTypeFromCHM(info)) {
|
||||||
ReleaseHelpViewer(info);
|
ReleaseHelpViewer(info);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
NavigateToUrl(info, url);
|
NavigateToUrl(info, url);
|
||||||
hhctrl_free(url);
|
heap_free(url);
|
||||||
|
|
||||||
return NULL; /* FIXME */
|
return NULL; /* FIXME */
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
|
len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
|
||||||
wfile = hhctrl_alloc(len*sizeof(WCHAR));
|
wfile = heap_alloc(len*sizeof(WCHAR));
|
||||||
MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
|
MultiByteToWideChar( CP_ACP, 0, filename, -1, wfile, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||||
case HH_GET_WIN_HANDLE:
|
case HH_GET_WIN_HANDLE:
|
||||||
case HH_SAFE_DISPLAY_TOPIC:
|
case HH_SAFE_DISPLAY_TOPIC:
|
||||||
len = MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, NULL, 0 );
|
len = MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, NULL, 0 );
|
||||||
wdata = hhctrl_alloc(len*sizeof(WCHAR));
|
wdata = heap_alloc(len*sizeof(WCHAR));
|
||||||
MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, wdata, len );
|
MultiByteToWideChar( CP_ACP, 0, (const char*)data, -1, wdata, len );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -227,8 +227,8 @@ HWND WINAPI HtmlHelpA(HWND caller, LPCSTR filename, UINT command, DWORD_PTR data
|
||||||
|
|
||||||
result = HtmlHelpW( caller, wfile, command, wdata ? (DWORD_PTR)wdata : data );
|
result = HtmlHelpW( caller, wfile, command, wdata ? (DWORD_PTR)wdata : data );
|
||||||
|
|
||||||
hhctrl_free(wfile);
|
heap_free(wfile);
|
||||||
hhctrl_free(wdata);
|
heap_free(wdata);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,19 @@ typedef struct {
|
||||||
IOleObject *wb_object;
|
IOleObject *wb_object;
|
||||||
|
|
||||||
HH_WINTYPEW WinType;
|
HH_WINTYPEW WinType;
|
||||||
|
|
||||||
|
LPWSTR pszType;
|
||||||
|
LPWSTR pszCaption;
|
||||||
|
LPWSTR pszToc;
|
||||||
|
LPWSTR pszIndex;
|
||||||
|
LPWSTR pszFile;
|
||||||
|
LPWSTR pszHome;
|
||||||
|
LPWSTR pszJump1;
|
||||||
|
LPWSTR pszJump2;
|
||||||
|
LPWSTR pszUrlJump1;
|
||||||
|
LPWSTR pszUrlJump2;
|
||||||
|
LPWSTR pszCustomTabs;
|
||||||
|
|
||||||
CHMInfo *pCHMInfo;
|
CHMInfo *pCHMInfo;
|
||||||
ContentItem *content;
|
ContentItem *content;
|
||||||
HWND hwndTabCtrl;
|
HWND hwndTabCtrl;
|
||||||
|
@ -111,7 +124,7 @@ void InitContent(HHInfo*);
|
||||||
void ReleaseContent(HHInfo*);
|
void ReleaseContent(HHInfo*);
|
||||||
|
|
||||||
CHMInfo *OpenCHM(LPCWSTR szFile);
|
CHMInfo *OpenCHM(LPCWSTR szFile);
|
||||||
BOOL LoadWinTypeFromCHM(CHMInfo *pCHMInfo, HH_WINTYPEW *pHHWinType);
|
BOOL LoadWinTypeFromCHM(HHInfo *info);
|
||||||
CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
|
CHMInfo *CloseCHM(CHMInfo *pCHMInfo);
|
||||||
void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
|
void SetChmPath(ChmPath*,LPCWSTR,LPCWSTR);
|
||||||
IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
|
IStream *GetChmStream(CHMInfo*,LPCWSTR,ChmPath*);
|
||||||
|
@ -124,27 +137,27 @@ BOOL NavigateToChm(HHInfo*,LPCWSTR,LPCWSTR);
|
||||||
|
|
||||||
/* memory allocation functions */
|
/* memory allocation functions */
|
||||||
|
|
||||||
static inline void *hhctrl_alloc(size_t len)
|
static inline void *heap_alloc(size_t len)
|
||||||
{
|
{
|
||||||
return HeapAlloc(GetProcessHeap(), 0, len);
|
return HeapAlloc(GetProcessHeap(), 0, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *hhctrl_alloc_zero(size_t len)
|
static inline void *heap_alloc_zero(size_t len)
|
||||||
{
|
{
|
||||||
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *hhctrl_realloc(void *mem, size_t len)
|
static inline void *heap_realloc(void *mem, size_t len)
|
||||||
{
|
{
|
||||||
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void *hhctrl_realloc_zero(void *mem, size_t len)
|
static inline void *heap_realloc_zero(void *mem, size_t len)
|
||||||
{
|
{
|
||||||
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline BOOL hhctrl_free(void *mem)
|
static inline BOOL heap_free(void *mem)
|
||||||
{
|
{
|
||||||
return HeapFree(GetProcessHeap(), 0, mem);
|
return HeapFree(GetProcessHeap(), 0, mem);
|
||||||
}
|
}
|
||||||
|
@ -158,7 +171,7 @@ static inline LPWSTR strdupW(LPCWSTR str)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
size = (strlenW(str)+1)*sizeof(WCHAR);
|
size = (strlenW(str)+1)*sizeof(WCHAR);
|
||||||
ret = hhctrl_alloc(size);
|
ret = heap_alloc(size);
|
||||||
memcpy(ret, str, size);
|
memcpy(ret, str, size);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -173,7 +186,7 @@ static inline LPWSTR strdupAtoW(LPCSTR str)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
||||||
ret = hhctrl_alloc(len*sizeof(WCHAR));
|
ret = heap_alloc(len*sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||||
|
<group>
|
||||||
<module name="hhctrl" type="win32ocx" baseaddress="${BASEADDRESS_HHCTRL}" installbase="system32" installname="hhctrl.ocx" allowwarnings="true">
|
<module name="hhctrl" type="win32ocx" baseaddress="${BASEADDRESS_HHCTRL}" installbase="system32" installname="hhctrl.ocx" allowwarnings="true">
|
||||||
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
|
<autoregister infsection="OleControlDlls" type="DllRegisterServer" />
|
||||||
<importlibrary definition="hhctrl.ocx.spec.def" />
|
<importlibrary definition="hhctrl.ocx.spec.def" />
|
||||||
|
@ -13,7 +14,6 @@
|
||||||
<library>wine</library>
|
<library>wine</library>
|
||||||
<library>advapi32</library>
|
<library>advapi32</library>
|
||||||
<library>comctl32</library>
|
<library>comctl32</library>
|
||||||
<library>shell32</library>
|
|
||||||
<library>shlwapi</library>
|
<library>shlwapi</library>
|
||||||
<library>ole32</library>
|
<library>ole32</library>
|
||||||
<library>oleaut32</library>
|
<library>oleaut32</library>
|
||||||
|
@ -31,3 +31,4 @@
|
||||||
<file>hhctrl.rc</file>
|
<file>hhctrl.rc</file>
|
||||||
<file>hhctrl.ocx.spec</file>
|
<file>hhctrl.ocx.spec</file>
|
||||||
</module>
|
</module>
|
||||||
|
</group>
|
||||||
|
|
|
@ -74,7 +74,7 @@ static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface)
|
||||||
if (refCount)
|
if (refCount)
|
||||||
return refCount;
|
return refCount;
|
||||||
|
|
||||||
hhctrl_free(This);
|
heap_free(This);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -576,7 +576,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
RECT rc;
|
RECT rc;
|
||||||
|
|
||||||
iOleClientSiteImpl = hhctrl_alloc_zero(sizeof(IOleClientSiteImpl));
|
iOleClientSiteImpl = heap_alloc_zero(sizeof(IOleClientSiteImpl));
|
||||||
if (!iOleClientSiteImpl)
|
if (!iOleClientSiteImpl)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -625,7 +625,7 @@ BOOL InitWebBrowser(HHInfo *info, HWND hwndParent)
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ReleaseWebBrowser(info);
|
ReleaseWebBrowser(info);
|
||||||
hhctrl_free(iOleClientSiteImpl);
|
heap_free(iOleClientSiteImpl);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue