Use the unicode string APIs. You may also be able to
use snprintf since you have the length.
— xxxxx@lenovo.com wrote:
Randy,
Thank for your helps.
You are right.The unicode strings are not always
NULL terminated,but how to
resolving this problem?Best Regards
Ken Wang
Randy Cook
> ÊÕ¼þÈË£º “Windows File Systems Devs Interest
> List”
> ·¢¼þÈË£º
>
>
> xxxxx@lis
> ³ËÍ£º
>
> ts.osr.com
> Ö÷Ì⣺ Re: [ntfsd] When System load KERNEL.dll my
> create dispatch
>
> routine intercept IRP_MJ_CREATE request,but
> impletments ZwOpenFile
>
> function,the system crash.This is why?
>
> 2005-02-04 00:38
>
>
> Çë´ð¸´ ¸ø “Windows File
>
>
> Systems Devs Interest
>
>
> List”
>
>
>
>
>
>
>
>
>
>
>
> Most likely the reason you are crashing is that you
> are not handling the reentrancy into your driver
> that
> happens when you call ZwCreateFile. You can look at
> the archives of this list for many complete
> discussions of this issue. Read the FAQ about
> shadow
> devices and search the archives for
> IoCreateFileSpecifyDeviceObjectHint or sometimes
> CreateWithHint as Neal refers to it.
>
> Also, unicode strings are not always NULL
> terminated,
> so sprintf’ing them is not safe. Things will appear
> to work for a while and then it will blow up at
> weird
> times.
>
> — xxxxx@lenovo.com wrote:
>
> >
> > I want to printing all filename,when i intercept
> > IRP_MJ_CREATE request in
> > my MySfCreate routine.
> > It’s work well,but when the current file is
> > KERNEL.DLL the system crash.Who
> > can tell me this is why?
> >
> > My MySfCreate routine code is below:
> >
> >
> > RtlInitUnicodeString( &sourceName,
> L"KERNEL32.DLL");
> > // For example
> > KERNEL.DLL or other system file
> > sprintf( chSourcePathName, “%ws”,
> > sourceName.Buffer);
> >
> > if ( savedFileObject->FileName.Buffer &&
> > !(savedFileObject->Flags &
> > FO_DIRECT_DEVICE_OPEN ) )
> > {
> > RtlCopyUnicodeString( &name,
> > &savedFileObject->FileName);
> > sprintf(chDestPathName, “%ws”,
> (&name)->Buffer
> > );
> > if ( strstr(chDestPathName, chSourcePathName)
> > != NULL )
> > {
> > sprintf(pszTmp, “sfilter - SfCreate:
> File
> > Name: %ws\n”, (&name)
> > ->Buffer );
> > WriteToLine(pszTmp, strlen(pszTmp)); //
> > print the current
> > filename to log file.
> >
> > }
> > //
> > // Print all Creating or Openning filename
> > //
> > sprintf(pszTmp, “File Name: %ws\n”,
> > (&name)->Buffer );
> > WriteToLine(pszTmp, strlen(pszTmp));
> > }
> >
> >
> > WriteToLine use ZwCreateFile,ZwWriteFile function
> to
> > Create,Write log file.
> >
> > When impletment ZwCreateFile,the system crash.
> >
> > BugCheck code is
> > UNEXPECTED_HERNEL_MODE_TRAP(0x00000008,
> > 0x00000000,0x00000000,0x00000000)
> >
> > Who can help me ?
> >
> > Best Regards
> >
> > Ken Wang
> >
> >
> >
> >
> >
> > —
> > Questions? First check the IFS FAQ at
> > https://www.osronline.com/article.cfm?id=17
> >
> > You are currently subscribed to ntfsd as:
> > xxxxx@yahoo.com
> > To unsubscribe send a blank email to
> > xxxxx@lists.osr.com
> >
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
> xxxxx@lenovo.com
> To unsubscribe send a blank email to
> xxxxx@lists.osr.com
>
>
>
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to $subst(‘List.Name’)
> as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to
$subst(‘Email.UnSub’)