示例#1
0
  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;
  }
示例#2
0
  private int createNew(
      VirtualFile file,
      WString path,
      int desiredAccess,
      int shareMode,
      int flagsAndAttributes,
      DokanFileInfo dokanFileInfo) {
    if (file != null) {
      return -ERROR_FILE_EXISTS;
    }

    file = (VirtualFile) root.createFile(path, flagsAndAttributes);
    if (file == null) {
      return -ERROR_PATH_NOT_FOUND;
    }
    dokanFileInfo.isDirectory = file.isDirectory() ? (byte) 1 : 0;
    dokanFileInfo.context = file.hashCode();
    return ERROR_SUCCESS;
  }
示例#3
0
  private int createAlways(
      VirtualFile file,
      WString path,
      int desiredAccess,
      int shareMode,
      int flagsAndAttributes,
      DokanFileInfo dokanFileInfo) {
    int returnCode = ERROR_SUCCESS;

    if (file != null) {
      returnCode = file.flush(flagsAndAttributes) ? ERROR_ALREADY_EXISTS : -ERROR_ACCESS_DENIED;
    } else {
      file = (VirtualFile) root.createFile(path, flagsAndAttributes);
      if (file == null) {
        return -ERROR_PATH_NOT_FOUND;
      }
    }

    dokanFileInfo.isDirectory = file.isDirectory() ? (byte) 1 : 0;
    dokanFileInfo.context = file.hashCode();
    return returnCode;
  }
示例#4
0
  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;
  }