libfreerdp-core: started implementing NdrClientCall2

This commit is contained in:
Marc-André Moreau 2012-04-28 22:27:04 -04:00
parent d615aa44da
commit 3e2b185989
3 changed files with 89 additions and 53 deletions

View File

@ -28,10 +28,41 @@
CLIENT_CALL_RETURN NdrClientCall2(PMIDL_STUB_DESC pStubDescriptor, PFORMAT_STRING pFormat, ...)
{
unsigned char oiFlags;
unsigned short procNum;
unsigned short stackSize;
unsigned char numberParams;
NDR_PROC_HEADER* procHeader;
CLIENT_CALL_RETURN client_call_return;
procNum = stackSize = numberParams = 0;
procHeader = (NDR_PROC_HEADER*) &pFormat[0];
client_call_return.Pointer = NULL;
oiFlags = procHeader->OiFlags;
procNum = procHeader->ProcNum;
stackSize = procHeader->StackSize;
pFormat += sizeof(NDR_PROC_HEADER);
if (pStubDescriptor->Version >= 0x20000)
{
NDR_PROC_OI2_HEADER* procHeaderOi2 = (NDR_PROC_OI2_HEADER*) pFormat;
oiFlags = procHeaderOi2->Oi2Flags;
numberParams = procHeaderOi2->NumberParams;
if (oiFlags & OI2_FLAG_HAS_EXTENSIONS)
{
NDR_PROC_HEADER_EXTS* extensions = (NDR_PROC_HEADER_EXTS*) pFormat;
pFormat += extensions->Size;
}
}
printf("ProcHeader: ProcNum:%d OiFlags: 0x%02X, handleType: 0x%02X StackSize: %d NumberParams: %d\n",
procNum, oiFlags, procHeader->HandleType, stackSize, numberParams);
return client_call_return;
}

View File

@ -222,6 +222,41 @@ typedef struct _MIDL_STUB_DESC
typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
#define OI2_FLAG_SERVER_MUST_SIZE 0x01
#define OI2_FLAG_CLIENT_MUST_SIZE 0x02
#define OI2_FLAG_HAS_RETURN 0x04
#define OI2_FLAG_HAS_PIPES 0x08
#define OI2_FLAG_HAS_ASYNC_UUID 0x20
#define OI2_FLAG_HAS_EXTENSIONS 0x40
#define OI2_FLAG_HAS_ASYNC_HANDLE 0x80
typedef struct
{
unsigned char Size;
unsigned char Flags2;
unsigned short ClientCorrHint;
unsigned short ServerCorrHint;
unsigned short NotifyIndex;
} NDR_PROC_HEADER_EXTS;
typedef struct _NDR_PROC_HEADER
{
unsigned char HandleType;
unsigned char OiFlags;
unsigned short RpcFlagsLow;
unsigned short RpcFlagsHi;
unsigned short ProcNum;
unsigned short StackSize;
} NDR_PROC_HEADER;
typedef struct _NDR_PROC_OI2_HEADER
{
unsigned short ClientBufferSize;
unsigned short ServerBufferSize;
unsigned int Oi2Flags;
unsigned char NumberParams;
} NDR_PROC_OI2_HEADER;
/* Type Format Strings: http://msdn.microsoft.com/en-us/library/windows/desktop/aa379093/ */
#define FC_BYTE 0x01
@ -242,6 +277,12 @@ typedef const MIDL_STUB_DESC *PMIDL_STUB_DESC;
#define FC_INT3264 0xB8
#define FC_UINT3264 0xB9
#define FC_BIND_CONTEXT 0x30
#define FC_BIND_GENERIC 0x31
#define FC_BIND_PRIMITIVE 0x32
#define FC_AUTO_HANDLE 0x33
#define FC_CALLBACK_HANDLE 0x34
#define NdrFcShort(s) (byte)(s & 0xFF), (byte)(s >> 8)
#define NdrFcLong(s) (byte)(s & 0xFF), (byte)((s & 0x0000FF00) >> 8), \

View File

@ -1607,59 +1607,6 @@ uint8 tsg_packet5[20] =
0x00, 0x00, 0x00, 0x00
};
#if 0
void Opnum0NotUsedOnWire(handle_t IDL_handle)
{
}
HRESULT TsProxyCreateTunnel(PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse,
PTUNNEL_CONTEXT_HANDLE_SERIALIZE* tunnelContext, unsigned long* tunnelId)
{
return 0;
}
HRESULT TsProxyAuthorizeTunnel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse)
{
return 0;
}
HRESULT TsProxyMakeTunnelCall(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
unsigned long procId, PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse)
{
return 0;
}
HRESULT TsProxyCreateChannel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
PTSENDPOINTINFO tsEndPointInfo, PCHANNEL_CONTEXT_HANDLE_SERIALIZE* channelContext, unsigned long* channelId)
{
return 0;
}
void Opnum5NotUsedOnWire(handle_t IDL_handle)
{
}
HRESULT TsProxyCloseChannel(PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* context)
{
return 0;
}
HRESULT TsProxyCloseTunnel(PTUNNEL_CONTEXT_HANDLE_SERIALIZE* context)
{
return 0;
}
DWORD TsProxySetupReceivePipe(handle_t IDL_handle, byte pRpcMessage[])
{
return 0;
}
#endif
DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, uint32* lengths)
{
STREAM* s;
@ -1770,6 +1717,15 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
* );
*/
{
TSG_PACKET tsgPacket;
PTSG_PACKET tsgPacketResponse;
PTUNNEL_CONTEXT_HANDLE_SERIALIZE tunnelContext;
unsigned long tunnelId;
TsProxyCreateTunnel(&tsgPacket, &tsgPacketResponse, &tunnelContext, &tunnelId);
}
DEBUG_TSG("TsProxyCreateTunnel");
status = rpc_tsg_write(rpc, tsg_packet1, sizeof(tsg_packet1), 1);
@ -1810,6 +1766,14 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
*
*/
{
TSG_PACKET tsgPacket;
PTSG_PACKET tsgPacketResponse;
PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext;
TsProxyAuthorizeTunnel(&tunnelContext, &tsgPacket, &tsgPacketResponse);
}
DEBUG_TSG("TsProxyAuthorizeTunnel");
status = rpc_tsg_write(rpc, tsg_packet2, sizeof(tsg_packet2), 2);