Sei sulla pagina 1di 23

Crear un Compilador de Batch en Visual Basic 6.

0 By Dhck oNe or Deunder_Talker



http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 1

1.- Introduccin

Hola ! , Te preguntaras como hacer un compilador en Visual Basic ? , bueno para ello hize
este tuto , para que puedas crear tu propio compilador de batch , realmente puede ser de
cualquier tipo de archivo , algunos que nos podrian convenir son los de las extensiones .js ,
.vbs , .bat , .cmd , entre otros xD, y te preguntaras como funciona esto ? bueno un compilador
se basa en un editor o compiler y una stub , y te preguntaras con que se come eso ? bueno el
editor es el encargado de meterle los datos a la stub , y la stub lo que hace es extraer los datos
que le pego el editor , procesas del modo que mas se le plasca la gana y ejecutar el archivo
que originalmente el editor le pego.

2.- Construccin del Editor

Bueno empezemos manos a la obra ! xD ... Abramos el vb y creemos un proyecto comun y
corriente xD,Primero coloquemosle dos Textbox , para que sea mas comodo uno nombralo
txtFile y el otro txtIcon , ambos deben tener la propiedad Locked en True , luego crea Dos
labels una Con el Carption Archivo : y la otra Icono luego coloca 5 CommandButton o 5
Command_XP al primero Ponle el nombre de cmdFile y caption ... o Examinar , el
segundo cmdIcon y caption ... o Examinar, el tercero cmdCompiler y caption Compilar
o Build o Make o que se yo xD,el cuarto cmdAbout y caption Acerca de Mi o Acerca
de ...,el quinto cmdCode y Caption Ver Codigo o similare ,tambien un CheckBox con
nombre chkEjecucin y caption Ejecucin Visible esto se deberia ver igual o similar a esto
:

[Me quedo un poko estrecho =$]

Bueno ya paso la entretencion de hacer la interface ...jeje... ahora nos vamos a ir al codigo

Primero que todo vamos a crear un modulo que emula o crea el CommondDialog pero con las
APIs (Copia y pega)

Private Declare Function GetSaveFileName Lib "comdlg32.dll" Alias "GetSaveFileNameA" (pOpenfilename As OPENFILENAME) As
Long
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As
Long
Private Type OPENFILENAME
lStructSize As Long
hWndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 2
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Function OpenDlg(hwnd As Long, Filter As String, Title As String, Inidir As String) As String
Dim OFName As OPENFILENAME
With OFName
.lStructSize = Len(OFName)
'Establecemos el hwnd del form
.hWndOwner = hwnd
'Establecemos el numero de instancia de la aplicacion
.hInstance = App.hInstance
'Establecemos el filtro de archivos a mostrar, _
en este caso txt y todos los ficheros
.lpstrFilter = Filter
'Ac debemos crear un buffer para el archivo
.lpstrFile = Space$(254)
'Establecemos el tamao maximo retornado
.nMaxFile = 255
'Creamos un buffer para el titulo del archivo
.lpstrFileTitle = Space$(254)
'Establecemos el tamao maximo retornado
.nMaxFileTitle = 255
'Establecemos el directorio por defecto que mostrar el dialogo
.lpstrInitialDir = Inidir
'El title
.lpstrTitle = Title
'Flasgs que detereminan caracteristicas del dialogo
.flags = 0
End With
'Abrimos el cuadro de dilogo pasndole _
a GetOpenFileName la estructura anterior
If GetOpenFileName(OFName) Then
OpenDlg = OFName.lpstrFile
Else
OpenDlg = ""
End If
End Function
Public Function SaveDlg(hwnd As Long, Filter As String, Inidir As String, Title As String) As String
Dim OFName As OPENFILENAME
With OFName
'Establecmos el tamao de la extructura
.lStructSize = Len(OFName)
'Establecmos el hwnd de la aplicacin, es decir _
la del form que llama al dilogo
.hWndOwner = hwnd
'Ac la instancia
.hInstance = App.hInstance
'Establecemos los filtros de extension que mostr
.lpstrFilter = Filter
'Le pasamos un buffer al nombre de archivo
.lpstrFile = Space$(254)
'Debemos establecer el maximo de caracteres del buffer anterior
.nMaxFile = 255
'Lo mismo pero para el ttulo del dilogo de windows
.lpstrFileTitle = Space$(254)
'Debemos establecer el maximo de caracteres del buffer
.nMaxFileTitle = 255
'Establecemos el drectorio inicial que mostrar el dilogo
.lpstrInitialDir = Inidir
'Establecemos el titulo
.lpstrTitle = Title
'Los flags
.flags = 0
End With

'Mostramos el dialogo pasandole la estructura a la funcin Api GetSaveFileName
If GetSaveFileName(OFName) Then
SaveDlg = Trim$(Replace(OFName.lpstrFile, Chr(0), ""))
Else
SaveDlg = ""
End If
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 3
End Function


Bueno ahora si jeje

cmdFile :

Dim Path As String
Path = OpenDlg(Me.hwnd, "Archivos de lotes" + Chr(0) + "*.bat;*.cmd;*.nt", "[nombre
de tu compiler] - Abrir", Environ$("USERPROFILE") & "\Escritorio")
If Not Path = "" Then txtFile = Path: GoTo xau
MsgBox "No has seleccionado ningn Archivo de lotes", vbCritical, "[Nombre de tu
compiler]"
xau:

cmdIcon :

Dim Path As String
Path = OpenDlg(Me.hwnd, "Iconos" + Chr(0) + "*.ico", "[nombre de tu compiler] -
Abrir", Environ$("USERPROFILE") & "\Escritorio")
If Not Path = "" Then txtIcon = Path: GoTo xau
MsgBox "No has seleccionado ningn Icono", vbCritical, "[Nombre de tu compiler]"
xau:

Para continuar crearemos un nuevo Form llamado frmView

Hay colocamos un TextBox llamado Text1 .. xD . con las propiedades

Multiline = True
ScrollBars = 3 Both

Ahora solo debe haber de codigo esto

Private Sub Form_Resize()
If Not Me.WindowState = vbMinimized Then Text1.Height = Me.Height - 450:
Text1.Width = Me.Width - 65
End Sub

... Continuemos con el editor

cmdCode

frmView.Show
If Not txtFile = "" Then
Dim todo As String
Open txtFile For Binary As #1
todo = Space(LOF(1))
Get #1, , todo
Close #1
frmView.Show
frmView.Caption = txtFile & " - Visor de Codigo"
frmView.Text1 = todo
Else
MsgBox "No hay Archivo", vbCritical, "[NombreCompiler]
Viewer"
End If

Ahora el boton mas importante ....
cmdCompiler :

Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 4
On Error GoTo man
If txtFile = "" Then MsgBox "No hay Archivo a Compilar", vbCritical, "Hazard": GoTo
fin
If txtIcon = "" Then
If MsgBox("No has seleccionado ningun icono , desea usar el icono por defecto ,
elija No para Cancelar la compilacin y seleccionar un icono", vbQuestion &
vbYesNo, "Hazard") = vbNo Then
btnIcon_Click
GoTo fin
End If
End If
Path = SaveDlg(Me.hwnd, "Aplicaciones" + Chr(0) + "*.exe", Environ$("USERPROFILE")
& "\Escritorio", "[ nombre compiler] - Compilar")
If Path = "?" Then MsgBox "No has selecciona un archivo !!!, no se puede compilar",
vbCritical, "Hazard": Exit Sub
Path = Path & ".exe"
recurso = LoadResData("STUB", "CUSTOM")
Open Path For Binary As #1
Put #1, , recurso
Close #1
If txtIcon <> "" Then
ReplaceIcons txtIcon, Path, erro
End If
Open txtFile For Binary As #1
todo = Space(LOF(1))
Get #1, , todo
Close #1
If chkEjecucin = vbChecked Then
modo = "vis"
Else
modo = "inv"
End If
datos = RC4(todo, "Sky") & "|Sky2|" & modo
Open Path For Binary As #1
Seek (1), LOF(1) + 1
Put #1, , "|Sky|"
Put #1, , datos
Close #1
MsgBox "Archivo Compilado !", vbInformation, "[ nombre compiler]"
Exit Sub
man:
MsgBox Err.Number & " " & Err.Description, vbCritical, "[ nombre compiler]!"
fin:

Si obervas bien esta parte del codigo hay varias cosas raras tales como Sky o |Sky2| o la funcion
RC4 o un monton de variables no declaradas bueno este es la parte rancia o coplicada no te asustes xD
Primero vamos a crear otro modulo con Nombre bRC4 y su codigo

bRC4 :

Public Function RC4(ByVal Expression As String, ByVal Password As String) As String
On Error Resume Next
Dim RB(0 To 255) As Integer, x As Long, Y As Long, Z As Long, Key() As Byte,
ByteArray() As Byte, Temp As Byte
If Len(Password) = 0 Then
Exit Function
End If
If Len(Expression) = 0 Then
Exit Function
End If
If Len(Password) > 256 Then
Key() = StrConv(Left$(Password, 256), vbFromUnicode)
Else
Key() = StrConv(Password, vbFromUnicode)
End If
For x = 0 To 255
RB(x) = x
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 5
Next x
x = 0
Y = 0
Z = 0
For x = 0 To 255
Y = (Y + RB(x) + Key(x Mod Len(Password))) Mod 256
Temp = RB(x)
RB(x) = RB(Y)
RB(Y) = Temp
Next x
x = 0
Y = 0
Z = 0
ByteArray() = StrConv(Expression, vbFromUnicode)
For x = 0 To Len(Expression)
Y = (Y + 1) Mod 256
Z = (Z + RB(Y)) Mod 256
Temp = RB(Y)
RB(Y) = RB(Z)
RB(Z) = Temp
ByteArray(x) = ByteArray(x) Xor (RB((RB(Y) + RB(Z)) Mod 256))
Next x
RC4 = StrConv(ByteArray, vbUnicode)
End Function

Para que sepas RC4 es una encriptacin esto es por que habeces un compila sus codigos batch
para protegerlos , para que no los plagien o que se y xD lo que hara la funcion RC4 es por
ejemplo

RC4(Viva yo,Micontrasea)

Convertira Viva yo a 5

Ahora te preguntaras y lo de txtIcon y cmdIcon sera para ... Si es para cambiarle el icono que
viene por defecto en la stub que nosotros se lo damos yo colocare este esea que si el
user no elige icono el archivo compilado tendra ese icono , pero ahora como cambiar el icono
, con dos modulos debo destacar que no son nada de cortos haci que a preparar el Copy y
Paste xD

Modulo 1 : Nombre PE

Option Explicit
Public Type IMAGE_DOS_HEADER
Magic As Integer
cblp As Integer
cp As Integer
crlc As Integer
cparhdr As Integer
minalloc As Integer
maxalloc As Integer
ss As Integer
sp As Integer
csum As Integer
ip As Integer
cs As Integer
lfarlc As Integer
ovno As Integer
res(3) As Integer
oemid As Integer
oeminfo As Integer
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 6
res2(9) As Integer
lfanew As Long
End Type

Public Type IMAGE_FILE_HEADER
Machine As Integer
NumberOfSections As Integer
TimeDateStamp As Long
PointerToSymbolTable As Long
NumberOfSymbols As Long
SizeOfOtionalHeader As Integer
Characteristics As Integer
End Type

Public Type IMAGE_DATA_DIRECTORY
DataRVA As Long
DataSize As Long
End Type

Public Type IMAGE_OPTIONAL_HEADER
Magic As Integer
MajorLinkVer As Byte
MinorLinkVer As Byte
CodeSize As Long
InitDataSize As Long
unInitDataSize As Long
EntryPoint As Long
CodeBase As Long
DataBase As Long
ImageBase As Long
SectionAlignment As Long
FileAlignment As Long
MajorOSVer As Integer
MinorOSVer As Integer
MajorImageVer As Integer
MinorImageVer As Integer
MajorSSVer As Integer
MinorSSVer As Integer
Win32Ver As Long
ImageSize As Long
HeaderSize As Long
Checksum As Long
Subsystem As Integer
DLLChars As Integer
StackRes As Long
StackCommit As Long
HeapReserve As Long
HeapCommit As Long
LoaderFlags As Long
RVAsAndSizes As Long
DataEntries(15) As IMAGE_DATA_DIRECTORY
End Type

Public Type IMAGE_SECTION_HEADER
SectionName(7) As Byte
Address As Long
VirtualAddress As Long
SizeOfData As Long
PData As Long
PReloc As Long
PLineNums As Long
RelocCount As Integer
LineCount As Integer
Characteristics As Long
End Type

Type IMAGE_RESOURCE_DIR
Characteristics As Long
TimeStamp As Long
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 7
MajorVersion As Integer
MinorVersion As Integer
NamedEntries As Integer
IDEntries As Integer
End Type

Type RESOURCE_DIR_ENTRY
Name As Long
Offset As Long
End Type

Type RESOURCE_DATA_ENTRY
Offset As Long
Size As Long
CodePage As Long
Reserved As Long
End Type

Public Type IconDescriptor
ID As Long
Offset As Long
Size As Long
End Type

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As
Any, Source As Any, ByVal Length As Long)
Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal
lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long,
lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByVal
dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
Public Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As
Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped
As Any) As Long
Public Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As
Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long,
lpOverlapped As Any) As Long
Public Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal
lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long)
As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long

