Implemented -A flag for Windows (#665)

TODO:  Need to update some documentation that reflects `-A` is applicable to Windows.  @bmah888 to do this.
diff --git a/configure b/configure
index 045006c..4f5d1f2 100755
--- a/configure
+++ b/configure
@@ -13002,7 +13002,7 @@
 # FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity.
 # Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a
 # generic concept is available.
-for ac_func in cpuset_setaffinity sched_setaffinity
+for ac_func in cpuset_setaffinity sched_setaffinity SetProcessAffinityMask
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
diff --git a/configure.ac b/configure.ac
index 936ff39..128fa1a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,7 +153,7 @@
 # FreeBSD uses cpuset_setaffinity while Linux uses sched_setaffinity.
 # Define HAVE_CPU_AFFINITY to indicate the CPU affinity setting as a
 # generic concept is available.
-AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity],
+AC_CHECK_FUNCS([cpuset_setaffinity sched_setaffinity SetProcessAffinityMask],
 	       AC_DEFINE([HAVE_CPU_AFFINITY], [1], 
 	 	         [Have CPU affinity support.]))
 
diff --git a/src/iperf_api.c b/src/iperf_api.c
index 722af37..b3d8acd 100755
--- a/src/iperf_api.c
+++ b/src/iperf_api.c
@@ -62,6 +62,10 @@
 #include <sys/cpuset.h>
 #endif /* HAVE_CPUSET_SETAFFINITY */
 
+#if defined(HAVE_SETPROCESSAFFINITYMASK)
+#include <Windows.h>
+#endif /* HAVE_SETPROCESSAFFINITYMASK */
+
 #include "net.h"
 #include "iperf.h"
 #include "iperf_api.h"
@@ -3576,6 +3580,15 @@
         return -1;
     }
     return 0;
+#elif defined(HAVE_SETPROCESSAFFINITYMASK)
+	HANDLE process = GetCurrentProcess();
+	DWORD_PTR processAffinityMask = 1 << affinity;
+
+	if (SetProcessAffinityMask(process, processAffinityMask) == 0) {
+		i_errno = IEAFFINITY;
+		return -1;
+	}
+	return 0;
 #else /* neither HAVE_SCHED_SETAFFINITY nor HAVE_CPUSET_SETAFFINITY */
     i_errno = IEAFFINITY;
     return -1;
@@ -3604,6 +3617,17 @@
         return -1;
     }
     return 0;
+#elif defined(HAVE_SETPROCESSAFFINITYMASK)
+	HANDLE process = GetCurrentProcess();
+	DWORD_PTR processAffinityMask;
+	DWORD_PTR lpSystemAffinityMask;
+
+	if (GetProcessAffinityMask(process, &processAffinityMask, &lpSystemAffinityMask) == 0
+			|| SetProcessAffinityMask(process, lpSystemAffinityMask) == 0) {
+		i_errno = IEAFFINITY;
+		return -1;
+	}
+	return 0;
 #else /* neither HAVE_SCHED_SETAFFINITY nor HAVE_CPUSET_SETAFFINITY */
     i_errno = IEAFFINITY;
     return -1;
diff --git a/src/iperf_config.h.in b/src/iperf_config.h.in
index 438d672..2d13f98 100644
--- a/src/iperf_config.h.in
+++ b/src/iperf_config.h.in
@@ -42,6 +42,9 @@
 /* Define to 1 if you have the `sendfile' function. */
 #undef HAVE_SENDFILE
 
+/* Define to 1 if you have the `SetProcessAffinityMask' function. */
+#undef HAVE_SETPROCESSAFFINITYMASK
+
 /* Have SO_MAX_PACING_RATE sockopt. */
 #undef HAVE_SO_MAX_PACING_RATE