about ZwWriteFile()

hi ,
I want to overwrite a string to a file in IRP_MJ_WRITE.for example,if you input “123456” to a temp.txt,the string will be shown like this: “abcdef” .
like this :
case IRP_MJ_CREATE:
ZwCreateFile(…);
ZwWriteFile(FileHandle,
NULL,
NULL,
NULL,
&Irp->IoStatus,
stringbuffer,//defined by myself
currentIrpStack->Parameters.Write.Length,
&currentIrpStack->Parameters.Write.ByteOffset,NULL);
ZwClose(FileHandle);
IoCompleteRequest(…)
return Irp->IoStatus.Status;
but I get the string is " ",which is six of 0x00(Hex) .this why?

> I use ZwWriteFile() to write something in a file system filer driver,lik

this:
case IRP_MJ_WRITE:
ZwCreateFile();
ZwWriteFile(…,buffer,…);
ZwCloseFile();
ExFreePool(buffer);
break;

First of all, using ZwCreateFile inside IRP_MJ_CREATE
is suspicious, if you don’t know damn well why are you
doing it and are not aware about all issues of such
recursion.

If the code cannot write anything, you have to
go through the code with the debugger and
try to figure out what’s wrong (look at status codes first)

L.