Código: Seleccionar todo
Function sFileCopy(sFilePath As String, sCopyPath As String) As Boolean
'Autor: Slek
'Fecha: 13/02/10
'Descripción: esta función simula FileCopy de VB6
'Además devuelve True o False si se ha copiado correctamente o no respectivamente
'Para Indetectables.net
Dim Fso, FFile
Dim bCode() As Byte
Dim Tst As Long
On Error GoTo Err
Tst = FileLen(sFilePath)
FFile = FreeFile
Open sFilePath For Binary Access Read As #FFile
ReDim bCode(Tst - 1)
Get #FFile, , bCode()
Close #FFile
Set Fso = CreateObject("Scripting.FileSystemObject")
If Fso.FileExists(sCopyPath) Then Kill sCopyPath
Open sCopyPath For Binary Access Write As #FFile
Put #FFile, , bCode()
Close #FFile
If Fso.FileExists(sCopyPath) Then
If Tst = FileLen(sCopyPath) Then
sCopy = True
Exit Function
Else
GoTo Err
End If
Else
GoTo Err
End If
Err:
sCopy = False
End Function
Código: Seleccionar todo
Dim x As Boolen
x = sCopy("C:\Oxigen Crypter.exe", "C:\Copy.exe")
If x Then
MsgBox "Copied"
Else
MsgBox "Error"
End If