Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
1711c3a5
Commit
1711c3a5
authored
Feb 23, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Feb 23, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl.ocx: Handle memory allocation in OpenCHM and CloseCHM.
parent
976f2db5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
33 deletions
+46
-33
chm.c
dlls/hhctrl.ocx/chm.c
+36
-24
help.c
dlls/hhctrl.ocx/help.c
+8
-7
hhctrl.h
dlls/hhctrl.ocx/hhctrl.h
+2
-2
No files found.
dlls/hhctrl.ocx/chm.c
View file @
1711c3a5
...
...
@@ -127,48 +127,60 @@ done:
}
/* Opens the CHM file for reading */
BOOL
CHM_OpenCHM
(
CHMInfo
*
pChmInfo
,
LPCWSTR
szFile
)
CHMInfo
*
OpenCHM
(
LPCWSTR
szFile
)
{
HRESULT
hres
;
static
const
WCHAR
wszSTRINGS
[]
=
{
'#'
,
'S'
,
'T'
,
'R'
,
'I'
,
'N'
,
'G'
,
'S'
,
0
};
pChmInfo
->
szFile
=
szFile
;
CHMInfo
*
ret
=
hhctrl_alloc_zero
(
sizeof
(
CHMInfo
))
;
if
(
FAILED
(
CoCreateInstance
(
&
CLSID_ITStorage
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IITStorage
,
(
void
**
)
&
pChmInfo
->
pITStorage
)))
return
FALSE
;
ret
->
szFile
=
szFile
;
if
(
FAILED
(
IITStorage_StgOpenStorage
(
pChmInfo
->
pITStorage
,
szFile
,
NULL
,
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
pChmInfo
->
pStorage
)))
return
FALSE
;
hres
=
CoCreateInstance
(
&
CLSID_ITStorage
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IITStorage
,
(
void
**
)
&
ret
->
pITStorage
)
;
if
(
FAILED
(
hres
))
{
WARN
(
"Could not create ITStorage: %08x
\n
"
,
hres
);
return
CloseCHM
(
ret
);
}
hres
=
I
Storage_OpenStream
(
pChmInfo
->
pStorage
,
wszSTRINGS
,
NULL
,
STGM_READ
,
0
,
&
pChmInfo
->
strings_stream
);
hres
=
I
ITStorage_StgOpenStorage
(
ret
->
pITStorage
,
szFile
,
NULL
,
STGM_READ
|
STGM_SHARE_DENY_WRITE
,
NULL
,
0
,
&
ret
->
pStorage
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not open
#STRINGS stream
: %08x
\n
"
,
hres
);
return
FALSE
;
WARN
(
"Could not open
storage
: %08x
\n
"
,
hres
);
return
CloseCHM
(
ret
)
;
}
pChmInfo
->
strings
=
NULL
;
pChmInfo
->
strings_size
=
0
;
hres
=
IStorage_OpenStream
(
ret
->
pStorage
,
wszSTRINGS
,
NULL
,
STGM_READ
,
0
,
&
ret
->
strings_stream
);
if
(
FAILED
(
hres
))
{
WARN
(
"Could not open #STRINGS stream: %08x
\n
"
,
hres
);
return
CloseCHM
(
ret
);
}
return
TRUE
;
return
ret
;
}
void
CHM_CloseCHM
(
CHMInfo
*
pCHMInfo
)
CHMInfo
*
CloseCHM
(
CHMInfo
*
chm
)
{
IITStorage_Release
(
pCHMInfo
->
pITStorage
);
IStorage_Release
(
pCHMInfo
->
pStorage
);
IStream_Release
(
pCHMInfo
->
strings_stream
);
if
(
chm
->
pITStorage
)
IITStorage_Release
(
chm
->
pITStorage
);
if
(
pCHMInfo
->
strings_size
)
{
if
(
chm
->
pStorage
)
IStorage_Release
(
chm
->
pStorage
);
if
(
chm
->
strings_stream
)
IStream_Release
(
chm
->
strings_stream
);
if
(
chm
->
strings_size
)
{
int
i
;
for
(
i
=
0
;
i
<
pCHMInfo
->
strings_size
;
i
++
)
hhctrl_free
(
pCHMInfo
->
strings
[
i
]);
for
(
i
=
0
;
i
<
chm
->
strings_size
;
i
++
)
hhctrl_free
(
chm
->
strings
[
i
]);
}
hhctrl_free
(
pCHMInfo
->
strings
);
hhctrl_free
(
chm
->
strings
);
hhctrl_free
(
chm
);
return
NULL
;
}
dlls/hhctrl.ocx/help.c
View file @
1711c3a5
...
...
@@ -800,10 +800,7 @@ static void HH_Close(HHInfo *pHHInfo)
hhctrl_free
(
pHHInfo
->
pHHWinType
);
if
(
pHHInfo
->
pCHMInfo
)
{
CHM_CloseCHM
(
pHHInfo
->
pCHMInfo
);
hhctrl_free
(
pHHInfo
->
pCHMInfo
);
}
CloseCHM
(
pHHInfo
->
pCHMInfo
);
if
(
pHHInfo
->
pWBInfo
)
{
...
...
@@ -816,12 +813,16 @@ static HHInfo *HH_OpenHH(LPWSTR filename)
{
HHInfo
*
pHHInfo
=
hhctrl_alloc_zero
(
sizeof
(
HHInfo
));
pHHInfo
->
pCHMInfo
=
OpenCHM
(
filename
);
if
(
!
pHHInfo
->
pCHMInfo
)
{
HH_Close
(
pHHInfo
);
return
NULL
;
}
pHHInfo
->
pHHWinType
=
hhctrl_alloc_zero
(
sizeof
(
HH_WINTYPEW
));
pHHInfo
->
pCHMInfo
=
hhctrl_alloc
(
sizeof
(
CHMInfo
));
pHHInfo
->
pWBInfo
=
hhctrl_alloc
(
sizeof
(
WBInfo
));
if
(
!
CHM_OpenCHM
(
pHHInfo
->
pCHMInfo
,
filename
)
||
!
CHM_LoadWinTypeFromCHM
(
pHHInfo
->
pCHMInfo
,
pHHInfo
->
pHHWinType
))
{
if
(
!
CHM_LoadWinTypeFromCHM
(
pHHInfo
->
pCHMInfo
,
pHHInfo
->
pHHWinType
))
{
HH_Close
(
pHHInfo
);
return
NULL
;
}
...
...
dlls/hhctrl.ocx/hhctrl.h
View file @
1711c3a5
...
...
@@ -70,9 +70,9 @@ void WB_UnEmbedBrowser(WBInfo *pWBInfo);
void
WB_ResizeBrowser
(
WBInfo
*
pWBInfo
,
DWORD
dwWidth
,
DWORD
dwHeight
);
void
WB_DoPageAction
(
WBInfo
*
pWBInfo
,
DWORD
dwAction
);
BOOL
CHM_OpenCHM
(
CHMInfo
*
pCHMInfo
,
LPCWSTR
szFile
);
CHMInfo
*
OpenCHM
(
LPCWSTR
szFile
);
BOOL
CHM_LoadWinTypeFromCHM
(
CHMInfo
*
pCHMInfo
,
HH_WINTYPEW
*
pHHWinType
);
void
CHM_
CloseCHM
(
CHMInfo
*
pCHMInfo
);
CHMInfo
*
CloseCHM
(
CHMInfo
*
pCHMInfo
);
/* memory allocation functions */
...
...
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