Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello!

Because of this class "FileStream" my application is considered as a trojan and eliminated by the antivirus, but it is not at all. What to do? Really thanks in advance.

See the code as follow: (it is c# in a windows form app)

-------
C#
FtpWebResponse response = (FtpWebResponse)request.GetResponse();

Stream responseStream = response.GetResponseStream();
byte[] buffer = new byte[2048];

FileStream filestreaming = new FileStream(installation_dir + filename, FileMode.Create);

int ReadCount = responseStream.Read(buffer, 0, buffer.Length);
percentComplete = 0;

while (ReadCount > 0)
{
    filestreaming.Write(buffer, 0, ReadCount);
    ReadCount = responseStream.Read(buffer, 0, buffer.Length);

    percentComplete = (int)Math.Round((double)(100 * (filestreaming.Length)) / size);


}

response.Close();
filestreaming.Close();
responseStream.Close();

-----

What I have tried:

I tried to comment the line and it works fine, the antivirus is quiet. This is the proof that the antivirus doesn't like FileStream class...
Posted
Updated 6-Feb-24 5:16am
v3

1 solution

It's not the FileStream class that's the problem. It's what you're doing with it that's causing the issue.

So, what is the path "installation_dir + filename" returning? If it's under Program Files or Program Files (x86), THAT is what is suspicious. Creating and writing to files under what is supposed to be a read-only folder at runtime is what is tripping the antivirus.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900