Intro Credits Features Issues Project Download

  about xbrowser

Modified: 07/04/2000

1. Intro

This is a programming experiment for myself (Tim Tabor), and sample source code for the public domain. I knocked it together pretty quickly, so I'd appreciate feedback - constructive and otherwise.

xbrowser is a web resource browser. It's not a browser for surfing the web, but rather for viewing resources local to the user's computer, including html pages, images, and any other resource types known to Microsoft Internet Explorer.

xbrowser hosts Microsoft's WebBrowser control, so it will only work on machines with Internet Explorer 4.0 or later installed. If you're not into Explorer, and not into programming, perhaps you're on the wrong page.

What makes xbrowser special is its ability to render encoded html and other mime types, providing a measure of security for source code and artistic works.

xenc is the command-line tool for encoding source files and packaging them in resource-only dll's.

2. Credits

While I was surfing - looking for some nice dhtml and graphics to test xbrowser - I came upon Stewart Butterfield's most excellent 5k contest. Entries were subject to an absolute size constraint of 5k, and were judged on size, aesthetic appeal, function, and overall concept and originality.

I contacted the authors of my favorite ten entries, and all generously permitted me to include their work in the project.

Thanks to the contest and the contestants, xbrowser comes fully equipped with building blocks, a calendar, a universal decision-maker, a drawing program, an innovative viewer-powered animation engine, poetry by D.H. Lawrence, a maze, Pong, Tetris, and a5kRobustScalableInternetOnlineEcommerceFurnishingsOutlet.

Some of the following links may be unavailable from time to time.

blocks Wouter De Jong and Roy Tanck www
calendar Ivo Widjaja www
decisions Sam Foster www
draw Alexander Clifton www
hyper Liz Byrne  
iris Josh Santangelo www
maze Chris Nott www
pong Jeff Blankenburg  
tetris Yue Feng www
usedIT Web Production Group, Cornell www

To give you a sense of the competition's challenge, the dumb terminal screen you are currently reading weighs more than 11k !

Several of these scripts are computationally intensive, and perform best with a fast computer and lots of memory.

3. Features

I encoded the contestants' otherwise unmodified html and gif's, and packaged each 'site' in its own dll. I was happy to see the relative urls resolve properly. xenc's dll-creation functionality requires win NT or 2000, although the dll's themselves work on all win32 platforms.

The encoded resources are probably much safer than our nuclear secrets, but not nearly as safe as the Crown jewels. I spent a little while pretending I didn't know anything about xbrowser and figuring out how to hack the resources. You can get a decoded data stream if you know about hooks and about either urlmon or CAxWindow. And of course you can crack my tinker-toy 'encoding' scheme.

There's nothing to register and nothing to install - no typelib to browse and no registry footprints to track.

'<html>hello world</html>' looks like this in Visual Studio after it's been encoded with xenc:

....=jwii8omefd,za}|u.<|a{{&

And this in a hex dump:

00000000 00 00 00 00 3d 6a 77 69  ....=jwi
00000010 69 38 6f 6d 65 66 64 2c  i8omefd,
00000020 7a 61 7d 7c 75 2e 3c 7c  za}|u.<|
00000030 61 7b 7b 26              a{{&

And this in a browser other than xbrowser.

Larger encoded resources tend to hang Visual Studio, and produce garbage in other browsers. If you run Chris Sells' tools page through xenc, the encoded html looks like this in a browser other than xbrowser.

You could, of course include plain resources as well as encoded resources in your modules, and everything should work as expected. (xbrowser itself includes both plain and encoded html.) You might also decide against encoding non-text resources (although graphic artists have told me that encoding their works is a pretty neat idea).

xenc is the Vegematic of command-line tools. It takes one argument. If the argument is a filename ending in .dll or .exe, xenc will dump the module's html resource directory to stdout. If the argument is a file of any other type, xenc will encode it, and create an output file of the same name with a '.x' extension in the current directory. If the argument is a directory, xenc will encode the directory's files and package them in a resource-only .dll in the current directory. The minimal dll overhead is about 1.5k. xenc will not encode .exe or .dll files.

4. Issues

Scripts in html resources can create new windows, but the new windows can't load resources. So I was unable to browse resources in a script-created window. This behavior (i) occurs regardless of whether the resources are encoded, (ii) is unaffected by Internet Explorer's "Launch browser windows in a new process" setting, (iii) is not an url-resolution problem, (iv) is not fixed by registering the protocol handler's class object.

5. Project

xbrowser was built with the following Microsoft products: Visual C++ 6, the April 2000 Platform SDK, ATL 3, and the libraries provided with Internet Explorer 5. The project also depends heavily on Microsoft's WTL 3 - officially: as-is without warranty of any kind, either expressed or implied; but unofficially and by popular acclaim: sweet, sweet, sweet.

xbrowser has a temporary asynchronous pluggable res:// protocol handler [inhale here] that decodes html and other mime types. When the protocol handler encounters resources that aren't encoded (such as shdocvw's error pages), it forwards them to the default res:// handler.

The xbrowser project has two subprojects: xenc and reslib. xbrowser depends on source from xenc, and xenc depends on the minimum-size binary from reslib. Build them in this order: reslib, xenc, xbrowser.

Everything else seems self-explanatory, but I'll expand these comments if questions come in.

One final technical note. xbrowser's protocol handler met the objective I set for myself, but it's clearly the 'hello world' of such implementations. For protocol hanlders with Rector-And-Sellsian Industrial-Strength Interoperability, see Valery Pryamikov's work.

6. Download

The 148k zipped binaries are here. Just unzip them into one directory, and double-click xbrowser.exe.

The 81k zipped source projects are here. After you build them, you'll need to copy the resource dll's from the binary distribution to xbrowser.exe's directory (or some other directory reachable by LoadLibrary)._

 

Intro Credits Features Issues Project Download