Skip to content

Commit c5e61fc

Browse files
committed
Global (Windows): removes Windows 7 support
1 parent 26ae4eb commit c5e61fc

11 files changed

Lines changed: 105 additions & 202 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ jobs:
690690
path: ./fastfetch-*.*
691691

692692
windows-hosts:
693-
name: Windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}
693+
name: Windows-${{ matrix.arch }}
694694
runs-on: ${{ matrix.runs-on }}
695695
permissions:
696696
security-events: write
@@ -703,22 +703,11 @@ jobs:
703703
msystem: CLANG64
704704
msystem-lower: clang64
705705
msys-arch: x86_64
706-
win7-compat-flag: OFF
707-
win7-compat-postfix: ""
708-
- arch: amd64
709-
runs-on: windows-latest
710-
msystem: CLANG64
711-
msystem-lower: clang64
712-
msys-arch: x86_64
713-
win7-compat-flag: ON
714-
win7-compat-postfix: "-win7"
715706
- arch: aarch64
716707
runs-on: windows-11-arm
717708
msystem: CLANGARM64
718709
msystem-lower: clangarm64
719710
msys-arch: aarch64
720-
win7-compat-flag: OFF
721-
win7-compat-postfix: ""
722711
defaults:
723712
run:
724713
shell: msys2 {0}
@@ -737,7 +726,7 @@ jobs:
737726
run: uname -a
738727

739728
- name: configure project
740-
run: env PKG_CONFIG_PATH=/${{ matrix.msystem-lower }}/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_WIN7_COMPAT=${{ matrix.win7-compat-flag }} .
729+
run: env PKG_CONFIG_PATH=/${{ matrix.msystem-lower }}/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DSET_TWEAK=Off -DBUILD_TESTS=On .
741730

742731
- name: build project
743732
run: cmake --build . --verbose -j4
@@ -768,7 +757,7 @@ jobs:
768757
name: upload artifacts for signing
769758
uses: actions/upload-artifact@v7
770759
with:
771-
name: fastfetch-windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}
760+
name: fastfetch-windows-${{ matrix.arch }}
772761
path: |
773762
*.dll
774763
fastfetch.exe
@@ -787,16 +776,16 @@ jobs:
787776
output-artifact-directory: '.'
788777

789778
- name: create zip archive
790-
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
779+
run: 7z a -tzip -mx9 -bd -y fastfetch-windows-${{ matrix.arch }}.zip LICENSE *.dll fastfetch.exe flashfetch.exe presets
791780

792781
- name: create 7z archive
793-
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
782+
run: 7z a -t7z -mx9 -bd -y fastfetch-windows-${{ matrix.arch }}.7z LICENSE *.dll fastfetch.exe flashfetch.exe presets
794783

795784
- name: upload true artifacts
796785
uses: actions/upload-artifact@v7
797786
with:
798-
name: fastfetch-windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}
799-
path: ./fastfetch-windows-${{ matrix.arch }}${{ matrix.win7-compat-postfix }}.*
787+
name: fastfetch-windows-${{ matrix.arch }}
788+
path: ./fastfetch-windows-${{ matrix.arch }}.*
800789
overwrite: true
801790

802791
release:

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# 2.60.0
22

33
Changes:
4-
* The CMake option `ENABLE_WIN7_COMPAT:BOOLEAN` now defaults to `OFF`
5-
* This follows the Windows 7 deprecation notice introduced in v2.57.0
6-
* The removal of Win7-compat code, however, is delayed to later version.
4+
* The CMake option `ENABLE_WIN7_COMPAT:BOOLEAN` is removed
5+
* The lowest supported Windows version is now Windows 8.1
6+
* Follows the Windows 7 deprecation notice introduced in v2.57.0
77
* `wm.detectPlugin` now defaults to `true` (WM)
88

