Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }
Ejemplo n.º 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;
  }