I am trying to add a temporary IP address to the NIC using AddIPAddress when I log in as a non-admin user. The MSDN documentation for AddIPAddress states that ERROR_INVALID_HANDLE is returned as an error if the function is not called by the administrator.
Given that I have undergone an AddIPAddress call with API calls for LogonUser () and ImpersonateLoggedOnUser (). Now my application considers that it is registered as Admin, but AddIPAddress still does not work with ERROR_INVALID_HANDLE.
MSDN also states that ..
"Note: Group policies, corporate policies, and other network restrictions may prevent these features from completing successfully. Ensure that the application has the necessary network permissions before attempting to use these features.
Can I call AddIPAddress using impersonation? if so, how? I assume that I need to change the permissions mentioned above, but I do not understand what to do in this area.
Any help would be appreciated!
Additonal: I also drew a space while trying to call netsh (logged in again as a regular user) using CreateProcessAsUser using a handle provided by the admin user to start the process. Always returns errors indicating minor privileges.
c ++ c winapi network-programming
Cloudy milder
source share