From 85d97f05f6f8e4c1d73cd2bb096806839d16f3b0 Mon Sep 17 00:00:00 2001
From: gcontini <1121667+gcontini@users.noreply.github.com>
Date: 周六, 31 10月 2020 10:27:16 +0800
Subject: [PATCH] Pc identifier Mac address issues #108 & #107

---
 src/library/os/network.hpp |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/library/os/network.hpp b/src/library/os/network.hpp
index 6ba1611..4dbc9aa 100644
--- a/src/library/os/network.hpp
+++ b/src/library/os/network.hpp
@@ -10,6 +10,18 @@
 #include <stdlib.h>
 #include <vector>
 
+#ifdef __unix__
+#include <netdb.h>
+#define LCC_ADAPTER_DESCRIPTION_LEN NI_MAXHOST
+#else
+//mingw cross compile for Windows
+#ifdef _MSC_VER
+#include <Windows.h>
+#endif
+#include <iphlpapi.h>
+#define LCC_ADAPTER_DESCRIPTION_LEN MAX_ADAPTER_DESCRIPTION_LENGTH
+#endif
+
 #include "../base/base.h"
 
 namespace license {
@@ -17,10 +29,11 @@
 
 typedef enum { IFACE_TYPE_ETHERNET, IFACE_TYPE_WIRELESS } IFACE_TYPE;
 
+
 typedef struct {
 	int id;
-	char description[1024];
-	unsigned char mac_address[8];
+	char description[LCC_ADAPTER_DESCRIPTION_LEN + 1];
+	unsigned char mac_address[6];
 	unsigned char ipv4_address[4];
 	IFACE_TYPE type;
 } OsAdapterInfo;

--
Gitblit v1.9.1