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.

28 lines
864 B

  1. // common.h
  2. #include "debug.h"
  3. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  4. #define StrToOleStrN(pwsz, cchWideChar, psz, cchMultiByte) MultiByteToWideChar(CP_ACP, 0, psz, cchMultiByte, pwsz, cchWideChar)
  5. #define OleStrToStrN(psz, cchMultiByte, pwsz, cchWideChar) WideCharToMultiByte(CP_ACP, 0, pwsz, cchWideChar, psz, cchMultiByte, NULL, NULL)
  6. #define QueryInterface(punk, iid, pobj) (punk)->lpVtbl->QueryInterface(punk, iid, pobj)
  7. #define AddRef(punk) (punk)->lpVtbl->AddRef(punk)
  8. #define Release(punk) (punk)->lpVtbl->Release(punk)
  9. #ifndef IToClass
  10. #define _IOffset(class, itf) ((UINT)(UINT_PTR)&(((class *)0)->itf))
  11. #define IToClass(class, itf, pitf) ((class *)(((LPSTR)pitf)-_IOffset(class, itf)))
  12. #endif
  13. #ifdef _DEBUG
  14. #define ReleaseLast(punk) Assert(Release(punk) == 0)
  15. #else
  16. #define ReleaseLast(punk) Release(punk)
  17. #endif