The macro to enter a crical section nee to be modify :
;*******************************************************************
CSER MACRO fonction:REQ,parameters:VARARG
local etiquette
change CATSTR <">,<fonction>,<",0>
.data
etiquette db change
.code
@@:
invoke TryEnterCriticalSection,addr CriticalSection ;------- +1
.if eax == 1
invoke fonction,parameters
.if eax==0
.if dword ptr [phrase] != 0
invoke printf,addr phrase
.endif
invoke GetWinHttpError,addr etiquette
mov hr,0
.else
mov hr,eax
.endif
invoke LeaveCriticalSection,addr CriticalSection ;------ -1 ,always 0 like that
.else
;inc echecenter
invoke Sleep,10
jmp @B
.endif
EXITM <>
ENDM
;*******************************************************************
The TryEnterCriticalSection function give a better stabiity.The Number of failed to enter are beetween 0,2 .
The WINHTTP_CALLBACK_STATUS_REQUEST_ERROR event need also a modify:
add this line at the end : invoke SetEvent,Hevent <<<<<< stop the wait loop
This is needed when a site don't accept the http (I have try it on my site)
STATUS_REQUEST_ERROR <<<< coming from WINHTTP_CALLBACK_STATUS_REQUEST_ERROR event
ERROR_WINHTTP_INVALID_SERVER_RESPONSE <<<<<<<< the fault
<Status:Request error exit
Ha Status: sendrequest complete
WinHttpQueryDataAvailableERROR_WINHTTP_INCORRECT_HANDLE_STATE
<Ha Status: sendrequest complete
Nombre Echec critical :0
Status: Handle Closing
Status: Handle Closing
In the init proc,change LeaveCriticalSection by DeleteCriticalSection