Solved

FindFirstFile in kernel-mode?

Posted on 1997-11-21
5
620 Views
Last Modified: 2013-12-03
I just want to do something like a findfirstfile in kernel-mode so that I can get a directory listing using wildcards.  Is there a function already there that I can use to do this?  I looked through the ntddk.h but I couldn't find anything.  A quick snip of source code would be great.  I'm using NT 4.0
0
Comment
Question by:vinniew
  • 3
  • 2
5 Comments
 
LVL 3

Author Comment

by:vinniew
ID: 1408722
P.S. If my driver works, I'll let you try it out.  It's just going to be a command completion driver that will work throughout the system on any input box, windows or dos boxes alike.  That means that you press a key, say the capslock, and you get the filename filled in for you.
0
 
LVL 1

Accepted Solution

by:
cph earned 50 total points
ID: 1408723
Well, you could use the function AX = 714Eh of the interruption 21h (FindFirst) and the function AX = 714Fh (FindNext).
It works with the long filename.

I can give you more detail on that if you want.

Another way could be to use the function FindFirstFile, which prototype look like this:
HANDLE FindFirstFile(LPCTSTR lpFileName,
      // pointer to name of file to search for  
    LPWIN32_FIND_DATA lpFindFileData
       // pointer to returned information
);

with FindNextFile. They are both define in the win32 API and are compatible with NT.

Hope this help,

CpH
0
 
LVL 3

Author Comment

by:vinniew
ID: 1408724
Okay, let me see if I understand you.  

If I just include the FindFirstFile prototype in my single .c file that I'm using, the operating system will know what to do to find that function when it starts?  Since this is kernel-mode, I won't need to include .libs or anything?

I'm new at this...

Thanks,
V

0
 
LVL 3

Author Comment

by:vinniew
ID: 1408725
I tried to use the FindFirstFile function in my device driver, but the compiler said no way.  Are you sure you can use that win32 function in a device driver?

Thanks,

V
0
 
LVL 1

Expert Comment

by:cph
ID: 1408726
Well if I don't know if you can use the findfirstfile function provide by windows in the kernel-mode, but I don't think it will matter. In fact, its the kernel itself who defines it so it should work.
However, if it doesn't, you can still use the interrupt function which will do the same job.

Hope this help,

CpH

BTW:the import library is kernel32.lib and the header file is winbase.h.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now