Network Node ID Help

Network Node ID Help

My software requires that I obtain the network node identifier of the network card and I should be able to obtain this at run time using the GetClusterNodeID API. However, the code show below results in an unsatisfied external for GetClusterNodeID when I link the program. Any suggestions? Am I missing a module or library (I am linking with clusapi.lib.

use dfport

integer*4 NodeIDCount,hNode
character*256 NodeID

lpszNodeID = loc(NodeID)
NodeIDCount = 256
lpcchNodeID = loc(NodeIDCount)
hNode = NULL
istatus = GetClusterNodeID(hNode,lpszNodeID,lpcchNodeID)

11 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

CVF doesn't include declarations for routines in clusapi.lib. You'll have to write your own INTERFACE block for it.

Steve

Steve - Intel Developer Support

Thanks Steve... Now can anyone tell me what the interface should look like. Declaring an integer function with integer arguements still gives me an unsatisfied external reference. Has anyone out there written the interface to GetClusterNodeID?

[pre]
INTERFACE
INTEGER FUNCTION GetClusterNodeId(hNode,lpszNodeID,lpcchNodeID)
!DEC$ATTRIBUTES STDCALL, ALIAS: "_GetClusterNodeId@12":: GetClusterNodeId
INTEGER:: hNode, lpszNodeID, lpcchNodeID
END FUNCTION
END INTERFACE
[/pre]
Of course, don't forget to add Clusapi.lib to Project/Settings/Link.

Jugoslav

Jugoslav
www.xeffort.com

Thanks jugoslavdujic... I left out the alias.

I could give you the interface (and will), but I don't think it will help you. Did you spot the note in the documentation that this service was available for Windows NT Enterprise Server Edition 4.0 only?

If you still want to use it, the interface would be:

interface
  integer(SINT) function GetClusterNodeId (hnode, &
    lpszNodeID, lpcchNodeID)
  !DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE :: GetClusterNodeID
  !DEC$ ATTRIBUTES ALIAS:"GetClusterNodeId" :: GetClusterNodeID
  INTEGER(HANDLE), INTENT(IN) :: hnode
  INTEGER(LPWSTR), INTENT(OUT) :: lpszNodeID
  !DEC$ ATTRIBUTES REFERENCE ::lpszNodeID
  INTEGER(DWORD), INTENT(INOUT) :: lpcchNodeID
  !DEC$ ATTRIBUTES REFERENCE :: lpcchNodeID
  end function GetClusterNodeId
end interface

Offhand, I don't know how you would retrieve the Ethernet address.

Steve - Intel Developer Support

OK Steve, you're right as usual. The procedure compiles and links, but doesn't return anything when I make the call. I am attempting to write a nodelock proceedure and need to retrieve the physical address of the network card. Is there any way that you know of to do this other than with GetClusterNodeID? Is there a registry entry containing this address or am I out of luck?

I dunno. Maybe one of the NDIS functions? I found one that gets a software address from the registry, but I don't think that's what you want.

Would be a good question for the Win32 programming newsgroup - just ask which Win32 API routine returns the hardware MAC address of the Ethernet adapter. Keep in mind that some systems have more than one Ethernet adapter, so you probably need to enumerate them and query them all.

Steve

Steve - Intel Developer Support

See http://codeguru.earthweb.com/network/GetMAC.html for a number of different methods.

James

Thanks elementyl.... however, it appears that all the methods discussed in your link are either not supported on NT or not supported in CVF. At least, I could not find the required interfaces and structures in the CVF modules in the DF98 include folder. Maybe the best way to get the network adapter id is through a call to a C++ procedure, such as the one shown on the web page you refered me to. Anyway, thanks... I'll keep looking.

Well, don't let that deter you. If I stopped every time CVF didn't have an interface for something I would have quit a long time ago. :-) In these cases you simply need to define the data structure(s) and the necessary call interface(s) for your method of choice and it is certainly no problem to implement any of those methods in CVF.

James

Leave a Comment

Please sign in to add a comment. Not a member? Join today