BinaryDi

BinaryDi.dll provides a GUI for the display of binary data. The application which wants to display the data simply loads the dll, creates a viewer COM object, and indicates the source of the data to that object. A pop-up viewer window is displayed with the data. The user has control over the display format via a right-click popup menu and controls at the bottom of the viewer window.

BinaryDi viewers can display data in any base from 2 to 49 and Radix-50 along with the ASCII or EBCDIC equivalent. The data can be viewed as bytes, words, longwords, and quadwords, signed or unsigned.

Note that the user can close the viewer at any time, but the calling program should make sure to use Free_Viewer to close the viewer when it is finished with it to make sure no extra windows are left active.

Download BinaryDi32.dll for MS Windows

Download BinaryD32.lib (import library) for BinaryDi32.dll for MS Windows

Download include files (Delphi and C) self-extracting executable

 

API

The API for BinaryDi consists of three functions, described following this paragraph. All API functions use the stdcall calling convention. Note that int indicates a 4-byte singed integer. int64 indicates a signed 8-byte integer.

int Make_Viewer( TArray_Interface* P, char* Title, int size, int base, int flags, int64 position);
This function creates a viewer and returns a context which can be used in the Free_Viewer function. The title text is shown in the caption bar of the viewer. This function is provided for data which cannot be provided as a simple char*. For simple data, use Make_Pointer_Viewer. P is an instance of the TArray_Interface class. size indicates the default display size (1 = byte, 2 = word, 4 = longword, 8 = quadword). Any invalid size is converted to the default (1). base is the default base for the display (2 through 49). A value of 50 indicates Radix-50. Any invalid base is converted to 16 (Hexadecimal). position is the initial position in the data to be positioned to. Flags are 0 or any of the following combinations:
1 = display text in EBCDIC (the default is ASCII)
2 = display data as signed (the default is unsigned)
 
int Make_Pointer_Viewer( char* P, int Len, char* Title, bool RO, int size, int base, int flags, int64 position );
This function creates a viewer and returns a context which can be used for the Free_Viewer function. The Title text is shown in the caption bar of the viewer. P is a pointer to the data and Len is the length of the data (ie the data may contain nulls). If RO is true, the data cannot be modified by the user, otherwise it may be. size indicates the default display size (1 = byte, 2 = word, 4 = longword, 8 = quadword). Any invalid size is converted to the default (1). base is the default base for the display (2 through 49). A value of 50 indicates Radix-50. Any invalid base is converted to 16 (Hexadecimal). position is the initial position in the data to be positioned to. Flags are 0 or any of the following combinations:
1 = display text in EBCDIC (the default is ASCII)
2 = display data as signed (the default is unsigned)
 
void Free_Viewer( int Context );
This function takes the context returned by Make_Viewer or Make_Pointer_Viewer and closes the viewer associated with that context. If the viewer doesn't exist, nothing happens.

 

TArray_Interface

TArray_Interface is a COM class whose instances may be used to supply the BinaryDi viewers with data that cannot be supplied via a pointer (such as data which is not entirely in memory, or not contiguous). An instance of this class must be created and passed to the Make_Viewer API call in order to use this feature. The class makes use of the UEH facility. The following methods are defined by this class.

TUEC Initialize();
Initializes the object for use. Note that this is not a constructor.
 
TUEC Terminate();
Terminate the use of the object. Returns result of termination. This generally should not be called directly - instead, use the Detach method. When called, the object should destroy itself. It will not be referenced after this call.
 
void Attach();
Increments the reference count for the object.
 
void Detach();
Decrements the reference count for the object. When count reaches 0, the object must be destroyed.
 
int Interface_Version();
Returns the version of this interface. This specification describes the interface for V1.0. Thus, the function should return 10.
 
int Facility_ID();
Returns the Facility ID for the UEH facility represented by this object. Returns -1 if no facility assigned.
 
int Facility_Version();
Returns the UEH facility version. Result only has meaning if Facility_ID doesn't return -1.
 
TDebug_Interface* Debugger();
Returns a debugging interface for the object. Return NULL if not supported.
 
void* Extension()
Always returns NULL for Version 1.0.
 
char Get_Byte( int64 Index );
Return a byte from the given index.
 
void Set_Byte( int64 Index, char Value ) ;
Set a byte at a specific index.
 
bool Read_Only();
Returns true if the data is read-only. If so, the user cannot modify the data.
 
int64 Low_Bound( int Subscript );
Returns low bound of specified subscript.
 
int64 High_Bound( int Subscript );
Returns high bound of specified subscript.

 

int Subscripts()
Returns number of subscripts supplied by this array. For BinaryDi use, this should always be 1.