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.

177 lines
7.5 KiB

  1. // The icons ID passed to the shell contains the following format:
  2. //
  3. // B: Designates value is a bitmask
  4. // M: Designates value is mutually exclusive
  5. //
  6. // Icon Handler Flag (01 = NetConfig, 10 = Connection Manager, 11 = Static Icon from Resource)
  7. // |
  8. // | For Icon Handler == 00 (NetConfig)
  9. // | ==================================
  10. // | Characteristics Overlay (B: Reserved)
  11. // | | Characteristics Overlay (B: 000001000 - Shared)
  12. // | | | Characteristics Overlay (B: 000000100 - Firewalled)
  13. // | | | | Characteristics Overlay (B: 000000010 - Default)
  14. // | | | | | Characteristics Overlay (B: 000000001 - Incoming)
  15. // | | | | | |
  16. // | | | | | | Status Overlay (M: 0000 - None)
  17. // | | | | | | Status Overlay (M: 0001 - Hardware Not Present)
  18. // | | | | | | Status Overlay (M: 0010 - Invalid IP)
  19. // | | | | | | Status Overlay (M: 0011 - EAPOL Authentication Failed)
  20. // | | | | | |
  21. // | | | | | | Status Overlay (M: 1xxx - Disabled status)
  22. // | | | | | | |
  23. // | | | | | | | Connection Icon (Flashy Computer) (M: 000 - No Overlay)
  24. // | | | | | | | Connection Icon (Flashy Computer) (M: 100 - Both Lights Off)
  25. // | | | | | | | Connection Icon (Flashy Computer) (M: 110 - Left Light On (Sent))
  26. // | | | | | | | Connection Icon (Flashy Computer) (M: 101 - Right Light On (Received))
  27. // | | | | | | | Connection Icon (Flashy Computer) (M: 111 - Both Lights On (Sent + Received))
  28. // | | | | | | | |
  29. // | | | | | | | | Media Type (M: NETCON_MEDIATYPE (0x1111111 is Connection Manager)
  30. // | | | | | | | | | Media Type (M: NETCON_SUBMEDIATYPE)
  31. // | | | | | | | | | |
  32. // v v v v v v v v v v
  33. // 01 00000 0 0 0 0 0000 000 0000000 0000000
  34. // |
  35. // |
  36. // | For Icon Handler == 01 (Connection Manager)
  37. // | ===========================================
  38. // | Characteristics Overlay (B: Reserved)
  39. // | | Characteristics Overlay (B: 000001000 - Shared)
  40. // | | | Characteristics Overlay (B: 000000100 - Firewalled)
  41. // | | | | Characteristics Overlay (B: 000000010 - Default)
  42. // | | | | | Characteristics Overlay (B: 000000001 - Incoming)
  43. // | | | | | |
  44. // | | | | | |
  45. // | | | | | | Reserved
  46. // | | | | | | |
  47. // | | | | | | | BrandedNames Lookup Table Entry
  48. // | | | | | | | |
  49. // v v v v v v v v (16 bits)
  50. // 10 00000 0 0 0 0 00000 0000000000000000
  51. // |
  52. // |
  53. // | For Icon Handler == 10 (10 = Static Icon from Resource)
  54. // | =======================================================
  55. // | Characteristics Overlay (B: Reserved)
  56. // | | Characteristics Overlay (B: 000001000 - Shared)
  57. // | | | Characteristics Overlay (B: 000000100 - Firewalled)
  58. // | | | | Characteristics Overlay (B: 000000010 - Default)
  59. // | | | | | Characteristics Overlay (B: 000000001 - Incoming)
  60. // | | | | | |
  61. // | | | | | |
  62. // | | | | | | Reserved
  63. // | | | | | | |
  64. // | | | | | | | Resource ID
  65. // | | | | | | | |
  66. // v v v v v v v v (16 bits)
  67. // 11 00000 0 0 0 0 00000 0000000000000000
  68. enum ENUM_MEDIA_ICONMASK
  69. {
  70. MASK_NETCON_SUBMEDIATYPE = 0x0000007f, // 00000000000000000000000001111111
  71. MASK_NETCON_MEDIATYPE = 0x00003F80, // 00000000000000000011111110000000
  72. MASK_CONNECTION = 0x0001C000, // 00000000000000011100000000000000
  73. MASK_STATUS = 0x000E0000, // 00000000000011100000000000000000
  74. MASK_STATUS_DISABLED = 0x00100000, // 00000000000100000000000000000000
  75. MASK_CHARACTERISTICS = 0x3FE00000, // 00111111111000000000000000000000
  76. MASK_ICONMANAGER = 0xC0000000, // 11000000000000000000000000000000
  77. MASK_BRANDORRESOURCEID = 0x0000FFFF, // 00000000000000001111111111111111
  78. MASK_SUPPORT_ALL = 0xFFFFFFFF,
  79. MASK_NO_CONNECTIONOVERLAY= MASK_NETCON_SUBMEDIATYPE | MASK_NETCON_MEDIATYPE | MASK_CHARACTERISTICS | MASK_ICONMANAGER,
  80. MASK_STATUSOVERLAY = MASK_NETCON_SUBMEDIATYPE | MASK_NETCON_MEDIATYPE | MASK_CHARACTERISTICS | MASK_ICONMANAGER | MASK_STATUS | MASK_STATUS_DISABLED,
  81. };
  82. enum ENUM_MEDIA_ICONSHIFT
  83. {
  84. SHIFT_NETCON_SUBMEDIATYPE = 0,
  85. SHIFT_NETCON_MEDIATYPE = 7,
  86. SHIFT_CONNECTION = 14,
  87. SHIFT_STATUS = 17,
  88. SHIFT_CHARACTERISTICS = 21,
  89. SHIFT_ICONMANAGER = 30
  90. };
  91. enum ENUM_ICON_MANAGER
  92. {
  93. ICO_MGR_INTERNAL = 0x1 << SHIFT_ICONMANAGER,
  94. ICO_MGR_CM = 0x2 << SHIFT_ICONMANAGER,
  95. ICO_MGR_RESOURCEID = 0x3 << SHIFT_ICONMANAGER
  96. };
  97. enum ENUM_STAT_ICON
  98. {
  99. ICO_STAT_NONE = 0x0 << SHIFT_STATUS,
  100. ICO_STAT_FAULT = 0x1 << SHIFT_STATUS,
  101. ICO_STAT_INVALID_IP = 0x2 << SHIFT_STATUS,
  102. ICO_STAT_EAPOL_FAILED = 0x3 << SHIFT_STATUS,
  103. ICO_STAT_DISABLED = 0x8 << SHIFT_STATUS // Flag
  104. };
  105. enum ENUM_CONNECTION_ICON
  106. {
  107. ICO_CONN_NONE = 0x0 << SHIFT_CONNECTION,
  108. ICO_CONN_BOTHOFF = 0x4 << SHIFT_CONNECTION,
  109. ICO_CONN_RIGHTON = 0x5 << SHIFT_CONNECTION,
  110. ICO_CONN_LEFTON = 0x6 << SHIFT_CONNECTION,
  111. ICO_CONN_BOTHON = 0x7 << SHIFT_CONNECTION,
  112. };
  113. enum ENUM_CHARACTERISTICS_ICON
  114. {
  115. ICO_CHAR_INCOMING = 0x1 << SHIFT_CHARACTERISTICS,
  116. ICO_CHAR_DEFAULT = 0x2 << SHIFT_CHARACTERISTICS,
  117. ICO_CHAR_FIREWALLED = 0x4 << SHIFT_CHARACTERISTICS,
  118. ICO_CHAR_SHARED = 0x8 << SHIFT_CHARACTERISTICS
  119. };
  120. class CNetConfigIcons;
  121. typedef map<tstring, DWORD> BrandedNames;
  122. typedef map<DWORD, HIMAGELIST> IMAGELISTMAP;
  123. // CNetConfigIcons
  124. // The main icon manager for NetShell
  125. class CNetConfigIcons
  126. {
  127. private:
  128. CRITICAL_SECTION csNetConfigIcons;
  129. BOOL m_bInitialized;
  130. IMAGELISTMAP m_ImageLists;
  131. HINSTANCE m_hInstance;
  132. BrandedNames m_BrandedNames;
  133. DWORD dwLastBrandedId;
  134. HRESULT HrMergeTwoIcons(IN DWORD dwIconSize, IN OUT HICON *phMergedIcon, IN HICON hIconToMergeWith);
  135. HRESULT HrMergeCharacteristicsIcons(IN DWORD dwIconSize, IN DWORD dwIconId, IN OUT HICON *phMergedIcon);
  136. HRESULT HrGetBrandedIconFromIconId(IN DWORD dwIconSize, IN DWORD dwIconId, OUT HICON &hIcon); // Use destroyicon after
  137. HRESULT HrGetInternalIconFromIconId(IN DWORD dwIconSize, IN DWORD dwIconId, OUT HICON &hIcon); // Use destroyicon after
  138. HRESULT HrGetResourceIconFromIconId(IN DWORD dwIconSize, IN DWORD dwIconId, OUT HICON &hIcon); // Use destroyicon after
  139. HRESULT HrGetInternalIconIDForPIDL(IN UINT uFlags, IN const CConFoldEntry& cfe, OUT DWORD &dwIconId); // Use destroyicon after
  140. HRESULT HrGetBrandedIconIDForPIDL(IN UINT uFlags, IN const CConFoldEntry& cfe, OUT DWORD &dwIconId); // Use destroyicon after
  141. public:
  142. CNetConfigIcons(IN HINSTANCE hInstance);
  143. virtual ~CNetConfigIcons();
  144. // All external calls are thread safe.
  145. HRESULT HrGetIconIDForPIDL(IN UINT uFlags, IN const CConFoldEntry& cfe, OUT DWORD &dwIconId, OUT LPBOOL pfCanCache);
  146. HRESULT HrGetIconFromIconId(IN DWORD dwIconSize, IN DWORD dwIconId, OUT HICON &hIcon); // Use destroyicon after
  147. HRESULT HrUpdateSystemImageListForPIDL(IN const CConFoldEntry& cfe);
  148. HRESULT HrGetIconFromMediaType(DWORD dwIconSize, IN NETCON_MEDIATYPE ncm, IN NETCON_SUBMEDIATYPE ncsm, IN DWORD dwConnectionIcon, IN DWORD dwCharacteristics, OUT HICON *phIcon);
  149. };
  150. extern CNetConfigIcons *g_pNetConfigIcons;
  151. extern const WCHAR c_szNetShellIcon[];