elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
29 Mayo 2012, 00:59  


Tema destacado: Nueva página de elhacker.net en Google+ Google+

+  Foro de elhacker.net
|-+  Programación
| |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo, raul338)
| | |-+  [HELP] Invoke InternetReadFile API
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [HELP] Invoke InternetReadFile API  (Leído 610 veces)
Swellow

Desconectado Desconectado

Mensajes: 36


Ver Perfil
[HELP] Invoke InternetReadFile API
« en: 6 Noviembre 2011, 22:17 »

I've tried almost everything to Invoke that API and I always failed...

I suceed with InternetOpen/InternetOpelUrl/InternetCloseHandle but not that one :/

Código:
Private Declare Function InternetReadFile Lib "wininet.dll" (ByVal hFile As Long, ByVal lpBuffer As String, ByVal dwNumberOfBytesToRead As Long, lNumberOfBytesRead As Long) As Integer

        bDoLoop = InternetReadFile(hInternetOpen, strArray, Len(strArray), lNumberOfBytes)

Can anyone help please?


En línea
BlackZeroX (Astaroth)
Wiki

Desconectado Desconectado

Mensajes: 2.831


I'Love...!¡.


Ver Perfil WWW
Re: [HELP] Invoke InternetReadFile API
« Respuesta #1 en: 6 Noviembre 2011, 22:36 »

.
Código
 
Const scUserAgent = "API-Guide test program"
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const sURL = "http://www.microsoft.com/index.htm"
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByRef hInet As Long) As Long
Private Declare Function InternetReadFile Lib "wininet" (ByVal hFile As Long, ByVal sBuffer As String, ByVal lNumBytesToRead As Long, lNumberOfBytesRead As Long) As Integer
Private Declare Function InternetOpenUrl Lib "wininet" Alias "InternetOpenUrlA" (ByVal hInternetSession As Long, ByVal lpszUrl As String, ByVal lpszHeaders As String, ByVal dwHeadersLength As Long, ByVal dwFlags As Long, ByVal dwContext As Long) As Long
Private Sub Form_Load()
   'KPD-Team 1999
   'URL: http://www.allapi.net/
   'E-Mail: KPDTeam@Allapi.net

   Dim hOpen As Long, hFile As Long, sBuffer As String, Ret As Long
   'Create a buffer for the file we're going to download
   sBuffer = Space(1000)
   'Create an internet connection
   hOpen = InternetOpen(scUserAgent, INTERNET_OPEN_TYPE_DIRECT, vbNullString, vbNullString, 0)
   'Open the url
   hFile = InternetOpenUrl(hOpen, sURL, vbNullString, ByVal 0&, INTERNET_FLAG_RELOAD, ByVal 0&)
   'Read the first 1000 bytes of the file
   InternetReadFile hFile, sBuffer, 1000, Ret
   'clean up
   InternetCloseHandle hFile
   InternetCloseHandle hOpen
   'Show our file
   MsgBox sBuffer
End Sub
 
 

http://allapi.mentalis.org/apilist/InternetReadFile.shtml

Dulces Lunas!¡.


En línea

Web Principal-->[ Blog(VB6) | Host File (Public & Private) | Scan Port | (New)MyInfraPC (Descubre mi Contraseña venefi. $) ]



The Dark Shadow is my passion.
El infierno es mi Hogar, mi novia es Lilith y el metal mi
Swellow

Desconectado Desconectado

Mensajes: 36


Ver Perfil
Re: [HELP] Invoke InternetReadFile API
« Respuesta #2 en: 6 Noviembre 2011, 22:44 »

Thanks for your answer man but its not that that I want. I want to Invoke the API using CallAPIByName.
En línea
RHL


Desconectado Desconectado

Mensajes: 968


mental


Ver Perfil
Re: [HELP] Invoke InternetReadFile API
« Respuesta #3 en: 6 Noviembre 2011, 23:20 »

Thanks for your answer man but its not that that I want. I want to Invoke the API using CallAPIByName.

which callApibyname use?
En línea
Swellow

Desconectado Desconectado

Mensajes: 36


Ver Perfil
Re: [HELP] Invoke InternetReadFile API
« Respuesta #4 en: 6 Noviembre 2011, 23:21 »

Modded CallAPIByName by cobein.
En línea
RHL


Desconectado Desconectado

Mensajes: 968


mental


Ver Perfil
Re: [HELP] Invoke InternetReadFile API
« Respuesta #5 en: 6 Noviembre 2011, 23:25 »

made several cobein  :-\
specify link or the code
En línea
BlackZeroX (Astaroth)
Wiki

Desconectado Desconectado

Mensajes: 2.831


I'Love...!¡.


Ver Perfil WWW
Re: [HELP] Invoke InternetReadFile API
« Respuesta #6 en: 6 Noviembre 2011, 23:26 »

.
I do not see the problem.

