'URLDownloadToFile Function corrupting downloaded EXE

I'm trying to download an EXE using the URLDownloadToFile function. Yet, when it is downloaded, it corrupts the exe and gives the error message:

This app can't run on your PC

The actual file size is 21kb, yet when it is downloaded using the function it turns into a 123KB file.

My code:

HRESULT hres = S_OK;
LPCTSTR vbURL = _T("https://linktofile.com/vb.exe"), vbPATH = _T("C:\\Desktop\\vb.exe");
hres = URLDownloadToFile(NULL, vbURL, vbPATH, 0, NULL);
system("start C:\\Desktop\\vb.exe");


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source