1) creai il file con CreateFile
2) per scriverci usi WriteFile
3) alla fine usi CloseHandle per chiudere il file.

Per allorare testod a scrivere usi VirtualAlloc.