Add Windows resource
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-03-04 15:59:10 +01:00
parent 60ee85c55b
commit b511ae8ad7
4 changed files with 98 additions and 0 deletions

View file

@ -9,6 +9,16 @@ mktest_LDFLAGS = -framework CoreFoundation -framework DiskArbitration
mkstream_LDFLAGS = -framework CoreFoundation -framework DiskArbitration
endif
# Windows
if HOST_WINDOWS
snapraid_LDADD = resource_res.o
resource_res.o: cmdline/resource.rc cmdline/resource.manifest
$(WINDRES) --include-dir=. --include-dir=$(srcdir) $< -o $@
CLEANFILES = resource_res.o
endif
snapraid_SOURCES = \
raid/raid.c \
raid/check.c \
@ -151,6 +161,8 @@ EXTRA_DIST = \
test/test-par6-rename.conf \
test/test-par6-thermal.conf \
snapraid.conf.example \
cmdline/resource.rc \
cmdline/resource.manifest \
configure.windows-x86 configure.windows-x64 snapraid.conf.example.windows \
acinclude.m4 \
tommyds/LICENSE \

40
cmdline/resource.manifest Normal file
View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- SnapRAID Windows Daemon Manifest -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="*"
name="snapraid"
type="win32"
/>
<description>SnapRAID Windows Daemon Service</description>
<!-- UAC PRIVILEGES: Forces 'requireAdministrator' so the daemon can access physical disks. -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<!-- OS COMPATIBILITY: Declares support for Win 10/11 to prevent 'Version Lying'. -->
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- Enables paths longer than 260 characters for deep backup trees. -->
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
<!-- Sets ANSI code page to UTF-8 so fopen() works like it does on Linux. -->
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
<!-- Enables the more efficient Segment Heap. -->
<heapType xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">SegmentHeap</heapType>
</windowsSettings>
</application>
</assembly>

35
cmdline/resource.rc Normal file
View file

@ -0,0 +1,35 @@
#include <windows.h>
#include "../config.h"
1 RT_MANIFEST "resource.manifest"
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
// 0409 = US English; 04b0 = Unicode (UTF-16)
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Andrea Mazzoleni"
VALUE "FileDescription", "SnapRAID CLI"
VALUE "FileVersion", PACKAGE_VERSION
VALUE "InternalName", "snapraid"
VALUE "LegalCopyright", "Copyright (C) 2026 Andrea Mazzoleni"
VALUE "OriginalFilename", "snapraid.exe"
VALUE "ProductName", "SnapRAID"
VALUE "ProductVersion", PACKAGE_VERSION
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -19,6 +19,17 @@ AC_CHECK_PROG([SDE],[sde64],[sde64],[])
AC_CHECK_PROG([ADVD2],[advd2],[advd2],[])
AM_CONDITIONAL(HAVE_ADVD2, [test x"$ADVD2" != x])
# Check if we are targeting Windows
is_windows=no
AS_CASE([$host_os], [mingw*|msys*|cygwin*], [is_windows=yes])
AM_CONDITIONAL([HOST_WINDOWS], [test "x$is_windows" = "xyes"])
# Check for Windows-specific tools only if on Windows
if test "x$is_windows" = "xyes"; then
AC_CHECK_TOOL([WINDMC], [windmc])
AC_CHECK_TOOL([WINDRES], [windres])
fi
dnl Options to improve stacktrace (some disabled as no crash reported by years)
AC_CHECK_CC_OPT([-fno-omit-frame-pointer], CFLAGS="$CFLAGS -fno-omit-frame-pointer", [])
# AC_CHECK_CC_OPT([-fno-inline-functions-called-once], CFLAGS="$CFLAGS -fno-inline-functions-called-once", [])