?? cresourceripper.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 + -