similar code for my small program

kagami01
kagami01 used Ask the Experts™
on
I coded this small snipet code to open an my webpage that i uploaded my AV detected it as a virus,i am wondering there is another similar snippet code?

#include<stdio.h>
#include<string.h>
#include<windows.h>
#include<winreg.h>
 
#include<wininet.h>
 
 
 
 
 
main()
 
     
 
 
HINTERNET Internet = InternetOpen( NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
 
 
HINTERNET Url = InternetOpenUrl(Internet, "http://mywebsite/index.php", 0, 0, INTERNET_FLAG_RAW_DATA, 0);
  
 
   char Buffer[64*1024];
 
   DWORD ReadLen = 0, CurrentPos = 0;
   do
   {
      InternetReadFile(Url, (void *)(Buffer + CurrentPos), sizeof(Buffer) - CurrentPos, &ReadLen);
 
      
      CurrentPos += ReadLen;
   }
   while(ReadLen);
   Buffer[CurrentPos] = 0;
   InternetCloseHandle(Url);
   InternetCloseHandle(Internet);
 
}

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
evilrixSenior Software Engineer (Avast)

Commented:
When you say your AV detected it as a virus can you explain this please?

It may be it was detecting the behavior (heuristic detection).

Author

Commented:
my AV says "TR/downloader.Gen"
and of course my AV will block it
the code line below here is detected like that
HINTERNET Internet = InternetOpen( NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);

Open in new window

evilrixSenior Software Engineer (Avast)

Commented:
It seems it's detecting your program as a generic downloader... this is probably a behavioural heuristics check. It's the AV that is false detecting... I wouldn't bother changing your code I'd just disable the check i9nt he engine. It's likely that any code you write that does this will be detected in the same way.

Out of interested, which engine is this?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
the engine is it's Avira AV.anywya if the problem won't dissapera i am going to change this code line if there is another good solution??
evilrixSenior Software Engineer (Avast)

Commented:
Like I said, the problem isn't your code it's you AV engine. It's detecting behavior not code.
http://www.avira.com/en/threats/section/fulldetails/id_vir/3907/tr_downloader.gen.html

Author

Commented:
i see. it was clear but i am wondering there is another function similar to
HINTERNET Internet = InternetOpen( NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);?
Senior Software Engineer (Avast)
Commented:
Well, if you are developing Win apps this is probably the way to go, else take a look at LibCurl.
http://curl.haxx.se/

Author

Commented:
thank you so much.your explanation have been so clear
evilrixSenior Software Engineer (Avast)

Commented:
Very welcome.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial