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.

420 lines
9.4 KiB

  1. /**MOD+**********************************************************************/
  2. /* Module: tsdbg.cpp */
  3. /* */
  4. /* Class : CMsTscDebugger */
  5. /* */
  6. /* Purpose: Implements debugger interface for RDP ActiveX control */
  7. /* */
  8. /* Copyright(C) Microsoft Corporation 1999 */
  9. /* */
  10. /* Author : Nadim Abdo (nadima) */
  11. /****************************************************************************/
  12. #include "stdafx.h"
  13. #include "tsdbg.h"
  14. #include "atlwarn.h"
  15. BEGIN_EXTERN_C
  16. #define TRC_GROUP TRC_GROUP_UI
  17. #define TRC_FILE "tsdbg"
  18. #include <atrcapi.h>
  19. END_EXTERN_C
  20. CMsTscDebugger::CMsTscDebugger()
  21. {
  22. m_pUI=NULL;
  23. m_bLockedForWrite = FALSE;
  24. }
  25. CMsTscDebugger::~CMsTscDebugger()
  26. {
  27. }
  28. BOOL CMsTscDebugger::SetUI(CUI* pUI)
  29. {
  30. ATLASSERT(pUI);
  31. if(!pUI)
  32. {
  33. return FALSE;
  34. }
  35. m_pUI = pUI;
  36. return TRUE;
  37. }
  38. //
  39. // HatchBitmapPDU property
  40. //
  41. STDMETHODIMP CMsTscDebugger::put_HatchBitmapPDU(BOOL hatchBitmapPDU)
  42. {
  43. #ifdef DC_DEBUG
  44. m_pUI->_UI.hatchBitmapPDUData = hatchBitmapPDU != 0;
  45. m_pUI->UI_CoreDebugSettingChanged();
  46. return S_OK;
  47. #else
  48. UNREFERENCED_PARAMETER(hatchBitmapPDU);
  49. return E_NOTIMPL;
  50. #endif
  51. }
  52. STDMETHODIMP CMsTscDebugger::get_HatchBitmapPDU(BOOL* phatchBitmapPDU)
  53. {
  54. #ifdef DC_DEBUG
  55. ATLASSERT(phatchBitmapPDU);
  56. if(!phatchBitmapPDU)
  57. {
  58. return E_POINTER;
  59. }
  60. *phatchBitmapPDU = m_pUI->_UI.hatchBitmapPDUData ? VB_TRUE : VB_FALSE;
  61. return S_OK;
  62. #else
  63. UNREFERENCED_PARAMETER(phatchBitmapPDU);
  64. return E_NOTIMPL;
  65. #endif
  66. }
  67. //
  68. // HatchSSBOrder property
  69. //
  70. STDMETHODIMP CMsTscDebugger::put_HatchSSBOrder(BOOL hatchSSBOrder)
  71. {
  72. #ifdef DC_DEBUG
  73. m_pUI->_UI.hatchSSBOrderData = hatchSSBOrder != 0;
  74. m_pUI->UI_CoreDebugSettingChanged();
  75. return S_OK;
  76. #else
  77. UNREFERENCED_PARAMETER(hatchSSBOrder);
  78. return E_NOTIMPL;
  79. #endif
  80. }
  81. STDMETHODIMP CMsTscDebugger::get_HatchSSBOrder(BOOL* phatchSSBOrder)
  82. {
  83. #ifdef DC_DEBUG
  84. ATLASSERT(phatchSSBOrder);
  85. if(!phatchSSBOrder)
  86. {
  87. return E_POINTER;
  88. }
  89. *phatchSSBOrder = m_pUI->_UI.hatchSSBOrderData ? VB_TRUE : VB_FALSE;
  90. return S_OK;
  91. #else
  92. UNREFERENCED_PARAMETER(phatchSSBOrder);
  93. return E_NOTIMPL;
  94. #endif
  95. }
  96. //
  97. // HatchMembltOrder property
  98. //
  99. STDMETHODIMP CMsTscDebugger::put_HatchMembltOrder(BOOL hatchMembltOrder)
  100. {
  101. #ifdef DC_DEBUG
  102. m_pUI->_UI.hatchMemBltOrderData = hatchMembltOrder != 0;
  103. m_pUI->UI_CoreDebugSettingChanged();
  104. return S_OK;
  105. #else
  106. UNREFERENCED_PARAMETER(hatchMembltOrder);
  107. return E_NOTIMPL;
  108. #endif
  109. }
  110. STDMETHODIMP CMsTscDebugger::get_HatchMembltOrder(BOOL* phatchMembltOrder)
  111. {
  112. #ifdef DC_DEBUG
  113. ATLASSERT(phatchMembltOrder);
  114. if(!phatchMembltOrder)
  115. {
  116. return E_POINTER;
  117. }
  118. *phatchMembltOrder = m_pUI->_UI.hatchMemBltOrderData ? VB_TRUE : VB_FALSE;
  119. return S_OK;
  120. #else
  121. UNREFERENCED_PARAMETER(phatchMembltOrder);
  122. return E_NOTIMPL;
  123. #endif
  124. }
  125. //
  126. // HatchIndexPDU property
  127. //
  128. STDMETHODIMP CMsTscDebugger::put_HatchIndexPDU(BOOL hatchIndexPDU)
  129. {
  130. #ifdef DC_DEBUG
  131. m_pUI->_UI.hatchIndexPDUData = hatchIndexPDU != 0;
  132. m_pUI->UI_CoreDebugSettingChanged();
  133. return S_OK;
  134. #else
  135. UNREFERENCED_PARAMETER(hatchIndexPDU);
  136. return E_NOTIMPL;
  137. #endif
  138. }
  139. STDMETHODIMP CMsTscDebugger::get_HatchIndexPDU(BOOL* phatchIndexPDU)
  140. {
  141. #ifdef DC_DEBUG
  142. ATLASSERT(phatchIndexPDU);
  143. if(!phatchIndexPDU)
  144. {
  145. return E_POINTER;
  146. }
  147. *phatchIndexPDU = m_pUI->_UI.hatchIndexPDUData ? VB_TRUE : VB_FALSE;
  148. return S_OK;
  149. #else
  150. UNREFERENCED_PARAMETER(phatchIndexPDU);
  151. return E_NOTIMPL;
  152. #endif
  153. }
  154. //
  155. // LabelMemblt property
  156. //
  157. STDMETHODIMP CMsTscDebugger::put_LabelMemblt(BOOL labelMemblt)
  158. {
  159. #ifdef DC_DEBUG
  160. m_pUI->_UI.labelMemBltOrders = labelMemblt != 0;
  161. m_pUI->UI_CoreDebugSettingChanged();
  162. return S_OK;
  163. #else
  164. UNREFERENCED_PARAMETER(labelMemblt);
  165. return E_NOTIMPL;
  166. #endif
  167. }
  168. STDMETHODIMP CMsTscDebugger::get_LabelMemblt(BOOL* plabelMemblt)
  169. {
  170. #ifdef DC_DEBUG
  171. ATLASSERT(plabelMemblt);
  172. if(!plabelMemblt)
  173. {
  174. return E_POINTER;
  175. }
  176. *plabelMemblt = m_pUI->_UI.labelMemBltOrders ? VB_TRUE : VB_FALSE;
  177. return S_OK;
  178. #else
  179. UNREFERENCED_PARAMETER(plabelMemblt);
  180. return E_NOTIMPL;
  181. #endif
  182. }
  183. //
  184. // BitmapCacheMonitor property
  185. //
  186. STDMETHODIMP CMsTscDebugger::put_BitmapCacheMonitor(BOOL bitmapCacheMonitor)
  187. {
  188. #ifdef DC_DEBUG
  189. m_pUI->_UI.bitmapCacheMonitor = bitmapCacheMonitor != 0;
  190. m_pUI->UI_CoreDebugSettingChanged();
  191. return S_OK;
  192. #else
  193. UNREFERENCED_PARAMETER(bitmapCacheMonitor);
  194. return E_NOTIMPL;
  195. #endif
  196. }
  197. STDMETHODIMP CMsTscDebugger::get_BitmapCacheMonitor(BOOL* pbitmapCacheMonitor)
  198. {
  199. #ifdef DC_DEBUG
  200. ATLASSERT(pbitmapCacheMonitor);
  201. if(!pbitmapCacheMonitor)
  202. {
  203. return E_POINTER;
  204. }
  205. *pbitmapCacheMonitor = m_pUI->_UI.bitmapCacheMonitor ? VB_TRUE : VB_FALSE;
  206. return S_OK;
  207. #else
  208. UNREFERENCED_PARAMETER(pbitmapCacheMonitor);
  209. return E_NOTIMPL;
  210. #endif
  211. }
  212. //
  213. // MallocFailures property
  214. //
  215. STDMETHODIMP CMsTscDebugger::put_MallocFailuresPercent(LONG mallocFailures)
  216. {
  217. #ifdef DC_DEBUG
  218. if(mallocFailures < 0 || mallocFailures > 100)
  219. {
  220. return E_INVALIDARG;
  221. }
  222. m_pUI->UI_SetRandomFailureItem(UT_FAILURE_MALLOC, mallocFailures);
  223. return S_OK;
  224. #else
  225. UNREFERENCED_PARAMETER(mallocFailures);
  226. return E_NOTIMPL;
  227. #endif
  228. }
  229. STDMETHODIMP CMsTscDebugger::get_MallocFailuresPercent(LONG* pmallocFailures)
  230. {
  231. #ifdef DC_DEBUG
  232. ATLASSERT(pmallocFailures);
  233. if(!pmallocFailures)
  234. {
  235. return E_POINTER;
  236. }
  237. *pmallocFailures = (LONG)m_pUI->UI_GetRandomFailureItem(UT_FAILURE_MALLOC);
  238. return S_OK;
  239. #else
  240. UNREFERENCED_PARAMETER(pmallocFailures);
  241. return E_NOTIMPL;
  242. #endif
  243. }
  244. //
  245. // MallocHugeFailures property
  246. //
  247. STDMETHODIMP CMsTscDebugger::put_MallocHugeFailuresPercent(LONG mallocHugeFailures)
  248. {
  249. #ifdef DC_DEBUG
  250. if(mallocHugeFailures < 0 || mallocHugeFailures > 100)
  251. {
  252. return E_INVALIDARG;
  253. }
  254. m_pUI->UI_SetRandomFailureItem(UT_FAILURE_MALLOC_HUGE, mallocHugeFailures);
  255. return S_OK;
  256. #else
  257. UNREFERENCED_PARAMETER(mallocHugeFailures);
  258. return E_NOTIMPL;
  259. #endif
  260. }
  261. STDMETHODIMP CMsTscDebugger::get_MallocHugeFailuresPercent(LONG* pmallocHugeFailures)
  262. {
  263. #ifdef DC_DEBUG
  264. ATLASSERT(pmallocHugeFailures);
  265. if(!pmallocHugeFailures)
  266. {
  267. return E_POINTER;
  268. }
  269. *pmallocHugeFailures = (LONG)m_pUI->UI_GetRandomFailureItem(UT_FAILURE_MALLOC_HUGE);
  270. return S_OK;
  271. #else
  272. UNREFERENCED_PARAMETER(pmallocHugeFailures);
  273. return E_NOTIMPL;
  274. #endif
  275. }
  276. //
  277. // NetThroughput property
  278. //
  279. STDMETHODIMP CMsTscDebugger::put_NetThroughput(LONG netThroughput)
  280. {
  281. #ifdef DC_DEBUG
  282. // m_NetThroughput = netThroughput;
  283. if(netThroughput < 0 || netThroughput > 50000)
  284. {
  285. return E_INVALIDARG;
  286. }
  287. m_pUI->UI_SetNetworkThroughput((DCUINT)netThroughput);
  288. return S_OK;
  289. #else
  290. UNREFERENCED_PARAMETER(netThroughput);
  291. return E_NOTIMPL;
  292. #endif
  293. }
  294. STDMETHODIMP CMsTscDebugger::get_NetThroughput(LONG* pnetThroughput)
  295. {
  296. #ifdef DC_DEBUG
  297. ATLASSERT(pnetThroughput);
  298. if(!pnetThroughput)
  299. {
  300. return E_POINTER;
  301. }
  302. *pnetThroughput = (LONG)m_pUI->UI_GetNetworkThroughput();
  303. return S_OK;
  304. #else
  305. UNREFERENCED_PARAMETER(pnetThroughput);
  306. return E_NOTIMPL;
  307. #endif
  308. }
  309. //
  310. // CLXCommand Line
  311. // this property is valid in both checked and free builds
  312. //
  313. STDMETHODIMP CMsTscDebugger::put_CLXCmdLine(BSTR CLXCmdLine)
  314. {
  315. HRESULT hr = E_FAIL;
  316. if(GetLockedForWrite())
  317. {
  318. return E_FAIL;
  319. }
  320. if (CLXCmdLine)
  321. {
  322. hr = CUT::StringPropPut(
  323. m_pUI->_UI.CLXCmdLine,
  324. SIZE_TCHARS(m_pUI->_UI.CLXCmdLine),
  325. (LPTSTR)CLXCmdLine);
  326. }
  327. else
  328. {
  329. m_pUI->_UI.CLXCmdLine[0] = 0;
  330. hr = S_OK;
  331. }
  332. return hr;
  333. }
  334. STDMETHODIMP CMsTscDebugger::get_CLXCmdLine(BSTR* pCLXCmdLine)
  335. {
  336. ATLASSERT(pCLXCmdLine);
  337. if(!pCLXCmdLine)
  338. {
  339. return E_INVALIDARG;
  340. }
  341. OLECHAR* oleClxCmdLine = (OLECHAR*)(m_pUI->_UI.CLXCmdLine);
  342. ATLASSERT(oleClxCmdLine);
  343. if (!oleClxCmdLine)
  344. {
  345. return E_OUTOFMEMORY;
  346. }
  347. *pCLXCmdLine = SysAllocString(oleClxCmdLine);
  348. if(!*pCLXCmdLine)
  349. {
  350. return E_OUTOFMEMORY;
  351. }
  352. return S_OK;
  353. }
  354. //
  355. // CLXDll
  356. // this property is deprecated for security reasons
  357. // see #533846
  358. //
  359. STDMETHODIMP CMsTscDebugger::put_CLXDll(BSTR CLXDll)
  360. {
  361. return E_NOTIMPL;
  362. }
  363. //
  364. // CLXDll
  365. // Deprecated for security reasons: bug#533846
  366. //
  367. STDMETHODIMP CMsTscDebugger::get_CLXDll(BSTR* pCLXDll)
  368. {
  369. return E_NOTIMPL;
  370. }