- How to Set An EA To Expire and hidden the EA setting?
- secure your trading robot
- Are EA test profits real ?
Yes
You could make a call to the windows APi and get a unique idetefier for the computer like Windows serial number or hardrive Serial number and lock the EA to run only on that PC
Yes
You could make a call to the windows APi and get a unique idetefier for the computer like Windows serial number or hardrive Serial number and lock the EA to run only on that PC
Can you give me the sample code ?
Can you give me the sample code ?
You could make a call to the windows APi and get a unique idetefier for the computer like Windows serial number or hardrive Serial number and lock the EA to run only on that PC
There are two general problems with this:
- There is no form of computer ID which meets all of the following criteria: (a) guaranteed to be available on all computers; (b) not falsifiable by the user; and (c) does not potentially require installation of additional libraries which the user does not have. For example, hard disk volume number is easy to query but is also easy to manipulate. Hard disk serial number can only be queried using something like WMI, which is not guaranteed to be present on a computer, and is a pig to call from MQL4/5. Similarly, locking against MAC address is hard, partly because most computers have multiple MAC addresses, and partly because the standard way of querying them is anyway open to user manipulation (i.e. doesn't actually touch the hardware).
- EX4 files can be decompiled. Therefore, any security mechanism which is built into MQL4 code can easily be removed.
puncher, there you go
//+------------------------------------------------------------------+ //| Function..: SystemDriveSerialNumber | //| Purpose...: Retrieve the serial number of a logical drive stored | //| in the drive's boot sector. | //| Parameters: sDrive - root diretory of volume to retrieve Serial | //| number. | //| Returns...: sNumber - drive serial number, or null string in the | //| case of an error. | //| Example...: string sNumber=SystemDriveSerialNumber("C"); | //| Thank You.: Big thank you to Stanislav Starikov of MetaQuotes | //| www.metaquotes.net for correcting the parameter type | //| Notes.....: Insert the following code at the top of your program | /*| in the EX4 imports section: | #import "Kernel32.dll" bool GetVolumeInformationA(string RootPathName, string VolumeNameBuffer, int VolumeNameSize, int& VolumeSerialNumber[], int MaximumComponentLength, int FileSystemFlags, string FileSystemNameBuffer, int FileSystemNameSize); #import //+------------------------------------------------------------------+*/ string SystemDriveSerialNumber(string sDrive) { int iVolumeSerialNumber[1]={0}; string sVolumeSerialNumber=""; if(GetVolumeInformationA(sDrive+":\\", " ", 15, iVolumeSerialNumber, 0, 0, " ", 15)) { sVolumeSerialNumber=IntegerToHexString(iVolumeSerialNumber[0]); sVolumeSerialNumber=StringConcatenate(StringSubstr(sVolumeSerialNumber,0,4), "-", StringSubstr(sVolumeSerialNumber,4)); } return(sVolumeSerialNumber); }
[offtopic]
@sxTed
i have noticed you comment your functions extensively which is a good thing and every programmer should do it.
Have you ever considered formatting these comments in JavaDoc style so you can later simply run Doxygen over your entire include folder to generate nice structured HTML (or CHM or PDF) documentation like this: http://7bit.99k.org/files.html with a single mouse click?
With the wealth of information you provide for every function it should produce really nice comprehensive documentation, all you have to do is use the standard tokens like @param, @return, etc. inside your blocks and make the blocks recognizable to doxygen itself by starting them with /**
puncher, there you go
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use