Hello,
I'm trying to call the function GetInterfaceInfo of iphlpapi.dll/runtimes of D, and it didn't work.
I don't know how to call it, or what parameters I should put in. I checked the Microsoft Windows APIs, the D documentation of the function, and still, don't succeed.
Can someone please explain me with an example how to use it?
Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
June 08, 2023 GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benny | On Thursday, 8 June 2023 at 05:29:07 UTC, Benny wrote: >Hello, Hi! >I'm trying to call the function GetInterfaceInfo it would be nice to see the code >didn't work. it would be nice to see specifics (error code, results, etc) |
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to novice2 | On Thursday, 8 June 2023 at 05:42:20 UTC, novice2 wrote: >On Thursday, 8 June 2023 at 05:29:07 UTC, Benny wrote: >Hello, Hi! >I'm trying to call the function GetInterfaceInfo it would be nice to see the code >didn't work. it would be nice to see specifics (error code, results, etc)
|
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benny | On Thursday, 8 June 2023 at 05:52:43 UTC, Benny wrote: >
app.obj : error LNK2019: unresolved external symbol GetInterfaceInfo referenced in function _Dmain
That's a linker error telling you that you aren't linking anything that contains the symbol for |
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Thursday, 8 June 2023 at 06:22:08 UTC, Mike Parker wrote: >On Thursday, 8 June 2023 at 05:52:43 UTC, Benny wrote: >
app.obj : error LNK2019: unresolved external symbol GetInterfaceInfo referenced in function _Dmain
That's a linker error telling you that you aren't linking anything that contains the symbol for I got something! thank you.
this got me 122 |
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benny | On Thursday, 8 June 2023 at 07:01:44 UTC, Benny wrote: >I got something! thank you.
this got me 122 Alright. I've never used this function, so I referenced the documentation here: https://learn.microsoft.com/en-us/windows/win32/api/iphlpapi/nf-iphlpapi-getinterfaceinfo First, you don't need to allocate i with malloc. Just declare it as a uint and give the function a pointer to it. Second, the function is intended to be called twice. The first time with null for the first parameter as you've done here. After that call, the value in i should be the size of the memory you need to allocate for the first parameter on the second call. In the second call, the data you want will be stored in that pointer. Third, the first parameter is of type PIP_INTERACE_INFO, which in Windows lingo means "pointer to IP_INTERFACE_INFO". That's declared in the ipexport module. Here's a working example. I chose to use the GC rather than malloc.
|
June 08, 2023 Re: GetInterfaceInfo function of win32 api | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benny | On Thursday, 8 June 2023 at 07:01:44 UTC, Benny wrote: >this got me 122 don be shy, try to do something yourself, be curiosity! |