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.

96 lines
2.8 KiB

  1. /***************************************************************************
  2. *
  3. * Copyright (C) 2001-2002 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: controlobj.h
  6. *
  7. * Content: Header for DP8SIM control interface object class.
  8. *
  9. * History:
  10. * Date By Reason
  11. * ======== ======== =========
  12. * 04/24/01 VanceO Created.
  13. *
  14. ***************************************************************************/
  15. //=============================================================================
  16. // Macros
  17. //=============================================================================
  18. #define DP8SIMCONTROL_FROM_BILINK(b) (CONTAINING_OBJECT(b, CDP8SimControl, m_blList))
  19. //=============================================================================
  20. // Object flags
  21. //=============================================================================
  22. #define DP8SIMCONTROLOBJ_INITIALIZED 0x01 // object has been initialized
  23. //=============================================================================
  24. // Control interface object class
  25. //=============================================================================
  26. class CDP8SimControl : public IDP8SimControl
  27. {
  28. public:
  29. CDP8SimControl(void); // constructor
  30. ~CDP8SimControl(void); // destructor
  31. STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  32. STDMETHODIMP_(ULONG) AddRef(void);
  33. STDMETHODIMP_(ULONG) Release(void);
  34. STDMETHODIMP Initialize(const DWORD dwFlags);
  35. STDMETHODIMP Close(const DWORD dwFlags);
  36. STDMETHODIMP GetAllParameters(DP8SIM_PARAMETERS * const pdp8spSend, DP8SIM_PARAMETERS * const pdp8spReceive, const DWORD dwFlags);
  37. STDMETHODIMP SetAllParameters(const DP8SIM_PARAMETERS * const pdp8spSend, const DP8SIM_PARAMETERS * const pdp8spReceive, const DWORD dwFlags);
  38. STDMETHODIMP GetAllStatistics(DP8SIM_STATISTICS * const pdp8ssSend, DP8SIM_STATISTICS * const pdp8ssReceive, const DWORD dwFlags);
  39. STDMETHODIMP ClearAllStatistics(const DWORD dwFlags);
  40. HRESULT InitializeObject(void);
  41. void UninitializeObject(void);
  42. CBilink m_blList; // list of all the DP8SimControl instances in existence
  43. private:
  44. BYTE m_Sig[4]; // debugging signature ('DP8S')
  45. LONG m_lRefCount; // reference count for this object
  46. DWORD m_dwFlags; // flags for this object
  47. DNCRITICAL_SECTION m_csLock; // lock preventing simultaneous usage of globals
  48. CDP8SimIPC m_DP8SimIPC; // object that handles interprocess communication
  49. inline BOOL IsValidObject(void)
  50. {
  51. if ((this == NULL) || (IsBadWritePtr(this, sizeof(CDP8SimControl))))
  52. {
  53. return FALSE;
  54. }
  55. if (*((DWORD*) (&this->m_Sig)) != 0x53385044) // 0x53 0x38 0x50 0x44 = 'S8PD' = 'DP8S' in Intel order
  56. {
  57. return FALSE;
  58. }
  59. return TRUE;
  60. };
  61. };