Win32::FsType() eq 'NTFS'
or skip_all("need NTFS");
+my (undef, $maj, $min) = Win32::GetOSVersion();
+
+my $vista_or_later = $maj >= 6;
+
my $tmpfile1 = tempfile();
# test some of the win32 specific stat code, since we
if (open my $fh, ">", "$tmpfile1.bat") {
ok(-x "$tmpfile1.bat", 'batch file is "executable"');
- ok(-x $fh, 'batch file handle is "executable"');
+ SKIP: {
+ skip "executable bit for handles needs vista or later", 1
+ unless $vista_or_later;
+ ok(-x $fh, 'batch file handle is "executable"');
+ }
close $fh;
unlink "$tmpfile1.bat";
}
return mktime(&pt);
}
+typedef DWORD (__stdcall *pGetFinalPathNameByHandleA_t)(HANDLE, LPSTR, DWORD, DWORD);
+
static int
win32_stat_low(HANDLE handle, const char *path, STRLEN len, Stat_t *sbuf) {
DWORD type = GetFileType(handle);
sbuf->st_mode = _S_IFREG;
if (!path) {
- len = GetFinalPathNameByHandleA(handle, path_buf, sizeof(path_buf), 0);
+ pGetFinalPathNameByHandleA_t pGetFinalPathNameByHandleA =
+ (pGetFinalPathNameByHandleA_t)GetProcAddress(GetModuleHandle("kernel32.dll"), "GetFinalPathNameByHandleA");
+ if (pGetFinalPathNameByHandleA) {
+ len = pGetFinalPathNameByHandleA(handle, path_buf, sizeof(path_buf), 0);
+ }
+ else {
+ len = 0;
+ }
+
/* < to ensure there's space for the \0 */
if (len && len < sizeof(path_buf)) {
path = path_buf;
} Data;
} MY_REPARSE_DATA_BUFFER, *PMY_REPARSE_DATA_BUFFER;
+#ifndef IO_REPARSE_TAG_SYMLINK
+# define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
+#endif
+
static BOOL
is_symlink(HANDLE h) {
MY_REPARSE_DATA_BUFFER linkdata;