Are you using 16-bit? If so, most cards use the 565 format, that is 5 bits for red and blue and 6 bits for green. Other cards use a 555 format.
After you've created your surface you can call the function GetPixelFormat, then check the bitmask values it contains like so like so:
LPDIRECTDRAWSURFACE lpdds; //already created
r_mask = ddpf.RBitMask;
g_mask = ddpf.GBitMask
b_mask = ddpf.BBitMask
You don't need to check all of them of course, only the green mask. After that, well, you can create macros for adjusting color values and whatnot. I haven't messed with it much. You can find an article about it at http://dxpm.cjb.net in the archives under DirectX. You have to create an ID and password, but it's free.