Rely on RTL when possible. Spotted by Thomas.

svn path=/trunk/; revision=62799
This commit is contained in:
Pierre Schweitzer 2014-04-19 11:03:26 +00:00
parent 4684054570
commit ad56db3061
2 changed files with 5 additions and 9 deletions

View file

@ -215,15 +215,14 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
{
/* it's root : complete essentials fields then return ok */
RtlZeroMemory(Fcb, sizeof(FCB));
RtlInitEmptyUnicodeString(&Fcb->PathName, Fcb->PathNameBuffer, sizeof(Fcb->PathNameBuffer));
Fcb->PathNameBuffer[0] = '\\';
Fcb->PathName.Length = sizeof(WCHAR);
Fcb->ObjectName = &Fcb->PathNameBuffer[1];
Fcb->Entry.ExtentLocationL = DeviceExt->CdInfo.RootStart;
Fcb->Entry.DataLengthL = DeviceExt->CdInfo.RootSize;
Fcb->Entry.FileFlags = 0x02; //FILE_ATTRIBUTE_DIRECTORY;
Fcb->PathName.Length = sizeof(WCHAR);
Fcb->PathName.MaximumLength = sizeof(Fcb->PathNameBuffer);
Fcb->PathName.Buffer = Fcb->PathNameBuffer;
if (pDirIndex)
*pDirIndex = 0;
@ -308,9 +307,8 @@ CdfsFindFile(PDEVICE_EXTENSION DeviceExt,
{
if (Parent->PathName.Buffer[0])
{
RtlCopyUnicodeString(&Fcb->PathName, &Parent->PathName);
len = Parent->PathName.Length / sizeof(WCHAR);
memcpy(Fcb->PathName.Buffer, Parent->PathName.Buffer, Parent->PathName.Length);
Fcb->PathName.Length = Parent->PathName.Length;
Fcb->ObjectName=&Fcb->PathName.Buffer[len];
if (len != 1 || Fcb->PathName.Buffer[0] != '\\')
{
@ -576,8 +574,7 @@ CdfsQueryDirectory(PDEVICE_OBJECT DeviceObject,
DeviceExtension = DeviceObject->DeviceExtension;
Stack = IoGetCurrentIrpStackLocation(Irp);
FileObject = Stack->FileObject;
TempFcb.PathName.Buffer = TempFcb.PathNameBuffer;
TempFcb.PathName.MaximumLength = sizeof(TempFcb.PathNameBuffer);
RtlInitEmptyUnicodeString(&TempFcb.PathName, TempFcb.PathNameBuffer, sizeof(TempFcb.PathNameBuffer));
Ccb = (PCCB)FileObject->FsContext2;
Fcb = (PFCB)FileObject->FsContext;

View file

@ -73,8 +73,7 @@ CdfsCreateFCB(PCWSTR FileName)
if(!Fcb) return NULL;
RtlZeroMemory(Fcb, sizeof(FCB));
Fcb->PathName.Buffer = Fcb->PathNameBuffer;
Fcb->PathName.MaximumLength = sizeof(Fcb->PathNameBuffer);
RtlInitEmptyUnicodeString(&Fcb->PathName, Fcb->PathNameBuffer, sizeof(Fcb->PathNameBuffer));
if (FileName)
{