diff --git a/bin/win/IdeaWin32.dll b/bin/win/IdeaWin32.dll index a610544ab33c..fc8c95a97aeb 100644 Binary files a/bin/win/IdeaWin32.dll and b/bin/win/IdeaWin32.dll differ diff --git a/native/IdeaWin32/IdeaWin32.cpp b/native/IdeaWin32/IdeaWin32.cpp index 18cb2870dad7..11d96a8f0f6c 100644 --- a/native/IdeaWin32/IdeaWin32.cpp +++ b/native/IdeaWin32/IdeaWin32.cpp @@ -72,6 +72,15 @@ JNIEXPORT jobject JNICALL Java_com_intellij_openapi_vfs_impl_win32_IdeaWin32_get return CreateFileInfo(env, &data, infoClass); } +JNIEXPORT jboolean JNICALL Java_com_intellij_openapi_vfs_impl_win32_IdeaWin32_checkExist(JNIEnv *env, jobject method, jstring path) { + jint result = 0; + WIN32_FILE_ATTRIBUTE_DATA wfad; + const jchar* str = env->GetStringChars(path, 0); + + if (GetFileAttributesEx((LPCWSTR)path, GetFileExInfoStandard, &wfad)) return JNI_TRUE; + return JNI_FALSE; +} + JNIEXPORT jobjectArray JNICALL Java_com_intellij_openapi_vfs_impl_win32_IdeaWin32_listChildren(JNIEnv *env, jobject method, jstring path) { diff --git a/native/IdeaWin32/IdeaWin32.vcproj b/native/IdeaWin32/IdeaWin32.vcproj index 5a8310e4d77d..af41a3c0f8c9 100644 --- a/native/IdeaWin32/IdeaWin32.vcproj +++ b/native/IdeaWin32/IdeaWin32.vcproj @@ -1,11 +1,12 @@ - @@ -139,6 +139,8 @@ SubSystem="2" OptimizeReferences="2" EnableCOMDATFolding="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" TargetMachine="1" /> - diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/IdeaWin32.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/IdeaWin32.java index b041683762de..32327f9f7f1c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/IdeaWin32.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/IdeaWin32.java @@ -22,5 +22,7 @@ public class IdeaWin32 { public native FileInfo getInfo(String path); + public native boolean checkExist(String path); + public native FileInfo[] listChildren(String path); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java index 66d976010ac4..73496eb28736 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32Kernel.java @@ -67,7 +67,7 @@ public class Win32Kernel { return true; } catch (FileNotFoundException e) { - return false; + return myKernel.checkExist(path); } } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32LocalFileSystem.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32LocalFileSystem.java index 85c336ad16db..ad8b87d77682 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32LocalFileSystem.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/win32/Win32LocalFileSystem.java @@ -56,13 +56,14 @@ public class Win32LocalFileSystem extends LocalFileSystemBase { }; public static Win32LocalFileSystem getWin32Instance() { + if (!isAvailable()) throw new RuntimeException("dll is not loaded"); Win32LocalFileSystem fileSystem = THREAD_LOCAL.get(); fileSystem.myKernel.clearCache(); return fileSystem; } private final Win32Kernel myKernel = new Win32Kernel(); - private boolean checkMe = false; + public static boolean checkMe = false; private Win32LocalFileSystem() { }