Source code of Windows XP (NT5)
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.

48 lines
1.3 KiB

  1. // ************************************************************************
  2. //
  3. // JCOHEN.H
  4. //
  5. // Microsoft Confidential
  6. // Copyright (c) Microsoft Corporation 1998
  7. // All rights reserved
  8. //
  9. // Contains common include files, macros, and other stuff I use
  10. // all the time.
  11. //
  12. // ************************************************************************
  13. #ifndef _JCOHEN_H_
  14. #define _JCOHEN_H_
  15. //
  16. // Include files
  17. //
  18. #include <windows.h>
  19. #define NULLSTR _T("")
  20. #define NULLCHR _T('\0')
  21. //
  22. // Macros.
  23. //
  24. // Memory managing macros.
  25. //
  26. #define MALLOC(cb) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cb)
  27. #define REALLOC(lp, cb) HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lp, cb)
  28. #define FREE(lp) ( (lp != NULL) ? ( (HeapFree(GetProcessHeap(), HEAP_NO_SERIALIZE, (LPVOID) lp)) ? ((lp = NULL) == NULL) : (FALSE) ) : (FALSE) )
  29. #define NETFREE(lp) ( (lp != NULL) ? ( (NetApiBufferFree((LPVOID) lp)) ? ((lp = NULL) == NULL) : (FALSE) ) : (FALSE) )
  30. // Misc. macros.
  31. //
  32. #define EXIST(lpFileName) ( (GetFileAttributes(lpFileName) == 0xFFFFFFFF) ? (FALSE) : (TRUE) )
  33. #define ISNUM(cChar) ((cChar >= '0') && (cChar <= '9')) ? (TRUE) : (FALSE)
  34. #define UPPER(x) ( ( (x >= 'a') && (x <= 'z') ) ? (x + 'A' - 'a') : (x) )
  35. #define RANDOM(low, high) (high - low + 1) ? rand() % (high - low + 1) + low : 0
  36. #endif // _JCOHEN_H_