From 72c2f487746fccfc57bdfe48169b4acba6aeead0 Mon Sep 17 00:00:00 2001 From: Andre Heider Date: Mon, 15 Apr 2019 18:52:38 +0200 Subject: [PATCH] ninewinecfg: add unix_filename() helper function Converts a windows ANSI filename to a unix filename. Use wine_get_unix_file_name() from winbase.h instead of wine_nt_to_unix_file_name() like the current file functions do. That eventually allows us to stop including winternl.h. --- ninewinecfg/main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ninewinecfg/main.c b/ninewinecfg/main.c index 00c1e03..b8f78fa 100644 --- a/ninewinecfg/main.c +++ b/ninewinecfg/main.c @@ -126,6 +126,26 @@ static BOOL Call64bitNineWineCfg(BOOL state) return res; } +static char *unix_filename(const LPCSTR filename) +{ + int len; + WCHAR *filename_w; + char *filename_u; + + len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); + filename_w = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (!filename_w) + return NULL; + + MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len); + + filename_u = wine_get_unix_file_name(filename_w); + + HeapFree(GetProcessHeap(), 0, filename_w); + + return filename_u; +} + /* helper functions taken from NTDLL and KERNEL32 */ static LPWSTR FILE_name_AtoW(LPCSTR name, int optarg) {