I think what you are describing is a way for, essentially, a non
programmer dictate that action of a file system driver, on a per process
basis? I can’t say that I have a better idea that this. That being
said, the idea of having a file system that may or may not be writeable
modify it’s behavior based on environment variables with, essentially,
arbitrary values, but hardcoded names is about as unsafe a practice as I
could imagine. Someone is going to have to write some real code in
order for this to have a prayer of being workable.
>> xxxxx@tawacentral.net 2006-05-01 14:18:23 >>>
Thanks Doron.
I am still in the exploratory phase, so I am trying to see what is
feasible
and what is not. As you say, maybe there is a better way to do what I
need.
The driver I am writing is a file system driver. It is expected that
batch
files will be written that call programs that work on files in my file
system. These programs cannot be expected to make special calls
specific to
my driver.
So one of the avenues I am investigating is the use of environment
variables. In the scenarios I am interested in, I assume the
programmer is
programming in the batch file language, and he *does* know that he is
programming to my file system. He may want to set options in the file
system driver for the programs he is calling, but he does not want
these
options to be globally applicable to all processes running on the
machine,
or to have any side effects outside the scope of the batch file.
So one option I am looking into is environment variables. The
programmer
could write a batch file like this:
@echo off
setlocal
set FS_OPTION1=value1
set FS_OPTION2=value2
notepad P:\file.txt
So when notepad opens file.txt (assuming P: is my file system), my
file
system driver will use the two options as specified. When the batch
file
ends, the options go away. Batch files can call other batch files
with
different options without side effects.
(The “no side effects” comment depends on batch files calling setlocal
correctly, but this is a reasonable expectation for my scenarios)
I am new to driver development, so maybe there is a better way to pass
non-global, out-of-band information like this to my driver. The local
context for this information should be a process. All suggestions
welcome.
Thanks.
=================================================
Roger Tawa
http://tawacentral.net/
[One thing about paradigms: shift happens.]
[When you stop, you’re done.]
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, May 01, 2006 13:15
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] reading environment variables from a kernel
driver
No, there is no documented way to do this. Furthermore, env vars are
not to be trusted. Anyone/thing in the process can change them and
any
application that launches the batch file can change the batch file
itself.
Even if you were able to get the env var, what decision in your driver
would you make with that information? Perhaps there is a better way
to
do what you want in a documented fashion.
d
– I can spell, I just can’t type.
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roger Tawa
Sent: Monday, May 01, 2006 10:03 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] reading environment variables from a kernel driver
Hi all,
I would like to know if there is a way for a kernel driver to access
the
environment variables of the process which is calling the driver’s
entry
point. Specifically, if a user runs a batch file which sets some
environment variables, and then executes a program (which inherits
these
variables) that calls into the driver, can get the driver get to the
environment?
I found this thread on the NTFSD list (which people were commenting
was
out
of place there):
http://www.osronline.com/showThread.cfm?link=87350
but there is no answer in there anyway. I also did not find anything
by
searching this list or Google.
There is a win32 api called GetEnvironmentVariable(), but I could not
find
an equivalent kernel level call.
Thanks.
=================================================
Roger Tawa
http://tawacentral.net/
[One thing about paradigms: shift happens.]
[When you stop, you’re done.]
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer