Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# dlfcn-win32 patches: keep exact bytes (prevents LF/CRLF munging)
depends/windows/dlfcn-win32/*.patch -text
depends/windowsstore/dlfcn-win32/*.patch -text
Comment thread
garbear marked this conversation as resolved.
57 changes: 57 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
ARCHITECTURE: x64
CONFIGURATION: Release
WINSTORE: -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION="10.0.22621.0"
USE_PATCH_WRAPPER: 'true'

workspace:
clean: all
Expand All @@ -54,12 +55,68 @@ jobs:
echo $(app_id) . . > definition/$(app_id)/$(app_id).txt
mklink /J "$(Pipeline.Workspace)/$(app_id)" "$(Build.SourcesDirectory)"

- powershell: |
$patchDir = 'C:\Strawberry\c\bin'
$patchExe = Join-Path $patchDir 'patch.exe'
$realExe = Join-Path $patchDir 'patch-real.exe'
$src = Join-Path $env:TEMP 'patch-wrapper.cs'
$out = Join-Path $patchDir 'patch.exe'

if (-not (Test-Path $realExe)) {
Rename-Item $patchExe 'patch-real.exe'
}

@'
using System;
using System.Diagnostics;

class PatchWrapper
{
static int Main(string[] args)
{
var psi = new ProcessStartInfo();
psi.FileName = @"C:\Strawberry\c\bin\patch-real.exe";
psi.UseShellExecute = false;

var quoted = new string[args.Length];
for (int i = 0; i < args.Length; i++)
quoted[i] = "\"" + args[i].Replace("\"", "\\\"") + "\"";

bool useBinary = false;
for (int i = 0; i < args.Length; i++)
{
if (args[i].IndexOf("dlfcn-win32", StringComparison.OrdinalIgnoreCase) >= 0)
{
useBinary = true;
break;
}
}

psi.Arguments =
(useBinary ? "--binary " : "") + string.Join(" ", quoted);

var p = Process.Start(psi);
p.WaitForExit();
return p.ExitCode;
}
}
'@ | Set-Content $src -Encoding Ascii

& "$env:WINDIR\Microsoft.NET\Framework64\v4.0.30319\csc.exe" `
/nologo /target:exe /out:$out $src
displayName: "Replace Strawberry patch.exe with --binary wrapper"
condition: and(succeeded(), eq(variables['USE_PATCH_WRAPPER'], 'true'))

- task: CMake@1
env:
PATHEXT: $(PATHEXT)
inputs:
workingDirectory: 'build'
cmakeArgs: '-T host=x64 -G "$(GENERATOR)" -A $(ARCHITECTURE) $(WINSTORE) -DADDONS_TO_BUILD=$(app_id) -DCMAKE_BUILD_TYPE=$(CONFIGURATION) -DADDONS_DEFINITION_DIR=$(Pipeline.Workspace)/$(app_id)/build/definition -DADDON_SRC_PREFIX=../.. -DCMAKE_INSTALL_PREFIX=../../kodi/addons -DPACKAGE_ZIP=1 ../../kodi/cmake/addons'

- task: CMake@1
env:
PATHEXT: $(PATHEXT)
inputs:
workingDirectory: 'build'
cmakeArgs: '--build . --config $(CONFIGURATION) --target $(app_id)'

This file was deleted.

57 changes: 34 additions & 23 deletions depends/windows/dlfcn-win32/0001-dlopen_with_widechar.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
diff --git a/dlfcn.c b/dlfcn.c
index 69670d1..8d2dbc0 100644
--- a/dlfcn.c
+++ b/dlfcn.c
@@ -264,8 +264,19 @@ void *dlopen( const char *file, int mode )
* to UNIX's search paths (start with system folders instead of current
* folder).
*/
- hModule = LoadLibraryExA(lpFileName, NULL,
- LOAD_WITH_ALTERED_SEARCH_PATH );
+ int wide_len = MultiByteToWideChar(CP_UTF8, 0, lpFileName, -1, 0, 0);
+ if (wide_len > 0)
+ {
+ wchar_t* lpFileNameW = (wchar_t*)malloc(wide_len * sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, lpFileName, -1, lpFileNameW, wide_len);
From 262365e15599077a3a69da43078f1f5193aa3061 Mon Sep 17 00:00:00 2001
From: Garrett Brown <themagnificentmrb@gmail.com>
Date: Sun, 1 Mar 2026 00:15:29 -0800
Subject: [PATCH] dlopen with widechar

---
src/dlfcn.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/dlfcn.c b/src/dlfcn.c
index cb9f9bb..82e0c1e 100644
--- a/src/dlfcn.c
+++ b/src/dlfcn.c
@@ -415,7 +415,19 @@ void *dlopen( const char *file, int mode )
* to UNIX's search paths (start with system folders instead of current
* folder).
*/
- hModule = LoadLibraryExA( lpFileName, NULL, LOAD_WITH_ALTERED_SEARCH_PATH );
+ int wide_len = MultiByteToWideChar(CP_UTF8, 0, lpFileName, -1, 0, 0);
+ if (wide_len > 0)
+ {
+ wchar_t* lpFileNameW = (wchar_t*)malloc(wide_len * sizeof(wchar_t));
+ MultiByteToWideChar(CP_UTF8, 0, lpFileName, -1, lpFileNameW, wide_len);
+
+ hModule = LoadLibraryExW(lpFileNameW, NULL,
+ LOAD_WITH_ALTERED_SEARCH_PATH );
+ hModule = LoadLibraryExW(lpFileNameW, NULL,
+ LOAD_WITH_ALTERED_SEARCH_PATH );
+
+ free(lpFileNameW);
+ }
+ else
+ hModule = 0;
+ free(lpFileNameW);
+ }
+ else
+ hModule = 0;

if( MyEnumProcessModules( hCurrentProc, NULL, 0, &dwProcModsAfter ) == 0 )
dwProcModsAfter = 0;
if( !hModule )
{
--
2.52.0

2 changes: 1 addition & 1 deletion depends/windows/dlfcn-win32/dlfcn-win32.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f18a412e84d8b701e61a78252411fe8c72587f52417c1ef21ca93604de1b9c55
f61a874bc9163ab488accb364fd681d109870c86e8071f4710cbcdcbaf9f2565
2 changes: 1 addition & 1 deletion depends/windows/dlfcn-win32/dlfcn-win32.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dlfcn-win32 https://github.com/dlfcn-win32/dlfcn-win32/archive/v1.2.0.tar.gz
dlfcn-win32 https://github.com/dlfcn-win32/dlfcn-win32/archive/v1.4.2.tar.gz

This file was deleted.

Loading