Implemented sub-second W32 filesystem interface by new: CaptiveFileInfoObject
[captive.git] / src / libcaptive / sandbox / parent-File.c
index ddfefed..ca062f5 100644 (file)
 #include "reactos/ntos/types.h"        /* for ULONG */
 
 
-GnomeVFSResult captive_sandbox_parent_file_new_open(CaptiveFileParentObject *captive_file_parent_object,
-               const gchar *pathname,GnomeVFSOpenMode mode)
+GnomeVFSResult captive_sandbox_parent_file_new_open(CaptiveFileParentObject *captive_file_parent_object)
 {
 xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
+GnomeVFSResult r;
+Captive_File corba_File_object;
 
        g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
-       g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(captive_file_parent_object->pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_new_open",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"pathname",pathname);
-               xmlNewProp(xml_action,"mode",captive_printf_alloca("%u",(unsigned)mode));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_new_open",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "pathname",BAD_CAST captive_file_parent_object->pathname);
+               xmlNewProp(xml_action,BAD_CAST "mode",BAD_CAST captive_printf_alloca("%u",(unsigned)captive_file_parent_object->mode));
                }
 
-       captive_file_parent_object->corba_File_object=Captive_Vfs_file_new_open(
-                       captive_vfs_parent_object->corba_Vfs_object,pathname,mode,&captive_corba_ev);
+       corba_File_object=Captive_Vfs_file_new_open(captive_vfs_parent_object->corba_Vfs_object,
+                       captive_file_parent_object->pathname,captive_file_parent_object->mode,&captive_corba_ev);
        if (xml_action)
-               xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST (captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
+       /* If 'r' means failure 'corba_File_object' may not be 'CORBA_OBJECT_NIL'
+        * although it is not valid 'CORBA_Object' to be passed to CORBA_Object_release().
+        */
+       if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object)))
+               return r;
 
-       return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
+       captive_file_parent_object->corba_File_object=corba_File_object;
+       return GNOME_VFS_OK;
 }
 
 
 GnomeVFSResult captive_sandbox_parent_file_new_create(CaptiveFileParentObject *captive_file_parent_object,
-               const gchar *pathname,GnomeVFSOpenMode mode,gboolean exclusive,guint perm)
+               gboolean exclusive,guint perm)
 {
 xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
+GnomeVFSResult r;
+Captive_File corba_File_object;
 
        g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
-       g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(captive_file_parent_object->pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_new_create",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"pathname",pathname);
-               xmlNewProp(xml_action,"mode",captive_printf_alloca("%u",(unsigned)mode));
-               xmlNewProp(xml_action,"exclusive",captive_printf_alloca("%u",(unsigned)exclusive));
-               xmlNewProp(xml_action,"perm",captive_printf_alloca("%u",(unsigned)perm));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_new_create",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "pathname",BAD_CAST captive_file_parent_object->pathname);
+               xmlNewProp(xml_action,BAD_CAST "mode",BAD_CAST captive_printf_alloca("%u",(unsigned)captive_file_parent_object->mode));
+               xmlNewProp(xml_action,BAD_CAST "exclusive",BAD_CAST captive_printf_alloca("%u",(unsigned)exclusive));
+               xmlNewProp(xml_action,BAD_CAST "perm",BAD_CAST captive_printf_alloca("%u",(unsigned)perm));
                }
 
-       captive_file_parent_object->corba_File_object=Captive_Vfs_file_new_create(
-                       captive_vfs_parent_object->corba_Vfs_object,pathname,mode,exclusive,perm,&captive_corba_ev);
+       corba_File_object=Captive_Vfs_file_new_create(captive_vfs_parent_object->corba_Vfs_object,
+                       captive_file_parent_object->pathname,captive_file_parent_object->mode,exclusive,perm,&captive_corba_ev);
        if (xml_action)
-               xmlNewProp(xml_action,"result",(captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST (captive_corba_ev._major==CORBA_NO_EXCEPTION ? "1" : "0"));
+       /* If 'r' means failure 'corba_File_object' may not be 'CORBA_OBJECT_NIL'
+        * although it is not valid 'CORBA_Object' to be passed to CORBA_Object_release().
+        */
+       if (GNOME_VFS_OK!=(r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object)))
+               return r;
 
-       return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
+       captive_file_parent_object->corba_File_object=corba_File_object;
+       return GNOME_VFS_OK;
 }
 
 
@@ -97,21 +112,20 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_close",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_close",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
                }
 
        Captive_File_shutdown(captive_file_parent_object->corba_File_object,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
-       if (r!=GNOME_VFS_OK)
-               return r;
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
 
+       /* Always clear 'corba_File_object' even if 'r' means failure. */
        CORBA_Object_release((CORBA_Object)captive_file_parent_object->corba_File_object,&captive_corba_ev);
        captive_file_parent_object->corba_File_object=CORBA_OBJECT_NIL;
 
-       return captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
+       return r;
 }
 
 
@@ -136,9 +150,9 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        *bytes_read_return=0;
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_read",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"num_bytes",captive_printf_alloca("%lu",(unsigned long)num_bytes));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_read",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "num_bytes",BAD_CAST captive_printf_alloca("%lu",(unsigned long)num_bytes));
                }
 
        r=captive_sandbox_parent_file_seek_slave(captive_file_parent_object,
@@ -148,7 +162,7 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
                r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
                }
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -161,7 +175,7 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        CORBA_free(buffer_corba);
 
        if (xml_action)
-               xmlNewProp(xml_action,"bytes_read_return",captive_printf_alloca("%lu",(unsigned long)*bytes_read_return));
+               xmlNewProp(xml_action,BAD_CAST "bytes_read_return",BAD_CAST captive_printf_alloca("%lu",(unsigned long)*bytes_read_return));
 
        return GNOME_VFS_OK;
 }
@@ -185,15 +199,16 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
 
        *bytes_written_return=0;
 
-       if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_write",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"num_bytes",captive_printf_alloca("%lu",(unsigned long)num_bytes));
-               }
-
        r=captive_sandbox_parent_file_seek_slave(captive_file_parent_object,
                        GNOME_VFS_SEEK_START,captive_file_parent_object->offset);
        if (r==GNOME_VFS_OK) {
+
+               if (captive_vfs_parent_object->corba_bug_action) {
+                       xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_write",NULL);
+                       xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+                       xmlNewProp(xml_action,BAD_CAST "num_bytes",BAD_CAST captive_printf_alloca("%lu",(unsigned long)num_bytes));
+                       }
+
                buffer_corba_local._maximum=num_bytes;
                buffer_corba_local._length=num_bytes;
                buffer_corba_local._buffer=(/* de-const */gpointer)buffer_captive;
@@ -202,9 +217,9 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
                Captive_File_write(captive_file_parent_object->corba_File_object,
                                &buffer_corba_local,&bytes_written_corba,&captive_corba_ev);
                r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
+               if (xml_action)
+                       xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
                }
-       if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -212,7 +227,7 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_file_parent_object->offset+=bytes_written_corba;
 
        if (xml_action)
-               xmlNewProp(xml_action,"bytes_written_return",captive_printf_alloca("%lu",(unsigned long)*bytes_written_return));
+               xmlNewProp(xml_action,BAD_CAST "bytes_written_return",BAD_CAST captive_printf_alloca("%lu",(unsigned long)*bytes_written_return));
 
        return GNOME_VFS_OK;
 }
@@ -230,19 +245,19 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_seek",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"whence",
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_seek",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "whence",BAD_CAST
                                (whence==GNOME_VFS_SEEK_START ? "start" :
                                        (whence==GNOME_VFS_SEEK_CURRENT ? "current" :
                                                (whence==GNOME_VFS_SEEK_END ? "end" : captive_printf_alloca("%lu",(unsigned long)whence)))));
-               xmlNewProp(xml_action,"offset",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)offset));
+               xmlNewProp(xml_action,BAD_CAST "offset",BAD_CAST captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)offset));
                }
 
        Captive_File_seek(captive_file_parent_object->corba_File_object,whence,offset,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -254,34 +269,30 @@ GnomeVFSResult captive_sandbox_parent_file_seek
                (CaptiveFileParentObject *captive_file_parent_object,GnomeVFSSeekPosition whence,GnomeVFSFileOffset offset)
 {
 GnomeVFSResult r;
-xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
 
        g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
 
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
-       if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_seek",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"whence",
-                               (whence==GNOME_VFS_SEEK_START ? "start" :
-                                       (whence==GNOME_VFS_SEEK_CURRENT ? "current" :
-                                               (whence==GNOME_VFS_SEEK_END ? "end" : captive_printf_alloca("%lu",(unsigned long)whence)))));
-               xmlNewProp(xml_action,"offset",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)offset));
-               }
+       /* Do not produce 'xml_action' here as we use only 'slave' point of view
+        * for captive-bug-replay(1).
+        */
 
        switch (whence) {
                case GNOME_VFS_SEEK_START:
                        captive_file_parent_object->offset=offset;
+                       r=GNOME_VFS_OK;
                        break;
                case GNOME_VFS_SEEK_CURRENT:
                        if (0
                                        || (offset>0 && (captive_file_parent_object->offset+offset)<captive_file_parent_object->offset)
                                        || (offset<0 && (captive_file_parent_object->offset+offset)>captive_file_parent_object->offset))
                                r=GNOME_VFS_ERROR_BAD_PARAMETERS;
-                       else
+                       else {
                                captive_file_parent_object->offset+=offset;
+                               r=GNOME_VFS_OK;
+                               }
                        break;
                case GNOME_VFS_SEEK_END:
                        g_assert_not_reached(); /* NOT IMPLEMENTED YET */
@@ -291,8 +302,6 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
                        r=GNOME_VFS_ERROR_BAD_PARAMETERS;
                }
 
-       if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -339,7 +348,6 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
 GnomeVFSResult captive_sandbox_parent_file_tell(CaptiveFileParentObject *captive_file_parent_object,GnomeVFSFileOffset *offset_return)
 {
 GnomeVFSResult r;
-xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
 
        g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
@@ -347,21 +355,16 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
 
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
-       if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_tell",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               }
+       /* Do not produce 'xml_action' here as we use only 'slave' point of view
+        * for captive-bug-replay(1).
+        */
 
        *offset_return=captive_file_parent_object->offset;
        r=GNOME_VFS_OK;
-       if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+
        if (r!=GNOME_VFS_OK)
                return r;
 
-       if (xml_action)
-               xmlNewProp(xml_action,"offset_return",captive_printf_alloca("%" G_GINT64_FORMAT,(gint64)*offset_return));
-
        return GNOME_VFS_OK;
 }
 
@@ -377,14 +380,14 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_remove",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_remove",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
                }
 
        Captive_File_remove(captive_file_parent_object->corba_File_object,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -393,46 +396,59 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
 
 
 GnomeVFSResult captive_sandbox_parent_file_file_info_get(CaptiveFileParentObject *captive_file_parent_object,
-               GnomeVFSFileInfo *file_info_captive)
+               CaptiveFileInfoObject **captive_file_info_object_return)
 {
-Captive_GnomeVFSFileInfo *file_info_corba;
+Captive_CaptiveFileInfoObject *file_info_corba;
 GnomeVFSResult r;
 xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
+CaptiveFileInfoObject *captive_file_info_object;
 
        g_return_val_if_fail(CAPTIVE_FILE_PARENT_IS_OBJECT(captive_file_parent_object),GNOME_VFS_ERROR_BAD_PARAMETERS);
-       g_return_val_if_fail(file_info_captive!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
+       g_return_val_if_fail(captive_file_info_object_return!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
 
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_file_info_get",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_file_info_get",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
                }
 
        Captive_File_file_info_get(captive_file_parent_object->corba_File_object,&file_info_corba,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
-       r=captive_sandbox_file_info_corba_to_captive(file_info_captive,file_info_corba);
-       Captive_GnomeVFSFileInfo__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+       r=captive_file_info_object_new(&captive_file_info_object);
+       if (xml_action)
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
+       if (r!=GNOME_VFS_OK) {
+               Captive_CaptiveFileInfoObject__freekids(file_info_corba,NULL/* 'd'; meaning? */);
+               CORBA_free(file_info_corba);
+               return r;
+               }
+
+       r=captive_sandbox_file_info_corba_to_captive(captive_file_info_object,file_info_corba);
+       Captive_CaptiveFileInfoObject__freekids(file_info_corba,NULL/* 'd'; meaning? */);
        CORBA_free(file_info_corba);
        if (xml_action)
-               xmlSetProp(xml_action,"result",gnome_vfs_result_to_string(r));
-       if (r!=GNOME_VFS_OK)
+               xmlSetProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
+       if (r!=GNOME_VFS_OK) {
+               g_object_unref(captive_file_info_object);
                return r;
+               }
 
+       *captive_file_info_object_return=captive_file_info_object;
        return GNOME_VFS_OK;
 }
 
 
 GnomeVFSResult captive_sandbox_parent_file_file_info_set(CaptiveFileParentObject *captive_file_parent_object,
-    const GnomeVFSFileInfo *file_info_captive,GnomeVFSSetFileInfoMask mask)
+    CaptiveFileInfoObject *file_info_captive,GnomeVFSSetFileInfoMask mask)
 {
-Captive_GnomeVFSFileInfo file_info_corba;
+Captive_CaptiveFileInfoObject file_info_corba;
 GnomeVFSResult r;
 xmlNode *xml_action=NULL;
 CaptiveVfsParentObject *captive_vfs_parent_object;
@@ -443,22 +459,22 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_file_info_set",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"mask",captive_printf_alloca("%u",(unsigned)mask));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_file_info_set",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "mask",BAD_CAST captive_printf_alloca("%u",(unsigned)mask));
                }
 
-       if (GNOME_VFS_OK!=(r=captive_sandbox_file_info_captive_to_corba(&file_info_corba,file_info_captive)))
+       if (GNOME_VFS_OK!=(r=captive_sandbox_file_info_set_mask_captive_to_corba(&file_info_corba,file_info_captive,mask)))
                return r;
 
        Captive_File_file_info_set(captive_file_parent_object->corba_File_object,&file_info_corba,mask,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
-       Captive_GnomeVFSFileInfo__freekids(&file_info_corba,NULL/* 'd'; meaning? */);
+       Captive_CaptiveFileInfoObject__freekids(&file_info_corba,NULL/* 'd'; meaning? */);
 
        return GNOME_VFS_OK;
 }
@@ -475,15 +491,15 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_truncate",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object));
-               xmlNewProp(xml_action,"file_size",captive_printf_alloca("%" G_GUINT64_FORMAT,(guint64)file_size));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_truncate",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object));
+               xmlNewProp(xml_action,BAD_CAST "file_size",BAD_CAST captive_printf_alloca("%" G_GUINT64_FORMAT,(guint64)file_size));
                }
 
        Captive_File_truncate(captive_file_parent_object->corba_File_object,file_size,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;
 
@@ -504,16 +520,16 @@ CaptiveVfsParentObject *captive_vfs_parent_object;
        captive_vfs_parent_object=CAPTIVE_VFS_PARENT_OBJECT(CAPTIVE_FILE_OBJECT(captive_file_parent_object_old)->vfs);
 
        if (captive_vfs_parent_object->corba_bug_action) {
-               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,"file_truncate",NULL);
-               xmlNewProp(xml_action,"object",captive_printf_alloca("%p",captive_file_parent_object_old));
-               xmlNewProp(xml_action,"pathname_new",pathname_new);
-               xmlNewProp(xml_action,"force_replace",captive_printf_alloca("%u",(unsigned)force_replace));
+               xml_action=xmlNewTextChild(captive_vfs_parent_object->corba_bug_action,NULL,BAD_CAST "file_move",NULL);
+               xmlNewProp(xml_action,BAD_CAST "object",BAD_CAST captive_printf_alloca("%p",captive_file_parent_object_old));
+               xmlNewProp(xml_action,BAD_CAST "pathname_new",BAD_CAST pathname_new);
+               xmlNewProp(xml_action,BAD_CAST "force_replace",BAD_CAST captive_printf_alloca("%u",(unsigned)force_replace));
                }
 
        Captive_File_move(captive_file_parent_object_old->corba_File_object,pathname_new,force_replace,&captive_corba_ev);
        r=captive_sandbox_parent_return_from_CORBA_Environment(&captive_corba_ev,captive_vfs_parent_object);
        if (xml_action)
-               xmlNewProp(xml_action,"result",gnome_vfs_result_to_string(r));
+               xmlNewProp(xml_action,BAD_CAST "result",BAD_CAST gnome_vfs_result_to_string(r));
        if (r!=GNOME_VFS_OK)
                return r;