Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
43ecfe03
Commit
43ecfe03
authored
12 years ago
by
Erich Hoover
Committed by
Alexandre Julliard
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
hhctrl.ocx: Use document title for subtopics in the index.
parent
5874d6f1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dlls/hhctrl.ocx/chm.c
+57
-4
57 additions, 4 deletions
dlls/hhctrl.ocx/chm.c
dlls/hhctrl.ocx/help.c
+2
-0
2 additions, 0 deletions
dlls/hhctrl.ocx/help.c
dlls/hhctrl.ocx/hhctrl.h
+1
-0
1 addition, 0 deletions
dlls/hhctrl.ocx/hhctrl.h
dlls/hhctrl.ocx/stream.h
+3
-1
3 additions, 1 deletion
dlls/hhctrl.ocx/stream.h
with
63 additions
and
5 deletions
dlls/hhctrl.ocx/chm.c
+
57
−
4
View file @
43ecfe03
...
...
@@ -20,6 +20,7 @@
*/
#include
"hhctrl.h"
#include
"stream.h"
#include
"winreg.h"
#include
"shlwapi.h"
...
...
@@ -27,10 +28,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
htmlhelp
);
#define BLOCK_BITS 12
#define BLOCK_SIZE (1 << BLOCK_BITS)
#define BLOCK_MASK (BLOCK_SIZE-1)
/* Reads a string from the #STRINGS section in the CHM file */
static
LPCSTR
GetChmString
(
CHMInfo
*
chm
,
DWORD
offset
)
{
...
...
@@ -413,6 +410,62 @@ IStream *GetChmStream(CHMInfo *info, LPCWSTR parent_chm, ChmPath *chm_file)
return
stream
;
}
/*
* Retrieve a CHM document and parse the data from the <title> element to get the document's title.
*/
WCHAR
*
GetDocumentTitle
(
CHMInfo
*
info
,
LPCWSTR
document
)
{
strbuf_t
node
,
node_name
,
content
;
WCHAR
*
document_title
=
NULL
;
IStream
*
str
=
NULL
;
IStorage
*
storage
;
stream_t
stream
;
HRESULT
hres
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
document
));
storage
=
info
->
pStorage
;
if
(
!
storage
)
{
WARN
(
"Could not open storage to obtain the title for a document.
\n
"
);
return
NULL
;
}
IStorage_AddRef
(
storage
);
hres
=
IStorage_OpenStream
(
storage
,
document
,
NULL
,
STGM_READ
,
0
,
&
str
);
IStorage_Release
(
storage
);
if
(
FAILED
(
hres
))
WARN
(
"Could not open stream: %08x
\n
"
,
hres
);
stream_init
(
&
stream
,
str
);
strbuf_init
(
&
node
);
strbuf_init
(
&
content
);
strbuf_init
(
&
node_name
);
while
(
next_node
(
&
stream
,
&
node
))
{
get_node_name
(
&
node
,
&
node_name
);
TRACE
(
"%s
\n
"
,
node
.
buf
);
if
(
!
strcasecmp
(
node_name
.
buf
,
"title"
))
{
if
(
next_content
(
&
stream
,
&
content
)
&&
content
.
len
>
1
)
{
document_title
=
strdupnAtoW
(
&
content
.
buf
[
1
],
content
.
len
-
1
);
FIXME
(
"magic: %s
\n
"
,
debugstr_w
(
document_title
));
break
;
}
}
strbuf_zero
(
&
node
);
}
strbuf_free
(
&
node
);
strbuf_free
(
&
content
);
strbuf_free
(
&
node_name
);
IStream_Release
(
str
);
return
document_title
;
}
/* Opens the CHM file for reading */
CHMInfo
*
OpenCHM
(
LPCWSTR
szFile
)
{
...
...
This diff is collapsed.
Click to expand it.
dlls/hhctrl.ocx/help.c
+
2
−
0
View file @
43ecfe03
...
...
@@ -634,6 +634,8 @@ static LRESULT OnTopicChange(HHInfo *info, void *user_data)
IndexSubItem
*
item
=
&
iiter
->
items
[
i
];
WCHAR
*
name
=
iiter
->
keyword
;
if
(
!
item
->
name
)
item
->
name
=
GetDocumentTitle
(
info
->
pCHMInfo
,
item
->
local
);
if
(
item
->
name
)
name
=
item
->
name
;
memset
(
&
lvi
,
0
,
sizeof
(
lvi
));
...
...
This diff is collapsed.
Click to expand it.
dlls/hhctrl.ocx/hhctrl.h
+
1
−
0
View file @
43ecfe03
...
...
@@ -189,6 +189,7 @@ CHMInfo *CloseCHM(CHMInfo *pCHMInfo) DECLSPEC_HIDDEN;
void
SetChmPath
(
ChmPath
*
,
LPCWSTR
,
LPCWSTR
)
DECLSPEC_HIDDEN
;
IStream
*
GetChmStream
(
CHMInfo
*
,
LPCWSTR
,
ChmPath
*
)
DECLSPEC_HIDDEN
;
LPWSTR
FindContextAlias
(
CHMInfo
*
,
DWORD
)
DECLSPEC_HIDDEN
;
WCHAR
*
GetDocumentTitle
(
CHMInfo
*
,
LPCWSTR
)
DECLSPEC_HIDDEN
;
HHInfo
*
CreateHelpViewer
(
LPCWSTR
)
DECLSPEC_HIDDEN
;
void
ReleaseHelpViewer
(
HHInfo
*
)
DECLSPEC_HIDDEN
;
...
...
This diff is collapsed.
Click to expand it.
dlls/hhctrl.ocx/stream.h
+
3
−
1
View file @
43ecfe03
...
...
@@ -19,7 +19,9 @@
#ifndef HHCTRL_STREAM_H
#define HHCTRL_STREAM_H
#define BLOCK_SIZE 0x1000
#define BLOCK_BITS 12
#define BLOCK_SIZE (1 << BLOCK_BITS)
#define BLOCK_MASK (BLOCK_SIZE-1)
typedef
struct
{
char
*
buf
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment