The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: statis on July 19, 2011, 02:25:01 PM

Title: HttpOpenRequest problem
Post by: statis on July 19, 2011, 02:25:01 PM
Hello,

I need open request with multipart.

I finded this on C sample :
HINTERNET hRequest = HttpOpenRequest(hConnect, "POST",
      _T("FormActionHere"), NULL, NULL, accept, 0, 1)

Do you know value for "accept" in db form to set correctly my invoke in masm32 language ?

Tanks for all
Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 19, 2011, 02:40:45 PM
The answer is not in the wininet.h,so you have to search in your source code
Title: Re: HttpOpenRequest problem
Post by: dedndave on July 19, 2011, 03:35:28 PM
it is a pointer to a string that defines the mime-type(s)...
QuoteA pointer to a null-terminated array of strings that indicates media types accepted by the client. If this parameter is NULL, no types are accepted by the client. Servers generally interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents—no pictures or other binary files). For more information and a list of valid media types, see http://www.iana.org/assignments/media-types/index.html.
Title: Re: HttpOpenRequest problem
Post by: Twister on July 19, 2011, 03:38:10 PM
The value is just "text/html"
Title: Re: HttpOpenRequest problem
Post by: dedndave on July 19, 2011, 03:40:49 PM
sounds like you could use NULL for HTML's   :P
Title: Re: HttpOpenRequest problem
Post by: statis on July 19, 2011, 09:44:05 PM
more informations
i have error with sendrequestheader when i send boundary
before studied rfc HttpOpenRequest does send accept value for multipart sending

if i anderstend your propositions i can try value:

db "accept",0

i try this tomorrow

thanks
Title: Re: HttpOpenRequest problem
Post by: statis on July 19, 2011, 09:50:13 PM
Quote from: dedndave on July 19, 2011, 03:35:28 PM
it is a pointer to a string that defines the mime-type(s)...
QuoteA pointer to a null-terminated array of strings that indicates media types accepted by the client. If this parameter is NULL, no types are accepted by the client. Servers generally interpret a lack of accept types to indicate that the client accepts only documents of type "text/*" (that is, only text documents—no pictures or other binary files). For more information and a list of valid media types, see http://www.iana.org/assignments/media-types/index.html.

"If this parameter is NULL, no types are accepted by the client", with null setting i have error boundary sending
i do sending form-data    but [RFC2388] isn't complete to set correctly parameters HttpOpenRequest's

tanks dednave
Title: Re: HttpOpenRequest problem
Post by: dedndave on July 20, 2011, 02:54:01 AM
try this...

        INVOKE  HttpOpenRequest,hConnect,chr$('POST'),chr$('FormActionHere'),NULL,NULL,chr$('text/html'),0,1
Title: Re: HttpOpenRequest problem
Post by: bomz on July 20, 2011, 05:00:56 AM
Quote.386
.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\wininet.inc
include \masm32\macros\macros.asm

includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wininet.lib

SendRequest PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
Main PROTO


.data
   UserAgent   db 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; .NET CLR 1.0.2914)',0
   fileUrl      db 'www.masm32.com',0
   method      db 'GET',0
   pageAddr   db '/board/index.php?topic=17065.new;boardseen#new',0
   ContentType   db 'Content-Type: zip',0
   fileSave   db 'index.html',0

.data?
   hInstance   dd ?
   hInternet   dd ?
   hConnect   dd ?
   hRequest   dd ?
   Bufferlen   dd ?
   Buffer      db 65536 dup(?)
   fHand      dd ?
   bwrite      dd ?

.code
start:
invoke InternetOpen, addr UserAgent,INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, NULL
mov hInternet,eax

invoke InternetConnect,hInternet, addr fileUrl,INTERNET_DEFAULT_HTTP_PORT, 0, 0,INTERNET_SERVICE_HTTP, 0, 0
mov hConnect,eax

invoke HttpOpenRequest,hConnect, addr method,addr pageAddr,0,0,0,0,0
mov hRequest,eax

invoke HttpSendRequest,hRequest, addr ContentType, sizeof ContentType, NULL, NULL

   invoke CreateFile, addr fileSave, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ,\
   NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
   mov fHand, eax
download:
   invoke InternetReadFile,hRequest,addr Buffer, sizeof Buffer,addr Bufferlen
.if Bufferlen != 0
   invoke WriteFile, fHand, addr Buffer, sizeof Buffer, addr bwrite, NULL
   jmp short download
.endif
   invoke CloseHandle, fHand

invoke InternetCloseHandle,hRequest
invoke InternetCloseHandle,hConnect
invoke InternetCloseHandle,hInternet

   invoke   ExitProcess,eax
end start
Title: Re: HttpOpenRequest problem
Post by: statis on July 20, 2011, 10:45:22 AM
Quote from: dedndave on July 20, 2011, 02:54:01 AM
try this...

        INVOKE  HttpOpenRequest,hConnect,chr$('POST'),chr$('FormActionHere'),NULL,NULL,chr$('text/html'),0,1

sorry INVOKE  HttpOpenRequest,hConnect,chr$('POST'),chr$('FormActionHere'),NULL,NULL,chr$('text/html'),1 start error request

INVOKE  HttpOpenRequest,hConnect,chr$('POST'),chr$('FormActionHere'),NULL,NULL,1,1 doesn't start error request but later i have error with sending boundary

lplpszAcceptTypes value is mistery...
Title: Re: HttpOpenRequest problem
Post by: statis on July 20, 2011, 11:02:16 AM
tanks bomz your sample is useful for get method but for multipart sending with boundary it's post method needed
Title: Re: HttpOpenRequest problem
Post by: bomz on July 20, 2011, 11:32:37 AM
Quote.386
   .model flat,stdcall
   option casemap:none

   include \masm32\include\windows.inc
   include \masm32\include\user32.inc
   include \masm32\include\kernel32.inc
   include \masm32\include\wininet.inc
   includelib \masm32\lib\user32.lib
   includelib \masm32\lib\kernel32.lib
   includelib \masm32\lib\wininet.lib

.data
   UserAgent   db 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; .NET CLR 1.0.2914)',0
   fileUrl      db 'films-onep.ifolder.ru',0
   method      db 'POST',0
   pageAddr   db '/control/?file_id=***********************************************',0
   ContentType   db 'Content-Type: application/x-www-form-urlencoded',0
   fileSave   db 'noname.htm',0
   Adress      db 'http://films-onep.ifolder.ru/control/?file_id=15825290&code=*********************************',0
   CoockieData   db 'sid=98f0092f24f75ee82733deb8744e5ebf',0
   PostData   db 'prolong=%D0%BF%D1%80%D0%BE%D0%B4%D0%BB%D0%B8%D1%82%D1%8C',0
.data?
    hInternet   dd ?
    hConnect   dd ?
    hRequest   dd ?
    Bufferlen   dd ?
    Buffer      db 65536 dup(?)
    fHand      dd ?
    bwrite      dd ?

.code
start:
   invoke InternetOpen, addr UserAgent,INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, NULL
   mov hInternet,eax
   invoke InternetSetCookie, addr Adress,NULL,addr CoockieData
   invoke InternetConnect,hInternet, addr fileUrl,INTERNET_DEFAULT_HTTP_PORT, 0, 0,INTERNET_SERVICE_HTTP, 0, 0
   mov hConnect,eax
   invoke HttpOpenRequest,hConnect, NULL,addr pageAddr,0, addr Adress,0,0,0
   mov hRequest,eax
   invoke HttpSendRequest,hRequest, addr ContentType, sizeof ContentType, NULL, NULL
   invoke CreateFile, addr fileSave, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ,\
   NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL
   mov fHand, eax
download:
   invoke InternetReadFile,hRequest,addr Buffer, sizeof Buffer,addr Bufferlen
.if Bufferlen != 0
   invoke WriteFile, fHand, addr Buffer, Bufferlen, addr bwrite, NULL
   jmp short download
.endif
   invoke InternetCloseHandle,hRequest
   invoke HttpOpenRequest,hConnect, addr method,addr pageAddr,0, addr Adress,0,0,0
   mov hRequest,eax
   invoke HttpSendRequest,hRequest, addr ContentType, sizeof ContentType, addr PostData, sizeof PostData
   invoke CloseHandle, fHand
   invoke InternetCloseHandle,hRequest
   invoke InternetCloseHandle,hConnect
   invoke InternetCloseHandle,hInternet
   invoke ExitProcess,eax
