mirror of
https://github.com/reactos/reactos.git
synced 2024-08-18 17:37:02 +00:00
71 lines
1.2 KiB
C
71 lines
1.2 KiB
C
/* ---------- dfalloc.c ---------- */
|
|
|
|
#define WIN32_LEAN_AND_MEAN
|
|
#include <windows.h>
|
|
|
|
#include "dflat.h"
|
|
|
|
static void AllocationError(void)
|
|
{
|
|
static BOOL OnceIn = FALSE;
|
|
extern jmp_buf AllocError;
|
|
extern BOOL AllocTesting;
|
|
static char *ErrMsg[] = {
|
|
"ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿",
|
|
"³ Out of Memory! ³",
|
|
"RÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄU"
|
|
};
|
|
int x, y;
|
|
CHAR_INFO savbuf[54];
|
|
DFRECT rc = {30,11,47,13};
|
|
INPUT_RECORD ir;
|
|
|
|
if (!OnceIn)
|
|
{
|
|
OnceIn = TRUE;
|
|
/* ------ close all windows ------ */
|
|
DfSendMessage(DfApplicationWindow, DFM_CLOSE_WINDOW, 0, 0);
|
|
DfGetVideo(rc, savbuf);
|
|
for (x = 0; x < 18; x++)
|
|
{
|
|
for (y = 0; y < 3; y++)
|
|
{
|
|
int c = (255 & (*(*(ErrMsg+y)+x))) | 0x7000;
|
|
DfPutVideoChar(x+rc.lf, y+rc.tp, c);
|
|
}
|
|
}
|
|
DfGetKey(&ir);
|
|
DfStoreVideo(rc, savbuf);
|
|
if (AllocTesting)
|
|
longjmp(AllocError, 1);
|
|
}
|
|
}
|
|
|
|
void *DfCalloc(size_t nitems, size_t size)
|
|
{
|
|
void *rtn = calloc(nitems, size);
|
|
if (size && rtn == NULL)
|
|
AllocationError();
|
|
return rtn;
|
|
}
|
|
|
|
void *DfMalloc(size_t size)
|
|
{
|
|
void *rtn = malloc(size);
|
|
if (size && rtn == NULL)
|
|
AllocationError();
|
|
return rtn;
|
|
}
|
|
|
|
void *DfRealloc(void *block, size_t size)
|
|
{
|
|
void *rtn;
|
|
|
|
rtn = realloc(block, size);
|
|
if (size && rtn == NULL)
|
|
AllocationError();
|
|
return rtn;
|
|
}
|
|
|
|
/* EOF */
|