C++ network setting
Project ID: 1254324717
Project Details
- Status: Closed (Cancelled)
- Posted: 9/30/2009 at 11:31 EST
- Cancelled: 10/22/2009 at 0:26 EST
- Project Creator:
- Budget: N/A
- Description: Hi,
I am trying to change the interface metric for the networking interfaces from automatic to a constant value. Here is the visual setting: http://i33.tinypic.com/a14pwh.jpg
I came across the APIs:
GetIpInterfaceEntry & SetIpInterfaceEntry.
When I use GetIpInterfaceEntry, I can determine the interface metric for all the interfaces correctly. However when I try to use the SetIpInterfaceEntry to change the interface metric, it gives me an error 0x57 (ERROR_INVALID_PARAMETER).
I did some tracing into the API and determined that the error is coming from an internal call to NsiSetAllParameters().
Any pointers greatly appreciated. We need to do this programatically - so either a WMI script that works, or a C++ or managed application is fine.
Here is the code snippet I am using:
/* Read in the interface entry */
MIB_IPINTERFACE_ROW iface;
memset((void *)&iface, 0, sizeof iface);
iface.InterfaceIndex = atoi(argv[1]);
iface.Family = AF_INET;
DWORD result = GetIpInterfaceEntry(&iface);
if (result) {
const char *error = ErrMessage(result);
printf("GetIpIE failed, error %d : %s\n", result, error);
exit(-1);
}
/* Now try changing the metric value */
InitializeIpInterfaceEntry(&iface);
iface.InterfaceIndex = atoi(argv[1]);
iface.Family = AF_INET;
iface.UseAutomaticMetric = 0;
iface.Metric = atoi(argv[2]);
result = SetIpInterfaceEntry(&iface); // ---> FAILS with error 0x57
if (result) {
const char *error = ErrMessage(result);
printf("SetIpIE failed, error %d : %s\n", result, error);
exit(-1);
}
printf("Result %d\n", result);
We require someone to assist with the fix and guide us with this problem. Our application requires a specific metric number to be set in Vista and currently we have to tell our users to manually edit the number which is not ideal.
Please quote price if you are confident of fix only. - Tags:
| Project Bids |
| Programmer | Bid |
Delivery Time | Time of Bid | Rating | |
| passy | $10 | 3 days | 10/1/2009 at 6:19 EST | (No Feedback Yet) | |
| hi(0$) i have got 2 years of corporate experience in C/C++ and shell programming. i can do your project. i will do it for free. you can also give your project to other programmers if you dont want to take risk. if they complete earlier than me then its fine else i will do it. thanks passy | |||||






