Excuse the simplicity of my question, I'm not used to working with Windows types.
I have an LPBYTE buffer and i wish to XOR each byte of it with another byte.
What is the proper way of getting the length of the buffer and iterating through it in C++? I'm trying to do something akin to:
LPBYTE buf = *something*;
char key = 'X';
for(int i=0;i<len(buf);i++)
buf[i] = buf[i] ^ key;
Many Thanks!
Depends from the type of resource, but most probably no. Anyhow, since you are working with resources, you can get the resource size using the
SizeofResourcefunction.Still, I'm not sure if you can write on stuff returned by
LockResource(it actually returns a pointer to the region containing the resource, that is probably just a region in the memory-mapped executable). Most probably you'll want to copy it elsewhere before XORing it.