99
Features:
@@ -94,7 +94,7 @@ Deprecation notice:
9494
* Support for Windows 7 (and 8.x) is deprecated and will be removed in a future release. Extended support for Windows 7 (and 8.1) ended on January 10, 2023. These versions do not officially support ANSI escape codes (running fastfetch on them requires a third-party terminal such as ConEmu). In addition, Windows 7 lacks some APIs used by fastfetch. Fastfetch currently loads these APIs dynamically at runtime to maintain compatibility, but this adds complexity to the codebase and increases the maintenance burden.
9595
* A CMake flag `ENABLE_WIN7_COMPAT:BOOLEAN` has been introduced (defaults to `ON` for now). If set to `OFF`, Windows 7 compatibility code is excluded, and the resulting binaries will support only Windows 10 (version 1607 and later) and Windows 11.
9696
* The main prebuilt Windows binaries on the Release page (`fastfetch-windows-amd64.*`) are built with `ENABLE_WIN7_COMPAT=OFF`. These are the binaries used by `scoop` and `winget`. Users who need Windows 7 (or 8.x) support can download the `-win7` variant instead.
97-
* ~~The `ENABLE_WIN7_COMPAT` CMake option and the `-win7` variant binaries are planned to be removed in 2.60.0~~.
97+
* The `ENABLE_WIN7_COMPAT` CMake option and the `-win7` variant binaries are planned to be removed in 2.60.0.
9898

9999
Features:
100100
* Supports COSMIC DE version detection (DE, Linux)

CMakeLists.txt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ option(ENABLE_EMBEDDED_AMDGPUIDS "Embed amdgpu.ids into fastfetch, requires `pyt
107107
option(ENABLE_WORDEXP "Enable using of wordexp(3) if available, instead of glob(3)" ON)
108108
option(ENABLE_LIBZFS "Enable libzfs" ON)
109109
if(WIN32 AND NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
110-
option(ENABLE_WIN7_COMPAT "Enable Windows 7 compatibility" OFF)
110+
option(ENABLE_WIN81_COMPAT "Enable legacy Windows compatibility (Windows 8.1 and later; Windows 7 unsupported)" ON)
111111
endif()
112112
if(APPLE)
113113
option(ENABLE_APPLE_MEMSIZE_USABLE "Use usable memory size as total memory size in Memory module, to match other systems" OFF)
@@ -168,8 +168,8 @@ endif()
168168
if(WIN32)
169169
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--tsaware -Wl,--build-id")
170170

171-
if(ENABLE_WIN7_COMPAT)
172-
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,console,--major-os-version,6,--minor-os-version,1")
171+
if(ENABLE_WIN81_COMPAT)
172+
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,console,--major-os-version,6,--minor-os-version,3")
173173
else()
174174
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,console,--major-os-version,10,--minor-os-version,0")
175175
endif()
@@ -1462,12 +1462,6 @@ if(WIN32)
14621462
if(HAVE_MSVC_MSIZE)
14631463
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_MSVC_MSIZE=1)
14641464
endif()
1465-
1466-
if(ENABLE_WIN7_COMPAT)
1467-
target_compile_definitions(libfastfetch PUBLIC FF_WIN7_COMPAT=1)
1468-
else()
1469-
target_compile_definitions(libfastfetch PUBLIC FF_WIN7_COMPAT=0)
1470-
endif()
14711465
else()
14721466
check_function_exists(malloc_usable_size HAVE_MALLOC_USABLE_SIZE)
14731467
if(HAVE_MALLOC_USABLE_SIZE)
@@ -1738,7 +1732,7 @@ elseif(WIN32)
17381732
PRIVATE "winbrand"
17391733
PRIVATE "secur32"
17401734
)
1741-
if(NOT ENABLE_WIN7_COMPAT)
1735+
if(NOT ENABLE_WIN81_COMPAT)
17421736
target_link_libraries(libfastfetch
17431737
PRIVATE "mincore"
17441738
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/fastfetch-cli/fastfetch)
1414
[![中文README](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-README-red)](README-cn.md)
1515

