flat assembler
Message board for the users of flat assembler.

Index > Main > wininet lybrary

Author
Thread Post new topic Reply to topic
a1ss



Joined: 17 Nov 2007
Posts: 3
a1ss 17 Nov 2007, 15:29
hi! may be anybody write this .inc file selfhanding or see that in the network? i ca'n find wininet.inc =(
Post 17 Nov 2007, 15:29
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Nov 2007, 01:25
Wait, are you asking for how to include functions for internet API in windows?
Post 18 Nov 2007, 01:25
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
a1ss



Joined: 17 Nov 2007
Posts: 3
a1ss 18 Nov 2007, 02:25
kohlrak, exactly!
Post 18 Nov 2007, 02:25
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Nov 2007, 02:50
Well, you'll have to research winsocks for internet in windows. Then you'll have to use the import table (see example below) to import the functions you want to use then use invoke or cinvoke to use them. All you have to do is elaborate on the following code based on your reading up of winsocks. The thing with fasm includes is that fasm includes don't do much outside of really useful macros, while functions/procs are in the OS's dlls. MSDN is pretty good at telling you what functions are in what dlls if you lookup the function.

Code:
format PE console
entry main
include 'win32ax.inc'

section '.code' readable executable
main:
cinvoke printf, <"HELLO!", 0> ;printf
cinvoke system, <"PAUSE", 0> ;To hold screen visible.
invoke ExitProcess, 0 ;Close program

section '.idata' readable import data

library kernel, 'kernel32.dll',\  ;kernel is our new identifier/pointer for whatever
                               \  ;is in the string beside it, which is kernel32.dll
        crtdll, 'crtdll.dll'

import kernel, ExitProcess, "ExitProcess" ;ExitProcess is the function we're importing.

import crtdll, printf, 'printf',\
               system, 'system'    
Post 18 Nov 2007, 02:50
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 18 Nov 2007, 03:28
There is no real need for winsocks, wininet provides access to HTTP and FTP protocols (among I don't remember how many others). For maximun control you can use sockets but you'll need to implement the protocols yourself so perhaps wininet is fine if your program does not demand special requirements.

I did use wininet before to do an IP address detector but I formatted the HD of the computer where I developed it and also accidentaly erased the backup. Yes I was very happy for my own stupidity!! I even couldn't blame physical media failures this time Sad

Anyway, I did it as kohlrak says, creating the import table by hand and picking the required constants and types from somewhere else (I looked inside the include files of the MASM package if I remember right).
Post 18 Nov 2007, 03:28
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Nov 2007, 03:31
I didn't know there was a wininet, i thought he ment random internet operations which would be winsocks. XD
Post 18 Nov 2007, 03:31
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 18 Nov 2007, 04:03
wininet is pretty fine for basic operation indeed, but it's unsuitable for more advanced operations - like, afaik, not being able to override the default max # of per-server connections, unless you change a registry setting (bad!).
Post 18 Nov 2007, 04:03
View user's profile Send private message Visit poster's website Reply with quote
a1ss



Joined: 17 Nov 2007
Posts: 3
a1ss 18 Nov 2007, 10:21
hmm.. i need just one function InternetOpenURL.. i solve this problem with LoadLibrary, GetProcAddress.. (sorry about my endlish)
Post 18 Nov 2007, 10:21
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 18 Nov 2007, 12:15
It'd probably be easier to just use the import table. Especially because it's the same names you use for getprocaddress, only you have to import a whole extra function just to import a function. If you ask me, it's easier just to import it in the import table.

Quote:
wininet is pretty fine for basic operation indeed, but it's unsuitable for more advanced operations - like, afaik, not being able to override the default max # of per-server connections, unless you change a registry setting (bad!).


I can only imagin that there are restrictions on what kind of data you can send as well along with maybe making protocols of your own? I think i recall seeing a library in windows that did all the HTTP work for you.
Post 18 Nov 2007, 12:15
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.