New function to close then zero a handle.
If we pass a second handle pointer, it will be set to the value of the
handle that was closed, or INVALID_HANDLE_VALUE. We can inspect the
remembered handle to see if we need to wait, eg for a thread.
/* Get path, share mode, creation disposition and flags for a stream. */
int get_createfile_parameters(HKEY key, TCHAR *prefix, TCHAR *path, unsigned long *sharing, unsigned long default_sharing, unsigned long *disposition, unsigned long default_disposition, unsigned long *flags, unsigned long default_flags, bool *copy_and_truncate) {