16-
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 7+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku and SunOS (illumos, Solaris).
16+
Fastfetch is a [neofetch](https://github.com/dylanaraps/neofetch)-like tool for fetching system information and displaying it in a visually appealing way. It is written mainly in C, with a focus on performance and customizability. Currently, it supports Linux, macOS, Windows 8.1+, Android, FreeBSD, OpenBSD, NetBSD, DragonFly, Haiku and SunOS (illumos, Solaris).
1717

1818
<img src="screenshots/example1.png" width="49%" align="left" />
1919
<img src="https://upload.wikimedia.org/wikipedia/commons/2/24/Transparent_Square_Tiles_Texture.png" width="49%" height="16px" align="left" />

src/common/impl/init.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,6 @@ void ffListFeatures(void)
252252
#if FF_HAVE_EMBEDDED_PCIIDS
253253
"Embedded pciids\n"
254254
#endif
255-
#if FF_WIN7_COMPAT
256-
"Windows 7 Compatibility\n"
257-
#endif
258255
#if FF_APPLE_MEMSIZE_USABLE
259256
"Apple memsize_usable\n"
260257
#endif

src/common/impl/processing_windows.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -154,30 +154,14 @@ const char* ffProcessReadOutput(FFProcessHandle* handle, FFstrbuf* buffer)
154154
switch (GetLastError())
155155
{
156156
case ERROR_IO_PENDING:
157-
#if !FF_WIN7_COMPAT
158157
if (!GetOverlappedResultEx(hChildPipeRead, &overlapped, &nRead, timeout < 0 ? INFINITE : (DWORD) timeout, FALSE))
159-
#else
160-
// To support Windows 7
161-
if (timeout >= 0 && WaitForSingleObject(hChildPipeRead, (DWORD) timeout) != WAIT_OBJECT_0)
162-
{
163-
CancelIo(hChildPipeRead);
164-
TerminateProcess(hProcess, 1);
165-
return "WaitForSingleObject(hChildPipeRead) failed or timeout (try increasing --processing-timeout)";
166-
}
167-
168-
if (!GetOverlappedResult(hChildPipeRead, &overlapped, &nRead, FALSE))
169-
#endif
170158
{
171159
if (GetLastError() == ERROR_BROKEN_PIPE)
172160
return NULL;
173161

174162
CancelIo(hChildPipeRead);
175163
TerminateProcess(hProcess, 1);
176-
return "GetOverlappedResult"
177-
#if !FF_WIN7_COMPAT
178-
"Ex"
179-
#endif
180-
"(hChildPipeRead) failed";
164+
return "GetOverlappedResultEx(hChildPipeRead) failed";
181165
}
182166
break;
183167

src/detection/bluetooth/bluetooth_windows.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@
99

1010
const char* ffDetectBluetooth(FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
1111
{
12-
// Actually bluetoothapis.dll, but it's missing on Windows 7
13-
FF_LIBRARY_LOAD_MESSAGE(bluetoothapis,
14-
#if FF_WIN7_COMPAT
15-
"bthprops.cpl"
16-
#else
17-
"bluetoothapis.dll"
18-
#endif
19-
, 1)
12+
FF_LIBRARY_LOAD_MESSAGE(bluetoothapis, "bluetoothapis.dll", 1)
2013
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindFirstDevice)
2114
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindNextDevice)
2215
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindDeviceClose)

src/detection/bluetoothradio/bluetoothradio_windows.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,7 @@ static_assert(sizeof(BTH_LOCAL_RADIO_INFO) == 292, "BTH_LOCAL_RADIO_INFO should
5454
const char* ffDetectBluetoothRadio(FFlist* devices /* FFBluetoothRadioResult */)
5555
{
5656
// Actually bluetoothapis.dll, but it's missing on Windows 7
57-
FF_LIBRARY_LOAD_MESSAGE(bluetoothapis,
58-
#if FF_WIN7_COMPAT
59-
"bthprops.cpl"
60-
#else
61-
"bluetoothapis.dll"
62-
#endif
63-
, 1)
57+
FF_LIBRARY_LOAD_MESSAGE(bluetoothapis, "bluetoothapis.dll", 1)
6458
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindFirstRadio)
6559
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindNextRadio)
6660
FF_LIBRARY_LOAD_SYMBOL_MESSAGE(bluetoothapis, BluetoothFindRadioClose)

src/detection/cpuusage/cpuusage_windows.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
#include "fastfetch.h"
21
#include "detection/cpuusage/cpuusage.h"
3-
42
#include "common/mallocHelper.h"
3+
#include "common/debug.h"
54

65
#include <ntstatus.h>
7-
#include <winternl.h>
86
#include <windows.h>
97
#include <wchar.h>
108
#include "common/windows/perflib_.h"
9+
#include "common/windows/nt.h"
1110

1211
static const char* getInfoByNqsi(FFlist* cpuTimes)
1312
{
@@ -155,20 +154,17 @@ static const char* getInfoByPerflib(FFlist* cpuTimes)
155154

156155
const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
157156
{
158-
#if !FF_WIN7_COMPAT
159-
static uint8_t winver = 10; // Assume Windows 10 or later for WoA
160-
#else
161-
static uint8_t winver = 0;
162-
if (winver == 0)
163-
winver = (uint8_t) ffStrbufToUInt(&instance.state.platform.sysinfo.release, 1);
164-
#endif
165-
166-
if (winver >= 10)
157+
const char* error;
158+
159+
if (SharedUserData->NtMajorVersion >= 10)
167160
{
168-
if (getInfoByPerflib(cpuTimes) == NULL) return NULL;
161+
error = getInfoByPerflib(cpuTimes);
162+
FF_DEBUG("Get CPU usage info by Perflib: %s", error ?: "success");
163+
if (!error) return NULL;
169164
ffListClear(cpuTimes);
170-
winver = 1; // Fall back to NQSI
171165
}
172166

173-
return getInfoByNqsi(cpuTimes);
167+
error = getInfoByNqsi(cpuTimes);
168+
FF_DEBUG("Get CPU usage info by NtQuerySystemInformation: %s", error ?: "success");
169+
return error;
174170
}

src/detection/displayserver/displayserver_windows.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,6 @@ BOOL WINAPI GetDpiForMonitorInternal(HMONITOR hmonitor, MONITOR_DPI_TYPE dpiType
1111

1212
static void detectDisplays(FFDisplayServerResult* ds)
1313
{
14-
#if FF_WIN7_COMPAT
15-
static __typeof__(GetDpiForMonitorInternal)* ffGetDpiForMonitor;
16-
if (!ffGetDpiForMonitor)
17-
{
18-
HMODULE user32 = GetModuleHandleW(L"user32.dll");
19-
if (user32)
20-
{
21-
// GetDpiForMonitorInternal (returns BOOL) is in user32, while GetDpiForMonitor (returns HRESULT) is in shcore.
22-
// Both are available since Windows 8.1. Not sure why Microsoft decided to put them in different DLLs, but whatever.
23-
// Use GetDpiForMonitorInternal for loading one less dll
24-
ffGetDpiForMonitor = (void*) GetProcAddress(user32, "GetDpiForMonitorInternal");
25-
}
26-
}
27-
#else
28-
#define ffGetDpiForMonitor GetDpiForMonitorInternal
29-
#endif
30-
3114
DISPLAYCONFIG_PATH_INFO paths[128];
3215
uint32_t pathCount = ARRAY_SIZE(paths);
3316
DISPLAYCONFIG_MODE_INFO modes[256];
@@ -145,15 +128,11 @@ static void detectDisplays(FFDisplayServerResult* ds)
145128
}
146129

147130
uint32_t systemDpi = 0;
148-
149-
if (ffGetDpiForMonitor)
131+
HMONITOR hMonitor = MonitorFromPoint(*(POINT*)&sourceMode->position, MONITOR_DEFAULTTONULL);
132+
if (hMonitor)
150133
{
151-
HMONITOR hMonitor = MonitorFromPoint(*(POINT*)&sourceMode->position, MONITOR_DEFAULTTONULL);
152-
if (hMonitor)
153-
{
154-
UINT ignored;
155-
ffGetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &systemDpi, &ignored);
156-
}
134+
UINT ignored;
135+
GetDpiForMonitorInternal(hMonitor, MDT_EFFECTIVE_DPI, &systemDpi, &ignored);
157136
}
158137

159138
if (systemDpi == 0)

0 commit comments

Comments
 (0)