Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void __thiscall fb::StreamingPartitionReader::process(fb::StreamingPartitionReader *this, void *data, unsigned int inByteCount)
- {
- fb::StreamingPartitionReader *StreamingPartitionReader; // ebx@1
- char *position; // esi@5
- fb::StreamingPartitionReader::ReaderState curentState; // ecx@7
- signed int bytesToEOF; // eax@7
- unsigned int Magic; // ecx@11
- void *v8; // eax@21
- unsigned int v9; // ST20_4@21
- unsigned int MetaSize; // eax@22
- unsigned int PayLoadSize; // ecx@22
- fb::InternalDatabasePartition *Partition; // eax@22
- bool isMetaDataLeft; // cf@25
- int metaDataLeft; // esi@25
- unsigned int *pMetaDataLeft; // eax@25
- size_t realMetaDataLeft; // edi@27
- char *v17; // eax@28
- bool v18; // zf@29
- char *v19; // eax@30
- char *startOfMetaData; // ecx@32
- int v21; // edx@32
- fb::StreamingPartitionImportEntry *importEntries; // eax@32
- int endOfImports; // eax@32
- unsigned int sizeOfFieldDescriptors; // edx@32
- int endOfTypeStringTable; // eax@32
- int endOfFieldDescriptors; // eax@32
- int sizeOfTypeDescriptors; // edx@32
- int endOfTypeDescriptors; // eax@32
- unsigned int sizeofInstances; // edx@32
- int endOfInstances; // eax@32
- unsigned int endOfArrayList; // edx@32
- int payLoadLeft; // edi@39
- unsigned int *pPayLoadLeft; // eax@39
- size_t realPayLoadLeft; // esi@41
- char *payLoadPos; // eax@42
- int v36; // edi@43
- char *pPayload; // eax@47
- unsigned int stringTableSize; // ecx@47
- fb::Log::Stream f_; // [sp+Ch] [bp-148h]@16
- char *const cursorEnd; // [sp+13Ch] [bp-18h]@4
- unsigned int byteCount; // [sp+140h] [bp-14h]@7
- char *cursor; // [sp+144h] [bp-10h]@4
- int v43; // [sp+150h] [bp-4h]@16
- char complete_3; // [sp+15Fh] [bp+Bh]@4
- StreamingPartitionReader = this;
- if ( (unsigned __int8)data & 0xF )
- {
- fb::Log::formattedLog(&stru_39E10FC, "%s", &secret);
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- cursor = (char *)data;
- cursorEnd = (char *)data + inByteCount;
- complete_3 = 0;
- while ( 1 )
- {
- position = cursor;
- if ( cursor == cursorEnd )
- {
- if ( inByteCount )
- break;
- }
- curentState = StreamingPartitionReader->m_currentState;
- bytesToEOF = cursorEnd - cursor;
- byteCount = cursorEnd - cursor;
- switch ( curentState )
- {
- case 0:
- if ( (unsigned int)bytesToEOF <= 0x50 )
- {
- fb::Log::formattedLog(&stru_39E10E8, "%s", &secret);
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- qmemcpy(&StreamingPartitionReader->m_header, position, sizeof(StreamingPartitionReader->m_header));
- Magic = StreamingPartitionReader->m_header.magic;
- if ( Magic == 0xFB2D1CE )
- {
- StreamingPartitionReader->m_endianSwapRequired = 0;
- }
- else if ( Magic == _byteswap_ulong(0xFB2D1CEu) )
- {
- StreamingPartitionReader->m_endianSwapRequired = 1;
- fb::endianSwapInplace(&StreamingPartitionReader->m_header);
- }
- else
- {
- if ( fb::Log::c_logFilter & 0x20 )
- {
- fb::Log::Stream::Stream(&f_, &stru_39E10D4, s_logContext);
- v43 = 0;
- fb::operator<<((fb::OutAsciiStream *)&f_.vfptr, "Bad EBX partition header magic");
- fb::Log::Stream::process(&f_);
- v43 = -1;
- fb::Log::Stream::~Stream(&f_);
- }
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- if ( StreamingPartitionReader->m_header.metaSize + StreamingPartitionReader->m_header.payloadSize == byteCount )
- {
- complete_3 = 1;
- }
- else
- {
- v8 = operator new[](StreamingPartitionReader->m_header.metaSize);
- v9 = StreamingPartitionReader->m_header.payloadSize;
- StreamingPartitionReader->m_metadataBuffer = (char *)v8;
- StreamingPartitionReader->m_metadataInputCursor = 0;
- StreamingPartitionReader->m_payloadBuffer = (char *)operator new[](v9);
- StreamingPartitionReader->m_payloadInputCursor = 0;
- }
- MetaSize = StreamingPartitionReader->m_header.metaSize;
- PayLoadSize = StreamingPartitionReader->m_header.payloadSize;
- cursor += 0x50;
- StreamingPartitionReader->m_metadataOutstanding = MetaSize - 0x50;
- Partition = StreamingPartitionReader->m_partition;
- StreamingPartitionReader->m_payloadOutstanding = PayLoadSize;
- if ( Partition )
- fb::InternalDatabaseDomain::setPartitionGuid(
- Partition->m_domain,
- Partition,
- &StreamingPartitionReader->m_header.partitionGuid);
- StreamingPartitionReader->m_currentState = 1;
- continue;
- case 1:
- isMetaDataLeft = StreamingPartitionReader->m_metadataOutstanding < bytesToEOF;
- metaDataLeft = (int)&StreamingPartitionReader->m_metadataOutstanding;
- pMetaDataLeft = &StreamingPartitionReader->m_metadataOutstanding;
- if ( !isMetaDataLeft )
- pMetaDataLeft = &byteCount;
- realMetaDataLeft = *pMetaDataLeft;
- if ( complete_3 )
- {
- v17 = cursor;
- cursor += realMetaDataLeft;
- StreamingPartitionReader->m_currentState = 2;
- StreamingPartitionReader->m_metadata = v17;
- }
- else
- {
- memcpy(
- &StreamingPartitionReader->m_metadataBuffer[StreamingPartitionReader->m_metadataInputCursor],
- cursor,
- realMetaDataLeft);
- StreamingPartitionReader->m_metadataInputCursor += realMetaDataLeft;
- v18 = *(_DWORD *)metaDataLeft == realMetaDataLeft;
- *(_DWORD *)metaDataLeft -= realMetaDataLeft;
- if ( v18 )
- {
- v19 = StreamingPartitionReader->m_metadataBuffer;
- StreamingPartitionReader->m_currentState = 2;
- StreamingPartitionReader->m_metadata = v19;
- }
- cursor += realMetaDataLeft;
- }
- continue;
- case 2:
- startOfMetaData = StreamingPartitionReader->m_metadata;
- v21 = StreamingPartitionReader->m_header.importCount;
- importEntries = (fb::StreamingPartitionImportEntry *)StreamingPartitionReader->m_metadata;
- StreamingPartitionReader->m_importEntries = importEntries;
- endOfImports = (int)&importEntries[v21];
- sizeOfFieldDescriptors = (16 * StreamingPartitionReader->m_header.fieldDescriptorCount + 15) & 0xFFFFFFF0;
- StreamingPartitionReader->m_metaStringBlock = (const char *)endOfImports;
- endOfTypeStringTable = StreamingPartitionReader->m_header.typeStringTableSize + endOfImports;
- StreamingPartitionReader->m_fieldDescriptors = (fb::StreamingPartitionFieldDescriptor *)endOfTypeStringTable;
- endOfFieldDescriptors = sizeOfFieldDescriptors + endOfTypeStringTable;
- sizeOfTypeDescriptors = 16 * StreamingPartitionReader->m_header.typeDescriptorCount;
- StreamingPartitionReader->m_typeDescriptors = (fb::StreamingPartitionTypeDescriptor *)endOfFieldDescriptors;
- endOfTypeDescriptors = sizeOfTypeDescriptors + endOfFieldDescriptors;
- sizeofInstances = (12 * StreamingPartitionReader->m_header.typeCount + 15) & 0xFFFFFFF0;
- StreamingPartitionReader->m_instanceEntries = (fb::StreamingPartitionInstanceEntry *)endOfTypeDescriptors;
- endOfInstances = sizeofInstances + endOfTypeDescriptors;
- endOfArrayList = endOfInstances + ((12 * StreamingPartitionReader->m_header.arrayCount + 15) & 0xFFFFFFF0);
- StreamingPartitionReader->m_arrayEntries = (fb::StreamingPartitionArrayEntry *)endOfInstances;
- if ( (char *)endOfArrayList != &startOfMetaData[StreamingPartitionReader->m_header.metaSize - 80] )
- {
- fb::Log::formattedLog(&stru_39E10C0, "%s", &secret);
- if ( fb::Log::shouldBreak() )
- __debugbreak();
- }
- if ( StreamingPartitionReader->m_endianSwapRequired )
- {
- fb::endianSwapInplace(
- StreamingPartitionReader->m_importEntries,
- StreamingPartitionReader->m_header.importCount);
- fb::endianSwapInplace(
- StreamingPartitionReader->m_fieldDescriptors,
- StreamingPartitionReader->m_header.fieldDescriptorCount);
- fb::endianSwapInplace(
- StreamingPartitionReader->m_typeDescriptors,
- StreamingPartitionReader->m_header.typeDescriptorCount);
- fb::endianSwapInplace(
- StreamingPartitionReader->m_instanceEntries,
- StreamingPartitionReader->m_header.typeCount);
- fb::endianSwapInplace(StreamingPartitionReader->m_arrayEntries, StreamingPartitionReader->m_header.arrayCount);
- }
- fb::StreamingPartitionReader::resolveImports(StreamingPartitionReader);
- StreamingPartitionReader->m_currentState = 5;
- continue;
- case 5:
- fb::StreamingPartitionReader::handleLayout(StreamingPartitionReader);
- StreamingPartitionReader->m_currentState = 3;
- continue;
- case 3:
- isMetaDataLeft = StreamingPartitionReader->m_payloadOutstanding < bytesToEOF;
- payLoadLeft = (int)&StreamingPartitionReader->m_payloadOutstanding;
- pPayLoadLeft = &StreamingPartitionReader->m_payloadOutstanding;
- if ( !isMetaDataLeft )
- pPayLoadLeft = &byteCount;
- realPayLoadLeft = *pPayLoadLeft;
- if ( complete_3 )
- {
- payLoadPos = cursor;
- }
- else
- {
- memcpy(
- &StreamingPartitionReader->m_payloadBuffer[StreamingPartitionReader->m_payloadInputCursor],
- cursor,
- realPayLoadLeft);
- *(_DWORD *)payLoadLeft -= realPayLoadLeft;
- v36 = *(_DWORD *)payLoadLeft;
- StreamingPartitionReader->m_payloadInputCursor += realPayLoadLeft;
- if ( v36 )
- goto LABEL_46;
- payLoadPos = StreamingPartitionReader->m_payloadBuffer;
- }
- StreamingPartitionReader->m_payload = payLoadPos;
- StreamingPartitionReader->m_currentState = 4;
- LABEL_46:
- cursor += realPayLoadLeft;
- break;
- case 4:
- pPayload = StreamingPartitionReader->m_payload;
- stringTableSize = StreamingPartitionReader->m_header.stringTableSize;
- StreamingPartitionReader->m_sourceStringBlock = pPayload;
- StreamingPartitionReader->m_sourceInstanceBlock = &pPayload[stringTableSize];
- StreamingPartitionReader->m_currentState = 6;
- return;
- case 6:
- fb::StreamingPartitionReader::handleFixup(StreamingPartitionReader);
- StreamingPartitionReader->m_currentState = 7;
- return;
- case 7:
- return;
- default:
- continue;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement