Pro text/hex editor
with Binary Templates

010 Editor - Text/Hex Editor Homepage

Support for a number of different data types is built into 010 Editor. These data types are used when writing a Template (see Declaring Template Variables) or when declaring variables in a Script (see Declaring Script Variables). Commonly, a number of different names refer to the same data type (for example, 'ushort' and 'WORD' usually refer to a 16-bit unsigned integer). The following lists each of the data types and all of the names currently supported for that type:

  • 8-Bit Signed Integer - char, byte, CHAR, BYTE, int8, INT8

  • 8-Bit Unsigned Integer - uchar, ubyte, UCHAR, UBYTE, uint8, UINT8

  • 16-Bit Signed Integer - short, int16, SHORT, INT16

  • 16-Bit Unsigned Integer - ushort, uint16, USHORT, UINT16, WORD

  • 32-Bit Signed Integer - int, int32, long, INT, INT32, LONG

  • 32-Bit Unsigned Integer - uint, uint32, ulong, UINT, UINT32, ULONG, DWORD

  • 64-Bit Signed Integer - int64, quad, QUAD, INT64, __int64

  • 64-Bit Unsigned Integer - uint64, uquad, UQUAD, UINT64, QWORD, __uint64

  • 32-Bit Floating Point Number - float, FLOAT

  • 64-Bit Floating Point Number - double, DOUBLE

  • 16-Bit Floating Point Number - hfloat, HFLOAT

  • Date Types - DOSDATE, DOSTIME, FILETIME, OLETIME, time_t, time64_t (for more information on date types see Using the Inspector)

  • String Types - string (see Strings), wchar_t and wstring (see Wide Strings)

  • GUID - See GUID below.

  • Opcode - Allows incorporating the disassembler into a Template and see Disassembly in Templates for more information.

Note that date types can be used in Templates, but they must be cast to an int or float before any operations can be performed on them. Default date and time formats can be set using the Inspector Options dialog. 010 Editor also has support for a special string type. Types hfloat and HFLOAT require version 5 of 010 Editor, time64_t requires version 9, GUID requires version 11, Opcode requires version 12, and types int8, INT8, uint8 and UINT8 require version 15.


Typedefs

Other data types can be created using the 'typedef' keyword. The syntax for creating new types is 'typedef <data_type> <new_type_name>'. For example,

     typedef unsigned int myInt; 

would generate a new data type myInt for unsigned integers. Typedefs can also be used with arrays (see Arrays, Duplicates, and Optimizing) using the syntax 'typedef <data_type> <new_type_name> [ <array_size> ]'. Note that the array size must be a constant in this case. For example, to generate a new string type with 15 characters use:

     typedef char myString[15];
     myString s = "Test";

Note that typedefs cannot be used to create multi-dimensional arrays (see Limitations). Typedefs can also be used with structs (see Structs and Unions).


Enums

Use the enum keyword to specify a number of constants for a variable. An enum data type can be created using the C syntax 'enum <type_name> { <constant_name> [ = expression ], ... } <variable_list>'. If no expression is given for the first constant, it is assumed to be zero. If no expression is given for any other constant, its value is assumed to be the previous constant plus one. For example,

     enum MYENUM { COMP_1, COMP_2 = 5, COMP_3 } var1; 

would declare the constants COMP_1 equal to 0, COMP_2 equal to 5, and COMP_3 equal to 6. By default, enums are the same type as an integer, but the type can be changed by placing '<' type_name '>' after the enum keyword. For example,

     enum <ushort> MYENUM { COMP_1, COMP_2 = 5, COMP_3 } var1; 

would declare the same variable but as an unsigned short. When an enum variable is declared and the variable is selected in the Template Results, a down arrow will appear to the right of the text field. Clicking on the down arrow displays a drop-down list of all constants defined for the enum. Selecting an item from the drop-down list, or entering a constant in the edit field and pressing Enter will assign the variable to a new value. Enums may also be used with bitfields.


GUID

A GUID is a built-in typedef for an array of 16 bytes. A GUID is also called a UUID or 'Globally Unique Identifier' and is used in Microsoft Windows. In the Template Results a GUID is displayed in the format {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} and the functions GUIDToString and StringToGUID can be used when working with GUIDs. The GUID datatype is available starting in 010 Editor version 11 and note that it is possible to use a typedef to redefine a GUID as a struct instead of an array.


This is the manual for 010 Editor, a professional hex editor and text editor. Use 010 Editor to edit the individual bytes of any binary file, hard drive, or process on your machine. 010 Editor contains a whole host of powerful analysis and editing tools, plus Binary Templates technology that allows any binary format to be understood.




Newsletter - Receive special offers, tips, tricks and news. Join now

010 Editor v15.0.1 is here!
What's new?



E-mail: info@sweetscape.com