Click here to Skip to main content
15,896,726 members
Articles / Programming Languages / C

Domain authentication based on-the-fly encryption/decryption system for USB storage devices

Rate me:
Please Sign up or sign in to vote.
4.22/5 (7 votes)
27 Feb 2008CPOL8 min read 49.4K   2.5K   50  
Encrypts/Decrypts files on a USB within a domain,on the fly.
#define NT4FINAL        1381
#define MAXMEMORY       1000000

#define MAXPATHLEN      1024
#define PROCNAMELEN     20
#define NT_PROCNAMELEN  16
#define MAXFILTERS      64
#define ERRORLEN        64
typedef struct {
   FILE_SYSTEM_TYPE Type;
   PDEVICE_OBJECT   FileSystem;
   unsigned         LogicalDrive;
} HOOK_EXTENSION, *PHOOK_EXTENSION;         
typedef struct _nameentry {
   PFILE_OBJECT		FileObject;
   PCHAR		FullPathName;
   struct _nameentry 	*Next;
} HASH_ENTRY, *PHASH_ENTRY;

typedef struct _EDDrvwork {
    WORK_QUEUE_ITEM WorkItem;
    ULONG          Sequence;
    LARGE_INTEGER  TimeResult;
    CHAR           ErrString[ERRORLEN];
} EDDrv_WORK, *PEDDrv_WORK;



#define NUMHASH		0x100


#define HASHOBJECT(_fileobject)		(((ULONG)_fileobject)>>5)%NUMHASH



typedef struct _store {
    ULONG           Len;
    struct _store * Next;
    CHAR            Data[ MAX_STORE ];
} STORE_BUF, *PSTORE_BUF;



#define FASTIOPRESENT( _hookExt, _call )                                                      \
    ((((ULONG)&_hookExt->FileSystem->DriverObject->FastIoDispatch->_call -                    \
       (ULONG) &_hookExt->FileSystem->DriverObject->FastIoDispatch->SizeOfFastIoDispatch <    \
       (ULONG) _hookExt->FileSystem->DriverObject->FastIoDispatch->SizeOfFastIoDispatch )) && \
      hookExt->FileSystem->DriverObject->FastIoDispatch->_call )



extern PSHORT           NtBuildNumber;




#undef DEVICE_TYPE
typedef UCHAR  BYTE;
typedef USHORT WORD;
typedef ULONGLONG DWORDLONG;
typedef ULONG  DWORD;
typedef PVOID SID;


#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0500


#define FSCTL_PIPE_ASSIGN_EVENT          0x110000
#define FSCTL_PIPE_DISCONNECT            0x110004
#define FSCTL_PIPE_QUERY_EVENT           0x110010
#define FSCTL_PIPE_LISTEN                0x110008
#define FSCTL_PIPE_IMPERSONATE           0x11001C
#define FSCTL_PIPE_WAIT                  0x110018
#define FSCTL_PIPE_QUERY_CLIENT_PROCESS  0x110024
#define FSCTL_PIPE_SET_CLIENT_PROCESS    0x110020
#define FSCTL_PIPE_PEEK                  0x11400C
#define FSCTL_PIPE_INTERNAL_READ         0x116000
#define FSCTL_PIPE_INTERNAL_WRITE        0x119FF8
#define FSCTL_PIPE_TRANSCEIVE            0x11C017
#define FSCTL_PIPE_INTERNAL_TRANSCEIVE   0x11DFFF


#define FSCTL_MAILSLOT_PEEK              0xC4003


#define NAMED_PIPE_PREFIX                "\\\\.\\Pipe"
#define NAMED_PIPE_PREFIX_LENGTH         (sizeof(NAMED_PIPE_PREFIX)-1)

#define MAIL_SLOT_PREFIX                "\\\\.\\MailSlot"
#define MAIL_SLOT_PREFIX_LENGTH         (sizeof(MAIL_SLOT_PREFIX)-1)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) NEC HCL System Technologies Ltd, India
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions