mirror of
https://github.com/reactos/reactos.git
synced 2025-07-25 11:04:05 +00:00
[NETCFGX]
Formatting. No code changes! svn path=/trunk/; revision=61273
This commit is contained in:
parent
d0d5cf63bb
commit
5a9dd2eb87
1 changed files with 590 additions and 554 deletions
|
@ -102,8 +102,7 @@ STDAPI
|
||||||
DllGetClassObject(
|
DllGetClassObject(
|
||||||
REFCLSID rclsid,
|
REFCLSID rclsid,
|
||||||
REFIID riid,
|
REFIID riid,
|
||||||
LPVOID* ppv
|
LPVOID* ppv)
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
HRESULT hres = E_OUTOFMEMORY;
|
HRESULT hres = E_OUTOFMEMORY;
|
||||||
|
@ -139,7 +138,8 @@ DllGetClassObject(
|
||||||
* If the value doesn't exist, create it.
|
* If the value doesn't exist, create it.
|
||||||
* Returns ERROR_SUCCESS if success. Othewise, returns an error code
|
* Returns ERROR_SUCCESS if success. Othewise, returns an error code
|
||||||
*/
|
*/
|
||||||
static LONG
|
static
|
||||||
|
LONG
|
||||||
AppendStringToMultiSZ(
|
AppendStringToMultiSZ(
|
||||||
IN HKEY hKey,
|
IN HKEY hKey,
|
||||||
IN PCWSTR ValueName,
|
IN PCWSTR ValueName,
|
||||||
|
@ -151,8 +151,7 @@ AppendStringToMultiSZ(
|
||||||
DWORD dwTmp;
|
DWORD dwTmp;
|
||||||
LONG rc;
|
LONG rc;
|
||||||
|
|
||||||
rc = RegQueryValueExW(
|
rc = RegQueryValueExW(hKey,
|
||||||
hKey,
|
|
||||||
ValueName,
|
ValueName,
|
||||||
NULL,
|
NULL,
|
||||||
&dwRegType,
|
&dwRegType,
|
||||||
|
@ -175,8 +174,8 @@ AppendStringToMultiSZ(
|
||||||
rc = ERROR_NOT_ENOUGH_MEMORY;
|
rc = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
rc = RegQueryValueExW(
|
|
||||||
hKey,
|
rc = RegQueryValueExW(hKey,
|
||||||
ValueName,
|
ValueName,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -202,8 +201,7 @@ AppendStringToMultiSZ(
|
||||||
/* Terminate the REG_MULTI_SZ string */
|
/* Terminate the REG_MULTI_SZ string */
|
||||||
Buffer[dwLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
|
Buffer[dwLength / sizeof(WCHAR) - 1] = UNICODE_NULL;
|
||||||
|
|
||||||
rc = RegSetValueExW(
|
rc = RegSetValueExW(hKey,
|
||||||
hKey,
|
|
||||||
ValueName,
|
ValueName,
|
||||||
0,
|
0,
|
||||||
REG_MULTI_SZ,
|
REG_MULTI_SZ,
|
||||||
|
@ -219,7 +217,8 @@ cleanup:
|
||||||
* Returns TRUE if success, FALSE if failure. Error code can
|
* Returns TRUE if success, FALSE if failure. Error code can
|
||||||
* be retrieved with GetLastError()
|
* be retrieved with GetLastError()
|
||||||
*/
|
*/
|
||||||
static BOOL
|
static
|
||||||
|
BOOL
|
||||||
InstallInfSection(
|
InstallInfSection(
|
||||||
IN HWND hWnd,
|
IN HWND hWnd,
|
||||||
IN LPCWSTR InfFile,
|
IN LPCWSTR InfFile,
|
||||||
|
@ -280,7 +279,8 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add default services for network cards */
|
/* Add default services for network cards */
|
||||||
static DWORD
|
static
|
||||||
|
DWORD
|
||||||
InstallAdditionalServices(
|
InstallAdditionalServices(
|
||||||
IN HWND hWnd)
|
IN HWND hWnd)
|
||||||
{
|
{
|
||||||
|
@ -288,8 +288,7 @@ InstallAdditionalServices(
|
||||||
UNICODE_STRING TcpipServicePath = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Tcpip");
|
UNICODE_STRING TcpipServicePath = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Tcpip");
|
||||||
|
|
||||||
/* Install TCP/IP protocol */
|
/* Install TCP/IP protocol */
|
||||||
ret = InstallInfSection(
|
ret = InstallInfSection(hWnd,
|
||||||
hWnd,
|
|
||||||
L"nettcpip.inf",
|
L"nettcpip.inf",
|
||||||
L"MS_TCPIP.PrimaryInstall",
|
L"MS_TCPIP.PrimaryInstall",
|
||||||
L"MS_TCPIP.PrimaryInstall.Services");
|
L"MS_TCPIP.PrimaryInstall.Services");
|
||||||
|
@ -315,7 +314,8 @@ InstallAdditionalServices(
|
||||||
return ERROR_SUCCESS;
|
return ERROR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static
|
||||||
|
DWORD
|
||||||
InstallNetDevice(
|
InstallNetDevice(
|
||||||
IN HDEVINFO DeviceInfoSet,
|
IN HDEVINFO DeviceInfoSet,
|
||||||
IN PSP_DEVINFO_DATA DeviceInfoData,
|
IN PSP_DEVINFO_DATA DeviceInfoData,
|
||||||
|
@ -341,6 +341,7 @@ InstallNetDevice(
|
||||||
rc = ERROR_GEN_FAILURE;
|
rc = ERROR_GEN_FAILURE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceId = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
InstanceId = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
||||||
if (!InstanceId)
|
if (!InstanceId)
|
||||||
{
|
{
|
||||||
|
@ -348,6 +349,7 @@ InstallNetDevice(
|
||||||
rc = ERROR_NOT_ENOUGH_MEMORY;
|
rc = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupDiGetDeviceInstanceIdW(DeviceInfoSet, DeviceInfoData, InstanceId, dwLength, NULL))
|
if (!SetupDiGetDeviceInstanceIdW(DeviceInfoSet, DeviceInfoData, InstanceId, dwLength, NULL))
|
||||||
{
|
{
|
||||||
rc = GetLastError();
|
rc = GetLastError();
|
||||||
|
@ -384,6 +386,7 @@ InstallNetDevice(
|
||||||
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegCreateKeyExW(hKey, UuidString, 0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, &hNetworkKey, NULL);
|
rc = RegCreateKeyExW(hKey, UuidString, 0, NULL, REG_OPTION_NON_VOLATILE, 0, NULL, &hNetworkKey, NULL);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -392,6 +395,7 @@ InstallNetDevice(
|
||||||
}
|
}
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
hKey = NULL;
|
hKey = NULL;
|
||||||
|
|
||||||
rc = RegCreateKeyExW(hNetworkKey, L"Parameters\\Tcpip", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL);
|
rc = RegCreateKeyExW(hNetworkKey, L"Parameters\\Tcpip", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hKey, NULL);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -400,24 +404,28 @@ InstallNetDevice(
|
||||||
}
|
}
|
||||||
RegCloseKey(hNetworkKey);
|
RegCloseKey(hNetworkKey);
|
||||||
hNetworkKey = NULL;
|
hNetworkKey = NULL;
|
||||||
|
|
||||||
rc = RegSetValueExW(hKey, L"DefaultGateway", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hKey, L"DefaultGateway", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hKey, L"IPAddress", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hKey, L"IPAddress", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hKey, L"SubnetMask", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hKey, L"SubnetMask", 0, REG_SZ, (const BYTE*)L"0.0.0.0", (wcslen(L"0.0.0.0") + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwValue = 1;
|
dwValue = 1;
|
||||||
rc = RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (const BYTE*)&dwValue, sizeof(DWORD));
|
rc = RegSetValueExW(hKey, L"EnableDHCP", 0, REG_DWORD, (const BYTE*)&dwValue, sizeof(DWORD));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
|
@ -443,43 +451,52 @@ InstallNetDevice(
|
||||||
DPRINT("SetupDiCreateDevRegKeyW() failed with error 0x%lx\n", rc);
|
DPRINT("SetupDiCreateDevRegKeyW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hKey, L"NetCfgInstanceId", 0, REG_SZ, (const BYTE*)UuidString, (wcslen(UuidString) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hKey, L"NetCfgInstanceId", 0, REG_SZ, (const BYTE*)UuidString, (wcslen(UuidString) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hKey, L"Characteristics", 0, REG_DWORD, (const BYTE*)&Characteristics, sizeof(DWORD));
|
rc = RegSetValueExW(hKey, L"Characteristics", 0, REG_DWORD, (const BYTE*)&Characteristics, sizeof(DWORD));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BusType)
|
if (BusType)
|
||||||
|
{
|
||||||
rc = RegSetValueExW(hKey, L"BusType", 0, REG_SZ, (const BYTE*)BusType, (wcslen(BusType) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hKey, L"BusType", 0, REG_SZ, (const BYTE*)BusType, (wcslen(BusType) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rc = RegCreateKeyExW(hKey, L"Linkage", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hLinkageKey, NULL);
|
rc = RegCreateKeyExW(hKey, L"Linkage", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hLinkageKey, NULL);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hLinkageKey, L"Export", 0, REG_SZ, (const BYTE*)DeviceName, (wcslen(DeviceName) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hLinkageKey, L"Export", 0, REG_SZ, (const BYTE*)DeviceName, (wcslen(DeviceName) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hLinkageKey, L"RootDevice", 0, REG_SZ, (const BYTE*)UuidString, (wcslen(UuidString) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hLinkageKey, L"RootDevice", 0, REG_SZ, (const BYTE*)UuidString, (wcslen(UuidString) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hLinkageKey, L"UpperBind", 0, REG_SZ, (const BYTE*)L"Tcpip", (wcslen(L"Tcpip") + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hLinkageKey, L"UpperBind", 0, REG_SZ, (const BYTE*)L"Tcpip", (wcslen(L"Tcpip") + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
@ -496,12 +513,14 @@ InstallNetDevice(
|
||||||
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegCreateKeyExW(hNetworkKey, UuidString, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY, NULL, &hKey, NULL);
|
rc = RegCreateKeyExW(hNetworkKey, UuidString, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_CREATE_SUB_KEY, NULL, &hKey, NULL);
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegCreateKeyExW(hKey, L"Connection", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hConnectionKey, NULL);
|
rc = RegCreateKeyExW(hKey, L"Connection", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL, &hConnectionKey, NULL);
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
hKey = NULL;
|
hKey = NULL;
|
||||||
|
@ -510,22 +529,26 @@ InstallNetDevice(
|
||||||
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegCreateKeyExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!LoadStringW(netcfgx_hInstance, IDS_NET_CONNECT, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
if (!LoadStringW(netcfgx_hInstance, IDS_NET_CONNECT, szBuffer, sizeof(szBuffer)/sizeof(WCHAR)))
|
||||||
{
|
{
|
||||||
wcscpy(szBuffer,L"Network connection");
|
wcscpy(szBuffer,L"Network connection");
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hConnectionKey, L"Name", 0, REG_SZ, (const BYTE*)szBuffer, (wcslen(szBuffer) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hConnectionKey, L"Name", 0, REG_SZ, (const BYTE*)szBuffer, (wcslen(szBuffer) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = RegSetValueExW(hConnectionKey, L"PnpInstanceId", 0, REG_SZ, (const BYTE*)InstanceId, (wcslen(InstanceId) + 1) * sizeof(WCHAR));
|
rc = RegSetValueExW(hConnectionKey, L"PnpInstanceId", 0, REG_SZ, (const BYTE*)InstanceId, (wcslen(InstanceId) + 1) * sizeof(WCHAR));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
DPRINT("RegSetValueExW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
dwShowIcon = 1;
|
dwShowIcon = 1;
|
||||||
rc = RegSetValueExW(hConnectionKey, L"ShowIcon", 0, REG_DWORD, (const BYTE*)&dwShowIcon, sizeof(dwShowIcon));
|
rc = RegSetValueExW(hConnectionKey, L"ShowIcon", 0, REG_DWORD, (const BYTE*)&dwShowIcon, sizeof(dwShowIcon));
|
||||||
if (rc != ERROR_SUCCESS)
|
if (rc != ERROR_SUCCESS)
|
||||||
|
@ -585,28 +608,32 @@ cleanup:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static
|
||||||
|
DWORD
|
||||||
InstallNetClient(VOID)
|
InstallNetClient(VOID)
|
||||||
{
|
{
|
||||||
DPRINT1("Installation of network clients is not yet supported\n");
|
DPRINT1("Installation of network clients is not yet supported\n");
|
||||||
return ERROR_GEN_FAILURE;
|
return ERROR_GEN_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static
|
||||||
|
DWORD
|
||||||
InstallNetService(VOID)
|
InstallNetService(VOID)
|
||||||
{
|
{
|
||||||
DPRINT1("Installation of network services is not yet supported\n");
|
DPRINT1("Installation of network services is not yet supported\n");
|
||||||
return ERROR_GEN_FAILURE;
|
return ERROR_GEN_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD
|
static
|
||||||
|
DWORD
|
||||||
InstallNetTransport(VOID)
|
InstallNetTransport(VOID)
|
||||||
{
|
{
|
||||||
DPRINT1("Installation of network protocols is not yet supported\n");
|
DPRINT1("Installation of network protocols is not yet supported\n");
|
||||||
return ERROR_GEN_FAILURE;
|
return ERROR_GEN_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD WINAPI
|
DWORD
|
||||||
|
WINAPI
|
||||||
NetClassInstaller(
|
NetClassInstaller(
|
||||||
IN DI_FUNCTION InstallFunction,
|
IN DI_FUNCTION InstallFunction,
|
||||||
IN HDEVINFO DeviceInfoSet,
|
IN HDEVINFO DeviceInfoSet,
|
||||||
|
@ -641,6 +668,7 @@ NetClassInstaller(
|
||||||
DPRINT("SetupDiGetSelectedDriverW() failed with error 0x%lx\n", rc);
|
DPRINT("SetupDiGetSelectedDriverW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverInfoDetail.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA_W);
|
DriverInfoDetail.cbSize = sizeof(SP_DRVINFO_DETAIL_DATA_W);
|
||||||
if (!SetupDiGetDriverInfoDetailW(DeviceInfoSet, DeviceInfoData, &DriverInfoData, &DriverInfoDetail, sizeof(DriverInfoDetail), NULL)
|
if (!SetupDiGetDriverInfoDetailW(DeviceInfoSet, DeviceInfoData, &DriverInfoData, &DriverInfoDetail, sizeof(DriverInfoDetail), NULL)
|
||||||
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
&& GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
||||||
|
@ -649,6 +677,7 @@ NetClassInstaller(
|
||||||
DPRINT("SetupDiGetDriverInfoDetailW() failed with error 0x%lx\n", rc);
|
DPRINT("SetupDiGetDriverInfoDetailW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
hInf = SetupOpenInfFileW(DriverInfoDetail.InfFileName, NULL, INF_STYLE_WIN4, &ErrorLine);
|
hInf = SetupOpenInfFileW(DriverInfoDetail.InfFileName, NULL, INF_STYLE_WIN4, &ErrorLine);
|
||||||
if (hInf == INVALID_HANDLE_VALUE)
|
if (hInf == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
@ -656,6 +685,7 @@ NetClassInstaller(
|
||||||
DPRINT("SetupOpenInfFileW() failed with error 0x%lx\n", rc);
|
DPRINT("SetupOpenInfFileW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupDiGetActualSectionToInstallW(hInf, DriverInfoDetail.SectionName, SectionName, LINE_LEN, NULL, NULL))
|
if (!SetupDiGetActualSectionToInstallW(hInf, DriverInfoDetail.SectionName, SectionName, LINE_LEN, NULL, NULL))
|
||||||
{
|
{
|
||||||
rc = GetLastError();
|
rc = GetLastError();
|
||||||
|
@ -671,12 +701,14 @@ NetClassInstaller(
|
||||||
L"Characteristics", SectionName, DriverInfoDetail.InfFileName, rc);
|
L"Characteristics", SectionName, DriverInfoDetail.InfFileName, rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupGetIntField(&InfContext, 1, &CharacteristicsInt))
|
if (!SetupGetIntField(&InfContext, 1, &CharacteristicsInt))
|
||||||
{
|
{
|
||||||
rc = GetLastError();
|
rc = GetLastError();
|
||||||
DPRINT("SetupGetIntField() failed with error 0x%lx\n", rc);
|
DPRINT("SetupGetIntField() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
Characteristics = (DWORD)CharacteristicsInt;
|
Characteristics = (DWORD)CharacteristicsInt;
|
||||||
if (IsEqualIID(&DeviceInfoData->ClassGuid, &GUID_DEVCLASS_NET))
|
if (IsEqualIID(&DeviceInfoData->ClassGuid, &GUID_DEVCLASS_NET))
|
||||||
{
|
{
|
||||||
|
@ -688,6 +720,7 @@ NetClassInstaller(
|
||||||
DPRINT("SetupGetStringFieldW() failed with error 0x%lx\n", rc);
|
DPRINT("SetupGetStringFieldW() failed with error 0x%lx\n", rc);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
BusType = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
BusType = HeapAlloc(GetProcessHeap(), 0, dwLength * sizeof(WCHAR));
|
||||||
if (!BusType)
|
if (!BusType)
|
||||||
{
|
{
|
||||||
|
@ -695,6 +728,7 @@ NetClassInstaller(
|
||||||
rc = ERROR_NOT_ENOUGH_MEMORY;
|
rc = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetupGetStringFieldW(&InfContext, 1, BusType, dwLength, NULL))
|
if (!SetupGetStringFieldW(&InfContext, 1, BusType, dwLength, NULL))
|
||||||
{
|
{
|
||||||
rc = GetLastError();
|
rc = GetLastError();
|
||||||
|
@ -712,6 +746,7 @@ NetClassInstaller(
|
||||||
rc = ERROR_GEN_FAILURE;
|
rc = ERROR_GEN_FAILURE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
RpcStatus = UuidToStringW(&Uuid, &UuidRpcString);
|
RpcStatus = UuidToStringW(&Uuid, &UuidRpcString);
|
||||||
if (RpcStatus != RPC_S_OK)
|
if (RpcStatus != RPC_S_OK)
|
||||||
{
|
{
|
||||||
|
@ -728,6 +763,7 @@ NetClassInstaller(
|
||||||
rc = ERROR_NOT_ENOUGH_MEMORY;
|
rc = ERROR_NOT_ENOUGH_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscpy(UuidString, L"{");
|
wcscpy(UuidString, L"{");
|
||||||
wcscat(UuidString, UuidRpcString);
|
wcscat(UuidString, UuidRpcString);
|
||||||
wcscat(UuidString, L"}");
|
wcscat(UuidString, L"}");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue