 |
|
 |
|
Next: System freeze on file copy
|
| Author |
Message |
External

Since: Nov 14, 2003 Posts: 3
|
(Msg. 1) Posted: Thu Sep 16, 2004 9:24 am
Post subject: Read a file currently beeing used by a driver Archived from groups: microsoft>public>development>device>drivers, others (more info?)
|
|
|
Hi
In my driver, I do log some data in af file on the harddrive. It would be
nice to read the file with notepad, will the driver still is running and
using the file.
I do have some problems doing this.
This is what I would like to do:
Read the file in eg. Notepad, while the driver stilling using the file
If the file allready exits, the driver opens the file, and append anything
new to it.
This is how I open the file in the driver
// Create the file
status = ZwCreateFile( &hLogFile,
SYNCHRONIZE,
&objectAttributes,
&IoStatus,
0,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_WRITE | FILE_SHARE_WRITE,
FILE_OPEN_IF,
FILE_SYNCHRONOUS_IO_NONALERT,
NULL,
0 );
I guess the problem is in the way I create the file, but what ?
Thomas >> Stay informed about: Read a file currently beeing used by a driver |
|
| Back to top |
|
 |  |
External

Since: Sep 16, 2004 Posts: 1
|
(Msg. 2) Posted: Thu Sep 16, 2004 1:28 pm
Post subject: Re: Read a file currently beeing used by a driver [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Thomas Johansen wrote:
> Hi
>
> In my driver, I do log some data in af file on the harddrive. It would be
> nice to read the file with notepad, will the driver still is running and
> using the file.
> I do have some problems doing this.
>
> This is what I would like to do:
> Read the file in eg. Notepad, while the driver stilling using the file
> If the file allready exits, the driver opens the file, and append anything
> new to it.
>
> This is how I open the file in the driver
>
> // Create the file
> status = ZwCreateFile( &hLogFile,
> SYNCHRONIZE,
> &objectAttributes,
> &IoStatus,
> 0,
> FILE_ATTRIBUTE_NORMAL,
> FILE_SHARE_WRITE | FILE_SHARE_WRITE,
> FILE_OPEN_IF,
> FILE_SYNCHRONOUS_IO_NONALERT,
> NULL,
> 0 );
>
> I guess the problem is in the way I create the file, but what ?
>
> Thomas
>
>
Hi,
Just a guess, but shouldn't that be:
FILE_SHARE_WRITE | FILE_SHARE_READ
Max Bolingbroke<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Read a file currently beeing used by a driver |
|
| Back to top |
|
 |  |
External

Since: Sep 16, 2004 Posts: 1
|
(Msg. 3) Posted: Thu Sep 16, 2004 3:38 pm
Post subject: Re: Read a file currently beeing used by a driver [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
I have a vague memory that the last time I looked into this I ultimately
discovered that Notepad wasn't opening the file for SHARE access, so it
was failing because it couldn't get exclusive access... but this was a
long time ago, so my memory could be faulty.
I do remember writing my own app that opens the file "the right way" and
getting it to work...
Thomas Johansen wrote:
> Hi
>
> In my driver, I do log some data in af file on the harddrive. It would be
> nice to read the file with notepad, will the driver still is running and
> using the file.
> I do have some problems doing this.
>
> This is what I would like to do:
> Read the file in eg. Notepad, while the driver stilling using the file
> If the file allready exits, the driver opens the file, and append anything
> new to it.
>
> This is how I open the file in the driver
>
> // Create the file
> status = ZwCreateFile( &hLogFile,
> SYNCHRONIZE,
> &objectAttributes,
> &IoStatus,
> 0,
> FILE_ATTRIBUTE_NORMAL,
> FILE_SHARE_WRITE | FILE_SHARE_WRITE,
> FILE_OPEN_IF,
> FILE_SYNCHRONOUS_IO_NONALERT,
> NULL,
> 0 );
>
> I guess the problem is in the way I create the file, but what ?
>
> Thomas
>
>
--
.../ray\..
Please remove ".spamblock" from my email address if you need to contact
me outside the newsgroup.<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Read a file currently beeing used by a driver |
|
| Back to top |
|
 |  |
External

Since: Apr 08, 2004 Posts: 1
|
(Msg. 4) Posted: Thu Sep 16, 2004 6:15 pm
Post subject: Re: Read a file currently beeing used by a driver [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Ray,
You are right... Most of the Microsoft Apps don't open for share... I just
ran into this (again) with log files from an app that are CSV and if you
open them in Excel they are write locked... <sigh> and yeah my workaround
was to add yet another dialog to this app to read the logs....
The sad thing here for the OP (and me) is that if I don't change the file
extent and someone DOES open the files in Notepad (or Excel) we're
screwed.. <sigh>
Dave (who's out in App land this month not DDK)
"Ray Trent" <rat RemoveThis @synaptics.spamblock.com> wrote in message
news:%23BlH1VDnEHA.3868@TK2MSFTNGP11.phx.gbl...
>I have a vague memory that the last time I looked into this I ultimately
>discovered that Notepad wasn't opening the file for SHARE access, so it was
>failing because it couldn't get exclusive access... but this was a long
>time ago, so my memory could be faulty.
>
> I do remember writing my own app that opens the file "the right way" and
> getting it to work...
>
> Thomas Johansen wrote:
>> Hi
>>
>> In my driver, I do log some data in af file on the harddrive. It would be
>> nice to read the file with notepad, will the driver still is running and
>> using the file.
>> I do have some problems doing this.
>>
>> This is what I would like to do:
>> Read the file in eg. Notepad, while the driver stilling using the file
>> If the file allready exits, the driver opens the file, and append
>> anything
>> new to it.
>>
>> This is how I open the file in the driver
>>
>> // Create the file
>> status = ZwCreateFile( &hLogFile,
>> SYNCHRONIZE,
>> &objectAttributes,
>> &IoStatus,
>> 0,
>> FILE_ATTRIBUTE_NORMAL,
>> FILE_SHARE_WRITE | FILE_SHARE_WRITE,
>> FILE_OPEN_IF,
>> FILE_SYNCHRONOUS_IO_NONALERT,
>> NULL,
>> 0 );
>>
>> I guess the problem is in the way I create the file, but what ?
>>
>> Thomas
>>
>>
>
> --
> ../ray\..
>
> Please remove ".spamblock" from my email address if you need to contact me
> outside the newsgroup.<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Read a file currently beeing used by a driver |
|
| Back to top |
|
 |  |
External

Since: Dec 20, 2003 Posts: 14
|
(Msg. 5) Posted: Thu Sep 16, 2004 10:28 pm
Post subject: Re: Read a file currently beeing used by a driver [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
OLE-based Office apps surely open files exclusively, and require byte range
locking (they fail on FSDs with no such locking. MSI Installer also fails).
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim DeleteThis @storagecraft.com
<a style='text-decoration: underline;' href="http://www.storagecraft.com" target="_blank">http://www.storagecraft.com</a>
"Dave August" <august DeleteThis @NOSPAMacmesi.com> wrote in message
news:eF90WsEnEHA.3564@tk2msftngp13.phx.gbl...
> Ray,
>
> You are right... Most of the Microsoft Apps don't open for share... I just
> ran into this (again) with log files from an app that are CSV and if you
> open them in Excel they are write locked... <sigh> and yeah my workaround
> was to add yet another dialog to this app to read the logs....
>
> The sad thing here for the OP (and me) is that if I don't change the file
> extent and someone DOES open the files in Notepad (or Excel) we're
> screwed.. <sigh>
>
> Dave (who's out in App land this month not DDK)
>
>
> "Ray Trent" <rat DeleteThis @synaptics.spamblock.com> wrote in message
> news:%23BlH1VDnEHA.3868@TK2MSFTNGP11.phx.gbl...
> >I have a vague memory that the last time I looked into this I ultimately
> >discovered that Notepad wasn't opening the file for SHARE access, so it was
> >failing because it couldn't get exclusive access... but this was a long
> >time ago, so my memory could be faulty.
> >
> > I do remember writing my own app that opens the file "the right way" and
> > getting it to work...
> >
> > Thomas Johansen wrote:
> >> Hi
> >>
> >> In my driver, I do log some data in af file on the harddrive. It would be
> >> nice to read the file with notepad, will the driver still is running and
> >> using the file.
> >> I do have some problems doing this.
> >>
> >> This is what I would like to do:
> >> Read the file in eg. Notepad, while the driver stilling using the file
> >> If the file allready exits, the driver opens the file, and append
> >> anything
> >> new to it.
> >>
> >> This is how I open the file in the driver
> >>
> >> // Create the file
> >> status = ZwCreateFile( &hLogFile,
> >> SYNCHRONIZE,
> >> &objectAttributes,
> >> &IoStatus,
> >> 0,
> >> FILE_ATTRIBUTE_NORMAL,
> >> FILE_SHARE_WRITE | FILE_SHARE_WRITE,
> >> FILE_OPEN_IF,
> >> FILE_SYNCHRONOUS_IO_NONALERT,
> >> NULL,
> >> 0 );
> >>
> >> I guess the problem is in the way I create the file, but what ?
> >>
> >> Thomas
> >>
> >>
> >
> > --
> > ../ray\..
> >
> > Please remove ".spamblock" from my email address if you need to contact me
> > outside the newsgroup.
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: Read a file currently beeing used by a driver |
|
| Back to top |
|
 |  |
| Related Topics: | any example about read/write memory direct in driver? - i have writed a device driver,when inside driver,i'm trying to read from memory location 0x03233452 or another (memory address could be any), i get a bule screen ,why? any example about read/write memory direct in driver? os:xp sp1 xpddk
driver.cab file - I was loading Windows XP and when the file driver.cab was loading I got a message that it was not able to complete the download for this file and that I could skip this file to comp;ete the download of Windows XP. I have tried three different cd-rom...
Remove a driver file at startup - Do you know how to stop XP for looking for a file ? Do you know what type of files are used at startup that is looking for this file ? When I start computer, I received the error message in a Window. \\.\DRI_KBFiltr The system cannot find the file..
File system Filter Driver Awareness Question-Please Help - Hello All Supppose one writes a Encryption file system filter driver which does On the fly encryption and decryption will it bother with the OS booting. For example if some of the OS files are encrypted then the OS will not be able to boot right. At leas...
BSSTOR.sys file here in W32 but not loaded on CD/DVD driver - My Sony DVD/CDrw player wont play DVD's anymore. I went to the Device drive info, and BSSTOR.SYS is missing a checkmark. I went to W32 on my hardrive and it is there, but by a company named BHA? Also, when I try to uninstall the drivers, it says.. |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|
 |
|
|