1 /*
2  * Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
3  * Use of this source code is governed by a BSD-style license that can be
4  * found in the LICENSE file.
5  */
6 
7 #include <Python.h>
8 #include <windows.h>
9 
10 // --- per-process functions
11 
12 static PyObject* psutil_proc_cmdline(PyObject* self, PyObject* args);
13 static PyObject* psutil_proc_cpu_affinity_get(PyObject* self, PyObject* args);
14 static PyObject* psutil_proc_cpu_affinity_set(PyObject* self, PyObject* args);
15 static PyObject* psutil_proc_cpu_times(PyObject* self, PyObject* args);
16 static PyObject* psutil_proc_create_time(PyObject* self, PyObject* args);
17 static PyObject* psutil_proc_cwd(PyObject* self, PyObject* args);
18 static PyObject* psutil_proc_exe(PyObject* self, PyObject* args);
19 static PyObject* psutil_proc_info(PyObject* self, PyObject* args);
20 static PyObject* psutil_proc_io_counters(PyObject* self, PyObject* args);
21 static PyObject* psutil_proc_is_suspended(PyObject* self, PyObject* args);
22 static PyObject* psutil_proc_kill(PyObject* self, PyObject* args);
23 static PyObject* psutil_proc_memory_info(PyObject* self, PyObject* args);
24 static PyObject* psutil_proc_memory_info_2(PyObject* self, PyObject* args);
25 static PyObject* psutil_proc_memory_maps(PyObject* self, PyObject* args);
26 static PyObject* psutil_proc_name(PyObject* self, PyObject* args);
27 static PyObject* psutil_proc_num_handles(PyObject* self, PyObject* args);
28 static PyObject* psutil_proc_open_files(PyObject* self, PyObject* args);
29 static PyObject* psutil_proc_priority_get(PyObject* self, PyObject* args);
30 static PyObject* psutil_proc_priority_set(PyObject* self, PyObject* args);
31 static PyObject* psutil_proc_resume(PyObject* self, PyObject* args);
32 static PyObject* psutil_proc_suspend(PyObject* self, PyObject* args);
33 static PyObject* psutil_proc_threads(PyObject* self, PyObject* args);
34 static PyObject* psutil_proc_username(PyObject* self, PyObject* args);
35 static PyObject* psutil_proc_wait(PyObject* self, PyObject* args);
36 
37 #if (PSUTIL_WINVER >= 0x0600)  // Windows Vista
38 static PyObject* psutil_proc_io_priority_get(PyObject* self, PyObject* args);
39 static PyObject* psutil_proc_io_priority_set(PyObject* self, PyObject* args);
40 #endif
41 
42 // --- system-related functions
43 
44 static PyObject* psutil_boot_time(PyObject* self, PyObject* args);
45 static PyObject* psutil_cpu_count_logical(PyObject* self, PyObject* args);
46 static PyObject* psutil_cpu_count_phys(PyObject* self, PyObject* args);
47 static PyObject* psutil_cpu_times(PyObject* self, PyObject* args);
48 static PyObject* psutil_disk_io_counters(PyObject* self, PyObject* args);
49 static PyObject* psutil_disk_partitions(PyObject* self, PyObject* args);
50 static PyObject* psutil_disk_usage(PyObject* self, PyObject* args);
51 static PyObject* psutil_net_connections(PyObject* self, PyObject* args);
52 static PyObject* psutil_net_io_counters(PyObject* self, PyObject* args);
53 static PyObject* psutil_per_cpu_times(PyObject* self, PyObject* args);
54 static PyObject* psutil_pid_exists(PyObject* self, PyObject* args);
55 static PyObject* psutil_pids(PyObject* self, PyObject* args);
56 static PyObject* psutil_ppid_map(PyObject* self, PyObject* args);
57 static PyObject* psutil_users(PyObject* self, PyObject* args);
58 static PyObject* psutil_virtual_mem(PyObject* self, PyObject* args);
59 static PyObject* psutil_net_if_addrs(PyObject* self, PyObject* args);
60 static PyObject* psutil_net_if_stats(PyObject* self, PyObject* args);
61 
62 // --- windows API bindings
63 
64 static PyObject* psutil_win32_QueryDosDevice(PyObject* self, PyObject* args);
65 
66 // --- internal
67 
68 int psutil_proc_suspend_or_resume(DWORD pid, int suspend);
69