bool CRootNode::SetupNode() { // Load the bitmap we'll be using as the root image HBITMAP hRootImage; hRootImage = LoadBitmapW(g_hThisInstance, MAKEINTRESOURCEW(IDB_ROOT_IMAGE)); if (hRootImage == NULL) return FALSE; // Add this bitmap to the device image list. This is a bit hacky, but it's safe m_ClassImage = ImageList_Add(m_ImageListData->ImageList, hRootImage, NULL); DeleteObject(hRootImage); // Get the root instance CONFIGRET cr; cr = CM_Locate_DevNodeW(&m_DevInst, NULL, CM_LOCATE_DEVNODE_NORMAL); if (cr != CR_SUCCESS) { return false; } // The root name is the computer name DWORD Size = DISPLAY_NAME_LEN; GetComputerNameW(m_DisplayName, &Size); return true; }
static PWSTR pCDevSettings_GetDeviceInstanceId(const WCHAR *pszDevice) { DEVINST DevInst; CONFIGRET cr; ULONG BufLen; LPWSTR lpDevInstId = NULL; DPRINT1("CDevSettings::GetDeviceInstanceId(%ws) UNIMPLEMENTED!\n", pszDevice); cr = CM_Locate_DevNodeW(&DevInst, (DEVINSTID_W)pszDevice, CM_LOCATE_DEVNODE_NORMAL); if (cr == CR_SUCCESS) { DPRINT1("Success1\n"); cr = CM_Get_Device_ID_Size(&BufLen, DevInst, 0); if (cr == CR_SUCCESS) { DPRINT1("Success2\n"); lpDevInstId = LocalAlloc(LMEM_FIXED, (BufLen + 1) * sizeof(WCHAR)); if (lpDevInstId != NULL) { DPRINT1("Success3\n"); cr = CM_Get_Device_IDW(DevInst, lpDevInstId, BufLen, 0); if (cr != CR_SUCCESS) { LocalFree((HLOCAL)lpDevInstId); lpDevInstId = NULL; } DPRINT1("instance id: %ws\n", lpDevInstId); } } } return lpDevInstId; }