Bug fix: change non-fmRead file mode to set GENERIC_READ or GENERIC_WRITE

instead of GENERIC_ALL
which on 64bit windows rasied an [OSError] exception
This commit is contained in:
JamesP
2015-09-24 09:04:55 +10:00
parent bdc1c5ee84
commit 305766a9fa

View File

@@ -116,7 +116,8 @@ proc open*(filename: string, mode: FileMode = fmRead,
template callCreateFile(winApiProc, filename: expr): expr =
winApiProc(
filename,
if readonly: GENERIC_READ else: GENERIC_ALL,
# GENERIC_ALL != (GENERIC_READ or GENERIC_WRITE)
if readonly: GENERIC_READ else: GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ,
nil,
if newFileSize != -1: CREATE_ALWAYS else: OPEN_EXISTING,