end start
Title: Re: HttpOpenRequest problem
Post by: bomz on July 20, 2011, 11:41:20 AM
For some tasks better use SOCKET. For my case I do working application with SOCKET but when understand that it may not be fully correct and it's too complicated to learn all http protocol so I leave this idea
Title: Re: HttpOpenRequest problem
Post by: statis on July 20, 2011, 01:54:49 PM
Quote from: bomz on July 20, 2011, 11:41:20 AM
For some tasks better use SOCKET. For my case I do working application with SOCKET but when understand that it may not be fully correct and it's too complicated to learn all http protocol so I leave this idea

I have another post on same subject, use winsock is better solution for only one action, on in context i can't use winsocket for only very little part coding with only multipart form.

Isn't problem with http protocol, it's problème with api use i do specify call openrequest to send correctly boundary
Title: Re: HttpOpenRequest problem
Post by: bomz on July 20, 2011, 02:09:56 PM
In my application IE libruary some times work incorrectly. using socket more flexibly
Title: Re: HttpOpenRequest problem
Post by: statis on July 22, 2011, 12:53:46 PM
Quote from: bomz on July 20, 2011, 02:09:56 PM
In my application IE libruary some times work incorrectly. using socket more flexibly

IE use IE dll's, wininet use common core with http(s) applications.
Winsock isn't appropriate in my case, if no one familiar wininet, i'm dead
Title: Re: HttpOpenRequest problem
Post by: Gunner on July 22, 2011, 04:46:31 PM
Use sockets or the http api , should not matter..  a boundery tells the server everything between the boundery that you define is different then the body...  You "set" the boundry in the headers.... Then you enclose your data within your boundry for the body..

What are you trying to do anyway
Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 22, 2011, 05:17:44 PM

a good sample is in the windows sdk (in c)
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\web\Wininet\Async\async.c
Title: Re: HttpOpenRequest problem
Post by: statis on July 25, 2011, 01:01:29 PM
Quote from: ToutEnMasm on July 22, 2011, 05:17:44 PM

a good sample is in the windows sdk (in c)
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\web\Wininet\Async\async.c


on msdn i find only sdk for W7 and i can't install this on my PC old XP
Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 25, 2011, 01:27:39 PM
Hello,
I have also XP SP3,you need just the headers files ,libraries ,binaries(tools)  and samples.
The download is well done,you can choose what you want to dowload.
Title: Re: HttpOpenRequest problem
Post by: statis on July 25, 2011, 03:14:53 PM
Quote from: statis on July 25, 2011, 01:01:29 PM
Quote from: ToutEnMasm on July 22, 2011, 05:17:44 PM

a good sample is in the windows sdk (in c)
C:\Program Files\Microsoft SDKs\Windows\v7.1\Samples\web\Wininet\Async\async.c


on msdn i find only sdk for W7 and i can't install this on my PC old XP

tanks

HttpAddRequestHeaders combination to use boundary before HttpOpenRequest isn't in this sample
Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 25, 2011, 03:32:17 PM

There is no sample in the sdk using HttpAddRequestHeaders .
Where to search ?
Title: Re: HttpOpenRequest problem
Post by: statis on July 26, 2011, 10:48:55 AM
Quote from: ToutEnMasm on July 25, 2011, 03:32:17 PM

There is no sample in the sdk using HttpAddRequestHeaders .
Where to search ?


Quote from: statis on July 19, 2011, 02:25:01 PM
Hello,

I need open request with multipart.

I finded this on C sample :
HINTERNET hRequest = HttpOpenRequest(hConnect, "POST",
      _T("FormActionHere"), NULL, NULL, accept, 0, 1)

Do you know value for "accept" in db form to set correctly my invoke in masm32 language ?

Tanks for all

the start of problem is on another post http://www.masm32.com/board/index.php?topic=16506.0 :

lpszVerbpost   db "POST",0
lphttp        db "HTTP/1.1",0
formact2   db "/default.html",0

invoke HttpOpenRequest,hConnect,offset lpszVerbpost,offset formact,offset lphttp,0,0,0,1

text1 db "Content-Type: multipart/form-data; boundary=AaB03x",0dh,0ah,0

