1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/task_manager/os_resource_win.h"
7 namespace task_manager
{
9 void GetWinGDIHandles(base::ProcessHandle process
,
14 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights.
15 HANDLE current_process
= GetCurrentProcess();
16 HANDLE process_with_query_rights
;
17 if (DuplicateHandle(current_process
, process
, current_process
,
18 &process_with_query_rights
, PROCESS_QUERY_INFORMATION
,
20 *current
= GetGuiResources(process_with_query_rights
, GR_GDIOBJECTS
);
21 *peak
= GetGuiResources(process_with_query_rights
, GR_GDIOBJECTS_PEAK
);
22 CloseHandle(process_with_query_rights
);
26 void GetWinUSERHandles(base::ProcessHandle process
,
31 // Get a handle to |process| that has PROCESS_QUERY_INFORMATION rights.
32 HANDLE current_process
= GetCurrentProcess();
33 HANDLE process_with_query_rights
;
34 if (DuplicateHandle(current_process
, process
, current_process
,
35 &process_with_query_rights
, PROCESS_QUERY_INFORMATION
,
37 *current
= GetGuiResources(process_with_query_rights
, GR_USEROBJECTS
);
38 *peak
= GetGuiResources(process_with_query_rights
, GR_USEROBJECTS_PEAK
);
39 CloseHandle(process_with_query_rights
);
43 } // namespace task_manager