WinExplorer by Dexter
Intro
Getting Started
System Requirements
Trouble Shooting
Batch Files
Simple XPL Files
Using VB and Java Script in WinExplorer
VB and Java Script Basics
Contacting the Author
WinExplorer History
WinExplorer is a Win32 GUI application designed to communicate with a wide variety of smartcards.
It's intended purpose is to give hobbyists and professionals a
powerful tool for programming smartcards using low cost interfaces.
It is also a great way to learn about smartcards, VBScript and JavaScript
programming.
WinExplorer will work on any speed machine, you DO NOT need to slow down the CPU to use this program.
To use WinExplorer, you will need a Phoenix type interface.
A Phoenix interface is a simple device that plugs into a serial port and uses the RTS line to reset the card.
Usually the interface is clocked with
a standard color burst crystal (3.579545 MHz), or a EXO-3C+ oscillator chip programmed for 3.579545 MHz.
Every byte sent to the card is echoed back to the computer by the interface due to the way it's
designed.
If your interface needs drivers, and/or contains a CPU,
it's probably NOT Phoenix compatible.
WinExplorer can use several different script formats to direct it's interaction
with a smartcard.
Supported formats are:
Simple scripts .xpl
VB Script .xvb
Java Script .xjs
Batch execution of scripts is also supported.
Please look at the example files that are included to understand the formats of
the different files.
If anybody wants support for perl, python, or REXX, drop me a e-mail
and I'll add it in.
WinExplorer is written in Borland C++ Builder 4.0
The Inspiration for WinExplorer comes from
"Card Explorer" by TheBlob a.k.a. Chris Coe.
Getting Started
Run the program WinExplorer.exe
Open a Script file (.xpl, .xvb, .xjs), or a WinExplorer Batch file (.xpb)
Then Execute Script or Execute batch.
You can edit batch & script files, then save them.
System Requirements:
Windows 95/98/NT/Windows 2000.
Note: If you are having problems with button graphics not being visible,
or other menu/button problems, the file you need to update is "comctl32.dll"
which is located in your windows\system dir.
The easiest fix is to install Microsoft Internet Explorer 5.x.
If you don't want to install IE5, then get the latest
comctl32.dll file from here:
http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp
For more info read:
http://support.microsoft.com/support/kb/articles/Q186/1/76.ASP
The Microsoft Script Control.
The script control can be downloaded from:
http://msdn.microsoft.com/scripting/scriptcontrol/x86/sct10en.exe
A serial port.
A Phoenix compatible interface.
Trouble Shooting
WinExplorer will not even start up without installing the
Microsoft Script Control.
If you are getting the following message:
This Version of WinExplorer will not run without installing the Microsoft Script
Control.
Please read the file
"readme.txt" or "WinExplorer.htm" for information on how to
obtain and
install the Script Control, and additional files that might be required for this application to run.
You did not install the script control file sct10en.exe. The script control can be downloaded from:
http://msdn.microsoft.com/scripting/scriptcontrol/x86/sct10en.exe
If WinExplorer starts up but you are having problems running a VB or Java
Script,
please read this section:
Using VB and Java Script in WinExplorer
This problem occurs if you have the com port in use by another program or device. A big problem with programs written to run in DOS is that they leave the port open even after the program has exited. Do not run any DOS apps that use the com port prior to running WinExplorer. If you do get a hung port, you have to reboot your computer.
This message indicates that WinExplorer is trying to reset the smartcard, and no ATR response has been returned in the time specified for the Reset Delay parameter.
The cause of this can be many things.
Common problems are:
Incorrect settings in WinExplorer.
A damaged smartcard.
Cable problems.
Interface problems.
Interface power supply problems.
WinExplorer will send a 2A instruction followed by a 58 instruction to read general information from a DSS smartcard under the following conditions:
When you do a "Read Card Info" by selecting the menu item or clicking the camera button.
You have "Log Transactions" enabled.
You have "Display USW After Each Script" enabled.
You have "Display Fuse After Each Script" enabled.
If you look at the example scripts included with WinExplorer you will find 2 scripts, "Irdread.xpl" and "fuse.xpl".
These are the instructions sent to the card. A timeout occurs if the card does not respond with enough bytes to satisfy the
request for information. The causes for this are many and most are caused by the smartcard, not WinExplorer.
Try increasing the "Byte Delay" parameter to a higher number.
Try increasing the "Rec Timeout" parameter to a higher number.
To stop WinExplorer from requesting this information from your smartcard, disable the following options:
"Log Transactions"
"Display USW After Each Script"
"Display Fuse After Each Script"
If a script tries to read data back from the smartcard, and the smartcard does not supply enough bytes to satisfy the
request, a timeout occurs.
Try increasing the "Byte Delay" parameter to a higher number.
Try increasing the "Rec Timeout" parameter to a higher number.
Again, the causes for this are many and are most caused by the smartcard, not WinExplorer.
Batch Files
A WinExplorer Batch file is a simple list of script files you want to run.
Example Batch:
; This is a WinExplorer Batch File.
; Simply list the script files you want to run in the order you wish to run them in.
; You can run any .xvb, .xjs, or .xpl files from the batch.
irdread.xpl ; General CAM info
ppvlist.xpl ; Dump PPV Info
fuse.xpl ; Get Fuse info
Simple XPL Files
This is the most basic way of sending and receiving data.
You simply specify the bytes you wish to send in hex one after the other, and they will be sent.
If you wish to receive some data, simply enter Rxx, where xx is the number of bytes to receive, again in hex.
You must handle everything except for the ATR (Answer To Reset), including the 5-byte headers, INS echo and switch bytes.
You can add comments to an XPL file by placing a semi-colon character ';' on a line. The rest of the line after the ';' will be ignored.
Example files are supplied to illustrate how XPL files work.
Using VB and Java Script in WinExplorer
WinExplorer is a ActiveX Scripting Host.
This means WinExplorer can run Microsoft's VBScript, JavaScript,
and any other ActiveX scripting engines like perl, python, and REXX.
This Version of WinExplorer will not run without installing the
Microsoft Script Control.
You MUST run the file sct10en.exe to install it.
The script control can be downloaded from:
http://msdn.microsoft.com/scripting/scriptcontrol/x86/sct10en.exe
I also recommend you install the latest scripting engine runtimes from
Microsoft.
http://www.microsoft.com/msdownload/vbscript/scripting.asp
Important:
The Scripting Engines are for Windows 95, Windows 98 & Windows NT 4.0.
If you are running Windows 98 or Windows NT 4.0 you are home free.
If you are running Windows 95 and are getting the following errors:
"A script engine for the specified language can not be created" or "Script Error on Line 0"
or other errors when you try to run a VB or Java Script, you still need to install some components.
Windows 95 users must have OSR2 installed or be running Microsoft Internet Explorer 4.x or later for these files to work properly.
Windows 95 users without Microsoft Internet Explorer 4.x or OSR2 will need to install DCOM before using these files.
If you are running Windows 95 & you feel that you MUST install this stuff piece by piece,
instead of installing Microsoft Internet Explorer 4.x, you will need the following files:
File |
DL Location |
Description |
ste50en.exe | http://www.microsoft.com/msdownload/vbscript/scripting.asp | Version 5 VB & Java Runtimes |
dcom95.exe | http://www.microsoft.com/com/dcom/dcom1_2/download.asp | Decom 95 |
For documentation on Programming in VB Script download:
http://msdn.microsoft.com/scripting/vbscript/download/vbsdoc.exe
For documentation on Programming in Java Script download:
http://msdn.microsoft.com/scripting/jscript/download/jsdoc.exe
VB and Java Script Basics
The first line in a script must be a comment to tell WinExplorer that
this a VB or Java Script.
Examples of the built in functions & proprieties are contained in the demos.
Please look at the included example script files for reference.
The following is a list of the Built in's, the parameters in brackets [] are optional.
The "Sc" Object has the following members:
Function / Property | Description |
Sc.Verbose = true | false |
When set to true, reads & writes are displayed in the output window. When false, reads & writes are not displayed. |
Sc.Debug = true | false |
When set to true, writes are not performed but the data is still displayed in the output window. |
Sc.DebugBufferStuff(Data String) |
When Sc.Debug is set to true, this command will stuff up to 255 bytes into the receive buffer. Sc.Read will return the stuffed bytes. Sc.BytesInBuffer will return the number of stuffed bytes. |
Sc.Read(Number of Bytes) |
Read data from card. If Number of Bytes > what is in the receive buffer, you will get a timeout. |
Sc.Write(Data String) |
Write data to card. "Data String" is a string of ASCII Hex Chars. |
Sc.PutByte(Integer Value) |
Write a byte to card |
Sc.GetByte(Byte Number) |
Retrieve a byte from the read buffer (0 thru Bytes Read from last Sc.Read command) |
Sc.Print(String) |
Print a string to the output window. |
Sc.Reset |
Perform a Card Reset. |
Ret = Sc.InputBox(prompt[, title][, default]) |
Get user input. |
Ret = Sc.ButtonBox(prompt[, buttons][,title] [,button1str][,button2str][,button3str] [,button4str][,button5str]) |
Display a dialog box formatted similarly to MsgBox but with up to 5 user-defined buttons. The icon (vbCritical, vbQuestion, vbExclamation, vbInformation) can be specified in the second parameter, as can the default button (vbDefaultButton1, vbDefaultButton2, vbDefaultButton3, vbDefaultButton4, 1024). The function returns a number from 1 through 5 (indicating which button was selected) or 0 if the user clicked the "X" in the corner to close the dialog box. |
Ret = Sc.MsgBox(prompt[, buttons] [,title]) |
Display a Message Box, Returns which button was pressed. |
Sc.PictureBox(filename [, timeout] [, ShowBorder]) |
Opens a button-less, title-less splash screen that contains the .bmp or .jpg file specified, centered on the screen. Clicking anywhere in the box dismisses the dialog, unless a non-zero timeout value is specified, in which case the dialog box automatically disappears after the specified number of seconds. |
Sc.ProgressBox(Prompt, CurrentStep, LastStep, [Title]) |
Displays a progress box with a "thermometer" that fills up based on the percentage of CurrentStep/LastStep. A CurrentStep value of "0" will close the dialog box. If "Prompt" is "", the last string is displayed. If "Title" is "", the last string is displayed. |
Sc.Err("Error Message") |
This function will abort a script and display the line number and the error message. |
Sc.Delay(ms) |
Delay for xx milliseconds. |
Ret = Sc.Log(Text) |
Write Text to Log File. Returns 0 if successful. Returns 1 if "Log Transactions" option is not enabled. |
Sc.ByteDelay = DelayTime |
Set the Delay Time Between Bytes Sent, in microseconds. |
Ret = Sc.Version |
Return WinExplorer's Version Number. |
Ret = Sc.IsHex(Data String) |
Returns true if Data String is Valid Hex Data, False if Data String contains invalid chars. |
Ret = Sc.Flush() |
Flush Serial input buffer. Returns number of bytes flushed. |
Ret = Sc.BytesInBuffer |
Get the number of bytes pending in the receive buffer. Returns -1 if the function fails. |
Sc.MousePointer = Value |
Changes the mouse pointer. The following values are valid: 0 (Default) Shape determined by the object. 1 Arrow. 2 Cross (crosshair pointer). 3 I beam. 4 Not Used. 5 Not Used. 6 Size NE SW (double arrow pointing northeast and southwest). 7 Size N S (double arrow pointing north and south). 8 Size NW SE (double arrow pointing northwest and southeast). 9 Size W E (double arrow pointing west and east). 10 Up Arrow. 11 Hourglass (wait). 12 No Drop. 13 Arrow and hourglass. 14 Arrow and question mark. |
The "Fs" Object has the following
members:
Function / Property | Description |
int FileOpen(String FileName, int Mode) |
Opens a specified file using a specified access mode. Use FileOpen to open a file and obtain its Windows file handle. The access mode can be one of the following values: Const fsoOpenRead = 0 Const fsoOpenWrite = 1 Const fsoOpenReadWrite = 2 If the return value is positive, the function was successful and the value is the file handle of the opened file. A return value of -1 indicates that an error occurred. |
int FileCreate(String FileName) |
Creates a new file. FileCreate creates a new file with the specified name. If the return value is positive, the function was successful and the value is the file handle of the new file. If the file already exists, FileCreate will overwrite the existing file. A return value of -1 indicates that an error occurred. |
void FileClose(int Handle) |
Closes a specified file. FileClose closes a file given its handle. The handle is obtained when the file is opened using FileOpen or FileCreate. |
int FileExists(String FileName) |
Tests if a specified file exists. FileExists returns 1 if the file specified by FileName exists. If the file does not exist, FileExists returns 0. |
int FileSeek(int Handle, int Offset, int Origin) |
Positions the current file pointer in a previously opened file. Use FileSeek to position the file pointer in a file that was opened with FileOpen or FileCreate. Handle contains the file handle that was returned by FileOpen or FileCreate. Offset specifies the number of bytes from Origin where the file pointer should be positioned. Origin is a code with three possible values, denoting the beginning of the file, the end of the file, and the current position of the file pointer. Origin Action 0 The file pointer is positioned Offset bytes from the beginning of the file. 1 The file pointer is positioned Offset bytes from its current position. 2 The file pointer is positioned Offset bytes from the end of the file. If FileSeek is successful, it returns the new position of the file pointer; otherwise, it returns -1. |
int FileGetc(int FileHandle) |
Gets character from the specified file. FileGetc returns the next character from the specified file. The file pointer is incremented after the read to point to the next byte. The return value is the byte read. |
int FilePutc(int FileHandle, int Char) |
Puts a character to the specified file. FilePutc writes a byte to the specified file at the position pointed to by the file pointer. The file pointer is incremented after the write to point to the next byte. The return value is a 1 if the write is successful, or -1 if an error occurred. |
String FileOpenDialog(String FileFilter, [String Caption], [String DefaultFileName]) |
Display a modal Windows dialog box for selecting and opening files. Filter Parameter: To create file masks, assign a value to the Filter property that consists of a description and a mask separated by a vertical bar (pipe) character. Do not include spaces around the vertical bar. For example, Filter = "Text files (*.txt)|*.TXT"; Multiple filters should be separated by vertical bars. For example, Filter = "Text files (*.txt)|*.TXT|C++ files (*.cpp)|*.cpp"; To include multiple masks in a single filter, separate the masks with semicolons. This works both in the Object Inspector and in program code. For example, Filter = "Script files|*.xpl;*.xvb;*.xjs"; If no value is assigned to Filter, the dialog displays all file types. Caption Parameter: Use Caption to specify the text that appears in the file-selection dialog’s title bar. If no value is assigned to Caption, the dialog has the title "Open". DefaultFileName Parameter: Use DefaultFileName to specify a default file name in the dialog box. |
String FileSaveDialog(String FileFilter, [String Caption], [String DefaultFileName]) |
Display a modal Windows dialog box for selecting file names and saving files. Filter Parameter: Same as the FileOpenDialog function Caption Parameter: Use Caption to specify the text that appears in the file-selection dialog’s title bar. If no value is assigned to Caption, the dialog has the title "Save". DefaultFileName Parameter: Use DefaultFileName to specify a default file name in the dialog box. |
Notes: None of the functions in the Fs object will throw errors. (i.e. the
script will not abort if a file does not exist, etc.)
It is up to the
script to do any error handling when using these functions.
When the script ends, any
open files will remain open until you close WinExplorer.
Don't forget to close any
files you open in your script!
Contacting the Author
Please note, there is NO OFFICIAL website for WinExplorer.
WinExplorer is freeware available to all smartcard users on many websites and irc channels.
I do not endorse any dealers or any particular websites.
If you have any comments, questions or suggestions about WinExplorer,
You can e-mail me at WinExplorer@yahoo.com
Please NO questions about the following, I will not even reply to them:
Card programming issues.
Problems running a particular script.
Will programmer xxx work WinExplorer? (How could I possibly know unless I have one?)
Why am I getting timeout 2A/58 messages? (the answer is in this file!)
You can also find me hanging around on the following IRC channels:
Novernet:
irc.c-plusnet.com - #DssWare, #Dss/Tech
WinExplorer History
1.0 (9/98) |
|
1.1 (9/98) |
|
1.2 (9/98) |
|
1.3 (9/98) |
|
1.4 (9/98) |
|
1.5 (9/98) |
|
1.6 (10/98) |
|
1.7 (10/98) |
|
1.8 (10/98) |
|
1.81 (10/98) |
|
1.9 (10/98) |
|
1.91 (11/98) |
|
2.0 (11/98) |
|
2.1 (11/98) |
|
2.2 (11/98) |
|
3.0 (12/98) |
|
3.1 (12/98) |
|
3.2 (12/98) |
|
3.3 (1/99) |
|
3.4 (1/99) |
|
3.5 (2/99) |
|
3.6 (4/99) |
|
4.0 (8/99) |
|
4.1 (8/99) |
|
4.2 (11/99) |
|
4.3 (2/00) |
|
4.4 (4/00) |
|