Page 1 of 1
MAC Address
Posted: Mon May 10, 2004 7:19 pm
by Palpatine
HI,
Is there a way to find out the mac address of the machine the app is running on?
Cheers,
Ron
Posted: Mon May 10, 2004 8:10 pm
by Flype
the easiest way is to use the userlib SRGetInfo
get it here :
http://www.purearea.net/pb/download/use ... ETINFO.zip
there are this commands in it :
SRGETCPUVendor
SRGETComputerName
SRGETDriveSerial
SRGETFolder
SRGETMACID <-------------
SRGETOnlinestatus
SRGETUsername
SRGetDriveFormat
SRGetDriveName
Posted: Mon May 10, 2004 8:28 pm
by Rings
arg did not work with 3.91, so an update is needed (if anyone wants a )
Posted: Mon May 10, 2004 8:32 pm
by Palpatine
Rings wrote:arg did not work with 3.91
Just found that out to :-/
Cheers,
Ron
Posted: Mon May 10, 2004 10:21 pm
by blueznl
i do... or the names of the winapi's you used

Posted: Tue May 11, 2004 9:03 pm
by Rings
Posted: Tue May 11, 2004 9:09 pm
by Shannara
Does this return the real HD serial number or the changable volume number?
Posted: Thu May 13, 2004 8:05 pm
by TerryHough
Hmm... downloaded the new version, but I still don't get the Mac Address reported. Maybe it really isn't available on my Win98SE system to this function?
Posted: Fri May 14, 2004 1:52 pm
by Rings
sorry, i don't support any win89 OS.
But for all, i will release the source to this lib so anyone can take that what he need .
Posted: Fri May 14, 2004 8:22 pm
by ABBKlaus
Try this one : (Tested under WinXP Pro / Win 2000 / Win98*)
* = tested by user
Code: Select all
; ABBKlaus Mon May 17, 2004 20:16
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp
; with the help of IPHlpAPI.inc from the Powerbasic include-file for the structures
; Microsoft isn´t quite a help here :-)
; modified by PSW Wed Sep 06, 2006 07:49
; PB4.02 compatible since 29.05.2007 19:48
DHCPServerEnabled.s
Structure IP_ADDR_STRING
pNext.l
IpAddress.b[16]
IpMask.b[16]
Context.l
EndStructure
Structure IP_ADAPTER_INFO
Next.l
ComboIndex.l
AdapterName.b[260] ; MAX_ADAPTER_NAME_LENGTH + 4
Description.b[132] ; MAX_ADAPTER_DESCRIPTION_LENGTH + 4
AdressLength.l
Address.b[8] ; MAX_ADAPTER_ADDRESS_LENGTH
Index.l
Type.l
DhcpEnabled.l
CurrentIpAddressPTR.l
IpAddressList.IP_ADDR_STRING
GatewayList.IP_ADDR_STRING
DhcpServer.IP_ADDR_STRING
HaveWins.l
PrimaryWinsServer.IP_ADDR_STRING
SecondaryWinsServer.IP_ADDR_STRING
LeaseObtained.l
LeaseExpires.l
EndStructure
length.l=0
Result=GetAdaptersInfo_(0,@length) ; Get the length for Buffer
If Result=#ERROR_BUFFER_OVERFLOW
*Buffer=AllocateMemory(length)
Result=GetAdaptersInfo_(*Buffer,@length)
If Result=#ERROR_SUCCESS
adapters=length/SizeOf(IP_ADAPTER_INFO)
For x=0 To adapters-1
Debug "AdapterNr : "+Str(x+1)
tempipinfo.IP_ADAPTER_INFO
For i=0 To SizeOf(IP_ADAPTER_INFO)-1
byte.b=PeekB(*Buffer+(x*640)+i)
PokeB(tempipinfo+i,byte)
Next
Debug "Adapter : "+PeekS(@tempipinfo\Description,-1,#PB_Ascii)
Debug "IP-Adress : "+PeekS(@tempipinfo\IpAddressList+4,-1,#PB_Ascii)
Debug "Gateway : "+PeekS(@tempipinfo\GatewayList+4,-1,#PB_Ascii)
Debug "P-Wins : "+PeekS(@tempipinfo\PrimaryWinsServer+4,-1,#PB_Ascii)
Debug "S-Wins : "+PeekS(@tempipinfo\SecondaryWinsServer+4,-1,#PB_Ascii)
;Debug "DHCP-Server : "+PeekS(@tempipinfo\DhcpServer+4)
If PeekS(@tempipinfo\DhcpServer+4,-1,#PB_Ascii) = "255.255.255.255"
Debug "STATIC IP Configuration"
Else
Debug "DHCP Server Adress : " +PeekS(@tempipinfo\DhcpServer+4,-1,#PB_Ascii)
EndIf
mac$=""
For i=0 To 5
byte.b=PeekB(@tempipinfo\Address+i)
If byte>=0
mac$+RSet(Hex(byte),2,"0")
Else
mac$+RSet(Hex(byte+256),2,"0")
EndIf
If i<5
mac$+":"
EndIf
Next
Debug "MAC-Address "+mac$
Next
Else
Debug "Error : "+Str(Result)
EndIf
EndIf
;----- Sample dump------------------------------------------------------------------
;AdapterNr : 1
;Adapter : ELSA Airlancer MC11 High Rate Wireless LAN PC Card - Paketplaner-Miniport
;IP-Adress : 192.168.1.115
;Gateway : 192.168.1.1
;MAC-Address 00:02:2D:3C:2E:73
;AdapterNr : 2
;Adapter : Realtek RTL8139-Familie-PCI-Fast Ethernet-NIC - Paketplaner-Miniport
;IP-Adress : 0.0.0.0
;Gateway :
;MAC-Address 00:30:54:00:40:63
Posted: Mon May 17, 2004 4:25 pm
by TerryHough
Thanks, it also works on my Win98SE successfully.
..
Posted: Mon May 17, 2004 5:45 pm
by NoahPhense
ABBKlaus wrote:Try this one : (Tested under WinXP Pro)
Code: Select all
; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/getadaptersinfo.asp
; with the help of IPHlpAPI.inc from the Powerbasic include-file for the structures...
That kicks as$, I need that for my machine dependant encryption algorithm..
boyaa, thx!
- np