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.

172 lines
4.4 KiB

  1. //############################################################################
  2. //#
  3. //# Microsoft Windows
  4. //# Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //# All rights reserved.
  6. //#
  7. //############################################################################
  8. //
  9. //+----------------------------------------------------------------------------
  10. // File: W4CTSUPP.HXX
  11. //
  12. // Contents: defines, macros, and prototypes for functions in w4ctsupp.cxx
  13. //
  14. // Created: RichE March 1992
  15. // Modified: added STGM_STREAM declaration t-chrisy 7/30/92
  16. //-----------------------------------------------------------------------------
  17. #ifndef __W4CTSUPP_HXX__
  18. #define __W4CTSUPP_HXX__
  19. extern "C"
  20. {
  21. #include <memory.h>
  22. #include <stdio.h>
  23. #include <limits.h>
  24. #include <io.h>
  25. #include <assert.h>
  26. }
  27. #include <windows.h>
  28. #include <storage.h>
  29. #include <dfdeb.hxx>
  30. #define STGM_STREAM (STGM_READWRITE|STGM_SHARE_EXCLUSIVE)
  31. #ifdef UNICODE
  32. #define tcslen wcslen
  33. #define tsccpy wcscpy
  34. #define tcscmp wcscmp
  35. #define MAX_STG_NAME_LEN CWCSTORAGENAME
  36. #define TCHAR_NIL (wchar_t)'\0'
  37. #include <wchar.h>
  38. #else
  39. #define tcslen strlen
  40. #define tcscpy strcpy
  41. #define tcscmp strcmp
  42. #define TCHAR_NIL '\0'
  43. #define MAX_STG_NAME_LEN (CWCSTORAGENAME * 2)
  44. #endif
  45. //
  46. // set debugging macros used by 'SetDebugMode' in w4ctsupp.cxx
  47. // DBG is set for debug builds, not set for retail builds
  48. //
  49. #if DBG == 1
  50. STDAPI_(void) DfDebug(ULONG ulLevel, ULONG ulMSFLevel);
  51. #define DEBUG_ALL DfDebug(0xffffffff,0xffffffff)
  52. #define DEBUG_NONE DfDebug(0x00000000,0x00000000)
  53. #define DEBUG_INTERNAL_ERRORS DfDebug(0x00000101,0x00000101)
  54. #define DEBUG_DOCFILE DfDebug(0xffffffff,0x00000000)
  55. #define DEBUG_MSF DfDebug(0x00000000,0xffffffff)
  56. #else
  57. #define DEBUG_ALL ;
  58. #define DEBUG_NONE ;
  59. #define DEBUG_INTERNAL_ERRORS ;
  60. #define DEBUG_DOCFILE ;
  61. #define DEBUG_MSF ;
  62. #endif
  63. //
  64. //define QuickWin calls to tell program what to do upon completion
  65. //and to set up an 'infinite' size output capture buffer
  66. //
  67. #define EXIT_WHEN_DONE _wsetexit(_WINEXITNOPERSIST)
  68. #define NO_EXIT_WHEN_DONE _wsetexit(_WINEXITPERSIST)
  69. #define SET_DISPLAY_BUF_SIZE _wsetscreenbuf(_fileno(stdout), _WINBUFINF)
  70. #define _YIELD _wyield()
  71. //
  72. //global defines and size macros
  73. //
  74. #define NIL '\0'
  75. #define ERR (SCODE) ~0
  76. #define MAX_IO (ULONG) 256000
  77. #define MAX_TEST_NAME_LEN 40
  78. #define MAX_BYTE UCHAR_MAX
  79. #define MAX_USHORT USHRT_MAX
  80. #define MAX_SHORT SHRT_MAX
  81. #define MAX_ULONG ULONG_MAX
  82. #define MAX_LONG LONG_MAX
  83. //
  84. //defines for logging, tprintf, and ErrExit functions
  85. //
  86. #define LOG_DEFAULT_NAME "OLETEST.LOG"
  87. #define DEST_LOG 1
  88. #define DEST_OUT 2
  89. #define DEST_ERR 4
  90. #define DEST_ALL 8
  91. #define LOG_INIT 16
  92. #define LOG_OPEN 32
  93. #define LOG_CLOSE 64
  94. //
  95. //32 bit CRC declarations and macro definitions. The logic was taken from
  96. //the book 'C Programmer's Guide to Netbios'.
  97. //
  98. #ifdef __CRC32__
  99. extern BYTE ibCrcIndex;
  100. extern ULONG aulCrc[];
  101. #define CRC_INIT(X) X = 0xFFFFFFFFL
  102. #define CRC_CALC(X,Y) ibCrcIndex = (BYTE) ((X ^ Y) & 0x000000FFL); \
  103. X = ((X >> 8) & 0x00FFFFFFL) ^ aulCrc[ibCrcIndex]
  104. #define CRC_GOOD(X) (X == 0xDEBB20E3L) ? TRUE : FALSE
  105. #endif
  106. //
  107. //interesting docfile specific defines
  108. //
  109. #define STG_CONVERTED_NAME "CONTENTS"
  110. #define MAX_FILE_SYS_NAME_LEN 8
  111. #define MAX_LEVELS 6
  112. #define MIN_OBJS 18
  113. #define MIN_SIZE 394000L
  114. #define MAX_SIZE_ARRAY 14
  115. #define MAX_SIZE_MULTIPLIER 15
  116. //
  117. //extern global declarations
  118. //
  119. extern char szTestName[];
  120. extern BYTE bDestOut;
  121. extern USHORT usRandomSeed;
  122. extern USHORT ausSIZE_ARRAY[];
  123. //
  124. //function prototypes in order of appearance in w4ctsupp.cxx
  125. //
  126. void *Allocate(size_t cbBytesToAllocate);
  127. ULONG GenerateNewName(char **pszNewName, BOOL fIsFileSysName);
  128. BOOL MakePath(char *pszDirToMake);
  129. void SetDebugMode(char DebugMode);
  130. void ErrExit(BYTE OutputDest, SCODE ErrCode, char *fmt, ...);
  131. void tprintf(BYTE OutputDest, char *fmt, ...);
  132. void LogFile(char *pszLogFileName, BYTE bLogFileAction);
  133. void MakeSureThatLogIsClosed(void);
  134. void MakeSingle(char *pszSingleName, TCHAR *ptcsWideName);
  135. void MakeWide(TCHAR *ptcsWideName, char *pszSingleName);
  136. #endif