Fixed pure WINAPI bug and a few other things...

Signed-off-by: Swizzy <swizzy@hotmail.co.uk>