blizim se :)
rpc bylo hodne, ale pak mi doslo jedno biblicke rceni: "co je marshalovano, musi byt nekde demarshalovano". takze jsem si dal breakpoint na combase.dll!CoUnmarshalInterface. tech uz nebylo tolik a kdyz jsem je proklikaval, tak se periodicky stridalo rekneme 5 com unmarshalu. po kratke prohlidce stacku jsem na jednom z nich nasel actxprxy.dll a OneCoreCommonProxyStub.dll (ci tak nejak) o kterych vim, ze se me tykaj. tendle thread jsem sledoval a dovedl me do
twinui.pcshell.dll, ktery jsem prohlidnul a zacal v nem nachazet fragmenty toho, co me zajima (IVirtualDesktopManagerInternal a podobne). napsal jsem si test, kterej na tomdle interfacu zavola GetCount, attachnul na explorera, dal breakpoint do twinui.pcshell.dll!CVirtualDesktopManager::GetCount, pustil test a bang! :)
co dela klient:
TLDR: com/interface -> com/proxy -> rpc -> alpc
> rpcrt4.dll!LRPC_BASE_CCALL::DoSendReceive() Unknown
rpcrt4.dll!LRPC_CCALL::SendReceive() Unknown
rpcrt4.dll!I_RpcSendReceive() Unknown
combase.dll!CMessageCall::RpcSendRequestReceiveResponse(const _GUID & moidForTracing) Line 4281 C++
[Inline Frame] combase.dll!ThreadSendReceive(tagRPCOLEMESSAGE *) Line 7282 C++
[Inline Frame] combase.dll!CSyncClientCall::SwitchAptAndDispatchCall(tagRPCOLEMESSAGE * pMessage) Line 5735 C++
combase.dll!CSyncClientCall::SendReceive2(tagRPCOLEMESSAGE * pMessage, unsigned long * pstatus) Line 5297 C++
[Inline Frame] combase.dll!SyncClientCallRetryContext::SendReceiveWithRetry(tagRPCOLEMESSAGE *) Line 1494 C++
[Inline Frame] combase.dll!CSyncClientCall::SendReceiveInRetryContext(SyncClientCallRetryContext *) Line 582 C++
combase.dll!DefaultSendReceive(CSyncClientCall * pClientCall, tagRPCOLEMESSAGE * pMsg, unsigned long * pulStatus) Line 540 C++
combase.dll!CSyncClientCall::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 787 C++
combase.dll!CClientChannel::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 659 C++
combase.dll!NdrExtpProxySendReceive(void * pThis, _MIDL_STUB_MESSAGE * pStubMsg) Line 1989 C++
rpcrt4.dll!NdrpClientCall3() Unknown
combase.dll!ObjectStublessClient(void * ParamAddress, __int64 * FloatRegisters, long Method) Line 366 C++
combase.dll!ObjectStubless() Line 176 Unknown
tady je videt druha strana - server - toho volani (nekde okolo NdrStubCall3 je ten CoUnmarshalInterface):
TLDR: alpc -> rpc -> com/stub -> com/interface -> dll
> twinui.pcshell.dll!CVirtualDesktopManager::GetCount(unsigned int *) Unknown
rpcrt4.dll!Invoke() Unknown
rpcrt4.dll!Ndr64StubWorker() Unknown
rpcrt4.dll!NdrStubCall3() Unknown
combase.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1479 C++
[Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing::__l6::::operator()() Line 1151 C++
combase.dll!ObjectMethodExceptionHandlingAction<>(InvokeStubWithExceptionPolicyAndTracing::__l6:: action, ObjectMethodExceptionHandlingInfo * pExceptionHandlingInfo, ExceptionHandlingResult * pExceptionHandlingResult, void *) Line 94 C++
[Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing(IRpcStubBuffer * pMsg, tagRPCOLEMESSAGE *) Line 1149 C++
combase.dll!DefaultStubInvoke(bool bIsAsyncBeginMethod, IServerCall * pServerCall, IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 1218 C++
combase.dll!SyncServerCall::StubInvoke(IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 791 C++
[Inline Frame] combase.dll!StubInvoke(tagRPCOLEMESSAGE * pMsg, const _GUID &) Line 1483 C++
combase.dll!ServerCall::ContextInvoke(tagIPIDEntry * ipidEntry) Line 1421 C++
combase.dll!ComInvokeWithLockAndIPID(ServerCall * pServerCall, tagIPIDEntry * pIPIDEntry) Line 2152 C++
[Inline Frame] combase.dll!ThreadInvokeReturnHresult(_RPC_MESSAGE *) Line 6944 C++
combase.dll!ThreadInvoke(_RPC_MESSAGE * message) Line 7044 C++
rpcrt4.dll!DispatchToStubInCNoAvrf() Unknown
rpcrt4.dll!RPC_INTERFACE::DispatchToStubWorker() Unknown
rpcrt4.dll!RPC_INTERFACE::DispatchToStubWithObject() Unknown
rpcrt4.dll!LRPC_SCALL::DispatchRequest() Unknown
rpcrt4.dll!LRPC_SCALL::HandleRequest(struct _PORT_MESSAGE *,struct _PORT_MESSAGE *,void *,unsigned __int64,class RPCP_ALPC_HANDLE_ATTR *) Unknown
rpcrt4.dll!LRPC_SASSOCIATION::HandleRequest() Unknown
rpcrt4.dll!LRPC_ADDRESS::HandleRequest() Unknown
rpcrt4.dll!LRPC_ADDRESS::ProcessIO(void *) Unknown
rpcrt4.dll!LrpcIoComplete() Unknown
ntdll.dll!TppAlpcpExecuteCallback() Unknown
ntdll.dll!TppWorkerThread() Unknown
kernel32.dll!BaseThreadInitThunk() Unknown
ntdll.dll!RtlUserThreadStart() Unknown
dalsim krokem je tedy vytahnout z toho dll/pdb/debugu interface toho, co me zajima a udelat z toho headery (ty nezdokumentovany interfacy ne ze by tam byly nejak explicitne, ze bych je vykopiroval a hotovo, spis ve forme forward deklaraci nebo tak neco)
--
attachovat se na explorer je prdel, clovek si ze zacatku neuvedomi co nemuze: je to jak xwindows bez window managera :)
napr: jdu od kompu, loaduje to symboly tak to zamknu, aby mi to deti nestoply... shit! uz to neodemknu! dam breakpoint do klavesovy zkratky win+tab, abych videl kam to vede, attachnu, zmacknu, breakpoint hitne, ale zustanu viset v nabidce virtualnich desktopu, protoze explorer visi v breakpointu v debuggeru na pozadi :) po kazdym takovymdle omylu hard reset, pac z toho neni cesta ven