MQL 5 Access Violation read in wininet.dll. MetaTraider version 5.00 build 3815 22 June 2023

 

Hi to all!

Try to post data to the web and get error:

Access violation at 0x00007FFE071D1F34 read to 0x00007FFE00000000 in 'wininet.dll'

crash -->  00007FFE071D1F34 4C3929            cmp        [rcx], r13

00007FFE071D1F37 0F85C7020000      jnz        dword 0x7ffe071d2204


00007FFE071D1F3D 488B0DAC353D00    mov        rcx, [rip+0x3d35ac]

00007FFE071D1F44 8D4301            lea        eax, [rbx+0x1]

00007FFE071D1F47 440FB7E0          movzx      r12d, ax

00007FFE071D1F4B 33D2              xor        edx, edx

00007FFE071D1F4D 458BC4            mov        r8d, r12d


00: 0x00007FFE071D1F34

01: 0x00000245845D76D3

02: 0x0000000000CC00A8

The including code for  wininet.dll:


#import "wininet.dll"

DWORD InternetAttemptConnect(DWORD dwReserved);

HINTERNET InternetOpenW(LPCTSTR lpszAgent, DWORD dwAccessType, LPCTSTR lpszProxyName, LPCTSTR lpszProxyBypass, DWORD dwFlags);

HINTERNET InternetConnectW(HINTERNET hInternet, LPCTSTR lpszServerName, INTERNET_PORT nServerPort, LPCTSTR lpszUsername, LPCTSTR lpszPassword, DWORD dwService, DWORD dwFlags, DWORD_PTR dwContext);

HINTERNET HttpOpenRequestW(HINTERNET hConnect, LPCTSTR lpszVerb, LPCTSTR lpszObjectName, LPCTSTR lpszVersion, LPCTSTR lpszReferer, int /*LPCTSTR* */ lplpszAcceptTypes, uint/*DWORD*/ dwFlags, DWORD_PTR dwContext);

BOOL HttpSendRequestW(HINTERNET hRequest, LPCTSTR lpszHeaders, DWORD dwHeadersLength, LPVOID lpOptional[], DWORD dwOptionalLength);

HINTERNET InternetOpenUrlW(HINTERNET hInternet, LPCTSTR lpszUrl, LPCTSTR lpszHeaders, DWORD dwHeadersLength, uint/*DWORD*/ dwFlags, DWORD_PTR dwContext);

BOOL InternetReadFile(HINTERNET hFile, LPVOID lpBuffer[], DWORD dwNumberOfBytesToRead, LPDWORD lpdwNumberOfBytesRead);

BOOL InternetCloseHandle(HINTERNET hInternet);

BOOL InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, LPDWORD lpBuffer, DWORD dwBufferLength);

BOOL InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, LPDWORD lpBuffer, LPDWORD lpdwBufferLength);

#import

Please help!

 

Have the same issue here:


 

I fixed the issue by

---   int  HttpOpenRequestW(int hConnect,string &lpszVerb,string &lpszObjectName,string &lpszVersion,string lpszReferer,string &lplpszAcceptTypes[],uint dwFlags,int dwContext);//org work with MT4

+++ int  HttpOpenRequestW(int hConnect,string &lpszVerb,string &lpszObjectName,string &lpszVersion,string lpszReferer,  string lplpszAcceptTypes,uint dwFlags,int dwContext); // Now For MT5

also see here : https://www.mql5.com/en/forum/3927


Discussion of article "Using WinInet in MQL5. Part 2: POST Requests and Files" - Using WinInet in MML5 is a great article, Part 2: Post Requests and Files are published by Alex Sergeev
Discussion of article "Using WinInet in MQL5. Part 2: POST Requests and Files" - Using WinInet in MML5 is a great article, Part 2: Post Requests and Files are published by Alex Sergeev
  • 2011.06.08
  • www.mql5.com
New article using wininet in mql5. Part 2: post requests and files is published: author: alex sergeev. Hi alex, good article - i have a request for 'part 3': xml-rpc client communication (and server if possible)
 

Take a look at this article: MQL5 HTTP Web Request Using WinINet DLL

Reason: