Is lps==NULL an argument that BeginPaint() and EndPaint() should cope with or is it a result for errors hidden deeper?
MSDN doesn't indicate any behaviour for when this is null. It just says the functions should fill out the struct that it points to. So passing NULL here is an error, that we have to protect ourselves against (clearly MS does)