Private SectionAlignment As Long
Private FileAlignment As Long
Private ResSectionRVA As Long
Private ResSectionOffset As Long
Public Function Valid_PE(hFile As Long) As Boolean

Dim Buffer(12) As Byte
Dim lngBytesRead As Long
Dim tDosHeader As IMAGE_DOS_HEADER

If (hFile > 0) Then
ReadFile hFile, tDosHeader, ByVal Len(tDosHeader), lngBytesRead, ByVal 0&
CopyMemory Buffer(0), tDosHeader.Magic, 2
If (Chr(Buffer(0)) & Chr(Buffer(1)) = "MZ") Then
SetFilePointer hFile, tDosHeader.lfanew, 0, 0
ReadFile hFile, Buffer(0), 4, lngBytesRead, ByVal 0&
If (Chr(Buffer(0)) = "P") And (Chr(Buffer(1)) = "E") And (Buffer(2) = 0)
And (Buffer(3) = 0) Then
Valid_PE = True
Exit Function
End If
End If
End If

Valid_PE = False

End Function
Public Function GetResTreeOffset(hFile As Long) As Long
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 8
On Error GoTo ErrHandler:

Dim tDos As IMAGE_DOS_HEADER
Dim tFile As IMAGE_FILE_HEADER
Dim tOptional As IMAGE_OPTIONAL_HEADER
Dim tSections() As IMAGE_SECTION_HEADER
Dim BytesRead As Long
Dim intC As Integer
Dim TreeFound As Boolean

TreeFound = False
If (hFile > 0) Then
SetFilePointer hFile, 0, 0, 0
' Get the offset of the Image File Header
ReadFile hFile, tDos, Len(tDos), BytesRead, ByVal 0&
SetFilePointer hFile, ByVal tDos.lfanew + 4, 0, 0
' Get the Image File Header and the Image Optional Header
ReadFile hFile, tFile, Len(tFile), BytesRead, ByVal 0&
ReadFile hFile, tOptional, Len(tOptional), BytesRead, ByVal 0&
' Get section headers
ReDim tSections(tFile.NumberOfSections - 1) As IMAGE_SECTION_HEADER
ReadFile hFile, tSections(0), Len(tSections(0)) * tFile.NumberOfSections,
BytesRead, ByVal 0&
' Make sure there is a resource tree in this file
If (tOptional.DataEntries(2).DataSize) Then
' Save section alignment and file alignment of image
SectionAlignment = tOptional.SectionAlignment
FileAlignment = tOptional.FileAlignment
' Determine which section contains the resource tree
For intC = 0 To UBound(tSections)
If (tSections(intC).VirtualAddress <= tOptional.DataEntries(2).DataRVA)
_
And ((tSections(intC).VirtualAddress + tSections(intC).SizeOfData) >
tOptional.DataEntries(2).DataRVA) Then
TreeFound = True
' Save RVA and offset of resource section for future calculations
ResSectionRVA = tSections(intC).VirtualAddress
ResSectionOffset = tSections(intC).PData
' Calculate the physical file offset of the resouce tree
GetResTreeOffset = tSections(intC).PData +
(tOptional.DataEntries(2).DataRVA - tSections(intC).VirtualAddress)
Exit For
End If
Next intC
If Not TreeFound Then
GetResTreeOffset = -1
End If
Else
GetResTreeOffset = -1
End If
Else
GetResTreeOffset = -1
End If
Exit Function

ErrHandler:
MsgBox "An error occurred while locating the resource tree. " _
& " Please make sure neither of the specified files are in use.", vbOKOnly +
vbExclamation, _
App.EXEName & " - " & Err.Description

End Function
Public Function GetIconOffsets(hFile As Long, TreeOffset As Long, Icons() As
IconDescriptor) As Long
On Error GoTo ErrHandler:

Dim Root As IMAGE_RESOURCE_DIR ' Root node of resource tree
Dim L1Entries() As RESOURCE_DIR_ENTRY ' 1st level of directory entries
Dim L2Root() As IMAGE_RESOURCE_DIR ' Level 2 resource directories
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 9
Dim L2Entries() As RESOURCE_DIR_ENTRY ' 2nd level of directory entries
Dim L3Root() As IMAGE_RESOURCE_DIR ' Level 3 resource directories
Dim L3Entries() As RESOURCE_DIR_ENTRY ' 3rd level of directory entries
Dim DataEntries() As RESOURCE_DATA_ENTRY ' Resource data entries
Dim DIB As DIB_HEADER ' Descriptor for icon images
Dim iLvl1 As Integer ' Loop Counter (first level)
Dim iLvl2 As Integer ' Loop Counter (second level)
Dim iLvl3 As Integer ' Loop Counter (third level)
Dim Cursor As Long ' Temp val for setting file pointer
Dim BytesRead As Long ' For ReadFile()
Dim Count As Integer ' Number of icons found

If (hFile > 0) Then
Count = 0
SetFilePointer hFile, ByVal TreeOffset, 0, 0
' Get the root node and begin navigating the resource tree
ReadFile hFile, Root, Len(Root), BytesRead, ByVal 0
ReDim L2Root(Root.NamedEntries + Root.IDEntries) As IMAGE_RESOURCE_DIR
ReDim L1Entries(Root.NamedEntries + Root.IDEntries) As RESOURCE_DIR_ENTRY
' Get first level child nodes
For iLvl1 = 1 To (Root.NamedEntries + Root.IDEntries)
SetFilePointer hFile, TreeOffset + 8 + (iLvl1 * 8), 0, 0
ReadFile hFile, L1Entries(iLvl1), 8, BytesRead, ByVal 0&
If L1Entries(iLvl1).Name = 3 Then
' Jump to level 2 and get directory
' Strip high-order byte from offset
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + TreeOffset
SetFilePointer hFile, ByVal Cursor, 0, 0
ReadFile hFile, L2Root(iLvl1), 16, BytesRead, ByVal 0&
ReDim L3Root(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries) As
IMAGE_RESOURCE_DIR
ReDim L2Entries(L2Root(iLvl1).IDEntries + L2Root(iLvl1).NamedEntries)
As RESOURCE_DIR_ENTRY
For iLvl2 = 1 To (L2Root(iLvl1).IDEntries + L2Root(iLvl1).NamedEntries)
' Read second level child nodes
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + TreeOffset
SetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0
ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&
' Jump to level 3 and get directory
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + TreeOffset
SetFilePointer hFile, ByVal Cursor, 0, 0
ReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&
ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRY
ReDim DataEntries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DATA_ENTRY
For iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)
' Read third level child nodes
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + TreeOffset
SetFilePointer hFile, (Cursor + 8 + (iLvl3 * 8)), 0, 0
ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&
' Jump to IMAGE_DATA_ENTRY and get RVA of IconDir structure
SetFilePointer hFile, TreeOffset + (L3Entries(iLvl3).Offset), 0,
0
ReadFile hFile, DataEntries(iLvl3), 16, BytesRead, ByVal 0&
' Convert RVA of IconDir structure to file offset and store
Count = Count + 1
ReDim Preserve Icons(Count) As IconDescriptor
Icons(Count).Offset = RVA_to_Offset(DataEntries(iLvl3).Offset)
' Store ID of icon resource
Icons(Count).ID = L2Entries(iLvl2).Name
' Store Size of icon resource
SetFilePointer hFile, Icons(Count).Offset, 0, 0
ReadFile hFile, DIB, ByVal Len(DIB), BytesRead, ByVal 0&
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 10
Icons(Count).Size = DIB.ImageSize + 40
Next iLvl3
Next iLvl2
End If
Next iLvl1
Else
Count = 0
End If

' Return the number of icons found
GetIconOffsets = Count
Exit Function

ErrHandler:
MsgBox "An error occurred while locating the icon resources. " _
& " Please make sure neither of the specified files are in use.", vbOKOnly +
vbExclamation, _
App.EXEName & " - " & Err.Description

End Function
Public Function HackDirectories(hFile As Long, ResTree As Long, DIBOffset As Long,
_
DIBAttrib As ICON_DIR_ENTRY) As Boolean
On Error GoTo ErrHandler:

Dim Cursor As Long ' File pointer position
Dim Root As IMAGE_RESOURCE_DIR ' Root node of res tree
Dim L1Entries() As RESOURCE_DIR_ENTRY ' First-level child nodes
Dim L2Root() As IMAGE_RESOURCE_DIR ' Second-level root nodes
Dim L2Entries() As RESOURCE_DIR_ENTRY ' Second-level child nodes
Dim L3Root() As IMAGE_RESOURCE_DIR ' Third-level root nodes
Dim L3Entries() As RESOURCE_DIR_ENTRY ' Third-level child nodes
Dim DataEntries() As RESOURCE_DATA_ENTRY ' IMAGE_RESOURCE_DATA_ENTRY structs
Dim IcoDir As ICON_DIR ' IconDirectory in EXE
Dim iLvl1 As Integer ' Loop Counter (first level)
Dim iLvl2 As Integer ' Loop Counter (second level)
Dim iLvl3 As Integer ' Loop Counter (third level)
Dim intC As Integer ' Loop Counter (general)
Dim BytesRead As Long ' Returned by Read/WriteFile API's

