diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 23:30:23 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 23:30:23 +0000 |
commit | 1eef1c588c77f15b47f4e3c177dfd2542e7c4bde (patch) | |
tree | b1a76571792a53f9883bdaf299e2a5301b149285 /content | |
parent | 1555122720ea4f0bbc17e28ae6ab12954782ceaa (diff) | |
download | chromium_src-1eef1c588c77f15b47f4e3c177dfd2542e7c4bde.zip chromium_src-1eef1c588c77f15b47f4e3c177dfd2542e7c4bde.tar.gz chromium_src-1eef1c588c77f15b47f4e3c177dfd2542e7c4bde.tar.bz2 |
Win: content/gpu has hard dependency on setupapi.dll.
For some reason it was loaded dynamically but it has been supported since Win 2000:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff551963(v=vs.85).aspx
This is to address an issue whereby the DLL cannot be loaded once the sandbox is enabled on some systems.
BUG=112205
Review URL: https://chromiumcodereview.appspot.com/9382019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121565 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/content_gpu.gypi | 5 | ||||
-rw-r--r-- | content/gpu/gpu_info_collector_win.cc | 59 |
2 files changed, 9 insertions, 55 deletions
diff --git a/content/content_gpu.gypi b/content/content_gpu.gypi index 6afa7e2..c31b081 100644 --- a/content/content_gpu.gypi +++ b/content/content_gpu.gypi @@ -39,6 +39,11 @@ '../third_party/angle/src/build_angle.gyp:libEGL', '../third_party/angle/src/build_angle.gyp:libGLESv2', ], + 'link_settings': { + 'libraries': [ + '-lsetupapi.lib', + ], + }, }], ['OS=="win" and directxsdk_exists=="True"', { 'actions': [ diff --git a/content/gpu/gpu_info_collector_win.cc b/content/gpu/gpu_info_collector_win.cc index 1736f43..13645f7 100644 --- a/content/gpu/gpu_info_collector_win.cc +++ b/content/gpu/gpu_info_collector_win.cc @@ -34,31 +34,6 @@ std::string VersionNumberToString(uint32 version_number) { } // namespace anonymous -// Setup API functions -typedef HDEVINFO (WINAPI*SetupDiGetClassDevsWFunc)( - CONST GUID *ClassGuid, - PCWSTR Enumerator, - HWND hwndParent, - DWORD Flags -); -typedef BOOL (WINAPI*SetupDiEnumDeviceInfoFunc)( - HDEVINFO DeviceInfoSet, - DWORD MemberIndex, - PSP_DEVINFO_DATA DeviceInfoData -); -typedef BOOL (WINAPI*SetupDiGetDeviceRegistryPropertyWFunc)( - HDEVINFO DeviceInfoSet, - PSP_DEVINFO_DATA DeviceInfoData, - DWORD Property, - PDWORD PropertyRegDataType, - PBYTE PropertyBuffer, - DWORD PropertyBufferSize, - PDWORD RequiredSize -); -typedef BOOL (WINAPI*SetupDiDestroyDeviceInfoListFunc)( - HDEVINFO DeviceInfoSet -); - namespace gpu_info_collector { bool CollectGraphicsInfo(content::GPUInfo* gpu_info) { @@ -186,36 +161,11 @@ bool CollectVideoCardInfo(content::GPUInfo* gpu_info) { bool CollectDriverInfoD3D(const std::wstring& device_id, content::GPUInfo* gpu_info) { - HMODULE lib_setupapi = LoadLibraryW(L"setupapi.dll"); - if (!lib_setupapi) { - LOG(ERROR) << "Open setupapi.dll failed"; - return false; - } - SetupDiGetClassDevsWFunc fp_get_class_devs = - reinterpret_cast<SetupDiGetClassDevsWFunc>( - GetProcAddress(lib_setupapi, "SetupDiGetClassDevsW")); - SetupDiEnumDeviceInfoFunc fp_enum_device_info = - reinterpret_cast<SetupDiEnumDeviceInfoFunc>( - GetProcAddress(lib_setupapi, "SetupDiEnumDeviceInfo")); - SetupDiGetDeviceRegistryPropertyWFunc fp_get_device_registry_property = - reinterpret_cast<SetupDiGetDeviceRegistryPropertyWFunc>( - GetProcAddress(lib_setupapi, "SetupDiGetDeviceRegistryPropertyW")); - SetupDiDestroyDeviceInfoListFunc fp_destroy_device_info_list = - reinterpret_cast<SetupDiDestroyDeviceInfoListFunc>( - GetProcAddress(lib_setupapi, "SetupDiDestroyDeviceInfoList")); - if (!fp_get_class_devs || !fp_enum_device_info || - !fp_get_device_registry_property || !fp_destroy_device_info_list) { - FreeLibrary(lib_setupapi); - LOG(ERROR) << "Retrieve setupapi.dll functions failed"; - return false; - } - // create device info for the display device - HDEVINFO device_info = fp_get_class_devs( + HDEVINFO device_info = SetupDiGetClassDevsW( NULL, device_id.c_str(), NULL, DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES); if (device_info == INVALID_HANDLE_VALUE) { - FreeLibrary(lib_setupapi); LOG(ERROR) << "Creating device info failed"; return false; } @@ -224,9 +174,9 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, bool found = false; SP_DEVINFO_DATA device_info_data; device_info_data.cbSize = sizeof(device_info_data); - while (fp_enum_device_info(device_info, index++, &device_info_data)) { + while (SetupDiEnumDeviceInfo(device_info, index++, &device_info_data)) { WCHAR value[255]; - if (fp_get_device_registry_property(device_info, + if (SetupDiGetDeviceRegistryPropertyW(device_info, &device_info_data, SPDRP_DRIVER, NULL, @@ -263,8 +213,7 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, } } } - fp_destroy_device_info_list(device_info); - FreeLibrary(lib_setupapi); + SetupDiDestroyDeviceInfoList(device_info); return found; } |