Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.7 KiB

/***************************************************************************\
* memalloc.c
*
* Copyright (c) 1991 Microsoft Corporation
*
* memory allocation routines for WINMETER
*
* History:
* Written by Hadi Partovi (t-hadip) summer 1991
\***************************************************************************/
#include "winmeter.h"
/***************************************************************************\
* MemAlloc()
*
* Entry: Size to allocate
* Exit: A pointer to new block. If error, it exits the program
\***************************************************************************/
LPVOID MemAlloc(
DWORD dwSize) // size to allocate
{
char *p;
p = (char *) LocalAlloc(LPTR, dwSize);
if (p==NULL) {
ErrorExit(MyLoadString(IDS_OUTOFMEMORY));
}
return (LPVOID) p;
}
/***************************************************************************\
* MemFree()
*
* Entry: a long pointer
* Exit: frees the memory pointed to by the pointer
\***************************************************************************/
void MemFree(
LPVOID ptr) // pointer to memory to release
{
AssertNotNull(ptr);
SetSigBAD(ptr);
LocalFree((LOCALHANDLE)ptr);
return;
}
/***************************************************************************\
* MemReAlloc()
*
* Entry: A pointer to a block, and a Size to Reallocate
* Exit: A pointer to new block. If error, it exits the program
\***************************************************************************/
LPVOID MemReAlloc(
LPVOID p, // pointer to reallocate
DWORD dwSize) // size to reallocate
{
AssertNotNull(p);
MemFree(p);
return MemAlloc(dwSize);
}