ReactOS 0.4.16-dev-319-g6cf4263
imalloc.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "winerror.h"
#include "winternl.h"
#include "objbase.h"
#include "shlwapi.h"
#include "mapiutil.h"
#include "util.h"
#include "wine/debug.h"
Include dependency graph for imalloc.c:

Go to the source code of this file.

Classes

struct  MAPI_IMALLOC
 

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (mapi)
 
LPMALLOC WINAPI MAPIGetDefaultMalloc (void)
 
static HRESULT WINAPI IMAPIMalloc_fnQueryInterface (LPMALLOC iface, REFIID refiid, LPVOID *ppvObj)
 
static ULONG WINAPI IMAPIMalloc_fnAddRef (LPMALLOC iface)
 
static ULONG WINAPI IMAPIMalloc_fnRelease (LPMALLOC iface)
 
static LPVOID WINAPI IMAPIMalloc_fnAlloc (LPMALLOC iface, SIZE_T cb)
 
static LPVOID WINAPI IMAPIMalloc_fnRealloc (LPMALLOC iface, LPVOID pv, SIZE_T cb)
 
static void WINAPI IMAPIMalloc_fnFree (LPMALLOC iface, LPVOID pv)
 
static SIZE_T WINAPI IMAPIMalloc_fnGetSize (LPMALLOC iface, LPVOID pv)
 
static INT WINAPI IMAPIMalloc_fnDidAlloc (LPMALLOC iface, LPVOID pv)
 
static void WINAPI IMAPIMalloc_fnHeapMinimize (LPMALLOC iface)
 

Variables

static const IMallocVtbl MAPI_IMalloc_vt
 
static MAPI_IMALLOC MAPI_IMalloc = { { &MAPI_IMalloc_vt }, 0 }
 
LONG MAPI_ObjectCount
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file imalloc.c.

Function Documentation

◆ IMAPIMalloc_fnAddRef()

static ULONG WINAPI IMAPIMalloc_fnAddRef ( LPMALLOC  iface)
static

Definition at line 95 of file imalloc.c.

96{
97 TRACE("(%p)\n", iface);
99 return 1u;
100}
#define InterlockedIncrement
Definition: armddk.h:53
LONG MAPI_ObjectCount
Definition: mapi32_main.c:36
#define TRACE(s)
Definition: solgame.cpp:4

◆ IMAPIMalloc_fnAlloc()

static LPVOID WINAPI IMAPIMalloc_fnAlloc ( LPMALLOC  iface,
SIZE_T  cb 
)
static

Definition at line 115 of file imalloc.c.

116{
117 TRACE("(%p)->(%ld)\n", iface, cb);
118
119 return LocalAlloc(LMEM_FIXED, cb);
120}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
static HMODULE MODULEINFO DWORD cb
Definition: module.c:33
#define LMEM_FIXED
Definition: winbase.h:394

◆ IMAPIMalloc_fnDidAlloc()

static INT WINAPI IMAPIMalloc_fnDidAlloc ( LPMALLOC  iface,
LPVOID  pv 
)
static

Definition at line 160 of file imalloc.c.

161{
162 TRACE("(%p)->(%p)\n", iface, pv);
163 return -1;
164}

◆ IMAPIMalloc_fnFree()

static void WINAPI IMAPIMalloc_fnFree ( LPMALLOC  iface,
LPVOID  pv 
)
static

Definition at line 142 of file imalloc.c.

143{
144 TRACE("(%p)->(%p)\n", iface, pv);
145 LocalFree(pv);
146}
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594

◆ IMAPIMalloc_fnGetSize()

static SIZE_T WINAPI IMAPIMalloc_fnGetSize ( LPMALLOC  iface,
LPVOID  pv 
)
static

Definition at line 151 of file imalloc.c.

152{
153 TRACE("(%p)->(%p)\n", iface, pv);
154 return LocalSize(pv);
155}
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1794

◆ IMAPIMalloc_fnHeapMinimize()

static void WINAPI IMAPIMalloc_fnHeapMinimize ( LPMALLOC  iface)
static

Definition at line 169 of file imalloc.c.

170{
171 TRACE("(%p)\n", iface);
172}

◆ IMAPIMalloc_fnQueryInterface()

