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