IMAGE_DIRECTORY_ENTRY_RESOURCE

/*
 * Predefined Resource Types
 
*/

#define  RT_CURSOR           MAKEINTRESOURCE(1)
#define  RT_BITMAP           MAKEINTRESOURCE(2)
#define  RT_ICON             MAKEINTRESOURCE(3)
#define  RT_MENU             MAKEINTRESOURCE(4)
#define  RT_DIALOG           MAKEINTRESOURCE(5)
#define  RT_STRING           MAKEINTRESOURCE(6)
#define  RT_FONTDIR          MAKEINTRESOURCE(7)
#define  RT_FONT             MAKEINTRESOURCE(8)
#define  RT_ACCELERATOR      MAKEINTRESOURCE(9)
#define  RT_RCDATA           MAKEINTRESOURCE(10)
#define  RT_MESSAGETABLE     MAKEINTRESOURCE(11)

#define  DIFFERENCE          11
#define  RT_GROUP_CURSOR MAKEINTRESOURCE((DWORD)RT_CURSOR + DIFFERENCE)
#define  RT_GROUP_ICON   MAKEINTRESOURCE((DWORD)RT_ICON + DIFFERENCE)
#define  RT_VERSION      MAKEINTRESOURCE(16)
#define  RT_DLGINCLUDE   MAKEINTRESOURCE(17)
#if (WINVER >= 0x0400)
#define  RT_PLUGPLAY     MAKEINTRESOURCE(19)
#define  RT_VXD          MAKEINTRESOURCE(20)
#define  RT_ANICURSOR    MAKEINTRESOURCE(21)
#define  RT_ANIICON      MAKEINTRESOURCE(22)
#endif  /* WINVER >= 0x0400 */
//
//  Resource Format.
//

//
//  Resource directory consists of two counts, following by a variable length
//  array of directory entries.  The first count is the number of entries at
//  beginning of the array that have actual names associated with each entry.
//  The entries are in ascending order, case insensitive strings.  The second
//  count is the number of entries that immediately follow the named entries.
//  This second count identifies the number of entries that have 16-bit integer
//  Ids as their name.  These entries are also sorted in ascending order.
//
//  This structure allows fast lookup by either name or number, but for any
//  given resource entry only one form of lookup is supported, not both.
//  This is consistant with the syntax of the .RC file and the .RES file.
//

typedef 
struct  _IMAGE_RESOURCE_DIRECTORY  {
    DWORD   Characteristics;
    DWORD   TimeDateStamp;
    WORD    MajorVersion;
    WORD    MinorVersion;
    WORD    NumberOfNamedEntries;
    WORD    NumberOfIdEntries;
//  IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[];
}
 IMAGE_RESOURCE_DIRECTORY,  * PIMAGE_RESOURCE_DIRECTORY;

#define  IMAGE_RESOURCE_NAME_IS_STRING        0x80000000
#define  IMAGE_RESOURCE_DATA_IS_DIRECTORY     0x80000000
//
//  Each directory contains the 32-bit Name of the entry and an offset,
//  relative to the beginning of the resource directory of the data associated
//  with this directory entry.  If the name of the entry is an actual text
//  string instead of an integer Id, then the high order bit of the name field
//  is set to one and the low order 31-bits are an offset, relative to the
//  beginning of the resource directory of the string, which is of type
//  IMAGE_RESOURCE_DIRECTORY_STRING.  Otherwise the high bit is clear and the
//  low-order 16-bits are the integer Id that identify this resource directory
//  entry. If the directory entry is yet another resource directory (i.e. a
//  subdirectory), then the high order bit of the offset field will be
//  set to indicate this.  Otherwise the high bit is clear and the offset
//  field points to a resource data entry.
//

typedef 
struct  _IMAGE_RESOURCE_DIRECTORY_ENTRY  {
    union 
{
        
struct {
            DWORD NameOffset:
31;
            DWORD NameIsString:
1;
        }
;
        DWORD   Name;
        WORD    Id;
    }
;
    union 
{
        DWORD   OffsetToData;
        
struct {
            DWORD   OffsetToDirectory:
31;
            DWORD   DataIsDirectory:
1;
        }
;
    }
;
}
 IMAGE_RESOURCE_DIRECTORY_ENTRY,  * PIMAGE_RESOURCE_DIRECTORY_ENTRY;

//
//  For resource directory entries that have actual string names, the Name
//  field of the directory entry points to an object of the following type.
//  All of these string objects are stored together after the last resource
//  directory entry and before the first resource data object.  This minimizes
//  the impact of these variable length objects on the alignment of the fixed
//  size directory entry objects.
//

typedef 
struct  _IMAGE_RESOURCE_DIRECTORY_STRING  {
    WORD    Length;
    CHAR    NameString[ 
1 ];
}
 IMAGE_RESOURCE_DIRECTORY_STRING,  * PIMAGE_RESOURCE_DIRECTORY_STRING;


typedef 
struct  _IMAGE_RESOURCE_DIR_STRING_U  {
    WORD    Length;
    WCHAR   NameString[ 
1 ];
}
 IMAGE_RESOURCE_DIR_STRING_U,  * PIMAGE_RESOURCE_DIR_STRING_U;


//
//  Each resource data entry describes a leaf node in the resource directory
//  tree.  It contains an offset, relative to the beginning of the resource
//  directory of the data for the resource, a size field that gives the number
//  of bytes of data at that offset, a CodePage that should be used when
//  decoding code point values within the resource data.  Typically for new
//  applications the code page would be the unicode code page.
//

typedef 
struct  _IMAGE_RESOURCE_DATA_ENTRY  {
    DWORD   OffsetToData;
    DWORD   Size;
    DWORD   CodePage;
    DWORD   Reserved;
}
 IMAGE_RESOURCE_DATA_ENTRY,  * PIMAGE_RESOURCE_DATA_ENTRY;
 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值