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
cf5e6bce
Commit
cf5e6bce
authored
Mar 25, 2008
by
Hin-Tak Leung
Committed by
Alexandre Julliard
Mar 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl.ocx: Implement more navigation of chm to TOC, default topic and specific title.
parent
4194daf1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
4 deletions
+55
-4
chm.c
dlls/hhctrl.ocx/chm.c
+32
-1
hhctrl.c
dlls/hhctrl.ocx/hhctrl.c
+1
-0
hhctrl.h
dlls/hhctrl.ocx/hhctrl.h
+22
-3
No files found.
dlls/hhctrl.ocx/chm.c
View file @
cf5e6bce
...
@@ -113,11 +113,20 @@ static BOOL ReadChmSystem(CHMInfo *chm)
...
@@ -113,11 +113,20 @@ static BOOL ReadChmSystem(CHMInfo *chm)
break
;
break
;
switch
(
entry
.
code
)
{
switch
(
entry
.
code
)
{
case
0x0
:
TRACE
(
"TOC is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
heap_free
(
chm
->
defToc
);
chm
->
defToc
=
strdupnAtoW
(
buf
,
entry
.
len
);
break
;
case
0x2
:
case
0x2
:
TRACE
(
"Default topic is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
TRACE
(
"Default topic is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
heap_free
(
chm
->
defTopic
);
chm
->
defTopic
=
strdupnAtoW
(
buf
,
entry
.
len
);
break
;
break
;
case
0x3
:
case
0x3
:
TRACE
(
"Title is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
TRACE
(
"Title is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
heap_free
(
chm
->
defTitle
);
chm
->
defTitle
=
strdupnAtoW
(
buf
,
entry
.
len
);
break
;
break
;
case
0x5
:
case
0x5
:
TRACE
(
"Default window is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
TRACE
(
"Default window is %s
\n
"
,
debugstr_an
(
buf
,
entry
.
len
));
...
@@ -212,7 +221,26 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
...
@@ -212,7 +221,26 @@ BOOL LoadWinTypeFromCHM(HHInfo *info)
hr
=
IStorage_OpenStream
(
pStorage
,
windowsW
,
NULL
,
STGM_READ
,
0
,
&
pStream
);
hr
=
IStorage_OpenStream
(
pStorage
,
windowsW
,
NULL
,
STGM_READ
,
0
,
&
pStream
);
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
return
FALSE
;
{
/* no defined window types so use (hopefully) sane defaults */
static
const
WCHAR
defaultwinW
[]
=
{
'd'
,
'e'
,
'f'
,
'a'
,
'u'
,
'l'
,
't'
,
'w'
,
'i'
,
'n'
,
'\0'
};
static
const
WCHAR
null
[]
=
{
0
};
memset
((
void
*
)
&
(
info
->
WinType
),
0
,
sizeof
(
info
->
WinType
));
info
->
WinType
.
cbStruct
=
sizeof
(
info
->
WinType
);
info
->
WinType
.
fUniCodeStrings
=
TRUE
;
info
->
WinType
.
pszType
=
strdupW
(
defaultwinW
);
info
->
WinType
.
pszToc
=
strdupW
(
info
->
pCHMInfo
->
defToc
);
info
->
WinType
.
pszIndex
=
strdupW
(
null
);
info
->
WinType
.
fsValidMembers
=
0
;
info
->
WinType
.
fsWinProperties
=
HHWIN_PROP_TRI_PANE
;
info
->
WinType
.
pszCaption
=
strdupW
(
info
->
pCHMInfo
->
defTitle
);
info
->
WinType
.
dwStyles
=
WS_POPUP
;
info
->
WinType
.
dwExStyles
=
0
;
info
->
WinType
.
nShowState
=
SW_SHOW
;
info
->
WinType
.
pszFile
=
strdupW
(
info
->
pCHMInfo
->
defTopic
);
info
->
WinType
.
curNavType
=
HHWIN_NAVTYPE_TOC
;
return
TRUE
;
}
/* jump past the #WINDOWS header */
/* jump past the #WINDOWS header */
liOffset
.
QuadPart
=
sizeof
(
DWORD
)
*
2
;
liOffset
.
QuadPart
=
sizeof
(
DWORD
)
*
2
;
...
@@ -393,6 +421,9 @@ CHMInfo *CloseCHM(CHMInfo *chm)
...
@@ -393,6 +421,9 @@ CHMInfo *CloseCHM(CHMInfo *chm)
}
}
heap_free
(
chm
->
strings
);
heap_free
(
chm
->
strings
);
heap_free
(
chm
->
defTitle
);
heap_free
(
chm
->
defTopic
);
heap_free
(
chm
->
defToc
);
heap_free
(
chm
);
heap_free
(
chm
);
return
NULL
;
return
NULL
;
...
...
dlls/hhctrl.ocx/hhctrl.c
View file @
cf5e6bce
...
@@ -114,6 +114,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
...
@@ -114,6 +114,7 @@ HWND WINAPI HtmlHelpW(HWND caller, LPCWSTR filename, UINT command, DWORD_PTR dat
memcpy
(
chm_file
,
filename
,
(
index
-
filename
)
*
sizeof
(
WCHAR
));
memcpy
(
chm_file
,
filename
,
(
index
-
filename
)
*
sizeof
(
WCHAR
));
chm_file
[
index
-
filename
]
=
0
;
chm_file
[
index
-
filename
]
=
0
;
filename
=
chm_file
;
filename
=
chm_file
;
index
+=
2
;
/* advance beyond "::" for calling NavigateToChm() later */
}
}
else
else
{
{
...
...
dlls/hhctrl.ocx/hhctrl.h
View file @
cf5e6bce
...
@@ -74,6 +74,10 @@ typedef struct CHMInfo
...
@@ -74,6 +74,10 @@ typedef struct CHMInfo
IStream
*
strings_stream
;
IStream
*
strings_stream
;
char
**
strings
;
char
**
strings
;
DWORD
strings_size
;
DWORD
strings_size
;
WCHAR
*
defTopic
;
WCHAR
*
defTitle
;
WCHAR
*
defToc
;
}
CHMInfo
;
}
CHMInfo
;
#define TAB_CONTENTS 0
#define TAB_CONTENTS 0
...
@@ -177,7 +181,7 @@ static inline LPWSTR strdupW(LPCWSTR str)
...
@@ -177,7 +181,7 @@ static inline LPWSTR strdupW(LPCWSTR str)
return
ret
;
return
ret
;
}
}
static
inline
LPWSTR
strdup
AtoW
(
LPCSTR
str
)
static
inline
LPWSTR
strdup
nAtoW
(
LPCSTR
str
,
LONG
lenA
)
{
{
LPWSTR
ret
;
LPWSTR
ret
;
DWORD
len
;
DWORD
len
;
...
@@ -185,13 +189,28 @@ static inline LPWSTR strdupAtoW(LPCSTR str)
...
@@ -185,13 +189,28 @@ static inline LPWSTR strdupAtoW(LPCSTR str)
if
(
!
str
)
if
(
!
str
)
return
NULL
;
return
NULL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
NULL
,
0
);
if
(
lenA
>
0
)
{
/* find length of string */
LPCSTR
eos
=
memchr
(
str
,
0
,
lenA
);
if
(
eos
)
lenA
=
eos
-
str
;
}
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
lenA
,
NULL
,
0
)
+
1
;
/* +1 for null pad */
ret
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
ret
=
heap_alloc
(
len
*
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
-
1
,
ret
,
len
);
MultiByteToWideChar
(
CP_ACP
,
0
,
str
,
lenA
,
ret
,
len
);
ret
[
len
-
1
]
=
0
;
return
ret
;
return
ret
;
}
}
static
inline
LPWSTR
strdupAtoW
(
LPCSTR
str
)
{
return
strdupnAtoW
(
str
,
-
1
);
}
extern
HINSTANCE
hhctrl_hinstance
;
extern
HINSTANCE
hhctrl_hinstance
;
extern
BOOL
hh_process
;
extern
BOOL
hh_process
;
...
...
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