If (hFile >= 0) Then
' Convert DIBOffset to an RVA (needed for RESOURCE_DATA_ENTRY structures)
DIBOffset = Offset_to_RVA(DIBOffset)
SetFilePointer hFile, ByVal ResTree, 0, 0
ReadFile hFile, Root, Len(Root), BytesRead, ByVal 0&
ReDim L1Entries(Root.NamedEntries + Root.IDEntries) As RESOURCE_DIR_ENTRY
ReDim L2Root(Root.NamedEntries + Root.IDEntries) As IMAGE_RESOURCE_DIR
' Loop through first-level child nodes and find RT_GROUP_ICON branch
For iLvl1 = 1 To (Root.NamedEntries + Root.IDEntries)
SetFilePointer hFile, ResTree + 8 + (iLvl1 * 8), 0, 0
ReadFile hFile, L1Entries(iLvl1), 8, BytesRead, ByVal 0&
If L1Entries(iLvl1).Name = &HE Then
' RT_GROUP_ICON branch found
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, Cursor, 0, 0
' Read second-level directory
ReadFile hFile, L2Root(iLvl1), 16, BytesRead, ByVal 0&
ReDim L2Entries(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
As RESOURCE_DIR_ENTRY
ReDim L3Root(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries) As
IMAGE_RESOURCE_DIR
For iLvl2 = 1 To (L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0
ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + ResTree
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 11
SetFilePointer hFile, Cursor, 0, 0
' Read thrid-level directory
ReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&
ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRY
For iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)
' Read third-level child nodes
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + ResTree + 8 + (iLvl3 * 8)
SetFilePointer hFile, Cursor, 0, 0
ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&
' Jump to RESOURCE_DATA_ENTRY
CopyMemory Cursor, L3Entries(iLvl3).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, Cursor, 0, 0
ReDim Preserve DataEntries(iLvl3) As RESOURCE_DATA_ENTRY
ReadFile hFile, DataEntries(iLvl3), 16, BytesRead, ByVal 0&
' Jump to and read ICON_DIR structure
Cursor = RVA_to_Offset(DataEntries(iLvl3).Offset)
SetFilePointer hFile, Cursor, 0, 0
ReadFile hFile, IcoDir, 6, BytesRead, ByVal 0&
For intC = 1 To IcoDir.Count
WriteFile hFile, DIBAttrib, Len(DIBAttrib) - 4, BytesRead,
ByVal 0&
SetFilePointer hFile, 2, 0, 1
Next intC
Next iLvl3
Next iLvl2
ElseIf L1Entries(iLvl1).Name = 3 Then
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, ByVal Cursor, 0, 0
' Read second-level directory
ReadFile hFile, L2Root(iLvl1), 16, BytesRead, ByVal 0&
ReDim L2Entries(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
As RESOURCE_DIR_ENTRY
ReDim L3Root(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries) As
IMAGE_RESOURCE_DIR
For iLvl2 = 1 To (L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0
ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + ResTree
SetFilePointer hFile, Cursor, 0, 0
' Read thrid-level directory
ReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&
ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRY
For iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)
' Read third-level child nodes
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3
Cursor = Cursor + ResTree + 8 + (iLvl3 * 8)
SetFilePointer hFile, Cursor, 0, 0
ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&
' Jump to and hack the RESOURCE_DATA_ENTRY
Cursor = L3Entries(iLvl3).Offset + ResTree
SetFilePointer hFile, Cursor, 0, 0
WriteFile hFile, DIBOffset, 4, BytesRead, ByVal 0&
WriteFile hFile, CLng(DIBAttrib.dwBytesInRes + 40), 4, BytesRead,
ByVal 0&
Next iLvl3
Next iLvl2
End If
Next iLvl1
Else
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 12
HackDirectories = False
Exit Function
End If

HackDirectories = True
Exit Function

ErrHandler:
MsgBox "An error occurred while modifying the resource directories. " _
& " Please make sure neither of the specified files are in use.", vbOKOnly +
vbExclamation, _
App.EXEName & " - " & Err.Description

End Function
Private Function RVA_to_Offset(RVA As Long) As Long
On Error GoTo ErrHandler:
Dim TempOffset As Long ' Difference of RVA and start of section
TempOffset = RVA - ResSectionRVA
If (TempOffset >= 0) Then
' Calculate the file offset of the RVA
RVA_to_Offset = ResSectionOffset + TempOffset
Else
RVA_to_Offset = -1
End If
Exit Function

ErrHandler:
MsgBox "Error in RVA_to_Offset function: " & Err.Number & ": " &
Err.Description, _
vbOKOnly + vbExclamation, App.EXEName & " - Error"
End Function

Private Function Offset_to_RVA(Offset As Long) As Long
On Error GoTo ErrHandler:

Dim TempOffset As Long ' Difference of Offset and start of section

' Get distance between offset and start of resource section
TempOffset = Offset - ResSectionOffset
If TempOffset >= 0 Then
' Calculate RVA of the file offset
Offset_to_RVA = ResSectionRVA + TempOffset
Else
Offset_to_RVA = -1
End If
Exit Function

ErrHandler:
MsgBox "Error in Offset_to_RVA function: " & Err.Number & ": " & Err.Description,
_
vbOKOnly + vbExclamation, App.EXEName & " - Error"

End Function

Y te diras esto es mas complicado que la mYrD@ (jeje) pues no jeje

Ahora va el modulo 2 : nombre Icon changer

Option Explicit
Type DIB_HEADER
Size As Long
Width As Long
Height As Long
Planes As Integer
Bitcount As Integer
Reserved As Long
ImageSize As Long
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 13
End Type

Type ICON_DIR_ENTRY
bWidth As Byte
bHeight As Byte
bColorCount As Byte
bReserved As Byte
wPlanes As Integer
wBitCount As Integer
dwBytesInRes As Long
dwImageOffset As Long
End Type

Type ICON_DIR
Reserved As Integer
Type As Integer
Count As Integer
End Type

Type DIB_BITS
Bits() As Byte
End Type

Public Enum Errors
FILE_CREATE_FAILED = 1000
FILE_READ_FAILED
INVALID_PE_SIGNATURE
INVALID_ICO
NO_RESOURCE_TREE
NO_ICON_BRANCH
CANT_HACK_HEADERS
End Enum
Public Function ReplaceIcons(Source As String, Dest As String, Error As String) As
Long

Dim IcoDir As ICON_DIR
Dim IcoDirEntry As ICON_DIR_ENTRY
Dim tBits As DIB_BITS
Dim Icons() As IconDescriptor
Dim lngRet As Long
Dim BytesRead As Long
Dim hSource As Long
Dim hDest As Long
Dim ResTree As Long

hSource = CreateFile(Source, ByVal &H80000000, 0, ByVal 0&, 3, 0, ByVal 0)
If hSource >= 0 Then
If Valid_ICO(hSource) Then
SetFilePointer hSource, 0, 0, 0
ReadFile hSource, IcoDir, 6, BytesRead, ByVal 0&
ReadFile hSource, IcoDirEntry, 16, BytesRead, ByVal 0&
SetFilePointer hSource, IcoDirEntry.dwImageOffset, 0, 0
ReDim tBits.Bits(IcoDirEntry.dwBytesInRes) As Byte
ReadFile hSource, tBits.Bits(0), IcoDirEntry.dwBytesInRes, BytesRead,
ByVal 0&
CloseHandle hSource
hDest = CreateFile(Dest, ByVal (&H80000000 Or &H40000000), 0, ByVal 0&, 3,
0, ByVal 0)
If hDest >= 0 Then
If Valid_PE(hDest) Then
ResTree = GetResTreeOffset(hDest)
If ResTree > 308 Then ' Sanity check
lngRet = GetIconOffsets(hDest, ResTree, Icons)
SetFilePointer hDest, Icons(1).Offset, 0, 0
WriteFile hDest, tBits.Bits(0), UBound(tBits.Bits), BytesRead,
ByVal 0&
If Not HackDirectories(hDest, ResTree, Icons(1).Offset,
IcoDirEntry) Then
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 14
Err.Raise CANT_HACK_HEADERS, App.EXEName, "Unable to modify
directories in target executable. File may not contain any icon resources."
End If
Else
Err.Raise NO_RESOURCE_TREE, App.EXEName, Dest & " does not
contain a valid resource tree. File may be corrupt."
CloseHandle hDest
End If
Else
Err.Raise INVALID_PE_SIGNATURE, App.EXEName, Dest & " is not a valid
Win32 executable."
CloseHandle hDest
End If
CloseHandle hDest
Else
Err.Raise FILE_CREATE_FAILED, App.EXEName, "Failed to open " & Dest &
". Make sure file is not in use by another program."
End If
Else
Err.Raise INVALID_ICO, App.EXEName, Source & " is not a valid icon
resource file."
CloseHandle hSource
End If
Else
Err.Raise FILE_CREATE_FAILED, App.EXEName, "Failed to open " & Source & ".
Make sure file is not in use by another program."
End If
ReplaceIcons = 0
Exit Function
ErrHandler:
ReplaceIcons = Err.Number
Error = Err.Description
End Function
Public Function Valid_ICO(hFile As Long) As Boolean
Dim tDir As ICON_DIR
Dim BytesRead As Long
If (hFile > 0) Then
ReadFile hFile, tDir, Len(tDir), BytesRead, ByVal 0&
If (tDir.Reserved = 0) And (tDir.Type = 1) And (tDir.Count > 0) Then
Valid_ICO = True
Else
Valid_ICO = False
End If
Else
Valid_ICO = False
End If
End Function

Bueno ese era mas cortito =) ahora vamos a declarar algunas variables



Recurso = es la variable donde descargaremos la stub
Todo=contenido del archivo bat
Datos = RC4(todo, "Sky") & "|Sky2|" & modo
[Encripta en RC4 la variable todo , con la contrasea Sky y aade la subfirma |Sky2|
mas el modo que es inv(Invisible) o vis(Visible)]
Path=variable que se usara para guadar temporalmente las rutas de los archivos
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 15
Modo = la variable que determina si el archivo en la stub se va ejecutar oculto o visible
Erro = variable que guardara si es que hay algun error en el cambio del icono a las stub


3.- Creando el stub

Les recomiendo que guarden par mientras el editor ya que aun no lo acuparemos, pero antes
debes fijarte de algo

datos = RC4(todo, "Sky") & "|Sky2|" & modo
Open Path For Binary As #1
Seek (1), LOF(1) + 1
Put #1, , "|Sky|"
Put #1, , datos
Close #1

IMPORTANTE :

Escribe en algun papel o algo la contrasea con que se encripto en RC4 en mi caso fue Sky
tambien la sub firma que en mi caso fue |Sky2| y la firma |Sky| puedes cambiarlas si es
que se te da la gana pero te recomineto que sean por ejemplo :
[-|Mifirma|-] o [_-Watzaa-_] o |Minick| o |nombrecompiler|

Continuemos
Creamos un nuevo proyecto , con un Form le colocamos un icono NEUTRO o el del
compiler, y creamos tambien el modulo bRC4 ahora debemos colocarle la propiedad Visible
a False para que no se muestre nada , todas las funciones se deben hacer en el evento
Form_Load hay debemos pegar esto

Codigo Entero :

Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal
lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As
Long
Private Declare Function GetModuleFileName Lib "kernel32" Alias
"GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByVal
nSize As Long) As Long
Private Declare Function GetWindowWord Lib "user32" (ByVal hwnd As Long, ByVal
nIndex As Long) As Integer
Dim Firma As String
Dim code() As String
Dim subp() As String
Dim todo As String
Dim dll As String
Dim des As String
Const GWW_HINSTANCE = (-6)
Const SW_SHOWHIDE = 0
Const SW_SHOWNORMAL = 1
Private Function Ruta() As String
Dim ModuleName As String, FileName As String, hInst As Long
ModuleName = String$(128, Chr$(0))
hInst = GetWindowWord(Me.hwnd, GWW_HINSTANCE)
ModuleName = Left$(ModuleName, GetModuleFileName(hInst, ModuleName,
Len(ModuleName)))
Ruta = ModuleName
End Function
Private Sub Form_Load()
On Error Resume Next
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 16
Dim sRuta As String
sRuta = App.Path & "\" & App.EXEName & ".bat"
Firma = "|Sky|"
Open Ruta For Binary As #1
todo = Space(LOF(1))
Get #1, , todo
Close #1
code = Split(todo, Firma)
subp = Split(code(1), "|Sky2|")
dll = Dir(sRuta)
If dll <> "" Then Kill sRuta
des = RC4(subp(0), "Sky")
Open sRuta For Binary As #1
Put #1, , des
Close #1
SetAttr sRuta, vbHidden
If subp(1) = "inv" Then
ShellExecute Me.hwnd, "Open", sRuta, vbNullString, "", SW_SHOWHIDE
Else
ShellExecute Me.hwnd, "open", sRuta, vbNullString, "", SW_SHOWNORMAL
End If
End
End Sub

