Skip to content

Commit

Permalink
ninewinecfg: add unix_filename() helper function
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dhewg committed Apr 15, 2019
1 parent 2968085 commit 72c2f48
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ninewinecfg/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 72c2f48

Please sign in to comment.