OSRLogo
OSRLogoOSRLogoOSRLogo x Seminar Ad
OSRLogo
x

Everything Windows Driver Development

x
x
x
GoToHomePage xLoginx
 
 

    Thu, 14 Mar 2019     118020 members

   Login
   Join


 
 
Contents
  Online Dump Analyzer
OSR Dev Blog
The NT Insider
The Basics
File Systems
Downloads
ListServer / Forum
  Express Links
  · The NT Insider Digital Edition - May-June 2016 Now Available!
  · Windows 8.1 Update: VS Express Now Supported
  · HCK Client install on Windows N versions
  · There's a WDFSTRING?
  · When CAN You Call WdfIoQueueP...ously

Querying the name of a file

When using ObQueryNameString in a driver, you should note that under some circumstances it will return STATUS_INFO_LENGTH_MISMATCH.  This is because some of the subroutines called require that the output buffer be at least as large as the OBJECT_NAME_INFORMATION buffer.

This is an issue for drivers that attempt to call with a zero-length buffer in order to determine the buffer size - it does not work in all circumstances, and this call does not tell you how big to make the buffer.

The solution to this is to use a buffer that is at least sizeof(OBJECT_NAME_INFORMATION) large on the initial call - this will ensure that the returned length is the necessary size.

User Comments
Rate this article and give us feedback. Do you find anything missing? Share your opinion with the community!
Post Your Comment

"Querying the name of a file"
But in case of sizeof(OBJECT_NAME_INFORMATION) as an initial buffer length this call returns STATUS_BUFFER_OVERFLOW, not STATUS_INFO_LENGTH_MISMATCH, but I prefer (and also strongly suggest) to check both of these error codes for reliability, and not only for this call.

Rating:
14-Apr-06, Konstantin Manurin


Post Your Comments.
Print this article.
Email this article.
bottom nav links