void QueryD3DRegistryInfo::Resize()

in library/src/D3DHelpers.cpp [27:41]


void QueryD3DRegistryInfo::Resize(size_t trailingBuffer)
{
	// Allocate memory for the new struct + buffer
	this->PrivateDataSize = sizeof(D3DDDI_QUERYREGISTRY_INFO) + trailingBuffer;
	auto newData = std::make_unique<uint8_t[]>(this->PrivateDataSize);
	
	// If we have existing struct values then copy them over to the new struct
	if (this->PrivateData) {
		memcpy(newData.get(), this->PrivateData.get(), sizeof(D3DDDI_QUERYREGISTRY_INFO));
	}
	
	// Release the existing data (if any) and update our struct pointer
	this->PrivateData = std::move(newData);
	this->RegistryInfo = reinterpret_cast<D3DDDI_QUERYREGISTRY_INFO*>(this->PrivateData.get());
}