I would like to use a unique identifier to determine if my application has moved to another computer. It seems that the MAC address is suitable for this purpose. The code I'm using is this:
Procedure TForm4.GetMacAddress; var item: TListItem; objWMIService : OLEVariant; colItems : OLEVariant; colItem : OLEVariant; oEnum : IEnumvariant; iValue : LongWord; wmiHost, root, wmiClass: string; i: Int32; function GetWMIObject(const objectName: String): IDispatch; var chEaten: Integer; BindCtx: IBindCtx;//for access to a bind context Moniker: IMoniker;//Enables you to use a moniker object begin OleCheck(CreateBindCtx(0, bindCtx)); OleCheck(MkParseDisplayName(BindCtx, StringToOleStr(objectName), chEaten, Moniker));//Converts a string into a moniker that identifies the object named by the string OleCheck(Moniker.BindToObject(BindCtx, nil, IDispatch, Result));//Binds to the specified object end; begin wmiHost := '.'; root := 'root\CIMV2'; wmiClass := 'Win32_NetworkAdapterConfiguration'; objWMIService := GetWMIObject(Format('winmgmts:\\%s\%s',[wmiHost,root])); colItems := objWMIService.ExecQuery(Format('SELECT * FROM %s',[wmiClass]),'WQL',0); oEnum := IUnknown(colItems._NewEnum) as IEnumVariant; i := 0; while oEnum.Next(1, colItem, iValue) = 0 do begin Item := View.Items.Add; item.Caption := Copy (colItem.Caption, 2, 8); Item.SubItems.Add (colItem.Description); Item.SubItems.Add (colItem.ServiceName); Item.SubItems.Add (VarToStrNil (colItem.MACAddress)); if (VarToStrNil(colItem.MACAddress) <> '') then Item.SubItems.Add ('yes') else Item.SubItems.Add ('no'); if colItem.IPEnabled then Item.SubItems.Add ('yes') else Item.SubItems.Add ('no'); Item.SubItems.Add (VarToStrNil (colItem.SettingID)); Item.SubItems.Add (IntToStr (colItem.InterfaceIndex)); end; // if end; // GetMacAddress //
My machine has one network port, but this code finds 18 network ports / things / something else. Among them are four MAC addresses. I assume that the network port must have IP enabled in order to leave two on the left (indicated by the MAC in the image). Is it right to assume that of the filters filtered in this way, the one with the lowest index is the hardware port?

Change in the screenshot above the adapter Realtek is the only physical adapter in the machine. Another adapter is the VirtualBox virtual adapter. TLama's answer identifies these two adapters, but is there a way to find the address of a single Physical (Realtek) adapter?
EJP Update 1 indicated that the MAC address can be changed. This somewhat undermines my goal, but since I am looking for a solution that is suitable for most situations, I decided to live with it.
TLama and Tndrej pointed to several solutions. Both end up in a situation where the physical adapter cannot be found without any doubt.
Update 2 TLama's excellent reading list shows that there is probably no definite way to determine the physical adapter. The article mentioned in the first brochure shows how to reduce the number of adapters based on some simple assumptions. The article in the third brochure shows how to choose an adapter connected to the PCI bus, which is actually exactly what I wanted to know. There are some strange exceptions mentioned in the article, but I think this will give an answer in most cases.
Thank you all for your input!