Lee Dungx
Lee Dungx

Reputation: 101

C# Winform Application detected by Kaspersky as Trojan (HEUR:Trojan-Spy.MSIL.Bobik.gen)

I have a C# Winform application, Its purpose is copy text in clipboard. But when I build the project I get Kaspersky report as (HEUR:Trojan-Spy.MSIL.Bobik.gen) and it deletes my .exe file. I found that problem from within my source code.

[DllImport("User32.dll")]
public static extern bool ReleaseCapture();
[DllImport("User32.dll")]
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AddClipboardFormatListener(IntPtr hwnd);
[DllImport("user32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool RemoveClipboardFormatListener(IntPtr hwnd);

//Call it in contructor

Public Form1()
{
    InitializeComponent();
    AddClipboardFormatListener(this.Handle);
    this.FormClosing += (s, e) =>
    {
        RemoveClipboardFormatListener(this.Handle);
    };
    button1.Click += (s, e) =>{
        // Button exit application
        RemoveClipboardFormatListener(this.Handle);
        Application.Exit();
    };
}

Please let me know, what went wrong with the above code and how to solve it. I'm trying a some way from C# Application Detected By Kaspersky As Trojan Virus (VHO:Trojan.MSIL.Convagent.gen), but not working for me. Thanks for reading.

Upvotes: 0

Views: 288

Answers (0)

Related Questions