elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Rompecabezas de Bitcoin, Medio millón USD en premios


  Mostrar Mensajes
Páginas: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 75
1  Programación / Programación Visual Basic / Re: forzar VB6 para usar los archivos DLL y OCX desde el directorio de la aplicación en: 12 Abril 2013, 16:15 pm
Podes crear un manifest y de esa forma evitar el registro de los componentes, aca te dejo el link de una app para realizar esto.

Código:
http://mmm4vb6.atom5.com/
2  Programación / Programación Visual Basic / Re: [Ayuda]Me dieron el codigo de un sistema y necesito conocerlo en: 30 Enero 2013, 20:33 pm
Tenes una herramienta para analizar el flujo del programa que te puede ser util.

//http://www.aivosto.com/visustin.html
3  Programación / Programación Visual Basic / Re: [Reto] UrlEncode y UrlDecode en: 21 Diciembre 2012, 13:42 pm
Bueno ahi esta con APIs, lo unico que vi que no es igual a lo que pedis es que las barras en los parametros no las codifica... no se, en teoria codifica lo necesario segun M$.

Código
  1. '---------------------------------------------------------------------------------------
  2. ' Module      : mUrlEncode
  3. ' DateTime    : 21/12/2012 - Fin del Mundo!
  4. ' Author      : Cobein
  5. ' Mail        : cobein27@hotmail.com
  6. ' Purpose     : Encode and Decode url parameters
  7. ' Requirements: None
  8. ' Distribution: You can freely use this code in your own
  9. '               applications, but you may not reproduce
  10. '               or publish this code on any web site,
  11. '               online service, or distribute as source
  12. '               on any media without express permission.
  13. '---------------------------------------------------------------------------------------
  14. Option Explicit
  15.  
  16. Private Const ICU_ESCAPE                    As Long = &H80000000
  17. Private Const ICU_DECODE                    As Long = &H10000000
  18. Private Const CP_UTF8                       As Long = 65001
  19. Private Const ICU_BROWSER_MODE              As Long = &H2000000
  20.  
  21. Private Type URL_COMPONENTS
  22.    StructSize          As Long
  23.    Scheme              As String
  24.    SchemeLength        As Long
  25.    nScheme             As Long
  26.    HostName            As String
  27.    HostNameLength      As Long
  28.    nPort               As Long
  29.    UserName            As String
  30.    UserNameLength      As Long
  31.    Password            As String
  32.    PasswordLength      As Long
  33.    URLPath             As String
  34.    UrlPathLength       As Long
  35.    ExtraInfo           As String
  36.    ExtraInfoLength     As Long
  37. End Type
  38.  
  39. Private Declare Function InternetCrackUrl Lib "wininet.dll" Alias "InternetCrackUrlA" (ByVal lpszUrl As String, ByVal dwUrlLength As Long, ByVal dwFlags As Long, lpUrlComponents As URL_COMPONENTS) As Long
  40. Private Declare Function InternetCanonicalizeUrl Lib "wininet.dll" Alias "InternetCanonicalizeUrlA" (ByVal lpszUrl As String, ByVal lpszBuffer As String, lpdwBufferLength As Long, ByVal dwFlags As Long) As Long
  41. Private Declare Function InternetCreateUrl Lib "wininet.dll" Alias "InternetCreateUrlA" (lpUrlComponents As URL_COMPONENTS, ByVal dwFlags As Long, ByVal lpszUrl As String, lpdwUrlLength As Long) As Long
  42. Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
  43. Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
  44. Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
  45.  
  46. Public Function URLDecode(ByVal sURL As String, _
  47.       Optional ByVal bEncodeSpace As Boolean = False, _
  48.       Optional ByVal bUTF8 As Boolean = True) As String
  49.  
  50.    Dim tURL_COMPONENTS As URL_COMPONENTS
  51.  
  52.    Call CrackUrl(sURL, tURL_COMPONENTS)
  53.  
  54.    If bEncodeSpace Then
  55.        tURL_COMPONENTS.ExtraInfo = Replace(tURL_COMPONENTS.ExtraInfo, "+", " ")
  56.    End If
  57.  
  58.    URLDecode = CreateUrl(tURL_COMPONENTS, False)
  59.  
  60.    If bUTF8 Then
  61.        URLDecode = UTF82Unicode(URLDecode)
  62.    End If
  63. End Function
  64.  
  65. Public Function URLEncode(ByVal sURL As String, _
  66.       Optional ByVal bEncodeSpace As Boolean = False, _
  67.       Optional ByVal bUTF8 As Boolean = True) As String
  68.  
  69.    Dim tURL_COMPONENTS As URL_COMPONENTS
  70.  
  71.    If bUTF8 Then
  72.        sURL = Unicode2UTF8(sURL)
  73.    End If
  74.  
  75.    Call CrackUrl(sURL, tURL_COMPONENTS)
  76.  
  77.    URLEncode = CreateUrl(tURL_COMPONENTS, True)
  78.  
  79.    If bEncodeSpace Then
  80.        URLEncode = Replace(URLEncode, "%20", "+")
  81.    End If
  82. End Function
  83.  
  84. Private Function CreateUrl(ByRef tURL_COMPONENTS As URL_COMPONENTS, ByVal bEscape As Boolean) As String
  85.    Dim sBuffer As String
  86.  
  87.    sBuffer = String$(2048, 0)
  88.  
  89.    tURL_COMPONENTS.StructSize = Len(tURL_COMPONENTS)
  90.  
  91.    If InternetCreateUrl(tURL_COMPONENTS, IIf(bEscape, ICU_ESCAPE, 0), sBuffer, 2048) Then
  92.        CreateUrl = Left$(sBuffer, lstrlen(sBuffer))
  93.    End If
  94. End Function
  95.  
  96. Private Sub CrackUrl(ByVal sURL As String, ByRef tURL_COMPONENTS As URL_COMPONENTS)
  97.    Dim sBuffer As String
  98.    Dim lSize   As Long
  99.  
  100.    lSize = 2048
  101.    sBuffer = Space$(lSize)
  102.  
  103.    If InternetCanonicalizeUrl(sURL, sBuffer, lSize, ICU_BROWSER_MODE) Then
  104.  
  105.        sURL = Left$(sBuffer, lstrlen(sBuffer))
  106.  
  107.        With tURL_COMPONENTS
  108.            .StructSize = Len(tURL_COMPONENTS)
  109.            .Scheme = Space$(lSize)
  110.            .SchemeLength = lSize
  111.            .HostName = Space$(lSize)
  112.            .HostNameLength = lSize
  113.            .UserName = Space$(lSize)
  114.            .UserNameLength = lSize
  115.            .Password = Space$(lSize)
  116.            .PasswordLength = lSize
  117.            .URLPath = Space$(lSize)
  118.            .UrlPathLength = lSize
  119.            .ExtraInfo = Space$(lSize)
  120.            .ExtraInfoLength = lSize
  121.        End With
  122.  
  123.        Call InternetCrackUrl(sURL, Len(sURL), ICU_DECODE, tURL_COMPONENTS)
  124.    End If
  125. End Sub
  126.  
  127. Private Function UTF82Unicode(ByVal sData As String) As String
  128.    Dim lRet    As Long
  129.    Dim sBuffer As String
  130.  
  131.    sBuffer = Space(Len(sData))
  132.  
  133.    lRet = MultiByteToWideChar(CP_UTF8, 0, _
  134.       StrPtr(StrConv(sData, vbFromUnicode)), Len(sData), _
  135.       StrPtr(sBuffer), Len(sData))
  136.  
  137.    If lRet Then
  138.        UTF82Unicode = Left$(sBuffer, lRet)
  139.    End If
  140. End Function
  141.  
  142. Private Function Unicode2UTF8(ByVal sData As String) As String
  143.    Dim lRet    As Long
  144.    Dim sBuffer As String
  145.  
  146.    sBuffer = Space(LenB(sData))
  147.  
  148.    lRet = WideCharToMultiByte(CP_UTF8, 0, _
  149.       StrPtr(sData), Len(sData), _
  150.       StrPtr(sBuffer), Len(sBuffer), _
  151.       vbNullString, 0)
  152.  
  153.    If lRet Then
  154.        sBuffer = StrConv(sBuffer, vbUnicode)
  155.        Unicode2UTF8 = Left$(sBuffer, lRet)
  156.    End If
  157. End Function
  158.  
  159.  
