Code is written in a slightly different style, but basically, here are my update and resize functions. Some of the types have been typedefed to a different style, but it should be readable enough.
Oh and unless is just a #define for if(!(statement))
Oh, and the bitmapInfo stuff, in case you wanted it. I added the biSizeImage thing base on some stack overflow stuff, but it didn't work before I added it either, so...
If you want to see the whole thing, I made a gist here: https://gist.github.com/RomanADavis/e6b4c5d2f1d15ffa4249537fc380ab82
bitmapInfo.bmiHeader.biSize = 0; // For compression: unused here.
This line writes bad value to biSize. You're overwriting previous value of biSize that is valid. So now bitmapInfo structure is corrupted and won't work.