libclient_la_SOURCES= \
init.c \
lib.c \
+ lib.h \
directory.c \
file.c \
- file_info.c
+ file_info.c \
+ result.c \
+ result.h
#include "reactos/ddk/iotypes.h" /* for IO_STATUS_BLOCK */
#include "reactos/ddk/iofuncs.h" /* for IoCreateFile() */
#include "captive/sandbox.h"
+#include "result.h"
static gpointer captive_directory_object_parent_class=NULL;
NULL, /* FileName; wildcards possible; optional */
captive_directory_object->read_first); /* RestartScan */
captive_directory_object->read_first=FALSE;
- if (err==STATUS_NO_MORE_FILES)
- return GNOME_VFS_ERROR_EOF;
+ if (GNOME_VFS_OK!=(errvfsresult=captive_NTSTATUS_to_GnomeVFSResult(err)))
+ return errvfsresult;
g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
errvfsresult=FileIdBothDirInformation_to_GnomeVFSFileInfo(file_info,FileIdBothDirInformation,
#include "reactos/ddk/iotypes.h" /* for IO_STATUS_BLOCK */
#include "reactos/ddk/iofuncs.h" /* for IoCreateFile() */
#include "captive/sandbox.h"
+#include "result.h"
static gpointer captive_file_object_parent_class=NULL;
0); /* Options */
g_free(file_ObjectAttributes.ObjectName); /* left from captive_file_uri_parent_init() */
g_return_val_if_fail(NT_SUCCESS(err)==NT_SUCCESS(file_IoStatusBlock.Status),GNOME_VFS_ERROR_GENERIC);
- if (err==STATUS_OBJECT_NAME_COLLISION)
- return GNOME_VFS_ERROR_FILE_EXISTS;
+ if (GNOME_VFS_OK!=(errvfsresult=captive_NTSTATUS_to_GnomeVFSResult(err)))
+ return errvfsresult;
g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
g_return_val_if_fail(file_IoStatusBlock.Information
==(!create ? FILE_OPENED : FILE_CREATED),
NTSTATUS err;
IO_STATUS_BLOCK file_IoStatusBlock;
LARGE_INTEGER file_offset;
+GnomeVFSResult errvfsresult;
if (CAPTIVE_IS_SANDBOX_PARENT())
return captive_sandbox_parent_file_read(captive_file_object,buffer,num_bytes,bytes_read_return);
*bytes_read_return=0;
return GNOME_VFS_ERROR_EOF;
}
+ if (GNOME_VFS_OK!=(errvfsresult=captive_NTSTATUS_to_GnomeVFSResult(err)))
+ return errvfsresult;
g_return_val_if_fail(NT_SUCCESS(err)==NT_SUCCESS(file_IoStatusBlock.Status),GNOME_VFS_ERROR_GENERIC);
g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
g_return_val_if_fail(file_IoStatusBlock.Information<=num_bytes,GNOME_VFS_ERROR_GENERIC);
#include "reactos/ddk/iotypes.h" /* for IO_STATUS_BLOCK */
#include "reactos/ddk/iofuncs.h" /* for IoCreateFile() */
#include "captive/sandbox.h"
+#include "result.h"
/* Use 'FileAllInformationStruct' identifier instead of the logical 'FileAllInformation'
0); /* Options */
g_free(file_ObjectAttributes.ObjectName); /* left from captive_gnomevfs_uri_parent_init() */
g_return_val_if_fail(NT_SUCCESS(err)==NT_SUCCESS(file_IoStatusBlock.Status),GNOME_VFS_ERROR_GENERIC);
- if (err==STATUS_OBJECT_NAME_NOT_FOUND)
- return GNOME_VFS_ERROR_NOT_FOUND;
- if (err==STATUS_UNRECOGNIZED_VOLUME)
- return GNOME_VFS_ERROR_WRONG_FORMAT;
- if (err==STATUS_OBJECT_NAME_INVALID)
- return GNOME_VFS_ERROR_INVALID_URI;
+ if (GNOME_VFS_OK!=(errvfsresult=captive_NTSTATUS_to_GnomeVFSResult(err)))
+ return errvfsresult;
g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
g_return_val_if_fail(file_IoStatusBlock.Information==FILE_OPENED,GNOME_VFS_ERROR_GENERIC);
--- /dev/null
+/* $Id$
+ * captive vfs result code translation for Gnome-VFS-2.0
+ * Copyright (C) 2002-2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "config.h"
+
+#include "result.h" /* self */
+#include <glib/gmessages.h>
+#include "reactos/ddk/status.h" /* for STATUS_* */
+#include <libgnomevfs/gnome-vfs-result.h> /* for GnomeVFSResult */
+
+
+GnomeVFSResult captive_NTSTATUS_to_GnomeVFSResult(NTSTATUS err)
+{
+ switch (err) {
+ case STATUS_NO_SUCH_FILE: return GNOME_VFS_ERROR_EOF; /* ==0 files found */
+ case STATUS_NO_MORE_FILES: return GNOME_VFS_ERROR_EOF; /* >=1 files found */
+ case STATUS_OBJECT_NAME_COLLISION: return GNOME_VFS_ERROR_FILE_EXISTS;
+ case STATUS_OBJECT_NAME_NOT_FOUND: return GNOME_VFS_ERROR_NOT_FOUND;
+ case STATUS_UNRECOGNIZED_VOLUME: return GNOME_VFS_ERROR_WRONG_FORMAT;
+ case STATUS_OBJECT_NAME_INVALID: return GNOME_VFS_ERROR_INVALID_URI;
+ default:; /* PASSTHRU */
+ }
+ return GNOME_VFS_OK; /* undetected */
+}
--- /dev/null
+/* $Id$
+ * Include file for captive vfs result code translation for Gnome-VFS-2.0
+ * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; exactly version 2 of June 1991 is required
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#ifndef _CAPTIVE_CLIENT_RESULT_H
+#define _CAPTIVE_CLIENT_RESULT_H 1
+
+
+#include <glib/gmacros.h>
+#include "reactos/napi/types.h" /* for NTSTATUS */
+#include <libgnomevfs/gnome-vfs-result.h>
+
+
+G_BEGIN_DECLS
+
+GnomeVFSResult captive_NTSTATUS_to_GnomeVFSResult(NTSTATUS err);
+
+G_END_DECLS
+
+
+#endif /* _CAPTIVE_CLIENT_RESULT_H */