After several days, I finally understood the dynamic encryption and decryption of IFS.
In order that the future will not be dizzy, It is summarized as follows:
1. Encryption in sfwrite (irp_mj_write), instead of completing the routine,
Decryption is performed in sfread (irp_mj_read) instead of the completion routine,
3. You only need to process irp_nocache | irp_paging_io | irp_synchronous_paging_io
2. Simple encryption process:
A. Get the buffer address passed down by windows,
If (IRP-> mdladdress)
{
Sysdatabuf = mmgetsystemaddressformdlsafe (IRP-> mdladdress, normalpagepriority );
}
Else
{
Sysdatabuf = IRP-> userbuffer;
}
B. Save the plaintext sysdatabuf in sysdatabuffirst
C. Use your powerful algorithm to encrypt sysdatabuf --> mybuf
D. Copy mybuf to sysdatabuf,
E. iocalldriver transfers down the ciphertext and writes it to the harddisk.
F. Recover the plaintext rtlcopymemory (sysdatabuf, sysdatabuffirst, ulwritelen) of the memory );.
3. decryption process:
A. iocalldriver reads ciphertext
B. decryption
C. Iocompleterequest
My development environment:
Ifs2600,SfilterThe code is for XP SP1