Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
7293f00d
Commit
7293f00d
authored
Dec 13, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl.ocx: Store a copy of the string pointers to enable freeing them without casting away const.
parent
9642714d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
27 deletions
+40
-27
chm.c
dlls/hhctrl.ocx/chm.c
+15
-15
help.c
dlls/hhctrl.ocx/help.c
+11
-11
hhctrl.h
dlls/hhctrl.ocx/hhctrl.h
+14
-1
No files found.
dlls/hhctrl.ocx/chm.c
View file @
7293f00d
...
...
@@ -200,10 +200,10 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index)
* FIXME: There may be more than one window type in the file, so
* add the ability to choose a certain window type
*/
BOOL
LoadWinTypeFromCHM
(
CHMInfo
*
pChmInfo
,
HH_WINTYPEW
*
pHHWinType
)
BOOL
LoadWinTypeFromCHM
(
HHInfo
*
info
)
{
LARGE_INTEGER
liOffset
;
IStorage
*
pStorage
=
pChm
Info
->
pStorage
;
IStorage
*
pStorage
=
info
->
pCHM
Info
->
pStorage
;
IStream
*
pStream
;
HRESULT
hr
;
DWORD
cbRead
;
...
...
@@ -221,26 +221,26 @@ BOOL LoadWinTypeFromCHM(CHMInfo *pChmInfo, HH_WINTYPEW *pHHWinType)
if
(
FAILED
(
hr
))
goto
done
;
/* read the HH_WINTYPE struct data */
hr
=
IStream_Read
(
pStream
,
pHHWinType
,
sizeof
(
*
pHH
WinType
),
&
cbRead
);
hr
=
IStream_Read
(
pStream
,
&
info
->
WinType
,
sizeof
(
info
->
WinType
),
&
cbRead
);
if
(
FAILED
(
hr
))
goto
done
;
/* convert the #STRINGS offsets to actual strings */
pHHWinType
->
pszType
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszType
));
pHHWinType
->
pszCaption
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszCaption
));
pHHWinType
->
pszToc
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszToc
));
pHHWinType
->
pszIndex
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszIndex
));
pHHWinType
->
pszFile
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszFile
));
pHHWinType
->
pszHome
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszHome
));
pHHWinType
->
pszJump1
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszJump1
));
pHHWinType
->
pszJump2
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszJump2
));
pHHWinType
->
pszUrlJump1
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszUrlJump1
));
pHHWinType
->
pszUrlJump2
=
strdupAtoW
(
GetChmString
(
pChmInfo
,
(
DWORD
)
pHHWinType
->
pszUrlJump2
));
info
->
WinType
.
pszType
=
info
->
pszType
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszType
));
info
->
WinType
.
pszCaption
=
info
->
pszCaption
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszCaption
));
info
->
WinType
.
pszToc
=
info
->
pszToc
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszToc
));
info
->
WinType
.
pszIndex
=
info
->
pszIndex
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszIndex
));
info
->
WinType
.
pszFile
=
info
->
pszFile
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszFile
));
info
->
WinType
.
pszHome
=
info
->
pszHome
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszHome
));
info
->
WinType
.
pszJump1
=
info
->
pszJump1
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszJump1
));
info
->
WinType
.
pszJump2
=
info
->
pszJump2
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszJump2
));
info
->
WinType
.
pszUrlJump1
=
info
->
pszUrlJump1
=
strdupAtoW
(
GetChmString
(
info
->
pCHMInfo
,
(
DWORD_PTR
)
info
->
WinType
.
pszUrlJump1
));
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
* work in this case
*/
#if 0
pHHWinType->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD)pHHWinType->
pszCustomTabs);
info->WinType.pszCustomTabs = info->pszCustomTabs = CHM_ReadString(pChmInfo, (DWORD_PTR)info->WinType.
pszCustomTabs);
#endif
done:
...
...
dlls/hhctrl.ocx/help.c
View file @
7293f00d
...
...
@@ -922,16 +922,16 @@ void ReleaseHelpViewer(HHInfo *info)
return
;
/* Free allocated strings */
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszType
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszCaption
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszToc
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszIndex
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszFile
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszHome
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszJump1
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszJump2
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszUrlJump1
);
heap_free
(
(
LPWSTR
)
info
->
WinType
.
pszUrlJump2
);
heap_free
(
info
->
pszType
);
heap_free
(
info
->
pszCaption
);
heap_free
(
info
->
pszToc
);
heap_free
(
info
->
pszIndex
);
heap_free
(
info
->
pszFile
);
heap_free
(
info
->
pszHome
);
heap_free
(
info
->
pszJump1
);
heap_free
(
info
->
pszJump2
);
heap_free
(
info
->
pszUrlJump1
);
heap_free
(
info
->
pszUrlJump2
);
if
(
info
->
pCHMInfo
)
CloseCHM
(
info
->
pCHMInfo
);
...
...
@@ -958,7 +958,7 @@ HHInfo *CreateHelpViewer(LPCWSTR filename)
return
NULL
;
}
if
(
!
LoadWinTypeFromCHM
(
info
->
pCHMInfo
,
&
info
->
WinType
))
{
if
(
!
LoadWinTypeFromCHM
(
info
))
{
ReleaseHelpViewer
(
info
);
return
NULL
;
}
...
...
dlls/hhctrl.ocx/hhctrl.h
View file @
7293f00d
...
...
@@ -92,6 +92,19 @@ typedef struct {
IOleObject
*
wb_object
;
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
;
ContentItem
*
content
;
HWND
hwndTabCtrl
;
...
...
@@ -111,7 +124,7 @@ void InitContent(HHInfo*);
void
ReleaseContent
(
HHInfo
*
);
CHMInfo
*
OpenCHM
(
LPCWSTR
szFile
);
BOOL
LoadWinTypeFromCHM
(
CHMInfo
*
pCHMInfo
,
HH_WINTYPEW
*
pHHWinType
);
BOOL
LoadWinTypeFromCHM
(
HHInfo
*
info
);
CHMInfo
*
CloseCHM
(
CHMInfo
*
pCHMInfo
);
void
SetChmPath
(
ChmPath
*
,
LPCWSTR
,
LPCWSTR
);
IStream
*
GetChmStream
(
CHMInfo
*
,
LPCWSTR
,
ChmPath
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment