function for getting information on NIC mac adress

791 views
Skip to first unread message

Domenico D'Oria

unread,
Nov 7, 2013, 10:09:47 AM11/7/13
to harbou...@googlegroups.com
hi all
first of all, i'm not a C or C++ expert.

i develop for many years in Clipper and from about three years i develop with Harbour, in Windows O.S.

in Clipper i have found and use a function to read mac adress of the ethernet port on the pc.

i have look on Harbour source, but probably not until the end of the source code

is there a function to read NIC mac adress/es of the pc ?

i found something in internet in the Xharbour forum and they use HB_FUN( getmacadress ) plus a C piece of code

is it possible to replicate this code, or i need aldo a library

any help will be appreciated

regards

Domenico

Qatan

unread,
Nov 7, 2013, 10:39:02 AM11/7/13
to harbou...@googlegroups.com
I do not know if it helps but look this link: http://forums.fivetechsupport.com/viewtopic.php?f=4&t=14566
 
Qatan

Evangelos Tsakalidis

unread,
Nov 7, 2013, 3:25:32 PM11/7/13
to harbou...@googlegroups.com
Hello Domenico.

I have this sample :

*-----------------------------
PROCEDURE Main
*-----------------------------
getMacAddress()
RETURN

*-----------------------------
FUNCTION getMacAddress()
*-----------------------------
Local oWmi := WmiService(), oAdapter, ii := 0 

for each oAdapter in oWmi:ExecQuery("Select * from Win32_NetworkAdapter where physicaladapter=true") 
if !empty(oAdapter:MACAddress)
++ii
? str(ii,2,0)+ '. ' + ' Interface : ' + oAdapter:description
? space(4)          + 'MACAddress : ' + oAdapter:MACAddress
?
endif
next

oWMI := Nil
Return Nil 

*-----------------------------
FUNCTION WMIService()
*-----------------------------
local oWMI, oLocator

oLocator   := win_oleCreateObject( "wbemScripting.SwbemLocator" )
oWMI       := oLocator:ConnectServer()

Return oWMI

Please complile with -lhbwin (hbwin library).

Evangelos


2013/11/7 Qatan <wanst...@gmail.com>
I do not know if it helps but look this link: http://forums.fivetechsupport.com/viewtopic.php?f=4&t=14566
 
Qatan

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Klas Engwall

unread,
Nov 7, 2013, 4:02:42 PM11/7/13
to harbou...@googlegroups.com
Hi Domenico,
I just did a copy/paste of the code Luiz posted in comp.lang.xharbour
in this thread:
https://groups.google.com/forum/#!msg/comp.lang.xharbour/XEtiPXWdeJE/vI8iegqeeYwJ

Just put it in a file called macaddress.c and include that file plus the
iphlpapi lib (-liphlpapi in the hbp file) in your project. It will work
but you will get a few compiletime warnings.

Watch out for wrapping comments in the c.l.x newsgroup message!

Regards,
Klas

Qatan

unread,
Nov 7, 2013, 4:14:21 PM11/7/13
to harbou...@googlegroups.com
Hello Evangelos,
 
Works very well in Win 7 Pro 32bit
This will only work in Windows, right?
Is there anyway to get the same in Linux?
Thanks for sharing.
 
Qatan
 

Evangelos Tsakalidis

unread,
Nov 7, 2013, 4:40:03 PM11/7/13
to harbou...@googlegroups.com
Hello Qatan.

This solution is only for Windows.
I do not know nothing about Linux. Sory for that.

PS : I wish to express my heartfelt thanks for your effort and result in Qalculator.

Evangelos



2013/11/7 Qatan <wanst...@gmail.com>

--

Qatan

unread,
Nov 7, 2013, 6:27:52 PM11/7/13
to harbou...@googlegroups.com
Hello Evangelos,
 
Thanks for the information
 
>...
>PS : I wish to express my heartfelt thanks for your effort and result in Qalculator.
 
I am glad you like it. The main goal was to have a calculator that works as you would expect based on a simple pocket calculator and/or Windows™ Calc.
I hope it will serve to help others to develop nicer programs based on that type of interface WVT, XWC, etc....
For me it is a nice learning.
Regards,
 
Qatan
 

elch

unread,
Nov 7, 2013, 6:36:06 PM11/7/13
to harbou...@googlegroups.com
Hi,

thanks Klas, will try it for Windows.
Seem a good replace for my grep in the result of: ipconfig.exe ;-)

--

Is there anyway to get the same in Linux?

for Linux!, harbour can do:

HB_INETIFINFO()[nNic][8]


ẃhere:

nNic is number of NIC interface.

As we have in Linux as first interface often this virtual 'loopback', try '2'.

Build around a check for len of returned 2dim array.

And this '8' stands for HB_SOCKET_IFINFO_HWADDR


may look changelog for info about other elements...


best regards

Rolf

Klas Engwall

unread,
Nov 7, 2013, 8:07:59 PM11/7/13
to harbou...@googlegroups.com
Hi Rolf,

> thanks Klas, will try it for Windows.
> Seem a good replace for my grep in the result of: ipconfig.exe ;-)
>
>> Is there anyway to get the same in Linux?
>
> for Linux!, harbour can do:
> HB_INETIFINFO()[nNic][8]
>
> ẃhere:
> nNic is number of NIC interface.
> As we have in Linux as first interface often this virtual 'loopback',
> try '2'.
> Build around a check for len of returned 2dim array.
> And this '8' stands for HB_SOCKET_IFINFO_HWADDR

In Windows the MAC addresses are also listed in the registry in the MAC
key of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Genuine Advantage

In the computer I am on right now that key lists three MAC addresses:
1) Marvell Yukon NIC chip on the motherboard
2) D-Link NIC in a PCI slot
3) Hamachi virtual NIC

But Luiz' function lists:
1) TAP-Windows Adapter
2) The D-Link
3) The Marvell Yukon
4) PPP-Card
5) Hamachi

And ipconfig lists:
1) The D-Link
2) The Marvell Yukon
3) TAP-Windows Adapter
4) Hamachi
5) PPP-Card

hb_InetIfInfo() reports NIL in the [nNic][8] element. I have no idea if
that is expected or not in Windows. And it only reports four NICs: The
D-Link, Unknown, Hamachi, PPP-Card (deducted from the reported IP addresses)

I wonder why the results vary so much ...

Regards,
Klas

Sumiran Theo

unread,
Jan 5, 2014, 1:25:12 AM1/5/14
to harbou...@googlegroups.com
Hello Domenico,
I had same problem with you, I need to get NIC Mac address on the PC. I had used what Evangelos write with function GetMacAddress(), and it runs on my notebook (with win 7 os), but this function get empty string on many PC (runs with os win7 or win xp).

Does any one can help. Thanks.

Regard,

Sumiran

Bernard Mouille

unread,
Jan 10, 2014, 2:29:07 PM1/10/14
to harbou...@googlegroups.com
Hello Sumiran and Domenico,

I do not knows if my code works on all computers, but you can take some idea.

Good devloppement,

Bernard

// Begin code

* Test.prg - Programme de test.
* -----------------------------
*
/*
# Test.hbp - Compilation de Test.EXE.
# -----------------------------------
#
# Nom du programme avec éventuellement son chemin.
#
-oTEST.EXE
#
# Affiche tous les warnings.
#
-w3
#
# Ne fabrique pas l'exe si warning.
#
-es2
#
# Programme maître.
#
TEST.PRG
#
# Librairies : respecter l'ordre.
#
hbwin.lib
Iphlpapi.lib
*/
*
* --------------
PROCEDURE Main
* --------------
*
SET DATE FRENCH                                      && Date en français.
SET CENTURY ON                                       && Année de la date en 4 chiffre.
SET EPOCH TO 1970                                    && Pour année à 2 chiffres.
*
* Mise en ANSI ( Windows ) langue française.
*
REQUEST HB_LANG_FR
REQUEST HB_CODEPAGE_FRWIN
HB_CDPSELECT( 'FRWIN' )
HB_LANGSELECT( 'FR' )
*
SETMODE( 43, 80 )                                     && Lignes et colonnes d'affichage écran.
*
? "Début du programme."
?
? "Mon adresse MAC : " + GetIpAddressConnected()
?
? "Fin du programme."
?
?
WAIT
*
RETURN
*
* ------------------------------
FUNCTION GetIpAddressConnected
* ------------------------------
*
LOCAL Aarray := GetIpAddressConnectedC()
LOCAL I      := 1
LOCAL Retour := ""
*
DO WHILE I < LEN( Aarray )
 IF .NOT. EMPTY( Aarray[ I + 1 ] )
  Retour := Aarray[ I ]
  EXIT
 ENDIF
 I := I + 2
ENDDO
*
Aarray := NIL
*
RETURN Retour
*
* -----------------------
* Fonction en language C
* -----------------------
*
/*
Author luiz Rafael Culik Guimaraes modified by Bernard Mouille.
*/
*
#pragma BEGINDUMP
#include <Windows.h>
#include <Iphlpapi.h>
#include <Assert.h>
#include "hbapi.h"
#include "hbapiitm.h"
HB_FUNC(GETIPADDRESSCONNECTEDC)
{
IP_ADAPTER_INFO AdapterInfo[16];                      // Allocate information for up to 16 NICs
DWORD dwBufLen = sizeof(AdapterInfo);                 // Save the memory size of buffer
char ret[ 20 ] ={0};
PHB_ITEM pArray;
PHB_ITEM pItem;
DWORD dwStatus = GetAdaptersInfo(                     // Call GetAdapterInfo
                                  AdapterInfo,        // [out] buffer to receive data
                                  &dwBufLen);         // [in] size of receive data buffer
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;          // Contains pointer to current adapter info
pArray = hb_itemNew( NULL );
hb_arrayNew( pArray, 0 );
assert( dwStatus == ERROR_SUCCESS );                  // Verify return value is valid, no buffer overflow
 do
 {
 // Adresse Mac
 sprintf( ret, "%02X-%02X-%02X-%02X-%02X-%02X"
             , pAdapterInfo->Address[0]
             , pAdapterInfo->Address[1]
             , pAdapterInfo->Address[2]
             , pAdapterInfo->Address[3]
             , pAdapterInfo->Address[4]
             , pAdapterInfo->Address[5] );
 pItem = hb_itemPutC( NULL, ( char * ) ret );
 hb_arrayAddForward( pArray, pItem );
 hb_itemRelease( pItem ) ;

 // Adresse IP du serveur dhcp.
 sprintf( ret,"%s", pAdapterInfo->DhcpServer.IpAddress.String );
 pItem = hb_itemPutC( NULL, ( char * ) ret );
 hb_arrayAddForward( pArray, pItem );
 hb_itemRelease( pItem ) ;

 pAdapterInfo = pAdapterInfo->Next;     // Progress through linked list
 }
 while( pAdapterInfo );                 // Terminate if last adapter
hb_itemReturnForward( pArray );         // Retour de la fonction.
hb_itemRelease( pArray );               // Libère la mémoire.
}
#pragma ENDDUMP

// End code

Bernard Mouille

unread,
Jan 11, 2014, 1:50:55 AM1/11/14
to harbou...@googlegroups.com
Sorry, I do a mistake :

Name GetMacAddressConnected() and not GetIpAddressConnected()

Bernard

smr

unread,
Jan 11, 2014, 9:17:41 AM1/11/14
to harbou...@googlegroups.com

Hi Bernard,

Thanks for your reply.

 

In my old Clipper application, I had used pppclp.lib to get Bios information or such hardware information. But when I move to Harbour few month ago, I cannot find similar function. I tried to replace that function with the idea of getting the NIC Mac adress information, and after I search the topic in groups, I found that topic Domenico ever asked, and Evangelos had ever post some idea of using win api (compile with hbmk2 and library hbwin), and when I used it in my notebook (with os win7), it runs well. But in some others computer, I dont know why it can’t work (display nothing for their NIC card).

 

I will try and get some idea of this. It means I had to compile hbmk2 and what library I had to include? Maybe hbwin only? Or I had to compile with other library in harbour? Now I am using only hbct and hbwin

 

Thank you very much in advance.

 

Sincerely

 

Sumiran

--

Bernard Mouille

unread,
Jan 11, 2014, 10:48:29 AM1/11/14
to harbou...@googlegroups.com, s...@medan.indo.net.id

Hi Sumiran,

 

For the bios, you can try the Win32_BIOS WMI class

http://msdn.microsoft.com/en-us/library/windows/desktop/aa394077(v=vs.85).aspx

 

If you want, I have a little tool for WMI and Harbour, but I am very busy this week.

 

“Cordialement”.

 

Bernard

s...@medan.indo.net.id

unread,
Jan 11, 2014, 12:27:36 PM1/11/14
to Bernard Mouille, harbou...@googlegroups.com
Dear Bernard,
Yes, I'm very grateful if you can send the tool, when you have time. Maybe this can solve my problem. Thank you very much.

Regards,

Sumiran
Powered by Telkomsel BlackBerry®

From: Bernard Mouille <bernard...@wanadoo.fr>
Date: Sat, 11 Jan 2014 07:48:29 -0800 (PST)
Subject: Re: [harbour-users] Re: function for getting information on NIC mac adress

Bernard Mouille

unread,
Jan 11, 2014, 12:32:22 PM1/11/14
to harbou...@googlegroups.com, Bernard Mouille, s...@medan.indo.net.id

For the olds systems, it is possible to download :

  • vbscript

  • wmi service.

     

    I must to search in my archives to look if I have always this tools.

     

    Bernard

Bernard Mouille

unread,
Jan 14, 2014, 7:55:04 AM1/14/14
to harbou...@googlegroups.com

Bernard Mouille

unread,
Jan 14, 2014, 7:56:11 AM1/14/14
to harbou...@googlegroups.com, Bernard Mouille, s...@medan.indo.net.id

Hello Sumiran,

You can look the code below my signature.

Regards,

Bernard.


// Begin code

* Test.prg - Programme de test.
* -----------------------------
*
* En cours de développement.
* Harbour 3.0.0 - Windows 8.1 pro 64, 7 pro 32, XP pro III
* Ce programme est un exemple basique.
*

/*

http://msdn.microsoft.com/en-us/library/windows/desktop/aa394077(v=vs.85).aspx

Apparemment, Microsoft n'a pas mis à jour cette classe depuis Windows 2000.

Pour les anciens Windows ( NT ), il faut éventuellement installer les programmes
suivant en fonction du système ( choisir la langue ) :

- scd56fr.exe
- scr56fr.exe
- scriptfr.exe
  http://www.microsoft.com/fr-fr/download/details.aspx?id=1406

- wmint4.exe
  http://www.microsoft.com/en-us/download/details.aspx?id=24045

class Win32_BIOS : CIM_BIOSElement
{
  uint16   BiosCharacteristics[];
  string   BIOSVersion[];
  string   BuildNumber;
  string   Caption;
  string   CodeSet;
  string   CurrentLanguage;
  string   Description;
  string   IdentificationCode;
  uint16   InstallableLanguages;
  datetime InstallDate;
  string   LanguageEdition;
  String   ListOfLanguages[];
  string   Manufacturer;
  string   Name;
  string   OtherTargetOS;
  boolean  PrimaryBIOS;
  datetime ReleaseDate;
  string   SerialNumber;
  string   SMBIOSBIOSVersion;
  uint16   SMBIOSMajorVersion;
  uint16   SMBIOSMinorVersion;
  boolean  SMBIOSPresent;
  string   SoftwareElementID;
  uint16   SoftwareElementState;
  string   Status;
  uint16   TargetOperatingSystem;
  string   Version;
};


*/

*
* --------------
PROCEDURE Main
* --------------
*
LOCAL oLocator
LOCAL oWMI
LOCAL Items
LOCAL Item
*
LOCAL I := 0
LOCAL J

*
SET DATE FRENCH                                      && Date en français.
SET CENTURY ON                                       && Année de la date en 4 chiffre.
SET EPOCH TO 1970                                    && Pour année à 2 chiffres.
*
* Mise en ANSI ( Windows ) langue française.
*
REQUEST HB_LANG_FR
REQUEST HB_CODEPAGE_FRWIN
HB_CDPSELECT( 'FRWIN' )
HB_LANGSELECT( 'FR' )
*
SETMODE( 50, 80 )                                     && Lignes et colonnes d'affichage écran.

*
? "Début du programme."
?
oLocator := WIN_OLECREATEOBJECT( "WbemScripting.SWbemLocator" )
oWMI     := oLocator:ConnectServer( ".", "root\cimv2" )
Items    := oWMI:ExecQuery( "SELECT * FROM Win32_Bios" )
*
SET SAFETY OFF
SET ALTE TO __Result.txt
SET ALTE ON
? "Bios -> Nombre : " + LTRIM( STR( Items:count, 9, 0 ) )
*
FOR EACH Item in Items
 I++
 *
 ?
 ? REPLICATE( "-", 10 ) + " " + LTRIM( STR( I, 9, 0 ) )
 ?
 *
 ? "BiosCharacteristics . :", VALTYPE( Item:BiosCharacteristics ) , ":", Item:BiosCharacteristics
 IF VALTYPE( Item:BiosCharacteristics ) == "A"       && Not NIL
  FOR J := 1 TO LEN( Item:BiosCharacteristics )
   WMI_Bios_BiosCharacteristics( Item:BiosCharacteristics[ J ] )
  ENDFOR
 ENDIF
 ?
 *
 ? "BIOSVersion ......... :", VALTYPE( Item:BIOSVersion )           , ":", Item:BIOSVersion
 IF VALTYPE( Item:BIOSVersion ) == "A"       && Not NIL
  FOR J := 1 TO LEN( Item:BIOSVersion )
   ? SPACE( 27 ), Item:BIOSVersion[ J ]
  ENDFOR
 ENDIF
 ?
 *
 ? "BuildNumber ......... :", VALTYPE( Item:BuildNumber )           , ":", Item:BuildNumber
 ? "Caption ............. :", VALTYPE( Item:Caption )               , ":", Item:Caption
 ? "CodeSet ............. :", VALTYPE( Item:CodeSet )               , ":", Item:CodeSet
 ? "CurrentLanguage ..... :", VALTYPE( Item:CurrentLanguage )       , ":", Item:CurrentLanguage
 ? "Description ......... :", VALTYPE( Item:Description )           , ":", Item:Description
 ? "IdentificationCode .. :", VALTYPE( Item:IdentificationCode )    , ":", Item:IdentificationCode
 ? "InstallableLanguages  :", VALTYPE( Item:InstallableLanguages )  , ":", Item:InstallableLanguages
 ? "InstallDate ......... :", VALTYPE( Item:InstallDate )           , ":", Item:InstallDate
 ? "LanguageEdition ..... :", VALTYPE( Item:LanguageEdition )       , ":", Item:LanguageEdition
 *
 ? "ListOfLanguages ..... :", VALTYPE( Item:ListOfLanguages )       , ":", Item:ListOfLanguages
 IF VALTYPE( Item:ListOfLanguages ) == "A"       && Not NIL
  FOR J := 1 TO LEN( Item:ListOfLanguages )
   ? SPACE( 27 ), Item:ListOfLanguages[ J ]
  ENDFOR
 ENDIF
 ?
 *
 ? "Manufacturer ........ :", VALTYPE( Item:Manufacturer )          , ":", Item:Manufacturer
 ? "Name ................ :", VALTYPE( Item:Name )                  , ":", Item:Name
 ? "OtherTargetOS ....... :", VALTYPE( Item:OtherTargetOS )         , ":", Item:OtherTargetOS
 ? "PrimaryBIOS ......... :", VALTYPE( Item:PrimaryBIOS )           , ":", Item:PrimaryBIOS
 ? "ReleaseDate ......... :", VALTYPE( Item:ReleaseDate )           , ":", Item:ReleaseDate
 ? "SerialNumber ........ :", VALTYPE( Item:SerialNumber )          , ":", Item:SerialNumber
 ? "SMBIOSBIOSVersion ... :", VALTYPE( Item:SMBIOSBIOSVersion )     , ":", Item:SMBIOSBIOSVersion
 ? "SMBIOSMajorVersion .. :", VALTYPE( Item:SMBIOSMajorVersion )    , ":", Item:SMBIOSMajorVersion
 ? "SMBIOSMinorVersion .. :", VALTYPE( Item:SMBIOSMinorVersion )    , ":", Item:SMBIOSMinorVersion
 ? "SMBIOSPresent ....... :", VALTYPE( Item:SMBIOSPresent )         , ":", Item:SMBIOSPresent
 ? "SoftwareElementID ... :", VALTYPE( Item:SoftwareElementID )     , ":", Item:SoftwareElementID
 *
 ? "SoftwareElementState  :", VALTYPE( Item:SoftwareElementState )
 IF VALTYPE( Item:SoftwareElementState ) == "N"       && Not NIL
   WMI_Bios_SoftwareElementState( Item:SoftwareElementState )
 ENDIF
 ?
 *
 ? "Status .............. :", VALTYPE( Item:Status )                , ":", Item:Status
 ? "TargetOperatingSystem :", VALTYPE( Item:TargetOperatingSystem )
 *
 IF VALTYPE( Item:TargetOperatingSystem ) == "N"       && Not NIL
   WMI_Bios_TargetOperatingSystem( Item:TargetOperatingSystem )
 ENDIF
 ?
 *
 ? "Version ............. :", VALTYPE( Item:Version )               , ":", Item:Version
 *
ENDFOR
*
?
? REPLICATE( "-", 10 )
?
SET ALTE OFF
SET ALTE TO
*
oLocator := NIL
oWMI     := NIL
Items    := NIL
Item     := NIL
*
hb_Run( "__Result.txt" )
*
WAIT "Fin du programme."
*
RETURN
*
* ----------------------------------------------
PROCEDURE WMI_Bios_BiosCharacteristics( Valeur )
* ----------------------------------------------
*
? SPACE( 27 ), STR( Valeur, 2, 0 ), "-> "
*
DO CASE
CASE Valeur == 0
 ?? "Reserved"
CASE Valeur == 1
 ?? "Reserved"
CASE Valeur == 2
 ?? "Unknown"
CASE Valeur == 3
 ?? "BIOS Characteristics Not Supported"
CASE Valeur == 4
 ?? "ISA is supported"
CASE Valeur == 5
 ?? "MCA is supported"
CASE Valeur == 6
 ?? "EISA is supported"
CASE Valeur == 7
 ?? "PCI is supported"
CASE Valeur == 8
 ?? "PC Card (PCMCIA) is supported"
CASE Valeur == 9
 ?? "Plug and Play is supported"
CASE Valeur == 10
 ?? "APM is supported"
CASE Valeur == 11
 ?? "BIOS is Upgradable (Flash)"
CASE Valeur == 12
 ?? "BIOS shadowing is allowed"
CASE Valeur == 13
 ?? "VL-VESA is supported"
CASE Valeur == 14
 ?? "ESCD support is available"
CASE Valeur == 15
 ?? "Boot from CD is supported"
CASE Valeur == 16
 ?? "Selectable Boot is supported"
CASE Valeur == 17
 ?? "BIOS ROM is socketed"
CASE Valeur == 18
 ?? "Boot From PC Card (PCMCIA) is supported"
CASE Valeur == 19
 ?? "EDD (Enhanced Disk Drive) Specification is supported"
CASE Valeur == 20
 ?? "Int 13h - Japanese Floppy for NEC 9800 1.2mb (3.5, 1k Bytes/Sector, 360 RPM) is supported"
CASE Valeur == 21
 ?? "Int 13h - Japanese Floppy for Toshiba 1.2mb (3.5, 360 RPM) is supported"
CASE Valeur == 22
 ?? "Int 13h - 5.25 / 360 KB Floppy Services are supported"
CASE Valeur == 23
 ?? "Int 13h - 5.25 /1.2MB Floppy Services are supported"
CASE Valeur == 24
 ?? "Int 13h - 3.5 / 720 KB Floppy Services are supported"
CASE Valeur == 25
 ?? "Int 13h - 3.5 / 2.88 MB Floppy Services are supported"
CASE Valeur == 26
 ?? "Int 5h, Print Screen Service is supported"
CASE Valeur == 27
 ?? "Int 9h, 8042 Keyboard services are supported"
CASE Valeur == 28
 ?? "Int 14h, Serial Services are supported"
CASE Valeur == 29
 ?? "Int 17h, printer services are supported"
CASE Valeur == 30
 ?? "Int 10h, CGA/Mono Video Services are supported"
CASE Valeur == 31
 ?? "NEC PC-98"
CASE Valeur == 32
 ?? "ACPI is supported"
CASE Valeur == 33
 ?? "USB Legacy is supported"
CASE Valeur == 34
 ?? "AGP is supported"
CASE Valeur == 35
 ?? "I2O boot is supported"
CASE Valeur == 36
 ?? "LS-120 boot is supported"
CASE Valeur == 37
 ?? "ATAPI ZIP Drive boot is supported"
CASE Valeur == 38
 ?? "1394 boot is supported"
CASE Valeur == 39
 ?? "Smart Battery is supported"
CASE Valeur >= 40 .AND. Valeur <= 47
 ?? "Reserved for BIOS vendor"
CASE Valeur >= 48 .AND. Valeur <= 63
 ?? "Reserved for system vendor"
OTHERWISE
 ?? "?? Unknow, look home Microsoft ??"
ENDCASE
*
RETURN
*
* ----------------------------------------------
PROCEDURE WMI_Bios_SoftwareElementState( Valeur )
* ----------------------------------------------
*
? SPACE( 27 ), STR( Valeur, 2, 0 ), "-> "
*
DO CASE
CASE Valeur == 0
 ?? "Deployable"
CASE Valeur == 1
 ?? "Installable"
CASE Valeur == 2
 ?? "Executable"
CASE Valeur == 3
 ?? "Running"
OTHERWISE
 ?? "?? Unknow, look home Microsoft ??"
ENDCASE
*
RETURN
*
* ----------------------------------------------
PROCEDURE WMI_Bios_TargetOperatingSystem( Valeur )
* ----------------------------------------------
*
? SPACE( 27 ), STR( Valeur, 2, 0 ), "-> "
*
DO CASE
CASE Valeur == 0
 ?? "Unknown"
