Skip to content

Commit

Permalink
Add *NdisDeviceType=1 key to registry for Loopback adapter. Fixes nma…
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Jan 19, 2017
1 parent 73eb22b commit a9b7f9e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packetWin7/NPFInstall/NPFInstall/LoopbackInstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Module Name:
#include "debug.h"

#include <shlobj.h>
#include <ntddndis.h>

#define BUF_SIZE 255
#define ADAPTER_SIZE 255
Expand Down Expand Up @@ -1118,18 +1119,21 @@ Return Value:
newdevMod = LoadLibrary(TEXT("newdev.dll"));
if (!newdevMod)
{
TRACE_PRINT1("LoadLibrary failed: %x", GetLastError());
goto final;
}
UpdateFn = (UpdateDriverForPlugAndPlayDevicesProto) GetProcAddress(newdevMod, UPDATEDRIVERFORPLUGANDPLAYDEVICES);
if (!UpdateFn)
{
TRACE_PRINT1("GetProcAddress failed to get UpdateDriverForPlugAndPlayDevices: %x", GetLastError());
goto final;
}

FormatToStream(stdout, inf ? MSG_UPDATE_INF : MSG_UPDATE, hwid, inf);

if (!UpdateFn(NULL, hwid, inf, flags, &reboot))
{
TRACE_PRINT1("UpdateFn failed: %x", GetLastError());
goto final;
}

Expand Down Expand Up @@ -1315,6 +1319,26 @@ Return Value:
//
failcode = cmdUpdate(BaseName, Machine, Flags, argc, argv);

// Mark device as an endpoint, not a network
HKEY DevRegKey = SetupDiCreateDevRegKey(DeviceInfoSet,
&DeviceInfoData,
DICS_FLAG_GLOBAL,
0,
DIREG_DRV,
NULL,
NULL
);
if (DevRegKey != INVALID_HANDLE_VALUE)
{
DWORD devtype = NDIS_DEVICE_TYPE_ENDPOINT; // 1
if (ERROR_SUCCESS != RegSetValueEx(DevRegKey,
TEXT("*NdisDeviceType"), 0, REG_DWORD, (const BYTE *)&devtype, sizeof(devtype))) {
TRACE_PRINT1("Couldn't set *NdisDeviceType: %x", GetLastError());// Oops. Hope this isn't a problem.
}
RegCloseKey(DevRegKey);
}
else{ TRACE_PRINT1("Couldn't create/open dev reg key: %x", GetLastError()); }

final:

if (DeviceInfoSet != INVALID_HANDLE_VALUE)
Expand Down

0 comments on commit a9b7f9e

Please sign in to comment.