Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » What does SSE2 usage enhance?
Re: What does SSE2 usage enhance? [message #39702 is a reply to message #39700] Thu, 18 April 2013 11:43 Go to previous messageGo to previous message
crydev is currently offline  crydev
Messages: 151
Registered: October 2012
Location: Netherlands
Experienced Member
Here is a small code snippet. If you see anything that is strange or wrong I would appreciate feedback. Smile

The memcpy line is the line where I copy, in this case, 4 bytes from the address of i in array buffer to float variable tempStore.

template<>
void MemoryScanner::ScanWorker(const MemoryRegion& region, const float& value)
{
	Byte *buffer = (Byte*)MemoryAlloc(region.MemorySize);
	if (!ReadProcessMemory(this->mOpenedProcessHandle, (void*)region.BaseAddress, buffer
		, region.MemorySize, NULL))
	{
		MemoryFree(buffer);
		return;
	}
	
	Vector<MemoryBlockBase*> localResults;
	
	for (int i = 0; i < region.MemorySize; i++)
	{
		float tempStore;
		memcpy(&tempStore, &(buffer[i]), sizeof(float));
		
		if (TemplateCompare(tempStore, value)) // WRITES TO FREED BLOCKS DETECTED
		{
			MemoryBlock<float>* mb = new MemoryBlock<float>();
			mb->Address = static_cast<unsigned int>(region.BaseAddress + i);
			mb->Size = sizeof(float);
			mb->Buffer = tempStore;
			localResults.Add(mb);
		}
	}

	MemoryFree(buffer);

	AtomicInc(this->ThreadFinishCount);

	if (localResults.GetCount() > 0)
	{
		this->AddThreadSpecificSearchResults(localResults);
	}

	this->UpdateScanningProgress(this->ThreadFinishCount);
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: What does !! in e.g. FtpClient class mean?
Next Topic: Stripping U++
Goto Forum:
  


Current Time: Tue May 14 05:19:08 CEST 2024

Total time taken to generate the page: 0.03141 seconds