⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cresourceripper.h

📁 pe exe packer (must use vc2005 to compile)
💻 H
字号:
// Author:   Brandon LaCombe
// Date:     February 3, 2006
// License:  Public Domain
#ifndef _RESOURCERIPPER_H
#define _RESOURCERIPPER_H

#include <windows.h>

// Used with the AddDeletionFilter and AddRetentionFilter functions. They are
// used to describe the resources they apply to.
#define FF_ID     0x01 // filter the level by id name
#define FF_STRING 0x02 // filter the level by string name
#define FF_ALL    0x08 // filter all items at that level
#define FF_ALPHA  0x10 // filters the highest alphabetic item (ids > strings)
#define FF_FIRST  0x20 // filters the first item listed
#define FF_NOT    0x04 // Can be combined with all other flags except FF_ALL.
                       // For FF_ID and FF_STRING it reverses the logic so that
                       // all non matching names are filtered. For FF_ALPHA and
                       // FF_FIRST it filters the opposite of the match. For
                       // example when combined with FF_FIRST it instead filters
                       // the last item instead of the first.

// private type definitions needed for header compilation
class CResourceRipper;
typedef struct _RESOURCEFILTER RESOURCEFILTER, *PRESOURCEFILTER;
typedef struct _RESOURCELEAF RESOURCELEAF, *PRESOURCELEAF;
typedef struct _RESOURCEPOINTERS RESOURCEPOINTERS, *PRESOURCEPOINTERS;
typedef VOID (CResourceRipper::*FILTERCALLBACK)(PRESOURCELEAF pDataLeaf);

class CResourceRipper
{
public:

    CResourceRipper();
    ~CResourceRipper();

    // interface functions
    VOID  AddDeletionFilter(DWORD dwId, DWORD dwLevel, DWORD dwFlags, PVOID pvName);
    VOID  AddRetentionFilter(DWORD dwId, DWORD dwLevel, DWORD dwFlags, PVOID pvName);
    VOID  MoveData(BOOL bMoveData);
    VOID  Strip(BOOL bStrip);
    VOID  Rip(PVOID pvFile);
    DWORD GetSize();
    VOID  Export(PVOID pvOutput, DWORD dwBaseRva);

private:

    // private functions
    VOID            AddFilter(PRESOURCEFILTER * pFilterList, DWORD dwId, DWORD dwLevel, DWORD dwFlags, PVOID pvName);
    DWORD           CountSiblings(PRESOURCELEAF pLeaf);
    PRESOURCEFILTER CreateFilter(PRESOURCEFILTER * pFilterList, DWORD dwId);
    VOID            DeleteFilters(PRESOURCEFILTER * pFilter);
    BOOL            DeleteResources(PRESOURCELEAF pLeaf, BOOL bDeleteAll);
    BOOL            DeleteLeaf(PRESOURCELEAF pLeaf);
    VOID            DeletionCallback(PRESOURCELEAF pDataLeaf);
    VOID            ExportLeaf(PRESOURCELEAF pParentLeaf, PRESOURCEPOINTERS pOutputPointers, DWORD dwBaseRva);
    VOID            ExtractResources();
    VOID            FilterResources();
    PRESOURCELEAF   FindAlphaLeaf(PRESOURCELEAF pLeaf, BOOL bNot);
    PRESOURCELEAF   FindFirstLeaf(PRESOURCELEAF pLeaf, BOOL bNot);
    PRESOURCELEAF   FindLeafByLevel(PRESOURCELEAF pDataLeaf, DWORD dwLevel);
    BOOL            IsGroupIconOrCursor(PRESOURCELEAF pDataLeaf);
    BOOL            LoadFile(PBYTE pbFile);
    PRESOURCEFILTER LocateFilter(PRESOURCEFILTER pFilterList, DWORD dwId);
    VOID            ParseGroupIconOrCursor(PRESOURCELEAF pCurrentLeaf, FILTERCALLBACK pfCallback);
    VOID            ProcessDirectory(PIMAGE_RESOURCE_DIRECTORY pDir, PRESOURCELEAF pParentLeaf);
    VOID            ProcessLeaf(PRESOURCELEAF pLeaf, PRESOURCEFILTER pFilters, FILTERCALLBACK pfCallback);
    VOID            RetentionCallback(PRESOURCELEAF pDataLeaf);
    BOOL            TestDataLeaf(PRESOURCELEAF pDataLeaf, PRESOURCEFILTER pFilters);
    BOOL            TestFilter(PRESOURCEFILTER pFilter, PRESOURCELEAF pDataLeaf);

    // member variables
    BOOL            m_bMoveData;
    BOOL            m_bNullSource;
    BOOL            m_bStrip;
    DWORD           m_dwDataSize;
    DWORD           m_dwHeaderSize;
    DWORD           m_dwStringSize;
    HANDLE          m_hHeap;
    PBYTE           m_pbFile;
    PBYTE           m_pbRsrc;
    PRESOURCEFILTER m_pDeletionFilters;
    PRESOURCEFILTER m_pRetentionFilters;
    PRESOURCELEAF   m_pResourceTree;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -