Llevo tiempo persiguiendo desarrollar al completo la función GetAdaptersInfo y con DLL32 me da como resultado nil y con #PRAGMA me da 0 pero no me funciona en ambos casos.
Código con DLL32:
- Code: Select all Expand view
- DLL32 FUNCTION GetAdaptersInfo( lpAdapterInfo AS LPSTR, BufLen AS LONG ) AS LONG PASCAL FROM "GetAdaptersInfoA" LIB "IPHlpApi.dll"
Código en C con #pragma:
- Code: Select all Expand view
- #pragma BEGINDUMP
#include <windows.h>
#include <Iphlpapi.h>
HB_FUNC( GETADAPTERSINFO )
{
LPCTSTR lpAdapterInfo = ( LPCTSTR ) hb_parc( 1 ) ;
LPDWORD dwBufLen = ( LPDWORD ) hb_parni( 2 ) ;
DWORD dwError = 0 ;
dwError = GetAdaptersInfo(&lpAdapterInfo,&dwBufLen) ;
hb_retni( dwError ) ;
}
#pragma ENDDUMP
La definición del MSDN es esta: https://msdn.microsoft.com/en-us/librar ... 17(v=vs.85).aspx
Además también estoy con la pelea de definir las estructuras de datos:
- Code: Select all Expand view
- STRUCT IP_ADDR_STRING
MEMBER Next As LONG
MEMBER IpAddress As STRING LEN 16
MEMBER IpMask As STRING LEN 16
MEMBER Context As LONG
ENDSTRUCT
STRUCT IP_ADAPTER_INFO
MEMBER Next AS LONG
MEMBER ComboIndex AS LONG
MEMBER AdapterName AS STRING LEN MAX_ADAPTER_NAME_LENGTH
MEMBER Description AS STRING LEN MAX_ADAPTER_DESCRIPTION_LENGTH
MEMBER AddressLength AS LONG
MEMBER Address AS STRING LEN MAX_ADAPTER_ADDRESS_LENGTH // -1 // (MAX_ADAPTER_ADDRESS_LENGTH - 1) AS Byte
MEMBER Index AS LONG
MEMBER Type AS LONG
MEMBER DhcpEnabled AS LONG
MEMBER CurrentIpAddress AS LONG
MEMBER IpAddressList AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER GatewayList AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER DhcpServer AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER HaveWins AS LONG // BYTE // Boolean
MEMBER PrimaryWinsServer AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER SecondaryWinsServer AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER LeaseObtained AS LONG
MEMBER LeaseExpires AS LONG
ENDSTRUCT
STRUCT FIXED_INFO
MEMBER HostName AS STRING LEN MAX_HOSTNAME_LEN
MEMBER DomainName AS STRING LEN MAX_DOMAIN_NAME_LEN
MEMBER CurrentDnsServer AS LONG
MEMBER DnsServerList AS STRING LEN IP_ADDR_STRING:SizeOf() // IP_ADDR_STRING
MEMBER NodeType AS LONG
MEMBER ScopeId AS STRING LEN MAX_SCOPE_ID_LEN
MEMBER EnableRouting AS LONG
MEMBER EnableProxy AS LONG
MEMBER EnableDns AS LONG
ENDSTRUCT
Las estructuras según el MSDN son:
IP_ADDR_STRING https://msdn.microsoft.com/en-us/librar ... 68(v=vs.85).aspx
IP_ADAPTER_INFO https://msdn.microsoft.com/es-es/librar ... 62(v=vs.85).aspx
FIXED_INFO https://msdn.microsoft.com/en-us/librar ... 00(v=vs.85).aspx
En fin... ¿alguna ayuda?