summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-12-16 14:24:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-12-16 14:24:12 (GMT)
commit3a35a2dd87fd96c2bd8bce4bf76f9c4d8c4b42a9 (patch)
treebf4516da509e7d7522bdc2ce5f8de33dcdfab12d /win
parente2c416d5de0aa6541686b6bbc4da418a49622cc1 (diff)
parent8cf5190b6a9f8233ad8a1ab8af4a592f79d19407 (diff)
downloadtcl-3a35a2dd87fd96c2bd8bce4bf76f9c4d8c4b42a9.zip
tcl-3a35a2dd87fd96c2bd8bce4bf76f9c4d8c4b42a9.tar.gz
tcl-3a35a2dd87fd96c2bd8bce4bf76f9c4d8c4b42a9.tar.bz2
Merge 8.6
Diffstat (limited to 'win')
-rw-r--r--win/tclWinFile.c18
-rw-r--r--win/tclWinInit.c3
-rw-r--r--win/tclWinInt.h1
3 files changed, 18 insertions, 4 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index f51d6f5..38edd87 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -264,11 +264,21 @@ WinLink(
TclWinConvertError(GetLastError());
} else if (linkAction & TCL_CREATE_SYMBOLIC_LINK) {
- /*
- * Can't symlink files.
- */
+ if (!tclWinProcs.createSymbolicLink) {
+ /*
+ * Can't symlink files.
+ */
+ Tcl_SetErrno(ENOTDIR);
+ } else if (tclWinProcs.createSymbolicLink(linkSourcePath, linkTargetPath,
+ 0x2 /* SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE */)) {
+ /*
+ * Success!
+ */
- Tcl_SetErrno(ENOTDIR);
+ return 0;
+ }
+
+ TclWinConvertError(GetLastError());
} else {
Tcl_SetErrno(ENODEV);
}
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index 29393ce..a7fb8d0 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -158,6 +158,9 @@ TclpInitPlatform(void)
tclWinProcs.cancelSynchronousIo =
(BOOL (WINAPI *)(HANDLE))(void *)GetProcAddress(handle,
"CancelSynchronousIo");
+ tclWinProcs.createSymbolicLink =
+ (BOOLEAN (WINAPI *)(LPCWSTR, LPCWSTR, DWORD))(void *)GetProcAddress(handle,
+ "CreateSymbolicLinkW");
}
/*
diff --git a/win/tclWinInt.h b/win/tclWinInt.h
index 3b31d8a..90a6cea 100644
--- a/win/tclWinInt.h
+++ b/win/tclWinInt.h
@@ -36,6 +36,7 @@ typedef struct TCLEXCEPTION_REGISTRATION {
*/
typedef struct TclWinProcs {
BOOL (WINAPI *cancelSynchronousIo)(HANDLE);
+ BOOLEAN (WINAPI *createSymbolicLink)(LPCWSTR, LPCWSTR, DWORD);
} TclWinProcs;
MODULE_SCOPE TclWinProcs tclWinProcs;