Skip to content

Commit 8666c6c

Browse files
committed
Re-vendor MapiStubLibrary
1 parent a83b36c commit 8666c6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+29445
-15270
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ jobs:
119119
- uses: psf/black@stable
120120
with:
121121
options: "--fast --check --diff --verbose"
122-
- run: | # Too many files to fit in a single command, exclude vendored Scintilla and mapi_headers
122+
- run: | # Too many files to fit in a single command, also exclude vendored Scintilla and MAPIStubLibrary
123123
clang-format --Werror --dry-run $(git ls-files '*.cpp')
124-
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/mapi_headers/')
124+
clang-format --Werror --dry-run $(git ls-files '*.h' ':!:Pythonwin/Scintilla/' ':!:com/win32comext/mapi/src/MAPIStubLibrary/')
125125
shell: powershell
126126
127127
mypy:

.pre-commit-config.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ repos:
4242
# https://github.com/pre-commit/mirrors-clang-format/blob/main/.pre-commit-hooks.yaml#L6
4343
types: [c++]
4444

45-
4645
# Vendored
47-
exclude: ^(com/win32comext/mapi/src/mapi_headers/|Pythonwin/Scintilla/).*$
46+
exclude: ^(com/win32comext/mapi/src/MAPIStubLibrary/|Pythonwin/Scintilla/).*$
4847

