ReactOS  0.4.14-dev-57-g333b8f1
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 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
LONG MAPI_ObjectCount
Definition: mapi32_main.c:36
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ 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 }
#define LMEM_FIXED
Definition: winbase.h:349
#define TRACE(s)
Definition: solgame.cpp:4
static DWORD cb
Definition: integrity.c:41
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577

◆ 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:1777
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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 }
#define TRACE(s)
Definition: solgame.cpp:4

◆ 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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static MAPI_IMALLOC MAPI_IMalloc
Definition: imalloc.c:47
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define LMEM_FIXED
Definition: winbase.h:349
#define TRACE(s)
Definition: solgame.cpp:4
#define LMEM_MOVEABLE
Definition: winbase.h:350
static DWORD cb
Definition: integrity.c:41
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1608
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373

◆ 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 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
LONG MAPI_ObjectCount
Definition: mapi32_main.c:36
#define TRACE(s)
Definition: solgame.cpp:4
#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 }
#define TRACE(s)
Definition: solgame.cpp:4
static MAPI_IMALLOC MAPI_IMalloc
Definition: imalloc.c:47
MAPI_FUNCTIONS mapiFunctions
Definition: util.c:50
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 INT WINAPI IMAPIMalloc_fnDidAlloc(LPMALLOC iface, LPVOID pv)
Definition: imalloc.c:160
static ULONG WINAPI IMAPIMalloc_fnAddRef(LPMALLOC iface)
Definition: imalloc.c:95
static ULONG WINAPI IMAPIMalloc_fnRelease(LPMALLOC iface)
Definition: imalloc.c:105
static void WINAPI IMAPIMalloc_fnHeapMinimize(LPMALLOC iface)
Definition: imalloc.c:169
static void WINAPI IMAPIMalloc_fnFree(LPMALLOC iface, LPVOID pv)
Definition: imalloc.c:142
static LPVOID WINAPI IMAPIMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, SIZE_T cb)
Definition: imalloc.c:125
static LPVOID WINAPI IMAPIMalloc_fnAlloc(LPMALLOC iface, SIZE_T cb)
Definition: imalloc.c:115
static HRESULT WINAPI IMAPIMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid, LPVOID *ppvObj)
Definition: imalloc.c:76

Definition at line 39 of file imalloc.c.

◆ MAPI_ObjectCount

LONG MAPI_ObjectCount