Hi,
I am new to writing device drivers and in the process of developing an
on the fly encryption program - somewhat similar to truecrypt / pgpdisk
/ crosscrypt using KMDF.
Starting from the RamDisk sample I have supported the necessary IOCTL's
to register it with the mount manager and to allow formattting as well
as chkdsk. It has also been made into a single file system ala
filedisk. Encryption routines which work in the kernel mode have also
been implemented.
However, on adding the cryptographic routines to the EvtIoRead/Write
functions my virtual disk no longer works correctly - formatting is not
completed.
My psuedocode is as follows:
Write Function -
1. Retrieve the buffer to read from.
2. Encrypt the data in it.
3. Write the file to disk using ZwWriteFile
Read Function
1. Retrieve the buffer to write in.
2. Read the data from file using ZwReadFile
3. Decrypt the data
By removing the encrypt/decrypt state the system works properly. Am I
doing something conceptually wrong or is it an implementation flaw? Or
is what I want to do possible only using file system filter drivers? I
would prefer to avoid these if possible. Any suggestions and help would
be welcome.
Thanks.