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.

45 lines
1.5 KiB

  1. //
  2. // util.cpp
  3. //
  4. typedef struct tagGETDCSTATE {
  5. IOleInPlaceSiteWindowless *pipsw; // If we got the DC from an interface
  6. HWND hwnd; // If we got the DC from a window
  7. } GETDCSTATE, *PGETDCSTATE;
  8. STDAPI_(HDC) IUnknown_GetDC(IUnknown *punk, LPCRECT prc, PGETDCSTATE pdcs);
  9. STDAPI_(void) IUnknown_ReleaseDC(HDC hdc, PGETDCSTATE pdcs);
  10. DWORD FormatMessageWrapW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageID, DWORD dwLangID, LPWSTR pwzBuffer, DWORD cchSize, ...);
  11. EXTERN_C int WINAPIV wsprintfWrapW(
  12. OUT LPWSTR pwszOut,
  13. IN LPCWSTR pwszFormat,
  14. ...);
  15. //---------------------------------------------------------------------------
  16. // For manipulating BSTRs without using SysAllocString
  17. template<int n> class STATIC_BSTR {
  18. public:
  19. ULONG _cb;
  20. WCHAR _wsz[n];
  21. // Remove const-ness because VARIANTs don't have "const BSTR"
  22. operator LPWSTR() { return _wsz; }
  23. void SetSize() { _cb = lstrlenW(_wsz) * sizeof(WCHAR); }
  24. int inline const MaxSize() { return n; }
  25. };
  26. #define MAKE_CONST_BSTR(name, str) \
  27. STATIC_BSTR<sizeof(str)/sizeof(WCHAR)> \
  28. name = { sizeof(str) - sizeof(WCHAR), str }
  29. #define DECL_CONST_BSTR(name, str) \
  30. extern STATIC_BSTR<sizeof(str)/sizeof(WCHAR)> name;
  31. extern HRESULT _ComputeFreeSpace(LPCWSTR pszFileName, ULONGLONG& ullFreeSpace,
  32. ULONGLONG& ullUsedSpace, ULONGLONG& ullTotalSpace);
  33. STDAPI IsSafePage(IUnknown *punkSite);
  34. DWORD IntSqrt(DWORD dwNum);