windows-nt/Source/XPSP1/NT/base/fs/utils/tuneup/jcohen.h
2020-09-26 16:20:57 +08:00

49 lines
1.3 KiB
C

// ************************************************************************
//
// JCOHEN.H
//
// Microsoft Confidential
// Copyright (c) Microsoft Corporation 1998
// All rights reserved
//
// Contains common include files, macros, and other stuff I use
// all the time.
//
// ************************************************************************
#ifndef _JCOHEN_H_
#define _JCOHEN_H_
//
// Include files
//
#include <windows.h>
#define NULLSTR _T("")
#define NULLCHR _T('\0')
//
// Macros.
//
// Memory managing macros.
//
#define MALLOC(cb) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb)
#define REALLOC(lp, cb) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lp, cb)
#define FREE(lp) ( (lp != NULL) ? ( (HeapFree(GetProcessHeap(), HEAP_NO_SERIALIZE, (LPVOID) lp)) ? ((lp = NULL) == NULL) : (FALSE) ) : (FALSE) )
#define NETFREE(lp) ( (lp != NULL) ? ( (NetApiBufferFree((LPVOID) lp)) ? ((lp = NULL) == NULL) : (FALSE) ) : (FALSE) )
// Misc. macros.
//
#define EXIST(lpFileName) ( (GetFileAttributes(lpFileName) == 0xFFFFFFFF) ? (FALSE) : (TRUE) )
#define ISNUM(cChar) ((cChar >= '0') && (cChar <= '9')) ? (TRUE) : (FALSE)
#define UPPER(x) ( ( (x >= 'a') && (x <= 'z') ) ? (x + 'A' - 'a') : (x) )
#define RANDOM(low, high) (high - low + 1) ? rand() % (high - low + 1) + low : 0
#endif // _JCOHEN_H_