Si es que en editor cambiaste las firmas y contrasea debes cambiarlas y ponerlas igual en el
stub

Me explico la parte de codigo naranja es aquella que lleva las apis funciones y contantes la
verde lleva una pequea funcin llamada Ruta.

Ahora debemos conpilar nuestra stub les recomiendo que les quiten las propiedades
CompanyName FileDescription o similares Ya que esto les disgusta a los usuarios ya
que tienen que estar editanto sus Apps con editores de recursos

Listo
4.- Colocar la Stub en los recursos

Primero que todo vaos a hacer un pequeo truco de manifest en los recursos
Vamos al bloc de notas y no escribimos nada

Y lo guardamos de la siguiente forma Archivo\Guardar Como ...



Recuerden Nombrecualquiera.RES
Y ahora vamos hacer lo mismo pero vamos a escribir lo siguiente :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-
com:asm.v1" manifestVersion="1.0"><assemblyIdentity version="1.0.0.0"
processorArchitecture="X86" name="TestDLL.exe" type="win32"/><description>Aplicacion de
ejemplo...</description><dependency><dependentAssembly><assemblyIdentity type="win32"
name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df" language="*"/></dependentAssembly></dependency></assembly>



Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 17
y lo guadramos con el nombre Recurso.txt como cualquier archivo de texto plano
creo que debeis descargar un pequea utilidad pero como buenos proramadores o Hacker creo que la
debe de Tener estoy hablando de Resource Hacker Bueno si no la tienen pueden descargarla desde
google es muy conocida y es GRATIS !!! weno habrimos nuestro archivo Nombrecompiler.RES y
hacemos lo siguiente nos vamos al menu Action luego a Add a new Resouce presionamos en
Open File with new Resouce y seleccioanmos nuestro archivo Resouce.txt

