Autor
|
Tema: [HELP] Invoke InternetReadFile API (Leído 4,110 veces)
|
Swellow
Desconectado
Mensajes: 77
|
I've tried almost everything to Invoke that API and I always failed... I suceed with InternetOpen/InternetOpelUrl/InternetCloseHandle but not that one :/ 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
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
. 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.shtmlDulces Lunas!¡.
|
|
|
En línea
|
The Dark Shadow is my passion.
|
|
|
Swellow
Desconectado
Mensajes: 77
|
Thanks for your answer man but its not that that I want. I want to Invoke the API using CallAPIByName.
|
|
|
En línea
|
|
|
|
x64core
Desconectado
Mensajes: 1.908
|
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
Mensajes: 77
|
Modded CallAPIByName by cobein.
|
|
|
En línea
|
|
|
|
x64core
Desconectado
Mensajes: 1.908
|
made several cobein specify link or the code
|
|
|
En línea
|
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
. I do not see the problem. for more information: http://msdn.microsoft.com/en-us/library/windows/desktop/aa385103%28v=vs.85%29.aspxprototype: Public Function CallAPIByName(ByVal sLib As String, ByVal sMod As String, ParamArray Params()) As Long
API to Call 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
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 pm por BlackZeroX (Astaroth) »
|
En línea
|
The Dark Shadow is my passion.
|
|
|
BlackZeroX
Wiki
Desconectado
Mensajes: 3.158
I'Love...!¡.
|
Example FULL: 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 pm por BlackZeroX (Astaroth) »
|
En línea
|
The Dark Shadow is my passion.
|
|
|
Swellow
Desconectado
Mensajes: 77
|
@BlackZeroX (Astaroth) Thanks a lot man!
|
|
« Última modificación: 7 Noviembre 2011, 00:00 am por Swellow »
|
En línea
|
|
|
|
|
Mensajes similares |
|
Asunto |
Iniciado por |
Respuestas |
Vistas |
Último mensaje |
|
|
[ASM+VB6][INVOKE] Llamas APIs sin declararlas - kInvoke.bas
« 1 2 3 »
Programación Visual Basic
|
Karcrack
|
26
|
21,381
|
2 Noviembre 2011, 20:03 pm
por Karcrack
|
|
|
Ayuda con el metodo Invoke y varias Dudas Sockets
.NET (C#, VB.NET, ASP)
|
CATBro
|
2
|
2,855
|
28 Octubre 2011, 07:00 am
por CATBro
|
|
|
[HELP]Invoke by Hash
Programación Visual Basic
|
Swellow
|
7
|
10,607
|
15 Diciembre 2011, 20:37 pm
por Karcrack
|
|
|
Invoke WININET y CopyMemory
Programación Visual Basic
|
STARZ
|
6
|
3,077
|
30 Enero 2012, 08:56 am
por BlackZeroX
|
|
|
[HELP] Invoke or Alternative to InternetReadFile API
Programación Visual Basic
|
Swellow
|
2
|
2,123
|
22 Junio 2012, 04:31 am
por Swellow
|
|