C# app appears false positive in AVG antivirus? - c#

I have created a C# application that I've been testing on my other computer throughout the developing phase. However now that I've completed the app with few recent things that I added, the app is detected as virus (AVG doesn't show what kind of virus). Here are a few changes I did:
Added a registry setting to allow user to start the app at Windows Startup.
Changed the Assembly Name and Assembly Information (Because I wanted to rename the app).
Went into signing settings and clicked on Sign the ClickOnce manifests.
Went into security and clicked this is a full trust application.
The app is just a simple weather application. It reads data from an XML and displays it. I never had a false positive until I did these changes. So what would be the problem here and how do I resolve it?
I added the following settings:
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (startupCheck.Checked) {
rk.SetValue("WeTile", "\"" + Application.ExecutablePath.ToString() + "\"");
} else {
rk.DeleteValue("WeTile", false);
}

Many antivirus programs and Windows itself will complain about new/untrusted applications. Signing with a code signing certificate will improve your "ranking" greatly and allow your program to run, but self-signing via ClickOnce will not help at all.
There are many other posts about trying to get around these filters. You may want to contact antivirus companies such as AVG and see what can be done, and if they can "whitelist" your application. (AVG - Report a false positive) Submitting false detection reports and removing tasks that need full trust (or activities that seem "suspicious" to AV) will help you application run.

Related

Unity Play Games can't authenticate

I have a issue with play games services and unity.
I've done everything by the documentation. I'm a tester, testing is allowed and I've changed the sha1 in api console to the one used by the app. I'm using code from the docs and examples so here is a brief:
PlayGamesClientConfiguration conf = new PlayGamesClientConfiguration.Builder().Build();
PlayGamesPlatform.InitializeInstance(conf);
PlayGamesPlatform.DebugLogEnabled = true;
PlayGamesPlatform.Activate();
Debug.Log("Authenticating...");
Social.localUser.Authenticate((bool success) =>
{
if (success)
{
Debug.Log("Welcome " + Social.localUser.userName);
}
else
{
Debug.Log("Authentication failed.");
}
});
When I build the app in development mode the Play Games popup appears, starts loading and disappears and gives me a Authentication failed message. But when I build the app without the development mode nothing happens and I get the authentication failed message instantly. And yes I'm the correct sha1 key.
Please help me
I did a number of things and finally got it to work. I cannot be sure if they all contributed to solving this issue so here I will list what I did, from greatest to least of my guess of their relevance:
Match the SHA-1 certificates. If you are using an app downloaded from Play Store use the "app signing certificate", else use the upload certificate. These are found in the Play Console under YourApp/Release Management/App Signing. As a note, if you are building from Unity directly to your device, you should make sure that you are building with the same key used to upload to Google Play. More info here
If you are using a custom config and are requesting things such .RequestServerAuthCode(false), you must create an additional Web App. Go to your console project, and under create credentials choose OAuth client ID, and then select Web App.
If using internal testing, make sure to authorize accounts in the Play Console under Game Services/Your App/Testing.
Try disabling Anti-Piracy in the Play Console under Game Services/Your App/Linked Apps/Your App. Only do this if you are testing app outside Google Play. I think if you are logging in using verified test accounts this doesn't matter.
Edit: Publishing Game Services is required even for testing.. at least that seemed to be the case for me to get it working.
Try clearing the cache of your App on your device, I ran into this problem again and this solved it for me.
I finally think I have got it fixed for good.. after nearly a month later. :o Hope this helps.
Google Services can be published/unpublished separately from your app.
Check if they are correctly published doing the following:
Google Play Console
Game services
Select your game
Publishing
Check if Game Services are published.

Forcing ClickOnce application update on Windows Startup?

I have a ClickOnce application that should automatically check for updates before the application starts. If I start the application manually this also works perfectly.
However I have also added a registry entry to start the application at windows startup and in this case the check for an update is not performed and the application starts just as if there would be no update - I guess because by the time the application starts the connection to the network drive on which the ClickOnce application installation is published is not yet established.
As a workaround I tried to manually force the application in my code by calling this after my MainWindow is already loaded:
private void checkforupdate()
{
try
{
ApplicationDeployment ad = ApplicationDeployment.CurrentDeployment;
if (ad.CheckForUpdate())
{
MessageBox.Show("Update available!");
ad.Update();
}
}
catch { }
}
However for some reason this code still only triggers an update when I start the application manually, when it's started automatically on Windows start nothing happens.
The part of my code where I call checkforupdate is after there was already a few things loaded from the very same drive where the ClickOnce installation files are published so the connection must be established by then.
Does anyone know what to do?
Ok, I found out that I was having a severe misunderstanding of how the update of a ClickOnce application works: In the registry entry which starts the program at Windows start-up I referred to the .exe file in the mysterious Users\AppData\Local\Apps\2.0.... folders - while this does work of course for starting the application itself it does not have anything to do with the update functionality itself.
The update only happens when referring to ClickOnce Application reference (.appref-ms) Shortcut on the Desktop.

