Cygwin: cygheap: convert installation paths to UNICODE_STRINGS

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-12-25 01:06:34 +01:00
parent a7f392686b
commit 866901441b
5 changed files with 30 additions and 25 deletions

View File

@@ -1305,11 +1305,11 @@ cygheap_pwdgrp::_nss_init ()
char *buf = tp.c_get ();
PCWSTR rel_path = L"\\etc\\nsswitch.conf";
path.Length = (wcslen (cygheap->installation_root) + wcslen (rel_path))
* sizeof (WCHAR);
path.Length = cygheap->installation_root.Length
+ wcslen (rel_path) * sizeof (WCHAR);
path.MaximumLength = path.Length + sizeof (WCHAR);
path.Buffer = (PWCHAR) alloca (path.MaximumLength);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root), rel_path);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root.Buffer), rel_path);
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE,
NULL, NULL);
if (rl.init (&attr, buf, NT_MAX_PATH))
@@ -1665,11 +1665,12 @@ pwdgrp::check_file ()
if (!path.Buffer)
{
PCWSTR rel_path = is_group () ? L"\\etc\\group" : L"\\etc\\passwd";
path.Length = (wcslen (cygheap->installation_root) + wcslen (rel_path))
* sizeof (WCHAR);
path.Length = cygheap->installation_root.Length
+ wcslen (rel_path) * sizeof (WCHAR);
path.MaximumLength = path.Length + sizeof (WCHAR);
path.Buffer = (PWCHAR) cmalloc_abort (HEAP_BUF, path.MaximumLength);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root), rel_path);
wcpcpy (wcpcpy (path.Buffer, cygheap->installation_root.Buffer),
rel_path);
InitializeObjectAttributes (&attr, &path, OBJ_CASE_INSENSITIVE,
NULL, NULL);
}