[VB6] Verify hosts file in VB6?
Hi everyone!
I searching a solution in VB6 for my licence system because if anyone modify the hosts file of windows for redirecting to the licence system hosts ... everyone can crack it :S
I don't know if it's possible ... I want to verify in the hosts file if the licence system host is in it
Thanks!
Re: [VB6] Verify hosts file in VB6?
Heh I went through the same thing as you, while ago (August?), for my Ambiance License System thing with mother server and w/e more, I also wanted to check if they didn't added the mother servers ip to their host file.
Very easy to do;
Code:
Private Function checkHost(forIP As String) As Boolean
Dim FSO As New FileSystemObject 'Inside the Scripting runtime lib
Dim hostFileContent As String
hostFileContent = FSO.OpenTextFile("C:\WINDOWS\system32\drivers\etc\hosts", ForReading).ReadAll
If instr(hostFileContent, forIP) Then checkHost = True
End Sub
Just call that function in your 'check if valid license' form, and if it returns a true then msgbox the user that he has fucked up his hostfile, is a cunt or w/e you desire! :D
Ofcourse you can call an API to get the 'real' dir where the user installed Windows, but in most cases it's just on C:\WINDOWS.
Hope this works, it should lol. ;]
Good luck.
- Nillus
Re: [VB6] Verify hosts file in VB6?