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.

106 lines
1.6 KiB

  1. //
  2. //
  3. //
  4. #ifndef SHAREMEM_H
  5. #define SHAREMEM_H
  6. //
  7. // shared data definition
  8. //
  9. class CUIFCandMenuParent;
  10. typedef struct _SHAREDDATA
  11. {
  12. DWORD dwThreadId;
  13. HHOOK hHookKeyboard;
  14. HHOOK hHookMouse;
  15. HWND hWndMenu;
  16. } SHAREDDATA;
  17. //
  18. // CCandUIMMFile
  19. //
  20. #define CANDUIMM_READONLY 0x00000000
  21. #define CANDUIMM_READWRITE 0x00000001
  22. class CCandUIMMFile
  23. {
  24. public:
  25. CCandUIMMFile( void );
  26. virtual ~CCandUIMMFile( void );
  27. BOOL Open( LPSTR szName, DWORD dwFlag );
  28. BOOL Create( LPSTR szName, DWORD dwFlag, SECURITY_ATTRIBUTES *psa, DWORD dwSize );
  29. BOOL Close( void );
  30. __inline BOOL IsValid( void )
  31. {
  32. return (GetData() != NULL);
  33. }
  34. __inline void *GetData( void )
  35. {
  36. return m_pvData;
  37. }
  38. private:
  39. HANDLE m_hFile;
  40. void *m_pvData;
  41. };
  42. //
  43. // CCandUIMutex
  44. //
  45. class CCandUIMutex
  46. {
  47. public:
  48. CCandUIMutex( void );
  49. virtual ~CCandUIMutex( void );
  50. BOOL Create( LPSTR szName, SECURITY_ATTRIBUTES *psa );
  51. BOOL Close( void );
  52. BOOL Lock( void );
  53. BOOL Unlock( void );
  54. private:
  55. HANDLE m_hMutex;
  56. };
  57. //
  58. // CCandUIShareMem
  59. //
  60. class CCandUIShareMem
  61. {
  62. public:
  63. CCandUIShareMem( void );
  64. virtual ~CCandUIShareMem( void );
  65. BOOL Initialize( void );
  66. BOOL Open( void );
  67. BOOL Create( void );
  68. BOOL Close( void );
  69. BOOL LockData( void );
  70. BOOL UnlockData( void );
  71. __inline SHAREDDATA *GetData( void )
  72. {
  73. return (SHAREDDATA*)m_MMFile.GetData();
  74. }
  75. protected:
  76. CCandUIMMFile m_MMFile;
  77. CCandUIMutex m_Mutex;
  78. };
  79. #endif /* SHAREMEM_H */