mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-07 23:10:31 +08:00
* sec_auth.cc (str2uni_cat): Move from here...
* path.cc (str2uni_cat): ...to here. Simplify. Make static inline. (get_nt_native_path): Use RtlAppendUnicodeToString rather than str2uni_cat for constant strings for speed. * security.h (str2uni_cat): Drop declaration.
This commit is contained in:
parent
4dff3fed7d
commit
a22af4a956
@ -1,3 +1,11 @@
|
|||||||
|
2009-05-09 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* sec_auth.cc (str2uni_cat): Move from here...
|
||||||
|
* path.cc (str2uni_cat): ...to here. Simplify. Make static inline.
|
||||||
|
(get_nt_native_path): Use RtlAppendUnicodeToString rather than
|
||||||
|
str2uni_cat for constant strings for speed.
|
||||||
|
* security.h (str2uni_cat): Drop declaration.
|
||||||
|
|
||||||
2009-05-08 Corinna Vinschen <corinna@vinschen.de>
|
2009-05-08 Corinna Vinschen <corinna@vinschen.de>
|
||||||
IWAMURO Motonori <deenheart@gmail.com>
|
IWAMURO Motonori <deenheart@gmail.com>
|
||||||
|
|
||||||
|
@ -428,6 +428,16 @@ transform_chars (PUNICODE_STRING upath, USHORT start_idx)
|
|||||||
upath->Buffer + upath->Length / sizeof (WCHAR) - 1);
|
upath->Buffer + upath->Length / sizeof (WCHAR) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
str2uni_cat (UNICODE_STRING &tgt, const char *srcstr)
|
||||||
|
{
|
||||||
|
int len = sys_mbstowcs (tgt.Buffer + tgt.Length / sizeof (WCHAR),
|
||||||
|
(tgt.MaximumLength - tgt.Length) / sizeof (WCHAR),
|
||||||
|
srcstr);
|
||||||
|
if (len)
|
||||||
|
tgt.Length += (len - 1) * sizeof (WCHAR);
|
||||||
|
}
|
||||||
|
|
||||||
PUNICODE_STRING
|
PUNICODE_STRING
|
||||||
get_nt_native_path (const char *path, UNICODE_STRING& upath)
|
get_nt_native_path (const char *path, UNICODE_STRING& upath)
|
||||||
{
|
{
|
||||||
@ -438,7 +448,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath)
|
|||||||
{
|
{
|
||||||
if (path[1] == ':') /* X:\... */
|
if (path[1] == ':') /* X:\... */
|
||||||
{
|
{
|
||||||
str2uni_cat (upath, "\\??\\");
|
RtlAppendUnicodeToString (&upath, L"\\??\\");
|
||||||
str2uni_cat (upath, path);
|
str2uni_cat (upath, path);
|
||||||
/* The drive letter must be upper case. */
|
/* The drive letter must be upper case. */
|
||||||
upath.Buffer[4] = towupper (upath.Buffer[4]);
|
upath.Buffer[4] = towupper (upath.Buffer[4]);
|
||||||
@ -452,13 +462,13 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath)
|
|||||||
else if ((path[2] != '.' && path[2] != '?')
|
else if ((path[2] != '.' && path[2] != '?')
|
||||||
|| path[3] != '\\') /* \\server\share\... */
|
|| path[3] != '\\') /* \\server\share\... */
|
||||||
{
|
{
|
||||||
str2uni_cat (upath, "\\??\\UNC\\");
|
RtlAppendUnicodeToString (&upath, L"\\??\\UNC\\");
|
||||||
str2uni_cat (upath, path + 2);
|
str2uni_cat (upath, path + 2);
|
||||||
transform_chars (&upath, 8);
|
transform_chars (&upath, 8);
|
||||||
}
|
}
|
||||||
else /* \\.\device or \\?\foo */
|
else /* \\.\device or \\?\foo */
|
||||||
{
|
{
|
||||||
str2uni_cat (upath, "\\??\\");
|
RtlAppendUnicodeToString (&upath, L"\\??\\");
|
||||||
str2uni_cat (upath, path + 4);
|
str2uni_cat (upath, path + 4);
|
||||||
}
|
}
|
||||||
return &upath;
|
return &upath;
|
||||||
|
@ -126,18 +126,6 @@ str2buf2lsa (LSA_STRING &tgt, char *buf, const char *srcstr)
|
|||||||
memcpy (buf, srcstr, tgt.MaximumLength);
|
memcpy (buf, srcstr, tgt.MaximumLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
str2uni_cat (UNICODE_STRING &tgt, const char *srcstr)
|
|
||||||
{
|
|
||||||
int len = sys_mbstowcs (tgt.Buffer + tgt.Length / sizeof (WCHAR),
|
|
||||||
(tgt.MaximumLength - tgt.Length) / sizeof (WCHAR),
|
|
||||||
srcstr);
|
|
||||||
if (len)
|
|
||||||
tgt.Length += (len - 1) * sizeof (WCHAR);
|
|
||||||
else
|
|
||||||
tgt.Length = tgt.MaximumLength = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
HANDLE
|
HANDLE
|
||||||
open_local_policy (ACCESS_MASK access)
|
open_local_policy (ACCESS_MASK access)
|
||||||
{
|
{
|
||||||
|
@ -366,9 +366,6 @@ extern "C" int acl32 (const char *, int, int, __acl32 *);
|
|||||||
int getacl (HANDLE, path_conv &, int, __acl32 *);
|
int getacl (HANDLE, path_conv &, int, __acl32 *);
|
||||||
int setacl (HANDLE, path_conv &, int, __acl32 *, bool &);
|
int setacl (HANDLE, path_conv &, int, __acl32 *, bool &);
|
||||||
|
|
||||||
struct _UNICODE_STRING;
|
|
||||||
void __stdcall str2uni_cat (_UNICODE_STRING &, const char *) __attribute__ ((regparm (2)));
|
|
||||||
|
|
||||||
/* Function creating a token by calling NtCreateToken. */
|
/* Function creating a token by calling NtCreateToken. */
|
||||||
HANDLE create_token (cygsid &usersid, user_groups &groups, struct passwd * pw);
|
HANDLE create_token (cygsid &usersid, user_groups &groups, struct passwd * pw);
|
||||||
/* LSA authentication function. */
|
/* LSA authentication function. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user