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.

78 lines
1.9 KiB

  1. // MSPID.h : Declaration of the CMSPID
  2. #ifndef __MSPID_H_
  3. #define __MSPID_H_
  4. #include "resource.h" // main symbols
  5. #include <vector>
  6. using namespace std;
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CMSPID
  9. class ATL_NO_VTABLE CMSPID :
  10. public CComObjectRootEx<CComSingleThreadModel>,
  11. public CComCoClass<CMSPID, &CLSID_MSPID>,
  12. public IDispatchImpl<IMSPID, &IID_IMSPID, &LIBID_MSINFO32Lib>
  13. {
  14. public:
  15. CMSPID(): m_szMachineName(NULL),
  16. m_szMSSoftware(_T("software\\microsoft")),
  17. m_szCurrKeyName(NULL),
  18. m_szWindowsPID(NULL),
  19. m_szIEPID(NULL)
  20. {
  21. m_bstrWindows.LoadString(IDS_WINDOWS);//localized "Windows"
  22. m_bstrIE.LoadString(IDS_IE);//localized "Internet Exporer"
  23. //valid PID keys/values
  24. m_vecPIDKeys.push_back(_T("productid"));
  25. m_vecPIDKeys.push_back(_T("pid"));
  26. //PIDs with these substrings are rejected
  27. m_vecBadPIDs.push_back(_T("11111"));
  28. m_vecBadPIDs.push_back(_T("12345"));
  29. m_vecBadPIDs.push_back(_T("none"));
  30. //don't go here
  31. m_vecKeysToSkip.push_back(_T("Uninstall"));
  32. m_vecKeysToSkip.push_back(_T("Installer"));
  33. m_vecKeysToSkip.push_back(_T("Windows NT"));
  34. }
  35. ~CMSPID()
  36. {
  37. }
  38. DECLARE_REGISTRY_RESOURCEID(IDR_MSPID)
  39. DECLARE_PROTECT_FINAL_CONSTRUCT()
  40. BEGIN_COM_MAP(CMSPID)
  41. COM_INTERFACE_ENTRY(IMSPID)
  42. COM_INTERFACE_ENTRY(IDispatch)
  43. END_COM_MAP()
  44. private:
  45. BOOL ReadValues(const HKEY&);
  46. BOOL ReadValue(const HKEY&, LPCTSTR);
  47. void EnumSubKeys(const HKEY&, LPCTSTR);
  48. void SearchKey(LPCTSTR);
  49. LPCTSTR m_szMachineName;
  50. LPCTSTR m_szMSSoftware;
  51. LPCTSTR m_szCurrKeyName;
  52. LPTSTR m_szWindowsPID;
  53. LPTSTR m_szIEPID;
  54. CComBSTR m_bstrWindows;
  55. CComBSTR m_bstrIE;
  56. vector<TCHAR *> m_vecPIDKeys;
  57. vector<TCHAR *> m_vecBadPIDs;
  58. vector<TCHAR *> m_vecKeysToSkip;
  59. vector<CComBSTR> m_vecData;
  60. // IMSPID
  61. public:
  62. STDMETHOD(GetPIDInfo)(/*[in]*/ VARIANT *, /*[out, retval]*/ VARIANT *);
  63. };
  64. #endif //__MSPID_H_