invoke HttpAddRequestHeaders,hRequest,offset text1,-1,HTTP_ADDREQ_FLAG_ADD

request part is send with no error

for next step :

text2 db "--AaB03x",0dh,0ah
        db 'Content-Disposition: form-data; name="EventSource"',0dh,0ah,0dh,0ah
        db 'quickSearch_searchFieldId_',0dh,0ah,0

invoke HttpAddRequestHeaders,hRequest,offset text2,-1,HTTP_ADDREQ_FLAG_ADD

and i have 87 error (057h), windows doesn't send request part, idon't see on wireshark monitoring

i have tryed many combinations with invoke HttpAddRequestHeaders and no good results

if i use :
invoke HttpOpenRequest,hConnect,offset lpszVerbpost,offset formact,offset lphttp,0,0,x,1

i have try x="ACCEPT" and "accept" ->error HttpOpenRequest
i have try x=1 ->error HttpAddRequestHeaders on step 2

alls samples multipart request i finded on google aren't with good rfc formatting :
first declaration boundary=1234
second declaration --1234
last declaration --1234--
AND USERS HAVEN'T good result with sample :
boundary=--1234
second declaration --1234
...

RFC don't say to use wininet request only data correct format...

It's to hard use winsock with my project (more 10000 line code) for this litle part and i can't find winhttp include on masm.

Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 26, 2011, 12:02:56 PM
Quote
It's to hard use winsock with my project (more 10000 line code) for this litle part and i can't find winhttp include on masm.
What a piety,have you never see http://www.masm32.com/board/index.php?topic=5428.0
To be more explicit , follow the link under:
QuoteBefore translate anything,have a look at the full set of SDK header files translated
Made that and you win a complet set of sdk translated files with the winhttp translated.

Title: Re: HttpOpenRequest problem
Post by: ToutEnMasm on July 26, 2011, 12:20:10 PM
In the Winhttp.sdk,you can read
Quote
IF DEFINED(_WIN64)
;Include pshpack8.SDK
ELSE
;Include pshpack4.SDK
ENDIF

This mean that alignment of the structures must be 8 for a WIN64 system and 4 for others system.
take care of this
Title: Re: HttpOpenRequest problem
Post by: Gunner on July 26, 2011, 01:54:29 PM
WinHTTP uses Wininet, so you would include wininet.inc and includelib wininet.lib

There is no reason why you cannot  use winsock just for this part of your code.  We are going to get nowhere fast because you are only showing us snippets of your code, you have to post more code.

You are not seeing anything with WireShark because AddHeaders does not sent anything to the servers, you have to do HttpSendRequest to send to the server.

Since there is no code, lets see if you are doing what is needed.

1. InternetOpen
2. InternetConnect
3. HttpOpenRequest
4. HttpAddRequestHeaders
5. HttpSendRequest
6. HttpQueryInfo
Title: Re: HttpOpenRequest problem
Post by: statis on July 26, 2011, 03:00:05 PM
Quote from: Gunner on July 26, 2011, 01:54:29 PM
WinHTTP uses Wininet, so you would include wininet.inc and includelib wininet.lib

There is no reason why you cannot  use winsock just for this part of your code.  We are going to get nowhere fast because you are only showing us snippets of your code, you have to post more code.

You are not seeing anything with WireShark because AddHeaders does not sent anything to the servers, you have to do HttpSendRequest to send to the server.

Since there is no code, lets see if you are doing what is needed.

1. InternetOpen
2. InternetConnect
3. HttpOpenRequest
4. HttpAddRequestHeaders
5. HttpSendRequest
6. HttpQueryInfo

Tanks Gunner

wininet exist and why i do use winsock ?

isn't code problem, it's problem with header construction...

THIS POST IS WININET POST and IT'S QUESTION on HttpOpenRequest lpszAccept format ;)

If you know wininet multipart use you can help me, if no you loose time, sorry
Title: Re: HttpOpenRequest problem
Post by: Gunner on July 26, 2011, 03:26:17 PM
Quote from: statis on July 26, 2011, 03:00:05 PM

Tanks Gunner

wininet exist and why i do use winsock ?

isn't code problem, it's problem with header construction...

THIS POST IS WININET POST and IT'S QUESTION on HttpOpenRequest lpszAccept format ;)

If you know wininet multipart use you can help me, if no you loose time, sorry

How do you know it is not a code problem?

WinINET IS winsock.  It is a "High Level" bunch of API calls that do their thing and then use sockets.  For somethings using sockets is much easier, no problems like this.  You construct your headers and body all in one buffer, and you then send that buffer to the server.

are you doing any other internet stuff?  Does that work?  Why don't you want to post more code?  We are not going to steal your code.  Knowing multipart data is nothing..  you tell the server what your boundry is, enclose your data in the boundry and send it... 

I ask again, what are you trying to do?  What are you trying to send?

What does the lpszAcceptTypes have anything to do with this?  that is only for the client - your app, unless you are going to receive binary or encoded data just use NULL
Title: Re: HttpOpenRequest problem
Post by: statis on July 26, 2011, 10:32:59 PM
i don't re-repeat code, see up text on Quote from: statis on July 19, 2011, 03:25:01 pm, code is here...

winsok or not winsok that is the question  :tdown

winsock has incompatibility with alls another part in my project and with 7 external scripting modules
if i use winsok i do restart all and loose more 10000 lines codes and 300 hours of devellopement

WinINET IS winsock ! Isn't same API and if WinINET IS winsock why wininet exist ?
wininet exist and i do use

for information i have tryed to send alls boundary's with rfc format and final boundary's in one block and i have same error on HttpAddRequestHeaders
for information this mutipart formulary isn't first access on server and alls work correctly, authentification, reading pages and more, problems goes when i try to send formulary informations

for more informations accept types is important when friend use copy header with scripting soft accept is present and if header is send with no accept types no error and no result...

I ask again, what are you trying to do?  What are you trying to send?
Read post...
Title: Re: HttpOpenRequest problem
Post by: Gunner on July 26, 2011, 10:51:57 PM
You actually don't say what you are trying to send, and send where... to a php/cgi script, to a form etc... are you trying to send form data? A picture? a zip file?  some other binary data?

You do say you found this c sample... 

Winsock should have no compatibility problems with anything.  It is windows version of sockets, problem is you have to do EVERYTHING yourself, that is why WinINET came about to make life easier for programmers, it "hides" a lot from you, but its tougher to do somethings.

That is only a code snippet you have data mixed in with code.... need to see the exact code you have, that is the only way we can see what is wrong.  unless you are trying to post binary data to a form/php/cgi you don't need multi-part, application/x-www-form-urlencoded will work just fine.

I mentioned a few times, the boundry is what you make it to be... can be --------myboundry >>>>> --------myboundry--

---HeYsTaRtHeRe >>>> ---HeYsTaRtHeRe-- doesn't matter as long as the last boundry marker matches the first one with  two dashes at the end.. that is the correct way...  but if you don't want to show the code you have, I am done here, good luck in your journey..
Title: Re: HttpOpenRequest problem
Post by: statis on July 27, 2011, 08:24:00 AM
Quote from: Gunner on July 26, 2011, 10:51:57 PM
You actually don't say what you are trying to send, and send where... to a php/cgi script, to a form etc... are you trying to send form data? A picture? a zip file?  some other binary data?

You do say you found this c sample... 


Winsock should have no compatibility problems with anything.  It is windows version of sockets, problem is you have to do EVERYTHING yourself, that is why WinINET came about to make life easier for programmers, it "hides" a lot from you, but its tougher to do somethings.
after
That is only a code snippet you have data mixed in with code.... need to see the exact code you have, that is the only way we can see what is wrong.  unless you are trying to post binary data to a form/php/cgi you don't need multi-part, application/x-www-form-urlencoded will work just fine.

I mentioned a few times, the boundry is what you make it to be... can be --------myboundry >>>>> --------myboundry--

---HeYsTaRtHeRe >>>> ---HeYsTaRtHeRe-- doesn't matter as long as the last boundry marker matches the first one with  two dashes at the end.. that is the correct way...  but if you don't want to show the code you have, I am done here, good luck in your journey..

the code is :

NAME   db "xxxxxx",0 ;hided for this post
OUT     db "xxxxxx",0 ;hided for this post
lpszVerbpost   db "POST",0
lphttp        db "HTTP/1.1",0
formact2   db "/default.html",0

text1 db "Content-Type: multipart/form-data; boundary=AaB03x",0dh,0ah,0  ;i have try with final 0 delete to all part for have final bloc in finaltext

text2 db "--AaB03x",0dh,0ah
        db 'Content-Disposition: form-data; name="EventSource"',0dh,0ah,0dh,0ah
        db 'quickSearch_searchFieldId_',0dh,0ah,0

;textx
;texty

finaltext db "--AaB03x--",0dh,0ah,0

hSession dd ?
hConnect dd ?

INVOKE InternetOpen,offset NAME,INTERNET_OPEN_TYPE_PRECONFIG,0,0,0
mov hSession,eax
or   eax,eax
jz   GetError ;special subroutine

invoke InternetConnect,hSession,offset OUT,PORT,0,0,3,0,1 ;PORT is port number hided for this post, same hided OUT, it's work for alls access server
mov hConnect, eax
or   eax,eax
jz   GetError ;special subroutine

;
;after many operations section to go to multipart form
;
;

invoke HttpOpenRequest,hConnect,offset lpszVerbpost,offset formact,offset lphttp,0,0,0,1
mov hRequest, eax
or   eax,eax
jz   GetError ;special subroutine

invoke HttpAddRequestHeaders,hRequest,offset text1,-1,HTTP_ADDREQ_FLAG_ADD
if eax==0
   ;jump to subroutine for extract error code and print to screen
.endif
;
;NO ERROR AT THIS POINT, if i try complete bloc sending subroutine return error code
;
;
invoke HttpAddRequestHeaders,hRequest,offset text2,-1,HTTP_ADDREQ_FLAG_ADD
if eax==0
   ;subroutine return error code
.endif

i have only this information on formulary :
<form name="menuForm" method="post" action="/default.html" enctype="multipart/form-data">

all data's are text format...
Title: Re: HttpOpenRequest problem
Post by: statis on August 06, 2011, 11:11:08 AM
...
Title: Re: HttpOpenRequest problem
Post by: morgot on January 19, 2012, 04:32:07 PM
hello
Sorry for bad English.
Where can I get a file winhttp.inc? I like it very necessary to masm32.
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 19, 2012, 08:27:18 PM
good question   :bg

i looked for winhttp.h online
it does not seem to be very large - you could probably convert it to ASM syntax without too much difficulty
Title: Re: HttpOpenRequest problem
Post by: hutch-- on January 20, 2012, 06:53:52 AM
Use wininet.inc and wininet.lib.


include \masm32\include\wininet.inc
includelib \masm32\lib\wininet.lib
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 20, 2012, 12:19:09 PM
dang - my eyes must be REALLY bad - lol
i looked in that file and must have skipped over something   :P
Title: Re: HttpOpenRequest problem
Post by: morgot on January 20, 2012, 01:22:41 PM
Quote from: dedndave on January 19, 2012, 08:27:18 PM
good question   :bg

i looked for winhttp.h online
it does not seem to be very large - you could probably convert it to ASM syntax without too much difficulty
I can not. I thought maybe someone else has already created such for their needs. I'm ready to buy this file.

hutch -, thanks, but Microsoft says that wininet bad multi-threaded and does not work in the context of the service. A socket for me too complicated.
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 20, 2012, 01:32:11 PM
what Hutch is telling you is...
the functions are prototyped in the wininet.inc file...
InternetOpen, InternetConnect, HttpOpenRequest, HttpAddRequestHeaders

as for the constants, they may or may not be defined in windows.inc
they are not hard to add, however

EDIT - it appears that the constants are defined in windows.inc
Title: Re: HttpOpenRequest problem
Post by: morgot on January 20, 2012, 03:50:34 PM
Sorry, my English is not very good. But i want a function from winhttp and not from wininet. Where can i find them ? In my masm (version 11), there is not prototypes of winhttp functions and constants.
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 20, 2012, 06:01:20 PM
ok - i found something you might be able to use   :P

Yves (ToutEnMasm) has a winhttp.inc file in his "ready to use windows sdk"
http://www.masm32.com/board/index.php?topic=8542.0

EDIT: more correctly, the file is named winhttp.sdk, which is similar to an INC file
it has the equates, structures, and prototypes
you can create an import library from the prototypes