static HRESULT WINAPI IMAPIMalloc_fnQueryInterface ( LPMALLOC  iface,
REFIID  refiid,
LPVOID ppvObj 
)
static

Definition at line 76 of file imalloc.c.

78{
79 TRACE("(%s,%p)\n", debugstr_guid(refiid), ppvObj);
80
81 if (IsEqualIID(refiid, &IID_IUnknown) ||
82 IsEqualIID(refiid, &IID_IMalloc))
83 {
84 *ppvObj = &MAPI_IMalloc;
85 TRACE("Returning IMalloc (%p)\n", *ppvObj);
86 return S_OK;
87 }
88 TRACE("Returning E_NOINTERFACE\n");
89 return E_NOINTERFACE;
90}
const GUID IID_IUnknown
static MAPI_IMALLOC MAPI_IMalloc
Definition: imalloc.c:47
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ IMAPIMalloc_fnRealloc()

static LPVOID WINAPI IMAPIMalloc_fnRealloc ( LPMALLOC  iface,
LPVOID  pv,
SIZE_T  cb 
)
static

Definition at line 125 of file imalloc.c.

126{
127 TRACE("(%p)->(%p, %ld)\n", iface, pv, cb);
128
129 if (!pv)
130 return LocalAlloc(LMEM_FIXED, cb);
131
132 if (cb)
133 return LocalReAlloc(pv, cb, LMEM_MOVEABLE);
134
135 LocalFree(pv);
136 return NULL;
137}
#define NULL
Definition: types.h:112
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
#define LMEM_MOVEABLE
Definition: winbase.h:395

◆ IMAPIMalloc_fnRelease()

static ULONG WINAPI IMAPIMalloc_fnRelease ( LPMALLOC  iface)
static

Definition at line 105 of file imalloc.c.

106{
107 TRACE("(%p)\n", iface);
109 return 1u;
110}
#define InterlockedDecrement
Definition: armddk.h:52

◆ MAPIGetDefaultMalloc()

LPMALLOC WINAPI MAPIGetDefaultMalloc ( void  )

Definition at line 62 of file imalloc.c.

63{
64 TRACE("()\n");
65
66 if (mapiFunctions.MAPIGetDefaultMalloc)
67 return mapiFunctions.MAPIGetDefaultMalloc();
68
69 IMalloc_AddRef(&MAPI_IMalloc.IMalloc_iface);
71}
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:49
IMalloc IMalloc_iface
Definition: imalloc.c:43

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( mapi  )

Variable Documentation

◆ MAPI_IMalloc

MAPI_IMALLOC MAPI_IMalloc = { { &MAPI_IMalloc_vt }, 0 }
static

Definition at line 47 of file imalloc.c.

Referenced by IMAPIMalloc_fnQueryInterface(), and MAPIGetDefaultMalloc().

◆ MAPI_IMalloc_vt

static const IMallocVtbl MAPI_IMalloc_vt
static
Initial value:
=
{
}
static SIZE_T WINAPI IMAPIMalloc_fnGetSize(LPMALLOC iface, LPVOID pv)
Definition: imalloc.c:151
static ULONG WINAPI IMAPIMalloc_fnAddRef(LPMALLOC iface)
Definition: imalloc.c:95
static HRESULT WINAPI IMAPIMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid, LPVOID *ppvObj)
Definition: imalloc.c:76
static LPVOID WINAPI IMAPIMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, SIZE_T cb)
Definition: imalloc.c:125
static void WINAPI IMAPIMalloc_fnHeapMinimize(LPMALLOC iface)
Definition: imalloc.c:169
static ULONG WINAPI IMAPIMalloc_fnRelease(LPMALLOC iface)
Definition: imalloc.c:105
static LPVOID WINAPI IMAPIMalloc_fnAlloc(LPMALLOC iface, SIZE_T cb)
Definition: imalloc.c:115
static INT WINAPI IMAPIMalloc_fnDidAlloc(LPMALLOC iface, LPVOID pv)
Definition: imalloc.c:160
static void WINAPI IMAPIMalloc_fnFree(LPMALLOC iface, LPVOID pv)
Definition: imalloc.c:142

Definition at line 39 of file imalloc.c.

◆ MAPI_ObjectCount

LONG MAPI_ObjectCount
extern