Use CryptAcquireContextW.
* ntdll.h (STATUS_PROCEDURE_NOT_FOUND): Define.
* sec_auth.cc (open_local_policy): Rename NTSTATUS variable ret to
status. Drop usage of LsaNtStatusToWinError.
(verify_token): Call NtQuerySecurityObject instead of
GetKernelObjectSecurity.
(create_token): Rename NTSTATUS variable ret to status. Rename ret2 to
sub_status. Drop usage of LsaNtStatusToWinError. In case LsaLogonUser
fails, report the sub_status as well.
from Windows environment instead. Explain why.
(cygheap_user::env_domain): Use MAX_DOMAIN_NAME_LEN rather than DNLEN
to specify the size of the domain name buffer.
* times.cc: Ditto.
localtime, gmtime).
(FACTOR): Add comment.
(NSPERSEC): Ditto.
(JITTER): New definition. Comment.
(systime_ns): Avoid gratuitous copying of the value returned by
GetSystemTimeAsFileTime.
(corelocaltime, localtime, gmtime): Remove very old, unused code block.
(cygwin_tzset): Remove.
(hires_ms::timeGetTime_ns): Add missing semicolon in comment.
(hires_ms::nsecs): Redefine check for difference between internal
timer value and system time.
* autoload.cc (GetUdpTable): Define.
* syslog.cc (connect_syslogd): Use get_inet_addr rather than _stat64
to check for local socket file. Create socket with type returned by
get_inet_addr. If connect on UDP socket works, test if there's
really a listening peer, otherwise fall back to Windows event log.
(try_connect_syslogd): Use syslogd_inited flag to check if syslogd
is available.
(UuidCreateSequential): Remove.
* passwd.cc (internal_getpwsid): Avoid a strict-aliasing compiler
error with gcc 4.5.1.
* fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Ditto.
* ntdll.h (NtAllocateUuids): Declare.
* syscalls.cc (gethostid): Use NtAllocateUuids function rather than
UuidCreateSequential/UuidCreate to get rid of rpcrt4 dependency.
unloadable wave functions as fatal.
* hires.h (hires_ms::timeGetTime_ns): New private method.
(hires_ms::dmsecs): Call timeGetTime_ns here.
* ntdll.h (struct _KSYSTEM_TIME): Define.
(KUSER_SHARED_DATA): Redefine to allow access to InterruptTime.
(SharedUserData): Define here.
(NtQueryTimerResolution): Declare.
(NtSetTimerResolution): Declare.
* path.cc (SharedUserData): Move to ntdll.h.
* times.cc (hires_ms::timeGetTime_ns): New private method.
Use throughout instead of timeGetTime. Document entire functionality
of timeGetTime in case we need it.
(hires_ms::resolution): Try a call to NtQueryTimerResolution
to fetch current period. Fall back to heuristic if that fails.
Cast to DWORD in assignments to minperiod.
(clock_setres): Align period to possible values per a call to
NtQueryTimerResolution. Explain why. Replace calls to timeBeginPeriod
and timeEndPeriod with underlying call to NtSetTimerResolution. Use
status code from NtSetTimerResolution to compute errno.
Convert period to ULONGLONG and store 100ns value to simplify code.
as pointer.
(mmap_record::alloc_page_map): Remove.
(mmap_record::free_page_map): Remove.
(mmap_record::init_page_map): New method.
(mmap_record::add_record): Take mmap_record parameter by reference
rather than by value.
(mmap_record::map_pages): Fix comment.
(mmap_list::add_record): Allocate space for mmap_record including the
page_map in a single ccalloc call. Call init_page_map afterwards.
(mmap_list::del_record): Remove call to mmap_record::free_page_map.
treatment for ERROR_NO_SYSTEM_RESOURCES. Cancel I/O and reset the overlapped
handle on error.
(fhandler_base_overlapped::write_overlapped): Limit writes to max_atomic_write
bytes in blocking case. Incorporate code from now-defunct
write_overlapped_fallback. Fix serious oversight where ptr was not advanced as
buffer was written.
(fhandler_base_overlapped::write_overlapped_fallback): Eliminate.
* fhandler.h (fhandler_base_overlapped::write_overlapped_fallback): Ditto for
declaration.
(DEFAULT_PIPEBUFSIZE): Lower size to slightly less than documented worst-case
atomic write size.
(fhandler_overlapped::wait_return): Remove unused element.
overlapped_fallback error condition like other error conditions. Set res
carefully and specifically for each condition rather than resorting to a
default.
(fhandler_base_overlapped::write_overlapped): Preserve errno in
overlapped_fallback condition. Correct write_overlapped_fallback to avoid
inappropriate looping.
(fhandler_base_overlapped::write_overlapped_fallback): Add some more comments.
* fhandler.cc (MAX_OVERLAPPED_WRITE_LEN): New constant.
(MIN_OVERLAPPED_WRITE_LEN): Ditto.
(fhandler_base_overlapped::close): Accommodate change in arguments to
wait_overlapped.
(fhandler_base_overlapped::setup_overlapped): Add __stdcall and regparm
modifiers.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::wait_overlapped): Modify to return an enum returning
various states. Accept nonblocking parameter.
(fhandler_base_overlapped::read_overlapped): Add __stdcall and regparm
modifiers. Rework to attempt to be smarter about reacting to states returned
by wait_overlapped.
(fhandler_base_overlapped::write_overlapped): Ditto. Add fallback option for
when wait_overlapped detects that smaller chunks must be written.
(fhandler_base_overlapped::write_overlapped_fallback): Ditto.
* fhandler.h (DEFAULT_PIPEBUFSIZE): Move definition here from pipe.cc.
(fhandler_base::has_ongoing_io): Define with __stdcall and regparm modifiers.
(fhandler_base_overlapped::wait_return): New enum.
(fhandler_base_overlapped::max_atomic_write): New variable.
(fhandler_base_overlapped:: wait_overlapped): Accommodate changes mentioned
above to arguments and modifiers.
(fhandler_base_overlapped::setup_overlapped): Ditto for modifiers.
(fhandler_base_overlapped::read_overlapped): Ditto.
(fhandler_base_overlapped::write_overlapped): Ditto.
(fhandler_base_overlapped::destroy_overlapped): Ditto.
(fhandler_base_overlapped::has_ongoing_io): Ditto.
(fhandler_base_overlapped::fhandler_base_overlapped): Zero max_atomic_write.
* fhandler_fifo.cc (fhandler_fifo::fhandler_fifo): Set max_atomic_write to the
size of the DEFAULT_PIPEBUFSIZE.
(fhandler_fifo::wait): Accommodate change in arguments to wait_overlapped.
* pipe.cc (fhandler_pipe::fhandler_pipe): Set max_atomic_write to the size of
the DEFAULT_PIPEBUFSIZE.
(fhandler_pipe::create_selectable): Allow minimum size of DEFAULT_PIPEBUFSIZE.
(DEFAULT_PIPEBUFSIZE): Delete here, move to fhandler.h.
filesystem supporting ACLs, create the file with WRITE_DAC access.
Explain why.
* fhandler_disk_file.cc (fhandler_disk_file::mkdir): Ditto for
directories.
* fhandler_socket.cc (fhandler_socket::bind): Ditto for sockets.
* path.cc (symlink_worker): Ditto for symlinks.
* security.cc (get_file_sd): Always call GetSecurityInfo for directories
on XP and Server 2003. Improve comment to explain why.
(set_file_attribute): Explicitely cast mode_t value to bool in call to
get_file_sd.
* wincap.h (wincaps::use_get_sec_info_on_dirs): New element.
* wincap.cc: Implement above element throughout.