I do not know why but I had the same problem
Mach4 517 would crash corrupt the ini file etc
I found out it it was my old industrial modified screen that caused the problem as the screen supplied was ok and ran fine .
But the problem was when I imported the prof file it had the link to my old screen thus crash , I had to do a clean install to 517 but not run it but open the ini file and alter the screen set in there ,then I could boot ok and run the mill , then alter the new screen to my needs
Note I was never able to find out what was in the old screen that caused it , the only clue I found was that a lot of addresses for vars had been changed