Problem accessing the pixels of a texture
I'm currently writing a bitmap font renderer and for that I need to access the individual pixels of a texture that contains all the characters that make up the font so I can calculate the kerning values. I've got this working, but I'm having some issues with accessing the pixels.
My texture is a 170x170 pixel DDS file (the issue is reproducable with a TGA as well) which I have loaded into memory. I create it like this:
D3DXCreateTextureFromFileInMemoryEx(lpDevice, pResource->pData, pResource->ulSize, D3DX_DEFAULT, D3DX_DEFAULT, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0xFFFF00FF, &d3dImageInfo, NULL, &pTexture);
If I load my texture as described above, then lock it and loop over its width and height and set every pixel to, let's say 0xFFFF0000, it actually only does that for a rectangle that is roughly 100x100 pixels in size. If I change my texture creation code to this however:
D3DXCreateTextureFromFileInMemoryEx(lpDevice, pResource->pData,
pResource->ulSize, 170, 170, 1, 0, D3DFMT_UNKNOWN,
D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0xFFFF00FF,
&d3dImageInfo, NULL, &pTexture);
meaning if I specify the width and height of the texture, it actually fills the entire texture and my kerning measurement code works nicely.
I'm completely out of ideas and any help is much appreciated. I can't specify the width and height manually, because I want to keep my code as generic as possible.
Thanks a lot in advance.