CASE Valeur == 1
 ?? "Other"
CASE Valeur == 2
 ?? "MACOS"
CASE Valeur == 3
 ?? "ATTUNIX"
CASE Valeur == 4
 ?? "DGUX"
CASE Valeur == 5
 ?? "DECNT"
CASE Valeur == 6
 ?? "Digital Unix"
CASE Valeur == 7
 ?? "OpenVMS"
CASE Valeur == 8
 ?? "HPUX"
CASE Valeur == 9
 ?? "AIX"
CASE Valeur == 10
 ?? "MVS"
CASE Valeur == 11
 ?? "OS400"
CASE Valeur == 12
 ?? "OS/2"
CASE Valeur == 13
 ?? "JavaVM"
CASE Valeur == 14
 ?? "MSDOS"
CASE Valeur == 15
 ?? "WIN3x"
CASE Valeur == 16
 ?? "WIN95"
CASE Valeur == 17
 ?? "WIN98"
CASE Valeur == 18
 ?? "WINNT"
CASE Valeur == 19
 ?? "WINCE"
CASE Valeur == 20
 ?? "NCR3000"
CASE Valeur == 21
 ?? "NetWare"
CASE Valeur == 22
 ?? "OSF"
CASE Valeur == 23
 ?? "DC/OS"
CASE Valeur == 24
 ?? "Reliant UNIX"
CASE Valeur == 25
 ?? "SCO UnixWare"
CASE Valeur == 26
 ?? "SCO OpenServer"
CASE Valeur == 27
 ?? "Sequent"
CASE Valeur == 28
 ?? "IRIX"
CASE Valeur == 29
 ?? "Solaris"
CASE Valeur == 30
 ?? "SunOS"
CASE Valeur == 31
 ?? "U6000"
CASE Valeur == 32
 ?? "ASERIES"
CASE Valeur == 33
 ?? "TandemNSK"
CASE Valeur == 34
 ?? "TandemNT"
CASE Valeur == 35
 ?? "BS2000"
CASE Valeur == 36
 ?? "LINUX"
CASE Valeur == 37
 ?? "Lynx"
CASE Valeur == 38
 ?? "XENIX"
CASE Valeur == 39
 ?? "VM/ESA"
CASE Valeur == 40
 ?? "Interactive UNIX"
CASE Valeur == 41
 ?? "BSDUNIX"
CASE Valeur == 42
 ?? "FreeBSD"
CASE Valeur == 43
 ?? "NetBSD"
CASE Valeur == 44
 ?? "GNU Hurd"
CASE Valeur == 45
 ?? "OS9"
CASE Valeur == 46
 ?? "MACH Kernel"
CASE Valeur == 47
 ?? "Inferno"
CASE Valeur == 48
 ?? "QNX"
CASE Valeur == 49
 ?? "EPOC"
CASE Valeur == 50
 ?? "IxWorks"
CASE Valeur == 51
 ?? "VxWorks"
CASE Valeur == 52
 ?? "MiNT"
CASE Valeur == 53
 ?? "BeOS"
CASE Valeur == 54
 ?? "HP MPE"
CASE Valeur == 55
 ?? "NextStep"
CASE Valeur == 56
 ?? "PalmPilot"
CASE Valeur == 57
 ?? "Rhapsody"
CASE Valeur == 58
 ?? "Windows 2000"
CASE Valeur == 59
 ?? "Dedicated"
CASE Valeur == 60
 ?? "VSE"
CASE Valeur == 61
 ?? "TPF"
OTHERWISE
 ?? "?? Unknow, look home Microsoft ??"
ENDCASE
*
RETURN

// End code





Le samedi 11 janvier 2014 18:27:36 UTC+1, s...@medan.indo.net.id a écrit :

elch

unread,
Jan 14, 2014, 8:09:56 AM1/14/14
to harbou...@googlegroups.com, Bernard Mouille, s...@medan.indo.net.id
Hi Bernard,

and where in the BIOS data the MAC address of the network card can be found ?

( thanks so far for example for reading the BIOS in Windows ..)

regards
Rolf

Jayadev U

unread,
Jan 14, 2014, 10:07:17 AM1/14/14
to harbou...@googlegroups.com

Hi Bernard,

 

Excellent.

 

Can we get the motherboard serial no. and the lan card serial no. in some way ?

 

We can use it for software protection.

 

Warm regards,

 

Jayadev

 

 

From: harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] On Behalf Of Bernard Mouille
Sent: Tuesday, January 14, 2014 6:26 PM
To: harbou...@googlegroups.com
Cc: Bernard Mouille; s...@medan.indo.net.id; s...@medan.indo.net.id
Subject: Re: [harbour-users] Re: function for getting information on NIC mac adress

 

--

s...@medan.indo.net.id

unread,
Jan 14, 2014, 10:46:17 AM1/14/14
to harbou...@googlegroups.com, Bernard Mouille
Hi Bernard,
Thanks for such a great code. I'll try it soon.


Sumiran

Powered by Telkomsel BlackBerry®

From: Bernard Mouille <bernard...@wanadoo.fr>
Date: Tue, 14 Jan 2014 04:56:11 -0800 (PST)
Subject: Re: [harbour-users] Re: function for getting information on NIC mac adress

Qatan

unread,
Jan 14, 2014, 10:45:14 AM1/14/14
to harbou...@googlegroups.com
and where in the BIOS data the MAC address of the network card can be found ?
+1 ?
 
Qatan

Bernard Mouille

unread,
Jan 14, 2014, 11:40:47 AM1/14/14
to harbou...@googlegroups.com, Bernard Mouille, s...@medan.indo.net.id
Hello Qatan and Rolf,

The MAC address of the network card in use can be found with the source putted the 10 january 2014

Sorry, I do a mistake : name GetMacAddressConnected() and not GetIpAddressConnected()

You can also use the WMI to look the MAC address of all the network cards : Win32_NetworkAdapter class
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx

Bernard

Qatan

unread,
Jan 14, 2014, 11:48:23 AM1/14/14
to harbou...@googlegroups.com
Hello Bernard,
 

>The MAC address of the network card in use can be found with the source putted the 10 january 2014
 
In Win7(x32) it returns an empty string.
Thanks for your help.
 
 
Qatan
 

Bernard Mouille

unread,
Jan 14, 2014, 12:04:42 PM1/14/14
to harbou...@googlegroups.com
Hello Quatan,

This function give the mac address of the connect card.
I Test with :

Dell and Windows 8.1 pro 64 bits
Dell and Windows 7 pro 32 bits laptop
Parallels Desktop and Windows XP pro ( on Dell Dell and Windows 8.1 pro 64 bits, and Dell and Windows 7 pro 32 bits laptop )

If I change the modem connection card ( Wifi, ethernet, Parallels Host-Only Networking Adapter, Parallels Shared Networking Adapter ), the mac address is good.
If I have no modem connexion, the function return an empty string.

Bernard

----------------------------------------------------------

Bernard Mouille

unread,
Jan 14, 2014, 1:36:01 PM1/14/14
to harbou...@googlegroups.com
Hello Jayadev

You can try the Win32_BaseBoard class with Windows :
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394072(v=vs.85).aspx

Regards,

Bernard


Le mardi 14 janvier 2014 16:07:17 UTC+1, ujayadev_at_gmail.com a écrit :

Hi Bernard,

 

Excellent.

 

Can we get the motherboard serial no. and the lan card serial no. in some way ?

 

We can use it for software protection.

 

Warm regards,

 

Jayadev

 

 

From: harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] On Behalf Of Bernard Mouille
Sent: Tuesday, January 14, 2014 6:26 PM
To: harbou...@googlegroups.com
Cc: Bernard Mouille; s...@medan.indo.net.id; s...@medan.indo.net.id
Subject: Re: [harbour-users] Re: function for getting information on NIC mac adress

 

Bernard Mouille

unread,
Jan 17, 2014, 2:52:02 AM1/17/14
to harbou...@googlegroups.com
Hello Jayadev,

I attached my codes to test and evaluate the WMI machine ( Tool := "BaseBoard" ).

Regards,

Bernard



WMI_Tests.zip

Jayadev U

unread,
Jan 17, 2014, 4:11:58 AM1/17/14
to harbou...@googlegroups.com

Hello Bernard,

 

Many thanks.  Shall test and revert.

 

Warm regards,

 

Jayadev

 

 

 

From: harbou...@googlegroups.com [mailto:harbou...@googlegroups.com] On Behalf Of Bernard Mouille
Sent: Friday, January 17, 2014 1:22 PM
To: harbou...@googlegroups.com
Subject: Re: [harbour-users] Re: function for getting information on NIC mac adress

 

Hello Jayadev,

--
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
 
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages