BE memory extension for raw I/O to block devices

Download from http://www.nyangau.org/berawio/berawio.zip.

What it does

BERAWIO is a 'memory extension' helper module which provides Andys Binary Folding Editor with the capability to view and edit raw block devices on Windows.

Because you are doing raw access to block devices, you need to be running as Administrator.

An alternative is to use a program like RAWIO to read from a device to a file, BE the file, then use RAWIO to write it back. Raw I/O and this memory extension share a lot of common code. BERAWIO is clearly quicker and easier for some use cases.

All I/Os to and from block devices have to be an integer number of sectors, aligned to a sector boundary.

BERAWIO caches the last sector it reads and if you run it in "lazy-write" mode, holds changes to a sector until you navigate away from that sector, or manually flush the data to the device.

The BE R key will discard cached date (but not unsaved changes). The @W flushes any unsaved changes to the device (ahead of you navigating away from the sector).

I wrote this tool because I routinely write CP/M 2.2 images to SD Cards. Recent versions of BE include an initialisation file called cpm.ini which decodes CP/M 2.2 filesystems. This can be used in conjunction with BERAWIO, allowing you to view and repair filesystem corruption on the device in-situ.

Usage

be rawio!device

The rawio! prefix is a cue that the binary data is to be provided on demand to BE via BERAWIO.

Anything after the prefix are arguments to be passed to BEBIG, and in this case it is the device name. These are the same device names as would be listed by the RAWIO program with this command, eg:

C:\rawio>rawio -L
\\.\PhysicalDrive0                      fixed        60801 255 63  512 465.76GB
\\.\PhysicalDrive3                      removable      123 255 63  512 964.84MB
\\.\C:                                  fixed        60801 255 63  512 465.76GB
\\.\D:                                  fixed        60801 255 63  512 465.76GB
\\.\G:                                  removable      123 255 63  512 964.84MB

In the above listing, note that the same device can appear more than once if Windows has mapped drive letter(s) to it. Also, devices may not appear if you're not running as Administrator, or another program already has directly opened a device.

Normally the right device is a "removable" device (the "fixed" ones tend to be your hard disks, which people rarely want to view or edit).

It's really important you don't try to access the wrong device. Remember, BERAWIO can be used to write to devices! You can easily corrupt your hard disk.

One way to reduce risk is to open in read-only mode, eg:

be rawio!RO:\\.\PhysicalDrive3

By default BERAWIO writes back to the device every time a byte is changed. To enable the lazy-write feature, you can :-

be rawio!LW:\\.\PhysicalDrive3

Limitations

Because BERAWIO works by actually manipulating a device, and only holds a one sector buffer, in lazy-write mode, any changes you make are written to the device when you attempt to read or write another sector. At any one moment in time there are only unsaved changes pertaining to the most recently accessed sector, all changes for other sectors will have been written back. So you're not really in control of exactly when writing back happens. This is really just a performance optimization.


This documentation is written and maintained by the author, Andy Key
andy.z.key@googlemail.com