27#define MSVCRT_size_t size_t
28#define MSVCRT_intptr_t intptr_t
29#define MSVCRT_wchar_t wchar_t
30#define MSVCRT__HEAPBADNODE _HEAPBADNODE
31#define MSVCRT__HEAPOK _HEAPOK
32#define MSVCRT__HEAPEND _HEAPEND
33#define MSVCRT__FREEENTRY _FREEENTRY
34#define MSVCRT__USEDENTRY _USEDENTRY
35#define MSVCRT__HEAPBADBEGIN _HEAPBADBEGIN
36#define MSVCRT_EINVAL EINVAL
37#define MSVCRT_ENOSYS ENOSYS
38#define MSVCRT_ENOMEM ENOMEM
39#define MSVCRT_ERANGE ERANGE
40#define MSVCRT__TRUNCATE _TRUNCATE
41#define MSVCRT__heapinfo _heapinfo
42#define MSVCRT__errno _errno
43#define MSVCRT_calloc calloc
44#define MSVCRT_malloc malloc
45#define MSVCRT_realloc realloc
46#define MSVCRT_free free
47#define MSVCRT_memcpy_s memcpy_s
48#define MSVCRT_memmove_s memmove_s
49#define MSVCRT_strncpy_s strncpy_s
50#define msvcrt_set_errno _dosmaperr
53#define LOCK_HEAP _lock( _HEAP_LOCK )
54#define UNLOCK_HEAP _unlock( _HEAP_LOCK )
57#define SAVED_PTR(x) ((void *)((DWORD_PTR)((char *)x - sizeof(void *)) & \
58 ~(sizeof(void *) - 1)))
59#define ALIGN_PTR(ptr, alignment, offset) ((void *) \
60 ((((DWORD_PTR)((char *)ptr + alignment + sizeof(void *) + offset)) & \
61 ~(alignment - 1)) - offset))
63#define SB_HEAP_ALIGN 16
81 void *memblock, *
temp, **saved;
100 void *memblock, *
temp, **saved;
101 size_t old_padding, new_padding, old_size;
104 old_padding = (
char*)
ptr - (
char*)*saved;
108 old_size -= old_padding;
115 new_padding = (
char*)memblock - (
char*)
temp;
117 if(new_padding != old_padding)
157 ret = (*handler)(
size) ? 1 : 0;
173 TRACE(
"(%Iu) returning %p\n",
size, retval);
299 FIXME(
"small blocks heap not supported\n");
378 if (
size == ~(
size_t)0)
380 WARN(
":Probably called with non wine-allocated memory, ret = -1\n");
390size_t CDECL _aligned_msize(
void *
p,
size_t alignment,
size_t offset)
396 if(alignment <
sizeof(
void*))
397 alignment =
sizeof(
void*);
400 return _msize(*alloc_ptr)-alignment-
sizeof(
void*);
569 TRACE(
"(%p)\n", memblock);
583 void *memblock, *
temp, **saved;
587 if ((alignment & (alignment - 1)) != 0)
601 if (alignment <
sizeof(
void *))
602 alignment =
sizeof(
void *);
634 size_t alignment,
size_t offset)
636 void *
temp, **saved;
637 size_t old_padding, new_padding, old_size;
644 if ((alignment & (alignment - 1)) != 0)
664 if (alignment <
sizeof(
void *))
665 alignment =
sizeof(
void *);
675 old_padding = (
char *)memblock - (
char *)*saved;
678 old_size =
_msize(*saved);
686 if (old_size < old_padding)
691 old_size -= old_padding;
705 new_padding = (
char *)memblock - (
char *)
temp;
737 if (new_padding != old_padding)
738 memmove((
char *)memblock, (
char *)
temp + old_padding, (old_size <
size) ? old_size :
size);
750 TRACE(
"(%p, %Iu, %Iu)\n", memblock,
size, alignment);
static unsigned char bytes[4]
#define InterlockedExchange
#define ERROR_CALL_NOT_IMPLEMENTED
#define ERROR_NO_MORE_ITEMS
#define HeapFree(x, y, z)
UINT(* handler)(MSIPACKAGE *)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLuint GLsizei GLenum type
GLuint GLuint GLsizei count
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 const GLfloat const GLdouble const GLfloat GLint i
HANDLE WINAPI HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
SIZE_T WINAPI HeapCompact(HANDLE hHeap, DWORD dwFlags)
BOOL WINAPI HeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
BOOL WINAPI HeapDestroy(HANDLE hHeap)
BOOL WINAPI HeapWalk(HANDLE hHeap, LPPROCESS_HEAP_ENTRY lpEntry)
_CRTIMP int __cdecl _set_sbh_threshold(_In_ size_t _NewValue)
_Check_return_ _CRTIMP size_t __cdecl _get_sbh_threshold(void)
#define memmove(s1, s2, n)
#define MSVCRT_INVALID_PMT(x)
#define MSVCRT_CHECK_PMT(x)
static size_t numberOfElements
#define HEAP_REALLOC_IN_PLACE_ONLY
static unsigned __int64 next
#define MSVCRT_CHECK_PMT_ERR(x, err)
_CRTIMP int *__cdecl _errno(void)
#define DECLSPEC_HOTPATCH
void CDECL DECLSPEC_HOTPATCH operator_delete(void *mem)
static void * msvcrt_heap_alloc(DWORD flags, size_t size)
MSVCRT_new_handler_func CDECL _query_new_handler(void)
void *CDECL _aligned_offset_malloc(size_t size, size_t alignment, size_t offset)
int CDECL memmove_s(void *dest, size_t numberOfElements, const void *src, size_t count)
BOOL msvcrt_init_heap(void)
MSVCRT_new_handler_func CDECL set_new_handler(void *func)
int CDECL memcpy_s(void *dest, size_t numberOfElements, const void *src, size_t count)
static int MSVCRT_new_mode
static size_t MSVCRT_sbh_threshold
int CDECL _heapset(unsigned int value)
void msvcrt_destroy_heap(void)
static size_t msvcrt_heap_size(void *ptr)
void *CDECL DECLSPEC_HOTPATCH operator_new(size_t size)
void *CDECL _aligned_offset_realloc(void *memblock, size_t size, size_t alignment, size_t offset)
int CDECL _query_new_mode(void)
unsigned int *CDECL __p__amblksiz(void)
int CDECL _set_new_mode(int mode)
MSVCRT_new_handler_func CDECL _set_new_handler(MSVCRT_new_handler_func func)
void *CDECL _aligned_malloc(size_t size, size_t alignment)
void *CDECL _expand(void *mem, size_t size)
int(CDECL * MSVCRT_new_handler_func)(size_t size)
static unsigned int MSVCRT_amblksiz
static MSVCRT_new_handler_func MSVCRT_new_handler
#define ALIGN_PTR(ptr, alignment, offset)
void CDECL _aligned_free(void *memblock)
int CDECL _heapadd(void *mem, size_t size)
void *CDECL _aligned_realloc(void *memblock, size_t size, size_t alignment)
static void * msvcrt_heap_realloc(DWORD flags, void *ptr, size_t size)
int CDECL _callnewh(size_t size)
size_t CDECL _msize(void *mem)
intptr_t CDECL _get_heap_handle(void)
static BOOL msvcrt_heap_free(void *ptr)
int CDECL strncpy_s(char *dest, size_t numberOfElements, const char *src, size_t count)
void *CDECL operator_new_dbg(size_t size, int type, const char *file, int line)
int CDECL _heapwalk(_HEAPINFO *next)
SIZE_T WINAPI HeapSize(HANDLE, DWORD, LPCVOID)
#define PROCESS_HEAP_UNCOMMITTED_RANGE
DWORD WINAPI GetLastError(void)
#define PROCESS_HEAP_ENTRY_BUSY
#define PROCESS_HEAP_REGION