4948
ci:
5049
autoupdate_schedule: quarterly
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# MAPIStubLibrary
2+
3+
The MAPI Stub Library is a drop in replacement for mapi32.lib which supports building both 32 and 64 bit MAPI applications. This library eliminates the need to explicitly link to MAPI.
4+
5+
**See the [documentation](https://msdn.microsoft.com/en-us/library/office/cc963763.aspx) for information on building the MAPI Stub Library and integrating it into your project.**
6+
**See the [FAQ](https://mapistublibrary.codeplex.com/wikipage?title=FAQ) for questions about this library, such as when and why to use it.**
7+
8+
---
9+
10+
These MAPI headers were downloaded from <https://github.com/microsoft/MAPIStubLibrary/commit/5183a5f18c388a1b964662fa48bb0f08592fc4b8> and enable us to build the MAPI extension.

com/win32comext/mapi/src/MAPIStubLibrary/include/EMSABTAG.H

+1,191
Large diffs are not rendered by default.

com/win32comext/mapi/src/mapi_headers/EdkGuid.h com/win32comext/mapi/src/MAPIStubLibrary/include/EdkGuid.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ DEFINE_GUID(IID_IExchangeManageStore, 0x559d10b0,0xa772,0x11cd,0x9b,0xc8,0x00,0x
1515
DEFINE_GUID(IID_IExchangeManageStore2,0xb6dca470, 0xff3, 0x11d0, 0xa4, 0x9, 0x0, 0xc0, 0x4f, 0xd7, 0xbd, 0x87);
1616
DEFINE_GUID(IID_IExchangeManageStore3,0x166d9bc2, 0xdb75, 0x44a9, 0x8a, 0x93, 0x9f, 0x3f, 0xfc, 0x99, 0x4d, 0x76) ;
1717
DEFINE_GUID(IID_IExchangeManageStore4,0x2590ff87, 0xc431, 0x4f9c, 0xb1, 0xa8, 0xcd, 0x69, 0xd7, 0x60, 0xcd, 0x10); // {2590FF87-C431-4f9c-B1A8-CD69D760CD10}
18+
DEFINE_GUID(IID_IExchangeManageStoreEx, 0x7fe3c629, 0x4d9a, 0x4510, 0xa4, 0x79, 0x56, 0x96, 0x2b, 0x24, 0x6d, 0xc6);
1819
DEFINE_GUID(IID_IExchangeModifyTable, 0x2d734cb0,0x53fd,0x101b,0xb1,0x9d,0x08,0x00,0x2b,0x30,0x56,0xe3);
1920
DEFINE_GUID(IID_IExchangeRuleAction, 0x74bba840,0xc93a,0x11ce,0x95,0x81,0x00,0xaa,0x00,0x57,0x42,0xf7);
21+
2022
DEFINE_GUID(IID_IExchangeFastTransfer, 0xff7db070,0xa88a,0x11cd,0x9b,0xc8,0x00,0xaa,0x00,0x2f,0xc4,0x5a);
2123

22-
DEFINE_GUID(IID_IExchangeExportChanges, 0xa3ea9cc0,0xd1b2,0x11cd,0x80,0xfc,0x00,0xaa,0x00,0x4b,0xba,0x0b);
23-
DEFINE_GUID(IID_IExchangeExportChanges2, 0x387cebe0,0xf53f,0x11cf,0xa4,0x8f,0x00,0xc0,0x4f, 0xd6, 0x55, 0x95);
24-
DEFINE_GUID(IID_IExchangeExportChanges3, 0x702e7f86,0x50a6,0x11d1,0xab,0xd6,0x00,0xa0,0xc9, 0x05, 0x66, 0x0a);
24+
DEFINE_GUID(IID_IExchangeExportChanges, 0xa3ea9cc0,0xd1b2,0x11cd,0x80,0xfc,0x00,0xaa,0x00,0x4b,0xba,0x0b);
25+
DEFINE_GUID(IID_IExchangeExportChanges2, 0x387cebe0,0xf53f,0x11cf,0xa4,0x8f,0x00,0xc0,0x4f,0xd6,0x55,0x95);
26+
DEFINE_GUID(IID_IExchangeExportChanges3, 0x702e7f86,0x50a6,0x11d1,0xab,0xd6,0x00,0xa0,0xc9,0x05,0x66,0x0a);
2527
DEFINE_GUID(IID_IExchangeImportHierarchyChanges, 0x85a66cf0,0xd0e0,0x11cd,0x80,0xfc,0x00,0xaa,0x00,0x4b,0xba,0x0b);
2628
DEFINE_GUID(IID_IExchangeImportContentsChanges, 0xf75abfa0,0xd0e0,0x11cd,0x80,0xfc,0x00,0xaa,0x00,0x4b,0xba,0x0b);
2729
DEFINE_GUID(IID_IExchangeImportContentsChanges2, 0x7dfdd720,0xf53f,0x11cf,0xa4,0x8f,0x00,0xc0,0x4f,0xd6,0x55,0x95);

com/win32comext/mapi/src/MAPIStubLibrary/include/EdkMdb.h

+2,717
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#ifndef EXCHFORM_H
2+
#define EXCHFORM_H
3+
4+
5+
/*
6+
* E X C H F O R M . H
7+
*
8+
* Declarations of interfaces and constants for forms that work with
9+
* the Microsoft Exchange client.
10+
*
11+
* Copyright 1986-1999 Microsoft Corporation. All Rights Reserved.
12+
*/
13+
14+
15+
/*
16+
* V e r b s
17+
*/
18+
19+
20+
// Interpersonal messaging verbs
21+
#define EXCHIVERB_OPEN 0
22+
#define EXCHIVERB_RESERVED_COMPOSE 100
23+
#define EXCHIVERB_RESERVED_OPEN 101
24+
#define EXCHIVERB_REPLYTOSENDER 102
25+
#define EXCHIVERB_REPLYTOALL 103
26+
#define EXCHIVERB_FORWARD 104
27+
#define EXCHIVERB_PRINT 105
28+
#define EXCHIVERB_SAVEAS 106
29+
#define EXCHIVERB_RESERVED_DELIVERY 107
30+
#define EXCHIVERB_REPLYTOFOLDER 108
31+
32+
33+
/*
34+
* G U I D s
35+
*/
36+
37+
38+
#define DEFINE_EXCHFORMGUID(name, b) \
39+
DEFINE_GUID(name, 0x00020D00 | (b), 0, 0, 0xC0,0,0,0,0,0,0,0x46)
40+
41+
#ifndef NOEXCHFORMGUIDS
42+
DEFINE_EXCHFORMGUID(PS_EXCHFORM, 0x0C);
43+
#endif // NOEXCHFORMGUIDS
44+
45+
46+
/*
47+
* E x t e n d e d P r o p e r t i e s
48+
*/
49+
50+
51+
// Operation map property
52+
#define psOpMap PS_EXCHFORM
53+
#define ulKindOpMap MNID_ID
54+
#define lidOpMap 1
55+
#define ptOpMap PT_STRING8
56+
57+
// Operation map indices
58+
#define ichOpMapReservedCompose 0
59+
#define ichOpMapOpen 1
60+
#define ichOpMapReplyToSender 2
61+
#define ichOpMapReplyToAll 3
62+
#define ichOpMapForward 4
63+
#define ichOpMapPrint 5
64+
#define ichOpMapSaveAs 6
65+
#define ichOpMapReservedDelivery 7
66+
#define ichOpMapReplyToFolder 8
67+
68+
// Operation map values
69+
#define chOpMapByClient '0'
70+
#define chOpMapByForm '1'
71+
#define chOpMapDisable '2'
72+
73+
74+
#endif // EXCHFORM_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#ifndef IMSCAPABILITIESGUID_H
2+
#ifdef INITGUID
3+
#include <mapiguid.h>
4+
#define IMSCAPABILITIESGUID_H
5+
#endif /* INITGUID */
6+
7+
// {00020393-0000-0000-C000-000000000046}
8+
#if !defined(INITGUID) || defined(USES_IID_IMSCapabilities)
9+
DEFINE_OLEGUID(IID_IMSCapabilities, 0x00020393, 0, 0);
10+
#endif
11+
12+
#endif /* IMSCAPABILITIESGUID_H */
13+
14+
#ifndef IMSCAPABILITIES_H
15+
#define IMSCAPABILITIES_H
16+
17+
#ifdef __cplusplus
18+
extern "C"
19+
{
20+
#endif
21+
22+
#ifndef BEGIN_INTERFACE
23+
#define BEGIN_INTERFACE
24+
#endif
25+
26+
// IMSCapabilities - advertises capabilities of the given store provider
27+
28+
/* Selector values for GetCapabilities() */
29+
enum class MSCAP_SELECTOR
30+
{
31+
MSCAP_SEL_RESERVED1 = 0,
32+
MSCAP_SEL_RESERVED2 = 1,
33+
MSCAP_SEL_FOLDER = 2,
34+
MSCAP_SEL_RESERVED3 = 3,
35+
MSCAP_SEL_RESTRICTION = 4,
36+
};
37+
38+
/* Return values for GetCapabilities */
39+
/* Values based on selector used to query */
40+
41+
// MSCAP_SEL_FOLDER
42+
// Support for folder homepages in non-default stores
43+
#define MSCAP_SECURE_FOLDER_HOMEPAGES ((ULONG) 0x00000001)
44+
45+
// MSCAP_SEL_RESTRICTION
46+
// Support for RES_ANNOTATION restrictions
47+
#define MSCAP_RES_ANNOTATION ((ULONG) 0x00000001)
48+
49+
#define MAPI_IMSCAPABILITIES_METHODS(IPURE) \
50+
MAPIMETHOD_(ULONG, GetCapabilities) (THIS_ MSCAP_SELECTOR mscapSelector);
51+
52+
#undef INTERFACE
53+
#define INTERFACE IMSCapabilities
54+
DECLARE_MAPI_INTERFACE_(IMSCapabilities, IUnknown)
55+
{
56+
MAPI_IUNKNOWN_METHODS(PURE)
57+
MAPI_IMSCAPABILITIES_METHODS(PURE)
58+
};
59+
60+
DECLARE_MAPI_INTERFACE_PTR(IMSCapabilities, LPMSCAPABILITIES);
61+
62+
#ifdef __cplusplus
63+
} /* extern "C" */
64+
#endif
65+
66+
#endif /* IMSCAPABILITIES_H */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
/*
2+
* I M E S S A G E . H
3+
*
4+
* External definitions for MAPI's IMessage-on-IStorage facility
5+
*
6+
* Copyright 1986-1999 Microsoft Corporation. All Rights Reserved.
7+
*/
8+
9+
#ifndef _IMESSAGE_H_
10+
#define _IMESSAGE_H_
11+
12+
#if _MSC_VER > 1000
13+
#pragma once
14+
#endif
15+
16+
#ifdef __cplusplus
17+
extern "C"
18+
{
19+
#endif
20+
21+
typedef struct _MSGSESS FAR * LPMSGSESS;
22+
23+
/* Typedef of optional callback routine to be called on last release of
24+
* top-level messages opened with OpenIMsgOnIStg
25+
*/
26+
typedef void (STDAPICALLTYPE MSGCALLRELEASE)(
27+
ULONG ulCallerData,
28+
LPMESSAGE lpMessage );
29+
30+
/* DLL Entry Points (found in mapiu.dll) */
31+
32+
/* OpenIMsgSession
33+
* CloseIMsgSession
34+
*
35+
* These entry points allow the caller to "wrap" the creation of messages
36+
* inside a session, so that when the session is closed, all messages
37+
* created within that session are closed as well. Use of IMSG sessions
38+
* is optional. If OpenIMsgOnIStg is called with a NULL for the lpmsgsess
39+
* parameter, the message is created independent of any session, and has
40+
* no way to be shutdown. If the caller forgets to release the message, or
41+
* to release open tables within the message, the memory will be leaked until
42+
* the external application terminates.
43+
*/
44+
45+
STDAPI_(SCODE) OpenIMsgSession(
46+
LPMALLOC lpMalloc, /* -> Co malloc object */
47+
ULONG ulFlags, /* reserved. Must be zero. */
48+
LPMSGSESS FAR *lppMsgSess ); /* <- message session object */
49+
50+
STDAPI_(void) CloseIMsgSession(
51+
LPMSGSESS lpMsgSess ); /* -> message session object */
52+
53+
/* OpenIMsgOnIStg - Main entry point
54+
*
55+
* NOTE 1: The IStg must be opened with STGM_TRANSACTED if STGM_READWRITE
56+
* is specified. Since messages don't support a write only mode, IMessage
57+
* doesn't allow a storage object opened in write only mode. If the storage
58+
* is opened STGM_READ, then STGM_TRANSACTED is NOT required.
59+
*
60+
* NOTE 2: The lpMapiSup parameter is optional. If supplied then IMessage
61+
* will support the MAPI_DIALOG and ATTACH_DIALOG flags (by calling
62+
* support method: DoMCDialog) on CopyTo and DeleteAttach methods.
63+
* If lpMapiSup is not supplied (i.e. passed 0) then dialog flags will be
64+
* ignored. If supplied then ModifyRecipients will attempt to convert
65+
* short term entryids to long term entryids (by calling support method
66+
* OpenAddressBook and calls on the returned object). If not supplied
67+
* then short term entryid's will be stored without conversion.
68+
*
69+
* NOTE 3: The lpfMsgCallRelease parameter is optional. If supplied then
70+
* IMessage will call the routine when the last release on (the toplevel only)
71+
* message is called. It is intended to allow the callee to free the IStorage
72+
* that contains the message. IMessage will not use the IStorage object after
73+
* making this call.
74+
*
75+
* NOTE 4: Behavior of multiple opens of sub-objects (Attachments, Streams,
76+
* Storages, Messages, etc.) within a message is deliberately undefined in
77+
* MAPI. This implementation allows them, but will do it by AddRef'ing the
78+
* existing open and returning it to the caller of OpenAttachment or
79+
* OpenProperty. This means that whatever access mode the first open on a
80+
* specific Attachment or Property had is what all others will get regardless
81+
* of what the subsequent opens asked for.
82+
*
83+
* NOTE 5: There is currently one flag defined for use with the ulFlags
84+
* parameter. The IMSG_NO_ISTG_COMMIT flag controls whether the commit
85+
* method of IStorage is called when the client calls SaveChanges on the
86+
* IMessage object. Some clients of IMessage may wish to commit the IStorage
87+
* themselves after writing additional data to the storage (beyond what
88+
* IMessage itself writes). To aid in this, the IMessage implementation
89+
* guarantees to name all sub-storages starting with "__". Therefore,
90+
* if the client keeps its names out of that namespace, there will be no
91+
* accidental collisions.
92+
*
93+
* WARNING:
94+
*
95+
* This implementation of IMessage will support OpenProperty w/MAPI_CREATE
96+
* where the source interface is IID_IStorage if the property id is
97+
* 'PR_ATTACH_DATA'. Once this has been done, the caller has an IStorage
98+
* interface on this property. This is ok and should allow for
99+
* easier implementation of OLE 2.0 Server functionality. However, if you
100+
* pass in the new IStorage ptr (to the attachment data) through the
101+
* OpenIMsgOnIStg entry point and then proceed to release things in the
102+
* wrong order we will make no attempt to behave in a predictable fashion.
103+
* Keep in mind that the correct method for placing a message into an
104+
* attachment is to call OpenProperty where the source interface is
105+
* IID_IMessage. The IStorage interface is supported to allow an easy way
106+
* to stick a WWord doc. into an attachment w/o converting to/from IStream.
107+
*
108+
*/
109+
STDAPI_(SCODE) OpenIMsgOnIStg(
110+
LPMSGSESS lpMsgSess, /* -> message session obj (optional) */
111+
LPALLOCATEBUFFER lpAllocateBuffer, /* -> AllocateBuffer memory routine */
112+
LPALLOCATEMORE lpAllocateMore, /* -> AllocateMore memory routine */
113+
LPFREEBUFFER lpFreeBuffer, /* -> FreeBuffer memory routine */
114+
LPMALLOC lpMalloc, /* -> Co malloc object */
115+
LPVOID lpMapiSup, /* -> MAPI Support Obj (optional) */
116+
LPSTORAGE lpStg, /* -> open IStorage containing msg */
117+
MSGCALLRELEASE FAR *lpfMsgCallRelease, /* -> release callback rtn (opt) */
118+
ULONG ulCallerData, /* caller data returned in callback */
119+
ULONG ulFlags, /* -> flags (controls istg commit) */
120+
LPMESSAGE FAR *lppMsg ); /* <- open message object */
121+
122+
#define IMSG_NO_ISTG_COMMIT ((ULONG) 0x00000001)
123+
124+
125+
/* NOTE: Property Attributes are specific to this IMessage on IStorage */
126+
/* implementation and are not a part of standard MAPI 1.0 property methods */
127+
128+
/* Property Attributes */
129+
130+
#define PROPATTR_MANDATORY ((ULONG) 0x00000001)
131+
#define PROPATTR_READABLE ((ULONG) 0x00000002)
132+
#define PROPATTR_WRITEABLE ((ULONG) 0x00000004)
133+
134+
#define PROPATTR_NOT_PRESENT ((ULONG) 0x00000008)
135+
136+
/* Attribute Array */
137+
138+
typedef struct _SPropAttrArray
139+
{
140+
ULONG cValues;
141+
ULONG aPropAttr[MAPI_DIM];
142+
} SPropAttrArray, FAR * LPSPropAttrArray;
143+
144+
#define CbNewSPropAttrArray(_cattr) \
145+
(offsetof(SPropAttrArray,aPropAttr) + (_cattr)*sizeof(ULONG))
146+
#define CbSPropAttrArray(_lparray) \
147+
(offsetof(SPropAttrArray,aPropAttr) + \
148+
(UINT)((_lparray)->cValues)*sizeof(ULONG))
149+
150+
#define SizedSPropAttrArray(_cattr, _name) \
151+
struct _SPropAttrArray_ ## _name \
152+
{ \
153+
ULONG cValues; \
154+
ULONG aPropAttr[_cattr]; \
155+
} _name
156+
157+
158+
159+
/* GetAttribIMsgOnIStg - To get attributes on properties
160+
*
161+
* This call is provided because there is no method of IMAPIPropSet to allow
162+
* getting attributes.
163+
*/
164+
STDAPI GetAttribIMsgOnIStg(
165+
LPVOID lpObject,
166+
LPSPropTagArray lpPropTagArray,
167+
LPSPropAttrArray FAR *lppPropAttrArray );
168+
169+
/* SetAttribIMsgOnIStg - To set attributes on properties
170+
*
171+
* This call is provided because there is no method of IMAPIPropSet to allow
172+
* setting of attributes.
173+
*/
174+
STDAPI SetAttribIMsgOnIStg(
175+
LPVOID lpObject,
176+
LPSPropTagArray lpPropTags,
177+
LPSPropAttrArray lpPropAttrs,
178+
LPSPropProblemArray FAR *lppPropProblems );
179+
180+
/* MapStorageSCode - To map an IStorage hResult to a MAPI sCode value
181+
*
182+
* This call is provided for the internal use of PDK components that base
183+
* their message implementations on IMessage. Since these components must
184+
* open the storage themselves, there is a common need to map OLE 2.0
185+
* Storage error returns to MAPI sCodes.
186+
*
187+
* WARNING: There is no guarantee that this entry point will exist in
188+
* shipped versions of mapiu.dll.
189+
*/
190+
STDAPI_(SCODE) MapStorageSCode( SCODE StgSCode );
191+
192+
193+
#ifdef __cplusplus
194+
}
195+
#endif
196+
197+
#endif /* _IMESSAGE_H_ */
198+

0 commit comments

Comments
 (0)