Ahoar colocan lo siguiente

ResourceType : 24
ResourceName: 1
ResourceLanguaje : 13322
Cosa que quede haci :













Y resionamos en Add Resouce

Y nos queda haci



Manifest Listo Ahora vamos a Save As y guardamos con el nombre de NewRes.res. Bueno ahora
abrimos nuestro editor o comiler y hacemos lo siguiente :



Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 18
Clickamos en Archivo de recursos y abrimos el archivo NewRes.res para poder ver esos
recursos hay que hacer lo siguiente : nos vamos al menu Complementos y luego Administrador
de Complementos hay verememos un monton de mYrd@ jeje debemos buscar uno llamado VB 6
Resouce Editor Clicamos en el y abajo en la esquina inferior derecha hay esto deben dejarlo haci :



Y Aceptamos luego clickamos dos veces en

(en el recurso)

Y nos parecera nuestro Vb Editor de recursos como pueden ver hay esta nuestro Manifest que hara
que al compilar nuestro Compilador Tenga el Estilo De Windows Xp o Vista xD


Wenu ahora vamos a agregar la estub no te aflijas esto lo vasmos a hacer en 30 seg wenu yo en 10 seg
xD Clicamos en en la barra y selccionamo nuestro Stub Compilado



Hay esta pero queda un pequeo detalle xD seleccionamos nuestro recurso y clicamos en hay nos
aparecera una nueva ventana
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 19

Debemos modificarla asi



Debemos cambiar 101 por STUB y estaremos listo con todo ahoar debemos hacer un About un
Acerca de ... bla bla bla crea un nuevo formulario llamado frmAbout y has los siguiente aki voy a
colocar una imagen del mio

[ese es de otro compiler mio llamado hazard ya que me dio pereza hacer otro en el homer xD]

En el boton que dice And You =) ! debes colocarle en el codigo :

Private Sub Command1_Click()
Unload Me
End Sub
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 20
Ahora en el form principal debemos colocar en el boton de Acerca de Mi Lo siguiente :

Private Sub cmdAbout_Click()
frmAbout.Show
End Sub

5.- Enchulando el Compiler

Bueno les voy a dejar 2 cosillas para enchular esyo para que no se vea tan fome xD
Primero podemos agregarle un Scroll de texto , para eso debemos colocar un Timer con su nombre po
defecto y con interval entre 130 y 150

Codigo Timer1 :

Private Sub Timer1_Timer()
strText = Mid(strText, 2) & Left(strText, 1)
Scroll = strText
End Sub

Y en la parte del pricipio donde declaramos las variables debemos colocar una mas

Dim strText As String

y en el evento form Load debemos agregar una linea

strText = " Hazard Batch Compiler - Create By Dhck oNe -
Deunder_Talker ... Thank to my friends SkullMaster- krackwar - MadAntrax - Freeze
- H-black - Who - nhaalclkiemr - cassiani - Hendrix - zorro2000zeta - LIA ...
Welcome to the our new world, that in that we have the power, and where the sky is
not the limits, the limits it is the universe, the infinite universe...
"

a esa linea le cambias todo lo que se te de la gana te recomiendo :

" NombreCompiler Batch Compiler Creaete By
UserName ... Thanks to my friends bla bla Dhck oNe bla bla ... y alguna
cita como Sky is not the lmit the limit is the universe that infinite universe ..
"

Truco 2

Campo de estrellas en el About

Primero debes colocarle el fondo negro y dos Timers uno Llamado tmrMainLoop y con
inteval 15 , el otro con nombre tmrSegundos y con inteval 1000

Y pegar este codigo :

'simulacin de estrellas by McCoy - McCoy@linuxmail.org
'adapatdo para Tutorial By Dhck oNe
Option Explicit

Const FOV As Single = 24 'el campo de visin (field of view).
'juega con l, experimenta...
Const puntos As Single = 500 'nmero de puntos (estrellas)

Public flowerPower As Boolean 'modo de colorines
Public frmAboutCompleta As Boolean 'a frmAbout completa (pseudofrmAboutcompleta en
realidad xD)

Private bAumentar As Boolean
Private bReducir As Boolean
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 21

Private frames As Integer
Private velocidad As Double
Private centx As Single 'el centro de la frmAbout en el eje x (horizontal)
Private centy As Single 'el centro de la frmAbout en el eje y (vertical)

Dim puntos3d(puntos - 1, 2) As punto3d 'array con las coordenadas de los puntos
'en 3 dimensiones (x,y,z). La parte del
array
'(n,0) son las coordenadas reales, la
'(n,1) es el incremento de cada
'coordenada en pasada del bucle, y
'el (n,2).x es cuadrante en el que
'est. Los (n,2).y Y (n,2).z no se
'usan para nada xD
Dim puntos2d(puntos - 1) As punto2d 'array con las coordenadas de los puntos
'en dos dimensiones (x,y) (los que realmente
'se muestran en frmAbout)

Private Type punto3d 'tipo definido por m, para establecer el sistema de
'coordenadas de un punto en 3D
x As Double 'coordenada X (horizontal en la frmAbout)
y As Double 'coordenada Y (vertical en la frmAbout)
z As Double 'coordenada Z (hacia dentro en la frmAbout)
End Type

Private Type punto2d 'tipo definido por m, para establecer el sistema de
'coordenadas para un punto en 2D
x As Double 'coordenada X
y As Double 'coordenada Y
End Type
Private Sub Form_Load()
Dim i As Integer
Randomize Timer 'para obtener valores aleatorios siempre diferentes
velocidad = 0.01
flowerPower = False
frmAboutCompleta = False
centx = frmAbout.ScaleWidth / 2 'haya el centro horizontal
centy = frmAbout.ScaleHeight / 2 'dem pero el vertical
For i = 0 To puntos / 4 - 1 Step 1 'calcula el movimiento de los puntos
'del primer cuadrante
puntos3d(i, 2).x = 1 'primer cuadrante
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i,
2).x))
Next i
For i = puntos / 4 To puntos / 4 * 2 - 1 Step 1 'del segundo cuadrant
puntos3d(i, 2).x = 2 'segundo cuadrante
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i, 2).x))
Next i
For i = puntos / 4 * 2 To puntos / 4 * 3 - 1 Step 1 'del tercer cuadrante
puntos3d(i, 2).x = 3
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i, 2).x))
Next i
For i = puntos / 4 * 3 To puntos - 1 Step 1 'etc etc
puntos3d(i, 2).x = 4
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i, 2).x))
Next i

