You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: open_file_windows.go
    path of file: ./repos/wazero/internal/sysfs
    
    the code of the file until where you have to start completion: package sysfs

import (
	"io/fs"
	"os"
	"strings"
	"syscall"
	"unsafe"

	"github.com/tetratelabs/wazero/experimental/sys"
)

func openFile(path string, oflag sys.Oflag, perm fs.FileMode) (*os.File, sys.Errno) {
	isDir := oflag&sys.O_DIRECTORY > 0
	flag := toOsOpenFlag(oflag)

	// TODO: document why we are opening twice
	fd, err := open(path, flag|syscall.O_CLOEXEC, uint32(perm))
	if err == nil {
		return os.NewFile(uintptr(fd), path), 0
	}

	// TODO: Set FILE_SHARE_DELETE for directory as well.
	f, err := os.OpenFile(path, flag, perm)
	errno := sys.UnwrapOSError(err)
	if errno == 0 {
		return f, 0
	}

	switch errno {
	case sys.EINVAL:
    
func openFile(path string, oflag sys.Oflag, perm fs.FileMode) (*os.File, sys.Errno) {
	isDir := oflag&sys.O_DIRECTORY > 0
	flag := toOsOpenFlag(oflag)

	// TODO: document why we are opening twice
	fd, err := open(path, flag|syscall.O_CLOEXEC, uint32(perm))
	if err == nil {
		return os.NewFile(uintptr(fd), path), 0
	}

	// TODO: Set FILE_SHARE_DELETE for directory as well.
	f, err := os.OpenFile(path, flag, perm)
	errno := sys.UnwrapOSError(err)
	if errno == 0 {
		return f, 0
	}

	switch errno {
	case sys.EINVAL:
		// WASI expects ENOTDIR for a file path with a trailing slash.
		if strings.HasSuffix(path, "/") {
			errno = sys.ENOTDIR
		}
	// To match expectations of WASI, e.g. TinyGo TestStatBadDir, return
	// ENOENT, not ENOTDIR.
	case sys.ENOTDIR:
		errno = sys.ENOENT
	case sys.ENOENT:
		if isSymlink(path) {
			// Either symlink or hard link not found. We change the returned
			// errno depending on if it is symlink or not to have consistent
			// behavior across OSes.
			if isDir {
				// Dangling symlink dir must raise ENOTDIR.
				errno = sys.ENOTDIR
			} else {
				errno = sys.ELOOP
			}
		}
	}
	return f, errno
}