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.

176 lines
6.1 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 <setupapi.h>
  68. #define STRSAFE_NO_DEPRECATE
  69. #include <strsafe.h>
  70. // A "fake" variants for use on the stack - usable for [in] parameters only!!!
  71. typedef struct _SA_BSTRGUID {
  72. UINT cb;
  73. WCHAR wsz[39];
  74. } SA_BSTRGUID;
  75. #define InitFakeBSTR(pSA_BSTR, guid) SHStringFromGUIDW((guid), (pSA_BSTR)->wsz, ARRAYSIZE((pSA_BSTR)->wsz)), (pSA_BSTR)->cb = (38*sizeof(WCHAR))
  76. #ifdef TRY_NtPowerInformation
  77. //
  78. // We would like to include <ntpoapi.h>, but ntpoapi.h redefines things
  79. // in a manner incompatible with <winnt.h>... It also relies on <nt.h>,
  80. // which also redefines things in a manner incompatible with <winnt.h>.
  81. // So we have to fake its brains out. Yuck.
  82. //
  83. typedef LONG NTSTATUS;
  84. #undef ES_SYSTEM_REQUIRED
  85. #undef ES_DISPLAY_REQUIRED
  86. #undef ES_USER_PRESENT
  87. #undef ES_CONTINUOUS
  88. #define LT_DONT_CARE NTPOAPI_LT_DONT_CARE
  89. #define LT_LOWEST_LATENCY NTPOAPI_LT_LOWEST_LATENCY
  90. #define LATENCY_TIME NTPOAPI_LATENCY_TIME
  91. #if defined(_M_IX86)
  92. #define FASTCALL _fastcall
  93. #else
  94. #define FASTCALL
  95. #endif
  96. #include <ntpoapi.h>
  97. #endif
  98. //
  99. // This is a very important piece of performance hack for non-DBCS codepage.
  100. //
  101. #ifdef UNICODE
  102. // NB - These are already macros in Win32 land.
  103. #ifdef WIN32
  104. #undef AnsiNext
  105. #undef AnsiPrev
  106. #endif
  107. #define AnsiNext(x) ((x)+1)
  108. #define AnsiPrev(y,x) ((x)-1)
  109. #define IsDBCSLeadByte(x) ((x), FALSE)
  110. #endif // DBCS
  111. #define CH_PREFIX TEXT('&')
  112. //
  113. // Trace/dump/break flags specific to shell32.
  114. // (Standard flags defined in debug.h)
  115. //
  116. // Trace flags
  117. #define TF_IDLIST 0x00000010 // IDList stuff
  118. #define TF_PATH 0x00000020 // path stuff
  119. #define TF_URL 0x00000040 // URL stuff
  120. #define TF_REGINST 0x00000080 // REGINST stuff
  121. #define TF_RIFUNC 0x00000100 // REGINST func tracing
  122. #define TF_REGQINST 0x00000200 // RegQueryInstall tracing
  123. #define TF_DBLIST 0x00000400 // SHDataBlockList tracing
  124. #define RECTWIDTH(rc) ((rc).right-(rc).left)
  125. #define RECTHEIGHT(rc) ((rc).bottom-(rc).top)
  126. // -1 means use CP_ACP, but do *not* verify
  127. // kind of a hack, but it's DEBUG and leaves 99% of callers unchanged
  128. #define CP_ACPNOVALIDATE ((UINT)-1)
  129. //
  130. // Global variables
  131. //
  132. EXTERN_C HINSTANCE g_hinst;
  133. #define HINST_THISDLL g_hinst
  134. // Icon mirroring
  135. EXTERN_C HDC g_hdc;
  136. EXTERN_C HDC g_hdcMask;
  137. EXTERN_C BOOL g_bMirroredOS;
  138. EXTERN_C DWORD g_tlsThreadRef;
  139. EXTERN_C DWORD g_tlsOtherThreadsRef;
  140. EXTERN_C int DrawTextFLW(HDC hdc, LPCWSTR lpString, int nCount, LPRECT lpRect, UINT uFormat);
  141. EXTERN_C int DrawTextExFLW(HDC hdc, LPWSTR pwzText, int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);
  142. EXTERN_C BOOL GetTextExtentPointFLW(HDC hdc, LPCWSTR lpString, int nCount, LPSIZE lpSize);
  143. EXTERN_C int ExtTextOutFLW(HDC hdc, int xp, int yp, UINT eto, CONST RECT *lprect, LPCWSTR lpwch, UINT cLen, CONST INT *lpdxp);
  144. STDAPI_(HANDLE) CreateAndActivateContext(ULONG_PTR* pul);
  145. STDAPI_(void) DeactivateAndDestroyContext(HANDLE hActCtx, ULONG_PTR ul);
  146. #endif // _PRIV_H_