UUDeview DLL Very Quick Reference

1 General Information

The UUDeview DLL contains a complete set of functions for decoding binary files that have been encoded using schemes like UU, XX, BinHex, and MIME. An encoding function is also provided.

The 32-bit version of UUDeview is found in a file called uudeview.dll. The 16-bit version is called uud16.dll.

All functions exported by the DLL are declared as _stdcall, so they can be called from Visual Basic or any VB-like language. An import library is provided for C/C++ users.

1.1 Library Documentation

The official source for information about the library is Frank Pilhofer's documentation. This document only describes support functions added to allow Visual Basic to use the library.

In addition to the functions described here, the DLL exports all the functions described in the official documentation, which is included in the UUDLL ZIP file in PostScript form. You can also download the documentation in the following forms from Frank's Web site:

1.2 Pointers

This documentation (and the include files for VB) refer to "pointers." For Visual Basic programmers, these are just long integers containing arbitrary numbers. You will never need to create or interpret a pointer; you'll only have to pass them to and from the library.

That said, it's very important that you pass only valid pointers where they are required. If you pass an invalid pointer back to the library, you are guaranteed a nasty crash.

2 Decoding files

To decode a set of encoded binary files, there are basically four steps: initialize, load (scan) the files, decode them to disk, and clean up.

2.1 Initialize

Before all decoding and encoding sessions, you must call the initialization function:

    Call UUVBInit

If you don't do this, the library will crash, usually with an IPF.

2.2 Set Options (if needed)

The UUDeview library provides a number of options designed to control how it processes input files. These options are documented in detail in the official UUDeview manual.

The default option values should work for most tasks, but you should be aware that the scanning and decoding processes can be customized for special situations.

2.3 Scan

You need to pass all the input files that you intend to decode to the UULoadFile function. As you load each file, it will be scanned by the library. Any encoded binary files found in the source files will be added to the library's internal decode list. You can examine this list with the UUVBListWalk function.

If the filenames were in a string array called FileList that was ListLen items long, the load loop might look like this:

    dim n as integer, returncode as integer

    Call UUVBInit

    for n = 1 to ListLen
        returncode = UULoadFile(FileList(n), FileList(n), False)
        next n

Note that this code doesn't do any error checking; you should examine the return code for errors. If an error occurs, you can use UUVBMessage to retrieve a text explanation of what happened.

2.4 Examine Decode List (optional)

If you want to see what encoded files were found during the scanning process, you can use the UUVBListWalk function. This function returns the status of the files in the list (e.g., "ready to decode," "missing parts," etc.).

For example, to print the names and status of all the files found during a scan to the Debug window, you might use code something like this:

    Dim rc As Integer, fpath As String
    Dim flags As Integer
    Dim ptr As Long, nextptr As Long, filestatus As String

    If UUVBListFirst(ptr) = False Then
        Exit Sub			' No files found
        End If
    
    Do
        rc = UUVBListWalk(ptr, fpath, filestatus, _
                    flags, nextptr)

        Debug.Print "File: "; fpath; " -> "; filestatus

        ptr = nextptr		' Advance to next item
        Loop Until rc = False

If you want to remove a file from the decode list, you can use the UUVBListDelete function.

2.5 Decoding

To create the decoded files, you need to walk the decode list and pass any pointers that you want to process to the UUVBDecode function. For example, you could enclose this line in a loop like the one in the "Examine Decode List" section:

    UUOK = UUVBDecode(ptr, flags, filen, uurc, mvret)

This would decode each file and write it to the filename specified in filen. You should examine UUOK to find out if anything went wrong; if UUOK is false, you can check the UUVBMessage and the uurc and mvret variables to find the cause of the error.

You can generate the output filename from the filename in the decode list if desired (available through UUVBListWalk), or make up your own filename as needed. Note that the filename in the decode list does not include a path specification.

2.6 Cleanup

When you're done decoding, you should call the UUVBShutdown function. Remember that if you plan to start another decoding session, you need to call UUVBInit again!

3 Encoding files

Encoding files is very simple. You simply need to call UUVBInit, then use the UUEncodeToFile function:

        Declare Function UUEncodeToFile _
            (ByVal zero As Long, _
             ByVal inputfilename As String, _
             ByVal encoding As Long, _
             ByVal nameinfile As String, _
             ByVal outputfilename As String, _
             ByVal linesperfile As Long) As Integer

4 Questions and Information

You can get more information about UUDeview and the UUDeview DLL from the official UUDeview Web Page.

In the last extremity, you can send mail to: