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.

83 lines
2.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  5. //
  6. // File: tutils.hxx
  7. //
  8. // Contents: Generic test utilities
  9. //
  10. // History: 06-Aug-93 DrewB Created
  11. //
  12. //----------------------------------------------------------------------------
  13. #ifndef __TUTILS_HXX__
  14. #define __TUTILS_HXX__
  15. #ifndef UNICODE
  16. #define tcscpy(d, s) strcpy(d, s)
  17. #define tcslen(s) strlen(s)
  18. #define TTEXT(s) s
  19. #define TFMT "%s"
  20. #define ATOT(a, t, max) strcpy(t, a)
  21. #define TTOA(t, a, max) strcpy(a, t)
  22. #define WTOT(w, t, max) wcstombs(t, w, max)
  23. #define TTOW(t, w, max) mbstowcs(w, t, max)
  24. #else
  25. #define tcscpy(d, s) wcscpy(d, s)
  26. #define tcslen(s) wcslen(s)
  27. #define TTEXT(s) L##s
  28. #define TFMT "%ws"
  29. #define ATOT(a, t, max) mbstowcs(t, a, max)
  30. #define TTOA(t, a, max) wcstombs(a, t, max)
  31. #define WTOT(w, t, max) wcscpy(t, w)
  32. #define TTOW(t, w, max) wcscpy(w, t)
  33. #endif
  34. #ifdef WIN32
  35. #define ATOX(a, t, max) mbstowcs(t, a, max)
  36. #define XTOA(t, a, max) wcstombs(a, t, max)
  37. #define WTOX(w, t, max) wcscpy(t, w)
  38. #define XTOW(t, w, max) wcscpy(w, t)
  39. #else
  40. #define ATOX(a, t, max) strcpy(t, a)
  41. #define XTOA(t, a, max) strcpy(a, t)
  42. #define WTOX(w, t, max) wcstombs(t, w, max)
  43. #define XTOW(t, w, max) mbstowcs(w, t, max)
  44. #endif
  45. #ifdef CINTERFACE
  46. #define Mthd(this, name) ((this)->lpVtbl->name)
  47. #define SELF(p) (p),
  48. #else
  49. #define Mthd(this, name) (this)->name
  50. #define SELF(p)
  51. #endif
  52. BOOL GetExitOnFail(void);
  53. void SetExitOnFail(BOOL set);
  54. void Fail(char *fmt, ...);
  55. char *ScText(SCODE sc);
  56. HRESULT Result(HRESULT hr, char *fmt, ...);
  57. HRESULT IllResult(HRESULT hr, char *fmt, ...);
  58. char *TcsText(TCHAR *ptcs);
  59. char *FileTimeText(FILETIME *pft);
  60. char *GuidText(GUID *pguid);
  61. void BinText(ULONG cb, BYTE *pb);
  62. TCHAR *TestFile(TCHAR *ptcsName, char *pszFile);
  63. #if WIN32 == 300
  64. char *TestFormat(DWORD *pdwFmt, DWORD *pgrfMode);
  65. #endif
  66. void CreateTestFile(char *pszFile, DWORD grfMode, BOOL fFail, IStorage **ppstg,
  67. TCHAR *ptcsName);
  68. void OpenTestFile(char *pszFile, DWORD grfMode, BOOL fFail, IStorage **ppstg,
  69. TCHAR *ptcsName);
  70. // Defined by test, called by Fail
  71. void EndTest(int code);
  72. BOOL CompareStorages(IStorage *pstg1, IStorage *pstg2);
  73. #endif // #ifndef __TUTILS_HXX__