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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  StrConv Alternative Function
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: 1 2 [3] Ir Abajo Respuesta Imprimir
Autor Tema: StrConv Alternative Function  (Leído 10,834 veces)
Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #20 en: 9 Octubre 2012, 14:37 pm »

On ROTXEncrypt yes but that's no problem, just use On Error Resume Next but remove it on ROTXDecrypt you won't get overflow, then use AltStrConv and u will get overflow..


En línea

Danyfirex


Desconectado Desconectado

Mensajes: 493


My Dear Mizuho


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #21 en: 9 Octubre 2012, 18:28 pm »

the error is byte array are in range  0 y 255. so ROTXEncrypt try to put over 255 making overflow. so, for that Can't  Encrypt/Decrypt extended character over chr(143).



En línea

Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #22 en: 12 Octubre 2012, 14:06 pm »

the error is byte array are in range  0 y 255. so ROTXEncrypt try to put over 255 making overflow. so, for that Can't  Encrypt/Decrypt extended character over chr(143).



I can tell you that the problem does not come from the encryption, I'm using it since a long time. Nobody enough skilled to fix this Alt StrConv func dude? :(
En línea

Psyke1
Wiki

Desconectado Desconectado

Mensajes: 1.089



Ver Perfil WWW
Re: StrConv Alternative Function
« Respuesta #23 en: 12 Octubre 2012, 15:17 pm »

Hello mate!  :D
I've done this function some years ago, I don't know if it works... actually, I don't remember if it came to work. :silbar:
I can't test it because in this PC I have only installed Ubuntu... :-\

Código
  1. Option Explicit
  2.  
  3. '// kernel32.dll
  4. Private Declare Function MultiByteToWideChar Lib "kernel32.dll" (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
  5. Private Declare Function WideCharToMultiByte Lib "kernel32.dll" (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
  6.  
  7. '// Const
  8. Private Const CP_UTF8                           As Long = &HFDE9 '65001
  9.  
  10. '// Enum
  11. Public Enum CONV_TYPE
  12.    Unicode = vbUnicode
  13.    UTF8 = vbFromUnicode
  14. End Enum
  15.  
  16. '// Function
  17. Public Function StrConversion(ByRef vEntry As Variant, eConv As CONV_TYPE) As Variant
  18. Dim lRet                                        As Long
  19. Dim lLen                                        As Long
  20. Dim lBuffer                                     As Long
  21. Dim sBuffer                                     As String
  22. Dim bvOutput()                                  As Byte
  23.  
  24.    On Error GoTo Exit_
  25.  
  26.    If eConv = Unicode Then
  27.        lLen = LenB(vEntry) \ 2
  28.  
  29.        If lLen Then
  30.            lBuffer = lLen + lLen + lLen + 1
  31.            ReDim bvOutput(lBuffer - 1) As Byte
  32.  
  33.            lRet = WideCharToMultiByte(CP_UTF8, 0, StrPtr(vEntry), lLen, bvOutput(0), lBuffer, vbNullString, 0)
  34.  
  35.            If lRet Then
  36.                ReDim Preserve bvOutput(lRet - 1) As Byte
  37.                StrConversion = bvOutput
  38.            End If
  39.        End If
  40.    Else
  41.        lLen = UBound(vEntry) + 1
  42.  
  43.        If lLen > 1 Then
  44.            lBuffer = lLen + lLen
  45.            sBuffer = Space$(lBuffer)
  46.  
  47.            lRet = MultiByteToWideChar(CP_UTF8, 0, vEntry(0), lLen, StrPtr(sBuffer), lBuffer)
  48.  
  49.            If lRet Then
  50.                StrConversion = Left$(sBuffer, lRet)
  51.            End If
  52.        End If
  53.    End If
  54.  
  55. Exit_:
  56. End Function

I hope it works, or at least it helps you to make your own function.
Good luck! ;)

DoEvents! :P
« Última modificación: 12 Octubre 2012, 15:19 pm por Psyke1 » En línea

Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #24 en: 12 Octubre 2012, 16:07 pm »

@Psyke1

Thanks for this mate I'll try it tonight but it use two APIs which is not a good thing, possible to remove/replace them?
« Última modificación: 12 Octubre 2012, 20:09 pm por raul338 » En línea

Psyke1
Wiki

Desconectado Desconectado

Mensajes: 1.089



Ver Perfil WWW
Re: StrConv Alternative Function
« Respuesta #25 en: 12 Octubre 2012, 17:49 pm »

Thanks for this mate I'll try it tonight but it use two APIs which is not a good thing, possible to remove/replace them?

Yes I think it's possible. :rolleyes:
May be loading an array of the unicode numbers and using CharUpperBuffW() and CharUpperBuffA() apis.
Here are some examples: vbspeed.

DoEvents! :P
En línea

Danyfirex


Desconectado Desconectado

Mensajes: 493


My Dear Mizuho


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #26 en: 12 Octubre 2012, 17:50 pm »

I can tell you that the problem does not come from the encryption, I'm using it since a long time. Nobody enough skilled to fix this Alt StrConv func dude? :(

I'm sure yes.  
En línea

Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #27 en: 12 Octubre 2012, 20:43 pm »

Yes I think it's possible. :rolleyes:
May be loading an array of the unicode numbers and using CharUpperBuffW() and CharUpperBuffA() apis.
Here are some examples: vbspeed.

DoEvents! :P

I've tried your alternative function and it doesn't work, dunno what part is wrong...
En línea

Swellow

Desconectado Desconectado

Mensajes: 77


Ver Perfil
Re: StrConv Alternative Function
« Respuesta #28 en: 12 Octubre 2012, 20:44 pm »

I'm sure yes.  

You sure it's from the encryption? Well, in another project I'm using hamavb's StrConv alternative which use MSVBVM60 APIs and the encryption works perfectly with it... The problem comes from the AltStrConv, even author said that there were a problem with unicode characters but I never found a fix...
En línea

Páginas: 1 2 [3] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
GetProcAddress alternative function
Programación Visual Basic
cobein 2 3,010 Último mensaje 9 Octubre 2008, 00:24 am
por cobein
StrPtr Alternative
Programación Visual Basic
Swellow 4 2,940 Último mensaje 11 Junio 2012, 14:30 pm
por Swellow
[HELP] Invoke or Alternative to InternetReadFile API
Programación Visual Basic
Swellow 2 1,977 Último mensaje 22 Junio 2012, 04:31 am
por Swellow
Alternative Replace & Right Functions
Programación Visual Basic
Swellow 6 2,720 Último mensaje 9 Noviembre 2012, 20:46 pm
por Swellow
Duda sobre strconv y conversiones byte-caracter
Programación Visual Basic
OfTheVara 2 1,585 Último mensaje 8 Julio 2015, 13:11 pm
por OfTheVara
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines