Hello Dejan,Randy Cook
Thank you very much for the information, it was really helpful ! I am able to hide the files in win 98 as well :). And for the first file the problem is coming only if I search that particular file. e.g. if I do
dir hide*
and if thats the only file in the directory. For now I have called the function to IFSFN_FINDCLOSE in IFSFN_FINDOPEN, to hide the first file. Actually I did tried calling function for IFSFN_FINDNEXT, but it was again returning me the first file and not the second file and I dont know why.
So the drawback is that if e.g. in a directory there are more files with pattern lets say hide*, and If I havd to hide the first file, after calling IFSFN_FINDCLOSE in IFSFN_FINDOPEN, none of the other files are visible. But If I simply do “dir *” in that directory then I am able to view all the files except the file which I wanted to hide.
So thats fine for now. I will try some thing more and If any problem I’ll come back to you. 
Now the other problem that I am facing is that If some one uses the 8.3 file format, then the files are visible…So it is only working for long file names…to I am trying to find out a way for that as well …
One Question: In win nt if for hiding the first file I am trying to use the method mentioned by Randy Cook, that is to move the first valid file at the biginning of the buffer instead of changing the address. But if I want to hide all the files in that buffer, then cant I just not put NULL as I have already mention? As this is functionally working, what are the problems that you can foresee ?
Thanks,
Ashish
Dejan Maksimovic wrote:
OUCH!
> The trap function (TrapDirectoryInfo) that I have mentioned runs at
> IRQL PASSIVE_LEVEL. When I make a call to the fuction, which looks if
> the current directory/file matches with the ones in the memory, it
> runs at IRQL DISPATCH_LEVEL.
Yes, it is because of spin locks. There is no need to use spin
locks here. SL are used IFF (if and ONLY if) the memory is to be
accessed at DISPATCH_LEVEL (in FSF this virtually mean if it is accessed
from a completion routine).
If you use SL use non paged memory - if not using SL, ERESOURCE
is the way to go.
> 1) hiding the first file in the buffer
> Lets say there are 5 files in the buffer, and I have to hide the
> first file/folder, In this case currently I am simply moving the
> address in the userbuffer/mdl ahead and pointing it to the next file
> in the buffer.
WOW! Wait a second - are you changing the Irp->UserBuffer or
Irp->MdlAddress from the original? You can do this while you are in your
IRP_MJ_xxx handler but you must change it back to what it was - you can
change the buffer data but not the address.
> 2) hiding all files in the buffer
> If I find that all the files/folders have to be hidden, then I am
> putting NULL in userbuffer/MDL.
Again same as above.
> 1) If I decide to use non-paged memory, then how much of non-paged
> kernel mem can I use ?
Like I said in my previous post, unless the programmer/user is
stupid enough to select 100,000+ files inside a directory instead of
directory itself (using wildcards) then you will be OK.
> 2) I have created a structure (linked list) to store the path
> information. The memory is dynamically allocated from nonpagedpool,
> will this cause any mem problem ?, I mean this memory wont be
> continuous, but would be scattered (this is what I feel, I am not
> sure)
Do not worry about it.
> It would be also gr8 if some one tells me if there is any way to
> traverse the memory looking for files and directory in a directory in
> Win 98, as i am doing it on Win NT
Yes, the only thing that is a bit hard for 9x is figuring how to
hide the first file.
What you do in Win9x is to trap IFSFN_FINDOPEN and
IFSFN_FINDNEXT. Let the call through, check the file name you got (you
get a single file name per call as opposed to multiple file names on NT)
and if you need to hide it, just call the function again.
Pitfalls:
During IFSFN_FINDOPEN you can’t just call the function again -
you have to call the IFSFN_FINDNEXT handler.
Do not forget to handle error returns:-)
–
Kind regards, Dejan M. MVP for DDK
http://www.alfasp.com E-mail: xxxxx@alfasp.com
Alfa Transparent File Encryptor - Transparent file encryption services.
Alfa File Protector - File protection and hiding library for Win32
developers.
Alfa File Monitor - File monitoring library for Win32 developers.
—
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
---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing