FlexHEX Editor - Just the Right Tool to Edit Binaries

Introduction

Files and Drives

Inspecting Data

Editing Data

Navigation

Search and Replace

Tools

Complex Data Types

Loading and Mapping

Editing Structured Data

Structure Definition

Structures

Unions

Arrays

Strings

Enumerations

Bit Structures

Basic Types

Special Fields

Advanced Features


 

 

Special Fields

There are two types of special fields: unused data and alignments.

Unused Data

The unused keyword may be used in a structure or a bit structure, and lets you skip data which is not used or just not important. The declaration syntax is

unused[number];

where number the number of bytes or bits to skip. In the following example

struct DocumentRecord {
  byte enum { Complete, NeedsReview, OutOfDate } Status;
  unused[3];
  FILETIME CreationTime;
  char szName[];
};

three bytes at offsets 1 to 3 contain no useful data and should be skipped.

The unused keyword serves the same purpose in bit structures except it forces skipping bits, not bytes:

byte bitstruct FlagByte {
  unused[1];
  Valid[1];
  Locked[1];
  unused[2];
  nLocks[3];
};

Alignments

The alignment directive can occur within a structure definition and has two forms:

align address[number]
align offset[number]

The number in the square brackets specifies alignment of the next field. The first form aligns the address of the field when the structure is mapped; the second form aligns the offset from the start of the structure. The offset alignment does not depend on structure mapping unless some previous field is of a variable size.

struct DocumentRecord {
  byte enum { Complete, NeedsReview, OutOfDate } Status;
  align offset [4];	// Align to doubleword boundary
  FILETIME CreationTime;
  char szName[];
};

The size of the alignment operator varies from 0 to number minus 1. The alignment value may be any positive value, not necessarily a power of two.

 

 
Copyright © 2007 Inv Softworks LLC
All rights reserved
 
Home | Product | Download | Order | Support | Documentation | Company