Click here to Skip to main content
15,894,460 members
Articles / Programming Languages / C++

Driver to Hide Processes and Files. Second Edition: Splicing

,
Rate me:
Please Sign up or sign in to vote.
4.93/5 (33 votes)
11 Mar 2011CPOL9 min read 69.5K   8.8K   115  
This article describes a driver that hides processes and files using the method of splicing.
#ifndef HIDE_DRIVER_IOCTL_H_INCLUDED
#define HIDE_DRIVER_IOCTL_H_INCLUDED

/* This file defines Input-Output Control Codes to communicate with HideDriver. */

/*
All input strings(parameters) is UNICODE strings.
If error occur driver return ASCII string with error description.
*/

/*
Almost all IOCTLs work with hide rules.
   Hide rule support following options: 
   - Hide from list of process, this mean that only selected process
     mustn't see this process or file
   - Hide from list of users, this mean only selected users
     mustn't see this process or file
   *This options can be used together

Format of hide rule string must be: 
    process(file)_name_to_hide;access_user_name;access_process_name
    
Where: 
    process(file)_name_to_hide - process name(file path) to hide.
    access_user_name           - user's name, which mustn't see this process(file).
    access_process_name        - process's name, which mustn't see this process(file).

To insert several process or users that mustn't see this process separate it by ',' character.
Example:
    process_name_to_hide;user_name1,user_name2;process_name1,process_name2

All names support following masks:
"*" - Matches all characters
"?" - Matches any single character

Final examples:
    *;*;*        - Hide all process from all users and process. Just for fun.
    System;*;*   - Hide process system from all users and process.
    er*;*;*      - Hide all process wich name starts with "er" characters.
    System;*;Rob - Hide process "System" for User: Rob
*/


/*-----------------------------------------------------------------------*/
/*                            Process hide IOCTLs                        */

#define IOCTL_ADD_PROCESS_HIDE_RULE CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to add process hide rule to hide list.

Input string must be hide rule.
*/

#define IOCTL_DEL_PROCESS_HIDE_RULE CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to delete process hide rule from hide list.

Input string must be hide rule.
*/

#define IOCTL_CLEAR_PROCESS_HIDE_RULES CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, FILE_ANY_ACCESS)

/* 
This IOCTL used to clear process hide list.

Input string should be empty. 
*/

#define QUERY_SUCCESS 1
#define QUERY_FAIL    2

#define IOCTL_QUERY_PROCESS_HIDE_RULES CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to get process hide rule list.

Input string should be empty. 

Format of output string:
First byte contain type of information returned:
QUERY_SUCCESS or QUERY_FAIL
After this byte placed hide rules separated by '\n' character

Example:
    *;*;*\nSystem;*;* - two hide rules (*;*;*) and (System;*;*)
*/
/*-----------------------------------------------------------------------*/


/*-----------------------------------------------------------------------*/
/*                                File hide IOCTLs                       */

#define IOCTL_ADD_FILE_HIDE_RULE CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x901, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to add file hide rule to hide list.

Input string must be hide rule.
*/

#define IOCTL_DEL_FILE_HIDE_RULE CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x902, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to delete file hide rule from hide list.

Input string must be hide rule.
*/

#define IOCTL_CLEAR_FILE_HIDE_RULES CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x903, METHOD_BUFFERED, FILE_ANY_ACCESS)

/* 
This IOCTL used to clear file hide list.

Input string should be empty. 
*/

#define IOCTL_QUERY_FILE_HIDE_RULES CTL_CODE( \
    FILE_DEVICE_UNKNOWN, 0x904, METHOD_BUFFERED, FILE_ANY_ACCESS)

/*
This IOCTL used to get file hide rule list.

Input string should be empty. 

Format of output string same as in IOCTL_QUERY_PROCESS_HIDE_RULES.
*/

/*-----------------------------------------------------------------------*/


#endif // #ifndef HIDE_DRIVER_IOCTL_H_INCLUDED)

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
Chief Technology Officer Apriorit Inc.
United States United States
ApriorIT is a software research and development company specializing in cybersecurity and data management technology engineering. We work for a broad range of clients from Fortune 500 technology leaders to small innovative startups building unique solutions.

As Apriorit offers integrated research&development services for the software projects in such areas as endpoint security, network security, data security, embedded Systems, and virtualization, we have strong kernel and driver development skills, huge system programming expertise, and are reals fans of research projects.

Our specialty is reverse engineering, we apply it for security testing and security-related projects.

A separate department of Apriorit works on large-scale business SaaS solutions, handling tasks from business analysis, data architecture design, and web development to performance optimization and DevOps.

Official site: https://www.apriorit.com
Clutch profile: https://clutch.co/profile/apriorit
This is a Organisation

33 members

Written By
Technical Lead Apriorit Inc.
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions