Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2007-08-12 16:48:02 +0400
committerCorinna Vinschen <corinna@vinschen.de>2007-08-12 16:48:02 +0400
commit61c44b72d4360797dfd519ddd5c98eac719f15e7 (patch)
tree97139201421c44e91b78dd22ddac955867c0ad00 /winsup/cygwin/strfuncs.cc
parent847e89f8e1f05115b9f719a319f7f7405f246e9b (diff)
* ntdll.h: Add descriptive comments to special Rtl functions.
(STATUS_OBJECT_PATH_NOT_FOUND): Define. (STATUS_BUFFER_OVERFLOW): Define. (FILE_SUPERSEDED): Define. (FILE_OPENED): Define. (FILE_CREATED): Define. (FILE_OVERWRITTEN): Define. (FILE_EXISTS): Define. (FILE_DOES_NOT_EXIST): Define. (PIO_APC_ROUTINE): Typedef. (NtFsControlFile): Fix parameter types to use PIO_APC_ROUTINE. (NtWriteFile): Declare. (RtlInt64ToHexUnicodeString): Declare. * strfuncs.cc: Include ntdll.h. (RtlInt64ToHexUnicodeString): New function. * syscalls.cc (try_to_bin): Rewrite using native NT functions. Only try to create recycle bin after unsuccessfully trying to move file. Also try to create special files in recycle bin so that Windows Explorer isn't unnecessarily stampeded.
Diffstat (limited to 'winsup/cygwin/strfuncs.cc')
-rw-r--r--winsup/cygwin/strfuncs.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc
index c0029fb1f..91ed160c3 100644
--- a/winsup/cygwin/strfuncs.cc
+++ b/winsup/cygwin/strfuncs.cc
@@ -12,6 +12,7 @@ details. */
#include "winsup.h"
#include <winbase.h>
#include <winnls.h>
+#include <ntdll.h>
codepage_type current_codepage = ansi_cp;
@@ -41,3 +42,23 @@ sys_mbstowcs (WCHAR *tgt, const char *src, int len)
int res = MultiByteToWideChar (get_cp (), 0, src, -1, tgt, len);
return res;
}
+
+static WCHAR hex_wchars[] = L"0123456789abcdef";
+
+NTSTATUS NTAPI
+RtlInt64ToHexUnicodeString (ULONGLONG value, PUNICODE_STRING dest,
+ BOOLEAN append)
+{
+ USHORT len = append ? dest->Length : 0;
+ if (dest->MaximumLength - len < 16 * (int) sizeof (WCHAR))
+ return STATUS_BUFFER_OVERFLOW;
+ PWCHAR end = (PWCHAR) ((PBYTE) dest->Buffer + len);
+ register PWCHAR p = end + 16;
+ while (p-- > end)
+ {
+ *p = hex_wchars[value & 0xf];
+ value >>= 4;
+ }
+ dest->Length += 16 * sizeof (WCHAR);
+ return STATUS_SUCCESS;
+}