For i = 0 To puntos - 1 Step 1 'establecer la distancia a la frmAbout en -3
'(z = -3)
Dim n As Integer
puntos3d(i, 0).z = -3
Next i
tmrMainLoop.Enabled = True 'dar comienzo al bucle principal
End Sub
Private Sub Form_KeyDown(keyindex As Integer, shifted As Integer)
If keyindex = 38 Then bAumentar = True
If keyindex = 40 Then bReducir = True
End Sub
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 22
Private Sub Form_KeyUp(keyindex As Integer, shifted As Integer)
If keyindex = 38 Then bAumentar = False
If keyindex = 40 Then bReducir = False
End Sub
Private Sub tmrMainLoop_Timer()
Dim i As Integer
frmAbout.Cls 'borrar lo que haya
For i = 0 To puntos - 1 Step 1 'acutalizar todos los puntos
If puntos2d(i).x < 0 Or puntos2d(i).x > frmAbout.ScaleWidth Then 'si el
punto
'ha salido de la frmAbout
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i,
2).x))
'reiniciar su movimiento aleatoriamente

With puntos3d(i, 0) 'y devolverlo al foco de emisin de estrellas (por
'llamarlo de alguna manera xD)
.x = 0
.y = 0
.z = -3
End With

End If
If puntos2d(i).y < 0 Or puntos2d(i).y > frmAbout.ScaleHeight Then 'lo mismo
puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i,
2).x))
With puntos3d(i, 0)
.x = 0
.y = 0
.z = -3
End With
End If
puntos3d(i, 0).x = puntos3d(i, 0).x + puntos3d(i, 1).x 'actualizar la
'posicin del punto en el eje x respecto
'a su incremento.
puntos3d(i, 0).y = puntos3d(i, 0).y + puntos3d(i, 1).y 'dem y
puntos3d(i, 0).z = puntos3d(i, 0).z + puntos3d(i, 1).z 'dem z

puntos2d(i) = tresADos(puntos3d(i, 0)) 'convertir las coordenadas del punto
'de 3D a 2D
If flowerPower = True Then 'modo gayfo
frmAbout.PSet (Int(puntos2d(i).x), Int(puntos2d(i).y)), vbWhite +
puntos3d(i, 0).z * 100000000
Else 'modo normal
frmAbout.PSet (Int(puntos2d(i).x), Int(puntos2d(i).y)), vbWhite
End If
If bAumentar = True Then puntos3d(i, 1) = variarVelocidad(puntos3d(i, 1), True)
If bReducir = True Then puntos3d(i, 1) = variarVelocidad(puntos3d(i, 1), False)
Next i
frames = frames + 1
DoEvents
End Sub
'----------------------------------------------------------
' Convierte las coordenadas de 3D a 2D
'----------------------------------------------------------
Private Function tresADos(coordenadas As punto3d) As punto2d
Dim tempx As Double 'variable temporal para la x
Dim tempy As Double 'dem y
tempx = centx + FOV * (coordenadas.x / coordenadas.z) 'esto es lo que hace
'el milagro de las 3D xD. smplemente divide entre z,
'resumiendo. Fjate un poco y vers que es muy sencillo.
tempy = centy - FOV * (coordenadas.y / coordenadas.z)
tresADos.x = tempx 'devuelve las coordenadas en 3D
tresADos.y = tempy
End Function
'----------------------------------------
'Calcula el movimiento aleatoriamente
'----------------------------------------

Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker

http://www.invisiblehack.foros.st http://www.code-makers.es http://foro.elhacker.net 23
Private Function calcularMovimiento(punto As punto3d, cuadrante As Integer) As
punto3d
Select Case cuadrante 'dependiendo de en que cuadrante se encuentre, su
'direccin ser una u otra.
Case 1
calcularMovimiento.x = Int(Rnd * 300) / 10000 'movimiento en el eje x
calcularMovimiento.y = Int(Rnd * 300) / 10000 'movimiento en el eje y
calcularMovimiento.z = Rnd * 2 / 100 + velocidad 'movimiento en el eje
z
Case 2
calcularMovimiento.x = Int(Rnd * 300) / 10000 * -1
calcularMovimiento.y = Int(Rnd * 300) / 10000
calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case 3
calcularMovimiento.x = Int(Rnd * 300) / 10000
calcularMovimiento.y = Int(Rnd * 300) / 10000 * -1
calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case 4
calcularMovimiento.x = Int(Rnd * 300) / 10000 * -1
calcularMovimiento.y = Int(Rnd * 300) / 10000 * -1
calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case Else
MsgBox "Error: cuadrante no vlido", vbCritical, "Error"
End
End Select
End Function
Private Sub tmrSegundos_Timer()
frames = 0
End Sub
Private Function variarVelocidad(punto As punto3d, aumentar As Boolean) As punto3d
Const velocidadtope = 0.01
velocidad = punto.z
If aumentar = True And Not velocidad > velocidadtope Then velocidad = velocidad
+ 0.001
If aumentar = False And Not velocidad < 0 Then velocidad = velocidad - 0.001
variarVelocidad.z = velocidad
variarVelocidad.x = punto.x
variarVelocidad.y = punto.y
velocidad = velocidadtope
End Function

6.- Despedida

Bueno he terminado este tutorial de cmo crear un Compilador , me imagino que habeiz
aprendo muchas cosas ya sea agragra cosas a los recursos usar funciones como split
colocar manifest a tus app para que se vean como WINXP Cualquier Duda Consulta
Error Agregame o Enviame Un Correo a Deunder_Talker@Hotmail.com
Muchas gracias a aquellos que me encearona proogramar Vb y los que me encearon
ha hacer compiladores en Vb

Gracias a :

[SMT] karcrack LIA (Leandro Ascierto) a mi gran amigo H-Black
zorro2000zeta .Y a los foros Professional Hacker , CodeMakers , elHacker.net y Fire-
Software

Sky is not the limit . the limit is the universe . the infinite universe We have the power
welcome to the new our World