Leaked source code of windows server 2003
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.

74 lines
2.0 KiB

  1. #ifndef UTIL_H /* Allow this file to be included at will */
  2. #define UTIL_H
  3. #ifndef _FILE_DEFINED
  4. #include <stdio.h> /* Needed for FPrintF2 prototype */
  5. #endif /* !_FILE_DEFINED */
  6. /* system node keys
  7. /**/
  8. extern const KEY rgkeySTATIC[7];
  9. #define pkeyNull ((KEY *)(rgkeySTATIC+0))
  10. #define pkeyOwnExt ((KEY *)(rgkeySTATIC+1))
  11. #define pkeyAvailExt ((KEY *)(rgkeySTATIC+2))
  12. #define pkeyData ((KEY *)(rgkeySTATIC+3))
  13. #define pkeyLong ((KEY *)(rgkeySTATIC+4))
  14. #define pkeyAutoInc ((KEY *)(rgkeySTATIC+5))
  15. #define pkeyDatabases ((KEY *)(rgkeySTATIC+6))
  16. extern RES rgres[];
  17. /* NOTE: whenever this is changed, also update the rgres[] in sysinit.c */
  18. #define iresCSR 0
  19. #define iresFCB 1
  20. #define iresFUCB 2
  21. #define iresIDB 3
  22. #define iresPIB 4
  23. #define iresSCB 5
  24. #define iresDAB 6
  25. #define iresLinkedMax 7 // the last linked ires + 1
  26. #define iresVER 7
  27. #define iresBF 8
  28. #define iresMax 9 // max all category
  29. /**************** function prototypes *********************
  30. /**********************************************************
  31. /**/
  32. ERR ErrMEMInit( VOID );
  33. BYTE *PbMEMAlloc( int ires);
  34. VOID MEMRelease( int ires, BYTE *pb );
  35. VOID MEMTerm( VOID );
  36. #define PbMEMPreferredThreshold( ires ) ( rgres[ires].pbPreferredThreshold )
  37. #define PbMEMMax( ires ) ( rgres[ires].pbAlloc + ( rgres[ires].cblockAlloc * rgres[ires].cbSize ) )
  38. #ifdef MEM_CHECK
  39. VOID MEMCheck( VOID );
  40. #else
  41. #define MEMCheck()
  42. #endif
  43. #ifdef DEBUG
  44. void VARARG PrintF2(const char * fmt, ...);
  45. void VARARG FPrintF2(const char * fmt, ...);
  46. VOID MEMPrintStat( VOID );
  47. #define PrintF PrintF2
  48. #else
  49. #define PrintF()
  50. #endif
  51. STATIC INLINE INT CmpStKey( BYTE *stKey, const KEY *pkey )
  52. {
  53. INT s;
  54. INT sDiff;
  55. sDiff = *stKey - pkey->cb;
  56. s = memcmp( stKey + 1, pkey->pb, sDiff < 0 ? (INT)*stKey : pkey->cb );
  57. return s ? s : sDiff;
  58. }
  59. INT CmpPartialKeyKey( KEY *pkey1, KEY *pkey2 );
  60. #endif /* !UTIL_H */