Skip to content

Commit cd3003f

Browse files
committed
Add comment lines to ifs for win versions
1 parent efb026a commit cd3003f

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

psutil/_psutil_windows.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
#include <tchar.h>
1919
#include <tlhelp32.h>
2020
#include <winsock2.h>
21-
#if (_WIN32_WINNT >= 0x0600)
21+
#if (_WIN32_WINNT >= 0x0600) // Windows Vista, 7, 8, 8.1, 10
2222
#include <ws2tcpip.h>
2323
#endif
2424
#include <iphlpapi.h>
2525
#include <wtsapi32.h>
26-
#if (_WIN32_WINNT < 0x0600)
26+
#if (_WIN32_WINNT < 0x0600) // Windows XP / 2000
2727
#include <ws2tcpip.h>
2828
#endif
2929
#include <Winsvc.h>
@@ -90,7 +90,7 @@ typedef struct _DISK_PERFORMANCE_WIN_2008 {
9090

9191
// --- network connections mingw32 support
9292
#ifndef _IPRTRMIB_H
93-
#if (_WIN32_WINNT < 0x0600)
93+
#if (_WIN32_WINNT < 0x0600) // Windows XP / 2000
9494
typedef struct _MIB_TCP6ROW_OWNER_PID {
9595
UCHAR ucLocalAddr[16];
9696
DWORD dwLocalScopeId;
@@ -135,7 +135,7 @@ typedef struct _MIB_UDPTABLE_OWNER_PID {
135135
} MIB_UDPTABLE_OWNER_PID, *PMIB_UDPTABLE_OWNER_PID;
136136
#endif
137137

138-
#if (_WIN32_WINNT < 0x0600)
138+
#if (_WIN32_WINNT < 0x0600) // Windows XP / 2000
139139
typedef struct _MIB_UDP6ROW_OWNER_PID {
140140
UCHAR ucLocalAddr[16];
141141
DWORD dwLocalScopeId;
@@ -2176,10 +2176,10 @@ psutil_disk_usage(PyObject *self, PyObject *args) {
21762176
static PyObject *
21772177
psutil_net_io_counters(PyObject *self, PyObject *args) {
21782178
DWORD dwRetVal = 0;
2179-
#if (_WIN32_WINNT >= 0x0600)
2179+
#if (_WIN32_WINNT >= 0x0600) // Windows Vista, 7, 8, 8.1, 10
21802180
MIB_IF_ROW2 *pIfRow = NULL;
21812181
#endif
2182-
#if (_WIN32_WINNT < 0x0600)
2182+
#if (_WIN32_WINNT < 0x0600) // Windows 2000 / XP
21832183
MIB_IFROW *pIfRow = NULL;
21842184
#endif
21852185
PIP_ADAPTER_ADDRESSES pAddresses = NULL;
@@ -2198,26 +2198,23 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
21982198
while (pCurrAddresses) {
21992199
py_nic_name = NULL;
22002200
py_nic_info = NULL;
2201-
#if (_WIN32_WINNT >= 0x0600)
2201+
#if (_WIN32_WINNT >= 0x0600) // Windows Vista, 7, 8, 8.1, 10
22022202
pIfRow = (MIB_IF_ROW2 *) malloc(sizeof(MIB_IF_ROW2));
22032203
#endif
2204-
#if (_WIN32_WINNT < 0x0600)
2204+
#if (_WIN32_WINNT < 0x0600) // Windows 2000 / XP
22052205
pIfRow = (MIB_IFROW *) malloc(sizeof(MIB_IFROW));
22062206
#endif
22072207

22082208
if (pIfRow == NULL) {
22092209
PyErr_NoMemory();
22102210
goto error;
22112211
}
2212-
#if (_WIN32_WINNT >= 0x0600)
2212+
#if (_WIN32_WINNT >= 0x0600) // Windows Vista, 7, 8, 8.1, 10
22132213
SecureZeroMemory((PVOID)pIfRow, sizeof(MIB_IF_ROW2));
2214-
#endif
2215-
2216-
#if (_WIN32_WINNT >= 0x0600)
22172214
pIfRow->InterfaceIndex = pCurrAddresses->IfIndex;
22182215
dwRetVal = GetIfEntry2(pIfRow);
22192216
#endif
2220-
#if (_WIN32_WINNT < 0x0600)
2217+
#if (_WIN32_WINNT < 0x0600) // Windows 2000 / XP
22212218
pIfRow->dwIndex = pCurrAddresses->IfIndex;
22222219
dwRetVal = GetIfEntry(pIfRow);
22232220
#endif
@@ -2226,7 +2223,7 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
22262223
goto error;
22272224
}
22282225

2229-
#if (_WIN32_WINNT >= 0x0600)
2226+
#if (_WIN32_WINNT >= 0x0600) // Windows Vista, 7, 8, 8.1, 10
22302227
py_nic_info = Py_BuildValue("(KKKKKKKK)",
22312228
pIfRow->OutOctets,
22322229
pIfRow->InOctets,
@@ -2237,7 +2234,7 @@ psutil_net_io_counters(PyObject *self, PyObject *args) {
22372234
pIfRow->InDiscards,
22382235
pIfRow->OutDiscards);
22392236
#endif
2240-
#if (_WIN32_WINNT < 0x0600)
2237+
#if (_WIN32_WINNT < 0x0600) // Windows 2000 / XP
22412238
py_nic_info = Py_BuildValue("(kkkkkkkk)",
22422239
pIfRow->dwOutOctets,
22432240
pIfRow->dwInOctets,

0 commit comments

Comments
 (0)