Appereantly the function does not work as advertised on Windows 7. Do call it, but ignore errors. Hopefully any real write errors, will be detected when reading back image instead.