Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added lame XP feature detection to avoid calling unavailable API

  • Loading branch information...
commit bc305f2167e2f1478d3ee37f6e6e4e36142270c8 1 parent e5f3433
@anurse authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 git-credential-winstore/Program.cs
View
14 git-credential-winstore/Program.cs
@@ -124,7 +124,12 @@ private static void InstallTheApp()
string target = GetTargetName(url);
if (!NativeMethods.CredRead(target, NativeMethods.CRED_TYPE.GENERIC, 0, out credPtr))
{
- // Don't have a credential for this user.
+ // Don't have a credential for this user. Are we on XP? If so, sorry no dice.
+ if (OnXP())
+ {
+ // Users will get a Git prompt for user name and password. We'll still store them.
+ yield break;
+ }
credPtr = IntPtr.Zero;
// If we have a username, pack an input authentication buffer
@@ -207,6 +212,13 @@ private static void InstallTheApp()
}
}
+ private static bool OnXP()
+ {
+ // I know, version detection a Bad Thing(TM). But "feature detection" is supposed to be done
+ // via checking DLL exports, which is gross in C#...
+ return Environment.OSVersion.Version.Major == 5;
+ }
+
private static bool UnPackAuthBuffer(IntPtr buffer, int size, out string userName, out string password)
{
userName = String.Empty;
Please sign in to comment.
Something went wrong with that request. Please try again.