473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Developing a File System filter Driver

noe
Hello all devs!!

I’m a student and I’m developing my Final Project in the University. I
have to develop a driver for Windows XP that work so:
I have a file in the HD (NTFS file system) of my PC and I want to copy it
to the floppy disk (FAT16 file system). But I need that the file data in
the floppy disk is modified (added 1 respect to the original value).
For example:

I have-> HD file data: ‘hello’
I need to obtain -> Floppy file data: ‘ifmmp’

I know I have to write a File System Filter Driver.
I’m working about the sample code ‘sfilter.c’ of IFS Kit.
I think that one of the routines which will be modified is this:

BOOLEAN
SfFastIoRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset,
IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)

{
PDEVICE_OBJECT nextDeviceObject;
PFAST_IO_DISPATCH fastIoDispatch;

PAGED_CODE();
VALIDATE_IRQL(Irp);

if (DeviceObject->DeviceExtension) {

ASSERT(IS_MY_DEVICE_OBJECT( DeviceObject ));

//
// Pass through logic for this type of Fast I/O
//

nextDeviceObject = ((PSFILTER_DEVICE_EXTENSION)
DeviceObject->DeviceExtension)->AttachedToDeviceObject;
ASSERT(nextDeviceObject);

fastIoDispatch = nextDeviceObject->DriverObject->FastIoDispatch;

if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoRead ))
{

return (fastIoDispatch->FastIoRead)(
FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
nextDeviceObject );
}
}
return FALSE;
}

I suppose what I have to modify is the parameter “buffer” but I’m not sure
and I don’t know how I have to do.

It’s the first time I face a problem so serious because I have never
worked with drivers.
Please, could you help me?
Thanks a lot
Nov 14 '05 #1
8 6627
In <69******************************@localhost.talkab outprogramming.com> "noe" <no*****@mixmail.com> writes:
BOOLEAN
SfFastIoRead (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset,
IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer,
OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)

{
PDEVICE_OBJECT nextDeviceObject;
PFAST_IO_DISPATCH fastIoDispatch;

PAGED_CODE();
VALIDATE_IRQL(Irp);

if (DeviceObject->DeviceExtension) {

ASSERT(IS_MY_DEVICE_OBJECT( DeviceObject ));

//
// Pass through logic for this type of Fast I/O
//

nextDeviceObject = ((PSFILTER_DEVICE_EXTENSION)
DeviceObject->DeviceExtension)->AttachedToDeviceObject;
ASSERT(nextDeviceObject);

fastIoDispatch = nextDeviceObject->DriverObject->FastIoDispatch;

if (VALID_FAST_IO_DISPATCH_HANDLER( fastIoDispatch, FastIoRead ))
{

return (fastIoDispatch->FastIoRead)(
FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
nextDeviceObject );
}
}
return FALSE;
}


Please do not post garbage to this newsgroup. If I try to compile your
code, this is what I get:

fangorn:~/tmp 177> gcc -c test.c
test.c:2: error: parse error before "SfFastIoRead"
test.c:2: error: parse error before "PFILE_OBJECT"
test.c: In function `SfFastIoRead':
test.c:7: error: `PDEVICE_OBJECT' undeclared (first use in this function)
test.c:7: error: (Each undeclared identifier is reported only once
test.c:7: error: for each function it appears in.)
test.c:7: error: parse error before "nextDeviceObject"
test.c:8: error: `PFAST_IO_DISPATCH' undeclared (first use in this function)
test.c:11: error: `Irp' undeclared (first use in this function)
test.c:13: error: `DeviceObject' undeclared (first use in this function)
test.c:21: error: `nextDeviceObject' undeclared (first use in this function)
test.c:21: error: `PSFILTER_DEVICE_EXTENSION' undeclared (first use in this function)
test.c:22: error: parse error before "DeviceObject"
test.c:25: error: `fastIoDispatch' undeclared (first use in this function)
test.c:27: error: `FastIoRead' undeclared (first use in this function)
test.c:31: error: `FileObject' undeclared (first use in this function)
test.c:32: error: `FileOffset' undeclared (first use in this function)
test.c:33: error: `Length' undeclared (first use in this function)
test.c:34: error: `Wait' undeclared (first use in this function)
test.c:35: error: `LockKey' undeclared (first use in this function)
test.c:36: error: `Buffer' undeclared (first use in this function)
test.c:37: error: `IoStatus' undeclared (first use in this function)
test.c:41: error: `FALSE' undeclared (first use in this function)

Furthermore, none of these diagnostics could be fixed by the inclusion of
any standard header, so your code is beyond any hope in this newsgroup.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #2
noe
Obviously it's only a part of the sample code. If you want to see the
complete code you have to check "sfilter.c" from the samples of IFS Kit.

Nov 14 '05 #3
"noe" <no*****@mixmail.com> wrote in
news:f4******************************@localhost.ta lkaboutprogramming.com:
Obviously it's only a part of the sample code. If you want to see the
complete code you have to check "sfilter.c" from the samples of IFS Kit.


So what? This is system specific stuff - off-topic here.

--
- Mark ->
--
Nov 14 '05 #4
On Wed, 26 May 2004 11:54:02 -0400, "noe" <no*****@mixmail.com> wrote
in comp.lang.c:
Hello all devs!!

I’m a student and I’m developing my Final Project in the University. I
have to develop a driver for Windows XP that work so:
I have a file in the HD (NTFS file system) of my PC and I want to copy it
to the floppy disk (FAT16 file system). But I need that the file data in
the floppy disk is modified (added 1 respect to the original value).
For example:

I have-> HD file data: ‘hello’
I need to obtain -> Floppy file data: ‘ifmmp’


[snip vast amounts of off-topic code that look more like Visual Basic
than C]

There is no need whatsoever for this to be a driver program. Plain
old ordinary C FILE * streams will do this quite nicely.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
FILE *fin, *fout;
int ch;

fin = fopen("source_file_name", "r");
fout = fopen("destination_file_name", "w");

if (!fin || !fout)
{
puts("error opening files!");
return EXIT_FAILURE;
}

while ((ch = fgetc(fin)) != EOF)
{
fputc(ch + 1, fout);
}
fclose(fin);
fclose(fout);
return EXIT_SUCCESS;
}

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #5
In <f4******************************@localhost.talkab outprogramming.com> "noe" <no*****@mixmail.com> writes:
Obviously it's only a part of the sample code. If you want to see the
complete code you have to check "sfilter.c" from the samples of IFS Kit.


1. How can you expect any advice without posting the complete code?

2. My point was that the code is not written in portable C, so you have
posted it in the wrong newsgroup.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #6
In <n8********************************@4ax.com> Jack Klein <ja*******@spamcop.net> writes:
On Wed, 26 May 2004 11:54:02 -0400, "noe" <no*****@mixmail.com> wrote
in comp.lang.c:
Hello all devs!!

I’m a student and I’m developing my Final Project in the University. I
have to develop a driver for Windows XP that work so:
I have a file in the HD (NTFS file system) of my PC and I want to copy it
to the floppy disk (FAT16 file system). But I need that the file data in
the floppy disk is modified (added 1 respect to the original value).
For example:

I have-> HD file data: ‘hello’
I need to obtain -> Floppy file data: ‘ifmmp’


[snip vast amounts of off-topic code that look more like Visual Basic
than C]

There is no need whatsoever for this to be a driver program. Plain
old ordinary C FILE * streams will do this quite nicely.


Not if you want the filtering to happen *transparently*. If the filter
must be hooked into the OS, it must fit into the hooks provided for this
purpose. This is what makes the post off topic here. Once the OS
interfacing issues are understood, the actual filtering is one of the
most trivial things one can imagine.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #7
On Wed, 26 May 2004 -0500, Jack Klein <ja*******@spamcop.net> wrote:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
FILE *fin, *fout;
int ch;

fin = fopen("source_file_name", "r");
fout = fopen("destination_file_name", "w");

if (!fin || !fout)
{
puts("error opening files!");
return EXIT_FAILURE;
}


if fin==NULL and fout!=NULL and no exit()
does it mean that "fout" is open afther the end of
the programme?

Nov 14 '05 #8
RoSsIaCrIiLoIA <n@esiste.ee> wrote:
On Wed, 26 May 2004 -0500, Jack Klein <ja*******@spamcop.net> wrote:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
FILE *fin, *fout;
int ch;

fin = fopen("source_file_name", "r");
fout = fopen("destination_file_name", "w");

if (!fin || !fout)
{
puts("error opening files!");
return EXIT_FAILURE;
}


if fin==NULL and fout!=NULL and no exit()
does it mean that "fout" is open afther the end of
the programme?


No, returning from main does the same thing as calling exit.

--
Michael
Nov 14 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Atila Olah | last post by:
I'm working on a project to implement a simple cross-platform file sharing protocol (using Python) that is similar to HTTP, and I have to write a GUI for Windows and Linux. But let's start with the...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
1
by: Muddassir | last post by:
hi everybody I am writing an application for tracking files and directory changes I used FindFirstChangeNotification FindNextChangeNotification FindCloseChangeNotification...
4
by: Alan Samet | last post by:
Is there a way to easily and securely use the Windows Encrypted File System (EFS) with IIS and ASP.NET? Alternatively, I would prefer to find some sort of totally encrypted low-level device driver...
2
by: Charles Law | last post by:
I want to intercept operations on serial ports (much like PortMon from SysInternals), and I think I need a filter driver. Is that correct, and can one be written in VB.NET? If it is possible,...
8
by: wally | last post by:
There is a brilliant application that allows you to wrap your EXE and all associated DLLs, OCXs, etc. into a single executable and run the executable on Windows OSs with no install and nor...
2
by: hugomind | last post by:
Hi, I've downloaded den Microsoft DDK 3790.1830 and there is an example under 3790.1830\src\storage\filters\diskperf I've compiled this one and would like to know where I could find the...
0
by: stanbogdan | last post by:
Hello, Does anyone know of a free/cheap alternative to the Microsoft IFS kit for developing a file system filter for Windows? The IFS kit is quite expensive and is not worth buying just for trying...
3
by: catoblepa80 | last post by:
Good morning, i'm developing an application for my company, in particular i have this need.. i have to copy a file from a place to another (tipically a network storage). i have the problem when the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.