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.

49 lines
1.7 KiB

  1. //
  2. // MODULE: ShortList.h
  3. //
  4. // PURPOSE: A list of all of the handles that are currently open.
  5. // There is an instance of a COM interface for every open handle.
  6. //
  7. // PROJECT: Local Troubleshooter Launcher for the Device Manager
  8. //
  9. // COMPANY: Saltmine Creative, Inc. (206)-633-4743 [email protected]
  10. //
  11. // AUTHOR: Richard Meadows
  12. //
  13. // ORIGINAL DATE: 2-26-98
  14. //
  15. //
  16. // Version Date By Comments
  17. //--------------------------------------------------------------------
  18. // V0.1 - RM Original
  19. ///////////////////////
  20. // Smart Struct
  21. class CShortListItem
  22. {
  23. public:
  24. CShortListItem() { m_hSelf = NULL; m_pInterface = NULL;
  25. m_pNext = NULL;
  26. return;};
  27. HANDLE m_hSelf; // The items in the queue are indexed by the handle.
  28. IUnknown *m_pInterface; // For now the ITShootATL interface pointers are the only thing TSLaunch needs to keep.
  29. CShortListItem *m_pNext; // Points to the next item in the list.
  30. };
  31. class CShortList
  32. {
  33. public:
  34. CShortList();
  35. ~CShortList(); // Frees the memory used by all of the items in the list and releases the interfaces.
  36. bool Add(HANDLE hItem, IUnknown *pInterface); // Returns false only if there is no memory left.
  37. // and the new function did not throw an exception.
  38. bool Remove(HANDLE hItem); // Removes the item from the queue frees the items memory and releases the interface.
  39. void RemoveAll(); // Removes all of the items from the queue. Releases all of the interfaces. Deletes all of the items.
  40. IUnknown *LookUp(HANDLE hItem); // Returns a pointer to the interface or NULL if hItem is not in the list.
  41. protected:
  42. CShortListItem *m_pFirst;
  43. CShortListItem *m_pLast;
  44. };