How to spawn a process that DOES NOT request admin rights on the machine in c#

I seem to be asking the opposite of everyone else. I want to spawn a process and NOT have it request admin rights on the machine.
I have 2 executables:
1) Application
2) Updater
The application periodically checks a web service to see if there are any software updates. If there are, it will spawn the updater .exe and close the current application.
The updater then downloads the files, unpacks and spawns the original process.
Nothing here seems to need admin rights, and yet UAC keeps getting involved.
This is an application that runs on a machine with no keyboard or mouse and I want the update process to run with no user interaction.
Do I have to turn off UAC in order to get this to work, or have I got something enabled that I need to disable?
I think the only other piece to add here is that I'm using ClickOnce to deploy a minimal app initially that will always run the updater and download the latest copy of the program.
I'm using the following lines to spawn the updater or the calling app:
if (System.IO.File.Exists("AppUpdater.exe"))
{
Process.Start(fileName: "AppUpdater.exe", arguments: appId + " " + versionNo + " " + callingApp);
}
if (File.Exists(CallingApp))
{
Process.Start(CallingApp);
}
Thanks
Turns out it was my executable for the updater application that was causing the issue. I had to change some settings in the project properties.
I'm not sure exactly which one was causing the issue because I changed a number of settings to match another application that didn't cause the UAC message to be displayed.
I suspect the main one was the "Icon and Manifest" setting; I changed this to "Embed manifest with default settings".

Run C# app on Startup?

I have created a simple weather application and I added the code below to let the user let it run on Startup:
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (startupCheck.Checked) {
rk.SetValue("WeTile", "\"" + Application.ExecutablePath.ToString() + "\"");
} else {
rk.DeleteValue("WeTile", false);
}
Now this runs fine on both my computers. But when I gave the app to my girlfriend. She said the app does not run on windows start up. I read it online that it could be because of the user permission or the location so I told her to move the app to c:/ and try checking the box again and then restarting. Now it works but on every startup she has the default windows message saying you want to run this app?
How do I get rid of this? What is the best way to add to windows startup that works with both windows 32/64 bit without any user permission disruptions?
It sounds like you may have run afoul of Windows' file blocking security function. Applications created on another computer are automatically blocked from executing unless the user specifically "unblocks" the file. Have your girlfriend right-click on the executable, select "Properties" and see if there is a button at the bottom of the dialog to unblock the file.
Once unblocked, you should no longer see the confirmation prompt at startup.
You could add it to the Windows startup folder, check if it's not there already and if not, add it (assuming this is what the user wants).
See How do I set a program to launch at startup

Disable "The publisher could not be verified" while tarting .NET console app from share folder

I am trying to run a .NET console app from a shared network folder using method Process.Start.
Everytime the console app starts I get the message "The publisher could not be verified" and Windows asks for user confirmation. How can I disable this dialog? I do not want to buy a digital certificate.
within your .net application when you use "Process.Start"
use the feature Process.StartInfo.UseShellExecute = false.
so ...
Process proc = new Process();
proc.StartInfo.UseShellExecute = false;
what this does is it allows you to launch EXES (and only exes) directly without using the Explorer(shell).
This will bypass any IE Security Zone checks. The Explorer by default includes the IEZone check and thus will
give you a security warning if the application you are running is not 'trusted' (specifically in a trusted zone).
Now you cannot use 'false' if you want to launch a 'PDF' for example. This only works for Exes.
Last bit of information:
http://technet.microsoft.com/en-us/library/bb457006.aspx
http://technet.microsoft.com/en-us/library/dd349795(WS.10).aspx
these bits of info, which a MS rep just provided me, may provide a way to trust the publisher of a signed application by using Software Restriction Policies. I haven't looked into this yet, but for those that need to continue with this further... this looks like another way to address part (1) .

Categories