Used by crash handler in https://bugs.winehq.org/show_bug.cgi?id=58752
Test program: [test.c](/uploads/c61409fde0a02e07abce6ebec725e49b/test.c)
Oddly, on Windows 11 I get: WINDOWS_SHORT: Windows 10 WINDOWS_LONG: Windows 11 Pro
But, since Wine defaults to Windows 10, I opted to use Windows 10 for both.
Ideally, we should probably use the configured Windows version, but I wasn't sure how to approach that.
From: Esme Povirk esme@codeweavers.com
--- configure.ac | 1 + dlls/winbrand/Makefile.in | 1 + dlls/winbrand/winbrand.spec | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 dlls/winbrand/Makefile.in create mode 100644 dlls/winbrand/winbrand.spec
diff --git a/configure.ac b/configure.ac index c45b1f83d5e..6b433123b12 100644 --- a/configure.ac +++ b/configure.ac @@ -3295,6 +3295,7 @@ WINE_CONFIG_MAKEFILE(dlls/win32u/tests) WINE_CONFIG_MAKEFILE(dlls/win87em.dll16) WINE_CONFIG_MAKEFILE(dlls/winaspi.dll16) WINE_CONFIG_MAKEFILE(dlls/winbio) +WINE_CONFIG_MAKEFILE(dlls/winbrand) WINE_CONFIG_MAKEFILE(dlls/windebug.dll16) WINE_CONFIG_MAKEFILE(dlls/windows.applicationmodel) WINE_CONFIG_MAKEFILE(dlls/windows.applicationmodel/tests) diff --git a/dlls/winbrand/Makefile.in b/dlls/winbrand/Makefile.in new file mode 100644 index 00000000000..bdccbbf66ee --- /dev/null +++ b/dlls/winbrand/Makefile.in @@ -0,0 +1 @@ +MODULE = winbrand.dll diff --git a/dlls/winbrand/winbrand.spec b/dlls/winbrand/winbrand.spec new file mode 100644 index 00000000000..bbc175d2b1d --- /dev/null +++ b/dlls/winbrand/winbrand.spec @@ -0,0 +1,15 @@ +@ stub BrandingFormatString +@ stub BrandingFormatStringForEdition +@ stub BrandingLoadBitmap +@ stub BrandingLoadCursor +@ stub BrandingLoadIcon +@ stub BrandingLoadImage +@ stub BrandingLoadNeutralStringForEdition +@ stub BrandingLoadString +@ stub BrandingLoadStringForEdition +@ stub GetEULAFile +@ stub GetEULAFileEx +@ stub GetEULAInCurrentUILanguage +@ stub GetHinstanceByNamespace +@ stub GetInstalledEULAPath +@ stub InstallEULA
From: Esme Povirk esme@codeweavers.com
--- dlls/winbrand/Makefile.in | 3 +++ dlls/winbrand/main.c | 53 +++++++++++++++++++++++++++++++++++++ dlls/winbrand/winbrand.spec | 2 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 dlls/winbrand/main.c
diff --git a/dlls/winbrand/Makefile.in b/dlls/winbrand/Makefile.in index bdccbbf66ee..bd8ce7c9c75 100644 --- a/dlls/winbrand/Makefile.in +++ b/dlls/winbrand/Makefile.in @@ -1 +1,4 @@ MODULE = winbrand.dll + +SOURCES = \ + main.c diff --git a/dlls/winbrand/main.c b/dlls/winbrand/main.c new file mode 100644 index 00000000000..3bdc9796da2 --- /dev/null +++ b/dlls/winbrand/main.c @@ -0,0 +1,53 @@ +/* + * Copyright 2025 Esme Povirk for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winternl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winbrand); + +LPWSTR WINAPI BrandingFormatString(LPWSTR format) +{ + const WCHAR* env = L"WINDOWS_SHORT=Windows 10\0WINDOWS_LONG=Windows 10 Pro\0"; + NTSTATUS stat; + SIZE_T len; + LPWSTR result; + + FIXME("%s: semi-stub\n", debugstr_w(format)); + + stat = RtlExpandEnvironmentStrings(env, format, wcslen(format), NULL, 0, &len); + if (stat != STATUS_SUCCESS && stat != STATUS_BUFFER_TOO_SMALL) + return NULL; + + result = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!result) + return NULL; + + stat = RtlExpandEnvironmentStrings(env, format, wcslen(format), result, len, NULL); + if (stat != STATUS_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, result); + return NULL; + } + + return result; +} diff --git a/dlls/winbrand/winbrand.spec b/dlls/winbrand/winbrand.spec index bbc175d2b1d..783f1ea7a20 100644 --- a/dlls/winbrand/winbrand.spec +++ b/dlls/winbrand/winbrand.spec @@ -1,4 +1,4 @@ -@ stub BrandingFormatString +@ stdcall BrandingFormatString(wstr) @ stub BrandingFormatStringForEdition @ stub BrandingLoadBitmap @ stub BrandingLoadCursor