//---------------------------------------------------------------------------- void PlanarReflections::LoadBiped () { #ifdef WM5_LITTLE_ENDIAN std::string path = Environment::GetPathR("SkinnedBipedPN.wmof"); #else std::string path = Environment::GetPathR("SkinnedBipedPN.be.wmof"); #endif InStream source; source.Load(path); mBiped = (Node*)source.GetObjectAt(0); // This guarantees that the reflection is drawn, even when the biped is // not visible to the camera. mBiped->Culling = Spatial::CULL_NEVER; }
void recv(InStream & stream, uint16_t len)override { this->len = len; unsigned int expected = 2 + 2 + ((this->len < 10) ? 0 : 2); /* colorPointerFlag(2) + colorPointerCacheSize(2) + pointerCacheSize*/ if (!stream.in_check_rem(expected)){ LOG(LOG_ERR, "Truncated CAPSTYPE_POINTER, need=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_MCS_PDU_TRUNCATED); } this->colorPointerFlag = stream.in_uint16_le(); this->colorPointerCacheSize = stream.in_uint16_le(); if (this->len < 10) return; this->pointerCacheSize = stream.in_uint16_le(); }
//---------------------------------------------------------------------------- void Portal::Load (InStream& source) { WM5_BEGIN_DEBUG_STREAM_LOAD(source); Object::Load(source); source.ReadRR(mNumVertices, mModelVertices); source.ReadAggregate(mModelPlane); source.ReadBool(Open); source.ReadPointer(AdjacentRegion); mWorldVertices = new1<APoint>(mNumVertices); WM5_END_DEBUG_STREAM_LOAD(Portal, source); }
//---------------------------------------------------------------------------- void Renderable::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); Movable::Load(source); source.ReadEnum(mType); source.ReadAggregate(mModelBound); source.ReadPointer(mVFormat); source.ReadPointer(mVBuffer); source.ReadPointer(mIBuffer); source.ReadPointer(mMaterial); PX2_END_DEBUG_STREAM_LOAD(Renderable, source); }
//---------------------------------------------------------------------------- void ScriptController::Load(InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); Controller::Load(source); PX2_VERSION_LOAD(source); source.Read(mNumFixUpdatePerSeconds); mOneFrameSeconds = 1.0f / (float)mNumFixUpdatePerSeconds; source.ReadString(mFilename); source.ReadString(mClassName); PX2_END_DEBUG_STREAM_LOAD(ScriptController, source); }
//---------------------------------------------------------------------------- void Visual::Load (InStream& source) { WM5_BEGIN_DEBUG_STREAM_LOAD(source); Spatial::Load(source); source.ReadEnum(mType); source.ReadAggregate(mModelBound); source.ReadPointer(mVFormat); source.ReadPointer(mVBuffer); source.ReadPointer(mIBuffer); source.ReadPointer(mEffect); WM5_END_DEBUG_STREAM_LOAD(Visual, source); }
//---------------------------------------------------------------------------- void RawTerrain::Link (InStream& source) { Node::Link(source); source.ResolveLink(mVFormat); source.ResolveLink(mCamera); source.ResolveLink(mShine); for (int row = 0; row < mNumRows; ++row) { for (int col = 0; col < mNumCols; ++col) { source.ResolveLink(mPages[row][col]); } } }
//---------------------------------------------------------------------------- void CurveMesh::Link (InStream& source) { Polysegment::Link(source); source.ResolveLink(mOrigVBuffer); source.ResolveLink(mOrigParams); source.ResolveLink(mNumSegments, mSegments); if (mCInfo) { for (int i = 0; i < mNumFullVertices; ++i) { source.ResolveLink(mCInfo[i].Segment); } } }
explicit ExtendedMouseEvent_Recv(InStream & stream) : pointerFlags(0) , xPos(0) , yPos(0) { const unsigned expected = 6; // pointerFlags(2) + xPos(2) + yPos(2) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "SlowPath::ExtendedMouseEvent: data truncated, expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_SLOWPATH); } this->pointerFlags = stream.in_uint16_le(); this->xPos = stream.in_uint16_le(); this->yPos = stream.in_uint16_le(); }
explicit UnicodeKeyboardEvent_Recv(InStream & stream) : keyboardFlags(0) , unicodeCode(0) { const unsigned expected = 6; // keyboardFlags(2) + unicodeCode(2) + pad2Octets(2) if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "SlowPath::UnicodeKeyboardEvent: data truncated, expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_SLOWPATH); } this->keyboardFlags = stream.in_uint16_le(); this->unicodeCode = stream.in_uint16_le(); stream.in_skip_bytes(2); // pad2Octets }
explicit InputEvent_Recv(InStream & stream) : eventTime([&stream](){ // time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2) if (!stream.in_check_rem(12)) { LOG(LOG_ERR, "SlowPath::InputEvent: data truncated, expected=12 remains=%zu", stream.in_remain()); throw Error(ERR_RDP_SLOWPATH); } return stream.in_uint32_le(); }()) , messageType(stream.in_uint16_le()) // device_flags(2) + param1(2) + param2(2) , payload(stream.get_current(), 6) // Body of constructor { stream.in_skip_bytes(this->payload.get_capacity()); }
//---------------------------------------------------------------------------- void SimpleSegment::Load (InStream& source) { WM5_BEGIN_DEBUG_STREAM_LOAD(source); CurveSegment::Load(source); source.Read(mAmplitude); source.Read(mFrequency); source.Read(mHeight); mAmplFreq = mAmplitude*mFrequency; mAmplFreqFreq = mAmplFreq*mFrequency; mAmplFreqFreqFreq = mAmplFreqFreq*mFrequency; WM5_END_DEBUG_STREAM_LOAD(SimpleSegment, source); }
RDPMultiDstBlt(int16_t nLeftRect, int16_t nTopRect, int16_t nWidth, int16_t nHeight, uint8_t bRop, uint8_t nDeltaEntries, InStream & deltaEncodedRectangles) : nLeftRect(nLeftRect) , nTopRect(nTopRect) , nWidth(nWidth) , nHeight(nHeight) , bRop(bRop) , nDeltaEntries(nDeltaEntries) { ::memset(this->deltaEncodedRectangles, 0, sizeof(this->deltaEncodedRectangles)); for (int i = 0; i < this->nDeltaEntries; i++) { this->deltaEncodedRectangles[i].leftDelta = deltaEncodedRectangles.in_sint16_le(); this->deltaEncodedRectangles[i].topDelta = deltaEncodedRectangles.in_sint16_le(); this->deltaEncodedRectangles[i].width = deltaEncodedRectangles.in_sint16_le(); this->deltaEncodedRectangles[i].height = deltaEncodedRectangles.in_sint16_le(); } }
//---------------------------------------------------------------------------- void InterpCurveSpeedController::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); InterpCurveFloat3Controller::Load(source); PX2_VERSION_LOAD(source); source.Read(mMaxLength); if (1 == GetReadedVersion()) { source.ReadAggregate(mInitPos); } PX2_END_DEBUG_STREAM_LOAD(InterpCurveSpeedController, source); }
void process_format_data_request( InStream& chunk, FieldIndex nb_paste_text, FieldIndex nb_paste_image, FieldIndex nb_paste_file) { this->last_formatID = chunk.in_uint32_le(); switch (this->last_formatID) { case RDPECLIP::CF_TEXT: case RDPECLIP::CF_OEMTEXT: case RDPECLIP::CF_UNICODETEXT: case RDPECLIP::CF_DSPTEXT: case RDPECLIP::CF_LOCALE: this->metrics->add_to_current_data(nb_paste_text, 1); break; case RDPECLIP::CF_METAFILEPICT: case RDPECLIP::CF_DSPMETAFILEPICT: this->metrics->add_to_current_data(nb_paste_image, 1); break; default: if (this->file_contents_format_ID == this->last_formatID){ this->metrics->add_to_current_data(nb_paste_file, 1); } break; } }
//---------------------------------------------------------------------------- void BlendTransformController::Link (InStream& source) { TransformController::Link(source); source.ResolveLink(mController0); source.ResolveLink(mController1); }
//---------------------------------------------------------------------------- void Node::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); Movable::Load(source); int numChildren; source.Read(numChildren); if (numChildren > 0) { mChild.resize(numChildren); source.ReadPointerVV(numChildren, &mChild[0]); } PX2_END_DEBUG_STREAM_LOAD(Node, source); }
inline void process_glyphcache(GlyphCache & gly_cache, InStream & stream) { const uint8_t cacheId = stream.in_uint8(); const uint8_t nglyphs = stream.in_uint8(); for (uint8_t i = 0; i < nglyphs; i++) { const uint16_t cacheIndex = stream.in_uint16_le(); const int16_t offset = stream.in_sint16_le(); const int16_t baseline = stream.in_sint16_le(); const uint16_t width = stream.in_uint16_le(); const uint16_t height = stream.in_uint16_le(); const unsigned int datasize = (height * nbbytes(width) + 3) & ~3; const uint8_t * data = stream.in_uint8p(datasize); server_add_char(gly_cache, cacheId, cacheIndex, offset, baseline, width, height, data); } }
//---------------------------------------------------------------------------- void Jungler::Link (InStream& source) { TriMesh::Link(source); source.ResolveLink(mMtlInst); source.ResolveLink(mTexture); }
//---------------------------------------------------------------------------- void UIAuiFrame::Link(InStream& source) { UIFrame::Link(source); if (mIPTCtrl) source.ResolveLink(mIPTCtrl); }
explicit ShareControl_Recv(InStream & stream) : totalLength([&stream]() { if (!stream.in_check_rem(2+2)){ LOG(LOG_ERR, "Truncated [4: ShareControl packet] , remains=%zu", stream.in_remain()); throw Error(ERR_SEC); } return stream.in_uint16_le(); }()) , pduType(stream.in_uint16_le() & 0xF) , PDUSource([&stream, this]() { if (this->pduType == PDUTYPE_DEACTIVATEALLPDU && this->totalLength == 4) { // should not happen // but DEACTIVATEALLPDU seems to be broken on windows 2000 return static_cast<uint16_t>(0); } return stream.in_uint16_le(); }()) , payload([&stream, this]() { if (this->pduType == PDUTYPE_DEACTIVATEALLPDU && this->totalLength == 4) { // should not happen // but DEACTIVATEALLPDU seems to be broken on windows 2000 return InStream(stream.get_current(), 0); } if (this->totalLength < 6) { LOG(LOG_ERR, "ShareControl packet too short totalLength=%u pduType=%u mcs_channel=%u", this->totalLength, this->pduType, this->PDUSource); throw Error(ERR_SEC); } if (!stream.in_check_rem(this->totalLength - 6)) { LOG(LOG_ERR, "Truncated ShareControl packet, need=%u remains=%zu", this->totalLength - 6, stream.in_remain()); throw Error(ERR_SEC); } return InStream(stream.get_current(), this->totalLength - 6); }()) // body of constructor { if (this->totalLength == 0x8000) { LOG(LOG_ERR, "Expected ShareControl header, got flowMarker"); throw Error(ERR_SEC); } stream.in_skip_bytes(this->payload.get_capacity()); }
~ShareData_Recv() noexcept(false) { if (!this->payload.check_end()) { LOG( LOG_INFO , "~ShareData_Recv: some payload data were not consumed len=%u compressedLen=%u remains=%zu" , this->len, this->compressedLen, payload.in_remain()); throw Error(ERR_SEC); } }
/// Reset everything to initial state /// void init () { if (m_stream) { m_stream->Close (); delete m_stream; m_stream = NULL; } m_userBuf.clear (); }
//---------------------------------------------------------------------------- void Movable::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); Controlledable::Load(source); source.ReadAggregate(LocalTransform); source.ReadAggregate(WorldTransform); source.ReadBool(WorldTransformIsCurrent); source.ReadAggregate(WorldBound); source.ReadBool(WorldBoundIsCurrent); source.ReadEnum(Culling); // mParent不被保存,它会在Node::Link中调用Node::SetChild被设置。 PX2_END_DEBUG_STREAM_LOAD(Movable, source); }
//---------------------------------------------------------------------------- void Object::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); // RTTI名称已经被读取了 // 读取ID,提供对象的链接信息 source.ReadUniqueID(this); // 资源路径 source.ReadString(mResourcePath); // 读取对象的名称 source.ReadString(mName); PX2_END_DEBUG_STREAM_LOAD(Object, source); }
void recv(InStream & stream) { if (!stream.in_check_rem(12)){ LOG(LOG_ERR, "CS_SECURITY short header"); throw Error(ERR_GCC); } this->userDataType = stream.in_uint16_le(); this->length = stream.in_uint16_le(); if (this->length != 12){ LOG(LOG_ERR, "CS_SECURITY bad header length=%d", this->length); throw Error(ERR_GCC); } this->encryptionMethods = stream.in_uint32_le(); this->extEncryptionMethods = stream.in_uint32_le(); }
//---------------------------------------------------------------------------- void CollapseRecordArray::Load (InStream& source) { WM5_BEGIN_DEBUG_STREAM_LOAD(source); Object::Load(source); source.Read(mNumRecords); mRecords = new1<CollapseRecord>(mNumRecords); for (int i = 0; i < mNumRecords; ++i) { source.Read(mRecords[i].VKeep); source.Read(mRecords[i].VThrow); source.Read(mRecords[i].NumVertices); source.Read(mRecords[i].NumTriangles); source.Read(mRecords[i].NumIndices); if (mRecords[i].NumIndices > 0) { mRecords[i].Indices = new1<int>(mRecords[i].NumIndices); source.ReadVR(mRecords[i].NumIndices, mRecords[i].Indices); } else { mRecords[i].Indices = 0; } } WM5_END_DEBUG_STREAM_LOAD(CollapseRecordArray, source); }
//---------------------------------------------------------------------------- void Scene::Load (InStream& source) { PX2_BEGIN_DEBUG_STREAM_LOAD(source); Netable::Load(source); source.Read<int>(mSceneID); source.ReadPointer(mSceneNode); int numActors; source.Read(numActors); if (numActors > 0) { mActors.resize(numActors); source.ReadPointerVV(numActors, &mActors[0]); } source.ReadPointer(mTerrainActor); source.ReadPointer(mDefaultLight); source.ReadPointer(mDefaultCameraActor); source.ReadPointer(mDefaultARActor); PX2_END_DEBUG_STREAM_LOAD(Scene, source); }
explicit ClientInputEventPDU_Recv(InStream & stream) : numEvents( [&stream](){ if (!stream.in_check_rem(2)) { LOG(LOG_ERR, "SlowPath::ClientInputEventPDU: data truncated (numEvents)"); throw Error(ERR_RDP_SLOWPATH); } auto numEvents = stream.in_uint16_le(); const unsigned expected = 2 // pad(2) + numEvents * 12 // (time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2)) * 12 ; if (!stream.in_check_rem(expected)) { LOG(LOG_ERR, "SlowPath::ClientInputEventPDU: data truncated, expected=%u remains=%zu", expected, stream.in_remain()); throw Error(ERR_RDP_SLOWPATH); } stream.in_skip_bytes(2); // pad return numEvents; }() ) // (time(4) + mes_type(2) + device_flags(2) + param1(2) + param2(2)) * 12 , payload(stream.get_current(), this->numEvents * 12) { // This is the constructor body, we skip payload now that it is packaged stream.in_skip_bytes(this->payload.get_capacity()); }
//---------------------------------------------------------------------------- void UIFText::Link(InStream& source) { UIFrame::Link(source); if (mText) { source.ResolveLink(mText); } }