I want to get page code.
if with mozilla firefox, after I open http://www.masm32.com/board/index.php?board=1.0,
then I clik menu View/ Page Source. It will display entire of that page code neatly.
how to do that?
I have make the following code.
It's only show partial page' code of http://www.masm32.com/board/index.php?board=1.0.
if I enlarge
htmlBuffer db 1024 dup(?)
to become
htmlBuffer db 2048 dup(?)
I will get more page'code of http://www.masm32.com/board/index.php?board=1.0.
and so on
how to get entire page code of http://www.masm32.com/board/index.php?board=1.0 and put it result neatly in hEdit1 like that mozilla firefox?
thank you
sorry for my bad english.
.data?
htmlBuffer db 1024 dup(?)
.
.
.
.
.
LOCAL hInternet:DWORD
LOCAL hConnect:DWORD
LOCAL hRequest:DWORD
LOCAL readed:DWORD
LOCAL retBuf[1000]:BYTE
LOCAL Buffer[1024]: BYTE
LOCAL hSession: DWORD
LOCAL hUrl: DWORD
LOCAL Bufferlen: DWORD
LOCAL fHand: HANDLE
LOCAL bwrite:HANDLE
invoke InternetOpen, SADD("Mozilla"), INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, 0
mov hInternet, eax
invoke InternetOpenUrl, hInternet, SADD("http://www.masm32.com/board/index.php?board=1.0"), 0, 0, 0, 0
mov hUrl, eax
invoke InternetReadFile, hUrl, addr htmlBuffer, sizeof htmlBuffer, addr Bufferlen
invoke SetWindowText,hEdit1,addr htmlBuffer
invoke CloseHandle, hFile
invoke InternetCloseHandle, hUrl
cmp eax, 0
jz done
invoke InternetCloseHandle, hInternet
xor eax, eax
inc eax
ret
done:
xor eax, eax
Hi
I use for my old youtube downloader this way
invoke InternetOpen,CTEXT ("toto"),INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,NULL
mov hSession,eax
.if hSession != 0
invoke InternetOpenUrl,hSession,lpszUrl,NULL,NULL,NULL,NULL
mov hUrl,eax
.if hUrl != 0
invoke CreateFile,lpszPath,GENERIC_READ or GENERIC_WRITE,FILE_SHARE_READ,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
mov fHand,eax
.if fHand != INVALID_HANDLE_VALUE
inc szBuffer
.WHILE szBuffer != 0
invoke InternetReadFile,hUrl,addr Buffer,sizeof Buffer,addr szBuffer
invoke WriteFile,fHand,addr Buffer,szBuffer,ADDR bwrite,NULL
.ENDW
invoke CloseHandle,fHand
invoke InternetCloseHandle,hUrl
invoke InternetCloseHandle,hSession
.endif
After if this routine finish open i this file with Createfile and Readfile
the other way you allocate more memory by the loop
Thank's ragdog. :U
I have imagine to try your first option.
For your second option (allocate more memory by the loop), I really don't.
would you like to give me sample code or link?
Thank you.
The best way You use
HttpQueryInfo,hUrl,HTTP_QUERY_CONTENT_LENGTH or HTTP_QUERY_FLAG_NUMBER,addr dwsize,addr dwread,addr dwindex
Now have you the size of the file in dwsize and you can allocate memory for it
Or look in Radasm 3 UpdateChecker Addin is a very good example this use HttpQueryInfo