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.

151 lines
6.7 KiB

  1. /*****************************************************************************
  2. * (C) COPYRIGHT MICROSOFT CORPORATION, 2002
  3. *
  4. * AUTHOR: ByronC
  5. *
  6. * DATE: 4/10/2002
  7. *
  8. * @doc INTERNAL
  9. *
  10. * @module WiaEventHandlerLookup.h - Definitions for <c WiaEventHandlerLookup> |
  11. *
  12. * This file contains the class definition for <c WiaEventHandlerLookup>.
  13. *
  14. *****************************************************************************/
  15. //
  16. // Defines
  17. //
  18. #define WiaEventHandlerLookup_UNINIT_SIG 0x55756C45
  19. #define WiaEventHandlerLookup_INIT_SIG 0x49756C45
  20. #define WiaEventHandlerLookup_TERM_SIG 0x54756C45
  21. #define WiaEventHandlerLookup_DEL_SIG 0x44756C45
  22. #define GUID_VALUE_NAME L"GUID"
  23. #define DEFAULT_HANDLER_VALUE_NAME L"DefaultHandler"
  24. #define NAME_VALUE L"Name"
  25. #define DESC_VALUE_NAME L"Desc"
  26. #define ICON_VALUE_NAME L"Icon"
  27. #define CMDLINE_VALUE_NAME L"Cmdline"
  28. #define GLOBAL_HANDLER_REGPATH L"SYSTEM\\CurrentControlSet\\Control\\StillImage\\Events"
  29. #define DEVNODE_REGPATH L"SYSTEM\\CurrentControlSet\\Control\\Class\\"
  30. #define DEVNODE_CLASS_REGPATH L"SYSTEM\\CurrentControlSet\\Control\\Class\\{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}"
  31. #define DEVINTERFACE_REGPATH L"SYSTEM\\CurrentControlSet\\Control\\DeviceClasses\\{6BDD1FC6-810F-11D0-BEC7-08002BE2092F}"
  32. #define EVENT_STR L"\\Events"
  33. #define DEVICE_ID_VALUE_NAME L"DeviceID"
  34. /*****************************************************************************
  35. *
  36. * @doc INTERNAL
  37. *
  38. * @class WiaEventHandlerLookup | Walks the a registry subtree looking for the appropriate persistent handler
  39. *
  40. * @comm
  41. * This class starts from the given registry location, and walks the sub-tree
  42. * looking for the appropriately registered WIA persistent event handler.
  43. * Note that it can only return handlers from the specific sub-trees. To
  44. * search for default handler for a given event, multiple of these objects
  45. * may be needed e.g. one to search the device event key, one to search the
  46. * global event key and so on.
  47. *
  48. * This class is not thread safe - multiple threads should not use an object of class
  49. * simultaneously. Either the caller should synchronize access, or preferably, each
  50. * should use it's own object instance.
  51. *
  52. *****************************************************************************/
  53. class WiaEventHandlerLookup
  54. {
  55. //@access Public members
  56. public:
  57. // @cmember Constructor
  58. WiaEventHandlerLookup(const CSimpleString &cswEventKeyPath);
  59. // @cmember Constructor
  60. WiaEventHandlerLookup();
  61. // @cmember Destructor
  62. virtual ~WiaEventHandlerLookup();
  63. // @cmember Increment reference count
  64. virtual ULONG __stdcall AddRef();
  65. // @cmember Decrement reference count
  66. virtual ULONG __stdcall Release();
  67. // @cmember Find the appropriate WIA handler
  68. EventHandlerInfo* getPersistentHandlerForDeviceEvent(const CSimpleStringWide &cswDeviceID, const GUID &guidEvent);
  69. // @cmember Change the root event key path for this object
  70. VOID setEventKeyRoot(const CSimpleString &cswNewEventKeyPath);
  71. // @cmember Return the event handler registered for this WIA event
  72. EventHandlerInfo* getHandlerRegisteredForEvent(const GUID &guidEvent);
  73. // @cmember Return the event handler with this CLSID
  74. EventHandlerInfo* getHandlerFromCLSID(const GUID &guidEvent, const GUID &guidHandlerCLSID);
  75. //@access Private members
  76. private:
  77. // @cmember Enumeration procedure called to process each event sub-key
  78. static bool ProcessEventSubKey(CSimpleReg::CKeyEnumInfo &enumInfo);
  79. // @cmember Enumeration procedure called to rocess each handler sub-key
  80. static bool ProcessHandlerSubKey(CSimpleReg::CKeyEnumInfo &enumInfo);
  81. // @cmember Helper which creates a handler info object from the handler registry key
  82. EventHandlerInfo* CreateHandlerInfoFromKey(CSimpleReg &csrHandlerKey);
  83. // @cmember Signature of class
  84. ULONG m_ulSig;
  85. // @cmember Ref count
  86. ULONG m_cRef;
  87. // @cmember The registry path of the start of our search
  88. CSimpleStringWide m_cswEventKeyRoot;
  89. // @cmember Stores the event guid in string form. The event is the one specified in <mf WiaEventHandlerLookup::getHandlerRegisteredForEvent>
  90. CSimpleStringWide m_cswEventGuidString;
  91. // @cmember Stores the event sub-key name set after event key enumeration
  92. CSimpleStringWide m_cswEventKey;
  93. // @cmember Stores the handler CLSID used when searching for a specific handler
  94. CSimpleStringWide m_cswHandlerCLSID;
  95. // @cmember Stores the handler information set after event handler enumeration
  96. EventHandlerInfo *m_pEventHandlerInfo;
  97. //
  98. // Comments for member variables
  99. //
  100. // @mdata ULONG | WiaEventHandlerLookup | m_ulSig |
  101. // The signature for this class, used for debugging purposes.
  102. // Doing a <nl>"db [addr_of_class]"<nl> would yield one of the following
  103. // signatures for this class:
  104. // @flag WiaEventHandlerLookup_UNINIT_SIG | 'EluU' - Object has not been successfully
  105. // initialized
  106. // @flag WiaEventHandlerLookup_INIT_SIG | 'EluI' - Object has been successfully
  107. // initialized
  108. // @flag WiaEventHandlerLookup_TERM_SIG | 'EluT' - Object is in the process of
  109. // terminating.
  110. // @flag WiaEventHandlerLookup_INIT_SIG | 'EluD' - Object has been deleted
  111. // (destructor was called)
  112. //
  113. //
  114. // @mdata ULONG | WiaEventHandlerLookup | m_cRef |
  115. // The reference count for this class. Used for lifetime
  116. // management.
  117. //
  118. // @mdata CSimpleStringWide | WiaEventHandlerLookup | m_cswEventKeyRoot |
  119. // This string is used to indicate the registry path of the start of our search.
  120. // The registry key at this location is opened, and the sub-keys searched
  121. // for appropriate registered handlers.
  122. //
  123. // @mdata CSimpleStringWide | WiaEventHandlerLookup | m_cswEventGuidString |
  124. // Stores the event guid in string form. The event is the one specified in <mf WiaEventHandlerLookup::getHandlerRegisteredForEvent>
  125. //
  126. // @mdata CSimpleStringWide | WiaEventHandlerLookup | m_cswEventKey |
  127. // Stores the event sub-key name set after event key enumeration
  128. //
  129. // @mdata CSimpleStringWide | WiaEventHandlerLookup | m_cswHandlerCLSID |
  130. // Stores the handler CLSID used to test for a match when searching for a specific handler
  131. //
  132. // @mdata <c EventHandlerInfo>* | WiaEventHandlerLookup | m_EventHandlerInfo |
  133. // Stores the handler information set after event handler enumeration
  134. //
  135. };