for more information: http://msdn.microsoft.com/en-us/library/windows/desktop/aa385103%28v=vs.85%29.aspx

prototype:
Código
Public Function CallAPIByName(ByVal sLib As String, ByVal sMod As String, ParamArray Params()) As Long
 

API to Call

Código
 
BOOL InternetReadFile(
 __in   HINTERNET hFile,
 __out  LPVOID lpBuffer,
 __in   DWORD dwNumberOfBytesToRead,
 __out  LPDWORD lpdwNumberOfBytesRead
);
 
Requirements
 
Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header Wininet.h
Library Wininet.lib
DLL Wininet.dll
 
 

Código
 
dim hFile as long
dim bBuff(0 to 999) as byte ' lpBuffer = varptr(bBuff(0))
dim dwNumberOfBytesToRead as long
dim lpdwNumberOfBytesRead as long
dim bRes as boolean
 
dwNumberOfBytesToRead = 1000
bRes = callapybyname("wininet", "InternetReadFile", hFile, varptr(bBuff(0)), dwNumberOfBytesToRead, varptr(lpdwNumberOfBytesRead) )
 
 

Dulces Lunas!¡.
« Última modificación: 6 Noviembre 2011, 23:53 por BlackZeroX (Astaroth) » En línea

Web Principal-->[ Blog(VB6) | Host File (Public & Private) | Scan Port | (New)MyInfraPC (Descubre mi Contraseña venefi. $) ]



The Dark Shadow is my passion.
El infierno es mi Hogar, mi novia es Lilith y el metal mi
BlackZeroX (Astaroth)
Wiki

Desconectado Desconectado

Mensajes: 2.831


I'Love...!¡.


Ver Perfil WWW
Re: [HELP] Invoke InternetReadFile API
« Respuesta #7 en: 6 Noviembre 2011, 23:42 »

Example FULL:

Código
 
Option Explicit
 
Const scUserAgent = "UserAngent InfraExplorer Plugin."
Const INTERNET_OPEN_TYPE_DIRECT = 1
Const INTERNET_OPEN_TYPE_PROXY = 3
Const INTERNET_FLAG_RELOAD = &H80000000
Const sURL = "http://infrangelux.sytes.net/ScanX/?ip=www.google.com.mx&port=80&nohtml=3"
 
Private Sub Form_Load()
   Dim hOpen       As Long
   Dim hFile       As Long
   Dim bBuffer()   As Byte
   Dim Ret         As Long
   ReDim bBuffer(0 To 0)
   hOpen = lCallApiByName("wininet", "InternetOpenW", StrPtr(scUserAgent), INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0)
   hFile = lCallApiByName("wininet", "InternetOpenUrlW", hOpen, StrPtr(sURL), 0, 0, INTERNET_FLAG_RELOAD, 0)
   Call lCallApiByName("wininet", "InternetReadFile", hFile, VarPtr(bBuffer(0)), 1, VarPtr(Ret))
   Call lCallApiByName("wininet", "InternetCloseHandle", hFile)
   Call lCallApiByName("wininet", "InternetCloseHandle", hOpen)
   MsgBox IIf(Val(StrConv(bBuffer, vbUnicode)) = 1, "Port Enabled", "Port Disabled")
End Sub
 
 

Dulces Lunas!¡.
« Última modificación: 6 Noviembre 2011, 23:51 por BlackZeroX (Astaroth) » En línea

Web Principal-->[ Blog(VB6) | Host File (Public & Private) | Scan Port | (New)MyInfraPC (Descubre mi Contraseña venefi. $) ]



The Dark Shadow is my passion.
El infierno es mi Hogar, mi novia es Lilith y el metal mi
Swellow

Desconectado Desconectado

Mensajes: 36


Ver Perfil
Re: [HELP] Invoke InternetReadFile API
« Respuesta #8 en: 6 Noviembre 2011, 23:55 »

@BlackZeroX (Astaroth)
Thanks a lot man!
« Última modificación: 7 Noviembre 2011, 00:00 por Swellow » En línea
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema con APi de Windows (InternetReadFile)
Programación C/C++
Zeny 1 829 Último mensaje 29 Mayo 2009, 09:11
por Eternal Idol
[ASM+VB6][INVOKE] Llamas APIs sin declararlas - kInvoke.bas « 1 2 »
Programación Visual Basic
Karcrack 26 6,611 Último mensaje 2 Noviembre 2011, 20:03
por Karcrack
Ayuda con el metodo Invoke y varias Dudas Sockets
.NET
CATBro 2 611 Último mensaje 28 Octubre 2011, 07:00
por CATBro
[HELP]Invoke by Hash
Programación Visual Basic
Swellow 7 2,153 Último mensaje 15 Diciembre 2011, 20:37
por Karcrack
Invoke WININET y CopyMemory
Programación Visual Basic
STARZ 6 634 Último mensaje 30 Enero 2012, 08:56
por BlackZeroX (Astaroth)
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines