mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:22:57 +00:00
Probably getting fcb.PathName handling right this time.
svn path=/trunk/; revision=1839
This commit is contained in:
parent
8701c47012
commit
59e33e46af
2 changed files with 37 additions and 27 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.22 2001/03/13 16:25:55 dwelch Exp $
|
/* $Id: create.c,v 1.23 2001/04/29 21:08:14 cnettel Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -237,8 +237,10 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
||||||
ULONG NextCluster;
|
ULONG NextCluster;
|
||||||
WCHAR TempStr[2];
|
WCHAR TempStr[2];
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
ULONG len;
|
||||||
|
|
||||||
DPRINT ("FindFile(Parent %x, FileToFind '%S')\n", Parent, FileToFind);
|
// DPRINT ("FindFile(Parent %x, FileToFind '%S')\n", Parent, FileToFind);
|
||||||
|
DPRINT("FindFile: old Pathname %x, old Objectname %x)\n",Fcb->PathName, Fcb->ObjectName);
|
||||||
|
|
||||||
if (wcslen (FileToFind) == 0)
|
if (wcslen (FileToFind) == 0)
|
||||||
{
|
{
|
||||||
|
@ -257,8 +259,12 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
||||||
|| (FileToFind[0] == '.' && FileToFind[1] == 0))
|
|| (FileToFind[0] == '.' && FileToFind[1] == 0))
|
||||||
{
|
{
|
||||||
/* it's root : complete essentials fields then return ok */
|
/* it's root : complete essentials fields then return ok */
|
||||||
|
CHECKPOINT;
|
||||||
memset (Fcb, 0, sizeof (VFATFCB));
|
memset (Fcb, 0, sizeof (VFATFCB));
|
||||||
memset (Fcb->entry.Filename, ' ', 11);
|
memset (Fcb->entry.Filename, ' ', 11);
|
||||||
|
CHECKPOINT;
|
||||||
|
Fcb->PathName[0]='\\';
|
||||||
|
Fcb->ObjectName = &Fcb->PathName[1];
|
||||||
Fcb->entry.FileSize = DeviceExt->rootDirectorySectors * BLOCKSIZE;
|
Fcb->entry.FileSize = DeviceExt->rootDirectorySectors * BLOCKSIZE;
|
||||||
Fcb->entry.Attrib = FILE_ATTRIBUTE_DIRECTORY;
|
Fcb->entry.Attrib = FILE_ATTRIBUTE_DIRECTORY;
|
||||||
if (DeviceExt->FatType == FAT32)
|
if (DeviceExt->FatType == FAT32)
|
||||||
|
@ -269,6 +275,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
||||||
*StartSector = StartingSector;
|
*StartSector = StartingSector;
|
||||||
if (Entry)
|
if (Entry)
|
||||||
*Entry = 0;
|
*Entry = 0;
|
||||||
|
DPRINT("FindFile: new Pathname %S, new Objectname %S)\n",Fcb->PathName, Fcb->ObjectName);
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,6 +337,19 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
||||||
StartingSector, 1, block);
|
StartingSector, 1, block);
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
|
if (Parent && Parent->PathName)
|
||||||
|
{
|
||||||
|
len = wcslen(Parent->PathName);
|
||||||
|
CHECKPOINT;
|
||||||
|
memcpy(Fcb->PathName, Parent->PathName, len*sizeof(WCHAR));
|
||||||
|
Fcb->ObjectName=&Fcb->PathName[len];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Fcb->ObjectName=Fcb->PathName;
|
||||||
|
|
||||||
|
Fcb->ObjectName[0]='\\';
|
||||||
|
Fcb->ObjectName=&Fcb->ObjectName[1];
|
||||||
|
|
||||||
memcpy (&Fcb->entry, &((FATDirEntry *) block)[i],
|
memcpy (&Fcb->entry, &((FATDirEntry *) block)[i],
|
||||||
sizeof (FATDirEntry));
|
sizeof (FATDirEntry));
|
||||||
vfat_wcsncpy (Fcb->ObjectName, name, MAX_PATH);
|
vfat_wcsncpy (Fcb->ObjectName, name, MAX_PATH);
|
||||||
|
@ -338,6 +358,7 @@ FindFile (PDEVICE_EXTENSION DeviceExt, PVFATFCB Fcb,
|
||||||
if (Entry)
|
if (Entry)
|
||||||
*Entry = i;
|
*Entry = i;
|
||||||
ExFreePool (block);
|
ExFreePool (block);
|
||||||
|
DPRINT("FindFile: new Pathname %S, new Objectname %S)\n",Fcb->PathName, Fcb->ObjectName);
|
||||||
return (STATUS_SUCCESS);
|
return (STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,7 +411,7 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
PWSTR current = NULL;
|
PWSTR current = NULL;
|
||||||
PWSTR next;
|
PWSTR next;
|
||||||
PWSTR string;
|
PWSTR string;
|
||||||
PWSTR buffer; // used to store a pointer while checking MAX_PATH conformance
|
// PWSTR buffer; // used to store a pointer while checking MAX_PATH conformance
|
||||||
PVFATFCB ParentFcb;
|
PVFATFCB ParentFcb;
|
||||||
PVFATFCB Fcb, pRelFcb;
|
PVFATFCB Fcb, pRelFcb;
|
||||||
PVFATFCB Temp;
|
PVFATFCB Temp;
|
||||||
|
@ -496,7 +517,6 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
else
|
else
|
||||||
Fcb->entry.FirstCluster = 1;
|
Fcb->entry.FirstCluster = 1;
|
||||||
/* FIXME : is 1 the good value for mark root? */
|
/* FIXME : is 1 the good value for mark root? */
|
||||||
Fcb->ObjectName--;
|
|
||||||
ParentFcb = Fcb;
|
ParentFcb = Fcb;
|
||||||
DPRINT("%S filename, PathName: %S\n",FileName, ParentFcb->PathName);
|
DPRINT("%S filename, PathName: %S\n",FileName, ParentFcb->PathName);
|
||||||
Fcb = NULL;
|
Fcb = NULL;
|
||||||
|
@ -549,25 +569,15 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
else
|
else
|
||||||
Fcb = ParentFcb;
|
Fcb = ParentFcb;
|
||||||
|
|
||||||
buffer=Fcb->ObjectName;
|
if (*(Temp->ObjectName))
|
||||||
Fcb->ObjectName = Fcb->PathName + (Temp->ObjectName-Temp->PathName) + wcslen(Temp->ObjectName)+1;
|
|
||||||
// The line above should be possible to optimize. I was tired when writing it and always did something wrong
|
|
||||||
if (Fcb->ObjectName - Fcb->PathName >= MAX_PATH)
|
|
||||||
{
|
{
|
||||||
if (Fcb != NULL)
|
vfat_wcsncpy(Fcb->PathName+(Fcb->ObjectName-Fcb->PathName),Temp->PathName+(Fcb->ObjectName-Fcb->PathName), MAX_PATH);
|
||||||
ExFreePool (Fcb);
|
|
||||||
if (ParentFcb != NULL)
|
|
||||||
ExFreePool (ParentFcb);
|
|
||||||
if (AbsFileName)
|
|
||||||
ExFreePool (AbsFileName);
|
|
||||||
|
|
||||||
return STATUS_OBJECT_PATH_NOT_FOUND;
|
Fcb->ObjectName = &Fcb->PathName[wcslen(Fcb->PathName)];
|
||||||
// Which error code? It's no input buffer limit, it's the MAX_PATH limit.
|
Fcb->ObjectName[0]='\\';
|
||||||
// However, the current one is still wrong. Fix it!
|
Fcb->ObjectName=&Fcb->ObjectName[1];
|
||||||
}
|
|
||||||
wcscat(buffer, Temp->ObjectName-1);
|
|
||||||
Fcb->ObjectName[-1]='\\';
|
|
||||||
Fcb->ObjectName[0]=0;
|
Fcb->ObjectName[0]=0;
|
||||||
|
}
|
||||||
|
|
||||||
CHECKPOINT;
|
CHECKPOINT;
|
||||||
ParentFcb = Temp;
|
ParentFcb = Temp;
|
||||||
|
@ -594,7 +604,7 @@ VfatOpenFile (PDEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject,
|
||||||
|
|
||||||
Fcb = ParentFcb;
|
Fcb = ParentFcb;
|
||||||
ParentFcb = Temp;
|
ParentFcb = Temp;
|
||||||
ParentFcb->ObjectName = wcschr (ParentFcb->ObjectName, '\\');
|
ParentFcb->ObjectName = &(wcschr (ParentFcb->ObjectName, '\\'))[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
FileObject->Flags = FileObject->Flags |
|
FileObject->Flags = FileObject->Flags |
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* $Id: fat.c,v 1.23 2001/04/26 04:01:54 phreak Exp $
|
* $Id: fat.c,v 1.24 2001/04/29 21:08:14 cnettel Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <ntos/minmax.h>
|
#include <ntos/minmax.h>
|
||||||
|
|
||||||
#define NDEBUGN
|
#define NDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
#include "vfat.h"
|
#include "vfat.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue