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
4c92dd98
Commit
4c92dd98
authored
May 30, 2016
by
Alistair Leslie-Hughes
Committed by
Alexandre Julliard
May 31, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inetcomm: Add support for PID ids in MimeBody Get/SetProp.
Signed-off-by:
Alistair Leslie-Hughes
<
leslie_alistair@hotmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a3547a13
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
5 deletions
+113
-5
mimeole.c
dlls/inetcomm/mimeole.c
+68
-5
mimeole.c
dlls/inetcomm/tests/mimeole.c
+41
-0
mimeole.idl
include/mimeole.idl
+4
-0
No files found.
dlls/inetcomm/mimeole.c
View file @
4c92dd98
...
...
@@ -496,7 +496,15 @@ static HRESULT find_prop(MimeBody *body, const char *name, header_t **prop)
LIST_FOR_EACH_ENTRY
(
header
,
&
body
->
headers
,
header_t
,
entry
)
{
if
(
!
lstrcmpiA
(
name
,
header
->
prop
->
name
))
if
(
ISPIDSTR
(
name
))
{
if
(
STRTOPID
(
name
)
==
header
->
prop
->
id
)
{
*
prop
=
header
;
return
S_OK
;
}
}
else
if
(
!
lstrcmpiA
(
name
,
header
->
prop
->
name
))
{
*
prop
=
header
;
return
S_OK
;
...
...
@@ -506,6 +514,33 @@ static HRESULT find_prop(MimeBody *body, const char *name, header_t **prop)
return
MIME_E_NOT_FOUND
;
}
static
const
property_t
*
find_default_prop
(
const
char
*
name
)
{
const
property_t
*
prop_def
=
NULL
;
for
(
prop_def
=
default_props
;
prop_def
->
name
;
prop_def
++
)
{
if
(
ISPIDSTR
(
name
))
{
if
(
STRTOPID
(
name
)
==
prop_def
->
id
)
{
break
;
}
}
else
if
(
!
lstrcmpiA
(
name
,
prop_def
->
name
))
{
break
;
}
}
if
(
prop_def
->
id
)
TRACE
(
"%s: found match with default property id %d
\n
"
,
prop_def
->
name
,
prop_def
->
id
);
else
prop_def
=
NULL
;
return
prop_def
;
}
static
HRESULT
WINAPI
MimeBody_QueryInterface
(
IMimeBody
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
...
...
@@ -650,7 +685,7 @@ static HRESULT WINAPI MimeBody_GetProp(
if
(
!
pszName
||
!
pValue
)
return
E_INVALIDARG
;
if
(
!
lstrcmpiA
(
pszName
,
"att:pri-content-type"
))
if
(
!
ISPIDSTR
(
pszName
)
&&
!
lstrcmpiA
(
pszName
,
"att:pri-content-type"
))
{
PropVariantClear
(
pValue
);
pValue
->
vt
=
VT_LPSTR
;
...
...
@@ -690,7 +725,16 @@ static HRESULT WINAPI MimeBody_SetProp(
LIST_FOR_EACH_ENTRY
(
prop_entry
,
&
This
->
new_props
,
property_list_entry_t
,
entry
)
{
if
(
!
lstrcmpiA
(
pszName
,
prop_entry
->
prop
.
name
))
if
(
ISPIDSTR
(
pszName
))
{
if
(
STRTOPID
(
pszName
)
==
prop_entry
->
prop
.
id
)
{
TRACE
(
"Found match with already added new property id %d
\n
"
,
prop_entry
->
prop
.
id
);
prop
=
&
prop_entry
->
prop
;
break
;
}
}
else
if
(
!
lstrcmpiA
(
pszName
,
prop_entry
->
prop
.
name
))
{
TRACE
(
"Found match with already added new property id %d
\n
"
,
prop_entry
->
prop
.
id
);
prop
=
&
prop_entry
->
prop
;
...
...
@@ -704,14 +748,33 @@ static HRESULT WINAPI MimeBody_SetProp(
if
(
!
prop
)
{
const
property_t
*
prop_def
=
NULL
;
prop_entry
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
prop_entry
));
if
(
!
prop_entry
)
{
HeapFree
(
GetProcessHeap
(),
0
,
header
);
return
E_OUTOFMEMORY
;
}
prop_entry
->
prop
.
name
=
strdupA
(
pszName
);
prop_entry
->
prop
.
id
=
This
->
next_prop_id
++
;
prop_def
=
find_default_prop
(
pszName
);
if
(
prop_def
)
{
prop_entry
->
prop
.
name
=
strdupA
(
prop_def
->
name
);
prop_entry
->
prop
.
id
=
prop_def
->
id
;
}
else
{
if
(
ISPIDSTR
(
pszName
))
{
HeapFree
(
GetProcessHeap
(),
0
,
prop_entry
);
HeapFree
(
GetProcessHeap
(),
0
,
header
);
return
MIME_E_NOT_FOUND
;
}
prop_entry
->
prop
.
name
=
strdupA
(
pszName
);
prop_entry
->
prop
.
id
=
This
->
next_prop_id
++
;
}
prop_entry
->
prop
.
flags
=
0
;
prop_entry
->
prop
.
default_vt
=
pValue
->
vt
;
list_add_tail
(
&
This
->
new_props
,
&
prop_entry
->
entry
);
...
...
dlls/inetcomm/tests/mimeole.c
View file @
4c92dd98
...
...
@@ -379,6 +379,47 @@ static void test_MessageSetProp(void)
PropVariantClear
(
&
prop
);
}
prop
.
vt
=
VT_LPSTR
;
prop
.
u
.
pszVal
=
CoTaskMemAlloc
(
strlen
(
topic
)
+
1
);
strcpy
(
prop
.
u
.
pszVal
,
topic
);
hr
=
IMimeBody_SetProp
(
body
,
PIDTOSTR
(
PID_HDR_SUBJECT
),
0
,
&
prop
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
PropVariantClear
(
&
prop
);
hr
=
IMimeBody_GetProp
(
body
,
PIDTOSTR
(
PID_HDR_SUBJECT
),
0
,
&
prop
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
prop
.
vt
==
VT_LPSTR
,
"type %d
\n
"
,
prop
.
vt
);
ok
(
!
strcmp
(
prop
.
u
.
pszVal
,
topic
),
"got %s
\n
"
,
prop
.
u
.
pszVal
);
PropVariantClear
(
&
prop
);
}
/* Using the name or PID returns the same result. */
hr
=
IMimeBody_GetProp
(
body
,
"Subject"
,
0
,
&
prop
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
if
(
hr
==
S_OK
)
{
ok
(
prop
.
vt
==
VT_LPSTR
,
"type %d
\n
"
,
prop
.
vt
);
ok
(
!
strcmp
(
prop
.
u
.
pszVal
,
topic
),
"got %s
\n
"
,
prop
.
u
.
pszVal
);
PropVariantClear
(
&
prop
);
}
prop
.
vt
=
VT_LPSTR
;
prop
.
u
.
pszVal
=
CoTaskMemAlloc
(
strlen
(
topic
)
+
1
);
strcpy
(
prop
.
u
.
pszVal
,
topic
);
hr
=
IMimeBody_SetProp
(
body
,
PIDTOSTR
(
PID_HDR_TO
),
0
,
&
prop
);
ok
(
hr
==
S_OK
,
"ret %08x
\n
"
,
hr
);
PropVariantClear
(
&
prop
);
/* Out of Range PID */
prop
.
vt
=
VT_LPSTR
;
prop
.
u
.
pszVal
=
CoTaskMemAlloc
(
strlen
(
topic
)
+
1
);
strcpy
(
prop
.
u
.
pszVal
,
topic
);
hr
=
IMimeBody_SetProp
(
body
,
PIDTOSTR
(
124
),
0
,
&
prop
);
ok
(
hr
==
MIME_E_NOT_FOUND
,
"ret %08x
\n
"
,
hr
);
PropVariantClear
(
&
prop
);
IMimeBody_Release
(
body
);
IMimeMessage_Release
(
msg
);
}
...
...
include/mimeole.idl
View file @
4c92dd98
...
...
@@ -153,6 +153,10 @@ cpp_quote(" PID_ATT_ACCOUNTNAME = 78,")
cpp_quote
(
" PID_LAST = 79,"
)
cpp_quote
(
"} MIMEPROPID;"
)
cpp_quote
(
"#define ISPIDSTR(_name) (((DWORD_PTR)(_name) >> 16) == 0)"
)
cpp_quote
(
"#define STRTOPID(_name) ((DWORD)((DWORD_PTR)((LPCSTR)(_name))))"
)
cpp_quote
(
"#define PIDTOSTR(_id) ((LPCSTR)((DWORD_PTR)(_id)))"
)
cpp_quote
(
"#define TYPEDID_ID(_typedid) (((ULONG)(_typedid))>>16)"
)
cpp_quote
(
"#define TYPEDID_MASK ((ULONG)0xffff)"
)
cpp_quote
(
"#define TYPEDID_TYPE(t) ((VARTYPE)((t) & TYPEDID_MASK))"
)
...
...
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