MSDN Library
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

MAPIFreeBuffer

Windows Mobile 6.5
4/8/2010

The MAPIFreeBuffer function frees a memory buffer that was previously allocated with a call to either the MAPIAllocateBuffer function, or the MAPIAllocateMore function.


ULONG MAPIFreeBuffer(
  LPVOID lpBuffer 
);

lpBuffer

[in] Pointer to a previously allocated memory buffer; if NULL, MAPIFreeBuffer does nothing.

S_OK

The call succeeded and freed the memory requested. MAPIFreeBuffer can also return S_OK on already freed locations or if memory block is not allocated with MAPIAllocateBuffer and MAPIAllocateMore.

Usually, when a client application or service provider calls MAPIAllocateBuffer or MAPIAllocateMore, the operating system constructs in one contiguous memory buffer one or more complex structures with multiple levels of pointers. When a MAPI function or method creates a buffer with such contents, a client can later free all the structures contained in the buffer by passing to MAPIFreeBuffer the pointer to the buffer returned by the MAPI function that created the buffer. For a service provider to free a memory buffer using MAPIFreeBuffer, it must pass the pointer to that buffer returned with the provider's support object.

The call to MAPIFreeBuffer to free a particular buffer must be made as soon as a client or provider is finished using this buffer.

A client or service provider should operate on the assumption that the pointer passed in lpBuffer is not valid after a successful return from MAPIFreeBuffer. If the pointer indicates either a memory block not allocated by the messaging system through MAPIAllocateBuffer or MAPIAllocateMore or a free memory block, the behavior of MAPIFreeBuffer is undefined.

Bb415578.note(en-us,MSDN.10).gifNote:
Passing a null pointer to MAPIFreeBuffer makes application cleanup code simpler and smaller because MAPIFreeBuffer can initialize pointers to NULL and then free them in the cleanup code without having to test them first.

Headermapix.h
Librarycemapi.lib
Windows Embedded CEWindows CE 3.0 and later
Windows MobilePocket PC 2002 and later, Smartphone 2002 and later

Reference

MAPI Functions

Other Resources

Messaging

Community Additions

Show:
© 2016 Microsoft