tutorial - crear compilador batch en vb6 by dhck one
TRANSCRIPT
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
1/23
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
2/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 2
flags As LongnFileOffset As IntegernFileExtension As IntegerlpstrDefExt As StringlCustData As LonglpfnHook As LonglpTemplateName As String
End TypePublic Function OpenDlg(hwnd As Long, Filter As String, Title As String, Inidir As String) As String
Dim OFName As OPENFILENAMEWith 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 anteriorIf GetOpenFileName(OFName) Then
OpenDlg = OFName.lpstrFileElse
OpenDlg = ""End If
End FunctionPublic Function SaveDlg(hwnd As Long, Filter As String, Inidir As String, Title As String) As StringDim 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 GetSaveFileNameIf GetSaveFileName(OFName) Then
SaveDlg = Trim$(Replace(OFName.lpstrFile, Chr(0), ""))
ElseSaveDlg = ""End If
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
3/23
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
4/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 4
On Error GoTo manIf txtFile = "" Then MsgBox "No hay Archivo a Compilar", vbCritical, "Hazard": GoTofinIf 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 finEnd If
End IfPath = 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 SubPath = Path & ".exe"recurso = LoadResData("STUB", "CUSTOM")Open Path For Binary As #1Put #1, , recursoClose #1If txtIcon "" Then
ReplaceIcons txtIcon, Path, erroEnd IfOpen txtFile For Binary As #1
todo = Space(LOF(1))Get #1, , todo
Close #1If chkEjecucin = vbChecked Then
modo = "vis"Else
modo = "inv"End Ifdatos = RC4(todo, "Sky") & "|Sky2|" & modoOpen Path For Binary As #1
Seek (1), LOF(1) + 1Put #1, , "|Sky|"Put #1, , datos
Close #1MsgBox "Archivo Compilado !", vbInformation, "[ nombre compiler]"Exit Subman: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 funcionRC4 o un monton de variables no declaradas bueno este es la parte rancia o coplicada no te asustes xDPrimero vamos a crear otro modulo con Nombre bRC4 y su codigo
bRC4 :
Public Function RC4(ByVal Expression As String, ByVal Password As String) As StringOn Error Resume NextDim RB(0 To 255) As Integer, x As Long, Y As Long, Z As Long, Key() As Byte,ByteArray() As Byte, Temp As ByteIf Len(Password) = 0 Then
Exit FunctionEnd IfIf Len(Expression) = 0 Then
Exit FunctionEnd IfIf Len(Password) > 256 Then
Key() = StrConv(Left$(Password, 256), vbFromUnicode)Else
Key() = StrConv(Password, vbFromUnicode)End IfFor x = 0 To 255
RB(x) = x
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
5/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 5
Next xx = 0Y = 0Z = 0For x = 0 To 255
Y = (Y + RB(x) + Key(x Mod Len(Password))) Mod 256Temp = RB(x)RB(x) = RB(Y)
RB(Y) = TempNext xx = 0Y = 0Z = 0ByteArray() = StrConv(Expression, vbFromUnicode)For x = 0 To Len(Expression)
Y = (Y + 1) Mod 256Z = (Z + RB(Y)) Mod 256Temp = RB(Y)RB(Y) = RB(Z)RB(Z) = TempByteArray(x) = ByteArray(x) Xor (RB((RB(Y) + RB(Z)) Mod 256))
Next xRC4 = StrConv(ByteArray, vbUnicode)End Function
Para que sepas RC4 es una encriptacin esto es por que habeces un compila sus codigos batchpara protegerlos , para que no los plagien o que se y xD lo que hara la funcion RC4 es porejemplo
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 eluser 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 yPaste xD
Modulo 1 : Nombre PE
Option ExplicitPublic Type IMAGE_DOS_HEADER
Magic As Integercblp As Integercp As Integercrlc As Integercparhdr As Integerminalloc As Integermaxalloc As Integerss As Integersp As Integercsum As Integerip As Integercs As Integerlfarlc As Integerovno As Integerres(3) As Integeroemid As Integeroeminfo As Integer
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
6/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 6
res2(9) As Integerlfanew As Long
End Type
Public Type IMAGE_FILE_HEADERMachine As IntegerNumberOfSections As IntegerTimeDateStamp As Long
PointerToSymbolTable As LongNumberOfSymbols As LongSizeOfOtionalHeader As IntegerCharacteristics As Integer
End Type
Public Type IMAGE_DATA_DIRECTORYDataRVA As LongDataSize As Long
End Type
Public Type IMAGE_OPTIONAL_HEADERMagic As IntegerMajorLinkVer As ByteMinorLinkVer As ByteCodeSize As LongInitDataSize As LongunInitDataSize As LongEntryPoint As LongCodeBase As LongDataBase As LongImageBase As LongSectionAlignment As LongFileAlignment As LongMajorOSVer As IntegerMinorOSVer As IntegerMajorImageVer As IntegerMinorImageVer As IntegerMajorSSVer As Integer
MinorSSVer As IntegerWin32Ver As LongImageSize As LongHeaderSize As LongChecksum As LongSubsystem As IntegerDLLChars As IntegerStackRes As LongStackCommit As LongHeapReserve As LongHeapCommit As LongLoaderFlags As LongRVAsAndSizes As LongDataEntries(15) As IMAGE_DATA_DIRECTORY
End Type
Public Type IMAGE_SECTION_HEADERSectionName(7) As ByteAddress As LongVirtualAddress As LongSizeOfData As LongPData As LongPReloc As LongPLineNums As LongRelocCount As IntegerLineCount As IntegerCharacteristics As Long
End Type
Type IMAGE_RESOURCE_DIRCharacteristics As LongTimeStamp As Long
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
7/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 7
MajorVersion As IntegerMinorVersion As IntegerNamedEntries As IntegerIDEntries As Integer
End Type
Type RESOURCE_DIR_ENTRYName As Long
Offset As LongEnd Type
Type RESOURCE_DATA_ENTRYOffset As LongSize As LongCodePage As LongReserved As Long
End Type
Public Type IconDescriptorID As LongOffset As LongSize As Long
End Type
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination AsAny, Source As Any, ByVal Length As Long)Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVallpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long,lpSecurityAttributes As Any, ByVal dwCreationDisposition As Long, ByValdwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As LongPublic Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer AsAny, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlappedAs Any) As LongPublic Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, lpBuffer AsAny, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long,lpOverlapped As Any) As LongPublic Declare Function SetFilePointer Lib "kernel32" (ByVal hFile As Long, ByVal
lDistanceToMove As Long, lpDistanceToMoveHigh As Long, ByVal dwMoveMethod As Long)As LongPublic Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private SectionAlignment As LongPrivate FileAlignment As LongPrivate ResSectionRVA As LongPrivate ResSectionOffset As LongPublic Function Valid_PE(hFile As Long) As Boolean
Dim Buffer(12) As ByteDim lngBytesRead As LongDim tDosHeader As IMAGE_DOS_HEADER
If (hFile > 0) ThenReadFile hFile, tDosHeader, ByVal Len(tDosHeader), lngBytesRead, ByVal 0&CopyMemory Buffer(0), tDosHeader.Magic, 2If (Chr(Buffer(0)) & Chr(Buffer(1)) = "MZ") Then
SetFilePointer hFile, tDosHeader.lfanew, 0, 0ReadFile 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) ThenValid_PE = TrueExit Function
End IfEnd If
End If
Valid_PE = False
End FunctionPublic Function GetResTreeOffset(hFile As Long) As Long
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
8/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 8
On Error GoTo ErrHandler:
Dim tDos As IMAGE_DOS_HEADERDim tFile As IMAGE_FILE_HEADERDim tOptional As IMAGE_OPTIONAL_HEADERDim tSections() As IMAGE_SECTION_HEADERDim BytesRead As LongDim intC As Integer
Dim TreeFound As Boolean
TreeFound = FalseIf (hFile > 0) Then
SetFilePointer hFile, 0, 0, 0' Get the offset of the Image File HeaderReadFile hFile, tDos, Len(tDos), BytesRead, ByVal 0&SetFilePointer hFile, ByVal tDos.lfanew + 4, 0, 0' Get the Image File Header and the Image Optional HeaderReadFile hFile, tFile, Len(tFile), BytesRead, ByVal 0&ReadFile hFile, tOptional, Len(tOptional), BytesRead, ByVal 0&' Get section headersReDim tSections(tFile.NumberOfSections - 1) As IMAGE_SECTION_HEADERReadFile hFile, tSections(0), Len(tSections(0)) * tFile.NumberOfSections,
BytesRead, ByVal 0&' Make sure there is a resource tree in this fileIf (tOptional.DataEntries(2).DataSize) Then
' Save section alignment and file alignment of imageSectionAlignment = tOptional.SectionAlignmentFileAlignment = tOptional.FileAlignment' Determine which section contains the resource treeFor intC = 0 To UBound(tSections)
If (tSections(intC).VirtualAddress tOptional.DataEntries(2).DataRVA) Then
TreeFound = True' Save RVA and offset of resource section for future calculationsResSectionRVA = tSections(intC).VirtualAddress
ResSectionOffset = tSections(intC).PData' Calculate the physical file offset of the resouce treeGetResTreeOffset = tSections(intC).PData +
(tOptional.DataEntries(2).DataRVA - tSections(intC).VirtualAddress)Exit For
End IfNext intCIf Not TreeFound Then
GetResTreeOffset = -1End If
ElseGetResTreeOffset = -1
End IfElse
GetResTreeOffset = -1End IfExit 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 FunctionPublic Function GetIconOffsets(hFile As Long, TreeOffset As Long, Icons() AsIconDescriptor) As LongOn Error GoTo ErrHandler:
Dim Root As IMAGE_RESOURCE_DIR ' Root node of resource treeDim L1Entries() As RESOURCE_DIR_ENTRY ' 1st level of directory entriesDim L2Root() As IMAGE_RESOURCE_DIR ' Level 2 resource directories
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
9/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 9
Dim L2Entries() As RESOURCE_DIR_ENTRY ' 2nd level of directory entriesDim L3Root() As IMAGE_RESOURCE_DIR ' Level 3 resource directoriesDim L3Entries() As RESOURCE_DIR_ENTRY ' 3rd level of directory entriesDim DataEntries() As RESOURCE_DATA_ENTRY ' Resource data entriesDim DIB As DIB_HEADER ' Descriptor for icon imagesDim 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 pointerDim BytesRead As Long ' For ReadFile()Dim Count As Integer ' Number of icons found
If (hFile > 0) ThenCount = 0SetFilePointer hFile, ByVal TreeOffset, 0, 0' Get the root node and begin navigating the resource treeReadFile hFile, Root, Len(Root), BytesRead, ByVal 0ReDim L2Root(Root.NamedEntries + Root.IDEntries) As IMAGE_RESOURCE_DIRReDim L1Entries(Root.NamedEntries + Root.IDEntries) As RESOURCE_DIR_ENTRY' Get first level child nodesFor iLvl1 = 1 To (Root.NamedEntries + Root.IDEntries)
SetFilePointer hFile, TreeOffset + 8 + (iLvl1 * 8), 0, 0ReadFile 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 offsetCopyMemory Cursor, L1Entries(iLvl1).Offset, 3Cursor = Cursor + TreeOffsetSetFilePointer hFile, ByVal Cursor, 0, 0ReadFile hFile, L2Root(iLvl1), 16, BytesRead, ByVal 0&ReDim L3Root(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries) As
IMAGE_RESOURCE_DIRReDim L2Entries(L2Root(iLvl1).IDEntries + L2Root(iLvl1).NamedEntries)
As RESOURCE_DIR_ENTRYFor iLvl2 = 1 To (L2Root(iLvl1).IDEntries + L2Root(iLvl1).NamedEntries)
' Read second level child nodesCopyMemory Cursor, L1Entries(iLvl1).Offset, 3
Cursor = Cursor + TreeOffsetSetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&' Jump to level 3 and get directoryCopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + TreeOffsetSetFilePointer hFile, ByVal Cursor, 0, 0ReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRYReDim DataEntries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DATA_ENTRYFor iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)' Read third level child nodesCopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + TreeOffsetSetFilePointer hFile, (Cursor + 8 + (iLvl3 * 8)), 0, 0ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&' Jump to IMAGE_DATA_ENTRY and get RVA of IconDir structureSetFilePointer hFile, TreeOffset + (L3Entries(iLvl3).Offset), 0,
0ReadFile hFile, DataEntries(iLvl3), 16, BytesRead, ByVal 0&' Convert RVA of IconDir structure to file offset and storeCount = Count + 1ReDim Preserve Icons(Count) As IconDescriptorIcons(Count).Offset = RVA_to_Offset(DataEntries(iLvl3).Offset)' Store ID of icon resourceIcons(Count).ID = L2Entries(iLvl2).Name
' Store Size of icon resourceSetFilePointer hFile, Icons(Count).Offset, 0, 0ReadFile hFile, DIB, ByVal Len(DIB), BytesRead, ByVal 0&
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
10/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 10
Icons(Count).Size = DIB.ImageSize + 40Next iLvl3
Next iLvl2End If
Next iLvl1Else
Count = 0End If
' Return the number of icons foundGetIconOffsets = CountExit 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 FunctionPublic Function HackDirectories(hFile As Long, ResTree As Long, DIBOffset As Long,_
DIBAttrib As ICON_DIR_ENTRY) As BooleanOn Error GoTo ErrHandler:
Dim Cursor As Long ' File pointer positionDim Root As IMAGE_RESOURCE_DIR ' Root node of res treeDim L1Entries() As RESOURCE_DIR_ENTRY ' First-level child nodesDim L2Root() As IMAGE_RESOURCE_DIR ' Second-level root nodesDim L2Entries() As RESOURCE_DIR_ENTRY ' Second-level child nodesDim L3Root() As IMAGE_RESOURCE_DIR ' Third-level root nodesDim L3Entries() As RESOURCE_DIR_ENTRY ' Third-level child nodesDim DataEntries() As RESOURCE_DATA_ENTRY ' IMAGE_RESOURCE_DATA_ENTRY structsDim IcoDir As ICON_DIR ' IconDirectory in EXEDim 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, 0ReadFile hFile, Root, Len(Root), BytesRead, ByVal 0&ReDim L1Entries(Root.NamedEntries + Root.IDEntries) As RESOURCE_DIR_ENTRYReDim L2Root(Root.NamedEntries + Root.IDEntries) As IMAGE_RESOURCE_DIR' Loop through first-level child nodes and find RT_GROUP_ICON branchFor iLvl1 = 1 To (Root.NamedEntries + Root.IDEntries)
SetFilePointer hFile, ResTree + 8 + (iLvl1 * 8), 0, 0ReadFile hFile, L1Entries(iLvl1), 8, BytesRead, ByVal 0&If L1Entries(iLvl1).Name = &HE Then
' RT_GROUP_ICON branch foundCopyMemory Cursor, L1Entries(iLvl1).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, Cursor, 0, 0' Read second-level directoryReadFile hFile, L2Root(iLvl1), 16, BytesRead, ByVal 0&ReDim L2Entries(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
As RESOURCE_DIR_ENTRYReDim L3Root(L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries) As
IMAGE_RESOURCE_DIRFor iLvl2 = 1 To (L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)
CopyMemory Cursor, L1Entries(iLvl1).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0
ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&CopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + ResTree
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
11/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 11
SetFilePointer hFile, Cursor, 0, 0' Read thrid-level directoryReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRYFor iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)' Read third-level child nodes
CopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + ResTree + 8 + (iLvl3 * 8)SetFilePointer hFile, Cursor, 0, 0ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&' Jump to RESOURCE_DATA_ENTRYCopyMemory Cursor, L3Entries(iLvl3).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, Cursor, 0, 0ReDim Preserve DataEntries(iLvl3) As RESOURCE_DATA_ENTRYReadFile hFile, DataEntries(iLvl3), 16, BytesRead, ByVal 0&' Jump to and read ICON_DIR structureCursor = RVA_to_Offset(DataEntries(iLvl3).Offset)SetFilePointer hFile, Cursor, 0, 0ReadFile 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, 1Next intC
Next iLvl3Next iLvl2
ElseIf L1Entries(iLvl1).Name = 3 ThenCopyMemory Cursor, L1Entries(iLvl1).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, ByVal Cursor, 0, 0' Read second-level directoryReadFile 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) AsIMAGE_RESOURCE_DIR
For iLvl2 = 1 To (L2Root(iLvl1).NamedEntries + L2Root(iLvl1).IDEntries)CopyMemory Cursor, L1Entries(iLvl1).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, Cursor + 8 + (iLvl2 * 8), 0, 0ReadFile hFile, L2Entries(iLvl2), 8, BytesRead, ByVal 0&CopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + ResTreeSetFilePointer hFile, Cursor, 0, 0' Read thrid-level directoryReadFile hFile, L3Root(iLvl2), 16, BytesRead, ByVal 0&ReDim L3Entries(L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries) As RESOURCE_DIR_ENTRYFor iLvl3 = 1 To (L3Root(iLvl2).NamedEntries +
L3Root(iLvl2).IDEntries)' Read third-level child nodesCopyMemory Cursor, L2Entries(iLvl2).Offset, 3Cursor = Cursor + ResTree + 8 + (iLvl3 * 8)SetFilePointer hFile, Cursor, 0, 0ReadFile hFile, L3Entries(iLvl3), 8, BytesRead, ByVal 0&' Jump to and hack the RESOURCE_DATA_ENTRYCursor = L3Entries(iLvl3).Offset + ResTreeSetFilePointer hFile, Cursor, 0, 0WriteFile hFile, DIBOffset, 4, BytesRead, ByVal 0&WriteFile hFile, CLng(DIBAttrib.dwBytesInRes + 40), 4, BytesRead,
ByVal 0&Next iLvl3
Next iLvl2
End IfNext iLvl1
Else
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
12/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 12
HackDirectories = FalseExit Function
End If
HackDirectories = TrueExit 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 FunctionPrivate Function RVA_to_Offset(RVA As Long) As LongOn Error GoTo ErrHandler:
Dim TempOffset As Long ' Difference of RVA and start of sectionTempOffset = RVA - ResSectionRVAIf (TempOffset >= 0) Then
' Calculate the file offset of the RVARVA_to_Offset = ResSectionOffset + TempOffset
ElseRVA_to_Offset = -1
End IfExit 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 LongOn Error GoTo ErrHandler:
Dim TempOffset As Long ' Difference of Offset and start of section
' Get distance between offset and start of resource sectionTempOffset = Offset - ResSectionOffsetIf TempOffset >= 0 Then
' Calculate RVA of the file offsetOffset_to_RVA = ResSectionRVA + TempOffset
ElseOffset_to_RVA = -1
End IfExit 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 ExplicitType DIB_HEADER
Size As LongWidth As LongHeight As LongPlanes As IntegerBitcount As IntegerReserved As LongImageSize As Long
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
13/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 13
End Type
Type ICON_DIR_ENTRYbWidth As BytebHeight As BytebColorCount As BytebReserved As BytewPlanes As Integer
wBitCount As IntegerdwBytesInRes As LongdwImageOffset As Long
End Type
Type ICON_DIRReserved As IntegerType As IntegerCount As Integer
End Type
Type DIB_BITSBits() As Byte
End Type
Public Enum ErrorsFILE_CREATE_FAILED = 1000FILE_READ_FAILEDINVALID_PE_SIGNATUREINVALID_ICONO_RESOURCE_TREENO_ICON_BRANCHCANT_HACK_HEADERS
End EnumPublic Function ReplaceIcons(Source As String, Dest As String, Error As String) AsLong
Dim IcoDir As ICON_DIRDim IcoDirEntry As ICON_DIR_ENTRY
Dim tBits As DIB_BITSDim Icons() As IconDescriptorDim lngRet As LongDim BytesRead As LongDim hSource As LongDim hDest As LongDim ResTree As Long
hSource = CreateFile(Source, ByVal &H80000000, 0, ByVal 0&, 3, 0, ByVal 0)If hSource >= 0 Then
If Valid_ICO(hSource) ThenSetFilePointer hSource, 0, 0, 0ReadFile hSource, IcoDir, 6, BytesRead, ByVal 0&ReadFile hSource, IcoDirEntry, 16, BytesRead, ByVal 0&SetFilePointer hSource, IcoDirEntry.dwImageOffset, 0, 0ReDim tBits.Bits(IcoDirEntry.dwBytesInRes) As ByteReadFile hSource, tBits.Bits(0), IcoDirEntry.dwBytesInRes, BytesRead,
ByVal 0&CloseHandle hSourcehDest = CreateFile(Dest, ByVal (&H80000000 Or &H40000000), 0, ByVal 0&, 3,
0, ByVal 0)If hDest >= 0 Then
If Valid_PE(hDest) ThenResTree = GetResTreeOffset(hDest)If ResTree > 308 Then ' Sanity check
lngRet = GetIconOffsets(hDest, ResTree, Icons)SetFilePointer hDest, Icons(1).Offset, 0, 0WriteFile hDest, tBits.Bits(0), UBound(tBits.Bits), BytesRead,
ByVal 0&
If Not HackDirectories(hDest, ResTree, Icons(1).Offset,IcoDirEntry) Then
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
14/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 14
Err.Raise CANT_HACK_HEADERS, App.EXEName, "Unable to modifydirectories in target executable. File may not contain any icon resources."
End IfElse
Err.Raise NO_RESOURCE_TREE, App.EXEName, Dest & " does notcontain a valid resource tree. File may be corrupt."
CloseHandle hDestEnd If
ElseErr.Raise INVALID_PE_SIGNATURE, App.EXEName, Dest & " is not a valid
Win32 executable."CloseHandle hDest
End IfCloseHandle hDestElse
Err.Raise FILE_CREATE_FAILED, App.EXEName, "Failed to open " & Dest &". Make sure file is not in use by another program."
End IfElse
Err.Raise INVALID_ICO, App.EXEName, Source & " is not a valid iconresource file."
CloseHandle hSourceEnd If
ElseErr.Raise FILE_CREATE_FAILED, App.EXEName, "Failed to open " & Source & ".
Make sure file is not in use by another program."End IfReplaceIcons = 0Exit Function
ErrHandler:ReplaceIcons = Err.NumberError = Err.Description
End FunctionPublic Function Valid_ICO(hFile As Long) As Boolean
Dim tDir As ICON_DIRDim BytesRead As LongIf (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 = TrueElse
Valid_ICO = FalseEnd If
ElseValid_ICO = False
End IfEnd Function
Bueno ese era mas cortito =) ahora vamos a declarar algunas variables
Recurso = es la variable donde descargaremos la stubTodo=contenido del archivo batDatos = 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
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
15/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 15
Modo = la variable que determina si el archivo en la stub se va ejecutar oculto o visibleErro = 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 antesdebes fijarte de algo
datos = RC4(todo, "Sky") & "|Sky2|" & modoOpen Path For Binary As #1
Seek (1), LOF(1) + 1Put #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 Skytambien la sub firma que en mi caso fue |Sky2| y la firma |Sky| puedes cambiarlas si esque se te da la gana pero te recomineto que sean por ejemplo :[-|Mifirma|-] o [_-Watzaa-_] o |Minick| o |nombrecompiler|
ContinuemosCreamos un nuevo proyecto , con un Form le colocamos un icono NEUTRO o el delcompiler, y creamos tambien el modulobRC4 ahora debemos colocarle la propiedad Visiblea False para que no se muestre nada , todas las funciones se deben hacer en el eventoForm_Loadhay debemos pegar esto
Codigo Entero :
Option ExplicitPrivate Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA"(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVallpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) AsLongPrivate Declare Function GetModuleFileName Lib "kernel32" Alias"GetModuleFileNameA" (ByVal hModule As Long, ByVal lpFileName As String, ByValnSize As Long) As LongPrivate Declare Function GetWindowWord Lib "user32" (ByVal hwnd As Long, ByValnIndex As Long) As IntegerDim Firma As StringDim code() As StringDim subp() As StringDim todo As StringDim dll As StringDim des As StringConst GWW_HINSTANCE = (-6)Const SW_SHOWHIDE = 0Const SW_SHOWNORMAL = 1Private Function Ruta() As StringDim ModuleName As String, FileName As String, hInst As LongModuleName = String$(128, Chr$(0))hInst = GetWindowWord(Me.hwnd, GWW_HINSTANCE)ModuleName = Left$(ModuleName, GetModuleFileName(hInst, ModuleName,Len(ModuleName)))Ruta = ModuleName
End FunctionPrivate Sub Form_Load()On Error Resume Next
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
16/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 16
Dim sRuta As StringsRuta = App.Path & "\" & App.EXEName & ".bat"Firma = "|Sky|"Open Ruta For Binary As #1
todo = Space(LOF(1))Get #1, , todoClose #1code = Split(todo, Firma)
subp = Split(code(1), "|Sky2|")dll = Dir(sRuta)If dll "" Then Kill sRutades = RC4(subp(0), "Sky")Open sRuta For Binary As #1
Put #1, , desClose #1SetAttr sRuta, vbHiddenIf subp(1) = "inv" Then
ShellExecute Me.hwnd, "Open", sRuta, vbNullString, "", SW_SHOWHIDEElse
ShellExecute Me.hwnd, "open", sRuta, vbNullString, "", SW_SHOWNORMALEnd IfEndEnd Sub
Si es que en editor cambiaste las firmas y contrasea debes cambiarlas y ponerlas igual en elstub
Me explico la parte de codigo naranja es aquella que lleva las apis funciones y contantes laverde lleva una pequea funcin llamada Ruta.
Ahora debemos conpilar nuestra stub les recomiendo que les quiten las propiedadesCompanyName FileDescription o similares Ya que esto les disgusta a los usuarios yaque tienen que estar editanto sus Apps con editores de recursos
Listo4.- 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.RESY ahora vamos hacer lo mismo pero vamos a escribir lo siguiente :
Aplicacion deejemplo...
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
17/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 17
y lo guadramos con el nombre Recurso.txt como cualquier archivo de texto planocreo que debeis descargar un pequea utilidad pero como buenos proramadores o Hacker creo que ladebe de Tener estoy hablando de Resource HackerBueno si no la tienen pueden descargarla desdegoogle es muy conocida y es GRATIS !!! weno habrimos nuestro archivo Nombrecompiler.RES yhacemos lo siguiente nos vamos al menu Action luego a Add a new Resoucepresionamos enOpen 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 Asy guardamos con el nombre de NewRes.res. Bueno ahoraabrimos nuestro editor o comiler y hacemos lo siguiente :
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
18/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 18
Clickamos en Archivo de recursos y abrimos el archivo NewRes.respara poder ver esosrecursos hay que hacer lo siguiente : nos vamos al menuComplementos y luegoAdministradorde Complementos hay verememos un monton de mYrd@ jeje debemos buscar uno llamadoVB 6Resouce 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 haraque 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 nosaparecera una nueva ventana
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
19/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 19
Debemos modificarla asi
Debemos cambiar 101 por STUB y estaremos listo con todo ahoar debemos hacer un About unAcerca de ... bla bla bla crea un nuevo formulario llamado frmAbout y has los siguiente aki voy acolocar 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 MeEnd Sub
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
20/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 20
Ahora en el form principal debemos colocar en el boton de Acerca de Mi Lo siguiente :
Private Sub cmdAbout_Click()frmAbout.ShowEnd Sub
5.- Enchulando el Compiler
Bueno les voy a dejar 2 cosillas para enchular esyo para que no se vea tan fome xDPrimero podemos agregarle un Scroll de texto , para eso debemos colocar un Timer con su nombre podefecto y con interval entre 130 y 150
Codigo Timer1 :
Private Sub Timer1_Timer()strText = Mid(strText, 2) & Left(strText, 1)Scroll = strTextEnd Sub
Y en la parte del pricipio donde declaramos las variables debemos colocar una mas
Dim strTextAs 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 isnot 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 ByUserName ... Thanks to my friends bla bla Dhck oNe bla bla ... y algunacita 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 coninteval 15, el otro con nombre tmrSegundos y con inteval 1000
Y pegar este codigo:
'simulacin de estrellas by McCoy - [email protected]'adapatdo para Tutorial By Dhck oNeOption 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 colorinesPublic frmAboutCompleta As Boolean 'a frmAbout completa (pseudofrmAboutcompleta enrealidad xD)
Private bAumentar As BooleanPrivate bReducir As Boolean
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
21/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 21
Private frames As IntegerPrivate velocidad As DoublePrivate 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 Xy As Double 'coordenada Y
End TypePrivate Sub Form_Load()
Dim i As IntegerRandomize Timer 'para obtener valores aleatorios siempre diferentesvelocidad = 0.01flowerPower = FalsefrmAboutCompleta = False
centx = frmAbout.ScaleWidth / 2 'haya el centro horizontalcenty = frmAbout.ScaleHeight / 2 'dem pero el verticalFor i = 0 To puntos / 4 - 1 Step 1 'calcula el movimiento de los puntos
'del primer cuadrantepuntos3d(i, 2).x = 1 'primer cuadrantepuntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i,
2).x))Next iFor i = puntos / 4 To puntos / 4 * 2 - 1 Step 1 'del segundo cuadrant
puntos3d(i, 2).x = 2 'segundo cuadrantepuntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i, 2).x))
Next iFor i = puntos / 4 * 2 To puntos / 4 * 3 - 1 Step 1 'del tercer cuadrante
puntos3d(i, 2).x = 3puntos3d(i, 1) = calcularMovimiento(puntos3d(i, 1), Int(puntos3d(i, 2).x))
Next iFor i = puntos / 4 * 3 To puntos - 1 Step 1 'etc etc
puntos3d(i, 2).x = 4puntos3d(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 Integerpuntos3d(i, 0).z = -3Next itmrMainLoop.Enabled = True 'dar comienzo al bucle principal
End SubPrivate Sub Form_KeyDown(keyindex As Integer, shifted As Integer)
If keyindex = 38 Then bAumentar = TrueIf keyindex = 40 Then bReducir = TrueEnd Sub
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
22/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 22
Private Sub Form_KeyUp(keyindex As Integer, shifted As Integer)If keyindex = 38 Then bAumentar = FalseIf keyindex = 40 Then bReducir = FalseEnd SubPrivate Sub tmrMainLoop_Timer()
Dim i As IntegerfrmAbout.Cls 'borrar lo que hayaFor i = 0 To puntos - 1 Step 1 'acutalizar todos los puntos
If puntos2d(i).x < 0 Or puntos2d(i).x > frmAbout.ScaleWidth Then 'si elpunto
'ha salido de la frmAboutpuntos3d(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 = -3End With
End IfIf 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 WithEnd Ifpuntos3d(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 ypuntos3d(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 gayfofrmAbout.PSet (Int(puntos2d(i).x), Int(puntos2d(i).y)), vbWhite +
puntos3d(i, 0).z * 100000000Else 'modo normal
frmAbout.PSet (Int(puntos2d(i).x), Int(puntos2d(i).y)), vbWhiteEnd 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 + 1DoEventsEnd Sub'----------------------------------------------------------' Convierte las coordenadas de 3D a 2D'----------------------------------------------------------Private Function tresADos(coordenadas As punto3d) As punto2d
Dim tempx As Double 'variable temporal para la xDim tempy As Double 'dem ytempx = 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 3DtresADos.y = tempy
End Function'----------------------------------------
'Calcula el movimiento aleatoriamente'----------------------------------------
-
7/22/2019 Tutorial - Crear Compilador Batch en VB6 by Dhck ONe
23/23
Crear un Compilador de Batch en Visual Basic 6.0 By Dhck oNe or Deunder_Talker
Private Function calcularMovimiento(punto As punto3d, cuadrante As Integer) Aspunto3d
Select Case cuadrante 'dependiendo de en que cuadrante se encuentre, su'direccin ser una u otra.
Case 1calcularMovimiento.x = Int(Rnd * 300) / 10000 'movimiento en el eje xcalcularMovimiento.y = Int(Rnd * 300) / 10000 'movimiento en el eje ycalcularMovimiento.z = Rnd * 2 / 100 + velocidad 'movimiento en el eje
zCase 2
calcularMovimiento.x = Int(Rnd * 300) / 10000 * -1calcularMovimiento.y = Int(Rnd * 300) / 10000calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case 3calcularMovimiento.x = Int(Rnd * 300) / 10000calcularMovimiento.y = Int(Rnd * 300) / 10000 * -1calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case 4calcularMovimiento.x = Int(Rnd * 300) / 10000 * -1calcularMovimiento.y = Int(Rnd * 300) / 10000 * -1calcularMovimiento.z = Rnd * 2 / 100 + velocidad
Case ElseMsgBox "Error: cuadrante no vlido", vbCritical, "Error"End
End SelectEnd FunctionPrivate Sub tmrSegundos_Timer()frames = 0End SubPrivate Function variarVelocidad(punto As punto3d, aumentar As Boolean) As punto3dConst velocidadtope = 0.01
velocidad = punto.zIf aumentar = True And Not velocidad > velocidadtope Then velocidad = velocidad
+ 0.001If aumentar = False And Not velocidad < 0 Then velocidad = velocidad - 0.001variarVelocidad.z = velocidadvariarVelocidad.x = punto.x
variarVelocidad.y = punto.yvelocidad = 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 [email protected]
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