Hello, I have the following code snippet, when the function "GetHOSTSFilePath" is called it should return the the location of the HOSTS file. However, in my case the string is truncated (no idea why).
char *GetWindowsPath() {
char szWindowsPath[MAX_PATH];
GetWindowsDirectory(szWindowsPath, sizeof(szWindowsPath));
return szWindowsPath;
}
char *GetHOSTSFilePath() {
char szBuffer[MAX_PATH];
wsprintf(szBuffer, "%s\\system32\\drivers\\etc\\hosts", GetWindowsPath());
return szBuffer;
}
Any ideas could be helpful. Thanks in advance.
Regards,
halsten