473,766 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_BLOC K IoStatus, IN PDEVICE_OBJECT DeviceObject)

{
PDEVICE_OBJECT nextDeviceObjec t;
PFAST_IO_DISPAT CH fastIoDispatch;

PAGED_CODE();
VALIDATE_IRQL(I rp);

if (DeviceObject->DeviceExtensio n) {

ASSERT(IS_MY_DE VICE_OBJECT( DeviceObject ));

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

nextDeviceObjec t = ((PSFILTER_DEVI CE_EXTENSION)
DeviceObject->DeviceExtensio n)->AttachedToDevi ceObject;
ASSERT(nextDevi ceObject);

fastIoDispatch = nextDeviceObjec t->DriverObject->FastIoDispatch ;

if (VALID_FAST_IO_ DISPATCH_HANDLE R( fastIoDispatch, FastIoRead ))
{

return (fastIoDispatch->FastIoRead)(
FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
nextDeviceObjec t );
}
}
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 6644
In <69************ *************** ***@localhost.t alkaboutprogram ming.com> "noe" <no*****@mixmai l.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_BLOC K IoStatus, IN PDEVICE_OBJECT DeviceObject)

{
PDEVICE_OBJECT nextDeviceObjec t;
PFAST_IO_DISPAT CH fastIoDispatch;

PAGED_CODE();
VALIDATE_IRQL(I rp);

if (DeviceObject->DeviceExtensio n) {

ASSERT(IS_MY_DE VICE_OBJECT( DeviceObject ));

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

nextDeviceObjec t = ((PSFILTER_DEVI CE_EXTENSION)
DeviceObject->DeviceExtensio n)->AttachedToDevi ceObject;
ASSERT(nextDevi ceObject);

fastIoDispatch = nextDeviceObjec t->DriverObject->FastIoDispatch ;

if (VALID_FAST_IO_ DISPATCH_HANDLE R( fastIoDispatch, FastIoRead ))
{

return (fastIoDispatch->FastIoRead)(
FileObject,
FileOffset,
Length,
Wait,
LockKey,
Buffer,
IoStatus,
nextDeviceObjec t );
}
}
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 "SfFastIoRe ad"
test.c:2: error: parse error before "PFILE_OBJE CT"
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 "nextDeviceObje ct"
test.c:8: error: `PFAST_IO_DISPA TCH' 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: `nextDeviceObje ct' undeclared (first use in this function)
test.c:21: error: `PSFILTER_DEVIC E_EXTENSION' undeclared (first use in this function)
test.c:22: error: parse error before "DeviceObje ct"
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*****@mixmai l.com> wrote in
news:f4******** *************** *******@localho st.talkaboutpro gramming.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*****@mixmai l.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_f ile_name", "r");
fout = fopen("destinat ion_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.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #5
In <f4************ *************** ***@localhost.t alkaboutprogram ming.com> "noe" <no*****@mixmai l.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*******@spam cop.net> writes:
On Wed, 26 May 2004 11:54:02 -0400, "noe" <no*****@mixmai l.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*******@spam cop.net> wrote:
#include <stdio.h>
#include <stdlib.h>

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

fin = fopen("source_f ile_name", "r");
fout = fopen("destinat ion_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*******@spam cop.net> wrote:
#include <stdio.h>
#include <stdlib.h>

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

fin = fopen("source_f ile_name", "r");
fout = fopen("destinat ion_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
5022
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 harder one: Windows. My question is: How do I implement a virtual partition that acts like a real file-system and is compleatly transparent to other programs? Should I make a virtual file allocation table for a FAT32 partition or simulate an...
2
3310
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 a couple of different directories and based upon the directory where the new file is created kick-off a process Example: File A in Directory B starts process C
1
1538
by: Muddassir | last post by:
hi everybody I am writing an application for tracking files and directory changes I used FindFirstChangeNotification FindNextChangeNotification FindCloseChangeNotification ReadDirectoryChangesW
4
1859
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 to lock-down and encrypt a hard drive. I remember back in my high school days experimenting with a low-level driver called KOH.COM that would require a password upon startup to decrypt file system files. It would be wonderful if a similar...
2
1796
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, can anyone point me to a reference? I have been hunting around, and have found lots about the principal of filter drivers, but so far nothing with a practical example. Of course, if there is another/better way I would be interested to hear it....
8
1755
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 registration of the files. It will even include only the portions of the .Net framework that are required for your application. The app is called Thinstall. the problem is the cost. $4,000 license fee PER APPLICATION PLUS A PER PC LICENSE FEE for...
2
1648
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 information that are written by using the DebugPrint function ? DebugPrint((2, "DiskPerfAddDevice: Driver %X Device %X\n", DriverObject, PhysicalDeviceObject));
0
1188
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 out a couple of experiments. Just to be clear: I am looking for something light and easy to use; I only want to implement a minifilter for file system operations, not to write an entire file system driver. Thanks.
3
2900
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 file is opened, in particular when during copy the file is modified, how can i create a "snapshot" of the file? Searching on internet i found that something can be done writing a filter driver for the file system. thank you
0
9571
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10009
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.