Приветствую! В общем сабж. Уже не знаю что делать. Но в браузере сохраняется вся страница ~15кило, а из моей проги только 968 байт(
Код (Text): BOOL DownloadFile(char *url, char *name) { DWORD dwReadFileCount, dwWriteFileCount, dwWriteFileTotal = 0; UINT uRetry; BOOL bOk, bRet = FALSE; char buff[1024]; #ifdef DBG DbgMsg(__FILE__, __LINE__, "DownloadFile: %s %s\n", url, name); #endif HANDLE hFile = CreateFile(name, GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH | FILE_FLAG_SEQUENTIAL_SCAN | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM, NULL); if (hFile == INVALID_HANDLE_VALUE) { #ifdef DBG DbgMsg(__FILE__, __LINE__, "CreateFile() ERROR %d\n", GetLastError()); #endif goto end; } HINTERNET hSession = InternetOpen(SAGENT, LOCAL_INTERNET_ACCESS, NULL, INTERNET_INVALID_PORT_NUMBER, INTERNET_FLAG_DONT_CACHE); if (hSession == NULL) { #ifdef DBG DbgMsg(__FILE__, __LINE__, "InternetOpen() ERROR\n"); #endif goto end; } HINTERNET hSource = InternetOpenUrl(hSession, url, NULL, 0xFFFFFFFF, INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RAW_DATA, 0); if (hSource == NULL) { #ifdef DBG DbgMsg(__FILE__, __LINE__, "InternetOpenUrl() ERROR\n"); #endif goto end; } do { uRetry = 0; do { dwReadFileCount = 0; bOk = InternetReadFile(hSource, buff, sizeof(buff), &dwReadFileCount); } while (!(dwReadFileCount || bOk || uRetry++ == 10)); if (dwReadFileCount) { dwWriteFileCount = 0; bOk = WriteFile(hFile, buff, dwReadFileCount, &dwWriteFileCount, NULL); if (bOk && dwReadFileCount == dwWriteFileCount) dwWriteFileTotal += dwWriteFileCount; else dwReadFileCount = 0; } } while (dwReadFileCount); bRet = TRUE; end: if (hFile) CloseHandle(hFile); if (hSource) InternetCloseHandle(hSource); if (hSession) InternetCloseHandle(hSession); return bRet; }