X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=win32%2Fwin32.c;h=9d819b518ff4b13eeba160049520c7eaa03930e9;hb=3730b96e60864694cf0c222f80e6ed2b3c27335b;hp=83ba873334ea5731d1205fe7653ebf63db4d51e2;hpb=ad0751ec707865dddd3f2c245757f2ef3ccf0dd8;p=p5sagit%2Fp5-mst-13.2.git diff --git a/win32/win32.c b/win32/win32.c index 83ba873..9d819b5 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -36,7 +36,7 @@ #include #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__MINGW32__) #include #else #include @@ -476,7 +476,10 @@ opendir(char *filename) /* check to see if filename is a directory */ if (win32_stat(filename, &sbuf) < 0 || (sbuf.st_mode & S_IFDIR) == 0) { - return NULL; + /* CRT is buggy on sharenames, so make sure it really isn't */ + DWORD r = GetFileAttributes(filename); + if (r == 0xffffffff || !(r & FILE_ATTRIBUTE_DIRECTORY)) + return NULL; } /* get the file system characteristics */ @@ -831,7 +834,7 @@ filetime_from_time(PFILETIME pFileTime, time_t Time) } DllExport int -win32_utime(const char *filename, const struct utimbuf *times) +win32_utime(const char *filename, struct utimbuf *times) { HANDLE handle; FILETIME ftCreate; @@ -1190,7 +1193,7 @@ win32_strerror(int e) } DllExport void -win32_str_os_error(SV *sv, unsigned long dwErr) +win32_str_os_error(void *sv, DWORD dwErr) { DWORD dwLen; char *sMsg; @@ -1211,7 +1214,7 @@ win32_str_os_error(SV *sv, unsigned long dwErr) "Unknown error #0x%lX (lookup 0x%lX)", dwErr, GetLastError()); } - sv_setpvn(sv, sMsg, dwLen); + sv_setpvn((SV*)sv, sMsg, dwLen); LocalFree(sMsg); }