Using DebugView to Track SecureLogin Application Definitions

Absent Member.
Absent Member.
0 0 2,797
0 Likes

Often when working with an application definition (script), it becomes necessary to add additional messages to be displayed on the screen. This is done so that the developer knows where in the script things are happening - and if the script is running slowly, where it is getting stuck.



Normally this is done by using the standard MessageBox. This displays a message on the screen with some text showing what is going on. As an example, this command



MessageBox "Now Starting Logon"


would display the following window:





Figure 1 - "Now Starting Logon" message



This gives the right level of information and is very obvious. At this point, the script stops running and waits for the user to clear the message. While this is good for many issues, it does not help with performance monitoring or any other time-sensitive issues. Because it relies on the user clearing the box before the script continues to run, the application could be changing in the background.



To get around this problem, the Microsoft application DebugView can be used. This allows a user to view debug messages being created on the workstation. The software is free to download from http://www.microsoft.com/technet/sysinternals/utilities/debugview.mspx and when downloaded comes as a zip file. This includes the executable, which does not have to be installed and can be added to any toolkit simply by copying the file.



When started, the DebugView application will begin to display debug information immediately.





Figure 2 - DebugView application



On my system I have a number of operations taking place that generate quite a number of SRB_STATUS_INVALID_REQUESTS, but I can ignore these as they are consistent.



I now take the SecureLogin script and modify it to include this command:



DebugPrint "Now Starting Logon"


This is exactly the same format and location as the MessageBox command. I put this in my test script (using Notepad.exe) and start Notepad. Inside DebugView I can then see the following:





Figure 3 - Notification in DebugView window



This shows at line 176 that I have a new notification. This tells me that the script being run is the notepad.exe script, and that at line 33 a DebugPrint command has been issued with the parameters "Now Starting Logon".



In order to simplify the display, a filter can be turned on. In my case I specify that I am only interested in lines that include "notepad". I do this by setting the filter using the Edit/Filter menu (or Ctrl+L as a shortcut):





Figure 4 - Setting the DebugView filter



From here on, the only messages displayed will be those that include the "notepad" text. For this example I use the notepad.exe script below:



# Script for Notepad.exe used for testing
Local ?Counter
DebugPrint "Starting Script"
Dialog
#Title "Untitled - Notepad"
Class Notepad
EndDialog

DebugPrint "Detected Dialog"
If ?Counter gt 2
Set ?Counter 0
EndIf
Increment ?Counter
If ?Counter eq 1
DebugPrint "Counter is " ?Counter
MessageBox "Now Starting Logon"
DebugPrint "Now Starting Logon"
EndIf


This then produced the following easy-to-understand output in DebugView.





Figure 5 - Notepad.exe output in DebugView



Using this technique allows scripts to process normally and yet be monitored by the developer to remove bugs and other issues. This simplifies the process of support and development.

Tags (1)
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.