Ejemplo n.º 1
0
void NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
{
	if (*pFormat != FC_RP)
	{
		NdrpAlignLength((&pStubMsg->BufferLength), 4);
		NdrpIncrementLength((&pStubMsg->BufferLength), 4);
	}

	NdrpPointerBufferSize(pMemory, pFormat, pStubMsg);
}
Ejemplo n.º 2
0
void NdrSimpleTypeBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
{
	switch (*pFormat)
	{
		case FC_BYTE:
		case FC_CHAR:
		case FC_SMALL:
		case FC_USMALL:
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(BYTE));
			break;

		case FC_WCHAR:
		case FC_SHORT:
		case FC_USHORT:
		case FC_ENUM16:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(USHORT));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(USHORT));
			break;

		case FC_LONG:
		case FC_ULONG:
		case FC_ENUM32:
		case FC_INT3264:
		case FC_UINT3264:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(ULONG));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(ULONG));
			break;

		case FC_FLOAT:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(FLOAT));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(FLOAT));
			break;

		case FC_DOUBLE:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(DOUBLE));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(DOUBLE));
			break;

		case FC_HYPER:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(ULONGLONG));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(ULONGLONG));
			break;

		case FC_ERROR_STATUS_T:
			NdrpAlignLength(&(pStubMsg->BufferLength), sizeof(error_status_t));
			NdrpIncrementLength(&(pStubMsg->BufferLength), sizeof(error_status_t));
			break;

		case FC_IGNORE:
			break;
	}
}
Ejemplo n.º 3
0
void NdrContextHandleBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
{
	unsigned char type = *pFormat;

	if (type == FC_BIND_PRIMITIVE)
	{
		/**
		 * FC_BIND_PRIMITIVE
		 * flag<1>
		 * offset<2>
		 */

		printf("warning: NdrContextHandleBufferSize FC_BIND_PRIMITIVE unimplemented\n");
	}
	else if (type == FC_BIND_GENERIC)
	{
		/**
		 * FC_BIND_GENERIC
		 * flag_and_size<1>
		 * offset<2>
		 * binding_routine_pair_index<1>
		 * FC_PAD
		 */

		printf("warning: NdrContextHandleBufferSize FC_BIND_GENERIC unimplemented\n");
	}
	else if (type == FC_BIND_CONTEXT)
	{
		/**
		 * FC_BIND_CONTEXT
		 * flags<1>
		 * offset<2>
		 * context_rundown_routine_index<1>
		 * param_num<1>
		 */

		NdrpAlignLength(&(pStubMsg->BufferLength), 4);
		NdrpIncrementLength(&(pStubMsg->BufferLength), 20);
	}
}
Ejemplo n.º 4
0
void NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMemory, PFORMAT_STRING pFormat)
{
	/**
	 * FC_STRUCT
	 * alignment<1>
	 * memory_size<2>
	 * member_layout<>
	 * FC_END
	 */

	/**
	 * FC_PSTRUCT
	 * alignment<1>
	 * memory_size<2>
	 * pointer_layout<>
	 * member_layout<>
	 * FC_END
	 */

	unsigned char type;
	unsigned char alignment;
	unsigned short memory_size;

	type = pFormat[0];
	alignment = pFormat[1] + 1;
	memory_size = *(unsigned short*) &pFormat[2];

	NdrpAlignLength(&(pStubMsg->BufferLength), alignment);
	NdrpIncrementLength(&(pStubMsg->BufferLength), memory_size);

	pFormat += 4;

	if (*pFormat == FC_PSTRUCT)
		NdrpEmbeddedPointerBufferSize(pStubMsg, pMemory, pFormat);

	printf("warning: NdrSimpleStructBufferSize unimplemented\n");
}