private int openExisting( VirtualFile file, int desiredAccess, int shareMode, int flagsAndAttributes, DokanFileInfo dokanFileInfo) { if (file == null) { dokanFileInfo.context = 0; return -ERROR_FILE_NOT_FOUND; } if (file.isReadOnly() && Is.in(desiredAccess).set(GENERIC_WRITE | FILE_WRITE_DATA)) { return -ERROR_ACCESS_DENIED; } dokanFileInfo.isDirectory = file.isDirectory() ? (byte) 1 : 0; dokanFileInfo.context = file.hashCode(); return ERROR_SUCCESS; }
private int openAlways( VirtualFile file, WString path, int desiredAccess, int shareMode, int flagsAndAttributes, DokanFileInfo dokanFileInfo) { int returnCode = ERROR_ALREADY_EXISTS; if (file == null) { file = (VirtualFile) root.createFile(path, flagsAndAttributes); returnCode = ERROR_SUCCESS; } if (file.isReadOnly() && Is.in(desiredAccess).set(GENERIC_WRITE | FILE_WRITE_DATA)) { return -ERROR_ACCESS_DENIED; } dokanFileInfo.isDirectory = file.isDirectory() ? (byte) 1 : 0; dokanFileInfo.context = file.hashCode(); return returnCode; }