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.

104 lines
3.3 KiB

  1. //+-------------------------------------------------------------------------
  2. // Microsoft OLE
  3. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  4. // All rights reserved.
  5. //
  6. // File: stgutil.hxx
  7. //
  8. // Contents: test utility functions
  9. //
  10. // Functions:
  11. //
  12. // History: SCousens 25-Jul-97 Created
  13. //--------------------------------------------------------------------------
  14. //
  15. // FirstError returns the first HRESULT that is not S_OK
  16. //
  17. // BUGBUG make this an inline function
  18. inline HRESULT FirstError(HRESULT a, HRESULT b)
  19. {
  20. return (S_OK != a) ? (a) : (b);
  21. };
  22. inline HRESULT FirstError(HRESULT a, HRESULT b, HRESULT c)
  23. {
  24. if (S_OK != a)
  25. return a;
  26. if (S_OK != b)
  27. return b;
  28. return c;
  29. };
  30. //--------------------------------------------------------------------------
  31. //// The following functions are in miscutil.cxx
  32. // Winnt specific functions are prototyped below.
  33. //--------------------------------------------------------------------------
  34. // converts hex char to int
  35. UINT Hex(CHAR ch);
  36. // return bitmask of available drives
  37. ULONG EnumLocalDrives();
  38. // verify if hrcheck has an expected value
  39. HRESULT VerifyResult(HRESULT hrCheck, HRESULT hrExpected);
  40. // waits for events
  41. DWORD WaitForObjectsAndProcessMessages(
  42. LPHANDLE pHandles,
  43. DWORD dwCount,
  44. BOOL fWaitAll,
  45. DWORD dwMilliSeconds) ;
  46. // determines if we are running debug ole
  47. HRESULT RunningDebugOle() ;
  48. //----------------------------------------------------------------------
  49. // The following functions are in ntutil.cxx and are specific to WINNT
  50. //----------------------------------------------------------------------
  51. // Must be at least NT5 (not mac, not win9x, not nt4 etc)
  52. #if defined(_WIN32_WINNT) && (_WIN32_WINNT>=0x0500)
  53. // Function to verify conversion driver with nssfiles
  54. HRESULT ConversionVerification (LPTSTR pFileName, DWORD dwCRCexp=0);
  55. // Function to verify a file is indeed an nssfile
  56. HRESULT VerifyNssfile (LPTSTR pszPathname);
  57. // stub out any references if we are not on NT5
  58. #else
  59. inline HRESULT ConversionVerification (LPTSTR /* pFileName */,
  60. DWORD dwCRCexp=0)
  61. {return S_OK;}
  62. // VerifyNssfile returns S_OK if nssfile, ERROR_INVALID_DATA for docfile
  63. // No nssfiles available here, so return ERROR_INVALID_DATA as spec'd
  64. inline HRESULT VerifyNssfile (LPTSTR /* pszPathname */)
  65. {return ERROR_INVALID_DATA;}
  66. #endif // WINNT5
  67. //--------------------------------------------------------------------------
  68. // in dumpcmd.cxx
  69. //--------------------------------------------------------------------------
  70. void DumpCmdLine (DWORD fResult, LPTSTR pszFmt, ...);
  71. //--------------------------------------------------------------------
  72. // Logging Macros
  73. // Use DH_DUMPCMD to dump out the commandline with additional
  74. // options so that we can get a repro case for this particular test.
  75. //
  76. // Sample Usage:
  77. // DH_DUMPCMD((LOG_PASS, TEXT(" /seed:%u"), ulSeed));
  78. //
  79. // Note:
  80. // -- double parenthesis for DH_LOG
  81. // -- newlines are appended automatically
  82. // -- must include semicolon line terminator
  83. //--------------------------------------------------------------------
  84. #define DH_DUMPCMD(data) DumpCmdLine data
  85. //internal functions
  86. HRESULT MergeParams (LPCTSTR ptCmdLine, LPCTSTR ptAdditional, LPTSTR *ptRepro);