MCPcopy Create free account
hub / github.com/NullArray/WinKernel-Resources / SetHwidCallback

Function SetHwidCallback

Drivers/Driver-SRC/setup/devcon/cmds.cpp:1976–2181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1974}
1975
1976int SetHwidCallback(_In_ HDEVINFO Devs, _In_ PSP_DEVINFO_DATA DevInfo, _In_ DWORD Index, _In_ LPVOID Context)
1977/*++
1978
1979Routine Description:
1980
1981 Callback for use by SetHwid
1982
1983Arguments:
1984
1985 Devs )_ uniquely identify the device
1986 DevInfo )
1987 Index - index of device
1988 Context - SetHwidContext
1989
1990Return Value:
1991
1992 EXIT_xxxx
1993
1994--*/
1995{
1996 SetHwidContext *pControlContext = (SetHwidContext*)Context;
1997 ULONG status;
1998 ULONG problem;
1999 LPTSTR * hwlist = NULL;
2000 bool modified = false;
2001 int result = EXIT_FAIL;
2002
2003 //
2004 // processes the sub-commands on each callback
2005 // not most efficient way of doing things, but perf isn't important
2006 //
2007 TCHAR devID[MAX_DEVICE_ID_LEN];
2008 SP_DEVINFO_LIST_DETAIL_DATA devInfoListDetail;
2009
2010 UNREFERENCED_PARAMETER(Index);
2011
2012 devInfoListDetail.cbSize = sizeof(devInfoListDetail);
2013 if((!SetupDiGetDeviceInfoListDetail(Devs,&devInfoListDetail)) ||
2014 (CM_Get_Device_ID_Ex(DevInfo->DevInst,devID,MAX_DEVICE_ID_LEN,0,devInfoListDetail.RemoteMachineHandle)!=CR_SUCCESS) ||
2015 (CM_Get_DevNode_Status_Ex(&status,&problem,DevInfo->DevInst,0,devInfoListDetail.RemoteMachineHandle)!=CR_SUCCESS)) {
2016 //
2017 // skip this
2018 //
2019 return EXIT_OK;
2020 }
2021 //
2022 // this is how to verify it's root enumerated
2023 //
2024 if(!(status & DN_ROOT_ENUMERATED)) {
2025 _tprintf(TEXT("%-60s: "),devID);
2026 FormatToStream(stdout,MSG_SETHWID_NOTROOT);
2027 pControlContext->skipped++;
2028 return EXIT_OK;
2029 }
2030 hwlist = GetDevMultiSz(Devs,DevInfo,pControlContext->prop);
2031 if(hwlist == NULL) {
2032 hwlist = CopyMultiSz(NULL);
2033 if(hwlist == NULL) {

Callers

nothing calls this directly

Calls 4

FormatToStreamFunction · 0.85
GetDevMultiSzFunction · 0.85
CopyMultiSzFunction · 0.85
DelMultiSzFunction · 0.85

Tested by

no test coverage detected