Skip to content

Commit c07b724

Browse files
seritoolsmbilker
authored andcommitted
Stub GetFinalPathNameByHandleW and CreateSymbolicLinkW
`GetFinalPathNameByHandleW` is used in `std::fs::canonicalize`, `CreateSymbolicLinkW` is used in `std::fs::soft_link`.
1 parent d7d75ed commit c07b724

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

library/std/src/sys/windows/c.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,29 @@ compat_fn_with_fallback! {
470470
SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD);
471471
FALSE
472472
}
473+
474+
// >= Vista / Server 2008
475+
// https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getfinalpathnamebyhandlew
476+
pub fn GetFinalPathNameByHandleW(
477+
hFile: HANDLE,
478+
lpszFilePath: LPCWSTR,
479+
cchFilePath: DWORD,
480+
dwFlags: DWORD
481+
) -> DWORD {
482+
SetLastError (ERROR_CALL_NOT_IMPLEMENTED as DWORD);
483+
0
484+
}
485+
486+
// >= Vista / Server 2008
487+
// https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createsymboliclinkw
488+
pub fn CreateSymbolicLinkW(
489+
lpSymlinkFileName: LPCWSTR,
490+
lpTargetFileName: LPCWSTR,
491+
dwFlags: DWORD
492+
) -> BOOLEAN {
493+
SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD);
494+
0
495+
}
473496
}
474497

475498
compat_fn_optional! {

library/std/src/sys/windows/c/windows_sys.lst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,6 @@ Windows.Win32.Storage.FileSystem.CREATE_NEW
22132213
Windows.Win32.Storage.FileSystem.CreateDirectoryW
22142214
Windows.Win32.Storage.FileSystem.CreateFileW
22152215
Windows.Win32.Storage.FileSystem.CreateHardLinkW
2216-
Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW
22172216
Windows.Win32.Storage.FileSystem.DELETE
22182217
Windows.Win32.Storage.FileSystem.DeleteFileW
22192218
Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS
@@ -2337,7 +2336,6 @@ Windows.Win32.Storage.FileSystem.GetFileInformationByHandle
23372336
Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx
23382337
Windows.Win32.Storage.FileSystem.GetFileType
23392338
Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS
2340-
Windows.Win32.Storage.FileSystem.GetFinalPathNameByHandleW
23412339
Windows.Win32.Storage.FileSystem.GetFullPathNameW
23422340
Windows.Win32.Storage.FileSystem.GetTempPathW
23432341
Windows.Win32.Storage.FileSystem.INVALID_FILE_ATTRIBUTES

library/std/src/sys/windows/c/windows_sys.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,6 @@ extern "system" {
124124
) -> BOOL;
125125
}
126126
#[link(name = "kernel32")]
127-
extern "system" {
128-
pub fn CreateSymbolicLinkW(
129-
lpsymlinkfilename: PCWSTR,
130-
lptargetfilename: PCWSTR,
131-
dwflags: SYMBOLIC_LINK_FLAGS,
132-
) -> BOOLEAN;
133-
}
134-
#[link(name = "kernel32")]
135127
extern "system" {
136128
pub fn CreateThread(
137129
lpthreadattributes: *const SECURITY_ATTRIBUTES,
@@ -271,15 +263,6 @@ extern "system" {
271263
pub fn GetFileType(hfile: HANDLE) -> FILE_TYPE;
272264
}
273265
#[link(name = "kernel32")]
274-
extern "system" {
275-
pub fn GetFinalPathNameByHandleW(
276-
hfile: HANDLE,
277-
lpszfilepath: PWSTR,
278-
cchfilepath: u32,
279-
dwflags: GETFINALPATHNAMEBYHANDLE_FLAGS,
280-
) -> u32;
281-
}
282-
#[link(name = "kernel32")]
283266
extern "system" {
284267
pub fn GetFullPathNameW(
285268
lpfilename: PCWSTR,

0 commit comments

Comments
 (0)