O4FE is a tool for looking at and modifying some of the files the Opera web browser puts on your disk. This is a 16-bit Windows program intended for use under Windows 3.1, Windows 9x/ME, or Windows NT/2000/XP, and to support file formats of Opera 4.00 and above. The four currently available functions are:
1. Open Cache... lists all the opr?????.* files which Opera has put in the cache, along with selected information from Opera's index file (dcache4.url). The display allows sorting in various orders, saving files with a name approximating the original file name, and deletion of unwanted files.
2. Open Cookies... shows the contents of cookies4.dat in an understandable format, can sort in various orders, allows deletion of selected cookies, and allows pasting in cookies copied from another cookies file. It can also read a Netscape or similar cookies.txt file.
3. Open Global History... shows the contents of global.dat, sorts in various orders, and allows deletion of selected items. You can also paste information copied from the cache index, another Global History file, or a Visited Links file.
4. Open Visited Links... shows the contents of vlink4.dat, sorts in various orders, and allows deletion of selected items. You can also paste information copied from the cache index, a Global History file, or another Visited Links file.
The functions are implemented as document windows in a Multiple Document Interface. That allows more than one of each document type to be used simultaneously to facilitate comparisons. The program currently limits the number of document windows to 15.
O4FE is freeware. If you decide to use the program, the following applies:
This software is offered for use as is, and no warranty is stated or implied. The author is not responsible for any loss of data, damage to hardware nor any resulting loss of time or revenue resulting from the use of this program. Like all software, this program is utilized entirely at the user's risk.
Files in zip:
O4FE.EXE The main program OFETZ32.EXE For 32-bit users only, transfers Time Zone information to OFE.INI O4FEQWK.TXT Quick reference to nonstandard functions, used as help O4FE.TXT This file in plain text form O4FEHIST.TXT Change history
There's no installation routine. Just put the files in any directory (folder) you choose. OFE.INI will be created in the same directory. If you have downloaded an additional translation table file, the ###.bin file should be placed into the same directory as O4FE.EXE.
Create one or more icons / shortcuts if you want.
O4FE.EXE is a 16-bit Windows program, so it can't use the 32-bit time functions which a 32-bit version of Opera uses. OFETZ32.EXE is a minimal 32-bit program which puts information in OFE.INI which O4FE can then use to give accurate displays of date and time information saved by Opera. Users of 32-bit Opera versions should run OFETZ32 once to set the information. It will create OFE.INI if run before O4FE, or update it later. OFETZ32 should be run again if any change is made to the time zone settings by the Control Panel Date/Time applet.
If you have an OFE.INI for OFE, O4FE will share it, writing to a new [O4FE] section. This avoids having to do a new version of OFETZ32 and reduces the number of files. The [TZ] section is of course shared, so you don't need to rerun OFETZ32 in this case.
If you prefer a different directory for the ini file, or want alternative settings, both O4FE and OFETZ32 accept an ini filename (.ini extension required, case insensitive) on the command line. If that filename includes a path it will be used as is. If it has no path, the program directory will be used. (Note: If an invalid path is specified O4FE will just use it's default settings without saving at exit, OFETZ32 will indicate it couldn't write to the file.)
Uninstallation is easy; O4FE makes no system changes. Just delete the files and any icons / shortcuts.
 First Window Maximized - controls whether the first document window opened will be maximized or not. The setting is saved in OFE.INI.
 Disable File Safety - enables the 'Delete File(s)' cache menu item which is grayed if Opera is running or the dcache4.url file has been changed since you opened the cache. (Note: the menu item is also grayed if no files are selected.) This setting is intentionally NOT saved in OFE.INI, so file safety will always be active at the beginning of an O4FE session.
Date Format and Time Format - self-explanatory. O4FE will use Windows' date and time separator characters between the fields. Settings are saved in OFE.INI.
 O6+: UTF-8 to...
This checkbox controls whether the UTF-8 to locale translation is on for Opera 6.x files or off for Opera 4 through 5.12. When it's checked, translation is applied to all URL's, Titles on Global History, and the extra fields on the Cookies display for Cookie2 beginning with the Comment field.
O4FE has a set of internal CodePage translation tables, and additional tables can be loaded from ###.bin files. At startup, O4FE builds a combined list of those tables. When a user selects a font and script, the corresponding CodePage table is selected and shown in the Combobox if it is in the list, otherwise the 1252 table is selected. The box should normally be used just as a reminder of which table is active, but in the case of a font which doesn't indicate which language is supported it may be used to select the needed CodePage table. There may also be cases where a system or font is configured for a different CodePage than the apparently standard one which is chosen automatically; in that case I would need to make a ###.bin file for that CodePage and the user would need to choose it manually.
The internal translation tables are:
Thai 874 Turkish 1254 Central European 1250 Hebrew 1255 Cyrillic 1251 Arabic 1256 Western 1252 Baltic 1257 Greek 1253 Vietnamese 1258
Additional tables which may be selected automatically if the ###.bin file is present are:
Japanese 932 Chinese GB2312 950 Chinese Big5 936 Korean Johab 1361 Korean Hangeul 949
These are DBCS tables which are only useful on versions of Windows which can be set to support those code pages.
 Save at Exit
 Load at Start
These two checkboxes provide a means for O4FE to automatically open document windows at startup. Save at Exit controls whether O4FE will update a file list in OFE.INI when you close O4FE. Load at Start controls whether the list will be used when you start O4FE.(Duh!) With both checked, each session will start with the same set of files open as at the end of the previous session. Or after you've established a list you want loaded at each start you can uncheck the Save at Exit box to keep the fixed list. The only way to clear the list from within O4FE is to close all windows and exit O4FE with the Save at Exit enabled.
 Autosave Edited File
 No Save As dialog
These boxes are for a Cookies, Global History, or Visited Links document window in which you've deleted or pasted some lines. When only 'Autosave Edited File' is checked, closing the window brings up the Save As dialog. The OK button will save the file (with no overwrite warning unlike the File | Save As..), the Cancel button will discard the changes. If 'No Save As dialog' is also checked, the Save routine is used instead (the file is immediately saved with its original filename). (Exception: a Netscape cookies.txt file will always have the Save As dialog, since O4FE doesn't save in Netscape format.) Note that any action which closes the window (for example exiting from O4FE) triggers the autosave action.
The Font... button brings up the standard Windows font selection dialog. Any font change you OK takes effect immediately. Settings are saved in OFE.INI.
Closing the Options dialog with the Cancel button discards any changes except those which take place immediately (a font change, a change made to the 'O6+...' checkbox, or a changed selection in the CodePage combobox). The OK button of course keeps all changes.
These windows have lines of information spaced into columns. At the top of each column is a button bearing the column label. Clicking that button (or moving the focus to it with the Tab or SHIFT+Tab key and pressing the Spacebar or Enter) does an ascending sort based on the contents of that column. Clicking the same column again gives a descending sort. The sort routine is "stable". That means for example if you sort the Cache display first by file size and then by MIME type, all the image/gif files will be presented in file size order, then all the image/jpeg files in size order, etc.
To adjust Column widths with the mouse, position the cursor near the right end of the column's sort button. A special cursor will indicate that you can click and drag. You can reduce a column to zero width or expand it to larger than your screen width. To expand a column which has been reduced to zero width you approach from the right to get a cursor with two vertical lines then click and drag.
To adjust Column widths with the keyboard, use Tab or SHIFT+Tab to move the focus rectangle to the column's sort button. Then the + and - keys will adjust the column width by one character, or the < and > keys will adjust by one pixel. The focus rectangle will be invisible for a very narrow column.
You can select one or more lines using conventional mouse or keyboard actions. Selected lines can be copied to the clipboard using CTRL+C or the edit menu. The clipboard gets:
1. formatted text which includes column labels and extra spaces added for column alignment. Pasting into a text editor set to a fixed-pitch font will give a columnar display, or pasting into a spreadsheet program will allow dividing the columns using the fixed-width option. There's also a 'Save As Text' menu item which uses the same formatting, but saves all lines to a file of your choice.
2. Custom formatted data for paste operations.
The Paste operations might better be described as a merge. When a pasted line matches an existing line (URL comparison for Global History or Visited Links, Site plus Cookie Name for Cookies), then the older of the two lines is eliminated.
Selected lines can also be deleted. For the Cookies, Global History, and Visited Links windows, this is a simple matter of deleting the lines from O4FE's internal copy of the file, and doesn't affect the disk file unless you later do a 'Save' operation. For the Cache window, lines represent disk files in the cache directory and a delete operation permanently removes those files. To remind you of the difference, the Cache delete function is on the File menu and requires a SHIFT+Delete, while the delete function for the other windows is on the Edit menu and the key equivalent is just Delete.
The deletion routine can be somewhat slow. I wrote the core routine for an unsorted list, to keep it small and easy to debug. If you've sorted the list the deletion first unsorts it, then performs the deletion, then resorts it to the order you'd chosen. If you're planning to change the sort order anyhow, it may save some time to manually unsort before the delete. In any case, it's more efficient to delete many items at once than to delete few items many times.
If you need to copy just a portion of a line, or want to see all of a long line without horizontal scrolling, a right-click on the line will create a popup window with the line displayed in wrapped format.
When you choose one of the 'Open' commands, an Open File dialog is displayed. The first time you do this, the path will be set to O4FE's home directory, so you'll need to navigate to the appropriate file location. After that, O4FE remembers the location of the last file of each type you tried to open.
When you choose 'Open Cache...' your target is the index file, dcache4.url. O4FE checks that file and merges its contents with a complete list of all the files in the same directory beginning with 'opr'. (If there aren't any files in cache, O4FE just tells you so rather than opening an empty document window.)
The document window has 8 columns, most of which are obvious, but the 'Type' column needs some explanation. It shows a 3 character extension code either in lower case or upper case. The upper case ones are files which O4FE has matched with a simple type determination routine. The lower case ones are either 'gif' files which O4FE doesn't check (because that extension is almost always correct, and to save time) or other extensions which the type determination can neither confirm nor contradict.
The file checking makes loading a large cache somewhat slow because the beginning of each checked file must be loaded, and that may also slow down other programs. File checking can be turned off by adding CheckCacheFiles=0 in the [O4FE] section of OFE.INI. It can be re-enabled by changing the value to 1 or deleting the line. That line is only read at startup, so takes effect the next time you start O4FE.
For files which are not indexed in dcache4.url, O4FE leaves the MIME and Visited columns blank, puts a " ?:" in the 'Scheme' column, and a " ?" in the 'Site' column. You could consider such files for deletion, but Opera 4 will delete them the next time you start it. The exception is that if Opera is running, such files may have been added during it's current session so the index update would not yet have been written to disk.
Double-clicking a line attempts to open the cached file using the ShellExecute function. That finds the program which is set to do the 'open' action for files with the cached file's extension and passes it the filename. I've disabled this call for files with the .exe extension, and it will also silently fail for any extension which isn't associated to an application.
The File menu has a 'Copy As.. ' item enabled when you have one or more files selected. This brings up a file save dialog sequentially for each selected file. The dialog shows the cache filename in its Titlebar, and has O4FE's guess at the original filename preset as the destination name. O4FE doesn't try to avoid duplicate filenames, but the save dialog will give a warning if the save would overwrite an existing file. If you ever get into this sequence accidentally with a large number of files selected, press and hold the ESC key; it cancels the save dialogs and the key autorepeat will finish the sequence in a reasonable time.
Opera 4.x and 5.x only update the dcache4.url file at exit, but Opera 6 also updates it periodically while running.
For 'Open Cookies...' your target is cookies4.dat. O4FE reads the file and expands to an internal form which allows deleting records without affecting subsequent records. If you then save the file it is compacted back to the form Opera expects.
You may also target a Netscape cookies.txt file. O4FE will read and convert it to the same internal form. You can then save in Opera's form, or copy and paste to merge the cookies with an Opera cookies file. O4FE doesn't save in Netscape format; I'll leave that to someone writing software to support Netscape users. I've only tested with Netscape Navigator 3.01 cookies and a cookies.txt exported to Netscape format by IE 5.
The display is ten columns. The first two columns show when the cookie will no longer be used (expire), and when it was last used. The third column shows certain optional status codes as a group of code numbers or letters, see below. I've combined the Domain and Path elements under the label 'Site', and also the Name and Value elements under the label 'Cookie'. The last five columns are for 'Comment', Comment URL', 'Rx Domain', 'Rx Path', and 'Cookie Port'. Those fields will only have content if a server is using the Set-Cookie2: header, and I haven't yet found any of those, so that's a completely untested region. Thanks to Yngve Pettersen of Opera Software for detailed information on cookies4.dat.
The codes which may appear in the third column (Status) are:
'1' Accept all cookies from this domain. '2' Refuse all cookies from this domain. '3' Accept all cookies from this server. '4' Refuse all cookies from this server. '5' Refuse unmatched path cookies from this domain. '6' Accept unmatched path cookies from this domain. '7' Accept 3rd party cookies from this domain. '8' Refuse 3rd party cookies from this domain. '9' Accept 3rd party cookies from this server. 'A' Refuse 3rd party cookies from this server. 's' cookie will only be sent on a secure connection. 'o' indicates 'server Only' 'p' indicates 'Protected' 't' cookie will not be sent if the path is only a prefix of the URL. 'v' cookie was set as the result of a password login form. 'w' cookie was set as the result of an HTTP authentication login. 'x' third party cookie
The numerical codes and 'A' are attached to domain elements, and may repeat if there are more than two elements in the 'Site'. These lines contain the cookie filter information and correspond to the information shown by Opera's server filters dialog. That dialog is a better means to add or delete such controls than O4FE. Codes 2, 4, 5, 8, and A will typically be seen in lines having no date or cookie information since they are cookie refusal codes. The other codes will be seen in lines with an accepted cookie.
The lower case letter codes are the result of flags sometimes found in the 'Cookie' portion.
Copy and Paste between cookies files seems to work well. O4FE allows up to 600 total cookies and 40 per site. Opera will delete least recently used cookies to 300 total and 20 per site, though. If there are some important but seldom used cookies, you might want to delete others before saving the merged file.
The specifications for cookies as used on the web can be found at http://www.netscape.com/newsref/std/cookie_spec.html.
RFC 2965 is the latest specification for cookies, and Opera has cookie handling based on this standard. http://www.ietf.org/rfc/rfc2965.txt is the text version, HTML versions are available from several sources.
Opera 4, 5, and 6 probably read the cookies4.dat file once per session when first making an actual http connection. Opera 4 and 5 rewrite the file when you exit (but only if there's been a change), Opera 6 also updates it periodically while running. If you saved an edited version between those two events, it would be overwritten by Opera.
For 'Open Global History...' the target is global.dat.
When you paste lines into a global history list which were copied from a Cache index or Visited Links list, the URL is used for both the Title and Scheme/Site fields. It's trimmed to no more than 70 characters for the Title.
Saving the Global History sorts the list in Date/Time order, either ascending or descending depending on the file's original order.
Opera reads the global.dat file at startup, and rewrites the file when you exit. If you save an edited version while Opera is running, it'll be overwritten by Opera.
For 'Open Visited Links...' the target is vlink4.dat.
Opera uses both the Visited Links file and the Cache index for deciding when to show a link as visited. The Visited Link file gets an immediate entry when you load a local file (since local files don't get cached), but not when you load a remote file. If Opera later removes the remote file from cache to make room for something newer (or when doing an 'Empty Now' or 'Empty on Exit' function), and the file's visited time is still within the limit you've chosen for displaying links as visited, then an entry is added to the Visited Links file.
When deleting cache files using O4FE, you can first copy the lines and paste into the Visited Links file to preserve the marking as visited. Your next Opera session will delete any lines with a visited time older than your chosen limit.
Opera reads the vlink4.dat file at startup, and rewrites the file when you exit. Opera 6 also updates it periodically while running. If you save an edited version while Opera is running, it'll be overwritten by Opera.
These are simple windows, basically designed to show some text wrapped to fit within the window width. They can be resized or moved, and vertical scrolling is available when needed.
You can also select some of the text and copy it to the clipboard. Rather than waste screen space for a menu bar or a copy button, I've just added 'Copy Text' to the System Menu (a.k.a. Control Menu) accessible by clicking the icon at the left end of the Titlebar (or ALT+Spacebar). The standard CTRL+C key combination does the copy without using the menu, of course.
A popup window can be created showing the full contents of a line from any of the document windows by right-clicking the line or simulating a right-click with the R key. A popup window is also used to display the Quick Reference text file which serves as O4FE's help.
These windows are always visible when O4FE is. They will be hidden if you minimize O4FE, and destroyed if you exit O4FE or if you close the document window from which they were created.
Mouse users can switch to another window simply by clicking it. Keyboard users can switch using the 1 or 2 keys, which cycle through all windows.
A popup window can be closed by double-clicking the icon at the left end of its Titlebar, choosing the Close option on its System Menu, or by pressing the ESC key. The standard ALT+F4 also works, but if you hold that down a little too long, O4FE will be closed.
I've limited the number of popups to 2 per document window, and 5 copies of the Quick Reference. Combine that with 15 possible document windows and you can thoroughly clutter your screen. But the limits are simply what I consider sufficient and made programming the 1 and 2 key sequencing easy. If any user needs more, I'll increase the limits in a future version.
There are three different menu versions; one when there are no documents open, another when a Cache window is the active window, and finally one for when the active window is a Cookies, Global History, or Visited Links window. The following listing has all the items which appear on any menu version.
File Menu: --------------------------------------------------------------- Save Saves Cookies, Global History, or Visited Links in Opera's format to the original filename (no 'Save as' dialog). Save As... Saves Cookies, Global History, or Visited Links in Opera's format with 'Save as' dialog to permit renaming. Save as Text... Saves the listing for Cookies, Global History, or Visited links to a file as formatted text. Delete File(s) Deletes selected files from the Cache directory. Copy As... Copies selected files from the Cache directory, with renaming for each. Open Cache... Creates a Cache document window (with file open dialog). Open Cookies... Creates a Cookies document window (with file open dialog). Open Global History... Creates a Global History document window (with file open dialog). Open Visited Links... Creates a Visited Links document window (with file open dialog). Close Closes the active document window. O4FE Options... Creates an O4FE Options dialog. MRU Cache Creates a Cache document window using the saved filename from the previous Open. MRU Cookies Creates a Cookies document window using the saved filename from the previous Open. MRU Global History Creates a Global History document window using the saved filename from the previous Open. MRU Visited Links Creates a Visited Links document window using the saved filename from the previous Open. Exit O4FE Quits the program. Edit Menu: --------------------------------------------------------------- Copy text Copies selected lines to the clipboard as formatted text and custom data. Paste Merges custom data from the clipboard. Delete Deletes selected lines for Cookies, Global History, or Visited Links. Select All Selects all lines in active document listing. Deselect Deselects all lines in active listing. Save as Text... Saves all lines of a Cache directory listing to a file as formatted text. Unsort Restores the original order of a listing. Window Menu: ------------------------------------------------------------- Cascade Standard diagonal overlapped arrangement of document windows. Tile Horizontal Non-overlapped biased toward short and wide. Tile Vertical Non-overlapped biased toward tall and narrow. Arrange Icons Move all minimized windows to bottom. Autotile Horizontal Checkable item. See Note. Autotile Vertical Checkable item. See Note. Close All Close all document windows. Note: If you have one of the Autotile items checked, it will force a tiling of the selected flavor in the following cases: 1. When you minimize a window. 2. When you switch a window from maximized to restored. 3. When you switch a window from minimized to restored. ** the following apply only if the document window is not maximized ** 4. When you open a new document. 5. When you close a document. 6. When you change the size of O4FE's main window. Help Menu: --------------------------------------------------------------- Quick Ref... Creates a popup window containing O4FEQWK.TXT. About O4FE... Creates a dialog with basic program information. Popup window System Menu addition: --------------------------------------- Copy Text Copies selected text to clipboard.
(1) Document Windows Maximize / Restore F7(toggle) Note: also for Quick Reference popup. Lengthy operations which show the Busy cursor (hourglass) can be stopped by pressing a key. The keystroke will also perform its normal function, though, so if you just want to stop an operation use a key which doesn't start something. The CTRL or SHIFT keys are suitable, as is ESC. Column Operations: Sort Click column sort button, or move focus rectangle there and press Spacebar or Enter. Focus to sort Tab (forward) or SHIFT+Tab (reverse). Adjust width Mouse: drag right side of sort button. Keyboard: move focus to sort button, then adjust using + and - to change by one character width, or > and < to change by one pixel. Focus to list additional Tab or SHIFT+Tab's, or any vertical scroll operation. Scrolling document & focus rectangle: Down one line Down arrow or click bottom scrollbar arrow (moves focus only, if possible). Down one line CTRL+Down arrow or CTRL+click bottom scrollbar arrow (moves text only, if possible). Up one line Up arrow or click top scrollbar arrow (moves focus only, if possible). Up one line CTRL+Up arrow or CTRL+click top scrollbar arrow (moves text only, if possible). Down one page Page Down or click scrollbar below thumb. Up one page Page Up or click scrollbar above thumb. End of document CTRL+End. Top of document CTRL+Home. Variable Drag scrollbar thumb. (either scrollbar) Right one char Right arrow or click right scrollbar arrow (char is the average character width of the font in use). Left one char Left arrow or click left scrollbar arrow. Right 7/8 window CTRL+Right arrow or click scrollbar right of thumb. Left 7/8 window CTRL+Left arrow or click scrollbar left of thumb. Full right End. Full left Home. Selection of lines in document: Single Click line or press Spacebar with focus on line. This clears any previous selection. Single (toggle) CTRL+click or CTRL+Spacebar changes selection state, does not affect any other selection. Range1 Click or Spacebar one end of range, SHIFT+click or SHIFT+Spacebar other end. Range2 Click and drag from one end of range to other. Range3 SHIFT+Up (or Down) arrow. This is implemented as a toggle function so it can also be used to deselect. Select All CTRL+A. Deselect All CTRL+D. Open Cached file Double-click. Note: In all actions the Enter key functions the same as the Spacebar. The mouse range selections can be combined. If you start a drag with the CTRL or SHIFT key down previous selections won't be cleared, etc. Pressing CTRL during any portion of a drag will do toggles rather than sets. (2) Popup Windows Mouse operations: Position caret Click between two characters.(clears any selection) ** Scrolling with the mouse leaves the caret at its original position in the text Down one line Click bottom scrollbar arrow. Up one line Click top scrollbar arrow. Down one page Click below scrollbar thumb. Up one page Click above scrollbar thumb. Select1 Position caret before first character, SHIFT+click after the last character (or vice versa). Select2 Click and drag. Copy to clipboard Click icon at left of Titlebar to get menu, click 'Copy Text' item. Close window Double-click icon at left of Titlebar. (Win 9x also could click X at right of Titlebar) Keyboard operations: ** all motion operations move the caret within the text Right one Right arrow. Left one Left arrow. Down one line Down arrow. Up one line Up arrow. End of line End. Start of line Home. Down one page Page Down. Up one page Page Up. End of text CTRL+End. Start of text CTRL+Home. Select SHIFT+arrow key. Open menu ALT+Spacebar. Copy to clipboard CTRL+C. Close window ESC. (3) Miscellaneous key functions Previous Window 1 or CTRL+1 Next Window 2 or CTRL+2
Note: CTRL+Tab or CTRL+F6 are the Windows standard keys for Next MDI document window, and CTRL+SHIFT+Tab or CTRL+SHIFT+F6 for Previous MDI document window. They work, but won't switch to or from the popup windows.
CTRL+F4 is the Windows standard to close a document Window. I saw no reason to change that.
ALT+F4 is the Windows standard to close a popup Window. It works, but if held down long enough for autorepeat to start it will also close O4FE. So I added the ESC key to close popups, for those who prefer safety to standards.
(4) Menu accelerator keys Save Ctrl+S Save As F11 Save As Text F12 O4FE Options... Alt+P Delete File(s) Shift+Del Copy Text Ctrl+C Paste Ctrl+V Delete Del Select All Ctrl+A Deselect Ctrl+D Unsort Ctrl+U Cascade Shift+F5 Tile Horizontal F6 Tile Vertical Shift+F6 Quick Ref F1
(1) File Parse Error
When you try to open a file, this error appears if O4FE can't handle it. Possible causes include trying to open a file of the wrong type, a corrupted file, or something I didn't find while designing and testing so there's no code to handle it. If you're reasonably certain the file is good, I'd like a copy of it to check.
In some cases, this error will also indicate the hex offset in the file where O4FE gave up, in the form ' @ 0xNNN' where NNN is the hex offset.
(2) Out of Memory
If O4FE asks the system for a block of memory and is told there's none available, it issues this error and quits what it was trying to do. When this error occurs during the initial stages of creating a window, it will be followed by a Can't create window for <File> error. There are also some cases where this error is issued for any failure of an attempted action where a memory limitation is only the most likely cause.
(3) Can't open <File>
The file system won't allow O4FE to open the file. Either the file doesn't exist or another application has it open in a mode not allowing O4FE's read access.
(4) No cached files in <Path>
'Open Cache...' didn't find any files to list. Rather than giving you an absolutely useless empty display O4FE just displays this message.
(5) No Cookies in <File>
'Open Cookies...' didn't find any cookies to list.
(6) No lines in <File>
The file you chose for 'Open Global History...' or 'Open Visited Links...' is too short to contain even one line for display.
(7) Can't create window for <File>
Either the system has refused to create a window, or there's not enough memory and the window is closing before it becomes visible. In the latter case, this message is preceded by an Out of Memory message.
(8) Error writing <File>
Indicates problems such as trying to write to a read-only file, out of disc space, etc.
My general approach is to do error prevention rather than error detection. I'm sure users will tell me where I haven't succeeded.
(1) <File> has been modified.
When you reactivate a document window after using another application or another O4FE window, the file's Date/Time is checked. If it has changed, this message is displayed.
(2) <File> has been deleted.
If the file is no longer there in the reactivation checking, this message is displayed. It can also be displayed in the unlikely case that the file was deleted by another application immediately after O4FE finished reading it, when O4FE first reads the file's Date/Time.
(3) Delete Aborted
If a Delete operation is stopped by pressing a key during it's initial 'unsort' phase, this message is displayed and nothing is deleted.
(1) Opera File Formats --
These are based on http://www.opera.com/docs/fileformats/ by Yngve Pettersen combined with my observations of the file contents. There may be significant items I've missed
All numerical data is stored most significant byte first, which makes it easy to read from a hex dump. Time values are currently in the 4 byte signed seconds after 1 Jan. 1970 00:00:00 GMT format which is supported on most platforms.
a. General format for cookies, cache index, and visited links
Header: Hex 00001000 Hex 00002000=cookies, Hex 00020000=cache or visited links Hex 0001 This indicates the size of tags (1 byte) Hex 0002 This indicates the size of length fields (2 bytes)
(The format allows for longer tags and/or length fields in the future. O4FE is not coded for that, so will reject any file with different values in the header.)
Each piece of data has a tag. There's one set of tag definitions for cookies, another common to the cache index and visited links. Most tags are followed by a length field, then the number of bytes of information indicated by that length. Other tags simply indicate a 'true if present' state and have no length field or content; such tags have their most significant bit set (hex 80 and above for the current single byte tags).
Some tags are record tags which form a container for one or more pieces of tagged data. The others contain only one piece of data with a specific type (string, unsigned, or signed numerical). In the descriptions I'll use indentation to indicate which tags may occur within specific record types. The tags will be in hexadecimal form expressed as 0xNN where NN are the actual hex digits.
b. Cookies File (cookies4.dat)
The file represents a tree structure. Starting at the beginning the entries work from the root to the first leaf, then back to a branch and out to the second leaf, etc. The data closest to the root is the most basic part of the domain; .com, .net, etc.
O4FE's internal version of the file is split into a forest of single-leaf saplings, each having all elements back to the root. This allows easy deletion or addition of saplings, and the Save operation recombines them into the Opera tree format.
There are 3 basic record tags; one for domain elements, one for path elements, and one for the cookie contents. There are additional tags for the data within those records, and also tags to back down through the path and domain elements.
0x01 Domain entry (record). 0x1E Domain element name (string). 0x1F Cookie server accept flags. Content is a numerical value: 1 = Accept all from domain. O4FE status '1' 2 = Refuse all from domain. O4FE status '2' 3 = Accept all from server. O4FE status '3' 4 = Refuse all from server. O4FE status '4' 0x21 Cookie with path not matching: 1 = Refuse. O4FE status '5' 2 = Accept automatically. O4FE status '6' 0x25 Third party cookie handling: 1 = Accept all from domain. O4FE status '7' 2 = Refuse all from domain. O4FE status '8' 3 = Accept all from server. O4FE status '9' 4 = Refuse all from server. O4FE status 'A' 0x02 Path entry (record). 0x1D Path element name (string). 0x03 Cookie content record. 0x10 Cookie Name (string). 0x11 Cookie Value (string). 0x12 Cookie expires (time). 0x13 Cookie last used (time). 0x14 Cookie2 Comment (string). (not seen yet) 0x15 Cookie2 Comment URL (string). (not seen yet) 0x16 Cookie2 Received Domain (string). (not seen yet) 0x17 Cookie2 Received Path (string). (not seen yet) 0x18 Cookie2 Portlist (string). (not seen yet) 0x99 Secure flag (true if present). O4FE status 's' 0x1A Cookie Version (unsigned numerical) (not seen yet) 0x9B Server Only flag (true if present) O4FE status 'o' 0x9C Protected flag (true if present) O4FE status 'p' 0xA0 Path prefix flag (true if present) O4FE status 't' 0xA2 Password flag (true if present) O4FE status 'v' 0xA3 Authenticate flag (true if present) O4FE status 'w' 0xA4 Third party flag (true if present) O4FE status 'x' 0x84 End of domain (true if present). This backs down one domain level, and is used at the end of the file to back out of the tree altogether. 0x85 End of path (true if present). This backs down one path level, and is used one more time than the number of path elements. The one extra can be considered to stand for the '/' between domain and path elements needed even when the path is empty.
c. Cache Index file (dcache4.url)
The file body is a set of records, each record containing information about one file in the cache directory.
0x01 Cache File Entry (record). 0x03 URL Name (string). 0x04 Last Visited (time). 0x22 #Anchor (record). 0x23 #Anchor Name (string). 0x24 #Anchor VisitTime (time). 0x05 Local Time Loaded (time). 0x06 Security Status (unsigned numerical). 0x07 Status (unsigned numerical). 0x08 Content Size (unsigned numerical). 0x09 Content Type (string). 0x0A Charset (string). 0x8B Form Request (true if present). 0x8C Cache Download File (true if present). 0x0D Cache Filename (string). 0x8E Proxy No Cache (true if present). 0x8F Always Verify (true if present). 0x10 HTTP Protocol Data (record). 0x11 Send Content Type (string). 0x12 Send Data (string). 0x93 Send Only If Modified (true if present). 0x14 Send Referrer (string). 0x15 Keep Load Date (string). 0x16 Keep Expires (time). 0x17 Keep Last Modified (string). 0x18 Keep Mime Type (string). 0x19 Keep Entity (string). 0x1A Moved To URL (string). 0x1B Response Text (string). 0x1C Response (unsigned numerical). 0x1D Refresh URL (string). 0x1E Refresh Interval (unsigned numerical). 0x1F Suggested Name (string). 0x20 Content Encoding (string). 0x21 Content Location (string). 0x25 ?? (numerical). 0x26 ?? (numerical). 0xB0 Send Method GET (true if present). 0xB1 Send Method POST (true if present). 0x40 Next Sequence (string). This is at the end of the cache index file and contains the 5 character sequence which will be used to form the filename for the next cached file.
d. Visited Links (vlink4.dat)
The file body is a set of records, each record containing information about one URL.
0x02 Visited File Entry (record). 0x03 URL Name (string). 0x04 Last Visited (time). 0x22 #Anchor (record). 0x23 #Anchor Name (string). 0x24 #Anchor VisitTime (time). 0x8B Form Request (true if present).
e. Global History file (global.dat)
There's no header in this file, just records.
Record: ASCII Title, terminated with line feed. ASCII URL, terminated with line feed. ASCII decimal Date/Time, terminated with line feed. (seconds after 1 Jan. 1970 00:00:00)
(2) Netscape Cookie File format --
This is my own analysis of the format, and describes what O4FE will currently accept.
The file is plain text, and each line ends with two carriage returns and a line feed. It begins with a header (between the lines):
------------------------------------------------------ # Netscape HTTP Cookie File # http://www.netscape.com/newsref/std/cookie_spec.html # This is a generated file! Do not edit. ------------------------------------------------------
Cookies exported by IE to the Netscape format are similar, but end lines with two line feeds. The header is:
------------------------------------------------------ # Internet Explorer cookie file, exported for Netscape browsers. ------------------------------------------------------
O4FE starts by skipping any number of empty lines or lines beginning with a '#' character. Lines may be terminated by one or more carriage returns or line feeds in any combination.
The cookies data is seven fields per line, each field separated from the next by a single space character or a single tab. O4FE replaces all the spaces, tabs, carriage returns and line feeds with zeroes so the fields can be treated as null terminated strings. The seven fields are:
1. Host or domain. If this contains only numerical characters and dots, O4FE stores it as a single string to match the Opera 3.5+ format for IP addresses. Otherwise it is broken into substrings by dots, and must have at least 2 substrings or O4FE outputs a File Parse Error and quits trying to read the file.
2. Either "TRUE" or "FALSE", where TRUE means that field 1 was specified by the optional 'domain=' cookie attribute and FALSE means field 1 is the host which sent the cookie. Any other contents cause a File Parse Error.
3. Path. This field may be empty if there was no 'path=' attribute, but usually has a '/' character and on rare occasions has multiple path elements strung together. If so, O4FE stores the path element substrings indicated by the slashes.
4. Either "TRUE" or "FALSE", where TRUE means the cookie is secure, FALSE not. O4FE saves the status, or quits with a File Parse Error.
5. Expiration Date/Time, expressed as seconds after 1 Jan. 1970 00:00:00 GMT. O4FE reduces this to a binary number, and adjusts it by the local standard time offset to match the way Opera does it.
6. Cookie Name. O4FE just stores it unless it's empty or longer than 4096 bytes, either of which will cause O4FE to issue a File Parse Error.
7. Cookie Value. O4FE just stores it unless it's empty or longer than 4096 bytes, either of which will cause O4FE to issue a File Parse Error.
After the seventh field O4FE steps over any extra zero bytes, then expects field 1 unless it has reached the end of the file.
(3) O4FE Custom Clipboard Formats --
This is the format used when copying from Visited Links, Cache index, or Global History.
DWORD 32 bit total length of clip (Intel format, LSB first) LONG 32 bit number of lines in clip (Intel format, LSB first) Each line has: MWORD 16 bit length of Title (MSB first) This is 0 if copying from Visited Links or Cache index ASCII Title (if any) MWORD 16 bit length of URL (MSB first) ASCII URL TIME 32 bit Date/Time, seconds since 1 Jan. 1970 00:00:00 (LSB first)
Note: This format is identical to that used by OFE for this data, allowing you to Copy and Paste between O4FE and OFE.
This is the format used when copying from Cookies.
DWORD 32 bit total length of clip (Intel format, LSB first) LONG 32 bit number of lines in clip (Intel format, LSB first)
Each line contains a cookie record in the same format as the Opera cookies4.dat file records but with all elements specified.
Note: This format differs from the CF_OFECOOKIE format used by OFE, so Copy and Paste of cookie information between the two programs is not currently possible.
(4) O4FE UTF-8 to CodePage translation --
For each string which might contain UTF-8 codes, O4FE steps through the string skipping bytes with 0x00 to 0x7F values. When it finds a byte with an 0xC2 or greater value, it decodes the 2 or greater byte UTF-8 sequence. If it instead finds a byte in the 0x80 to 0xC1 range, it returns the remainder of that string without decoding; the likelihood that Opera will produce an invalid UTF-8 code is far less than the likelihood the user is looking at a file produced by Opera 5.12.
Decoding of UTF-8 sequences first checks whether the sequence corresponds to a valid UTF-16 code point; if not a '?' replaces the sequence. Valid UTF-16 codes are converted to the selected CodePage using a lookup table; the ###.bin external table or an internal table of the same form. If an identically numbered table is present both internally and as a file, O4FE uses the file.
The table format has 3 sections:
Section 1: Preamble
This consists of two 16 bit words; the first word is the code page number (O4FE doesn't use this number, it's there to identify the file if it has been renamed), the second word is bit-coded for control. Currently only the last bit of that second word is used; when set it indicates a Double Byte Character Set (DBCS), when clear it indicates a Single Byte Character Set (SBCS).
Note: words are stored in Intel order; the low byte is first, followed by the high byte.
Section 2: Unicode table
This consists of an ordered list of Ranges. Each Range consists of 3 words indicating a starting UTF-16 value, an ending UTF-16 value, and the byte offset from the beginning of the overall table/file to the Output code corresponding to the starting UTF-16 value. A lookup consists of searching for the first ending value greater than or equal to the desired value (O4FE uses a binary search for this; one of the DBCS tables has 1489 Ranges and a sequential search would be slow). If the value is also greater than or equal to the starting value for the Range, it lies in that Range, otherwise it is not in any Range and the UTF-8 code is replaced with a '?'. For an in-Range value the starting value is subtracted from the desired value, the difference is doubled for a DBCS table, and the result is added to the offset to find the location of the Output code. The last Range is always a guard which has starting and ending values of 0xFFFF.
Section 3: Output table
This section simply lists the character code bytes (SBCS) or words (DBCS) in the same order as the Ranges. Within a Range, there may be up to 6 (SBCS) or 3 (DBCS) sequential '?' characters where the UTF-16 values don't have CodePage equivalents. This keeps the overall table size as small as possible - replacing 5 '?' bytes with a 6 byte Range entry wouldn't be efficient for instance. The 6 byte case could have been handled either way, but the lookup is slightly faster with fewer Ranges.
Name: Josef W. Segur (Joe)
Residence: Northern New York State, USA (about 80 miles south of Montreal, Quebec, Canada)
Occupation: retired former electronic engineer and programmer