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.

1815 lines
43 KiB

  1. //----------------------------------------------------------------------------
  2. //
  3. // Engine interface proxies and stubs.
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000-2002.
  6. //
  7. //----------------------------------------------------------------------------
  8. #include "ntsdp.hpp"
  9. // Generated headers.
  10. #include "dbgeng_p.hpp"
  11. #include "dbgeng_s.hpp"
  12. #include "dbgsvc_p.hpp"
  13. #include "dbgsvc_s.hpp"
  14. //----------------------------------------------------------------------------
  15. //
  16. // Initialization.
  17. //
  18. //----------------------------------------------------------------------------
  19. void
  20. DbgRpcInitializeClient(void)
  21. {
  22. DbgRpcInitializeStubTables_dbgeng(DBGRPC_SIF_DBGENG_FIRST);
  23. DbgRpcInitializeStubTables_dbgsvc(DBGRPC_SIF_DBGSVC_FIRST);
  24. //
  25. // Ensure that released interfaces haven't changed.
  26. //
  27. C_ASSERT(DBGRPC_UNIQUE_IDebugAdvanced == 19156);
  28. C_ASSERT(DBGRPC_UNIQUE_IDebugBreakpoint == 76131);
  29. C_ASSERT(DBGRPC_UNIQUE_IDebugClient == 229769);
  30. C_ASSERT(DBGRPC_UNIQUE_IDebugClient2 == 258161);
  31. C_ASSERT(DBGRPC_UNIQUE_IDebugClient3 == 308255);
  32. C_ASSERT(DBGRPC_UNIQUE_IDebugControl == 590362);
  33. C_ASSERT(DBGRPC_UNIQUE_IDebugControl2 == 635813);
  34. C_ASSERT(DBGRPC_UNIQUE_IDebugControl3 == 706698);
  35. C_ASSERT(DBGRPC_UNIQUE_IDebugDataSpaces == 180033);
  36. C_ASSERT(DBGRPC_UNIQUE_IDebugDataSpaces2 == 231471);
  37. C_ASSERT(DBGRPC_UNIQUE_IDebugDataSpaces3 == 256971);
  38. C_ASSERT(DBGRPC_UNIQUE_IDebugEventCallbacks == 87804);
  39. C_ASSERT(DBGRPC_UNIQUE_IDebugInputCallbacks == 10391);
  40. C_ASSERT(DBGRPC_UNIQUE_IDebugOutputCallbacks == 9646);
  41. C_ASSERT(DBGRPC_UNIQUE_IDebugRegisters == 69746);
  42. C_ASSERT(DBGRPC_UNIQUE_IDebugSymbolGroup == 53483);
  43. C_ASSERT(DBGRPC_UNIQUE_IDebugSymbols == 376151);
  44. C_ASSERT(DBGRPC_UNIQUE_IDebugSymbols2 == 435328);
  45. C_ASSERT(DBGRPC_UNIQUE_IDebugSystemObjects == 135421);
  46. C_ASSERT(DBGRPC_UNIQUE_IDebugSystemObjects2 == 155936);
  47. C_ASSERT(DBGRPC_UNIQUE_IDebugSystemObjects3 == 206920);
  48. }
  49. //----------------------------------------------------------------------------
  50. //
  51. // Proxy and stub support.
  52. //
  53. //----------------------------------------------------------------------------
  54. DbgRpcStubFunction
  55. DbgRpcGetStub(USHORT StubIndex)
  56. {
  57. USHORT If = (USHORT) DBGRPC_STUB_INDEX_INTERFACE(StubIndex);
  58. USHORT Mth = (USHORT) DBGRPC_STUB_INDEX_METHOD(StubIndex);
  59. DbgRpcStubFunctionTable* Table;
  60. if (If <= DBGRPC_SIF_DBGENG_LAST)
  61. {
  62. Table = g_DbgRpcStubs_dbgeng;
  63. }
  64. else if (If >= DBGRPC_SIF_DBGSVC_FIRST &&
  65. If >= DBGRPC_SIF_DBGSVC_LAST)
  66. {
  67. Table = g_DbgRpcStubs_dbgsvc;
  68. If -= DBGRPC_SIF_DBGSVC_FIRST;
  69. }
  70. else
  71. {
  72. return NULL;
  73. }
  74. if (Mth >= Table[If].Count)
  75. {
  76. return NULL;
  77. }
  78. return Table[If].Functions[Mth];
  79. }
  80. #if DBG
  81. PCSTR
  82. DbgRpcGetStubName(USHORT StubIndex)
  83. {
  84. USHORT If = (USHORT) DBGRPC_STUB_INDEX_INTERFACE(StubIndex);
  85. USHORT Mth = (USHORT) DBGRPC_STUB_INDEX_METHOD(StubIndex);
  86. DbgRpcStubFunctionTable* Table;
  87. PCSTR** Names;
  88. if (If <= DBGRPC_SIF_DBGENG_LAST)
  89. {
  90. Table = g_DbgRpcStubs_dbgeng;
  91. Names = g_DbgRpcStubNames_dbgeng;
  92. }
  93. else if (If >= DBGRPC_SIF_DBGSVC_FIRST &&
  94. If >= DBGRPC_SIF_DBGSVC_LAST)
  95. {
  96. Table = g_DbgRpcStubs_dbgsvc;
  97. Names = g_DbgRpcStubNames_dbgsvc;
  98. If -= DBGRPC_SIF_DBGSVC_FIRST;
  99. }
  100. else
  101. {
  102. return "!InvalidInterface!";
  103. }
  104. if (Mth >= Table[If].Count)
  105. {
  106. return "!InvalidStubIndex!";
  107. }
  108. return Names[If][Mth];
  109. }
  110. #endif // #if DBG
  111. HRESULT
  112. DbgRpcPreallocProxy(REFIID InterfaceId, PVOID* Interface,
  113. DbgRpcProxy** Proxy, PULONG IfUnique)
  114. {
  115. HRESULT Status;
  116. Status = DbgRpcPreallocProxy_dbgeng(InterfaceId, Interface,
  117. Proxy, IfUnique);
  118. if (Status == E_NOINTERFACE)
  119. {
  120. Status = DbgRpcPreallocProxy_dbgsvc(InterfaceId, Interface,
  121. Proxy, IfUnique);
  122. }
  123. return Status;
  124. }
  125. void
  126. DbgRpcDeleteProxy(class DbgRpcProxy* Proxy)
  127. {
  128. // All proxies used here are similar simple single
  129. // vtable proxy objects so IDebugClient can represent them all.
  130. delete (ProxyIDebugClient*)Proxy;
  131. }
  132. HRESULT
  133. DbgRpcServerThreadInitialize(void)
  134. {
  135. HRESULT Status;
  136. // eXDI requires that all threads have OLE initialized
  137. // for the COM RPC that's done. We don't want
  138. // to do this all the time because it brings in a bunch
  139. // of OLE code that won't be used except in the eXDI
  140. // case. The OLE code is dynlinked so only init
  141. // if OLE code is loaded.
  142. if (g_Ole32Calls.CoInitializeEx)
  143. {
  144. if (FAILED(Status = g_Ole32Calls.
  145. CoInitializeEx(NULL, COM_THREAD_MODEL)))
  146. {
  147. return Status;
  148. }
  149. }
  150. return S_OK;
  151. }
  152. void
  153. DbgRpcServerThreadUninitialize(void)
  154. {
  155. if (g_Ole32Calls.CoUninitialize)
  156. {
  157. g_Ole32Calls.CoUninitialize();
  158. }
  159. }
  160. void
  161. DbgRpcError(char* Format, ...)
  162. {
  163. va_list Args;
  164. va_start(Args, Format);
  165. MaskOutVa(DEBUG_OUTPUT_ERROR, Format, Args, TRUE);
  166. va_end(Args);
  167. }
  168. //----------------------------------------------------------------------------
  169. //
  170. // Generated RPC proxies and stubs.
  171. //
  172. //----------------------------------------------------------------------------
  173. #include "dbgeng_p.cpp"
  174. #include "dbgeng_s.cpp"
  175. //----------------------------------------------------------------------------
  176. //
  177. // Hand-written proxies and stubs.
  178. //
  179. //----------------------------------------------------------------------------
  180. STDMETHODIMP
  181. ProxyIDebugClient::CreateClient(
  182. OUT PDEBUG_CLIENT* Client
  183. )
  184. {
  185. DbgRpcConnection* Conn;
  186. // Always look up the owning connection.
  187. Conn = DbgRpcGetConnection(m_OwningThread);
  188. if (Conn == NULL)
  189. {
  190. return RPC_E_CONNECTION_TERMINATED;
  191. }
  192. if (GetCurrentThreadId() != m_OwningThread)
  193. {
  194. // The caller wants a new client for a new thread.
  195. // Create a new RPC connection based on the owning connection.
  196. DbgRpcTransport* Trans = Conn->m_Trans->Clone();
  197. if (Trans == NULL)
  198. {
  199. return E_OUTOFMEMORY;
  200. }
  201. return DbgRpcCreateServerConnection(Trans, &IID_IDebugClient,
  202. (IUnknown**)Client);
  203. }
  204. //
  205. // Just creating another client for the owning thread.
  206. // Normal RPC.
  207. //
  208. HRESULT Status;
  209. DbgRpcCall Call;
  210. PUCHAR Data;
  211. PDEBUG_CLIENT Proxy;
  212. if ((Data = Conn->StartCall(&Call, m_ObjectId,
  213. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  214. DBGRPC_SMTH_IDebugClient_CreateClient),
  215. 0, sizeof(DbgRpcObjectId))) == NULL)
  216. {
  217. Status = E_OUTOFMEMORY;
  218. }
  219. else
  220. {
  221. if ((Proxy = DbgRpcPreallocIDebugClientProxy()) == NULL)
  222. {
  223. Status = E_OUTOFMEMORY;
  224. }
  225. else
  226. {
  227. Status = Conn->SendReceive(&Call, &Data);
  228. if (Status == S_OK)
  229. {
  230. *Client = (PDEBUG_CLIENT)
  231. ((ProxyIDebugClient*)Proxy)->
  232. InitializeProxy(Conn, *(DbgRpcObjectId*)Data, Proxy);
  233. }
  234. else
  235. {
  236. delete Proxy;
  237. }
  238. }
  239. Conn->FreeData(Data);
  240. }
  241. return Status;
  242. }
  243. STDMETHODIMP
  244. ProxyIDebugClient::StartProcessServer(
  245. IN ULONG Flags,
  246. IN PCSTR Options,
  247. IN PVOID Reserved
  248. )
  249. {
  250. if (::GetCurrentThreadId() != m_OwningThread)
  251. {
  252. return E_INVALIDARG;
  253. }
  254. if (Reserved != NULL)
  255. {
  256. return E_INVALIDARG;
  257. }
  258. DbgRpcConnection* Conn;
  259. DbgRpcCall Call;
  260. PUCHAR Data;
  261. HRESULT Status;
  262. ULONG Len = strlen(Options) + 1;
  263. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  264. (Data = Conn->StartCall(&Call, m_ObjectId,
  265. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  266. DBGRPC_SMTH_IDebugClient_StartProcessServer),
  267. Len + sizeof(ULONG), 0)) == NULL)
  268. {
  269. Status = E_OUTOFMEMORY;
  270. }
  271. else
  272. {
  273. PUCHAR InData = Data;
  274. *(ULONG*)InData = Flags;
  275. InData += sizeof(ULONG);
  276. memcpy(InData, Options, Len);
  277. Status = Conn->SendReceive(&Call, &Data);
  278. Conn->FreeData(Data);
  279. }
  280. return Status;
  281. }
  282. STDMETHODIMP
  283. ProxyIDebugClient2::CreateClient(
  284. OUT PDEBUG_CLIENT* Client
  285. )
  286. {
  287. DbgRpcConnection* Conn;
  288. // Always look up the owning connection.
  289. Conn = DbgRpcGetConnection(m_OwningThread);
  290. if (Conn == NULL)
  291. {
  292. return RPC_E_CONNECTION_TERMINATED;
  293. }
  294. if (GetCurrentThreadId() != m_OwningThread)
  295. {
  296. // The caller wants a new client for a new thread.
  297. // Create a new RPC connection based on the owning connection.
  298. DbgRpcTransport* Trans = Conn->m_Trans->Clone();
  299. if (Trans == NULL)
  300. {
  301. return E_OUTOFMEMORY;
  302. }
  303. return DbgRpcCreateServerConnection(Trans, &IID_IDebugClient,
  304. (IUnknown**)Client);
  305. }
  306. //
  307. // Just creating another client for the owning thread.
  308. // Normal RPC.
  309. //
  310. HRESULT Status;
  311. DbgRpcCall Call;
  312. PUCHAR Data;
  313. PDEBUG_CLIENT Proxy;
  314. if ((Data = Conn->StartCall(&Call, m_ObjectId,
  315. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  316. DBGRPC_SMTH_IDebugClient2_CreateClient),
  317. 0, sizeof(DbgRpcObjectId))) == NULL)
  318. {
  319. Status = E_OUTOFMEMORY;
  320. }
  321. else
  322. {
  323. if ((Proxy = DbgRpcPreallocIDebugClientProxy()) == NULL)
  324. {
  325. Status = E_OUTOFMEMORY;
  326. }
  327. else
  328. {
  329. Status = Conn->SendReceive(&Call, &Data);
  330. if (Status == S_OK)
  331. {
  332. *Client = (PDEBUG_CLIENT)
  333. ((ProxyIDebugClient*)Proxy)->
  334. InitializeProxy(Conn, *(DbgRpcObjectId*)Data, Proxy);
  335. }
  336. else
  337. {
  338. delete Proxy;
  339. }
  340. }
  341. Conn->FreeData(Data);
  342. }
  343. return Status;
  344. }
  345. STDMETHODIMP
  346. ProxyIDebugClient2::StartProcessServer(
  347. IN ULONG Flags,
  348. IN PCSTR Options,
  349. IN PVOID Reserved
  350. )
  351. {
  352. if (::GetCurrentThreadId() != m_OwningThread)
  353. {
  354. return E_INVALIDARG;
  355. }
  356. if (Reserved != NULL)
  357. {
  358. return E_INVALIDARG;
  359. }
  360. DbgRpcConnection* Conn;
  361. DbgRpcCall Call;
  362. PUCHAR Data;
  363. HRESULT Status;
  364. ULONG Len = strlen(Options) + 1;
  365. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  366. (Data = Conn->StartCall(&Call, m_ObjectId,
  367. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  368. DBGRPC_SMTH_IDebugClient2_StartProcessServer),
  369. Len + sizeof(ULONG), 0)) == NULL)
  370. {
  371. Status = E_OUTOFMEMORY;
  372. }
  373. else
  374. {
  375. PUCHAR InData = Data;
  376. *(ULONG*)InData = Flags;
  377. InData += sizeof(ULONG);
  378. memcpy(InData, Options, Len);
  379. Status = Conn->SendReceive(&Call, &Data);
  380. Conn->FreeData(Data);
  381. }
  382. return Status;
  383. }
  384. STDMETHODIMP
  385. ProxyIDebugClient3::CreateClient(
  386. OUT PDEBUG_CLIENT* Client
  387. )
  388. {
  389. DbgRpcConnection* Conn;
  390. // Always look up the owning connection.
  391. Conn = DbgRpcGetConnection(m_OwningThread);
  392. if (Conn == NULL)
  393. {
  394. return RPC_E_CONNECTION_TERMINATED;
  395. }
  396. if (GetCurrentThreadId() != m_OwningThread)
  397. {
  398. // The caller wants a new client for a new thread.
  399. // Create a new RPC connection based on the owning connection.
  400. DbgRpcTransport* Trans = Conn->m_Trans->Clone();
  401. if (Trans == NULL)
  402. {
  403. return E_OUTOFMEMORY;
  404. }
  405. return DbgRpcCreateServerConnection(Trans, &IID_IDebugClient,
  406. (IUnknown**)Client);
  407. }
  408. //
  409. // Just creating another client for the owning thread.
  410. // Normal RPC.
  411. //
  412. HRESULT Status;
  413. DbgRpcCall Call;
  414. PUCHAR Data;
  415. PDEBUG_CLIENT Proxy;
  416. if ((Data = Conn->StartCall(&Call, m_ObjectId,
  417. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  418. DBGRPC_SMTH_IDebugClient3_CreateClient),
  419. 0, sizeof(DbgRpcObjectId))) == NULL)
  420. {
  421. Status = E_OUTOFMEMORY;
  422. }
  423. else
  424. {
  425. if ((Proxy = DbgRpcPreallocIDebugClientProxy()) == NULL)
  426. {
  427. Status = E_OUTOFMEMORY;
  428. }
  429. else
  430. {
  431. Status = Conn->SendReceive(&Call, &Data);
  432. if (Status == S_OK)
  433. {
  434. *Client = (PDEBUG_CLIENT)
  435. ((ProxyIDebugClient*)Proxy)->
  436. InitializeProxy(Conn, *(DbgRpcObjectId*)Data, Proxy);
  437. }
  438. else
  439. {
  440. delete Proxy;
  441. }
  442. }
  443. Conn->FreeData(Data);
  444. }
  445. return Status;
  446. }
  447. STDMETHODIMP
  448. ProxyIDebugClient3::StartProcessServer(
  449. IN ULONG Flags,
  450. IN PCSTR Options,
  451. IN PVOID Reserved
  452. )
  453. {
  454. if (::GetCurrentThreadId() != m_OwningThread)
  455. {
  456. return E_INVALIDARG;
  457. }
  458. if (Reserved != NULL)
  459. {
  460. return E_INVALIDARG;
  461. }
  462. DbgRpcConnection* Conn;
  463. DbgRpcCall Call;
  464. PUCHAR Data;
  465. HRESULT Status;
  466. ULONG Len = strlen(Options) + 1;
  467. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  468. (Data = Conn->StartCall(&Call, m_ObjectId,
  469. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  470. DBGRPC_SMTH_IDebugClient3_StartProcessServer),
  471. Len + sizeof(ULONG), 0)) == NULL)
  472. {
  473. Status = E_OUTOFMEMORY;
  474. }
  475. else
  476. {
  477. PUCHAR InData = Data;
  478. *(ULONG*)InData = Flags;
  479. InData += sizeof(ULONG);
  480. memcpy(InData, Options, Len);
  481. Status = Conn->SendReceive(&Call, &Data);
  482. Conn->FreeData(Data);
  483. }
  484. return Status;
  485. }
  486. STDMETHODIMP
  487. ProxyIDebugClient4::CreateClient(
  488. OUT PDEBUG_CLIENT* Client
  489. )
  490. {
  491. DbgRpcConnection* Conn;
  492. // Always look up the owning connection.
  493. Conn = DbgRpcGetConnection(m_OwningThread);
  494. if (Conn == NULL)
  495. {
  496. return RPC_E_CONNECTION_TERMINATED;
  497. }
  498. if (GetCurrentThreadId() != m_OwningThread)
  499. {
  500. // The caller wants a new client for a new thread.
  501. // Create a new RPC connection based on the owning connection.
  502. DbgRpcTransport* Trans = Conn->m_Trans->Clone();
  503. if (Trans == NULL)
  504. {
  505. return E_OUTOFMEMORY;
  506. }
  507. return DbgRpcCreateServerConnection(Trans, &IID_IDebugClient,
  508. (IUnknown**)Client);
  509. }
  510. //
  511. // Just creating another client for the owning thread.
  512. // Normal RPC.
  513. //
  514. HRESULT Status;
  515. DbgRpcCall Call;
  516. PUCHAR Data;
  517. PDEBUG_CLIENT Proxy;
  518. if ((Data = Conn->StartCall(&Call, m_ObjectId,
  519. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  520. DBGRPC_SMTH_IDebugClient4_CreateClient),
  521. 0, sizeof(DbgRpcObjectId))) == NULL)
  522. {
  523. Status = E_OUTOFMEMORY;
  524. }
  525. else
  526. {
  527. if ((Proxy = DbgRpcPreallocIDebugClientProxy()) == NULL)
  528. {
  529. Status = E_OUTOFMEMORY;
  530. }
  531. else
  532. {
  533. Status = Conn->SendReceive(&Call, &Data);
  534. if (Status == S_OK)
  535. {
  536. *Client = (PDEBUG_CLIENT)
  537. ((ProxyIDebugClient*)Proxy)->
  538. InitializeProxy(Conn, *(DbgRpcObjectId*)Data, Proxy);
  539. }
  540. else
  541. {
  542. delete Proxy;
  543. }
  544. }
  545. Conn->FreeData(Data);
  546. }
  547. return Status;
  548. }
  549. STDMETHODIMP
  550. ProxyIDebugClient4::StartProcessServer(
  551. IN ULONG Flags,
  552. IN PCSTR Options,
  553. IN PVOID Reserved
  554. )
  555. {
  556. if (::GetCurrentThreadId() != m_OwningThread)
  557. {
  558. return E_INVALIDARG;
  559. }
  560. if (Reserved != NULL)
  561. {
  562. return E_INVALIDARG;
  563. }
  564. DbgRpcConnection* Conn;
  565. DbgRpcCall Call;
  566. PUCHAR Data;
  567. HRESULT Status;
  568. ULONG Len = strlen(Options) + 1;
  569. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  570. (Data = Conn->StartCall(&Call, m_ObjectId,
  571. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  572. DBGRPC_SMTH_IDebugClient4_StartProcessServer),
  573. Len + sizeof(ULONG), 0)) == NULL)
  574. {
  575. Status = E_OUTOFMEMORY;
  576. }
  577. else
  578. {
  579. PUCHAR InData = Data;
  580. *(ULONG*)InData = Flags;
  581. InData += sizeof(ULONG);
  582. memcpy(InData, Options, Len);
  583. Status = Conn->SendReceive(&Call, &Data);
  584. Conn->FreeData(Data);
  585. }
  586. return Status;
  587. }
  588. //
  589. // The following methods are hand-written to convert
  590. // varargs output into simple strings before sending
  591. // them on.
  592. //
  593. STDMETHODIMPV
  594. ProxyIDebugControl::Output(
  595. IN ULONG Mask,
  596. IN PCSTR Format,
  597. ...
  598. )
  599. {
  600. va_list Args;
  601. HRESULT Status;
  602. if (::GetCurrentThreadId() != m_OwningThread)
  603. {
  604. return E_INVALIDARG;
  605. }
  606. va_start(Args, Format);
  607. Status = OutputVaList(Mask, Format, Args);
  608. va_end(Args);
  609. return Status;
  610. }
  611. STDMETHODIMP
  612. ProxyIDebugControl::OutputVaList(
  613. THIS_
  614. IN ULONG Mask,
  615. IN PCSTR Format,
  616. IN va_list Args
  617. )
  618. {
  619. int Len;
  620. BOOL Ptr64;
  621. if (IsPointer64Bit() == S_FALSE)
  622. {
  623. Ptr64 = FALSE;
  624. }
  625. else
  626. {
  627. Ptr64 = TRUE;
  628. }
  629. // Need the engine lock for the global buffers.
  630. ENTER_ENGINE();
  631. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  632. Ptr64))
  633. {
  634. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  635. g_FormatBuffer, Args);
  636. }
  637. else
  638. {
  639. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  640. }
  641. if (Len <= 0)
  642. {
  643. LEAVE_ENGINE();
  644. return E_INVALIDARG;
  645. }
  646. else
  647. {
  648. Len++;
  649. }
  650. DbgRpcConnection* Conn;
  651. DbgRpcCall Call;
  652. PUCHAR Data;
  653. HRESULT Status;
  654. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  655. (Data = Conn->StartCall(&Call, m_ObjectId,
  656. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  657. DBGRPC_SMTH_IDebugControl_OutputVaList),
  658. Len + sizeof(ULONG), 0)) == NULL)
  659. {
  660. LEAVE_ENGINE();
  661. Status = E_OUTOFMEMORY;
  662. }
  663. else
  664. {
  665. PUCHAR InData = Data;
  666. *(ULONG*)InData = Mask;
  667. InData += sizeof(ULONG);
  668. memcpy(InData, g_OutBuffer, Len);
  669. LEAVE_ENGINE();
  670. Status = Conn->SendReceive(&Call, &Data);
  671. Conn->FreeData(Data);
  672. }
  673. return Status;
  674. }
  675. STDMETHODIMPV
  676. ProxyIDebugControl::ControlledOutput(
  677. THIS_
  678. IN ULONG OutputControl,
  679. IN ULONG Mask,
  680. IN PCSTR Format,
  681. ...
  682. )
  683. {
  684. va_list Args;
  685. HRESULT Status;
  686. if (::GetCurrentThreadId() != m_OwningThread)
  687. {
  688. return E_INVALIDARG;
  689. }
  690. va_start(Args, Format);
  691. Status = ControlledOutputVaList(OutputControl, Mask, Format, Args);
  692. va_end(Args);
  693. return Status;
  694. }
  695. STDMETHODIMP
  696. ProxyIDebugControl::ControlledOutputVaList(
  697. THIS_
  698. IN ULONG OutputControl,
  699. IN ULONG Mask,
  700. IN PCSTR Format,
  701. IN va_list Args
  702. )
  703. {
  704. int Len;
  705. BOOL Ptr64;
  706. if (IsPointer64Bit() == S_FALSE)
  707. {
  708. Ptr64 = FALSE;
  709. }
  710. else
  711. {
  712. Ptr64 = TRUE;
  713. }
  714. // Need the engine lock for the global buffers.
  715. ENTER_ENGINE();
  716. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  717. Ptr64))
  718. {
  719. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  720. g_FormatBuffer, Args);
  721. }
  722. else
  723. {
  724. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  725. }
  726. if (Len <= 0)
  727. {
  728. LEAVE_ENGINE();
  729. return E_INVALIDARG;
  730. }
  731. else
  732. {
  733. Len++;
  734. }
  735. DbgRpcConnection* Conn;
  736. DbgRpcCall Call;
  737. PUCHAR Data;
  738. HRESULT Status;
  739. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  740. (Data = Conn->StartCall(&Call, m_ObjectId,
  741. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  742. DBGRPC_SMTH_IDebugControl_ControlledOutputVaList),
  743. Len + 2 * sizeof(ULONG), 0)) == NULL)
  744. {
  745. LEAVE_ENGINE();
  746. Status = E_OUTOFMEMORY;
  747. }
  748. else
  749. {
  750. PUCHAR InData = Data;
  751. *(ULONG*)InData = OutputControl;
  752. InData += sizeof(ULONG);
  753. *(ULONG*)InData = Mask;
  754. InData += sizeof(ULONG);
  755. memcpy(InData, g_OutBuffer, Len);
  756. LEAVE_ENGINE();
  757. Status = Conn->SendReceive(&Call, &Data);
  758. Conn->FreeData(Data);
  759. }
  760. return Status;
  761. }
  762. STDMETHODIMPV
  763. ProxyIDebugControl::OutputPrompt(
  764. IN ULONG OutputControl,
  765. IN OPTIONAL PCSTR Format,
  766. ...
  767. )
  768. {
  769. va_list Args;
  770. HRESULT Status;
  771. if (::GetCurrentThreadId() != m_OwningThread)
  772. {
  773. return E_INVALIDARG;
  774. }
  775. va_start(Args, Format);
  776. Status = OutputPromptVaList(OutputControl, Format, Args);
  777. va_end(Args);
  778. return Status;
  779. }
  780. STDMETHODIMP
  781. ProxyIDebugControl::OutputPromptVaList(
  782. THIS_
  783. IN ULONG OutputControl,
  784. IN OPTIONAL PCSTR Format,
  785. IN va_list Args
  786. )
  787. {
  788. int Len;
  789. if (Format != NULL)
  790. {
  791. BOOL Ptr64;
  792. if (IsPointer64Bit() == S_FALSE)
  793. {
  794. Ptr64 = FALSE;
  795. }
  796. else
  797. {
  798. Ptr64 = TRUE;
  799. }
  800. // Need the engine lock for the global buffers.
  801. ENTER_ENGINE();
  802. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  803. Ptr64))
  804. {
  805. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  806. g_FormatBuffer, Args);
  807. }
  808. else
  809. {
  810. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  811. }
  812. if (Len <= 0)
  813. {
  814. LEAVE_ENGINE();
  815. return E_INVALIDARG;
  816. }
  817. else
  818. {
  819. Len++;
  820. }
  821. }
  822. else
  823. {
  824. Len = 0;
  825. }
  826. DbgRpcConnection* Conn;
  827. DbgRpcCall Call;
  828. PUCHAR Data;
  829. HRESULT Status;
  830. // Presence/absence of text will be detected in the stub
  831. // by checking the input size on the call.
  832. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  833. (Data = Conn->StartCall(&Call, m_ObjectId,
  834. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  835. DBGRPC_SMTH_IDebugControl_OutputPromptVaList),
  836. Len + sizeof(ULONG), 0)) == NULL)
  837. {
  838. if (Format != NULL)
  839. {
  840. LEAVE_ENGINE();
  841. }
  842. Status = E_OUTOFMEMORY;
  843. }
  844. else
  845. {
  846. PUCHAR InData = Data;
  847. *(ULONG*)InData = OutputControl;
  848. InData += sizeof(ULONG);
  849. memcpy(InData, g_OutBuffer, Len);
  850. if (Format != NULL)
  851. {
  852. LEAVE_ENGINE();
  853. }
  854. Status = Conn->SendReceive(&Call, &Data);
  855. Conn->FreeData(Data);
  856. }
  857. return Status;
  858. }
  859. STDMETHODIMPV
  860. ProxyIDebugControl2::Output(
  861. IN ULONG Mask,
  862. IN PCSTR Format,
  863. ...
  864. )
  865. {
  866. va_list Args;
  867. HRESULT Status;
  868. if (::GetCurrentThreadId() != m_OwningThread)
  869. {
  870. return E_INVALIDARG;
  871. }
  872. va_start(Args, Format);
  873. Status = OutputVaList(Mask, Format, Args);
  874. va_end(Args);
  875. return Status;
  876. }
  877. STDMETHODIMP
  878. ProxyIDebugControl2::OutputVaList(
  879. THIS_
  880. IN ULONG Mask,
  881. IN PCSTR Format,
  882. IN va_list Args
  883. )
  884. {
  885. int Len;
  886. BOOL Ptr64;
  887. if (IsPointer64Bit() == S_FALSE)
  888. {
  889. Ptr64 = FALSE;
  890. }
  891. else
  892. {
  893. Ptr64 = TRUE;
  894. }
  895. // Need the engine lock for the global buffers.
  896. ENTER_ENGINE();
  897. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  898. Ptr64))
  899. {
  900. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  901. g_FormatBuffer, Args);
  902. }
  903. else
  904. {
  905. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  906. }
  907. if (Len <= 0)
  908. {
  909. LEAVE_ENGINE();
  910. return E_INVALIDARG;
  911. }
  912. else
  913. {
  914. Len++;
  915. }
  916. DbgRpcConnection* Conn;
  917. DbgRpcCall Call;
  918. PUCHAR Data;
  919. HRESULT Status;
  920. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  921. (Data = Conn->StartCall(&Call, m_ObjectId,
  922. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  923. DBGRPC_SMTH_IDebugControl2_OutputVaList),
  924. Len + sizeof(ULONG), 0)) == NULL)
  925. {
  926. LEAVE_ENGINE();
  927. Status = E_OUTOFMEMORY;
  928. }
  929. else
  930. {
  931. PUCHAR InData = Data;
  932. *(ULONG*)InData = Mask;
  933. InData += sizeof(ULONG);
  934. memcpy(InData, g_OutBuffer, Len);
  935. LEAVE_ENGINE();
  936. Status = Conn->SendReceive(&Call, &Data);
  937. Conn->FreeData(Data);
  938. }
  939. return Status;
  940. }
  941. STDMETHODIMPV
  942. ProxyIDebugControl2::ControlledOutput(
  943. THIS_
  944. IN ULONG OutputControl,
  945. IN ULONG Mask,
  946. IN PCSTR Format,
  947. ...
  948. )
  949. {
  950. va_list Args;
  951. HRESULT Status;
  952. if (::GetCurrentThreadId() != m_OwningThread)
  953. {
  954. return E_INVALIDARG;
  955. }
  956. va_start(Args, Format);
  957. Status = ControlledOutputVaList(OutputControl, Mask, Format, Args);
  958. va_end(Args);
  959. return Status;
  960. }
  961. STDMETHODIMP
  962. ProxyIDebugControl2::ControlledOutputVaList(
  963. THIS_
  964. IN ULONG OutputControl,
  965. IN ULONG Mask,
  966. IN PCSTR Format,
  967. IN va_list Args
  968. )
  969. {
  970. int Len;
  971. BOOL Ptr64;
  972. if (IsPointer64Bit() == S_FALSE)
  973. {
  974. Ptr64 = FALSE;
  975. }
  976. else
  977. {
  978. Ptr64 = TRUE;
  979. }
  980. // Need the engine lock for the global buffers.
  981. ENTER_ENGINE();
  982. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  983. Ptr64))
  984. {
  985. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  986. g_FormatBuffer, Args);
  987. }
  988. else
  989. {
  990. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  991. }
  992. if (Len <= 0)
  993. {
  994. LEAVE_ENGINE();
  995. return E_INVALIDARG;
  996. }
  997. else
  998. {
  999. Len++;
  1000. }
  1001. DbgRpcConnection* Conn;
  1002. DbgRpcCall Call;
  1003. PUCHAR Data;
  1004. HRESULT Status;
  1005. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  1006. (Data = Conn->StartCall(&Call, m_ObjectId,
  1007. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  1008. DBGRPC_SMTH_IDebugControl2_ControlledOutputVaList),
  1009. Len + 2 * sizeof(ULONG), 0)) == NULL)
  1010. {
  1011. LEAVE_ENGINE();
  1012. Status = E_OUTOFMEMORY;
  1013. }
  1014. else
  1015. {
  1016. PUCHAR InData = Data;
  1017. *(ULONG*)InData = OutputControl;
  1018. InData += sizeof(ULONG);
  1019. *(ULONG*)InData = Mask;
  1020. InData += sizeof(ULONG);
  1021. memcpy(InData, g_OutBuffer, Len);
  1022. LEAVE_ENGINE();
  1023. Status = Conn->SendReceive(&Call, &Data);
  1024. Conn->FreeData(Data);
  1025. }
  1026. return Status;
  1027. }
  1028. STDMETHODIMPV
  1029. ProxyIDebugControl2::OutputPrompt(
  1030. IN ULONG OutputControl,
  1031. IN OPTIONAL PCSTR Format,
  1032. ...
  1033. )
  1034. {
  1035. va_list Args;
  1036. HRESULT Status;
  1037. if (::GetCurrentThreadId() != m_OwningThread)
  1038. {
  1039. return E_INVALIDARG;
  1040. }
  1041. va_start(Args, Format);
  1042. Status = OutputPromptVaList(OutputControl, Format, Args);
  1043. va_end(Args);
  1044. return Status;
  1045. }
  1046. STDMETHODIMP
  1047. ProxyIDebugControl2::OutputPromptVaList(
  1048. THIS_
  1049. IN ULONG OutputControl,
  1050. IN OPTIONAL PCSTR Format,
  1051. IN va_list Args
  1052. )
  1053. {
  1054. int Len;
  1055. if (Format != NULL)
  1056. {
  1057. BOOL Ptr64;
  1058. if (IsPointer64Bit() == S_FALSE)
  1059. {
  1060. Ptr64 = FALSE;
  1061. }
  1062. else
  1063. {
  1064. Ptr64 = TRUE;
  1065. }
  1066. // Need the engine lock for the global buffers.
  1067. ENTER_ENGINE();
  1068. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  1069. Ptr64))
  1070. {
  1071. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  1072. g_FormatBuffer, Args);
  1073. }
  1074. else
  1075. {
  1076. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  1077. }
  1078. if (Len <= 0)
  1079. {
  1080. LEAVE_ENGINE();
  1081. return E_INVALIDARG;
  1082. }
  1083. else
  1084. {
  1085. Len++;
  1086. }
  1087. }
  1088. else
  1089. {
  1090. Len = 0;
  1091. }
  1092. DbgRpcConnection* Conn;
  1093. DbgRpcCall Call;
  1094. PUCHAR Data;
  1095. HRESULT Status;
  1096. // Presence/absence of text will be detected in the stub
  1097. // by checking the input size on the call.
  1098. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  1099. (Data = Conn->StartCall(&Call, m_ObjectId,
  1100. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  1101. DBGRPC_SMTH_IDebugControl2_OutputPromptVaList),
  1102. Len + sizeof(ULONG), 0)) == NULL)
  1103. {
  1104. if (Format != NULL)
  1105. {
  1106. LEAVE_ENGINE();
  1107. }
  1108. Status = E_OUTOFMEMORY;
  1109. }
  1110. else
  1111. {
  1112. PUCHAR InData = Data;
  1113. *(ULONG*)InData = OutputControl;
  1114. InData += sizeof(ULONG);
  1115. memcpy(InData, g_OutBuffer, Len);
  1116. if (Format != NULL)
  1117. {
  1118. LEAVE_ENGINE();
  1119. }
  1120. Status = Conn->SendReceive(&Call, &Data);
  1121. Conn->FreeData(Data);
  1122. }
  1123. return Status;
  1124. }
  1125. STDMETHODIMPV
  1126. ProxyIDebugControl3::Output(
  1127. IN ULONG Mask,
  1128. IN PCSTR Format,
  1129. ...
  1130. )
  1131. {
  1132. va_list Args;
  1133. HRESULT Status;
  1134. if (::GetCurrentThreadId() != m_OwningThread)
  1135. {
  1136. return E_INVALIDARG;
  1137. }
  1138. va_start(Args, Format);
  1139. Status = OutputVaList(Mask, Format, Args);
  1140. va_end(Args);
  1141. return Status;
  1142. }
  1143. STDMETHODIMP
  1144. ProxyIDebugControl3::OutputVaList(
  1145. THIS_
  1146. IN ULONG Mask,
  1147. IN PCSTR Format,
  1148. IN va_list Args
  1149. )
  1150. {
  1151. int Len;
  1152. BOOL Ptr64;
  1153. if (IsPointer64Bit() == S_FALSE)
  1154. {
  1155. Ptr64 = FALSE;
  1156. }
  1157. else
  1158. {
  1159. Ptr64 = TRUE;
  1160. }
  1161. // Need the engine lock for the global buffers.
  1162. ENTER_ENGINE();
  1163. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  1164. Ptr64))
  1165. {
  1166. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  1167. g_FormatBuffer, Args);
  1168. }
  1169. else
  1170. {
  1171. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  1172. }
  1173. if (Len <= 0)
  1174. {
  1175. LEAVE_ENGINE();
  1176. return E_INVALIDARG;
  1177. }
  1178. else
  1179. {
  1180. Len++;
  1181. }
  1182. DbgRpcConnection* Conn;
  1183. DbgRpcCall Call;
  1184. PUCHAR Data;
  1185. HRESULT Status;
  1186. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  1187. (Data = Conn->StartCall(&Call, m_ObjectId,
  1188. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  1189. DBGRPC_SMTH_IDebugControl3_OutputVaList),
  1190. Len + sizeof(ULONG), 0)) == NULL)
  1191. {
  1192. LEAVE_ENGINE();
  1193. Status = E_OUTOFMEMORY;
  1194. }
  1195. else
  1196. {
  1197. PUCHAR InData = Data;
  1198. *(ULONG*)InData = Mask;
  1199. InData += sizeof(ULONG);
  1200. memcpy(InData, g_OutBuffer, Len);
  1201. LEAVE_ENGINE();
  1202. Status = Conn->SendReceive(&Call, &Data);
  1203. Conn->FreeData(Data);
  1204. }
  1205. return Status;
  1206. }
  1207. STDMETHODIMPV
  1208. ProxyIDebugControl3::ControlledOutput(
  1209. THIS_
  1210. IN ULONG OutputControl,
  1211. IN ULONG Mask,
  1212. IN PCSTR Format,
  1213. ...
  1214. )
  1215. {
  1216. va_list Args;
  1217. HRESULT Status;
  1218. if (::GetCurrentThreadId() != m_OwningThread)
  1219. {
  1220. return E_INVALIDARG;
  1221. }
  1222. va_start(Args, Format);
  1223. Status = ControlledOutputVaList(OutputControl, Mask, Format, Args);
  1224. va_end(Args);
  1225. return Status;
  1226. }
  1227. STDMETHODIMP
  1228. ProxyIDebugControl3::ControlledOutputVaList(
  1229. THIS_
  1230. IN ULONG OutputControl,
  1231. IN ULONG Mask,
  1232. IN PCSTR Format,
  1233. IN va_list Args
  1234. )
  1235. {
  1236. int Len;
  1237. BOOL Ptr64;
  1238. if (IsPointer64Bit() == S_FALSE)
  1239. {
  1240. Ptr64 = FALSE;
  1241. }
  1242. else
  1243. {
  1244. Ptr64 = TRUE;
  1245. }
  1246. // Need the engine lock for the global buffers.
  1247. ENTER_ENGINE();
  1248. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  1249. Ptr64))
  1250. {
  1251. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  1252. g_FormatBuffer, Args);
  1253. }
  1254. else
  1255. {
  1256. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  1257. }
  1258. if (Len <= 0)
  1259. {
  1260. LEAVE_ENGINE();
  1261. return E_INVALIDARG;
  1262. }
  1263. else
  1264. {
  1265. Len++;
  1266. }
  1267. DbgRpcConnection* Conn;
  1268. DbgRpcCall Call;
  1269. PUCHAR Data;
  1270. HRESULT Status;
  1271. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  1272. (Data = Conn->StartCall(&Call, m_ObjectId,
  1273. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  1274. DBGRPC_SMTH_IDebugControl3_ControlledOutputVaList),
  1275. Len + 2 * sizeof(ULONG), 0)) == NULL)
  1276. {
  1277. LEAVE_ENGINE();
  1278. Status = E_OUTOFMEMORY;
  1279. }
  1280. else
  1281. {
  1282. PUCHAR InData = Data;
  1283. *(ULONG*)InData = OutputControl;
  1284. InData += sizeof(ULONG);
  1285. *(ULONG*)InData = Mask;
  1286. InData += sizeof(ULONG);
  1287. memcpy(InData, g_OutBuffer, Len);
  1288. LEAVE_ENGINE();
  1289. Status = Conn->SendReceive(&Call, &Data);
  1290. Conn->FreeData(Data);
  1291. }
  1292. return Status;
  1293. }
  1294. STDMETHODIMPV
  1295. ProxyIDebugControl3::OutputPrompt(
  1296. IN ULONG OutputControl,
  1297. IN OPTIONAL PCSTR Format,
  1298. ...
  1299. )
  1300. {
  1301. va_list Args;
  1302. HRESULT Status;
  1303. if (::GetCurrentThreadId() != m_OwningThread)
  1304. {
  1305. return E_INVALIDARG;
  1306. }
  1307. va_start(Args, Format);
  1308. Status = OutputPromptVaList(OutputControl, Format, Args);
  1309. va_end(Args);
  1310. return Status;
  1311. }
  1312. STDMETHODIMP
  1313. ProxyIDebugControl3::OutputPromptVaList(
  1314. THIS_
  1315. IN ULONG OutputControl,
  1316. IN OPTIONAL PCSTR Format,
  1317. IN va_list Args
  1318. )
  1319. {
  1320. int Len;
  1321. if (Format != NULL)
  1322. {
  1323. BOOL Ptr64;
  1324. if (IsPointer64Bit() == S_FALSE)
  1325. {
  1326. Ptr64 = FALSE;
  1327. }
  1328. else
  1329. {
  1330. Ptr64 = TRUE;
  1331. }
  1332. // Need the engine lock for the global buffers.
  1333. ENTER_ENGINE();
  1334. if (TranslateFormat(g_FormatBuffer, Format, Args, OUT_BUFFER_SIZE - 1,
  1335. Ptr64))
  1336. {
  1337. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1,
  1338. g_FormatBuffer, Args);
  1339. }
  1340. else
  1341. {
  1342. Len = _vsnprintf(g_OutBuffer, OUT_BUFFER_SIZE - 1, Format, Args);
  1343. }
  1344. if (Len <= 0)
  1345. {
  1346. LEAVE_ENGINE();
  1347. return E_INVALIDARG;
  1348. }
  1349. else
  1350. {
  1351. Len++;
  1352. }
  1353. }
  1354. else
  1355. {
  1356. Len = 0;
  1357. }
  1358. DbgRpcConnection* Conn;
  1359. DbgRpcCall Call;
  1360. PUCHAR Data;
  1361. HRESULT Status;
  1362. // Presence/absence of text will be detected in the stub
  1363. // by checking the input size on the call.
  1364. if ((Conn = DbgRpcGetConnection(m_OwningThread)) == NULL ||
  1365. (Data = Conn->StartCall(&Call, m_ObjectId,
  1366. DBGRPC_STUB_INDEX(m_InterfaceIndex,
  1367. DBGRPC_SMTH_IDebugControl3_OutputPromptVaList),
  1368. Len + sizeof(ULONG), 0)) == NULL)
  1369. {
  1370. if (Format != NULL)
  1371. {
  1372. LEAVE_ENGINE();
  1373. }
  1374. Status = E_OUTOFMEMORY;
  1375. }
  1376. else
  1377. {
  1378. PUCHAR InData = Data;
  1379. *(ULONG*)InData = OutputControl;
  1380. InData += sizeof(ULONG);
  1381. memcpy(InData, g_OutBuffer, Len);
  1382. if (Format != NULL)
  1383. {
  1384. LEAVE_ENGINE();
  1385. }
  1386. Status = Conn->SendReceive(&Call, &Data);
  1387. Conn->FreeData(Data);
  1388. }
  1389. return Status;
  1390. }
  1391. HRESULT
  1392. SFN_IDebugClient_StartProcessServer(
  1393. IUnknown* __drpc_If,
  1394. DbgRpcConnection* __drpc_Conn,
  1395. DbgRpcCall* __drpc_Call,
  1396. PUCHAR __drpc_InData,
  1397. PUCHAR __drpc_OutData
  1398. )
  1399. {
  1400. ULONG Flags = *(ULONG*)__drpc_InData;
  1401. __drpc_InData += sizeof(ULONG);
  1402. return ((IDebugClient*)__drpc_If)->
  1403. StartProcessServer(Flags, (PSTR)__drpc_InData, NULL);
  1404. }
  1405. HRESULT
  1406. SFN_IDebugClient2_StartProcessServer(
  1407. IUnknown* __drpc_If,
  1408. DbgRpcConnection* __drpc_Conn,
  1409. DbgRpcCall* __drpc_Call,
  1410. PUCHAR __drpc_InData,
  1411. PUCHAR __drpc_OutData
  1412. )
  1413. {
  1414. ULONG Flags = *(ULONG*)__drpc_InData;
  1415. __drpc_InData += sizeof(ULONG);
  1416. return ((IDebugClient2*)__drpc_If)->
  1417. StartProcessServer(Flags, (PSTR)__drpc_InData, NULL);
  1418. }
  1419. HRESULT
  1420. SFN_IDebugClient3_StartProcessServer(
  1421. IUnknown* __drpc_If,
  1422. DbgRpcConnection* __drpc_Conn,
  1423. DbgRpcCall* __drpc_Call,
  1424. PUCHAR __drpc_InData,
  1425. PUCHAR __drpc_OutData
  1426. )
  1427. {
  1428. ULONG Flags = *(ULONG*)__drpc_InData;
  1429. __drpc_InData += sizeof(ULONG);
  1430. return ((IDebugClient3*)__drpc_If)->
  1431. StartProcessServer(Flags, (PSTR)__drpc_InData, NULL);
  1432. }
  1433. HRESULT
  1434. SFN_IDebugClient4_StartProcessServer(
  1435. IUnknown* __drpc_If,
  1436. DbgRpcConnection* __drpc_Conn,
  1437. DbgRpcCall* __drpc_Call,
  1438. PUCHAR __drpc_InData,
  1439. PUCHAR __drpc_OutData
  1440. )
  1441. {
  1442. ULONG Flags = *(ULONG*)__drpc_InData;
  1443. __drpc_InData += sizeof(ULONG);
  1444. return ((IDebugClient4*)__drpc_If)->
  1445. StartProcessServer(Flags, (PSTR)__drpc_InData, NULL);
  1446. }
  1447. HRESULT
  1448. SFN_IDebugControl_OutputVaList(
  1449. IUnknown* __drpc_If,
  1450. DbgRpcConnection* __drpc_Conn,
  1451. DbgRpcCall* __drpc_Call,
  1452. PUCHAR __drpc_InData,
  1453. PUCHAR __drpc_OutData
  1454. )
  1455. {
  1456. ULONG Mask = *(ULONG*)__drpc_InData;
  1457. __drpc_InData += sizeof(ULONG);
  1458. return ((IDebugControl*)__drpc_If)->
  1459. Output(Mask, "%s", (PSTR)__drpc_InData);
  1460. }
  1461. HRESULT
  1462. SFN_IDebugControl_ControlledOutputVaList(
  1463. IUnknown* __drpc_If,
  1464. DbgRpcConnection* __drpc_Conn,
  1465. DbgRpcCall* __drpc_Call,
  1466. PUCHAR __drpc_InData,
  1467. PUCHAR __drpc_OutData
  1468. )
  1469. {
  1470. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1471. __drpc_InData += sizeof(ULONG);
  1472. ULONG Mask = *(ULONG*)__drpc_InData;
  1473. __drpc_InData += sizeof(ULONG);
  1474. return ((IDebugControl*)__drpc_If)->
  1475. ControlledOutput(OutputControl, Mask, "%s", (PSTR)__drpc_InData);
  1476. }
  1477. HRESULT
  1478. SFN_IDebugControl_OutputPromptVaList(
  1479. IUnknown* __drpc_If,
  1480. DbgRpcConnection* __drpc_Conn,
  1481. DbgRpcCall* __drpc_Call,
  1482. PUCHAR __drpc_InData,
  1483. PUCHAR __drpc_OutData
  1484. )
  1485. {
  1486. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1487. __drpc_InData += sizeof(ULONG);
  1488. if (__drpc_Call->InSize > sizeof(ULONG))
  1489. {
  1490. return ((IDebugControl*)__drpc_If)->
  1491. OutputPrompt(OutputControl, "%s", (PSTR)__drpc_InData);
  1492. }
  1493. else
  1494. {
  1495. return ((IDebugControl*)__drpc_If)->OutputPrompt(OutputControl, NULL);
  1496. }
  1497. }
  1498. HRESULT
  1499. SFN_IDebugControl2_OutputVaList(
  1500. IUnknown* __drpc_If,
  1501. DbgRpcConnection* __drpc_Conn,
  1502. DbgRpcCall* __drpc_Call,
  1503. PUCHAR __drpc_InData,
  1504. PUCHAR __drpc_OutData
  1505. )
  1506. {
  1507. ULONG Mask = *(ULONG*)__drpc_InData;
  1508. __drpc_InData += sizeof(ULONG);
  1509. return ((IDebugControl2*)__drpc_If)->
  1510. Output(Mask, "%s", (PSTR)__drpc_InData);
  1511. }
  1512. HRESULT
  1513. SFN_IDebugControl2_ControlledOutputVaList(
  1514. IUnknown* __drpc_If,
  1515. DbgRpcConnection* __drpc_Conn,
  1516. DbgRpcCall* __drpc_Call,
  1517. PUCHAR __drpc_InData,
  1518. PUCHAR __drpc_OutData
  1519. )
  1520. {
  1521. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1522. __drpc_InData += sizeof(ULONG);
  1523. ULONG Mask = *(ULONG*)__drpc_InData;
  1524. __drpc_InData += sizeof(ULONG);
  1525. return ((IDebugControl2*)__drpc_If)->
  1526. ControlledOutput(OutputControl, Mask, "%s", (PSTR)__drpc_InData);
  1527. }
  1528. HRESULT
  1529. SFN_IDebugControl2_OutputPromptVaList(
  1530. IUnknown* __drpc_If,
  1531. DbgRpcConnection* __drpc_Conn,
  1532. DbgRpcCall* __drpc_Call,
  1533. PUCHAR __drpc_InData,
  1534. PUCHAR __drpc_OutData
  1535. )
  1536. {
  1537. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1538. __drpc_InData += sizeof(ULONG);
  1539. if (__drpc_Call->InSize > sizeof(ULONG))
  1540. {
  1541. return ((IDebugControl2*)__drpc_If)->
  1542. OutputPrompt(OutputControl, "%s", (PSTR)__drpc_InData);
  1543. }
  1544. else
  1545. {
  1546. return ((IDebugControl2*)__drpc_If)->OutputPrompt(OutputControl, NULL);
  1547. }
  1548. }
  1549. HRESULT
  1550. SFN_IDebugControl3_OutputVaList(
  1551. IUnknown* __drpc_If,
  1552. DbgRpcConnection* __drpc_Conn,
  1553. DbgRpcCall* __drpc_Call,
  1554. PUCHAR __drpc_InData,
  1555. PUCHAR __drpc_OutData
  1556. )
  1557. {
  1558. ULONG Mask = *(ULONG*)__drpc_InData;
  1559. __drpc_InData += sizeof(ULONG);
  1560. return ((IDebugControl3*)__drpc_If)->
  1561. Output(Mask, "%s", (PSTR)__drpc_InData);
  1562. }
  1563. HRESULT
  1564. SFN_IDebugControl3_ControlledOutputVaList(
  1565. IUnknown* __drpc_If,
  1566. DbgRpcConnection* __drpc_Conn,
  1567. DbgRpcCall* __drpc_Call,
  1568. PUCHAR __drpc_InData,
  1569. PUCHAR __drpc_OutData
  1570. )
  1571. {
  1572. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1573. __drpc_InData += sizeof(ULONG);
  1574. ULONG Mask = *(ULONG*)__drpc_InData;
  1575. __drpc_InData += sizeof(ULONG);
  1576. return ((IDebugControl3*)__drpc_If)->
  1577. ControlledOutput(OutputControl, Mask, "%s", (PSTR)__drpc_InData);
  1578. }
  1579. HRESULT
  1580. SFN_IDebugControl3_OutputPromptVaList(
  1581. IUnknown* __drpc_If,
  1582. DbgRpcConnection* __drpc_Conn,
  1583. DbgRpcCall* __drpc_Call,
  1584. PUCHAR __drpc_InData,
  1585. PUCHAR __drpc_OutData
  1586. )
  1587. {
  1588. ULONG OutputControl = *(ULONG*)__drpc_InData;
  1589. __drpc_InData += sizeof(ULONG);
  1590. if (__drpc_Call->InSize > sizeof(ULONG))
  1591. {
  1592. return ((IDebugControl3*)__drpc_If)->
  1593. OutputPrompt(OutputControl, "%s", (PSTR)__drpc_InData);
  1594. }
  1595. else
  1596. {
  1597. return ((IDebugControl3*)__drpc_If)->OutputPrompt(OutputControl, NULL);
  1598. }
  1599. }