Look for device specific layers
| 83 | |
| 84 | /// Look for device specific layers |
| 85 | static void LoadDeviceRegistry(DEVINST id, const QString &entry, std::vector<Path> &layers_paths) { |
| 86 | HKEY key; |
| 87 | if (CM_Open_DevNode_Key(id, KEY_QUERY_VALUE, 0, RegDisposition_OpenExisting, &key, CM_REGISTRY_SOFTWARE) != CR_SUCCESS) return; |
| 88 | |
| 89 | DWORD path_size; |
| 90 | if (RegQueryValueExW(key, (LPCWSTR)entry.utf16(), nullptr, nullptr, nullptr, &path_size) != ERROR_SUCCESS) { |
| 91 | RegCloseKey(key); |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | DWORD data_type; |
| 96 | wchar_t *path = new wchar_t[path_size]; |
| 97 | if (RegQueryValueExW(key, (LPCWSTR)entry.utf16(), nullptr, &data_type, (LPBYTE)path, &path_size) != ERROR_SUCCESS) { |
| 98 | delete[] path; |
| 99 | RegCloseKey(key); |
| 100 | return; |
| 101 | } |
| 102 | |
| 103 | if (data_type == REG_SZ || data_type == REG_MULTI_SZ) { |
| 104 | for (wchar_t *curr_filename = path; curr_filename[0] != '\0'; curr_filename += wcslen(curr_filename) + 1) { |
| 105 | layers_paths.push_back(QString::fromWCharArray(curr_filename).toStdString()); |
| 106 | |
| 107 | if (data_type == REG_SZ) { |
| 108 | break; |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | delete[] path; |
| 114 | RegCloseKey(key); |
| 115 | } |
| 116 | |
| 117 | /// This is for Windows only. It looks for device specific layers in the Windows registry. |
| 118 | std::vector<Path> LoadRegistrySystemLayers(const char *input_path) { |
no outgoing calls
no test coverage detected