4  Programación / Programación Visual Basic / Re: [Reto] UrlEncode y UrlDecode en: 19 Diciembre 2012, 14:27 pm
Leandro aca arme un funcion que replica lo que hace la web que posteaste. Las funciones para UTF8 las saque de tu code.

Hay que limpiar ese code porque quedo medio desastre pero bueno es simplemente a modo de ejemplo.

Nota: los caracteres reservados los saque de http://en.wikipedia.org/wiki/Percent-encoding

Código:
Option Explicit

Private Declare Function WideCharToMultiByte Lib "KERNEL32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Private Declare Function MultiByteToWideChar Lib "KERNEL32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
Private Const CP_UTF8                           As Long = 65001

Private Sub Form_Load()
    Debug.Print (EncodeURL("http://www.taringa.net/buscar/?q=día 12/12/12&interval="))
End Sub

Private Function EncodeURL(ByVal sURL As String) As String
    Dim bvData()    As Byte
    Dim i           As Long
    Dim sChar       As String * 1
    
    bvData = Unicode2UTF8(sURL)
    
    For i = 0 To UBound(bvData) Step 2
        sChar = Chr$(bvData(i))
        Select Case sChar
            Case "a" To "z", "A" To "Z", "0" To "9", "-", "_", ".", "~"
                EncodeURL = EncodeURL & sChar
            Case Else
                EncodeURL = EncodeURL & "%" & Right$("0" & Hex(Asc(sChar)), 2)
        End Select
    Next
