Click here to Skip to main content
15,881,852 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.3K   8.8K   115  
This article describes a driver that hides processes and files using the method of splicing.
/*
 * Copyright (c) 1999, 2000
 * Boris Fomitchev
 *
 * This material is provided "as is", with absolutely no warranty expressed
 * or implied. Any use is at your own risk.
 *
 * Permission to use or copy this software for any purpose is hereby granted 
 * without fee, provided the above notices are retained on all copies.
 * Permission to modify the code and to distribute modified code is granted,
 * provided the above notices are retained, and a notice that the code was
 * modified is included with the above copyright notice.
 *
 */

/* NOTE: This is an internal header file, included by other STL headers.
 *   You should not attempt to use it directly.
 */

#ifndef _STLP_INTERNAL_WRAP_HASH_SET_H
#define _STLP_INTERNAL_WRAP_HASH_SET_H

#ifndef _STLP_INTERNAL_HASH_SET_H
# include <stl/_hash_set.h>
#endif

# ifdef _STLP_USE_NAMESPACES
namespace STLPORT { 
# endif

#  if defined (_STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS)
#   define __HS_TEMPLATE_HEADER  template <class _Value>
#   define __HS_ARGUMENTS        _Value
#   define __HS_BASE_ARGUMENTS   _Value, hash<_Value>, equal_to<_Value>, _STLP_DEFAULT_ALLOCATOR(_Value)
#  else
#   define __HS_TEMPLATE_HEADER  template <class _Value, class _HashFcn, class _EqualKey >
#   define __HS_ARGUMENTS        _Value, _HashFcn, _EqualKey
#   define __HS_BASE_ARGUMENTS   _Value, _HashFcn, _EqualKey, _STLP_DEFAULT_ALLOCATOR(_Value)
#  endif


#  define __HS_SUPER  __hash_set< __HS_BASE_ARGUMENTS >
#  define __HMS_SUPER __hash_multiset< __HS_BASE_ARGUMENTS >


// provide a "default" hash_set adaptor
__HS_TEMPLATE_HEADER
class hash_set : public __HS_SUPER 
{
  typedef hash_set< __HS_ARGUMENTS > _Self;
public:
  typedef  __HS_SUPER _Super;
  __IMPORT_WITH_ITERATORS(_Super)
  typedef typename _Super::key_type key_type;
  typedef typename _Super::hasher hasher;
  typedef typename _Super::key_equal key_equal;
  hash_set() {}
  hash_set(size_type n) : __HS_SUPER(n) {}
  hash_set(size_type n, const hasher& hf) : __HS_SUPER(n, hf) {}
  hash_set(size_type n, const hasher& hf, const key_equal& eql): __HS_SUPER(n, hf, eql) {}

  hash_set(const value_type* f, const value_type* l) : __HS_SUPER(f,l) {}
  hash_set(const value_type* f, const value_type* l, size_type n): __HS_SUPER(f,l,n) {}
  hash_set(const value_type* f, const value_type* l, size_type n,
           const hasher& hf) : __HS_SUPER(f,l,n,hf) {}
  hash_set(const value_type* f, const value_type* l, size_type n,
           const hasher& hf, const key_equal& eql) : __HS_SUPER(f,l,n,hf, eql) {}

  hash_set(const_iterator f, const_iterator l) : __HS_SUPER(f,l) { }
  hash_set(const_iterator f, const_iterator l, size_type n) : __HS_SUPER(f,l,n) { }
  hash_set(const_iterator f, const_iterator l, size_type n,
           const hasher& hf) : __HS_SUPER(f, l, n, hf) { }
  hash_set(const_iterator f, const_iterator l, size_type n,
           const hasher& hf, const key_equal& eql) : __HS_SUPER(f, l, n, hf, eql) { }
# if defined (_STLP_BASE_MATCH_BUG)
    friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& hs1, const _Self& hs2);
# endif
};

# if defined (_STLP_BASE_MATCH_BUG)
__HS_TEMPLATE_HEADER
inline bool operator==(const hash_set< __HS_ARGUMENTS >& hs1, 
                       const hash_set< __HS_ARGUMENTS >& hs2)
{
    typedef __HS_SUPER _Super;
    return (const _Super&)hs1 == (const _Super&)hs2; 
}
# endif

// provide a "default" hash_multiset adaptor
__HS_TEMPLATE_HEADER
class hash_multiset : public __HMS_SUPER
{
  typedef hash_multiset< __HS_ARGUMENTS > _Self;
public:
  typedef __HMS_SUPER _Super;
  __IMPORT_WITH_ITERATORS(_Super)
  typedef typename _Super::key_type key_type;
  typedef typename _Super::hasher hasher;
  typedef typename _Super::key_equal key_equal;

  hash_multiset() {}
  hash_multiset(size_type __n) : __HMS_SUPER(__n) {}
  hash_multiset(size_type __n, const hasher& __hf) : __HMS_SUPER(__n, __hf) {}
  hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql): __HMS_SUPER(__n, __hf, __eql) {}

  hash_multiset(const value_type* __f, const value_type* __l) : __HMS_SUPER(__f,__l) {}
  hash_multiset(const value_type* __f, const value_type* __l, size_type __n): __HMS_SUPER(__f,__l,__n) {}
  hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
           const hasher& __hf) : __HMS_SUPER(__f,__l,__n,__hf) {}
  hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
           const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f,__l,__n,__hf, __eql) {}

  hash_multiset(const_iterator __f, const_iterator __l) : __HMS_SUPER(__f,__l) { }
  hash_multiset(const_iterator __f, const_iterator __l, size_type __n) : __HMS_SUPER(__f,__l,__n) { }
  hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
           const hasher& __hf) : __HMS_SUPER(__f, __l, __n, __hf) { }
  hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
           const hasher& __hf, const key_equal& __eql) : __HMS_SUPER(__f, __l, __n, __hf, __eql) { }
# if defined (_STLP_BASE_MATCH_BUG)
  friend inline bool operator== _STLP_NULL_TMPL_ARGS (const _Self& __hs1, const _Self& __hs2);
# endif
};

# if defined (_STLP_BASE_MATCH_BUG)
__HS_TEMPLATE_HEADER
inline bool operator==(const hash_multiset< __HS_ARGUMENTS >& __hs1, 
                       const hash_multiset< __HS_ARGUMENTS >& __hs2)
{
    typedef __HMS_SUPER  __s;
    return _STLP_STD::operator==((const __s&)__hs1,(const __s&)__hs2);
}
# endif


# undef __HS_SUPER
# undef __HMS_SUPER
# undef __HS_ARGUMENTS
# undef __HS_BASE_ARGUMENTS
# undef __HS_TEMPLATE_HEADER

# ifdef _STLP_USE_NAMESPACES
} /* namespace STLPORT */
# endif

#endif /* _STLP_INTERNAL_HASH_SET_H */

// Local Variables:
// mode:C++
// End:

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