![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Thanks, Dominik.
As previously mentioned, the code is part of a large proprietary project, and the specific area of code is quite sensitive. I would, however, be willing to work with you, perhaps online together to demonstrate and to try to diagnose any issue or create code that can reproduce the problem. Would that be possible?
MT5 Version: 5.00 build 4153, 22 Jan 2024.
Windows 10 Pro 22H2, build 19045.3930 with Windows Feature Experience Pack 1000.19053.1000.0. [32 GB memory, Intel Core i7-3920XM CPU @ 2.90GHz, 3.10 GHz]
Thanks.
The issue has been resolved in a private session.
Actually, it is the function signature definitions of the imported functions as they are defined in MT5 supplied files. A snippet of the finding is here:
winreg.mqh:
which is defined by Microsoft official documentation as:
https://learn.microsoft.com/en-us/windows/win32/api/winreg/nf-winreg-regopenkeyexw
Where HKEY is defined as:
https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types
And LPCWSTR is defined as:
https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types
And DWORD is defined as:
https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types
As annotation here, it is not exactly clear to me if this should be a 64 bit or 32 bit variable. - Consulting C++ documentation "unsigned long" should be at least 32 bit, depending on the target type. - Since MT5 is 64 bit, and the target architecture is 64 bit, this should result in a 64 bit type.
https://en.cppreference.com/w/cpp/language/types
And REGSAM is defined as:
https://learn.microsoft.com/en-us/previous-versions/bb401738(v=msdn.10)
And PHKEY is defined as:
typedef HKEY *PHKEY;
https://learn.microsoft.com/en-us/windows/win32/winprog/windows-data-types
The return value type is a bit difficult, as can be seen in this discussion: https://github.com/microsoft/win32metadata/issues/760
So, according to the resolution on that thread:
Same definition issue with this as with DWORD. - See above. - So, in conclusion it should b e 64 bit.
Therefore the actually valid signature seems to be:
After changing the signature to represent Microsoft's documentation, the reported issues were gone.
I remember seeing this some where:
To access DLL in MT4 (32bit), when you use:
- int / uint
- char / uchar
for MT5 (64bit), you use instead:
- long / ulong
- short / ushort
Thanks for the update.
I remember seeing this some where:
To access DLL in MT4 (32bit), when you use:
- int / uint
- char / uchar
for MT5 (64bit), you use instead:
- long / ulong
- short / ushort
Many thanks to Dominik Egert for very kind and generous assistance to investigate, diagnose and rectify the problem. Many thanks to him also for his comprehensive summary of the process and outcomes!
Obviously, there are implications here for the accuracy of the WinAPI Include files provided by MetaQuotes. One might hope they would be reviewed, validated against Microsoft signatures, and updated where need be to completely align with those Microsoft signatures.
Meanwhile, it is important to be aware of their deficiencies and the possible side effects when Optimization is enabled.
Thanks, again, Dominik Egert !
The issue has been resolved in a private session.
Actually, it is the function signature definitions of the imported functions as they are defined in MT5 supplied files. A snippet of the finding is here:
Thank you for detailed report.
I rechecked function signature and didn't find any mistakes.
C++ type long is not platform type (x64 or x86), it is TARGET depended type, which on WINDOWS is 32 bits integer and 64 bits on MINGW
Thank you for detailed report.
I rechecked function signature and didn't find any mistakes.
C++ type long is not platform type (x64 or x86), it is TARGET depended type, which on WINDOWS is 32 bits integer and 64 bits on MINGW
Could you provide your code for investigation?
Or try this signature: