When attempting to create a file using fopen() without a full pathname (ex. “test.txt”, I noticed that the fopen() returns NULL. When I give a full pathname (ex. “c:\testdir\test.txt”) the fopen() succeeds.
Does anyone know why this occurs under UMDF?
What’s the value of errno? I assume that errno exists. Persumably, it
can not find the file without a path. I haven’t any idea of what a UMDF
driver considers the current directory.
mm
xxxxx@aeshen.com wrote:
When attempting to create a file using fopen() without a full pathname (ex. “test.txt”, I noticed that the fopen() returns NULL. When I give a full pathname (ex. “c:\testdir\test.txt”) the fopen() succeeds.
Does anyone know why this occurs under UMDF?
IIRC, the current working directory is %windir%\system32 and as a UMDF driver you do not have sufficient rights to open a file in this directory. You should be explicit with your paths regardless of this problem, if another driver in the stack changes the current working directory, you will get unexpected results if you use a relative path.
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Martin O’Brien
Sent: Tuesday, October 30, 2007 4:45 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Why does a filename without a path fail under UMDF?
What’s the value of errno? I assume that errno exists. Persumably, it
can not find the file without a path. I haven’t any idea of what a UMDF
driver considers the current directory.
mm
xxxxx@aeshen.com wrote:
When attempting to create a file using fopen() without a full pathname (ex. “test.txt”, I noticed that the fopen() returns NULL. When I give a full pathname (ex. “c:\testdir\test.txt”) the fopen() succeeds.
Does anyone know why this occurs under UMDF?
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Thanks for the feedback. This is good advice.
What about writing to the root directory (ex. c:). I notice that my UMDF driver fails when creating a file here. Where are the non-legitimate areas fora UMDF driver to write documented? Note that I am using SECURITY IMPERSONATION of a user with Administrator rights.
I think that the root of the system driver is protected by UAC which is why you cannot write there
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@aeshen.com
Sent: Wednesday, October 31, 2007 10:30 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Why does a filename without a path fail under UMDF?
Thanks for the feedback. This is good advice.
What about writing to the root directory (ex. c:). I notice that my UMDF driver fails when creating a file here. Where are the non-legitimate areas fora UMDF driver to write documented? Note that I am using SECURITY IMPERSONATION of a user with Administrator rights.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
I would never rely on current directory in anything but simple command-line
apps. What is the current directory for UMDF is a random thing I think.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
wrote in message news:xxxxx@ntdev…
> When attempting to create a file using fopen() without a full pathname (ex.
“test.txt”, I noticed that the fopen() returns NULL. When I give a full
pathname (ex. “c:\testdir\test.txt”) the fopen() succeeds.
>
> Does anyone know why this occurs under UMDF?
>