getting AdapterName
Hi,
could someone tell me how is it possible to get the network adapter
interface name (this name sounds like "Local Area Connection")?
PIP_ADAPTER_INFO AdapterName returns only a number (specific to this
adapter) but not this string...
PIP_ADAPTER_INFO pAdapter = NULL;
//load network interface adapter
CString name;
name = pAdapter->AdapterName;
I need this string to setup a new ip addr etc. to the network adapter
using netsh...
fstream batchFile;
batchFile.open("Launch.bat", ios::out);
if(!batchFile){ /* Uh-oh! */
TRACE(_T("error: creating batch file\n"));
return FALSE;
}
batchFile << "netsh interface ip set address name=\"Local Area
Connection\" source=static addr=192.168.59.34 mask=255.255.0.0 " <<
endl;
batchFile.close();
HINSTANCE nResult = ShellExecute(NULL,_T("open"),_T("Launch.bat"),
NULL, NULL, SW_HIDE);
if((int)nResult <= 32)
{
TRACE(_T("error\n"));
}
CloseHandle(nResult);
BTW: do I need the CloseHandle??? Is it possible to know that the
batch file was executed successfull as well as that the batch file is
no longer running?
I don`t erase this file (Launch.bat) after the creation so that I can
execute this file after a restart of the operating system - setting up
the network connection with the latest information. Because of using
the enhanced write filter (operating system is installed on a CF-card)
I can`t store these information in the image whithout a restart (and I
don`t want to restart the whole system after changing the ip addr).
Moreover is ShellExecute the right command to use instead of
CreateProcess?
best regards
Hans