home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / ADSDK.ZIP / Samples / ActiveDir / GUIDBind / vc / ADSIhelpers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-10-19  |  943 b   |  48 lines

  1.  
  2. /*
  3.  
  4.     ADSIHelpers.h
  5.  
  6.     General helper rountines for Debugging ADSI applications
  7.  
  8.  
  9. */
  10.  
  11.  
  12. #ifndef __ADSIHELLPERS_H
  13. #define __ADSIHELLPERS_H
  14.  
  15. #include <activeds.h>
  16. #include <adsiid.h>
  17.  
  18.  
  19. // Function declarations
  20. void            CheckHRESULT(HRESULT hr, const char *pszCause);
  21. const char *    GetVariantStyle(VARTYPE vt);
  22. HRESULT            GetIADsPropertyValueAsBSTR(BSTR * pbsRet,IADsPropertyValue * pAdsPV);
  23. WCHAR*          CrackADError(HRESULT hResult);
  24. void            ADErrMsgBox(HRESULT passedhr);
  25. const char *    QueryAllInterfaces(IUnknown * pUnk);
  26. char *          GetCharFromGUID(GUID idtofind);
  27.  
  28.  
  29. // Macros
  30.  
  31. // Simple Macro to simplyfy reading a bitflag
  32. #define HAS_BIT_STYLE(val, style) \
  33. ((val & style) == style)
  34.  
  35.  
  36. // Inline functions
  37.  
  38. // Will display ADSI or COM error messages
  39. // when passed a BAD Hresult
  40. inline void CheckADHRESULT(HRESULT hr)
  41. {
  42.     if (FAILED(hr))
  43.         ADErrMsgBox(hr);
  44.  
  45. }
  46.  
  47. #endif
  48.