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
e14cfc49
Commit
e14cfc49
authored
Oct 13, 2002
by
Uwe Bonnes
Committed by
Alexandre Julliard
Oct 13, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to get size of in-memory resource and used this function
to copy resource to writable memory.
parent
0e668bb9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
147 additions
and
7 deletions
+147
-7
propsheet.c
dlls/comctl32/propsheet.c
+147
-7
No files found.
dlls/comctl32/propsheet.c
View file @
e14cfc49
...
...
@@ -36,6 +36,8 @@
/******************************************************************************
* Data structures
*/
#include "pshpack2.h"
typedef
struct
{
WORD
dlgVer
;
...
...
@@ -45,6 +47,18 @@ typedef struct
DWORD
style
;
}
MyDLGTEMPLATEEX
;
typedef
struct
{
DWORD
helpid
;
DWORD
exStyle
;
DWORD
style
;
short
x
;
short
y
;
short
cy
;
DWORD
id
;
}
MyDLGITEMTEMPLATEEX
;
#include "poppack.h"
typedef
struct
tagPropPageInfo
{
HPROPSHEETPAGE
hpage
;
/* to keep track of pages not passed to PropertySheet */
...
...
@@ -1159,6 +1173,129 @@ static BOOL PROPSHEET_CreateTabControl(HWND hwndParent,
return
TRUE
;
}
/*
* Get the size of an in-memory Template
*
*( Based on the code of PROPSHEET_CollectPageInfo)
*/
static
UINT
GetTemplateSize
(
DLGTEMPLATE
*
pTemplate
)
{
const
WORD
*
p
=
(
const
WORD
*
)
pTemplate
;
BOOL
istemplateex
=
(((
MyDLGTEMPLATEEX
*
)
pTemplate
)
->
signature
==
0xFFFF
);
WORD
nrofitems
;
if
(
istemplateex
)
{
/* DIALOGEX template */
p
++
;
/* dlgVer */
p
++
;
/* signature */
p
+=
2
;
/* help ID */
p
+=
2
;
/* ext style */
p
+=
2
;
/* style */
}
else
{
/* DIALOG template */
p
+=
2
;
/* style */
p
+=
2
;
/* ext style */
}
nrofitems
=
(
WORD
)
*
p
;
p
++
;
/* nb items */
p
++
;
/* x */
p
++
;
/* y */
p
++
;
/* width */
p
++
;
/* height */
/* menu */
switch
((
WORD
)
*
p
)
{
case
0x0000
:
p
++
;
break
;
case
0xffff
:
p
+=
2
;
break
;
default:
TRACE
(
"menu %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
(
(
LPCWSTR
)
p
)
+
1
;
break
;
}
/* class */
switch
((
WORD
)
*
p
)
{
case
0x0000
:
p
++
;
break
;
case
0xffff
:
p
+=
2
;
break
;
default:
TRACE
(
"class %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
(
(
LPCWSTR
)
p
)
+
1
;
break
;
}
/*title */
TRACE
(
"title %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
((
LPCWSTR
)
p
)
+
1
;
/* font, if DS_FONT set */
if
((
DS_SETFONT
&
((
istemplateex
)
?
((
MyDLGTEMPLATEEX
*
)
pTemplate
)
->
style
:
pTemplate
->
style
)))
{
p
+=
(
istemplateex
)
?
3
:
1
;
TRACE
(
"font %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
(
(
LPCWSTR
)
p
)
+
1
;
/* the font name*/
}
TRACE
(
"%d items
\n
"
,
nrofitems
);
while
(
nrofitems
>
0
)
{
p
=
(
WORD
*
)(((
DWORD
)
p
+
3
)
&
~
3
);
/* DWORD align */
p
+=
(
istemplateex
?
sizeof
(
MyDLGITEMTEMPLATEEX
)
:
sizeof
(
DLGITEMTEMPLATE
))
/
sizeof
(
WORD
);
switch
((
WORD
)
*
p
)
{
case
0x0000
:
p
++
;
break
;
case
0xffff
:
TRACE
(
"class ordinal 0x%08lx
\n
"
,
*
(
DWORD
*
)
p
);
p
+=
2
;
break
;
default:
TRACE
(
"class %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
(
(
LPCWSTR
)
p
)
+
1
;
break
;
}
switch
((
WORD
)
*
p
)
{
case
0x0000
:
p
++
;
break
;
case
0xffff
:
TRACE
(
"text ordinal 0x%08lx
\n
"
,
*
(
DWORD
*
)
p
);
p
+=
2
;
break
;
default:
TRACE
(
"text %s
\n
"
,
debugstr_w
((
LPCWSTR
)
p
));
p
+=
lstrlenW
(
(
LPCWSTR
)
p
)
+
1
;
break
;
}
p
+=
*
p
+
1
;
/* Skip extra data */
--
nrofitems
;
}
TRACE
(
"%p %p size 0x%08x
\n
"
,
p
,
(
WORD
*
)
pTemplate
,
sizeof
(
WORD
)
*
(
p
-
(
WORD
*
)
pTemplate
));
return
(
p
-
(
WORD
*
)
pTemplate
)
*
sizeof
(
WORD
);
}
/******************************************************************************
* PROPSHEET_CreatePage
...
...
@@ -1187,7 +1324,10 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
}
if
(
ppshpage
->
dwFlags
&
PSP_DLGINDIRECT
)
pTemplate
=
(
DLGTEMPLATE
*
)
ppshpage
->
u
.
pResource
;
{
pTemplate
=
(
DLGTEMPLATE
*
)
ppshpage
->
u
.
pResource
;
resSize
=
GetTemplateSize
(
pTemplate
);
}
else
{
HRSRC
hResource
;
...
...
@@ -1209,13 +1349,13 @@ static BOOL PROPSHEET_CreatePage(HWND hwndParent,
/*
* Make a copy of the dialog template to make it writable
*/
temp
=
COMCTL32_Alloc
(
resSize
);
if
(
!
temp
)
return
FALSE
;
memcpy
(
temp
,
pTemplate
,
resSize
);
pTemplate
=
temp
;
}
temp
=
COMCTL32_Alloc
(
resSize
);
if
(
!
temp
)
return
FALSE
;
memcpy
(
temp
,
pTemplate
,
resSize
);
pTemplate
=
temp
;
if
(((
MyDLGTEMPLATEEX
*
)
pTemplate
)
->
signature
==
0xFFFF
)
{
...
...
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