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.

202 lines
6.5 KiB

  1. #ifndef _PRIV_H_
  2. #define _PRIV_H_
  3. #ifdef STRICT
  4. #undef STRICT
  5. #endif
  6. #define STRICT
  7. /* disable "non-standard extension" warnings in our code
  8. */
  9. #ifndef RC_INVOKED
  10. #pragma warning(disable:4001)
  11. #endif
  12. #include <w4warn.h>
  13. /*
  14. * Level 4 warnings to be turned on.
  15. * Do not disable any more level 4 warnings.
  16. */
  17. #pragma warning(disable:4706) /* assignment within conditional expression */
  18. #pragma warning(disable:4127) /* conditional expression is constant */
  19. #pragma warning(disable:4245) /* 'initializing' : conversion from 'int' to 'DWORD', signed/unsigned */
  20. /* mismatch */
  21. #pragma warning(disable:4189) /* local variable is initialized but not referenced */
  22. #pragma warning(disable:4057) /* 'LPSTR ' differs in indirection to slightly different base types from */
  23. /* 'LPBYTE ' */
  24. #pragma warning(disable:4701) /* local variable 'clrBkSav' may be used without having been initialized */
  25. #pragma warning(disable:4310) /* cast truncates constant value */
  26. #pragma warning(disable:4702) /* unreachable code */
  27. #pragma warning(disable:4206) /* nonstandard extension used : translation unit is empty */
  28. #pragma warning(disable:4267) /* '=' : conversion from 'size_t' to 'int', possible loss of data */
  29. #pragma warning(disable:4328) /* 'BOOL StrToIntExA(const LPCSTR,DWORD,int *__ptr64 )' : indirection */
  30. /* alignment of formal parameter 3 (4) is greater than the actual */
  31. /* argument alignment (2) */
  32. #pragma warning(disable:4509) /* nonstandard extension used: 'IOWorkerThread' uses SEH and 'info' */
  33. /* has destructor */
  34. #ifdef WIN32
  35. #define _SHLWAPI_
  36. #define _SHLWAPI_THUNK_
  37. #define _OLE32_ // we delay-load OLE
  38. #define _OLEAUT32_ // we delay-load OLEAUT32
  39. #define _INC_OLE
  40. #define CONST_VTABLE
  41. #endif
  42. #define _COMCTL32_ // for DECLSPEC_IMPORT
  43. #define _NTSYSTEM_ // for DECLSPEC_IMPORT ntdll
  44. #define _SETUPAPI_ // for DECLSPEC_IMPORT setupapi
  45. #define CC_INTERNAL
  46. // Conditional for apithk.c
  47. #ifndef _WIN32_WINDOWS
  48. #define _WIN32_WINDOWS 0x0400
  49. #endif
  50. #ifndef WINVER
  51. #define WINVER 0x0400
  52. #endif
  53. #include <windows.h>
  54. #include <windowsx.h>
  55. #include <ole2.h> // to get IStream for image.c
  56. #include <port32.h>
  57. #define DISALLOW_Assert
  58. #include <debug.h>
  59. #include <winerror.h>
  60. #include <winnlsp.h>
  61. #include <docobj.h>
  62. #include <shlobj.h>
  63. #include <shlwapi.h>
  64. #include <ccstock.h>
  65. #include <crtfree.h>
  66. #include <regstr.h>
  67. #include <vdate.h>
  68. #include <setupapi.h>
  69. // A "fake" variants for use on the stack - usable for [in] parameters only!!!
  70. typedef struct _SA_BSTRGUID {
  71. UINT cb;
  72. WCHAR wsz[39];
  73. } SA_BSTRGUID;
  74. #define InitFakeBSTR(pSA_BSTR, guid) SHStringFromGUIDW((guid), (pSA_BSTR)->wsz, ARRAYSIZE((pSA_BSTR)->wsz)), (pSA_BSTR)->cb = (38*sizeof(WCHAR))
  75. #ifdef TRY_NtPowerInformation
  76. //
  77. // We would like to include <ntpoapi.h>, but ntpoapi.h redefines things
  78. // in a manner incompatible with <winnt.h>... It also relies on <nt.h>,
  79. // which also redefines things in a manner incompatible with <winnt.h>.
  80. // So we have to fake its brains out. Yuck.
  81. //
  82. typedef LONG NTSTATUS;
  83. #undef ES_SYSTEM_REQUIRED
  84. #undef ES_DISPLAY_REQUIRED
  85. #undef ES_USER_PRESENT
  86. #undef ES_CONTINUOUS
  87. #define LT_DONT_CARE NTPOAPI_LT_DONT_CARE
  88. #define LT_LOWEST_LATENCY NTPOAPI_LT_LOWEST_LATENCY
  89. #define LATENCY_TIME NTPOAPI_LATENCY_TIME
  90. #if defined(_M_IX86)
  91. #define FASTCALL _fastcall
  92. #else
  93. #define FASTCALL
  94. #endif
  95. #include <ntpoapi.h>
  96. #endif
  97. // ---------------------------------------------------------------------------
  98. //
  99. // Local includes
  100. //
  101. #include "thunk.h"
  102. //
  103. // Wrappers so our Unicode calls work on Win95
  104. //
  105. #define lstrcmpW StrCmpW
  106. #define lstrcmpiW StrCmpIW
  107. #define lstrcatW StrCatW
  108. #define lstrcpyW StrCpyW
  109. #define lstrcpynW StrCpyNW
  110. #define CharLowerW CharLowerWrapW
  111. #define CharNextW CharNextWrapW
  112. #define CharPrevW CharPrevWrapW
  113. //
  114. // This is a very important piece of performance hack for non-DBCS codepage.
  115. //
  116. #ifdef UNICODE
  117. // NB - These are already macros in Win32 land.
  118. #ifdef WIN32
  119. #undef AnsiNext
  120. #undef AnsiPrev
  121. #endif
  122. #define AnsiNext(x) ((x)+1)
  123. #define AnsiPrev(y,x) ((x)-1)
  124. #define IsDBCSLeadByte(x) ((x), FALSE)
  125. #endif // DBCS
  126. #define CH_PREFIX TEXT('&')
  127. //
  128. // Trace/dump/break flags specific to shell32.
  129. // (Standard flags defined in debug.h)
  130. //
  131. // Trace flags
  132. #define TF_IDLIST 0x00000010 // IDList stuff
  133. #define TF_PATH 0x00000020 // path stuff
  134. #define TF_URL 0x00000040 // URL stuff
  135. #define TF_REGINST 0x00000080 // REGINST stuff
  136. #define TF_RIFUNC 0x00000100 // REGINST func tracing
  137. #define TF_REGQINST 0x00000200 // RegQueryInstall tracing
  138. #define TF_DBLIST 0x00000400 // SHDataBlockList tracing
  139. #define RECTWIDTH(rc) ((rc).right-(rc).left)
  140. #define RECTHEIGHT(rc) ((rc).bottom-(rc).top)
  141. // -1 means use CP_ACP, but do *not* verify
  142. // kind of a hack, but it's DEBUG and leaves 99% of callers unchanged
  143. #define CP_ACPNOVALIDATE ((UINT)-1)
  144. //
  145. // Global variables
  146. //
  147. EXTERN_C HINSTANCE g_hinst;
  148. #define HINST_THISDLL g_hinst
  149. EXTERN_C BOOL g_bRunningOnNT;
  150. EXTERN_C BOOL g_bRunningOnNT5OrHigher;
  151. EXTERN_C BOOL g_bRunningOnMemphis;
  152. // Icon mirroring
  153. EXTERN_C HDC g_hdc;
  154. EXTERN_C HDC g_hdcMask;
  155. EXTERN_C BOOL g_bMirroredOS;
  156. EXTERN_C DWORD g_tlsThreadRef;
  157. EXTERN_C DWORD g_tlsOtherThreadsRef;
  158. EXTERN_C int DrawTextFLW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);
  159. EXTERN_C int DrawTextExFLW(HDC hdc, LPWSTR pwzText, int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);
  160. EXTERN_C BOOL GetTextExtentPointFLW(HDC hdc, LPCWSTR lpString, int nCount, LPSIZE lpSize);
  161. EXTERN_C int ExtTextOutFLW(HDC hdc, int xp, int yp, UINT eto, CONST RECT *lprect, LPCWSTR lpwch, UINT cLen, CONST INT *lpdxp);
  162. #undef ExpandEnvironmentStrings
  163. #define ExpandEnvironmentStrings #error "Use SHExpandEnvironmentStrings instead"
  164. #endif // _PRIV_H_