Start New Discussion within our Software Development Community

I am trying to change the NIC speed through the registry.. But my problem is that I dont fully understand the command RegSetValueEx. I have checked the Internet up and down for some good examples but have fallen short.. I am tring to set the default value for the NIOC speed to be 0 (Auto). Here is what I have for that part..

LPTSTR lptstrRegSubKey;
LPCTSTR Caption2 = "Speed Change Successfull!";
HKEY hKey;

if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\0001\\Ndi\\Params\\*SpeedDuplex\\enum", 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
    lptstrRegSubKey = "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002bE10318}\\0001\\Ndi\\Params\\*SpeedDuplex\\default";
    RegCloseKey (hKey);

if (RegSetValueEx(HKEY_LOCAL_MACHINE, lptstrRegSubKey, 0, REG_DWORD,   (PBYTE) 0, sizeof(0))==ERROR_SUCCESS)
     MessageBox(NULL, "NIC Speed was changed to Auto..", Caption2,MB_OK);
This question has already been answered. Start a new discussion instead.