' ########################################################################################
' Microsoft Windows
' File: MAPIHook.inc
' Contents: Defines the SpoolerMsgHook provider interface.
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_MAPIHook_PBI)
#DEFINE PBX_MAPIHook_PBI
%EQUATE `MAPIHOOK_INC = 1
#INCLUDE ONCE "Legacy/UI/MAPIGuid.inc"
#INCLUDE ONCE "mapidefs.inc
#INCLUDE ONCE "mapicode.inc
#INCLUDE ONCE "mapitags.inc
'/* ISpoolerHook Interface ------------------------------------------------ */
'/* MsgHooks */
%EQUATE `HOOK_DELETE = &H00000001
%EQUATE `HOOK_CANCEL = &H00000002
' ========================================================================================
' ISpoolerHook interface
' $IID_ISpoolerHook = GUID$("{00020320-0000-0000-C000-000000000046}")
' The ISpoolerHook interface enables a messaging hook provider to process messages before
' they go to their destination. This processing can include modifying the message,
' changing the list of recipients, saving a copy of the message elsewhere, and so on.
' ========================================================================================
INTERFACE ISpoolerHook $IID_ISpoolerHook
 INHERIT IUnknown
 ' =====================================================================================
 METHOD InboundMsgHook ( ' VTable offset = 12
 BYVAL lpMessage AS IMessage
 , BYVAL lpFolder AS IMAPIFolder
 , BYVAL lpMDB AS IMsgStore
 , BYREF lpulFlags AS DWORD
 , BYREF lpcbEntryID AS DWORD
 , BYREF lppEntryID AS DWORD
 ) AS LONG
 ' =====================================================================================
 METHOD OutboundMsgHook ( ' VTable offset = 16
 BYVAL lpMessage AS IMessage
 , BYVAL lpFolder AS IMAPIFolder
 , BYVAL lpMDB AS IMsgStore
 , BYREF lpulFlags AS DWORD
 , BYREF lpcbEntryID AS DWORD
 , BYREF lppEntryID AS DWORD
 ) AS LONG
 ' =====================================================================================
END INTERFACE
'/* Hook Provider Entry Point */
%EQUATE `HOOK_INBOUND = &H00000200
%EQUATE `HOOK_OUTBOUND = &H00000400
'typedef HRESULT (STDMAPIINITCALLTYPE HPPROVIDERINIT)(
' LPMAPISESSION lpSession,
' HINSTANCE hInstance,
' LPALLOCATEBUFFER lpAllocateBuffer,
' LPALLOCATEMORE lpAllocateMore,
' LPFREEBUFFER lpFreeBuffer,
' LPMAPIUID lpSectionUID,
' ULONG ulFlags,
' LPSPOOLERHOOK FAR * lppSpoolerHook
');
' Note: This is a prorotype for a function that you have to implement.
'FUNCTION HPProviderInit ( ' BYVAL lpSession AS IUnknown
' , BYVAL hInstance AS DWORD
' , BYVAL lpAllocateBuffer AS DWORD
' , BYVAL lpAllocateMore AS DWORD
' , BYVAL lpFreeBuffer AS DWORD
' , BYVAL lpSectionUID AS DWORD
' , BYVAL ulFlags AS DWORD
' , BYREF lppSpoolerHook AS IUnknown
' ) AS LONG
#ENDIF