the fun part is - everything is in French
is your French better than your English ?   :bg
what language do you speak ?
Title: Re: HttpOpenRequest problem
Post by: hutch-- on January 20, 2012, 07:17:15 PM
morgot,

You are confusing the C++ header file name with the LOCATION of the function which is in wininet.lib.

winhttp.h = C++ header file 45829 bytes.

Function (API) is in WININET.LIB.
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 20, 2012, 11:22:39 PM
i don't understand what you are saying, Hutch
this looks like a different group of functions

from "About WinHTTP"
QuoteMicrosoft Windows HTTP Services (WinHTTP) provides developers with a server-supported,
high-level interface to the HTTP/1.1 Internet protocol. WinHTTP is designed to be used
primarily in server-based scenarios by server applications
that communicate with HTTP servers.

WinINet was designed as an HTTP client platform for interactive desktop applications, such as
Microsoft Internet Explorer, Microsoft Office, and Microsoft Money. WinINet displays a user interface
for some operations such as collecting user credentials. WinHTTP, however, handles these operations
programmatically. Server applications that require HTTP client services should use WinHTTP instead of WinINet.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa382925%28v=vs.85%29.aspx

and, from WinHttpSendRequest...
QuoteHeader Winhttp.h
Library Winhttp.lib
DLL Winhttp.dll
http://msdn.microsoft.com/en-us/library/windows/desktop/aa384110%28v=vs.85%29.aspx
Title: Re: HttpOpenRequest problem
Post by: hutch-- on January 21, 2012, 03:55:51 AM
This is the content of winhttp.lib. It provides "WinHttpOpenRequest", not "HttpOpenRequest" which occurs in wininet.lib in both ANSI and UNICODE.



; --------------------------------------------------------------------------------------------------
;                           winhttp.inc Copyright The MASM32 SDK 1998-2010
; --------------------------------------------------------------------------------------------------

IFNDEF WINHTTP_INC
WINHTTP_INC equ <1>

SvchostPushServiceGlobals PROTO STDCALL :DWORD
WinHttpAddRequestHeaders PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpAutoProxySvcMain PROTO STDCALL :DWORD,:DWORD
WinHttpCheckPlatform PROTO STDCALL
WinHttpCloseHandle PROTO STDCALL :DWORD
WinHttpConnect PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpCrackUrl PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpCreateUrl PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpDetectAutoProxyConfigUrl PROTO STDCALL :DWORD,:DWORD
WinHttpGetDefaultProxyConfiguration PROTO STDCALL :DWORD
WinHttpGetIEProxyConfigForCurrentUser PROTO STDCALL :DWORD
WinHttpGetProxyForUrl PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpOpen PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpOpenRequest PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpQueryAuthSchemes PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpQueryDataAvailable PROTO STDCALL :DWORD,:DWORD
WinHttpQueryHeaders PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpQueryOption PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpReadData PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpReceiveResponse PROTO STDCALL :DWORD,:DWORD
WinHttpSendRequest PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpSetCredentials PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpSetDefaultProxyConfiguration PROTO STDCALL :DWORD
WinHttpSetOption PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpSetStatusCallback PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD
WinHttpSetTimeouts PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
WinHttpTimeFromSystemTime PROTO STDCALL :DWORD,:DWORD
WinHttpTimeToSystemTime PROTO STDCALL :DWORD,:DWORD
WinHttpWriteData PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD

ELSE
  echo ------------------------------------------
  echo WARNING duplicate include file winhttp.inc
  echo ------------------------------------------
ENDIF
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 21, 2012, 04:13:02 AM
gotcha   :U

i think there was a little confusion because of the language barrier
the code in the original post seems to represent the WinInet code he wants to replace, using WinHttp   :P

at any rate, it is a relatively small and simple include/lib pair
most of it is equates
Title: Re: HttpOpenRequest problem
Post by: dedndave on January 21, 2012, 04:54:38 AM
SvchostPushServiceGlobals
dunno where you got that one
it appears to be an undocumented seclogon.dll (secure logon) function   :P
Title: Re: HttpOpenRequest problem
Post by: morgot on January 21, 2012, 01:10:50 PM
hutch Thank you very much! :U :cheekygreen:

By the way, if someone will use this Library, then it must be recognized, that winhttp requires Unicode.

dedndave
I know ukrainian and russian language only. And use google translate to write you.