External Program in DMM

STB Suite | The Industry Standard in Peripheral Testing.


  • Ability to pass command line parameters to the program
  • Ability to retrieve the status of the program after it terminates
  • Ability to receive an ASCII string from the program that will be logged to the DMM logfile


Ability to pass command line parameters to the program:

When the user clicks the “External Program” test type (see pic below), a dialog box titled “External Program Command Line Parameters” will appear. In the edit box, enter the command line parameters.

IMPORTANT: The string that you enter in the edit box in the “External Program Command Line Parameters” dialog is appended to the HBA:Target:Lun:Slot information that is automatically passed to your external program. By way of an example, if device HBA=4,Target=7,Lun=0 is being tested, then the actual command line parameter your External Program will receive will be

“CheckTemperature.exe HBA=4,TID=7,LUN=0,SLOT=255,Gauge-07365”


Ability to retrieve the status of the program after it terminates:

Upon completion of the program, DMM will retrieve the exit code status of the program to determine the SUCCESS/FAILURE of the external program. This information will be logged to the DMM logfile. An example of the logging done follows:

04/14/2009 08:15:23 TEST 1 of 1:

External Program Test, executable = C:WorkdirTestExtProgDebugTestExtProg.exe

04/14/2009 08:16:34 Test Failed

Return code from External Program: 00000055
String Data from the External Program follows:
The Temperature is 98 degrees
04/14/2009 08:16:34 *** FAIL ***

Ability to receive an ascii string from the program that will be logged to the DMM logfile:

After the external program has completed, DMM will retrieve, if available, an ascii string from a system memory-mapped file. The external program, prior to exiting, must store the ascii string into the system memory-mapped file so that DMM can retrieve it. The name of the memory mapped file will have the format “DMM_HBAnnTIDxxxLUNyy” (for example DMM_HBA03TID007LUN00). The size of the data in the memory-mapped file will be no larger than 4K.

The following code can be pasted into your application (with the appropriate modifications) that will log a string to the DMM logfile:

CString strInfo;

DWORD dwLastError;

CString strMMFName;

int nLenOfString;

int nOffsetToString = 4;





if (!hMMF)


dwLastError = GetLastError();







if (hMMF)


char * pStr = (char *)MapViewOfFile(hMMF,





//Store the number 1 in the first 4 bytes of the memory mapped 


int * pIntPtr = (int *)pStr;

*pIntPtr = 1;

//Copy the text to the memory map file


nLenOfString = strlen(m_strDMMText);

FlushViewOfFile(pStr,nLenOfString + nOffsetToString);






dwLastError = GetLastError();


Stop On Error in DMM

DMM will have an additional “Stop On Error” option to run an external program. All information contained in Section 1 is applicable.


Asynchronous running of an external program

SCSIToolbox will have the capability to receive notification that it is to run an external program

  • The notification will be via the Windows message WM_COPYDATA. The message must be sent to the main window of SCSIToolbox (a handle to the main window can be found via the API FindWindow(NULL,“SCSI Toolbox32”) ). The string data SCSIToolbox will be expecting in the WM_COPYDATA message are:
    • CODE=2
    • ExtProg=’name of external program to run’
    • CmdLine=’command line parameters’
    • HBA=nn
    • TID=xxx
    • LUN=yy
As an example, the string data passed via WM_COPYDATA could be:
As in Section 1, the return code from the external program will be logged to the DMM logfile and if an ascii string needs to also be logged, that string must be stored in the System Memory-Mapped file (and the name of this memory-mapped file will have the same format as outlined in Section 1)