usa la cañeria de comunicacion entre procesos... PIPES
Dulces Lunas!¡.
			Dulces Lunas!¡.
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
%windir%/Prefetch
Cita de: Constance en 7 Septiembre 2011, 00:51 AM
A ver el titulo yo creo que está bien por eso lo he puesto en seguridad porque pienso que se puede tratar de un virus lo que tengo dentro del pc.....
Option Explicit
Const IPWAN         As String = "http://infrangelux.sytes.net/ScanX/?myipaddres=1"
Const PORT          As String = "[PORT]"
Const PORTOPEN      As String = "1"
Const PORTREQUEST   As String = "http://infrangelux.sytes.net/ScanX/?port=[PORT]&nohtml=1"
Private Sub Form_Load()
Dim oXML        As Object
Dim i           As Long
Dim sIPWAN      As String
Dim sRes        As String
    Set oXML = streamHTTP(IPWAN)
    sIPWAN = oXML.responseText
    Set oXML = Nothing  '   //  Release XMLHTTP
    
    For i = 1 To 1024
        Set oXML = streamHTTP(Replace$(PORTREQUEST, PORT, i))
        sRes = oXML.responseText
        If (Strings.StrComp(sRes, PORTOPEN, vbTextCompare) = 0) Then
            MsgBox "Puerto: " & i & " esta abierto en el HOST: " & sIPWAN
        End If
        Set oXML = Nothing  '   //  Release XMLHTTP
    Next
End Sub
Function streamHTTP(ByVal strDowload As String) As Object
Dim oXML                     As Object
    Set oXML = CreateObject("Microsoft.XMLHTTP")
    If Not (oXML Is Nothing) Then
        Call oXML.Open("GET", strDowload, 0)
        Call oXML.Send
    End If
Set streamHTTP = oXML
End Function
Option Explicit
Private Sub Form_Load()
Dim sStr    As String
    sStr = "Hola Mundo"
    MsgBox aaa(sStr)
    MsgBox sStr
    
    sStr = "Hola Mundo"
    MsgBox bbb(sStr)
    MsgBox sStr
End Sub
Public Function aaa(valor As String) As String
    valor = "BlackZeroX"
    aaa = valor
End Function
Public Function bbb(ByVal valor As String) As String
    valor = "BlackZeroX"
    bbb = valor
End Function
char a[] = "BlackZeroX";
char* pa = a;  // Se guarda el puntero de la variable "a" en "pa".
Dim a as string
Dim b as string
a = "BlackZeroX"
RtlMoveMemory VarPtr(b), VarPtr(a), &H4 ' // Lo mismo que lo anterior en C/C++...
' // Antes de terminar el proceso donde se Autodestruyen ambas variables hay que hacer esto:
RtlMoveMemory VarPtr(b), &H0 &H4 ' // esta seria otra desventaja ya que SI NO SE HACE PROVOCA A LA LARGA UN CRASH.
' // Nota: si "b" apuntaba a un contenido o ya se le habia asignado un contenido X debera de guardarse la _
dirrecion ala que apuntaba en una variable tipo long, y al final antes de su autodestruccion debera de volver _
a tener el mismo puntero, ya que de lo contrario se crearia un Extraordinario Memory leak (Fuga de memoria) _
y al final un Crash...
Dim a as string * 20
lLn = ((int*)(pSringVB6 - 0x4))
// pSringVB6 es el puntero a la variable string de vb6 obtenida con StrPtr
if (lLn) lLn >>= 1;
/*
Dividimos entre 2 de manera binaria SOLO si se paso con StrPtr() el puntero
de la string de lo contrario No debera ser dividido entre 2 ya que vb6 transforma
una variable String en formato Ansi... es decir quita los Bytes Nulos que sirven
como separadores en el formato Unicode de vb6 aun que no se ocupen para eso.
*/
Public Function altLen(ByRef sStr As String) As Long
Dim lRet    As Long
    '   //  Simulacion de StrPtr()
    RtlMoveMemory VarPtr(lRet), VarPtr(sStr), &H4           '   //  Leemos el apuntardor a la cadena.
    If (lRet = &H0) Then Exit Function                      '   //  Si el puntero es &H0 es que no hay ninguna cadena.
    RtlMoveMemory VarPtr(lRet), ByVal (lRet - &H4), &H4     '   //  Leemos la longitud en Bytes SOLO de la cadena en UNICODE.
    altLen = (lRet \ 2)                                     '   //  Por ser UNICODE dividimos entre 2
End Function
 
 
Public Function altLen2(ByRef sStr As String) As Long
Dim lRet    As Long
    lRet = StrPtr(sStr)
    If (lRet = &H0) Then Exit Function                      '   //  Si el puntero es &H0 es que no hay ninguna cadena.
    RtlMoveMemory VarPtr(lRet), ByVal (lRet - &H4), &H4     '   //  Leemos la longitud en Bytes SOLO de la cadena en UNICODE.
    altLen2 = (lRet \ 2)                                    '   //  Por ser UNICODE dividimos entre 2
End Function
Option Explicit
 
Private Declare Sub RtlMoveMemory Lib "kernel32" (ByVal pDst As Long, ByVal pSrc As Long, ByVal ByteLen As Long)
 
Private Sub Form_Load()
Dim sStr    As String   '   //  Apuntador...
    MsgBox altLen(sStr)
    sStr = "BlackZeroX"
    MsgBox altLen(sStr) & vbCrLf & Len(sStr)
    
    sStr = ""
    MsgBox altLen2(sStr)
    sStr = "BlackZeroX"
    MsgBox altLen2(sStr) & vbCrLf & Len(sStr)
    
End Sub
Public Function altLen(ByRef sStr As String) As Long
Dim lRet    As Long
    '   //  Simulacion de StrPtr()
    RtlMoveMemory VarPtr(lRet), VarPtr(sStr), &H4           '   //  Leemos el apuntardor a la cadena.
    If (lRet = &H0) Then Exit Function                      '   //  Si el puntero es &H0 es que no hay ninguna cadena.
    RtlMoveMemory VarPtr(lRet), ByVal (lRet - &H4), &H4     '   //  Leemos la longitud en Bytes SOLO de la cadena en UNICODE.
    altLen = (lRet \ 2)                                     '   //  Por ser UNICODE dividimos entre 2
End Function
Public Function altLen2(ByRef sStr As String) As Long
Dim lRet    As Long
    lRet = StrPtr(sStr)
    If (lRet = &H0) Then Exit Function                      '   //  Si el puntero es &H0 es que no hay ninguna cadena.
    RtlMoveMemory VarPtr(lRet), ByVal (lRet - &H4), &H4     '   //  Leemos la longitud en Bytes SOLO de la cadena en UNICODE.
    altLen2 = (lRet \ 2)                                    '   //  Por ser UNICODE dividimos entre 2
End Function