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.

176 lines
4.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: pch.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _PCH_H_
  11. #define _PCH_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <nt.h>
  16. #include <ntrtl.h>
  17. #include <nturtl.h>
  18. #ifdef __cplusplus
  19. } // end of extern "C"
  20. #endif
  21. #define INC_OLE2
  22. #include <windows.h>
  23. #include <windowsx.h>
  24. #include <atlbase.h>
  25. #include <shellapi.h>
  26. #include <shlobj.h>
  27. #include <shlobjp.h> // SHFree
  28. #include <shlwapi.h>
  29. #include <shlwapip.h> // QITAB, QISearch
  30. #include <commctrl.h>
  31. #include <comctrlp.h>
  32. #include <cscapi.h>
  33. #include <mobsync.h> // OneStop/SyncMgr interfaces
  34. #include <emptyvc.h> // Memphis disk cleanup interface
  35. #include <resource.h> // resource IDs
  36. #include <cscuiext.h>
  37. #include <ras.h>
  38. #include <rasdlg.h>
  39. #include <raserror.h>
  40. #ifndef FLAG_CSC_SHARE_STATUS_PINNED_OFFLINE
  41. //
  42. // NTRAID#NTBUG9-350509-2001/04/11-brianau
  43. //
  44. // JHarper defined this new flag in shdcom.h but I don't think he's
  45. // yet added it to cscapi.h.
  46. //
  47. # define FLAG_CSC_SHARE_STATUS_PINNED_OFFLINE 0x2000
  48. #endif
  49. #ifndef FLAG_CSC_HINT_PIN_ADMIN
  50. // This should be defined in cscapi.h, but since
  51. // Remote Boot has been cancelled, use the system hint flag.
  52. #define FLAG_CSC_HINT_PIN_ADMIN FLAG_CSC_HINT_PIN_SYSTEM
  53. #endif
  54. #ifndef ARRAYSIZE
  55. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  56. #endif
  57. //
  58. // Convert a value to a "bool".
  59. // Lower-case "boolify" is intentional to enforce relationship
  60. // to type "bool".
  61. //
  62. template <class T>
  63. inline bool boolify(const T& x)
  64. {
  65. return !!x;
  66. }
  67. //
  68. // Global function prototypes
  69. //
  70. STDAPI_(void) DllAddRef(void);
  71. STDAPI_(void) DllRelease(void);
  72. #include "debug.h"
  73. #include "cscentry.h"
  74. #include "uuid.h" // GUIDs
  75. #include "util.h"
  76. #include "filelist.h" // CscFileNameList, PCSC_NAMELIST_HDR
  77. #include "shellex.h"
  78. #include "update.h"
  79. #include "volclean.h"
  80. #include "config.h"
  81. //
  82. // Global variables
  83. //
  84. extern LONG g_cRefCount;
  85. extern HINSTANCE g_hInstance;
  86. extern CLIPFORMAT g_cfShellIDList;
  87. extern HANDLE g_heventTerminate;
  88. extern HANDLE g_hmutexAdminPin;
  89. //
  90. // Magic debug flags
  91. //
  92. #define TRACE_UTIL 0x00000001
  93. #define TRACE_SHELLEX 0x00000002
  94. #define TRACE_UPDATE 0x00000004
  95. #define TRACE_VOLFREE 0x00000008
  96. #define TRACE_CSCST 0x00000080
  97. #define TRACE_CSCENTRY 0x00000100
  98. #define TRACE_ADMINPIN 0x00000200
  99. #define TRACE_COMMON_ASSERT 0x40000000
  100. /*-----------------------------------------------------------------------------
  101. / Exit macros
  102. / - these assume that a label "exit_gracefully:" prefixes the epilog
  103. / to your function
  104. /----------------------------------------------------------------------------*/
  105. #define ExitGracefully(hr, result, text) \
  106. { TraceMsg(text); hr = result; goto exit_gracefully; }
  107. #define FailGracefully(hr, text) \
  108. { if ( FAILED(hr) ) { TraceMsg(text); goto exit_gracefully; } }
  109. /*-----------------------------------------------------------------------------
  110. / Interface helper macros
  111. /----------------------------------------------------------------------------*/
  112. #define DoRelease(pInterface) \
  113. { if ( pInterface ) { pInterface->Release(); pInterface = NULL; } }
  114. /*-----------------------------------------------------------------------------
  115. / String helper macros
  116. /----------------------------------------------------------------------------*/
  117. #define StringByteCopy(pDest, iOffset, sz) \
  118. { memcpy(&(((LPBYTE)pDest)[iOffset]), sz, StringByteSize(sz)); }
  119. #define StringByteSize(sz) \
  120. ((lstrlen(sz)+1)*SIZEOF(TCHAR))
  121. /*-----------------------------------------------------------------------------
  122. / Other helpful macros
  123. /----------------------------------------------------------------------------*/
  124. #define ByteOffset(base, offset) \
  125. (((LPBYTE)base)+offset)
  126. #ifndef MAKEDWORDLONG
  127. #define MAKEDWORDLONG(low,high) ((DWORDLONG)(((DWORD)(low)) | ((DWORDLONG)((DWORD)(high))) << 32))
  128. #endif
  129. #ifndef LODWORD
  130. #define LODWORD(dwl) ((DWORD)((dwl) & 0xFFFFFFFF))
  131. #define HIDWORD(dwl) ((DWORD)(((DWORDLONG)(dwl) >> 32) & 0xFFFFFFFF))
  132. #endif
  133. #ifndef ResultFromShort
  134. #define ResultFromShort(i) MAKE_HRESULT(SEVERITY_SUCCESS, 0, (USHORT)(i))
  135. #endif
  136. //
  137. // This is from shell32. From the comments in browseui
  138. // this value will not change.
  139. //
  140. #define FCIDM_REFRESH 0xA220
  141. #define MAX_PATH_BYTES (MAX_PATH * sizeof(TCHAR))
  142. #endif // _PCH_H_