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.

141 lines
5.3 KiB

  1. //
  2. // MODULE: StateInfo.cpp
  3. //
  4. // PURPOSE: Contains sniffing, network and node information. Also is used
  5. // by the Launch module to start the container application.
  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. // COMMENTS BY: Joe Mabel
  13. //
  14. // ORIGINAL DATE: 2-26-98
  15. //
  16. //
  17. // Version Date By Comments
  18. //--------------------------------------------------------------------
  19. // V0.1 - RM Original
  20. ///////////////////////
  21. enum ELaunchRegime
  22. {
  23. launchIndefinite = 0,
  24. launchMap,
  25. launchDefaultWebPage,
  26. launchDefaultNetwork,
  27. launchKnownNetwork
  28. };
  29. // Basically, this is the structure to pass information to the launched
  30. // Local Troubleshooter OCX
  31. class CItem
  32. {
  33. public:
  34. enum { SYM_LEN = 512 };
  35. enum { NODE_COUNT = 55 };
  36. enum { GUID_LEN = 256 }; // this is used for other things besides GUIDs, so
  37. // don't shrink it just because GUIDs are smaller.
  38. public:
  39. CItem();
  40. void ReInit();
  41. void Clear();
  42. void SetNetwork(LPCTSTR szNetwork);
  43. void SetProblem(LPCTSTR szProblem);
  44. void SetNode(LPCTSTR szNode, LPCTSTR szState);
  45. bool GetNetwork(LPTSTR *pszCmd, LPTSTR *pszVal);
  46. bool GetProblem(LPTSTR *szCmd, LPTSTR *szVal);
  47. bool GetNodeState(int iNodeC, LPTSTR *szCmd, LPTSTR *szVal);
  48. TCHAR m_szEventName[SYM_LEN]; // an arbitrary, unique event name related to this
  49. // launch.
  50. // ProblemSet and NetworkSet are used to query the state of the item.
  51. bool ProblemSet();
  52. bool NetworkSet();
  53. // Interface to other member variables recponsible for launching
  54. void SetLaunchRegime(ELaunchRegime eLaunchRegime);
  55. void SetContainerPathName(TCHAR szContainerPathName[MAX_PATH]);
  56. void SetWebPage(TCHAR m_szWebPage[MAX_PATH]);
  57. void SetSniffScriptFile(TCHAR szSniffScriptFile[MAX_PATH]);
  58. void SetSniffStandardFile(TCHAR szSniffStandardFile[MAX_PATH]);
  59. ELaunchRegime GetLaunchRegime();
  60. TCHAR* GetContainerPathName();
  61. TCHAR* GetWebPage();
  62. TCHAR* GetSniffScriptFile();
  63. TCHAR* GetSniffStandardFile();
  64. // Although the troubleshooting network & problem node are already specified,
  65. // this info is here for sniffing. That is, the Troubleshooter OCX can get the
  66. // P&P device ID & use it for sniffing purposes.
  67. TCHAR m_szPNPDeviceID[GUID_LEN]; // Plug & Play Device ID
  68. TCHAR m_szGuidClass[GUID_LEN]; // Standard text representation of Device Class GUID
  69. TCHAR m_szMachineID[GUID_LEN]; // Machine name (in format like "\\holmes")
  70. // Needed so that we can sniff on a remote machine
  71. TCHAR m_szDeviceInstanceID[GUID_LEN]; // Needed so that we can sniff correct device
  72. protected:
  73. TCHAR m_szProblemDef[SYM_LEN]; // "TShootProblem", typically used as m_aszCmds[1]
  74. // so that m_aszVals[1] is the name of the
  75. // problem node
  76. TCHAR m_szTypeDef[SYM_LEN]; // "type", typically used as m_aszCmds[0]
  77. // so that m_aszVals[0] is the name of the
  78. // troubleshooting belief network
  79. int m_cNodesSet; // The number of nodes, other than the problem
  80. // node, for which we've set states.
  81. // The next two arrays are used jointly. m_aszCmds[i] and m_aszVals[i] are
  82. // a name/value pair similar to what would be returned by an HTML form,
  83. // although, in practice, the Local Troubleshooter OCX does the work that
  84. // (on the Web) would be performed by server-side code.
  85. // Typically these arrays have m_cNodesSet+2 significant entries (with the first
  86. // 2 locations indicating troubleshooting network and problem node).
  87. // Second dimension is just amount of space for each string.
  88. TCHAR m_aszCmds[NODE_COUNT][SYM_LEN];
  89. TCHAR m_aszVals[NODE_COUNT][SYM_LEN];
  90. TCHAR m_szContainerPathName[MAX_PATH]; // name (possibly full path) of executable intended to start
  91. TCHAR m_szWebPage[MAX_PATH]; // full path of web page file (possibly default) to start container with
  92. TCHAR m_szSniffScriptFile[MAX_PATH]; // contains full path and file name of "network"_sniff.htm file
  93. TCHAR m_szSniffStandardFile[MAX_PATH]; // contains full path and file name of tssniffAsk.htm file
  94. ELaunchRegime m_eLaunchRegime; // regime of launch
  95. };
  96. class CSMStateInfo
  97. {
  98. enum { HANDLE_VAL = 1 };
  99. public:
  100. CSMStateInfo();
  101. ~CSMStateInfo();
  102. /* Made for the ILaunchTS interface . */
  103. HRESULT GetShooterStates(CItem &refLaunchState, DWORD *pdwResult);
  104. /* Made for the ITShootATL interface . */
  105. bool GoGo(DWORD dwTimeOut, CItem &item, DWORD *pdwResult);
  106. bool GoURL(CItem &item, DWORD *pdwResult);
  107. /* Made to verify the mapping code. */
  108. // The ILaunchTS interface uses TestGet directly.
  109. // The ITShootATL interface uses TestPut indirectly through the CLaunch class.
  110. // CLaunch does the mapping and then calls TestPut.
  111. void TestPut(CItem &item); // Simply copies item to m_Item.
  112. void TestGet(CItem &item); // Simply copies m_Item to item.
  113. protected:
  114. CComCriticalSection m_csGlobalMemory; // Critical section to protect global
  115. // memory against simultaneous use by
  116. // TSLaunch.DLL & Local Troubleshooter OCX
  117. CComCriticalSection m_csSingleLaunch; // Critical section to prevent distinct
  118. // launches (say, by 2 different applications)
  119. // from overlapping dangerously.
  120. CItem m_Item;
  121. BOOL CreateContainer(CItem &item, LPTSTR szCommand);
  122. BOOL CopySniffScriptFile(CItem &item);
  123. };