ETHER: Fix incompatible ptr type and relocate _eth_get_system_id for Cygwin
Compilation under Cygwin with gcc 5.3.0 - missing const gave rise to incompatible pointer type warning, and _eth_get_system_id for _WIN32 was included under a conditional for either _WIN32 or __CYGWIN__ and later redefined for !_WIN32
This commit is contained in:
parent
8d7e8f4d30
commit
d9f3743783
1 changed files with 26 additions and 24 deletions
50
sim_ether.c
50
sim_ether.c
|
@ -1392,7 +1392,7 @@ static int pcap_mac_if_win32(const char *AdapterName, unsigned char MACAddress[6
|
||||||
p_PacketRequest = (int (*)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData))GetProcAddress(hDll, "PacketRequest");
|
p_PacketRequest = (int (*)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData))GetProcAddress(hDll, "PacketRequest");
|
||||||
#else
|
#else
|
||||||
hDll = dlopen("packet.dll", RTLD_NOW);
|
hDll = dlopen("packet.dll", RTLD_NOW);
|
||||||
p_PacketOpenAdapter = (LPADAPTER (*)(char *AdapterName))dlsym(hDll, "PacketOpenAdapter");
|
p_PacketOpenAdapter = (LPADAPTER (*)(const char *AdapterName))dlsym(hDll, "PacketOpenAdapter");
|
||||||
p_PacketCloseAdapter = (void (*)(LPADAPTER lpAdapter))dlsym(hDll, "PacketCloseAdapter");
|
p_PacketCloseAdapter = (void (*)(LPADAPTER lpAdapter))dlsym(hDll, "PacketCloseAdapter");
|
||||||
p_PacketRequest = (int (*)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData))dlsym(hDll, "PacketRequest");
|
p_PacketRequest = (int (*)(LPADAPTER AdapterObject,BOOLEAN Set,PPACKET_OID_DATA OidData))dlsym(hDll, "PacketRequest");
|
||||||
#endif
|
#endif
|
||||||
|
@ -1447,28 +1447,6 @@ static int pcap_mac_if_win32(const char *AdapterName, unsigned char MACAddress[6
|
||||||
return ReturnValue;
|
return ReturnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _eth_get_system_id (char *buf, size_t buf_size)
|
|
||||||
{
|
|
||||||
LONG status;
|
|
||||||
DWORD reglen, regtype;
|
|
||||||
HKEY reghnd;
|
|
||||||
|
|
||||||
memset (buf, 0, buf_size);
|
|
||||||
if ((status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY, ®hnd)) != ERROR_SUCCESS)
|
|
||||||
return -1;
|
|
||||||
reglen = buf_size;
|
|
||||||
if ((status = RegQueryValueExA (reghnd, "MachineGuid", NULL, ®type, buf, ®len)) != ERROR_SUCCESS) {
|
|
||||||
RegCloseKey (reghnd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
RegCloseKey (reghnd );
|
|
||||||
/* make sure value is the right type, bail if not acceptable */
|
|
||||||
if ((regtype != REG_SZ) || (reglen > buf_size))
|
|
||||||
return -1;
|
|
||||||
/* registry value seems OK */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* defined(_WIN32) || defined(__CYGWIN__) */
|
#endif /* defined(_WIN32) || defined(__CYGWIN__) */
|
||||||
|
|
||||||
#if defined (__VMS) && !defined(__VAX)
|
#if defined (__VMS) && !defined(__VAX)
|
||||||
|
@ -1636,7 +1614,31 @@ if (gethostuuid (uuid, &wait))
|
||||||
uuid_unparse_lower(uuid, buf);
|
uuid_unparse_lower(uuid, buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#elif !defined(_WIN32)
|
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
static int _eth_get_system_id (char *buf, size_t buf_size)
|
||||||
|
{
|
||||||
|
LONG status;
|
||||||
|
DWORD reglen, regtype;
|
||||||
|
HKEY reghnd;
|
||||||
|
|
||||||
|
memset (buf, 0, buf_size);
|
||||||
|
if ((status = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Cryptography", 0, KEY_QUERY_VALUE|KEY_WOW64_64KEY, ®hnd)) != ERROR_SUCCESS)
|
||||||
|
return -1;
|
||||||
|
reglen = buf_size;
|
||||||
|
if ((status = RegQueryValueExA (reghnd, "MachineGuid", NULL, ®type, buf, ®len)) != ERROR_SUCCESS) {
|
||||||
|
RegCloseKey (reghnd);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
RegCloseKey (reghnd );
|
||||||
|
/* make sure value is the right type, bail if not acceptable */
|
||||||
|
if ((regtype != REG_SZ) || (reglen > buf_size))
|
||||||
|
return -1;
|
||||||
|
/* registry value seems OK */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
static int _eth_get_system_id (char *buf, size_t buf_size)
|
static int _eth_get_system_id (char *buf, size_t buf_size)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
Loading…
Add table
Reference in a new issue