diff --git a/ChangeLog b/ChangeLog
index 514fb630cd..f78bc8dee1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Mar 26 13:51:23 2012  Nobuyoshi Nakada  <nobu@ruby-lang.org>
+
+	* win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++
+	  not to use S_ISDIR().  [Feature #2408][ruby-core:26925]
+
+	* ruby.c (load_file_internal): ditto.
+
 Mon Mar 26 11:46:01 2012  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 
 	* ruby.c (load_file_internal): bail out if the script is a directory.
diff --git a/ruby.c b/ruby.c
index 22fb5ffe5d..d6f0432f3a 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1524,19 +1524,20 @@ load_file_internal(VALUE arg)
 	}
 #endif
 	if ((fd = rb_cloexec_open(fname, mode, 0)) < 0) {
-	  load_failed:
 	    rb_load_fail(fname_v, strerror(errno));
 	}
         rb_update_max_fd(fd);
+#if !defined DOSISH && !defined __CYGWIN__
 	{
 	    struct stat st;
-	    if (fstat(fd, &st) != 0) goto load_failed;
+	    if (fstat(fd, &st) != 0)
+		rb_load_fail(fname_v, strerror(errno));
 	    if (S_ISDIR(st.st_mode)) {
 		errno = EISDIR;
-		goto load_failed;
+		rb_load_fail(fname_v, strerror(EISDIR));
 	    }
 	}
-
+#endif
 	f = rb_io_fdopen(fd, mode, fname);
     }
 
diff --git a/win32/win32.c b/win32/win32.c
index 2657d7403d..c26d3e3cc7 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5188,9 +5188,18 @@ rb_w32_uopen(const char *file, int oflag, ...)
 static int
 check_if_dir(const char *file)
 {
-    struct stati64 st;
-    if (rb_w32_stati64(file, &st) != 0 || !S_ISDIR(st.st_mode))
+    DWORD attr;
+    WCHAR *wfile;
+
+    if (!(wfile = filecp_to_wstr(file, NULL)))
 	return FALSE;
+    attr = GetFileAttributesW(wfile);
+    if (attr == (DWORD)-1L ||
+	!(attr & FILE_ATTRIBUTE_DIRECTORY) ||
+	check_valid_dir(wfile)) {
+	return FALSE;
+    }
+    free(wfile);
     errno = EISDIR;
     return TRUE;
 }
@@ -5199,9 +5208,12 @@ check_if_dir(const char *file)
 static int
 check_if_wdir(const WCHAR *wfile)
 {
-    struct stati64 st;
-    if (wstati64(wfile, &st) != 0 || !S_ISDIR(st.st_mode))
+    DWORD attr = GetFileAttributesW(wfile);
+    if (attr == (DWORD)-1L ||
+	!(attr & FILE_ATTRIBUTE_DIRECTORY) ||
+	check_valid_dir(wfile)) {
 	return FALSE;
+    }
     errno = EISDIR;
     return TRUE;
 }