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.

109 lines
2.8 KiB

  1. //+--------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1996 - 1999
  5. //
  6. // File: view.h
  7. //
  8. // Contents: Cert Server Database interface implementation
  9. //
  10. //---------------------------------------------------------------------------
  11. #include "resource.h" // main symbols
  12. // defines for multi-thread handling
  13. typedef enum
  14. {
  15. ENUMTHREAD_OPEN = 0,
  16. ENUMTHREAD_NEXT,
  17. ENUMTHREAD_CLEANUP,
  18. ENUMTHREAD_END
  19. } ENUMTHREADCALLS;
  20. class CEnumCERTDBRESULTROW: public IEnumCERTDBRESULTROW
  21. {
  22. public:
  23. CEnumCERTDBRESULTROW(BOOL fThreading = TRUE);
  24. ~CEnumCERTDBRESULTROW();
  25. // IUnknown
  26. STDMETHODIMP QueryInterface(const IID& iid, void **ppv);
  27. ULONG STDMETHODCALLTYPE AddRef();
  28. ULONG STDMETHODCALLTYPE Release();
  29. // IEnumCERTDBRESULTROW
  30. STDMETHOD(Next)(
  31. /* [in] */ ULONG celt,
  32. /* [out] */ CERTDBRESULTROW *rgelt,
  33. /* [out] */ ULONG *pceltFetched);
  34. STDMETHOD(ReleaseResultRow)(
  35. /* [in] */ ULONG celt,
  36. /* [in, out] */ CERTDBRESULTROW *rgelt);
  37. STDMETHOD(Skip)(
  38. /* [in] */ LONG celt,
  39. /* [out] */ LONG *pielt);
  40. STDMETHOD(Reset)(VOID);
  41. STDMETHOD(Clone)(
  42. /* [out] */ IEnumCERTDBRESULTROW **ppenum);
  43. // CEnumCERTDBRESULTROW
  44. HRESULT Open(
  45. IN CERTSESSION *pcs,
  46. IN ICertDB *pdb,
  47. IN DWORD ccvr,
  48. IN CERTVIEWRESTRICTION const *acvr,
  49. IN DWORD ccolOut,
  50. IN DWORD const *acolOut);
  51. private:
  52. VOID _Cleanup();
  53. HRESULT _SetTable(
  54. IN LONG ColumnIndex,
  55. OUT LONG *pColumnIndexDefault);
  56. HRESULT _SaveRestrictions(
  57. IN DWORD ccvrIn,
  58. IN CERTVIEWRESTRICTION const *acvrIn,
  59. IN LONG ColumnIndexDefault);
  60. // multi-thread handling
  61. static DWORD WINAPI _ViewWorkThreadFunctionHelper(LPVOID lp);
  62. HRESULT _HandleThreadError();
  63. HRESULT _ThreadOpen(DWORD dwCallerThreadID);
  64. HRESULT _ThreadNext(DWORD dwCallerThreadID);
  65. VOID _ThreadCleanup(DWORD dwCallerThreadID);
  66. DWORD _ViewWorkThreadFunction(VOID);
  67. ICertDB *m_pdb;
  68. CERTSESSION *m_pcs;
  69. CERTVIEWRESTRICTION *m_aRestriction;
  70. DWORD m_cRestriction;
  71. DWORD m_ccolOut;
  72. DWORD *m_acolOut;
  73. BOOL m_fNoMoreData;
  74. LONG m_ieltMax;
  75. LONG m_ielt;
  76. LONG m_cskip;
  77. // thread stuff
  78. HANDLE m_hWorkThread;
  79. HANDLE m_hViewEvent;
  80. HANDLE m_hReturnEvent;
  81. HRESULT m_hrThread;
  82. ENUMTHREADCALLS m_enumViewCall;
  83. VOID *m_pThreadParam;
  84. BOOL m_fThreading;
  85. //#if DBG_CERTSRV
  86. DWORD m_dwCallerThreadId;
  87. //#endif
  88. // Reference count
  89. long m_cRef;
  90. };