+support GnomeVFSMethod->get_file_info_from_handle()
authorshort <>
Mon, 3 Feb 2003 09:20:53 +0000 (09:20 +0000)
committershort <>
Mon, 3 Feb 2003 09:20:53 +0000 (09:20 +0000)
 - static captive_file_info_get() superseded by captive_file->*file_info_get()

src/client/libcaptive-gnomevfs/gnome-vfs-method.c
src/libcaptive/client/Makefile.am
src/libcaptive/client/file.c
src/libcaptive/client/file_info.c [deleted file]
src/libcaptive/include/captive/Makefile.am
src/libcaptive/include/captive/client-file.h
src/libcaptive/include/captive/client-file_info.h [deleted file]

index 85dd1db..d8598f0 100644 (file)
@@ -26,7 +26,6 @@
 #include "gnome-vfs-module.h"
 #include "captive/client-directory.h"
 #include "captive/client-file.h"
-#include "captive/client-file_info.h"
 #include "captive/client.h"
 
 
@@ -369,6 +368,7 @@ static GnomeVFSResult captive_gnomevfs_get_file_info(GnomeVFSMethod *method,
                GnomeVFSURI *uri,GnomeVFSFileInfo *file_info,GnomeVFSFileInfoOptions options,GnomeVFSContext *context)
 {
 GnomeVFSResult errvfsresult;
+CaptiveFileObject *captive_file_object;
 
        g_return_val_if_fail(method==&GnomeVFSMethod_static,GNOME_VFS_ERROR_BAD_PARAMETERS);
        g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
@@ -378,7 +378,38 @@ GnomeVFSResult errvfsresult;
        g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
 
        G_LOCK(libcaptive);
-       errvfsresult=captive_file_info_get(uri->text,file_info);
+       errvfsresult=captive_file_new_open(&captive_file_object,uri->text,
+                       0);     /* mode; 0 means FILE_READ_ATTRIBUTES */
+       G_UNLOCK(libcaptive);
+       if (errvfsresult!=GNOME_VFS_OK)
+               return errvfsresult;
+
+       G_LOCK(libcaptive);
+       errvfsresult=captive_file_file_info_get(captive_file_object,file_info);
+       G_UNLOCK(libcaptive);
+
+       G_LOCK(libcaptive);
+       g_object_unref(captive_file_object);
+       G_UNLOCK(libcaptive);
+
+       return errvfsresult;
+}
+
+
+GnomeVFSResult captive_gnomevfs_get_file_info_from_handle(GnomeVFSMethod *method,
+               GnomeVFSMethodHandle *method_handle,GnomeVFSFileInfo *file_info,GnomeVFSFileInfoOptions options,GnomeVFSContext *context)
+{
+GnomeVFSResult errvfsresult;
+CaptiveFileObject *captive_file_object;
+
+       g_return_val_if_fail(method==&GnomeVFSMethod_static,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       captive_file_object=(CaptiveFileObject *)method_handle;
+       g_return_val_if_fail(CAPTIVE_FILE_IS_OBJECT(captive_file_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       /* handle 'options & GNOME_VFS_FILE_INFO_GET_MIME_TYPE'? */
+
+       G_LOCK(libcaptive);
+       errvfsresult=captive_file_file_info_get(captive_file_object,file_info);
        G_UNLOCK(libcaptive);
 
        return errvfsresult;
@@ -399,21 +430,32 @@ GnomeVFSMethod *captive_gnomevfs_method_init(const gchar *fs_path)
        G_LOCK(GnomeVFSMethod_static);
        CAPTIVE_MEMZERO(&GnomeVFSMethod_static);
        GnomeVFSMethod_static.method_table_size=sizeof(GnomeVFSMethod_static);
-       GnomeVFSMethod_static.open_directory  =captive_gnomevfs_open_directory;
-       GnomeVFSMethod_static.close_directory =captive_gnomevfs_close_directory;
-       GnomeVFSMethod_static.read_directory  =captive_gnomevfs_read_directory;
-       GnomeVFSMethod_static.make_directory  =captive_gnomevfs_make_directory;
-       GnomeVFSMethod_static.remove_directory=captive_gnomevfs_remove_directory;
-       GnomeVFSMethod_static.open            =captive_gnomevfs_open;   /* mandatory */
-       GnomeVFSMethod_static.close           =captive_gnomevfs_close;
-       GnomeVFSMethod_static.read            =captive_gnomevfs_read;
-       GnomeVFSMethod_static.write           =captive_gnomevfs_write;
-       GnomeVFSMethod_static.seek            =captive_gnomevfs_seek;
-       GnomeVFSMethod_static.tell            =captive_gnomevfs_tell;
-       GnomeVFSMethod_static.create          =captive_gnomevfs_create; /* mandatory */
-       GnomeVFSMethod_static.unlink          =captive_gnomevfs_unlink;
-       GnomeVFSMethod_static.is_local        =captive_gnomevfs_is_local;       /* mandatory */
-       GnomeVFSMethod_static.get_file_info   =captive_gnomevfs_get_file_info;  /* mandatory */
+       GnomeVFSMethod_static.open                     =captive_gnomevfs_open;  /* mandatory */
+       GnomeVFSMethod_static.create                   =captive_gnomevfs_create;        /* mandatory */
+       GnomeVFSMethod_static.close                    =captive_gnomevfs_close;
+       GnomeVFSMethod_static.read                     =captive_gnomevfs_read;
+       GnomeVFSMethod_static.write                    =captive_gnomevfs_write;
+       GnomeVFSMethod_static.seek                     =captive_gnomevfs_seek;
+       GnomeVFSMethod_static.tell                     =captive_gnomevfs_tell;
+       /* TODO: GnomeVFSMethodTruncateHandleFunc truncate_handle; */
+       GnomeVFSMethod_static.open_directory           =captive_gnomevfs_open_directory;
+       GnomeVFSMethod_static.close_directory          =captive_gnomevfs_close_directory;
+       GnomeVFSMethod_static.read_directory           =captive_gnomevfs_read_directory;
+       GnomeVFSMethod_static.get_file_info            =captive_gnomevfs_get_file_info; /* mandatory */
+       GnomeVFSMethod_static.get_file_info_from_handle=captive_gnomevfs_get_file_info_from_handle;
+       GnomeVFSMethod_static.is_local                 =captive_gnomevfs_is_local;      /* mandatory */
+       GnomeVFSMethod_static.make_directory           =captive_gnomevfs_make_directory;
+       GnomeVFSMethod_static.remove_directory         =captive_gnomevfs_remove_directory;
+       /* TODO: GnomeVFSMethodMoveFunc move; */
+       GnomeVFSMethod_static.unlink                   =captive_gnomevfs_unlink;
+       /* TODO: GnomeVFSMethodCheckSameFSFunc check_same_fs; */
+       /* TODO: GnomeVFSMethodSetFileInfo set_file_info; */
+       /* TODO: GnomeVFSMethodTruncateFunc truncate; */
+       /* TODO: GnomeVFSMethodFindDirectoryFunc find_directory; */
+       /* TODO: GnomeVFSMethodCreateSymbolicLinkFunc create_symbolic_link; */
+       /* TODO: GnomeVFSMethodMonitorAddFunc monitor_add; */
+       /* TODO: GnomeVFSMethodMonitorCancelFunc monitor_cancel; */
+       /* TODO: GnomeVFSMethodFileControlFunc file_control; */
        G_UNLOCK(GnomeVFSMethod_static);
 
        return &GnomeVFSMethod_static;
index 4209464..cbe6247 100644 (file)
@@ -26,7 +26,6 @@ libclient_la_SOURCES= \
                lib.h \
                directory.c \
                file.c \
-               file_info.c \
                giochannel-blind.c \
                giochannel-blind.h \
                result.c \
index 0f2bf55..3b87dd9 100644 (file)
@@ -115,6 +115,7 @@ NTSTATUS err;
                        0
                                        |(!(mode&GNOME_VFS_OPEN_READ ) ? 0 : FILE_READ_DATA)
                                        |(!(mode&GNOME_VFS_OPEN_WRITE) ? 0 : FILE_WRITE_DATA | FILE_APPEND_DATA)
+                                       |(  mode!=0                    ? 0 : FILE_READ_ATTRIBUTES)
                                        ,       /* DesiredAccess */
                        &file_ObjectAttributes, /* ObjectAttributes */
                        &file_IoStatusBlock,    /* IoStatusBlock */
@@ -352,3 +353,127 @@ GnomeVFSResult errvfsresult;
 
        return GNOME_VFS_OK;
 }
+
+
+/* Use 'FileAllInformationStruct' identifier instead of the logical 'FileAllInformation'
+ * to prevent override of enum member 'FileAllInformation'
+ */
+static GnomeVFSResult FileAllInformationStruct_to_GnomeVFSFileInfo(GnomeVFSFileInfo *file_info,
+               FILE_ALL_INFORMATION *FileAllInformationStruct,IO_STATUS_BLOCK *IoStatusBlock)
+{
+UNICODE_STRING FileName_UnicodeString;
+BOOLEAN errBOOLEAN;
+ULONG tmp_ULONG;
+
+       g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_GENERIC);
+       g_return_val_if_fail(FileAllInformationStruct!=NULL,GNOME_VFS_ERROR_GENERIC);
+
+       g_return_val_if_fail(NT_SUCCESS(IoStatusBlock->Status),GNOME_VFS_ERROR_GENERIC);
+
+       file_info->valid_fields=0;
+
+       FileName_UnicodeString.Length=FileAllInformationStruct->NameInformation.FileNameLength;
+       FileName_UnicodeString.MaximumLength=FileAllInformationStruct->NameInformation.FileNameLength
+                       +sizeof(*FileAllInformationStruct->NameInformation.FileName);   /* 0-terminator */
+       g_assert((gpointer)(((char *)FileAllInformationStruct->NameInformation.FileName)+FileName_UnicodeString.Length)
+                       <=(gpointer)(((char *)FileAllInformationStruct)+IoStatusBlock->Information));
+                                       /* ensure we fit below '->IoStatusBlock->Information' at least without the 0-terminator */
+       FileAllInformationStruct->NameInformation.FileName[FileAllInformationStruct->NameInformation.FileNameLength
+                       /sizeof(*FileAllInformationStruct->NameInformation.FileName)]=0;        /* 0-terminate it */
+       FileName_UnicodeString.Buffer=FileAllInformationStruct->NameInformation.FileName;
+       file_info->name=captive_UnicodeString_to_utf8_malloc(&FileName_UnicodeString);
+       /* '->name' assumed for 'file_info->valid_fields' */
+
+       /* FIXME: What is 'FILE_ATTRIBUTE_NORMAL'? */
+       switch (FileAllInformationStruct->BasicInformation.FileAttributes & (0
+                       | FILE_ATTRIBUTE_DIRECTORY
+                       | FILE_ATTRIBUTE_DEVICE)) {
+               case 0:                        file_info->type=GNOME_VFS_FILE_TYPE_REGULAR;   break;
+               case FILE_ATTRIBUTE_DIRECTORY: file_info->type=GNOME_VFS_FILE_TYPE_DIRECTORY; break;
+               case FILE_ATTRIBUTE_DEVICE:    file_info->type=GNOME_VFS_FILE_TYPE_SOCKET;
+                       /* or GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE or GNOME_VFS_FILE_TYPE_BLOCK_DEVICE ? */
+                       break;
+               default:                       file_info->type=GNOME_VFS_FILE_TYPE_UNKNOWN;   break;
+               }
+       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE;
+
+       /* we use 0600 for r/w files, 0400 for FILE_ATTRIBUTE_READONLY */
+       file_info->permissions=GNOME_VFS_PERM_USER_READ;
+       if (file_info->type==GNOME_VFS_FILE_TYPE_DIRECTORY)
+               file_info->permissions|=GNOME_VFS_PERM_USER_EXEC;
+       if (!(FileAllInformationStruct->BasicInformation.FileAttributes & FILE_ATTRIBUTE_READONLY))
+               file_info->permissions|=GNOME_VFS_PERM_USER_WRITE;
+       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
+
+       file_info->size=FileAllInformationStruct->StandardInformation.EndOfFile.QuadPart;
+       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_SIZE;
+
+       file_info->block_count=FileAllInformationStruct->StandardInformation.AllocationSize.QuadPart/512;
+       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT;
+
+       file_info->flags=GNOME_VFS_FILE_FLAGS_LOCAL;
+       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_FLAGS;
+
+       if (FileAllInformationStruct->BasicInformation.LastAccessTime.QuadPart) {       /* it may be 0 if not set */
+               errBOOLEAN=RtlTimeToSecondsSince1970(&FileAllInformationStruct->BasicInformation.LastAccessTime,&tmp_ULONG);
+               g_assert(errBOOLEAN==TRUE);
+               file_info->atime=tmp_ULONG;
+               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_ATIME;
+               }
+
+       /* it may be 0 if not set */
+       if (FileAllInformationStruct->BasicInformation.LastWriteTime.QuadPart || FileAllInformationStruct->BasicInformation.ChangeTime.QuadPart) {
+               errBOOLEAN=RtlTimeToSecondsSince1970(
+                               /* take the more recent (==bigger) time: */
+                               (FileAllInformationStruct->BasicInformation.LastWriteTime.QuadPart > FileAllInformationStruct->BasicInformation.ChangeTime.QuadPart
+                                               ? &FileAllInformationStruct->BasicInformation.LastWriteTime : &FileAllInformationStruct->BasicInformation.ChangeTime),
+                               &tmp_ULONG);
+               g_assert(errBOOLEAN==TRUE);
+               file_info->mtime=tmp_ULONG;
+               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_MTIME;
+               }
+
+       if (FileAllInformationStruct->BasicInformation.CreationTime.QuadPart) { /* it may be 0 if not set */
+               errBOOLEAN=RtlTimeToSecondsSince1970(&FileAllInformationStruct->BasicInformation.CreationTime,&tmp_ULONG);
+               g_assert(errBOOLEAN==TRUE);
+               file_info->ctime=tmp_ULONG;
+               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_CTIME;
+               }
+
+       return GNOME_VFS_OK;
+}
+
+
+GnomeVFSResult captive_file_file_info_get(CaptiveFileObject *captive_file_object,GnomeVFSFileInfo *file_info)
+{
+NTSTATUS err;
+IO_STATUS_BLOCK file_IoStatusBlock;
+FILE_ALL_INFORMATION *FileAllInformationStruct;
+GnomeVFSResult errvfsresult;
+char QueryFile_buf[sizeof(FILE_ALL_INFORMATION)
+               +0x1000 /* max 'FileName' length, 255 should be enough */ * sizeof(WCHAR /* *FILE_ALL_INFORMATION.NameInformation.FileName */ )];
+
+       g_return_val_if_fail(captive_file_object!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(captive_file_object->file_Handle!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+
+       /* query */
+       FileAllInformationStruct=(void *)QueryFile_buf;
+       err=NtQueryInformationFile(
+                       captive_file_object->file_Handle,       /* FileHandle */
+                       &file_IoStatusBlock,    /* IoStatusBlock */
+                       (gpointer)QueryFile_buf,        /* FileInformation */
+                       sizeof(QueryFile_buf)   /* Length */
+                                       -sizeof(*FileAllInformationStruct->NameInformation.FileName),   /* reserve space for 0-terminator */
+                       FileAllInformation);    /* FileInformationClass; =>FILE_ALL_INFORMATION */
+       if (GNOME_VFS_OK!=(errvfsresult=captive_NTSTATUS_to_GnomeVFSResult(err)))
+               return errvfsresult;
+       g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
+
+       /* process gathered info */
+       errvfsresult=FileAllInformationStruct_to_GnomeVFSFileInfo(file_info,FileAllInformationStruct,
+                       &file_IoStatusBlock);
+       g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
+
+       return GNOME_VFS_OK;
+}
diff --git a/src/libcaptive/client/file_info.c b/src/libcaptive/client/file_info.c
deleted file mode 100644 (file)
index d2d4e49..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $Id$
- * captive vfs 'file' interface to reactos
- * 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 "captive/client-file_info.h"  /* self */
-#include "lib.h"
-#include <glib/gmessages.h>
-#include "captive/unicode.h"
-#include "reactos/ntos/types.h"        /* for HANDLE */
-#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'
- * to prevent override of enum member 'FileAllInformation'
- */
-static GnomeVFSResult FileAllInformationStruct_to_GnomeVFSFileInfo(GnomeVFSFileInfo *file_info,
-               FILE_ALL_INFORMATION *FileAllInformationStruct,IO_STATUS_BLOCK *IoStatusBlock)
-{
-UNICODE_STRING FileName_UnicodeString;
-BOOLEAN errBOOLEAN;
-ULONG tmp_ULONG;
-
-       g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_GENERIC);
-       g_return_val_if_fail(FileAllInformationStruct!=NULL,GNOME_VFS_ERROR_GENERIC);
-
-       g_return_val_if_fail(NT_SUCCESS(IoStatusBlock->Status),GNOME_VFS_ERROR_GENERIC);
-
-       file_info->valid_fields=0;
-
-       FileName_UnicodeString.Length=FileAllInformationStruct->NameInformation.FileNameLength;
-       FileName_UnicodeString.MaximumLength=FileAllInformationStruct->NameInformation.FileNameLength
-                       +sizeof(*FileAllInformationStruct->NameInformation.FileName);   /* 0-terminator */
-       g_assert((gpointer)(((char *)FileAllInformationStruct->NameInformation.FileName)+FileName_UnicodeString.Length)
-                       <=(gpointer)(((char *)FileAllInformationStruct)+IoStatusBlock->Information));
-                                       /* ensure we fit below '->IoStatusBlock->Information' at least without the 0-terminator */
-       FileAllInformationStruct->NameInformation.FileName[FileAllInformationStruct->NameInformation.FileNameLength
-                       /sizeof(*FileAllInformationStruct->NameInformation.FileName)]=0;        /* 0-terminate it */
-       FileName_UnicodeString.Buffer=FileAllInformationStruct->NameInformation.FileName;
-       file_info->name=captive_UnicodeString_to_utf8_malloc(&FileName_UnicodeString);
-       /* '->name' assumed for 'file_info->valid_fields' */
-
-       /* FIXME: What is 'FILE_ATTRIBUTE_NORMAL'? */
-       switch (FileAllInformationStruct->BasicInformation.FileAttributes & (0
-                       | FILE_ATTRIBUTE_DIRECTORY
-                       | FILE_ATTRIBUTE_DEVICE)) {
-               case 0:                        file_info->type=GNOME_VFS_FILE_TYPE_REGULAR;   break;
-               case FILE_ATTRIBUTE_DIRECTORY: file_info->type=GNOME_VFS_FILE_TYPE_DIRECTORY; break;
-               case FILE_ATTRIBUTE_DEVICE:    file_info->type=GNOME_VFS_FILE_TYPE_SOCKET;
-                       /* or GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE or GNOME_VFS_FILE_TYPE_BLOCK_DEVICE ? */
-                       break;
-               default:                       file_info->type=GNOME_VFS_FILE_TYPE_UNKNOWN;   break;
-               }
-       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_TYPE;
-
-       /* we use 0600 for r/w files, 0400 for FILE_ATTRIBUTE_READONLY */
-       file_info->permissions=GNOME_VFS_PERM_USER_READ;
-       if (file_info->type==GNOME_VFS_FILE_TYPE_DIRECTORY)
-               file_info->permissions|=GNOME_VFS_PERM_USER_EXEC;
-       if (!(FileAllInformationStruct->BasicInformation.FileAttributes & FILE_ATTRIBUTE_READONLY))
-               file_info->permissions|=GNOME_VFS_PERM_USER_WRITE;
-       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
-
-       file_info->size=FileAllInformationStruct->StandardInformation.EndOfFile.QuadPart;
-       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_SIZE;
-
-       file_info->block_count=FileAllInformationStruct->StandardInformation.AllocationSize.QuadPart/512;
-       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_BLOCK_COUNT;
-
-       file_info->flags=GNOME_VFS_FILE_FLAGS_LOCAL;
-       file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_FLAGS;
-
-       if (FileAllInformationStruct->BasicInformation.LastAccessTime.QuadPart) {       /* it may be 0 if not set */
-               errBOOLEAN=RtlTimeToSecondsSince1970(&FileAllInformationStruct->BasicInformation.LastAccessTime,&tmp_ULONG);
-               g_assert(errBOOLEAN==TRUE);
-               file_info->atime=tmp_ULONG;
-               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_ATIME;
-               }
-
-       /* it may be 0 if not set */
-       if (FileAllInformationStruct->BasicInformation.LastWriteTime.QuadPart || FileAllInformationStruct->BasicInformation.ChangeTime.QuadPart) {
-               errBOOLEAN=RtlTimeToSecondsSince1970(
-                               /* take the more recent (==bigger) time: */
-                               (FileAllInformationStruct->BasicInformation.LastWriteTime.QuadPart > FileAllInformationStruct->BasicInformation.ChangeTime.QuadPart
-                                               ? &FileAllInformationStruct->BasicInformation.LastWriteTime : &FileAllInformationStruct->BasicInformation.ChangeTime),
-                               &tmp_ULONG);
-               g_assert(errBOOLEAN==TRUE);
-               file_info->mtime=tmp_ULONG;
-               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_MTIME;
-               }
-
-       if (FileAllInformationStruct->BasicInformation.CreationTime.QuadPart) { /* it may be 0 if not set */
-               errBOOLEAN=RtlTimeToSecondsSince1970(&FileAllInformationStruct->BasicInformation.CreationTime,&tmp_ULONG);
-               g_assert(errBOOLEAN==TRUE);
-               file_info->ctime=tmp_ULONG;
-               file_info->valid_fields|=GNOME_VFS_FILE_INFO_FIELDS_CTIME;
-               }
-
-       return GNOME_VFS_OK;
-}
-
-
-GnomeVFSResult captive_file_info_get(const gchar *pathname,GnomeVFSFileInfo *file_info)
-{
-NTSTATUS err;
-IO_STATUS_BLOCK file_IoStatusBlock;
-FILE_ALL_INFORMATION *FileAllInformationStruct;
-GnomeVFSResult errvfsresult;
-OBJECT_ATTRIBUTES file_ObjectAttributes;
-HANDLE file_Handle;
-char QueryFile_buf[sizeof(FILE_ALL_INFORMATION)
-               +0x1000 /* max 'FileName' length, 255 should be enough */ * sizeof(WCHAR /* *FILE_ALL_INFORMATION.NameInformation.FileName */ )];
-
-       if (CAPTIVE_IS_SANDBOX_PARENT())
-               return captive_sandbox_parent_file_info_get(pathname,file_info);
-
-       g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-       g_return_val_if_fail(file_info!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
-
-       errvfsresult=captive_ObjectAttributes_init(pathname,&file_ObjectAttributes);
-       g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
-       
-       /* open */
-       err=IoCreateFile(
-                       &file_Handle,   /* FileHandle */
-                       FILE_READ_ATTRIBUTES,   /* DesiredAccess */
-                       &file_ObjectAttributes, /* ObjectAttributes */
-                       &file_IoStatusBlock,    /* IoStatusBlock */
-                       NULL,   /* AllocationSize; ignored for open */
-                       FILE_ATTRIBUTE_NORMAL,  /* FileAttributes; ignored for open */
-                       FILE_SHARE_WRITE,       /* ShareAccess; 0 means exclusive */
-                       FILE_OPEN,      /* CreateDisposition */
-                       /* FILE_SYNCHRONOUS_IO_{,NON}ALERT: We need to allow W32 filesystem
-                                * any waits to not to let it return STATUS_CANT_WAIT us.
-                                * Alertability should have only effect on asynchronous events
-                                * from KeWaitForSingleObject() by setting/clearing its parameter 'Alertable'.
-                                */
-                       FILE_SYNCHRONOUS_IO_ALERT,      /* CreateOptions */
-                       NULL,   /* EaBuffer */
-                       0,      /* EaLength */
-                       CreateFileTypeNone,     /* CreateFileType */
-                       NULL,   /* ExtraCreateParameters */
-                       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 (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);
-
-       /* query */
-       FileAllInformationStruct=(void *)QueryFile_buf;
-       err=NtQueryInformationFile(
-                       file_Handle,    /* FileHandle */
-                       &file_IoStatusBlock,    /* IoStatusBlock */
-                       (gpointer)QueryFile_buf,        /* FileInformation */
-                       sizeof(QueryFile_buf)   /* Length */
-                                       -sizeof(*FileAllInformationStruct->NameInformation.FileName),   /* reserve space for 0-terminator */
-                       FileAllInformation);    /* FileInformationClass; =>FILE_ALL_INFORMATION */
-       if (!NT_SUCCESS(err)) {
-               g_assert_not_reached();
-               goto err_close;
-               }
-
-       /* close */
-       err=NtClose(file_Handle);
-       g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
-
-       /* process gathered info */
-       errvfsresult=FileAllInformationStruct_to_GnomeVFSFileInfo(file_info,FileAllInformationStruct,
-                       &file_IoStatusBlock);
-       g_return_val_if_fail(errvfsresult==GNOME_VFS_OK,errvfsresult);
-
-       return GNOME_VFS_OK;
-
-err_close:
-       err=NtClose(file_Handle);
-       g_return_val_if_fail(NT_SUCCESS(err),GNOME_VFS_ERROR_GENERIC);
-/* err: */
-       g_return_val_if_reached(GNOME_VFS_ERROR_GENERIC);
-}
index 20cfd12..5047831 100644 (file)
@@ -24,7 +24,6 @@ pkginclude_HEADERS+= \
                client.h \
                client-directory.h \
                client-file.h \
-               client-file_info.h \
                config2.h \
                ldr.h \
                ldr_exports.h \
index 804846f..d64055c 100644 (file)
@@ -63,6 +63,7 @@ GnomeVFSResult captive_file_seek
                (CaptiveFileObject *captive_file_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset);
 GnomeVFSResult captive_file_tell(CaptiveFileObject *captive_file_object,GnomeVFSFileOffset *offset_return);
 GnomeVFSResult captive_file_remove(CaptiveFileObject *captive_file_object);
+GnomeVFSResult captive_file_file_info_get(CaptiveFileObject *captive_file_object,GnomeVFSFileInfo *file_info);
 
 G_END_DECLS
 
diff --git a/src/libcaptive/include/captive/client-file_info.h b/src/libcaptive/include/captive/client-file_info.h
deleted file mode 100644 (file)
index 56a4a71..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $Id$
- * Include file with client-application 'GnomeVFSFileInfo' access to libcaptive
- * 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_FILE_INFO_H
-#define _CAPTIVE_CLIENT_FILE_INFO_H 1
-
-
-#include <glib/gmacros.h>
-#include <libgnomevfs/gnome-vfs-result.h>      /* for GnomeVFSResult */
-#include <libgnomevfs/gnome-vfs-file-info.h>   /* for GnomeVFSFileInfo */
-
-
-G_BEGIN_DECLS
-
-GnomeVFSResult captive_file_info_get(const gchar *pathname,GnomeVFSFileInfo *file_info);
-
-G_END_DECLS
-
-
-#endif /* _CAPTIVE_CLIENT_FILE_INFO_H */