End Function

Private Function DecodeURL(ByVal sURL As String) As String
    Dim bvData()    As Byte
    Dim i           As Long
    Dim sChar       As String * 1
    bvData = sURL
        
    For i = 0 To UBound(bvData) Step 2
        sChar = Chr$(bvData(i))
        If sChar = "%" Then
            DecodeURL = DecodeURL & Chr$(Val("&h" & Chr$(bvData(i + 2)) & Chr$(bvData(i + 4))))
            i = i + 4
        Else
        DecodeURL = DecodeURL & sChar
        End If
    Next
    DecodeURL = UTF82Unicode(DecodeURL)
End Function

Private Function UTF82Unicode(ByVal sUTF8 As String) As String

    Dim UTF8Size As Long
    Dim BufferSize As Long
    Dim BufferUNI As String
    Dim LenUNI As Long
    Dim bUTF8() As Byte
    
    If LenB(sUTF8) = 0 Then Exit Function
    
    bUTF8 = StrConv(sUTF8, vbFromUnicode)
    UTF8Size = UBound(bUTF8) + 1
    
    BufferSize = UTF8Size * 2
    BufferUNI = String$(BufferSize, vbNullChar)
    
    LenUNI = MultiByteToWideChar(CP_UTF8, 0, bUTF8(0), UTF8Size, StrPtr(BufferUNI), BufferSize)
    
    If LenUNI Then
        UTF82Unicode = Left$(BufferUNI, LenUNI)
    End If

End Function


Private Function Unicode2UTF8(ByVal strUnicode As String) As String

    Dim LenUNI As Long
    Dim BufferSize As Long
    Dim LenUTF8 As Long
    Dim bUTF8() As Byte
    
    LenUNI = Len(strUnicode)
    
    If LenUNI = 0 Then Exit Function
    
    BufferSize = LenUNI * 3 + 1
    ReDim bUTF8(BufferSize - 1)
    
    LenUTF8 = WideCharToMultiByte(CP_UTF8, 0, StrPtr(strUnicode), LenUNI, bUTF8(0), BufferSize, vbNullString, 0)
    
    If LenUTF8 Then
        ReDim Preserve bUTF8(LenUTF8 - 1)
        Unicode2UTF8 = StrConv(bUTF8, vbUnicode)
    End If

End Function
5  Programación / Programación Visual Basic / Re: [Reto] UrlEncode y UrlDecode en: 19 Diciembre 2012, 02:45 am
Leandro no podes usar InternetCanonicalizeUrl ?

http://msdn.microsoft.com/en-us/library/windows/desktop/aa384342(v=vs.85).aspx
6  Programación / Programación Visual Basic / Re: dll estandar creada en vb6 falla al llamar desde otro programa en: 23 Julio 2012, 19:23 pm
Va a explotar porque no esta cargada la libreria msvbvm60.
7  Programación / Programación Visual Basic / Re: ¿como ejecutar el DllMain de una dll estandar hecha en vb6? en: 17 Julio 2012, 22:34 pm
Si se pueden hacer dll standard y si se pueden inyectar, lo dificil es hacer la libreria correctamente para no explotar el proceso inyectado.
8  Programación / Programación Visual Basic / Re: Tamaño maximo de archivo. en: 30 Diciembre 2011, 03:00 am
En realidad tenes 2 problemas primero el de2gb que se presenta porque el long tiene signo y pasado cierto size el valor se vuelve negativo, el otro problema viene cuando el size supera el long y ahi se trabaja con con un complemento el segundo parametro de GetFileSize, ambos problemas entan resueltos en diferentes clases como dijo seba el post anterior.
9  Programación / Programación Visual Basic / Re: mMemory - WriteProcessMemory/vbaCopyBytes/RtlMoveMemory replacement [NOAPI!!!] en: 20 Noviembre 2011, 23:27 pm
Muy bueno Karcrack, simple y efectivo como siempre, un lujo.
10  Programación / Programación Visual Basic / Re: How to remove types en: 20 Noviembre 2011, 23:26 pm
The types are just memory spaces, you can replace them with byte/long arrays or just allocate your own memory, then when you need to address any of the parameters you calculate the offset in the type structure.
Eg:

type Test
    longdata1 as long
    longdata2 as long
end type

there you have an eight byte size structure, 4 bytes each long, so when you need to address any of them you simply calculate the offset, so longdata2 will be placed at 4 bytes from the bigging of the memory.
Páginas: [1] 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 75
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines