problem with ZwQueryDirectoryFile

This is a discussion on problem with ZwQueryDirectoryFile within the Windows Programming forums, part of the Platform Specific Boards category; at a certain point it returns STATUS_PENDING,i can retry the call but it still continues returning that error,forever i always ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    69

    problem with ZwQueryDirectoryFile

    at a certain point it returns STATUS_PENDING,i can retry the call
    but it still continues returning that error,forever

    i always set to NULL the second parameter,that is supposed to be an OPTIONAL HANDLE to an Event

    Code:
    // hDir is a valid handle to a directory,obtained via CreateFile with
    // FILE_FLAG_BACKUP_SEMANTICS
    // pNames is a buffer,and uBufSize its size
    
    int ret = NtQueryDirectoryFile(hDir,NULL,NULL,NULL,&IO,pNames,uBufSize,FileNamesInformation,FALSE,NULL,TRUE);
    perhaps i have to pass a non-NULL value as the second
    parameter, which is an handle to an event,
    and then wait for it to happen...but how i create it?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    You can create your own event HANDLE using CreateEvent. You can then pass it to your function and wait for the event to be signalled with WaitForSingleObject.

    Pseudo Code:

    HANDLE hEvent = CreateEvent( ... );

    int ret = NtQueryDirectoryFile(hDir,hEvent,NULL,NULL,&IO,pNa mes,uBufSize,FileNamesInformation,FALSE,NULL,TRUE) ;

    WaitForSingleObject( hEvent, INFINITE );
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 05:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21