* cygheap.cc (cwcsdup): New function.

(cwcsdup1): New function.
	* cygheap.h (cygheap_user::get_windows_id): New method returning PWCHAR.
	(cwcsdup): Declare.
	(cwcsdup1): Declare.
	* registry.cc (get_registry_hive_path): Use WCHAR instead of char
	throughout.
	(load_registry_hive): Ditto.
	* registry.h (get_registry_hive_path): Change declaration accordingly.
	(load_registry_hive): Ditto.
	* sec_helper.cc (cygpsid::string): New method returning PWCHAR.
	* security.h (cygpsid::string): Declare.
	* syscalls.cc (seteuid32): Convert local name var to WCHAR.
	* uinfo.cc (cygheap_user::env_userprofile): Convert local name buffers
	to WCHAR.  Call sys_wcstombs_alloc to generate puserprof buffer.

	* winsup.h: Fix comment.
	(NT_MAX_PATH): New definition for maximum internal path length.
	Use throughout where appropriate.
	* include/limits.h (PATH_MAX): Set to 4096 as on Linux.
This commit is contained in:
Corinna Vinschen
2008-02-14 16:47:11 +00:00
parent f16db7f54e
commit 7b4b41ab3e
23 changed files with 138 additions and 60 deletions

View File

@@ -24,6 +24,7 @@
#include "sigproc.h"
#include "pinfo.h"
#include <unistd.h>
#include <wchar.h>
init_cygheap NO_COPY *cygheap;
void NO_COPY *cygheap_max;
@@ -354,6 +355,30 @@ ccalloc_abort (cygheap_types x, DWORD n, DWORD size)
return ccalloc (x, n, size, "ccalloc");
}
extern "C" PWCHAR __stdcall
cwcsdup (const PWCHAR s)
{
MALLOC_CHECK;
PWCHAR p = (PWCHAR) cmalloc (HEAP_STR, wcslen (s) + 1);
if (!p)
return NULL;
wcpcpy (p, s);
MALLOC_CHECK;
return p;
}
extern "C" PWCHAR __stdcall
cwcsdup1 (const PWCHAR s)
{
MALLOC_CHECK;
PWCHAR p = (PWCHAR) cmalloc (HEAP_1_STR, wcslen (s) + 1);
if (!p)
return NULL;
wcpcpy (p, s);
MALLOC_CHECK;
return p;
}
extern "C" char *__stdcall
cstrdup (const char *s)
{