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.

83 lines
2.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1996 - 1999
  6. //
  7. // File: GenDefs.h
  8. //
  9. // History: 31-Mar-1997 pberkman created
  10. //
  11. //--------------------------------------------------------------------------
  12. #ifndef GENDEFS_H
  13. #define GENDEFS_H
  14. #include "cryptver.h"
  15. #if (VER_PRODUCTMINOR > 101) // > IE4 (NT5 b2 and >)
  16. # define USE_IEv4CRYPT32 0
  17. # include "cryptui.h"
  18. # define CVP_STRUCTDEF CRYPTUI_VIEWCERTIFICATE_STRUCTW
  19. # define CVP_DLL "cryptui.dll"
  20. # define CVP_FUNC_NAME "CryptUIDlgViewCertificateW"
  21. typedef BOOL (WINAPI *pfnCertViewProperties)(CVP_STRUCTDEF * pcvsa, BOOL *fRefreshChain);
  22. #else // IE4 and <
  23. # define USE_IEv4CRYPT32 1
  24. # include "cryptdlg.h"
  25. # define CVP_STRUCTDEF CERT_VIEWPROPERTIES_STRUCT_A
  26. # define CVP_DLL "cryptdlg.dll"
  27. # define CVP_FUNC_NAME "CertViewPropertiesA"
  28. typedef BOOL (WINAPI *pfnCertViewProperties)(CVP_STRUCTDEF * pcvsa);
  29. #endif
  30. #define EVER (;;)
  31. #ifdef _WINDLL
  32. # define APIEXP
  33. # define DLL32EXP __declspec(dllexport)
  34. #else
  35. # define APIEXP
  36. # define DLL32EXP
  37. #endif
  38. #define SignError() (GetLastError() > (DWORD)0xFFFF) ? \
  39. GetLastError() : \
  40. HRESULT_FROM_WIN32(GetLastError())
  41. #define _OFFSETOF(t,f) ((DWORD)((DWORD_PTR)(&((t*)0)->f)))
  42. #define _ISINSTRUCT(structtypedef, structpassedsize, member) \
  43. ((_OFFSETOF(structtypedef, member) < structpassedsize) ? TRUE : FALSE)
  44. #define WIDEN(sz,wsz) \
  45. int cch##wsz = sz ? strlen(sz) + 1 : 0; \
  46. int cb##wsz = cch##wsz * sizeof(WCHAR); \
  47. LPWSTR wsz = sz ? (LPWSTR)_alloca(cb##wsz) : NULL; \
  48. if (wsz) MultiByteToWideChar(0, 0, sz, -1, wsz, cch##wsz)
  49. #ifdef __cplusplus
  50. # define DELETE_OBJECT(obj0) if (obj0) \
  51. { \
  52. delete obj0; \
  53. obj0 = NULL; \
  54. }
  55. #else
  56. # define DELETE_OBJECT(obj0) if (obj0) \
  57. { \
  58. free(obj0); \
  59. obj0 = NULL; \
  60. }
  61. #endif
  62. #endif // GENDEFS_H