OSRLogoOSRLogoOSRLogo x Seminar Ad

Everything Windows Driver Development

GoToHomePage xLoginx

    Sat, 23 Feb 2019     118020 members


  Online Dump Analyzer
OSR Dev Blog
The NT Insider
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

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