newlib/winsup/cygwin/ntdll.h

1548 lines
47 KiB
C
Raw Normal View History

2001-04-29 04:54:36 +02:00
/* ntdll.h. Contains ntdll specific stuff not defined elsewhere.
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2013-04-23 11:44:36 +02:00
2011, 2012, 2013 Red Hat, Inc.
This file is part of Cygwin.
This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
* DevNotes: Add entry cgf-000013. * cygserver_ipc.h (ipc_set_proc_info): Use _cygtls::ipc_set_proc_info to set per-thread signal arrived value. * cygthread.cc (cygthread::detach): Use per-thread signal_arrived via set_thread_waiting. * fork.cc (_cygtls::fixup_after_fork): Clear signal_arrived. (_cygtls::remove): Close any signal_arrived handle when thread exists. (_cygtls::find_tls): Remove unneeded function. * cygtls.h: Update copyright. (class _cygtls): Reorganize to help avoid rebuilding newlib when structure changes. (_cygtls::event): Delete. (_cygtls::threadkill): Ditto. (_cygtls::signal_waiting): Declare new bool. (_cygtls::find_tls): Delete declaration. (_cygtls::set_threadkill): Ditto. (_cygtls::reset_threadkill): Ditto. (_cygtls::set_signal_arrived): Declare new function. (class set_thread_waiting): Declare new class. * cygwait.cc (cw_nowait_storage): Define. (cygwait): Set per-thread signal_arrived via set_thread_waiting. Don't special-case _main_tls. * cygwait.h (cw_nowait): Define. (cw_infinite): Ditto. (cygwait): Redefine pathological wait-only case. * dcrt0.cc (dll_crt0_0): Remove call to now-defunct events_init(). (dll_crt0_1): Remove call to now-defunct create_signal_arrived(). * exceptions.cc: Reflect set_signal_mask() argument reordering throughout. Remove signal mask synchronization throughout. (events_init): Delete definition. (mask_sync): Delete now-unneeded mask synchronization. (set_signal_mask): Reverse order of arguments to "standard" to, from layout. Rename "newmask" argument to "setmask". Remove debugging. (sig_handle_tty_stop): Use cancelable_wait rather than WFMO. (_cygtls::interrupt_setup): Don't treat "threadkill" events specially. Conditionally set signal_arrived depending on whether the thread has created it or not. (sigpacket::process): Reorganize to reflect thread-specific sending of signals which is more in line with the way it was actually supposed to work. * fhandler_socket.cc (get_inet_addr): Use cancelable_wait rather than IsEventSignalled to avoid potential race. (fhandler_socket::wait_for_events): Set signal_arrived event using set_thread_waiting(). (fhandler_socket::close): Use cygwait for the case of just waiting 10 ms for a signal. * fhandler_tape.cc (fhandler_dev_tape::_lock): Use cancelable_wait rather than WFMO. Redo switch/case tests accordingly. * fhandler_termios.cc (fhandler_termios::bg_check): Use cygwait for case of just waiting 0 ms for a potential signal. * fhandler_tty.cc (fhandler_pty_master::process_slave_output): Use cancelable_wait rather than WFSO. * fhandler_windows.cc (fhandler_windows::read): Set per-thread signal_arrived via set_thread_waiting(). * flock.cc (lf_setlock): Ditto. * select.cc (pselect): Ditto. Set per-thread signal_arrived using set_thread_waiting(). * gendef: Don't special case handling of _cygtls::sig for threads. * gentls_offsets: Use #pragma once in tlsoffsets.h. * ntdll.h: Use #pragma once. * poll.cc: Reflect set_signal_mask() argument reordering. * posix_ipc.cc (ipc_mutex_lock): Use cancelable_wait rather than WFMO. (ipc_cond_timedwait): Set perl-thread signal arrived using set_thread_waiting(). * security.h: Use #pragma once. * signal.cc (abort): Reflect set_signal_mask() argument reordering. (clock_nanosleep): Ditto. Change call to cancelable_wait to properly specify handling of cancel and interrupt. (sigwaitinfo): Remove handling of per-thread event in favor of per-thread signal_arrived. Use cancelable_wait rather than WFSO. * sigproc.cc (signal_arrived): Delete definition. (create_signal_arrived): Ditto. * sigproc.h (signal_arrived): Delete declaration. (set_signal_mask): Avoid defining as a "C" function. Don't conditionally declare. (create_signal_arrived): Delete declaration. * syscalls.cc (rename): Use cygwait() rather than WFSO. * thread.h (fast_mutex::lock): Use cw_infinite rather than LARGE_NULL. * wait.cc (wait4): Ditto. * thread.cc (pthread_mutex::lock): Ditto. (pthread::join): Ditto. (semaphore::_wait): Ditto. (pthread_kill): Remove set_threadkill() accommodation. * tlsoffsets.h: Regenerate.
2012-07-22 00:58:20 +02:00
#pragma once
#include <ntstatus.h>
2009-10-07 17:47:38 +02:00
/* custom status code: */
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
2013-04-23 11:44:36 +02:00
/* As of March 2013, Mingw doesn't define these status codes yet. */
#ifndef STATUS_NETWORK_OPEN_RESTRICTION
#define STATUS_NETWORK_OPEN_RESTRICTION ((NTSTATUS)0xC0000201)
#endif
#ifndef STATUS_SYMLINK_CLASS_DISABLED
#define STATUS_SYMLINK_CLASS_DISABLED ((NTSTATUS)0xC0000715)
#endif
#define NtCurrentProcess() ((HANDLE) (LONG_PTR) -1)
#define NtCurrentThread() ((HANDLE) (LONG_PTR) -2)
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
/* Creation information returned in IO_STATUS_BLOCK. */
#define FILE_SUPERSEDED 0
#define FILE_OPENED 1
#define FILE_CREATED 2
#define FILE_OVERWRITTEN 3
#define FILE_EXISTS 4
#define FILE_DOES_NOT_EXIST 5
/* Relative file position values in NtWriteFile call. */
#define FILE_WRITE_TO_END_OF_FILE (-1LL)
#define FILE_USE_FILE_POINTER_POSITION (-2LL)
/* Device Characteristics. */
#define FILE_REMOVABLE_MEDIA 0x00000001
#define FILE_READ_ONLY_DEVICE 0x00000002
#define FILE_FLOPPY_DISKETTE 0x00000004
#define FILE_WRITE_ONCE_MEDIA 0x00000008
#define FILE_REMOTE_DEVICE 0x00000010
#define FILE_DEVICE_IS_MOUNTED 0x00000020
#define FILE_VIRTUAL_VOLUME 0x00000040
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
#define FILE_DEVICE_SECURE_OPEN 0x00000100
/* Allocation type values in NtMapViewOfSection call. */
#define AT_EXTENDABLE_FILE 0x00002000
#define AT_ROUND_TO_PAGE 0x40000000
/* Lock type in NtLockVirtualMemory/NtUnlockVirtualMemory call. */
#define MAP_PROCESS 1
#define MAP_SYSTEM 2
/* Directory access rights (only in NT namespace). */
#define DIRECTORY_QUERY 1
#define DIRECTORY_TRAVERSE 2
#define DIRECTORY_CREATE_OBJECT 4
#define DIRECTORY_CREATE_SUBDIRECTORY 8
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x0f)
/* Symbolic link access rights (only in NT namespace). */
#define SYMBOLIC_LINK_QUERY 1
/* Transaction access rights. */
#define TRANSACTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x3F)
/* Event object access rights. */
#define EVENT_QUERY_STATE 1
/* Semaphore access rights. */
#define SEMAPHORE_QUERY_STATE 1
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
| DIRECTORY_TRAVERSE \
| DIRECTORY_CREATE_SUBDIRECTORY \
| DIRECTORY_CREATE_OBJECT \
| READ_CONTROL)
#define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \
| SYNCHRONIZE \
| READ_CONTROL)
#define CYG_EVENT_ACCESS (EVENT_QUERY_STATE \
| EVENT_MODIFY_STATE \
| SYNCHRONIZE \
| READ_CONTROL)
#define CYG_SEMAPHORE_ACCESS (SEMAPHORE_QUERY_STATE \
| SEMAPHORE_MODIFY_STATE \
| SYNCHRONIZE \
| READ_CONTROL)
/* Definitions for first parameter of RtlQueryRegistryValues. */
#define RTL_REGISTRY_ABSOLUTE 0
#define RTL_REGISTRY_SERVICES 1
#define RTL_REGISTRY_CONTROL 2
#define RTL_REGISTRY_WINDOWS_NT 3
#define RTL_REGISTRY_DEVICEMAP 4
#define RTL_REGISTRY_USER 5
#define RTL_REGISTRY_HANDLE 0x40000000
#define RTL_REGISTRY_OPTIONAL 0x80000000
/* Flags values for QueryTable parameter of RtlQueryRegistryValues. */
#define RTL_QUERY_REGISTRY_SUBKEY 0x01
#define RTL_QUERY_REGISTRY_TOPKEY 0x02
#define RTL_QUERY_REGISTRY_REQUIRED 0x04
#define RTL_QUERY_REGISTRY_NOVALUE 0x08
#define RTL_QUERY_REGISTRY_NOEXPAND 0x10
#define RTL_QUERY_REGISTRY_DIRECT 0x20
#define RTL_QUERY_REGISTRY_DELETE 0x40
#define RTL_QUERY_REGISTRY_NOSTRING 0x80
/* What RtlQueryProcessDebugInformation shall return. */
#define PDI_MODULES 0x01
#define PDI_HEAPS 0x04
#define PDI_HEAP_BLOCKS 0x10
2013-04-23 11:44:36 +02:00
#define PDI_WOW64_MODULES 0x40
/* VM working set list protection values. Returned by NtQueryVirtualMemory. */
#define WSLE_PAGE_READONLY 0x001
#define WSLE_PAGE_EXECUTE 0x002
#define WSLE_PAGE_EXECUTE_READ 0x003
#define WSLE_PAGE_READWRITE 0x004
#define WSLE_PAGE_WRITECOPY 0x005
#define WSLE_PAGE_EXECUTE_READWRITE 0x006
#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
#define WSLE_PAGE_SHAREABLE 0x100
/* Known debug heap flags */
#define HEAP_FLAG_NOSERIALIZE 0x1
#define HEAP_FLAG_GROWABLE 0x2
#define HEAP_FLAG_EXCEPTIONS 0x4
#define HEAP_FLAG_NONDEFAULT 0x1000
#define HEAP_FLAG_SHAREABLE 0x8000
#define HEAP_FLAG_EXECUTABLE 0x40000
#define HEAP_FLAG_DEBUGGED 0x40000000
/* IOCTL code to impersonate client of named pipe. */
#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \
METHOD_BUFFERED, FILE_ANY_ACCESS)
typedef enum _FILE_INFORMATION_CLASS
{
FileDirectoryInformation = 1,
FileFullDirectoryInformation, // 2
FileBothDirectoryInformation, // 3
FileBasicInformation, // 4 wdm
FileStandardInformation, // 5 wdm
FileInternalInformation, // 6
FileEaInformation, // 7
FileAccessInformation, // 8
FileNameInformation, // 9
FileRenameInformation, // 10
FileLinkInformation, // 11
FileNamesInformation, // 12
FileDispositionInformation, // 13
FilePositionInformation, // 14 wdm
FileFullEaInformation, // 15
FileModeInformation, // 16
FileAlignmentInformation, // 17
FileAllInformation, // 18
FileAllocationInformation, // 19
FileEndOfFileInformation, // 20 wdm
FileAlternateNameInformation, // 21
FileStreamInformation, // 22
FilePipeInformation, // 23
FilePipeLocalInformation, // 24
FilePipeRemoteInformation, // 25
FileMailslotQueryInformation, // 26
FileMailslotSetInformation, // 27
FileCompressionInformation, // 28
FileObjectIdInformation, // 29
FileCompletionInformation, // 30
FileMoveClusterInformation, // 31
FileQuotaInformation, // 32
FileReparsePointInformation, // 33
FileNetworkOpenInformation, // 34
FileAttributeTagInformation, // 35
FileTrackingInformation, // 36
FileIdBothDirectoryInformation, // 37
FileIdFullDirectoryInformation, // 38
FileValidDataLengthInformation, // 39
FileShortNameInformation, // 40
FileMaximumInformation
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_NAMES_INFORMATION
{
ULONG NextEntryOffset;
ULONG FileIndex;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_DIRECTORY_INFORMATION
{
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
ULONG NextEntryOffset;
ULONG FileIndex;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
ULONG FileAttributes;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_BOTH_DIR_INFORMATION
{
ULONG NextEntryOffset;
ULONG FileIndex;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
ULONG FileAttributes;
ULONG FileNameLength;
ULONG EaSize;
CCHAR ShortNameLength;
WCHAR ShortName[12];
WCHAR FileName[1];
2013-04-23 11:44:36 +02:00
} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_ID_BOTH_DIR_INFORMATION
{
ULONG NextEntryOffset;
ULONG FileIndex;
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER EndOfFile;
LARGE_INTEGER AllocationSize;
ULONG FileAttributes;
ULONG FileNameLength;
ULONG EaSize;
CCHAR ShortNameLength;
WCHAR ShortName[12];
LARGE_INTEGER FileId;
WCHAR FileName[1];
} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
typedef enum _SYSTEM_INFORMATION_CLASS
{
SystemBasicInformation = 0,
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
SystemPerformanceInformation = 2,
SystemTimeOfDayInformation = 3,
2013-04-23 11:44:36 +02:00
SystemProcessInformation = 5,
SystemProcessorPerformanceInformation = 8,
* autoload.cc: Call _api_fatal in asm. * child_info.h: Redefine CURR_CHILD_INFO_MAGIC. (child_info_fork::abort): Rename from handle_failure. Change arguments. * cygtls.h (_local_storage::ttybuf): New field. * dcrt0.cc (vapi_fatal): Split api_fatal. Add "in forked process" to message when appropriate. (api_fatal): Use vapi_fatal. * devices.h: Make multiple inclusion safe. (fh_devices): Add FH_CONS* stuff. Reorder slightly. (device): Eliminate anonymous union. Add more ways to access minor/major. (device::setunit): Accommodate no-longer-anonymous union. (device::is_fs): Ditto. (device::is_fs_special): Ditto. (device::major): New function. (device::minor): Ditto. (device::is_device): New function. (device::not_device): Ditto. (device::operator int): New operator. (device::operator fh_devices): Ditto. (device::operator bool): Ditto. (device::operator DWORD): Ditto. (device::operator =): Ditto. (isproc_dev): New function. (isprocsys_dev): Ditto. (iscons_dev): Ditto. (istty_slave_dev): Ditto. * devices.in: Add new "/dev/cons*" strings. Accommodate no-longer-anonymous union throughout. (BRACK): Use more precise method for initialization. * devices.cc: Regenerate. * dtable.cc (dtable::stdio_init): Use get_cttyp instead of get_tty. (dtable::find_archetype): Use new DWORD operator in device to test archetypes. (dtable::init_std_file_from_handle): Use different method to initialize 'dev'. Adapt to different ctty handling and accommodate /dev/cons*. (fh_alloc): Accommodate no-longer-anonymous union. Adapt to new /dev/cons*. (build_fh_pc): Make debugging output more useful. * exceptions.cc (ctrl_c_handler): Use get_cttyp instead of get_tty. * external.cc (fillout_pinfo): Accommodate new cons* stuff. * fhandler.cc (fhandler_base::read): Eliminate is_slow() test. * fhandler.h (fhandler_base::*): Adapt to changes in device.h. (fhandler_*::is_slow): Delete. ( fhandler_proc::get_proc_fhandler): Return fh_devices type. * fhandler_console.cc (open_shared_console): New function. (console_unit): New class. (console_unit::console_unit): New constructor. (enum_windows): New function. Declare as friend to console_unit. (fhandler_console::set_unit): New function. (fhandler_console::get_tty_stuff): Call set_unit to set the unit number and determine if initialization is needed. Eliminate flags parameter. (tty_list::get_cttyp): Rename (sorta) from get_tty. Return pointer to correct tty_min. (fhandler_console::open): Adapt to elimination of argument to get_tty_stuff. (fhandler_console::output_tcsetattr): Properly detect error condition. (fhandler_console::fixup_after_fork_exec): Adapt to get_tty_stuff() setting tc automatically. * fhandler_proc.cc: Use FH_BAD rather than 0 throughout where using fh_devices enum. (fhandler_proc::get_proc_fhandler): Return fh_devices. Adapt to devices.h changes. * fhandler_process.cc: Adapt to devices.h changes. Use FH_BAD rather than 0 throughout where using fh_devices enum. * fhandler_procnet.cc: Ditto. * fhandler_procsys.cc: Ditto. * fhandler_procsysvipc.cc: Ditto. * fhandler_tape.cc (fhandler_dev_tape::fhandler_dev_tape): Ditto. * fhandler_termios.cc (handler_termios::bg_check): Use tc->ttyname() rather than assuming that we can construct a tty. * fhandler_tty.cc (fhandler_tty_master::fhandler_tty_master): Just return get_minor() of dev. (fhandler_pty_master::process_slave_output): Add slightly more debugging info. (fhandler_tty_slave::fhandler_tty_slave): Change name from ntty to unit. (fhandler_pty_master::open): Ditto. (fhandler_tty_slave::ioctl): Adapt to change which causes ctty to represent a complete device. (fhandler_tty_master::init_console): Add debugging for failure path. (fhandler_pty_master::setup): Use get_unit() to retrieve unit number rather than relying on raw ntty. (fhandler_pty_master::setup): Ditto. * fhandler_virtual.h (virt_tab_t): Redefine fhandler as fh_devices. * fork.cc: Remove obsolete vfork stuff. (frok::child): Don't assume that a ctty == 0 is valid. * mount.cc (mount_info::conv_to_win32_path): Adapt to device struct changes. (mount_info::conv_to_win32_path): Ditto. * path.cc (path_conv::check): Retrive major/minor numbers via a method rather than accessing them directly from device. Rely on dev operators to set/retrieve device information as required by device struct change. * path.h (isproc_dev): Move to devices.h. (isprocsys_dev): Ditto. (isvirtual_dev): Ditto. (path_conv:{isdevice,isfifo,isspecial,iscygdrive,issocket,get_devn,get_unitn}): Use device methods to access/manipulate devices. * pinfo.cc (pinfo::exit): Don't assume that ctty == 0 is valid. Use iscons_dev to determine if a device is a console. (_pinfo::_ctty): Use device::parse to generate tty/cons name. (_pinfo::set_ctty): Don't assume that ctty == 0 is valid. Remove redundant info from debugging. * shared.cc (offsets): Remove console offset. * shared_info.h (shared_locations): Ditto. * syscalls.cc (umask): Use device methods to manipulate device information. (ctermid): Use device::parse to generate term device name. * tlsoffsets.h: Regenerate. * tty.cc (ttyslot): Return minor number of ctty since ctty now represents a full device. (tty::create_master): Set ctty to a complete device. (tty_list::attach): Rework to detect new /dev/cons* stuff. (tty_list::terminate): Adapt to changes to ctty. (tty_list::init): Adapt to change to setntty - pass in device major number. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Define new function. * tty.h (tty_min::ntty): Redefine as fh_devices. (tty::exists): Use get_unit() to retrive tty unit number. (tty::open_mutex): Ditto. (tty::open_inuse): Ditto. (tty::create_inuse): Ditto. (tty::get_event): Ditto. (tty_min::ttyname): Declare new function. (tty::getntty): Declare as const. (tty_list::operator []): Assure that only minor part of argument is used. * dll_init.cc (dll_list::alloc): Detect mismatch of data segments early issuing an explicit error message if necessary. * heap.cc (heap_init): Adapt to changes from fork->handle_failure to fork->abort. * pinfo.h (EXITCODE_FORK_FAILED): New enum. (from Ryan Johnson) * sigproc.cc (child_info_fork::abort): Rename from handle_failure. Change arguments to allow passing in a printf-like message. * winsup.h (api_fatal): Delete macro definition. (api_fatal): Redefine from __api_fatal. (vapi_fatal): Declare new function. * include/sys/strace.h (strace_vprintf): Define new macro. * ntdll.h (_SYSTEM_INFORMATION_CLASS): Add SystemHandleInformation.
2011-05-28 20:17:09 +02:00
SystemHandleInformation = 16,
SystemPagefileInformation = 18,
/* There are a lot more of these... */
} SYSTEM_INFORMATION_CLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_BASIC_INFORMATION
{
ULONG Unknown;
ULONG MaximumIncrement;
ULONG PhysicalPageSize;
ULONG NumberOfPhysicalPages;
ULONG LowestPhysicalPage;
ULONG HighestPhysicalPage;
ULONG AllocationGranularity;
2013-04-23 11:44:36 +02:00
ULONG_PTR LowestUserAddress;
ULONG_PTR HighestUserAddress;
ULONG_PTR ActiveProcessors;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
UCHAR NumberProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_PAGEFILE_INFORMATION
{
ULONG NextEntryOffset;
ULONG CurrentSize;
ULONG TotalUsed;
ULONG PeakUsed;
UNICODE_STRING FileName;
} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
{
LARGE_INTEGER IdleTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER DpcTime;
LARGE_INTEGER InterruptTime;
ULONG InterruptCount;
2013-04-23 11:44:36 +02:00
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef LONG KPRIORITY;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _VM_COUNTERS
{
2013-04-23 11:44:36 +02:00
SIZE_T PeakVirtualSize;
SIZE_T VirtualSize;
ULONG PageFaultCount;
2013-04-23 11:44:36 +02:00
SIZE_T PeakWorkingSetSize;
SIZE_T WorkingSetSize;
SIZE_T QuotaPeakPagedPoolUsage;
SIZE_T QuotaPagedPoolUsage;
SIZE_T QuotaPeakNonPagedPoolUsage;
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
} VM_COUNTERS, *PVM_COUNTERS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _CLIENT_ID
{
HANDLE UniqueProcess;
HANDLE UniqueThread;
} CLIENT_ID, *PCLIENT_ID;
typedef enum
{
StateInitialized,
StateReady,
StateRunning,
StateStandby,
StateTerminated,
StateWait,
StateTransition,
StateUnknown,
} THREAD_STATE;
typedef enum
{
Executive,
FreePage,
PageIn,
PoolAllocation,
DelayExecution,
Suspended,
UserRequest,
WrExecutive,
WrFreePage,
WrPageIn,
WrPoolAllocation,
WrDelayExecution,
WrSuspended,
WrUserRequest,
WrEventPair,
WrQueue,
WrLpcReceive,
WrLpcReply,
WrVirtualMemory,
WrPageOut,
WrRendezvous,
Spare2,
Spare3,
Spare4,
Spare5,
Spare6,
WrKernel,
MaximumWaitReason
} KWAIT_REASON;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_THREADS
{
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER CreateTime;
ULONG WaitTime;
PVOID StartAddress;
CLIENT_ID ClientId;
KPRIORITY Priority;
KPRIORITY BasePriority;
ULONG ContextSwitchCount;
THREAD_STATE State;
KWAIT_REASON WaitReason;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
DWORD Reserved;
} SYSTEM_THREADS, *PSYSTEM_THREADS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_PROCESS_INFORMATION
{
2013-04-23 11:44:36 +02:00
ULONG NextEntryOffset;
ULONG NumberOfThreads;
ULONG Reserved1[6];
LARGE_INTEGER CreateTime;
LARGE_INTEGER UserTime;
LARGE_INTEGER KernelTime;
2013-04-23 11:44:36 +02:00
UNICODE_STRING ImageName;
KPRIORITY BasePriority;
2013-04-23 11:44:36 +02:00
HANDLE UniqueProcessId;
HANDLE InheritedFromUniqueProcessId;
ULONG HandleCount;
2013-04-23 11:44:36 +02:00
ULONG SessionId;
ULONG PageDirectoryBase;
VM_COUNTERS VirtualMemoryCounters;
SIZE_T PrivatePageCount;
IO_COUNTERS IoCounters;
SYSTEM_THREADS Threads[1];
2013-04-23 11:44:36 +02:00
} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _IO_STATUS_BLOCK
{
2013-04-23 11:44:36 +02:00
union {
NTSTATUS Status;
PVOID Pointer;
};
ULONG_PTR Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _SYSTEM_PERFORMANCE_INFORMATION
{
LARGE_INTEGER IdleTime;
LARGE_INTEGER ReadTransferCount;
LARGE_INTEGER WriteTransferCount;
LARGE_INTEGER OtherTransferCount;
ULONG ReadOperationCount;
ULONG WriteOperationCount;
ULONG OtherOperationCount;
ULONG AvailablePages;
ULONG TotalCommittedPages;
ULONG TotalCommitLimit;
ULONG PeakCommitment;
ULONG PageFaults;
ULONG WriteCopyFaults;
ULONG TransitionFaults;
ULONG Reserved1;
ULONG DemandZeroFaults;
ULONG PagesRead;
ULONG PageReadIos;
ULONG Reserved2[2];
ULONG PagefilePagesWritten;
ULONG PagefilePageWriteIos;
ULONG MappedFilePagesWritten;
ULONG MappedFilePageWriteIos;
ULONG PagedPoolUsage;
ULONG NonPagedPoolUsage;
ULONG PagedPoolAllocs;
ULONG PagedPoolFrees;
ULONG NonPagedPoolAllocs;
ULONG NonPagedPoolFrees;
ULONG TotalFreeSystemPtes;
ULONG SystemCodePage;
ULONG TotalSystemDriverPages;
ULONG TotalSystemCodePages;
ULONG SmallNonPagedLookasideListAllocateHits;
ULONG SmallPagedLookasideListAllocateHits;
ULONG Reserved3;
ULONG MmSystemCachePage;
ULONG PagedPoolPage;
ULONG SystemDriverPage;
ULONG FastReadNoWait;
ULONG FastReadWait;
ULONG FastReadResourceMiss;
ULONG FastReadNotPossible;
ULONG FastMdlReadNoWait;
ULONG FastMdlReadWait;
ULONG FastMdlReadResourceMiss;
ULONG FastMdlReadNotPossible;
ULONG MapDataNoWait;
ULONG MapDataWait;
ULONG MapDataNoWaitMiss;
ULONG MapDataWaitMiss;
ULONG PinMappedDataCount;
ULONG PinReadNoWait;
ULONG PinReadWait;
ULONG PinReadNoWaitMiss;
ULONG PinReadWaitMiss;
ULONG CopyReadNoWait;
ULONG CopyReadWait;
ULONG CopyReadNoWaitMiss;
ULONG CopyReadWaitMiss;
ULONG MdlReadNoWait;
ULONG MdlReadWait;
ULONG MdlReadNoWaitMiss;
ULONG MdlReadWaitMiss;
ULONG ReadAheadIos;
ULONG LazyWriteIos;
ULONG LazyWritePages;
ULONG DataFlushes;
ULONG DataPages;
ULONG ContextSwitches;
ULONG FirstLevelTbFills;
ULONG SecondLevelTbFills;
ULONG SystemCalls;
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _SYSTEM_TIMEOFDAY_INFORMATION
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
{
LARGE_INTEGER BootTime;
LARGE_INTEGER CurrentTime;
LARGE_INTEGER TimeZoneBias;
ULONG CurrentTimeZoneId;
2013-04-23 11:44:36 +02:00
BYTE Reserved1[20]; /* Per MSDN. Always 0. */
} SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef enum _PROCESSINFOCLASS
{
ProcessBasicInformation = 0,
ProcessQuotaLimits = 1,
ProcessVmCounters = 3,
* Makefile.in (DLL_OFILES): Add kernel32.o. * autoload.cc (WSACloseEvent): Remove. (WSACreateEvent): Remove. * cygheap.cc (cygheap_init): Drop initializing shared_prefix. * cygheap.h (struct init_cygheap): Drop shared_prefix and shared_prefix_buf members. * fhandler_socket.cc (sock_shared_name): New static function. (search_wsa_event_slot): Convert name buffers to WCHAR. Call NtCreateMutant/NtOpenMutant to create mutexes in session local namespace. (fhandler_socket::init_events): Ditto. Fix debug output. (fhandler_socket::release_events): Close mutexes using NtClose. (fhandler_socket::dup): Ditto. * kernel32.cc: New file, implementing Win32 calls in a Cygwin-specific way. * mmap.cc (MapView): Make static. * ntdll.h: Fix status code sorting. (STATUS_OBJECT_NAME_EXISTS): Define. (SEMAPHORE_QUERY_STATE): Define. (CYG_SHARED_DIR_ACCESS): Define. (CYG_MUTANT_ACCESS): Define. (CYG_EVENT_ACCESS): Define. (CYG_SEMAPHORE_ACCESS): Define. (enum _PROCESSINFOCLASS): Define ProcessSessionInformation. (struct _PROCESS_SESSION_INFORMATION): Define. (NtCreateSemaphore): Declare. (NtOpenSemaphore): Declare. * flock.cc: Use CYG_xxx_ACCESS access masks where appropriate. * posix_ipc.cc (ipc_mutex_init): Use native functions to create mutex. Create in cygwin-shared subdir. (ipc_cond_init): Ditto for event. (ipc_mutex_close): Use NtClose. (ipc_cond_close): Ditto. (mq_open): Drop "cyg" prefix from mqh_uname. * shared.cc (CYG_SHARED_DIR_ACCESS): Drop definition here. (_cygwin_testing): Declare extern on file level. (get_shared_parent_dir): Change name of shared directory. Add name to api_fatal output. (get_session_parent_dir): New function. (shared_name): Simplify. (shared_info::initialize): Call get_session_parent_dir. * shared_info.h (get_session_parent_dir): Declare. * smallprint.cc (__small_vswprintf): Fix bug in multibyte string conversion. * thread.cc (semaphore::semaphore): Align semaphore name to object names in posix IPC functions. * include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2008-04-21 14:46:58 +02:00
ProcessTimes = 4,
ProcessSessionInformation = 24,
ProcessWow64Information = 26,
ProcessImageFileName = 27
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
} PROCESSINFOCLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _DEBUG_BUFFER
{
HANDLE SectionHandle;
PVOID SectionBase;
PVOID RemoteSectionBase;
2013-04-23 11:44:36 +02:00
ULONG_PTR SectionBaseDelta;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
HANDLE EventPairHandle;
2013-04-23 11:44:36 +02:00
ULONG_PTR Unknown[2];
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
HANDLE RemoteThreadHandle;
ULONG InfoClassMask;
2013-04-23 11:44:36 +02:00
ULONG_PTR SizeOfInfo;
ULONG_PTR AllocatedSize;
ULONG_PTR SectionSize;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
PVOID ModuleInformation;
PVOID BackTraceInformation;
PVOID HeapInformation;
PVOID LockInformation;
2013-04-23 11:44:36 +02:00
PVOID Reserved[8];
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
} DEBUG_BUFFER, *PDEBUG_BUFFER;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _DEBUG_HEAP_INFORMATION
{
2013-04-23 11:44:36 +02:00
ULONG_PTR Base;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
ULONG Flags;
USHORT Granularity;
USHORT Unknown;
2013-04-23 11:44:36 +02:00
ULONG_PTR Allocated;
ULONG_PTR Committed;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
ULONG TagCount;
ULONG BlockCount;
ULONG Reserved[7];
PVOID Tags;
PVOID Blocks;
} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _DEBUG_HEAP_ARRAY
{
ULONG Count;
DEBUG_HEAP_INFORMATION Heaps[1];
} DEBUG_HEAP_ARRAY, *PDEBUG_HEAP_ARRAY;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _DEBUG_HEAP_BLOCK
{
2013-04-23 11:44:36 +02:00
ULONG_PTR Size;
ULONG Flags;
2013-04-23 11:44:36 +02:00
ULONG_PTR Committed;
ULONG_PTR Address;
} DEBUG_HEAP_BLOCK, *PDEBUG_HEAP_BLOCK;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _DEBUG_MODULE_INFORMATION
{
2013-04-23 11:44:36 +02:00
ULONG_PTR Reserved[2];
ULONG_PTR Base;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
ULONG Size;
ULONG Flags;
USHORT Index;
USHORT Unknown;
USHORT LoadCount;
USHORT ModuleNameOffset;
CHAR ImageName[256];
} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _DEBUG_MODULE_ARRAY
{
ULONG Count;
DEBUG_MODULE_INFORMATION Modules[1];
} DEBUG_MODULE_ARRAY, *PDEBUG_MODULE_ARRAY;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _KERNEL_USER_TIMES
{
LARGE_INTEGER CreateTime;
LARGE_INTEGER ExitTime;
LARGE_INTEGER KernelTime;
LARGE_INTEGER UserTime;
} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _LDR_DATA_TABLE_ENTRY
{
2013-04-23 11:44:36 +02:00
/* Heads up! The pointers within the LIST_ENTRYs don't point to the
start of the next LDR_DATA_TABLE_ENTRY, but rather they point to the
start of their respective LIST_ENTRY *within* LDR_DATA_TABLE_ENTRY. */
LIST_ENTRY InLoadOrderLinks;
LIST_ENTRY InMemoryOrderLinks;
LIST_ENTRY InInitializationOrderLinks;
PVOID DllBase;
PVOID EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING FullDllName;
UNICODE_STRING BaseDllName;
ULONG Flags;
2013-04-23 11:44:36 +02:00
USHORT LoadCount;
/* More follows. Left out since it's just not used. The aforementioned
2013-04-23 11:44:36 +02:00
part of the structure is stable from at least NT4 up to Windows 8,
including WOW64. */
} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _PEB_LDR_DATA
{
ULONG Length;
2013-04-23 11:44:36 +02:00
BOOLEAN Initialized;
PVOID SsHandle;
2013-04-23 11:44:36 +02:00
/* Heads up! The pointers within the LIST_ENTRYs don't point to the
start of the next LDR_DATA_TABLE_ENTRY, but rather they point to the
start of their respective LIST_ENTRY *within* LDR_DATA_TABLE_ENTRY. */
LIST_ENTRY InLoadOrderModuleList;
LIST_ENTRY InMemoryOrderModuleList;
LIST_ENTRY InInitializationOrderModuleList;
PVOID EntryInProgress;
} PEB_LDR_DATA, *PPEB_LDR_DATA;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _RTL_USER_PROCESS_PARAMETERS
{
ULONG AllocationSize;
ULONG Size;
ULONG Flags;
ULONG DebugFlags;
HANDLE hConsole;
ULONG ProcessGroup;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
UNICODE_STRING CurrentDirectoryName;
HANDLE CurrentDirectoryHandle;
UNICODE_STRING DllPath;
UNICODE_STRING ImagePathName;
UNICODE_STRING CommandLine;
PWSTR Environment;
ULONG dwX;
ULONG dwY;
ULONG dwXSize;
ULONG dwYSize;
ULONG dwXCountChars;
ULONG dwYCountChars;
ULONG dwFillAttribute;
ULONG dwFlags;
ULONG wShowWindow;
UNICODE_STRING WindowTitle;
UNICODE_STRING DesktopInfo;
UNICODE_STRING ShellInfo;
UNICODE_STRING RuntimeInfo;
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _PEB
{
BYTE Reserved1[2];
BYTE BeingDebugged;
2013-04-23 11:44:36 +02:00
BYTE Reserved2[1];
PVOID Reserved3[2];
PPEB_LDR_DATA Ldr;
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
2013-04-23 11:44:36 +02:00
PVOID Reserved4;
PVOID ProcessHeap;
PRTL_CRITICAL_SECTION FastPebLock;
2013-04-23 11:44:36 +02:00
PVOID Reserved5[2];
ULONG EnvironmentUpdateCount;
2013-04-23 11:44:36 +02:00
BYTE Reserved6[228];
PVOID Reserved7[49];
ULONG SessionId;
2013-04-23 11:44:36 +02:00
/* A lot more follows... */
} PEB, *PPEB;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _GDI_TEB_BATCH
{
ULONG Offset;
HANDLE HDC;
ULONG Buffer[0x136];
} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
/* Checked on 64 bit. */
typedef struct _TEB
{
* cygwin.din (pthread_attr_getguardsize): Export. (pthread_attr_setguardsize): Export. (pthread_attr_setstack): Export. (pthread_attr_setstackaddr): Export. * init.cc (dll_entry): Remove wow64_test_stack_marker. Check for unusual stack address by testing stack addresses from current TEB. Check validity of _my_tls by testing if it's within the stack as given in current TEB. * miscfuncs.cc (struct thread_wrapper_arg): New structure used to push all required information to thread_wrapper function. (thread_wrapper): Wrapper function for actual thread function. If an application stack has been given, change %ebp and %esp so that the thread function runs on that stack. If the thread has been created by CygwinCreateThread, set up the POSIX guard pages if necessary. (CygwinCreateThread): New function. * miscfuncs.h (CygwinCreateThread): Declare. * ntdll.h (struct _TEB): Define all members up to Peb. * posix.sgml (std-susv4): Move pthread_attr_getguardsize, pthread_attr_setguardsize and pthread_attr_setstack here. (std-deprec): Add pthread_attr_setstackaddr. * sysconf.cc (sca): Set _SC_THREAD_ATTR_STACKADDR to _POSIX_THREAD_ATTR_STACKADDR. * thread.cc (pthread::precreate): Copy pthread_attr stackaddr and guardsize members. (pthread::create): Call CygwinCreateThread. (pthread_attr::pthread_attr): Initialize guardsize. (pthread_attr_setstack): New function. (pthread_attr_setstackaddr): New function. (pthread_attr_setguardsize): New function. (pthread_attr_getguardsize): New function. (pthread_getattr_np): Copy attr.guardsize. * thread.h (pthread_attr): Add member guardsize. * include/pthread.h (pthread_attr_getguardsize): Declare. (pthread_attr_setguardsize): Declare. * include/cygwin/version.h: Bump API minor number.
2011-05-15 20:49:40 +02:00
NT_TIB Tib;
PVOID EnvironmentPointer;
CLIENT_ID ClientId;
PVOID ActiveRpcHandle;
PVOID ThreadLocalStoragePointer;
PPEB Peb;
ULONG LastErrorValue;
ULONG CountOfOwnedCriticalSections;
2013-04-23 11:44:36 +02:00
PVOID CsrClientThread;
PVOID Win32ThreadInfo;
ULONG User32Reserved[26];
ULONG UserReserved[5];
PVOID WOW32Reserved;
2013-04-23 11:44:36 +02:00
LCID CurrentLocale;
ULONG FpSoftwareStatusRegister;
PVOID SystemReserved1[54];
LONG ExceptionCode;
PVOID ActivationContextStackPointer;
2013-04-23 11:44:36 +02:00
UCHAR SpareBytes1[0x30 - 3 * sizeof(PVOID)];
ULONG TxFsContext;
2013-04-23 11:44:36 +02:00
GDI_TEB_BATCH GdiTebBatch;
CLIENT_ID RealClientId;
PVOID GdiCachedProcessHandle;
ULONG GdiClientPID;
ULONG GdiClientTID;
PVOID GdiThreadLocalInfo;
2013-04-23 11:44:36 +02:00
SIZE_T Win32ClientInfo[62];
PVOID glDispatchTable[233];
2013-04-23 11:44:36 +02:00
SIZE_T glReserved1[29];
PVOID glReserved2;
PVOID glSectionInfo;
PVOID glSection;
PVOID glTable;
PVOID glCurrentRC;
PVOID glContext;
ULONG LastStatusValue;
UNICODE_STRING StaticUnicodeString;
WCHAR StaticUnicodeBuffer[261];
PVOID DeallocationStack;
2013-04-23 11:44:36 +02:00
PVOID TlsSlots[64];
BYTE Reserved3[8];
PVOID Reserved4[26];
PVOID ReservedForOle;
PVOID Reserved5[4];
PVOID TlsExpansionSlots;
/* A lot more follows... */
} TEB, *PTEB;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _KSYSTEM_TIME
{
ULONG LowPart;
LONG High1Time;
LONG High2Time;
} KSYSTEM_TIME, *PKSYSTEM_TIME;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _KUSER_SHARED_DATA
{
BYTE Reserved1[0x08];
KSYSTEM_TIME InterruptTime;
BYTE Reserved2[0x2c8];
ULONG DismountCount;
/* A lot more follows... */
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef struct _PROCESS_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PPEB PebBaseAddress;
KAFFINITY AffinityMask;
2013-04-23 11:44:36 +02:00
KPRIORITY BasePriority; /* !!!Broken on WOW64!!! */
ULONG_PTR UniqueProcessId;
ULONG_PTR InheritedFromUniqueProcessId;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* Makefile.in (DLL_OFILES): Add kernel32.o. * autoload.cc (WSACloseEvent): Remove. (WSACreateEvent): Remove. * cygheap.cc (cygheap_init): Drop initializing shared_prefix. * cygheap.h (struct init_cygheap): Drop shared_prefix and shared_prefix_buf members. * fhandler_socket.cc (sock_shared_name): New static function. (search_wsa_event_slot): Convert name buffers to WCHAR. Call NtCreateMutant/NtOpenMutant to create mutexes in session local namespace. (fhandler_socket::init_events): Ditto. Fix debug output. (fhandler_socket::release_events): Close mutexes using NtClose. (fhandler_socket::dup): Ditto. * kernel32.cc: New file, implementing Win32 calls in a Cygwin-specific way. * mmap.cc (MapView): Make static. * ntdll.h: Fix status code sorting. (STATUS_OBJECT_NAME_EXISTS): Define. (SEMAPHORE_QUERY_STATE): Define. (CYG_SHARED_DIR_ACCESS): Define. (CYG_MUTANT_ACCESS): Define. (CYG_EVENT_ACCESS): Define. (CYG_SEMAPHORE_ACCESS): Define. (enum _PROCESSINFOCLASS): Define ProcessSessionInformation. (struct _PROCESS_SESSION_INFORMATION): Define. (NtCreateSemaphore): Declare. (NtOpenSemaphore): Declare. * flock.cc: Use CYG_xxx_ACCESS access masks where appropriate. * posix_ipc.cc (ipc_mutex_init): Use native functions to create mutex. Create in cygwin-shared subdir. (ipc_cond_init): Ditto for event. (ipc_mutex_close): Use NtClose. (ipc_cond_close): Ditto. (mq_open): Drop "cyg" prefix from mqh_uname. * shared.cc (CYG_SHARED_DIR_ACCESS): Drop definition here. (_cygwin_testing): Declare extern on file level. (get_shared_parent_dir): Change name of shared directory. Add name to api_fatal output. (get_session_parent_dir): New function. (shared_name): Simplify. (shared_info::initialize): Call get_session_parent_dir. * shared_info.h (get_session_parent_dir): Declare. * smallprint.cc (__small_vswprintf): Fix bug in multibyte string conversion. * thread.cc (semaphore::semaphore): Align semaphore name to object names in posix IPC functions. * include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2008-04-21 14:46:58 +02:00
typedef struct _PROCESS_SESSION_INFORMATION
{
ULONG SessionId;
} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
typedef enum _MEMORY_INFORMATION_CLASS
{
MemoryBasicInformation,
MemoryWorkingSetList,
MemorySectionName,
2003-01-13 04:55:00 +01:00
MemoryBasicVlmInformation
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
} MEMORY_INFORMATION_CLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 03:55:40 +02:00
typedef struct _MEMORY_WORKING_SET_LIST
{
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
ULONG NumberOfPages;
2013-04-23 11:44:36 +02:00
ULONG_PTR WorkingSetList[1];
* autoload.cc: Add dynamic load statements for 'ZwQueryInformationProcess' and 'ZwQueryVirtualMemory'. * fhandler.h: Change type of bufalloc and filesize members of fhandler_virtual from int to size_t. Change type of position member from __off32_t to __off64_t. Add new fileid member to fhandler_virtual class. Make seekdir take an __off64_t argument. Make lseek take an __off64_t argument. Add fill_filebuf method to fhandler_virtual. Add fill_filebuf method to fhandler_proc. Add fill_filebuf method to fhandler_registry. Add fill_filebuf method to fhandler_process. Add saved_pid and saved_p members to fhandler_process. * fhandler_proc.cc (proc_listing_array): Add 'loadavg', 'meminfo', and 'stat'. (proc_fhandlers array): Ditto. (fhandler_proc::open): Use fill_filebuf to flesh out the file contents. (fhandler_proc::fill_filebuf): New method. (fhandler_proc::format_proc_meminfo): Ditto. (fhandler_proc::format_proc_stat): Ditto. (fhandler_proc::format_proc_uptime): Ditto. * fhandler_process.cc (process_listing): Add 'stat' and 'statm'. (fhandler_process::fstat): Find the _pinfo structure for the process named in the filename. Return ENOENT if the process is no longer around. Set the gid and uid fields of the stat structure. (fhandler_process::open): Store pid and pointer to _pinfo structure in saved_pid and saved_p respectively. Use fill_filebuf to flesh out file contents. (fhandler_proc::fill_filebuf): New method. (format_process_stat): New function. (format_process_status): Ditto. (format_process_statm): Ditto. (get_process_state): Ditto. (get_mem_values): Ditto. * fhandler_registry.cc (fhandler_registry::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_registry::fill_filebuf): New method. * fhandler_virtual.cc (fhandler_virtual::seekdir): Change argument type from __off32_t to __off64_t. (fhandler_virtual::lseek): Ditto. (fhandler_virtual::fill_filebuf): New method. (fhandler_virtual::fhandler_virtual): Initialise fileid to -1. * wincap.cc: Set flag has_process_io_counters appropriately. * wincap.h: Add flag has_process_io_counters.
2002-05-12 03:37:48 +02:00
} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _MEMORY_SECTION_NAME
{
UNICODE_STRING SectionFileName;
} MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_BASIC_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
ULONG FileAttributes;
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_STANDARD_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
LARGE_INTEGER AllocationSize;
LARGE_INTEGER EndOfFile;
ULONG NumberOfLinks;
BOOLEAN DeletePending;
BOOLEAN Directory;
} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_NETWORK_OPEN_INFORMATION
{
LARGE_INTEGER CreationTime;
LARGE_INTEGER LastAccessTime;
LARGE_INTEGER LastWriteTime;
LARGE_INTEGER ChangeTime;
LARGE_INTEGER AllocationSize;
LARGE_INTEGER EndOfFile;
ULONG FileAttributes;
} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_INTERNAL_INFORMATION
{
* autoload.cc (NtQueryDirectoryFile): Define. * dir.cc (__opendir_with_d_ino): Just call opendir. (opendir): Remove CYGWIN_VERSION_CHECK_FOR_NEEDS_D_INO handling. (readdir_worker): Only try generating d_ino if it's 0. Utilize namehash of directories fhandler. Call readdir_get_ino to generate d_ino for "..". (seekdir64): Keep dirent_set_d_ino flag. * fhandler.h (enum dirent_states): Add dirent_get_d_ino. (class fhandler_disk_file): Declare new private methods readdir_helper and readdir_9x. * fhandler_disk_file.cc (path_conv::hasgood_inode): New method to evaluate if a filesystem has reliable inode numbers. (fhandler_base::fstat_by_handle): Accomodate structure member name change from IndexNumber to FileId. (fhandler_base::fstat_helper): Call hasgood_inode here. (fhandler_disk_file::opendir): Call fhaccess only for real files. Don't append '*' to __d_dirname here, move to readdir_9x. On NT, open directory handle here. Set dirent_get_d_ino and dirent_set_d_ino flags according to wincap and filesystem. (fhandler_disk_file::readdir_helper): New method to implement readdir postprocessing only once. (readdir_get_ino_by_handle): New static function. (readdir_get_ino): New function to centralize inode number evaluation in case inode number hasn't been returned by NtQueryDirectoryFile. (fhandler_disk_file::readdir): Move old functionality to readdir_9x. Call readdir_9x when on 9x/Me. Implement NT specific readdir here. (fhandler_disk_file::readdir_9x): Move 9x specific readdir here. (fhandler_disk_file::seekdir): Accomodate new NT readdir method. (fhandler_disk_file::closedir): Ditto. (fhandler_cygdrive::fstat): Set d_ino to namehash. Add comment. (fhandler_cygdrive::opendir): Call get_namehash to prepare later correct evaluation of d_ino. (fhandler_cygdrive::readdir): Replace recursion with loop. Evaluate drive's d_ino by calling readdir_get_ino. * fhandler_proc.cc (fhandler_proc::readdir): Set dirent_saw_dot and dirent_saw_dot_dot to avoid seeing . and .. entries twice. * fhandler_process.cc (fhandler_process::readdir): Ditto. * fhandler_registry.cc (fhandler_registry::readdir): Ditto. * ntdll.h (STATUS_INVALID_PARAMETER): New define. (STATUS_INVALID_LEVEL): New define. (struct _FILE_INTERNAL_INFORMATION): Rename member IndexNumber to FileId (as in Nebbitt). * path.h (path_conv::hasgood_inode): Now implemented in fhandler_disk_file.cc. * wincap.h (wincaps::has_fileid_dirinfo): New element. * wincap.cc: Implement above element throughout. * winsup.h (readdir_get_ino): Add declaration. * include/sys/dirent.h (struct dirent): Slightly rename structure members to accomodate changes. Remove __USE_EXPENSIVE_CYGWIN_D_INO handling and declaration of __opendir_with_d_ino.
2006-01-27 22:50:42 +01:00
LARGE_INTEGER FileId;
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_EA_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
ULONG EaSize;
} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_ACCESS_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
ACCESS_MASK AccessFlags;
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_DISPOSITION_INFORMATION
{
BOOLEAN DeleteFile;
} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_POSITION_INFORMATION
{
2005-05-02 05:50:11 +02:00
LARGE_INTEGER CurrentByteOffset;
} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_END_OF_FILE_INFORMATION
{
LARGE_INTEGER EndOfFile;
} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_MODE_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
ULONG Mode;
} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_ALIGNMENT_INFORMATION
{
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
ULONG AlignmentRequirement;
} FILE_ALIGNMENT_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_NAME_INFORMATION
{
2005-05-02 05:50:11 +02:00
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_LINK_INFORMATION
{
BOOLEAN ReplaceIfExists;
HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_RENAME_INFORMATION
{
BOOLEAN ReplaceIfExists;
HANDLE RootDirectory;
ULONG FileNameLength;
WCHAR FileName[1];
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
typedef struct _FILE_ALL_INFORMATION {
FILE_BASIC_INFORMATION BasicInformation;
FILE_STANDARD_INFORMATION StandardInformation;
FILE_INTERNAL_INFORMATION InternalInformation;
FILE_EA_INFORMATION EaInformation;
FILE_ACCESS_INFORMATION AccessInformation;
FILE_POSITION_INFORMATION PositionInformation;
FILE_MODE_INFORMATION ModeInformation;
FILE_ALIGNMENT_INFORMATION AlignmentInformation;
FILE_NAME_INFORMATION NameInformation;
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 03:55:40 +02:00
enum
{
FILE_PIPE_DISCONNECTED_STATE = 1,
FILE_PIPE_LISTENING_STATE = 2,
FILE_PIPE_CONNECTED_STATE = 3,
FILE_PIPE_CLOSING_STATE = 4
};
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_PIPE_LOCAL_INFORMATION
{
ULONG NamedPipeType;
ULONG NamedPipeConfiguration;
ULONG MaximumInstances;
ULONG CurrentInstances;
ULONG InboundQuota;
ULONG ReadDataAvailable;
ULONG OutboundQuota;
ULONG WriteQuotaAvailable;
ULONG NamedPipeState;
ULONG NamedPipeEnd;
} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_COMPRESSION_INFORMATION
{
LARGE_INTEGER CompressedFileSize;
USHORT CompressionFormat;
UCHAR CompressionUnitShift;
UCHAR ChunkShift;
UCHAR ClusterShift;
UCHAR Reserved[3];
} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FS_DEVICE_INFORMATION
{
ULONG DeviceType;
ULONG Characteristics;
} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
{
ULONG FileSystemAttributes;
ULONG MaximumComponentNameLength;
ULONG FileSystemNameLength;
WCHAR FileSystemName[1];
} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
#pragma pack(push,4)
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
typedef struct _FILE_FS_VOLUME_INFORMATION
{
LARGE_INTEGER VolumeCreationTime;
ULONG VolumeSerialNumber;
ULONG VolumeLabelLength;
BOOLEAN SupportsObjects;
BOOLEAN __dummy;
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
WCHAR VolumeLabel[1];
} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
#pragma pack(pop)
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FS_SIZE_INFORMATION
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
{
LARGE_INTEGER TotalAllocationUnits;
LARGE_INTEGER AvailableAllocationUnits;
ULONG SectorsPerAllocationUnit;
ULONG BytesPerSector;
} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FS_FULL_SIZE_INFORMATION
{
LARGE_INTEGER TotalAllocationUnits;
LARGE_INTEGER CallerAvailableAllocationUnits;
LARGE_INTEGER ActualAvailableAllocationUnits;
ULONG SectorsPerAllocationUnit;
ULONG BytesPerSector;
} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FS_OBJECTID_INFORMATION
{
UCHAR ObjectId[16];
UCHAR ExtendedInfo[48];
} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
typedef enum _FSINFOCLASS {
FileFsVolumeInformation = 1,
FileFsLabelInformation,
FileFsSizeInformation,
FileFsDeviceInformation,
FileFsAttributeInformation,
FileFsControlInformation,
FileFsFullSizeInformation,
FileFsObjectIdInformation,
FileFsDriverPathInformation,
FileFsMaximumInformation
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 03:55:40 +02:00
typedef enum _OBJECT_INFORMATION_CLASS
{
ObjectBasicInformation = 0,
ObjectNameInformation = 1,
ObjectHandleInformation = 4
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 03:55:40 +02:00
// and many more
} OBJECT_INFORMATION_CLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _OBJECT_BASIC_INFORMATION
{
ULONG Attributes;
ACCESS_MASK GrantedAccess;
ULONG HandleCount;
ULONG PointerCount;
ULONG PagedPoolUsage;
ULONG NonPagedPoolUsage;
ULONG Reserved[3];
ULONG NameInformationLength;
ULONG TypeInformationLength;
ULONG SecurityDescriptorLength;
LARGE_INTEGER CreateTime;
} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* autoload.cc (LoadFuncEx): Define via new LoadFuncEx2 macro. (LoadFuncEx2): Adapted from LoadFuncEx. Provides control of return value for nonexistent function. (NtQueryObject): Declare. (IsDebuggerPresent): Declare via LoadFuncEx2 and always return true if not available. * debug.h (being_debugged): Just rely on IsDebuggerPresent return value. * dtable.cc (handle_to_fn): New function. (dtable::init_std_file_from_handle): Attempt to derive std handle's name via handle_to_fn. (dtable::build_fhandler_from_name): Fill in what we can in path_conv structure when given a handle and path doesn't exist. * fhandler.cc (fhandler_base::open): Don't set the file pointer here. Use pc->exists () to determine if file exists rather than calling GetFileAttributes again. * fhandler.h (fhandler_base::exec_state_isknown): New method. (fhandler_base::fstat_helper): Add extra arguments to declaration. (fhandler_base::fstat_by_handle): Declare new method. (fhandler_base::fstat_by_name): Declare new method. * fhandler_disk_file (num_entries): Make __stdcall. (fhandler_base::fstat_by_handle): Define new method. (fhandler_base::fstat_by_name): Define new method. (fhandler_base:fstat): Call fstat_by_{handle,name} as appropriate. (fhandler_disk_file::fstat_helper): Accept extra arguments for filling out stat structure. Move handle or name specific stuff to new methods above. (fhandler_disk_file::open): Use real_path->exists rather than calling GetFileAttributes again. * ntdll.h (FILE_NAME_INFORMATION): Define new structure. (OBJECT_INFORMATION_CLASS): Partially define new enum. (OBJECT_NAME_INFORMATION): Define new structure. (NtQueryInformationFile): New declaration. (NtQueryObject): New declaration. * path.cc (path_conv::fillin): Define new method. * path.h (path_conv::fillin): Declare new method. (path_conv::drive_thpe): Rename from 'get_drive_type'. (path_conv::volser): Declare new method. (path_conv::volname): Declare new method. (path_conv::root_dir): Declare new method. * syscalls.cc (fstat64): Send real path_conv to fstat as second argument.
2002-05-28 03:55:40 +02:00
typedef struct _OBJECT_NAME_INFORMATION
{
UNICODE_STRING Name;
} OBJECT_NAME_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _DIRECTORY_BASIC_INFORMATION
{
UNICODE_STRING ObjectName;
UNICODE_STRING ObjectTypeName;
} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_GET_EA_INFORMATION
{
2013-04-23 11:44:36 +02:00
ULONG NextEntryOffset;
UCHAR EaNameLength;
CHAR EaName[1];
} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_FULL_EA_INFORMATION
{
ULONG NextEntryOffset;
UCHAR Flags;
UCHAR EaNameLength;
USHORT EaValueLength;
CHAR EaName[1];
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _FILE_MAILSLOT_SET_INFORMATION
{
LARGE_INTEGER ReadTimeout;
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
typedef VOID NTAPI (*PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG);
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
* smallprint.cc (__small_vswprintf): Fix uninitialized usage of `w'. Revamp advisory file locking to avoid cross reference pointers as well as to allow BSD flock semantics. More agressively delete unused nodes and sync objects. * fhandler.h (fhandler_base::ino): Rename from namehash. Fix comment. (fhandler_base::node): Remove. (fhandler_base::unique_id): Add. (fhandler_base::del_my_locks): New method. (get_ino): Rename from get_namehash. Change usage throughout Cygwin. (get_unique_id): New method. * fhandler.cc (fhandler_base::close): Call own del_my_locks method. Fix comment. (fhandler_base::fhandler_base): Accommodate new and changed members. (fhandler_base::fixup_after_fork): Call del_my_locks. (fhandler_base::fixup_after_exec): Ditto for files with close-on-exec flag set. * fhandler_disk_file.cc (get_ino_by_handle): Rename from readdir_get_ino_by_handle. Accommodate throughout. (fhandler_base::open_fs): Fill ino with inode number if FS has good inodes. Allocate a LUID and store in unique_id to recognize file descriptors referencing the same file object. * flock.cc: Drop flock TODO comments. Use explicit types __dev32_t and __ino64_t instead of dev_t and ino_t. (LOCK_OBJ_NAME_LEN): Change to reflect longer lf_id length. (get_obj_handle_count): New method. (lockf_t::lf_id): Change type to long long. (inode_t::get_lock_obj_handle_count): Drop in favor of static function get_obj_handle_count. (inode_t::del_locks): Remove. (inode_t::get): Add create_if_missing flag argument. (inode_t::del_my_locks): Reimplement to handle POSIX and BSD flock locks. Return if node can be deleted or not. (inode_t::~inode_t): Ditto. Close handles to i_dir and i_mtx. (fixup_lockf_after_fork): Remove. (fhandler_base::del_my_locks): New method. (fixup_lockf_after_exec): Check if node can be deleted. (inode_t::get): Only create node if create_if_missing is set. Lock the returned node here before unlocking the node list. (inode_t::get_all_locks_list): Accommodate new lf_id length. (inode_t::create_lock_obj): Ditto. (lockf_t::open_lock_obj): Ditto. Change return type to bool. De-const. Set lf_obj instead of returning a handle. (lockf_t::del_lock_obj): Call SetEvent only if new incoming parameters allow it. Explain how it's supposed to work. (fhandler_disk_file::lock): Only fetch file length in SEEK_END case. Use NtQueryInformationFile(FileStandardInformation) instead of calling fstat_by_handle. Always unlock node before returning. Use fhandler's unique id to create lf_id for BSD flock locks. Rely on node lock from inode_t::get. Call del_lock_obj on removed locks here to allow explicit unlocking. Delete node if no lock exists on the file anymore. (lf_setlock): Get file handle as additional parameter. Handle the fact that lf_getblock now always opens the attached event object. Reactivate erroneously applied patch which deactivates setting thread priority. Additionally handle blocking on BSD flock locks. (lf_clearlock): Get file handle as additional parameter. (lf_getlock): Close event handle opened by lf_getblock. (lf_getblock): Open potentially blocking event object here and check its signal state if it's a BSD flock lock. (lf_wakelock): Get file handle as additional parameter. * fork.cc (frok::child): Drop call to fixup_lockf_after_fork. * ntdll.h (struct _EVENT_BASIC_INFORMATION): Define. (enum _EVENT_INFORMATION_CLASS): Define. (NtQueryEvent): Declare. * fhandler.h (fhandler_base::fs_flags): Remove. (fhandler_base::set_fs_flags): Remove. (fhandler_base::get_fs_flags): Remove. * fhandler.cc (fhandler_base::write): Check for sparse file using pc.fs_flags(). * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Ditto. The return of the volume serial number in fs_info. * fhandler.h (get_dev): New method. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop call to NtQueryVolumeInformationFile(FileFsVolumeInformation). Just use get_dev() method. * fhandler_fifo.cc (fhandler_fifo::open) Use device ID and inode number to generate fifo name. * path.h (fs_info::sernum): New member. (fs_info::serial_number): New method. (path_conv::fs_serial_number): New method. * path.cc (fs_info::update): Fetch volume serial number and store in sernum.
2008-03-31 20:03:25 +02:00
typedef struct _EVENT_BASIC_INFORMATION
{
EVENT_TYPE EventType;
LONG SignalState;
} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
typedef enum _EVENT_INFORMATION_CLASS
{
EventBasicInformation = 0
} EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
/* Checked on 64 bit. */
typedef struct _SEMAPHORE_BASIC_INFORMATION
{
LONG CurrentCount;
LONG MaximumCount;
} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
typedef enum _SEMAPHORE_INFORMATION_CLASS
{
SemaphoreBasicInformation = 0
} SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS;
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
typedef enum _THREAD_INFORMATION_CLASS
{
ThreadBasicInformation = 0,
ThreadTimes = 1,
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
ThreadImpersonationToken = 5
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;
2013-04-23 11:44:36 +02:00
/* Checked on 64 bit. */
typedef struct _THREAD_BASIC_INFORMATION
{
NTSTATUS ExitStatus;
PNT_TIB TebBaseAddress;
CLIENT_ID ClientId;
KAFFINITY AffinityMask;
KPRIORITY Priority;
KPRIORITY BasePriority;
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
* cygtls.h (struct _local_storage): Add cw_timer member. * cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer. (_cygtls::fixup_after_fork): Ditto. * tlsoffsets.h: Regenerate. * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define. (struct _TIMER_BASIC_INFORMATION): Define. (NtQueryTimer): Declare function. * thread.h (cancelable_wait): Change timeout argument to PLARGE_INTEGER and provide NULL default. (fast_mutex::lock): Adjust accordingly. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER and default to NULL. * thread.cc (cancelable_wait): Change timeout argument to PLARGE_INTEGER. Initialize _cygtls.locals.cw_timer if needed. Use NT waitable timers for handling timeout. Return remaining time to timeout argument if timeout was relative. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER. Adjust to change in cancelable_wait. (pthread_mutex::lock): Adjust to change in cancelable_wait. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER. Adjust to changes in cancelable_wait and pthread_cond::wait. (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait. (pthread_cond_wait): Ditto. (semaphore::_timedwait): Adjust to change in cancelable_wait. (semaphore::_wait): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. * signal.cc (nanosleep): Ditto. * wait.cc (wait4): Ditto. Fix copyright dates. * times.cc (FACTOR, NSPERSEC): Move from here... * hires.h (FACTOR, NSPERSEC): ...to here.
2011-08-03 18:40:48 +02:00
typedef enum _TIMER_INFORMATION_CLASS {
TimerBasicInformation = 0
} TIMER_INFORMATION_CLASS, *PTIMER_INFORMATION_CLASS;
typedef struct _TIMER_BASIC_INFORMATION {
LARGE_INTEGER TimeRemaining;
BOOLEAN SignalState;
} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)
(PWSTR, ULONG, PVOID, ULONG, PVOID, PVOID);
typedef struct _RTL_QUERY_REGISTRY_TABLE
{
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
ULONG Flags;
PCWSTR Name;
PVOID EntryContext;
ULONG DefaultType;
PVOID DefaultData;
ULONG DefaultLength;
} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
typedef enum _KEY_VALUE_INFORMATION_CLASS
{
KeyValueBasicInformation = 0,
KeyValueFullInformation,
KeyValuePartialInformation
} KEY_VALUE_INFORMATION_CLASS, *PKEY_VALUE_INFORMATION_CLASS;
2011-06-06 07:02:13 +02:00
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
{
ULONG TitleIndex;
ULONG Type;
ULONG DataLength;
UCHAR Data[1];
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
typedef enum _SECTION_INHERIT
{
ViewShare = 1,
ViewUnmap = 2
} SECTION_INHERIT;
typedef VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID, ULONG, ULONG);
/* Function declarations for ntdll.dll. These don't appear in any
standard Win32 header. */
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
#ifdef __cplusplus
2013-04-23 11:44:36 +02:00
/* This is the mapping of the KUSER_SHARED_DATA structure into the user
address space on BOTH architectures, 32 and 64 bit!
We need it here to access the current DismountCount and InterruptTime. */
static volatile KUSER_SHARED_DATA &SharedUserData
= *(volatile KUSER_SHARED_DATA *) 0x7ffe0000;
extern "C"
{
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
#endif
NTSTATUS NTAPI NtAccessCheck (PSECURITY_DESCRIPTOR, HANDLE, ACCESS_MASK,
PGENERIC_MAPPING, PPRIVILEGE_SET, PULONG,
PACCESS_MASK, PNTSTATUS);
* cygheap.h (init_cygheap::luid): Remove. * mmap.cc (mlock): Accommodate parameter change in call to push_thread_privilege. (munlock): Ditto. * ntdll.h (STATUS_NOT_ALL_ASSIGNED): Define. (NtAdjustPrivilegesToken): Declare. * sec_helper.cc (cygpriv): Reorder to match numerical privilege order. (privilege_luid): Take job of privilege_luid_by_name, using new cygpriv. (privilege_luid_by_name): Remove. (privilege_name): Accommodate new cygpriv array. (set_privilege): Call NtAdjustPrivilegesToken to avoid using advapi32. Accommodate changes to privilege_name. (set_cygwin_privileges): Simplify. Don't try to set SE_CREATE_GLOBAL_PRIVILEGE on systems not supporting it. * security.cc (sys_privs): Reorder to match numerical privilege order. Use real privilege values as defined in security.h. (get_system_priv_list): Drop unused grp_list argument. Create list of privileges according to new wincapc::max_sys_priv value. (get_priv_list): Call privilege_luid instead of privilege_luid_by_name. Make priv a local value instead of a pointer. (create_token): Accommodate parameter change in call to push_self_privilege. (lsaauth): Ditto. (check_access): Use privilege values directly instead of calling privilege_luid. * security.h: Define real privilege values. (cygpriv_idx): Remove. (privilege_luid): Change declaration. (privilege_luid_by_name): Drop declaration. (set_privilege): Change declaration. (set_process_privilege): Drop definition. (_push_thread_privilege): Accomodate new set_privilege parameters. * wincap.h (wincapc::max_sys_priv): New element. * wincap.cc: Implement above element throughout. (wincap_2000sp4): New wincaps structure. (wincap_xpsp1): Ditto. (wincap_xpsp2): Ditto. (wincapc::init): Use new wincaps. (wincapc::max_sys_priv): New element.
2007-07-19 10:33:22 +02:00
NTSTATUS NTAPI NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES,
ULONG, PTOKEN_PRIVILEGES, PULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtAllocateLocallyUniqueId (PLUID);
NTSTATUS NTAPI NtAllocateUuids (PLARGE_INTEGER, PULONG, PULONG, PUCHAR);
NTSTATUS NTAPI NtCancelTimer (HANDLE, PBOOLEAN);
NTSTATUS NTAPI NtClose (HANDLE);
NTSTATUS NTAPI NtCommitTransaction (HANDLE, BOOLEAN);
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtCreateKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG,
PUNICODE_STRING, ULONG, PULONG);
NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
EVENT_TYPE, BOOLEAN);
* autoload.cc (NtCreateFile): Add. * dir.cc (mkdir): Change set_file_attribute call to indicate that NT security isn't used. * fhandler.cc (fhandler_base::open_9x): New method, created from fhandler_base::open. (fhandler_base::open): Rearrange to use NtCreateFile instead of CreateFile. * fhandler.h (enum query_state): Redefine query_null_access to query_stat_control. query_null_access isn't allowed in NtCreateFile. (fhandler_base::open_9x): Declare. * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use query_stat_control first, query_read_control if that fails. (fhandler_disk_file::fchmod): Call enable_restore_privilege before trying to open for query_write_control. Don't fall back to opening for query_read_control. (fhandler_disk_file::fchown): Ditto. (fhandler_disk_file::facl): Only request restore privilege and query access necessary for given cmd. * fhandler_raw.cc (fhandler_dev_raw::open): Call fhandler_base::open instead of opening device here. * ntdll.h (NtCreateFile): Declare. * path.cc (symlink_worker): Change set_file_attribute call to indicate that NT security isn't used. * sec_acl.cc (getacl): Fix bracketing. * sec_helper.cc (enable_restore_privilege): New function. * security.cc (str2buf2uni_cat): New function. (write_sd): Don't request restore permission here. * security.h (set_process_privileges): Drop stale declaration. (str2buf2uni): Declare. (str2buf2uni_cat): Declare. (enable_restore_privilege): Declare. * syscalls.cc (fchown32): Return immediate success on 9x.
2004-04-16 23:22:13 +02:00
NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
ULONG, ULONG, PVOID, ULONG);
NTSTATUS NTAPI NtCreateMailslotFile(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG, ULONG,
PLARGE_INTEGER);
NTSTATUS NTAPI NtCreateMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
BOOLEAN);
* autoload.cc (NtCreateSection): Define. * cygheap.cc (_csbrk): Call getpagesize instead of getshmlba. * dcrt0.cc (dll_crt0_0): Call mmap_init. * external.cc (cygwin_internal): Call getpagesize instead of getshmlba. * fhandler.h (fhandler_base::mmap): Change access to prot parameter. (fhandler_base::fixup_mmap_after_fork): Ditto. (fhandler_disk_file::mmap): Ditto. (fhandler_disk_file::fixup_mmap_after_fork): Ditto. (fhandler_dev_mem::mmap): Ditto. (fhandler_dev_mem::fixup_mmap_after_fork): Ditto. * fhandler_mem.cc (fhandler_dev_mem::write): Call getsystempagesize instead of getpagesize. (fhandler_dev_mem::read): Ditto. (fhandler_dev_mem::fstat): Ditto. (fhandler_dev_mem::mmap): Move to mmap.cc. (fhandler_dev_mem::munmap): Ditto. (fhandler_dev_mem::msync): Ditto. (fhandler_dev_mem::fixup_mmap_after_fork): Ditto. * fhandler_proc.cc (format_proc_meminfo): Call getsystempagesize instead of getpagesize. * fhandler_process.cc (format_process_stat): Ditto. (format_process_status): Ditto. (get_mem_values): Ditto. * mmap.cc: Fix formatting. Try to make more readable and modular. Take advantage of pagesize==granularity. (gen_protect): New static function to evaluate Windows protection bits from POSIX protection and flags. (gen_access): Ditto for Windows access mode. (VirtualProt9x): Wrapper function to call VirtualProtect on 9x. (VirtualProtNT): Ditto for NT. (VirtualProtEx9x): Ditto for VirtualProtectEx on 9x. (VirtualProtExNT): Ditto for NT. (CreateMapping9x): Wrapper function for creating a mapping handle on 9x. (CreateMappingNT): Ditto for NT. (MapView9x): Wrapper function to map a view on 9x. (MapViewNT): Ditto for NT. (mmap_funcs_9x): Structure containing function pointers to wrapper functions for 9x. (mmap_funcs_nt): Ditto for NT. (mmap_func): Pointer to wrapper functions used in subsequent code. (mmap_init): Initialize mmap_func depending on OS. (class mmap_record): Use sensible member names. Add POSIX protection member. Drop Windows access flags member. Constify more methods. Use accessors instead of direct member access inside of own methods. (mmap_record::gen_protect): Class wrapper to evaluate matching Windows protection bits. (mmap_record::gen_access): Ditto for Windows access flags. (mmap_record::compatible_flags): New function to check if flags are compatible with flags of existing map. (list::add_record): Drop offset and length arguments. (class map): Change counters to unsigned. Match usage throughout. (mmapped_areas): Convert from pointer to global struct. (mmap_record::alloc_page_map): Simplify. (mmap_record::map_pages): Ditto. (mmap_record::fixup_page_map): Delete. (mmap64): Simplify. Add workaround for Windows 98 bug. Fix bug on NT that existing anonymous mappings weren't searched for a match. (munmap): Add workaround for Windows 98 bug. (msync): Simplify. (mprotect): Handle existing maps correctly. (mlock): Add local pagesize variable and enlightening comment. (fhandler_disk_file::mmap): Main functionality now in CreateMapping/ MapView wrapper functions. (fhandler_disk_file::fixup_mmap_after_fork): Call MapView wrapper. (fhandler_dev_mem::mmap): Moved from fhandler_mem.cc. Simplify by calling MapViewNT. (fhandler_dev_mem::munmap): Moved from fhandler_mem.cc. (fhandler_dev_mem::msync): Ditto. (fhandler_dev_mem::fixup_mmap_after_fork): Ditto. Call MapViewNT. (fixup_mmaps_after_fork): Restructure and hopefully speed up loop for setting protection and memory content on MAP_PRIVATE maps. * ntdll.h (AT_ROUND_TO_PAGE): Remove define. (AT_EXTENDABLE_FILE): Add define. (NtCreateSection): Add prototype. * syscalls.cc (getpagesize): Return granularity as pagesize now. (getsystempagesize): New function to retrieve "real" pagesize. (getshmlba): Delete since it's replaced by getpagesize now. * wincap.h (wincaps::has_mmap_alignment_bug): New element. * wincap.cc: Implement above element throughout. * winsup.h (getshmlba): Drop prototype. (getsystempagesize): Add prototype. (mmap_init): Ditto. * include/sys/mman.h: (Not yet) define MAP_NORESERVE.
2005-11-28 23:32:29 +01:00
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
* Makefile.in (DLL_OFILES): Add kernel32.o. * autoload.cc (WSACloseEvent): Remove. (WSACreateEvent): Remove. * cygheap.cc (cygheap_init): Drop initializing shared_prefix. * cygheap.h (struct init_cygheap): Drop shared_prefix and shared_prefix_buf members. * fhandler_socket.cc (sock_shared_name): New static function. (search_wsa_event_slot): Convert name buffers to WCHAR. Call NtCreateMutant/NtOpenMutant to create mutexes in session local namespace. (fhandler_socket::init_events): Ditto. Fix debug output. (fhandler_socket::release_events): Close mutexes using NtClose. (fhandler_socket::dup): Ditto. * kernel32.cc: New file, implementing Win32 calls in a Cygwin-specific way. * mmap.cc (MapView): Make static. * ntdll.h: Fix status code sorting. (STATUS_OBJECT_NAME_EXISTS): Define. (SEMAPHORE_QUERY_STATE): Define. (CYG_SHARED_DIR_ACCESS): Define. (CYG_MUTANT_ACCESS): Define. (CYG_EVENT_ACCESS): Define. (CYG_SEMAPHORE_ACCESS): Define. (enum _PROCESSINFOCLASS): Define ProcessSessionInformation. (struct _PROCESS_SESSION_INFORMATION): Define. (NtCreateSemaphore): Declare. (NtOpenSemaphore): Declare. * flock.cc: Use CYG_xxx_ACCESS access masks where appropriate. * posix_ipc.cc (ipc_mutex_init): Use native functions to create mutex. Create in cygwin-shared subdir. (ipc_cond_init): Ditto for event. (ipc_mutex_close): Use NtClose. (ipc_cond_close): Ditto. (mq_open): Drop "cyg" prefix from mqh_uname. * shared.cc (CYG_SHARED_DIR_ACCESS): Drop definition here. (_cygwin_testing): Declare extern on file level. (get_shared_parent_dir): Change name of shared directory. Add name to api_fatal output. (get_session_parent_dir): New function. (shared_name): Simplify. (shared_info::initialize): Call get_session_parent_dir. * shared_info.h (get_session_parent_dir): Declare. * smallprint.cc (__small_vswprintf): Fix bug in multibyte string conversion. * thread.cc (semaphore::semaphore): Align semaphore name to object names in posix IPC functions. * include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2008-04-21 14:46:58 +02:00
NTSTATUS NTAPI NtCreateSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
LONG, LONG);
NTSTATUS NTAPI NtCreateTimer (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
TIMER_TYPE);
* autoload.cc: Add load statements for `LookupAccountNameW', `LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory', `LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum', `NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and `NtCreateToken'. * ntdll.h: Add declaration for `NtCreateToken'. * sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid', `well_known_network_sid', `well_known_batch_sid', `well_known_interactive_sid', `well_known_service_sid' and `well_known_authenticated_users_sid'. (cygsid::string): Define as const method. (cygsid::get_sid): Set psid to NO_SID on error. (cygsid::getfromstr): Ditto. (cygsid::getfrompw): Simplify. (cygsid::getfromgr): Check for gr == NULL. (legal_sid_type): Move to security.h. (set_process_privilege): Return -1 on error, otherwise 0 or 1 related to previous privilege setting. * security.cc (extract_nt_dom_user): Remove `static'. (lsa2wchar): New function. (open_local_policy): Ditto. (close_local_policy): Ditto. (get_lsa_srv_inf): Ditto. (get_logon_server): Ditto. (get_logon_server_and_user_domain): Ditto. (get_user_groups): Ditto. (is_group_member): Ditto. (get_user_local_groups): Ditto. (sid_in_token_groups): Ditto. (get_user_primary_group): Ditto. (get_group_sidlist): Ditto. (get_system_priv_list): Ditto. (get_priv_list): Ditto. (get_dacl): Ditto. (create_token): Ditto. (subauth): Return immediately if SE_TCB_NAME can't be assigned. Change all return statements in case of error to jumps to `out' label. Add `out' label to support cleanup. * security.h: Add extern declarations for `well_known_local_sid', `well_known_dialup_sid', `well_known_network_sid', `well_known_batch_sid', `well_known_interactive_sid', `well_known_service_sid' and `well_known_authenticated_users_sid'. Add extern declarations for functions `create_token', `extract_nt_dom_user' and `get_logon_server_and_user_domain'. (class cygsid): Add method `assign'. Change operator= to call new `assign' method. Add `debug_print' method. (class cygsidlist): New class. (legal_sid_type): Moved from sec_helper.cc to here. * spawn.cc (spawn_guts) Revert reversion of previous patch. Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid' again. * syscalls.cc (seteuid): Rearranged. Call `create_token' now when needed. Call `subauth' if `create_token' fails. Try setting token owner and primary group only if token was not explicitely created by `create_token'. * uinfo.cc (internal_getlogin): Try harder to generate correct user information. Especially don't trust return value of `GetUserName'.
2001-05-20 10:10:47 +02:00
NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
PTOKEN_PRIMARY_GROUP, PTOKEN_DEFAULT_DACL,
PTOKEN_SOURCE);
NTSTATUS NTAPI NtCreateTransaction (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
LPGUID, HANDLE, ULONG, ULONG, ULONG,
PLARGE_INTEGER, PUNICODE_STRING);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtDuplicateToken (HANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
BOOLEAN, TOKEN_TYPE, PHANDLE);
NTSTATUS NTAPI NtFsControlFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
PIO_STATUS_BLOCK, ULONG, PVOID, ULONG,
PVOID, ULONG);
NTSTATUS NTAPI NtFlushBuffersFile (HANDLE, PIO_STATUS_BLOCK);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtLoadKey (POBJECT_ATTRIBUTES, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtLockFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
PIO_STATUS_BLOCK, PLARGE_INTEGER, PLARGE_INTEGER,
ULONG, BOOLEAN, BOOLEAN);
2013-04-23 11:44:36 +02:00
NTSTATUS NTAPI NtLockVirtualMemory (HANDLE, PVOID *, PSIZE_T, ULONG);
NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG_PTR, SIZE_T,
PLARGE_INTEGER, PSIZE_T, SECTION_INHERIT,
ULONG, ULONG);
NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE,
PVOID, PIO_STATUS_BLOCK,
PFILE_NOTIFY_INFORMATION, ULONG,
ULONG, BOOLEAN);
NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtOpenKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtOpenProcessToken (HANDLE, ACCESS_MASK, PHANDLE);
NTSTATUS NTAPI NtOpenThreadToken (HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
* autoload.cc: Add load statements for `LookupAccountNameW', `LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory', `LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum', `NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and `NtCreateToken'. * ntdll.h: Add declaration for `NtCreateToken'. * sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid', `well_known_network_sid', `well_known_batch_sid', `well_known_interactive_sid', `well_known_service_sid' and `well_known_authenticated_users_sid'. (cygsid::string): Define as const method. (cygsid::get_sid): Set psid to NO_SID on error. (cygsid::getfromstr): Ditto. (cygsid::getfrompw): Simplify. (cygsid::getfromgr): Check for gr == NULL. (legal_sid_type): Move to security.h. (set_process_privilege): Return -1 on error, otherwise 0 or 1 related to previous privilege setting. * security.cc (extract_nt_dom_user): Remove `static'. (lsa2wchar): New function. (open_local_policy): Ditto. (close_local_policy): Ditto. (get_lsa_srv_inf): Ditto. (get_logon_server): Ditto. (get_logon_server_and_user_domain): Ditto. (get_user_groups): Ditto. (is_group_member): Ditto. (get_user_local_groups): Ditto. (sid_in_token_groups): Ditto. (get_user_primary_group): Ditto. (get_group_sidlist): Ditto. (get_system_priv_list): Ditto. (get_priv_list): Ditto. (get_dacl): Ditto. (create_token): Ditto. (subauth): Return immediately if SE_TCB_NAME can't be assigned. Change all return statements in case of error to jumps to `out' label. Add `out' label to support cleanup. * security.h: Add extern declarations for `well_known_local_sid', `well_known_dialup_sid', `well_known_network_sid', `well_known_batch_sid', `well_known_interactive_sid', `well_known_service_sid' and `well_known_authenticated_users_sid'. Add extern declarations for functions `create_token', `extract_nt_dom_user' and `get_logon_server_and_user_domain'. (class cygsid): Add method `assign'. Change operator= to call new `assign' method. Add `debug_print' method. (class cygsidlist): New class. (legal_sid_type): Moved from sec_helper.cc to here. * spawn.cc (spawn_guts) Revert reversion of previous patch. Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid' again. * syscalls.cc (seteuid): Rearranged. Call `create_token' now when needed. Call `subauth' if `create_token' fails. Try setting token owner and primary group only if token was not explicitely created by `create_token'. * uinfo.cc (internal_getlogin): Try harder to generate correct user information. Especially don't trust return value of `GetUserName'.
2001-05-20 10:10:47 +02:00
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
* Makefile.in (DLL_OFILES): Add kernel32.o. * autoload.cc (WSACloseEvent): Remove. (WSACreateEvent): Remove. * cygheap.cc (cygheap_init): Drop initializing shared_prefix. * cygheap.h (struct init_cygheap): Drop shared_prefix and shared_prefix_buf members. * fhandler_socket.cc (sock_shared_name): New static function. (search_wsa_event_slot): Convert name buffers to WCHAR. Call NtCreateMutant/NtOpenMutant to create mutexes in session local namespace. (fhandler_socket::init_events): Ditto. Fix debug output. (fhandler_socket::release_events): Close mutexes using NtClose. (fhandler_socket::dup): Ditto. * kernel32.cc: New file, implementing Win32 calls in a Cygwin-specific way. * mmap.cc (MapView): Make static. * ntdll.h: Fix status code sorting. (STATUS_OBJECT_NAME_EXISTS): Define. (SEMAPHORE_QUERY_STATE): Define. (CYG_SHARED_DIR_ACCESS): Define. (CYG_MUTANT_ACCESS): Define. (CYG_EVENT_ACCESS): Define. (CYG_SEMAPHORE_ACCESS): Define. (enum _PROCESSINFOCLASS): Define ProcessSessionInformation. (struct _PROCESS_SESSION_INFORMATION): Define. (NtCreateSemaphore): Declare. (NtOpenSemaphore): Declare. * flock.cc: Use CYG_xxx_ACCESS access masks where appropriate. * posix_ipc.cc (ipc_mutex_init): Use native functions to create mutex. Create in cygwin-shared subdir. (ipc_cond_init): Ditto for event. (ipc_mutex_close): Use NtClose. (ipc_cond_close): Ditto. (mq_open): Drop "cyg" prefix from mqh_uname. * shared.cc (CYG_SHARED_DIR_ACCESS): Drop definition here. (_cygwin_testing): Declare extern on file level. (get_shared_parent_dir): Change name of shared directory. Add name to api_fatal output. (get_session_parent_dir): New function. (shared_name): Simplify. (shared_info::initialize): Call get_session_parent_dir. * shared_info.h (get_session_parent_dir): Declare. * smallprint.cc (__small_vswprintf): Fix bug in multibyte string conversion. * thread.cc (semaphore::semaphore): Align semaphore name to object names in posix IPC functions. * include/cygwin/version.h (CYGWIN_VERSION_SHARED_DATA): Bump.
2008-04-21 14:46:58 +02:00
NTSTATUS NTAPI NtOpenSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
* Makefile.in (DLL_OFILES): Add fhandler_procsys.o. * devices.h (enum fh_devices): Add FH_PROCSYS. * devices.in (dev_procsys_storage): New device. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Add code to allocate fhandler_procsys. * fhandler.h (proc_len): Convert to size_t. (procsys): Declare. (procsys_len): Declare. (enum virtual_ftype_t): Move here from fhandler_virtual.h. Add members supported by fhandler_procsys. (fhandler_virtual::exists): Return virtual_ftype_t. Change in all derived classes. (class fhandler_procsys): New class. (fhandler_union): Add fhandler_procnet and fhandler_procsys members. * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Use ro_u_proc. (fhandler_base::fstat_by_handle): Don't copy attributes if file is an NT device. (fhandler_base::fstat_by_name): Ditto. * fhandler_netdrive.cc (fhandler_netdrive::exists): Return virtual_ftype_t. * fhandler_proc.cc (proc_tab): Sort alphabetically. Use _VN macro to store length. (proc_len): Change to size_t. (proc_tab_cmp): New static function. (virt_tab_search): New function to search entry in virt_tab_t arrays. Use throughout in /proc and sibling classes instead of loop. (fhandler_proc::exists): Return virtual_ftype_t. * fhandler_process.cc (process_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_process::exists): Return virtual_ftype_t. (fhandler_process::open): Simplify code. * fhandler_procnet.cc (procnet_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_procnet::exists): Return virtual_ftype_t. (fhandler_procnet::open): Simplify. * fhandler_procsys.cc: New file. * fhandler_registry.cc (fhandler_registry::exists): Return virtual_ftype_t. * fhandler_virtual.cc (fhandler_virtual::exists): Ditto. * fhandler_virtual.h (enum virtual_ftype_t): Move to fhandler.h. (virt_tab_t): Add name_len member. (_VN): New macro. (virt_tab_search): Declare. * mount.cc (mount_info::conv_to_win32_path): Fix comment. Backslashify isprocsys_dev paths. * ntdll.h (STATUS_OBJECT_TYPE_MISMATCH): Define (STATUS_INSTANCE_NOT_AVAILABLE): Define. (STATUS_PIPE_NOT_AVAILABLE): Define. (STATUS_INVALID_PIPE_STATE): Define. (STATUS_PIPE_BUSY): Define. (SYMBOLIC_LINK_QUERY): Define. (NtOpenSymbolicLinkObject): Declare. (NtQuerySymbolicLinkObject): Declare. * path.cc (path_conv::check): Accommodate fact that exists method returns virtual_ftype_t now. Add cases for new virtual_ftype_t types. (cygwin_conv_path): Add GLOBALROOT prefix to native device paths. Make sure to strip \\?\ prefix only for actual filesystem-based paths, not for all paths. * path.h (isproc_dev): Add FH_PROCSYS. (isprocsys_dev): Define.
2010-09-06 11:47:01 +02:00
NTSTATUS NTAPI NtOpenSymbolicLinkObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES);
/* WARNING! Don't rely on the timestamp information returned by
NtQueryAttributesFile. Only the DOS file attribute info is reliable. */
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtPrivilegeCheck (HANDLE, PPRIVILEGE_SET, PBOOLEAN);
NTSTATUS NTAPI NtQueryAttributesFile (POBJECT_ATTRIBUTES,
PFILE_BASIC_INFORMATION);
NTSTATUS NTAPI NtQueryDirectoryFile(HANDLE, HANDLE, PVOID, PVOID,
PIO_STATUS_BLOCK, PVOID, ULONG,
FILE_INFORMATION_CLASS, BOOLEAN,
PUNICODE_STRING, BOOLEAN);
NTSTATUS NTAPI NtQueryDirectoryObject (HANDLE, PVOID, ULONG, BOOLEAN,
BOOLEAN, PULONG, PULONG);
NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
* smallprint.cc (__small_vswprintf): Fix uninitialized usage of `w'. Revamp advisory file locking to avoid cross reference pointers as well as to allow BSD flock semantics. More agressively delete unused nodes and sync objects. * fhandler.h (fhandler_base::ino): Rename from namehash. Fix comment. (fhandler_base::node): Remove. (fhandler_base::unique_id): Add. (fhandler_base::del_my_locks): New method. (get_ino): Rename from get_namehash. Change usage throughout Cygwin. (get_unique_id): New method. * fhandler.cc (fhandler_base::close): Call own del_my_locks method. Fix comment. (fhandler_base::fhandler_base): Accommodate new and changed members. (fhandler_base::fixup_after_fork): Call del_my_locks. (fhandler_base::fixup_after_exec): Ditto for files with close-on-exec flag set. * fhandler_disk_file.cc (get_ino_by_handle): Rename from readdir_get_ino_by_handle. Accommodate throughout. (fhandler_base::open_fs): Fill ino with inode number if FS has good inodes. Allocate a LUID and store in unique_id to recognize file descriptors referencing the same file object. * flock.cc: Drop flock TODO comments. Use explicit types __dev32_t and __ino64_t instead of dev_t and ino_t. (LOCK_OBJ_NAME_LEN): Change to reflect longer lf_id length. (get_obj_handle_count): New method. (lockf_t::lf_id): Change type to long long. (inode_t::get_lock_obj_handle_count): Drop in favor of static function get_obj_handle_count. (inode_t::del_locks): Remove. (inode_t::get): Add create_if_missing flag argument. (inode_t::del_my_locks): Reimplement to handle POSIX and BSD flock locks. Return if node can be deleted or not. (inode_t::~inode_t): Ditto. Close handles to i_dir and i_mtx. (fixup_lockf_after_fork): Remove. (fhandler_base::del_my_locks): New method. (fixup_lockf_after_exec): Check if node can be deleted. (inode_t::get): Only create node if create_if_missing is set. Lock the returned node here before unlocking the node list. (inode_t::get_all_locks_list): Accommodate new lf_id length. (inode_t::create_lock_obj): Ditto. (lockf_t::open_lock_obj): Ditto. Change return type to bool. De-const. Set lf_obj instead of returning a handle. (lockf_t::del_lock_obj): Call SetEvent only if new incoming parameters allow it. Explain how it's supposed to work. (fhandler_disk_file::lock): Only fetch file length in SEEK_END case. Use NtQueryInformationFile(FileStandardInformation) instead of calling fstat_by_handle. Always unlock node before returning. Use fhandler's unique id to create lf_id for BSD flock locks. Rely on node lock from inode_t::get. Call del_lock_obj on removed locks here to allow explicit unlocking. Delete node if no lock exists on the file anymore. (lf_setlock): Get file handle as additional parameter. Handle the fact that lf_getblock now always opens the attached event object. Reactivate erroneously applied patch which deactivates setting thread priority. Additionally handle blocking on BSD flock locks. (lf_clearlock): Get file handle as additional parameter. (lf_getlock): Close event handle opened by lf_getblock. (lf_getblock): Open potentially blocking event object here and check its signal state if it's a BSD flock lock. (lf_wakelock): Get file handle as additional parameter. * fork.cc (frok::child): Drop call to fixup_lockf_after_fork. * ntdll.h (struct _EVENT_BASIC_INFORMATION): Define. (enum _EVENT_INFORMATION_CLASS): Define. (NtQueryEvent): Declare. * fhandler.h (fhandler_base::fs_flags): Remove. (fhandler_base::set_fs_flags): Remove. (fhandler_base::get_fs_flags): Remove. * fhandler.cc (fhandler_base::write): Check for sparse file using pc.fs_flags(). * fhandler_disk_file.cc (fhandler_disk_file::ftruncate): Ditto. The return of the volume serial number in fs_info. * fhandler.h (get_dev): New method. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Drop call to NtQueryVolumeInformationFile(FileFsVolumeInformation). Just use get_dev() method. * fhandler_fifo.cc (fhandler_fifo::open) Use device ID and inode number to generate fifo name. * path.h (fs_info::sernum): New member. (fs_info::serial_number): New method. (path_conv::fs_serial_number): New method. * path.cc (fs_info::update): Fetch volume serial number and store in sernum.
2008-03-31 20:03:25 +02:00
NTSTATUS NTAPI NtQueryEvent (HANDLE, EVENT_INFORMATION_CLASS, PVOID, ULONG,
PULONG);
NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES,
PFILE_NETWORK_OPEN_INFORMATION);
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
ULONG, FILE_INFORMATION_CLASS);
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
2003-03-09 21:31:07 +01:00
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryInformationThread (HANDLE, THREAD_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtQueryInformationToken (HANDLE, TOKEN_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
2003-03-09 21:31:07 +01:00
ULONG, ULONG *);
NTSTATUS NTAPI NtQuerySemaphore (HANDLE, SEMAPHORE_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
* shared_info.h (user_info): Add dll_crt0_1 as a friend. (user_info::version): Make LONG to accommodate spinlock use. (user_info::create): New static function renamed from user_info_create. (user_info::initialize): New private function renamed from user_info_initialize. (SHARED_VERSION): Delete. (SHARED_VERSION_MAGIC): Ditto. (USER_VERSION_MAGIC): Ditto. (SHARED_INFO_CB): Ditto. (USER_VERSION): Ditto. (USER_VERSION_MAGIC): Ditto. (CURR_SHARED_MAGIC): Update. (CURR_USER_MAGIC): Ditto. (shared_info::version): Make LONG to accommodate spinlock use. (shared_info::create): New static function mirroring user_info::create. (dll_crt0_1): Accommodate change to user_info::initialize. * spinlock.h (spinlock::setto): New variable member. (spinlock::done): New function. (spinlock::spinlock): Generalize to allow arbitrary values and timeouts. Call done() when lock is not needed. * ntdll.h: Make multiple-inclusion safe. (NtQuerySystemTime): Declare. * shared.cc (installation_root_inited): Rename from shared_mem_inited. (init_installation_root): Make inline. Use a spinlock to ensure that this is initialized only once per session. (user_info::initialize): Rename from user_shared_initialize. Protect with spinlock on sversion and remove other spinlock-like things. Remove reference to user_shared since it is now implicit. Refer to spinlock version of multiple_cygwin_problem to ensure that any spinlock is released. (user_info::create): Rename from user_shared_create. Accommodate change from user_shared_initialize to user_info::initialize. (shared_info::create): New inline function. (shared_info::initialize): Protect with spinlock on sversion. Move heap_init back under specific control of shared_info spinlock. Remove reference to SHARED_INFO_CB and just use sizeof(*this). (memory_init): Move all locking into respective functions where it is needed. Accommodate name changes. Remove call to heap_init(). * syscalls.cc (seteuid32): Accommodate name change to user_info::create(). * mount.cc (mount_info::create_root_entry): Report on errors from add_item since they should be nonexistent. (mount_info::init): Don't initialize nmounts. It should already be zero. Give more verbose error when root_idx < 0. Implicitly use this pointer rather than explicitly referencing mount_table->. (mount_info::add_item): Minor whitespace fix.
2010-03-15 22:29:15 +01:00
NTSTATUS WINAPI NtQuerySystemTime (PLARGE_INTEGER);
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
PSECURITY_DESCRIPTOR, ULONG, PULONG);
* Makefile.in (DLL_OFILES): Add fhandler_procsys.o. * devices.h (enum fh_devices): Add FH_PROCSYS. * devices.in (dev_procsys_storage): New device. * devices.cc: Regenerate. * dtable.cc (build_fh_pc): Add code to allocate fhandler_procsys. * fhandler.h (proc_len): Convert to size_t. (procsys): Declare. (procsys_len): Declare. (enum virtual_ftype_t): Move here from fhandler_virtual.h. Add members supported by fhandler_procsys. (fhandler_virtual::exists): Return virtual_ftype_t. Change in all derived classes. (class fhandler_procsys): New class. (fhandler_union): Add fhandler_procnet and fhandler_procsys members. * fhandler_disk_file.cc (__DIR_mounts::check_missing_mount): Use ro_u_proc. (fhandler_base::fstat_by_handle): Don't copy attributes if file is an NT device. (fhandler_base::fstat_by_name): Ditto. * fhandler_netdrive.cc (fhandler_netdrive::exists): Return virtual_ftype_t. * fhandler_proc.cc (proc_tab): Sort alphabetically. Use _VN macro to store length. (proc_len): Change to size_t. (proc_tab_cmp): New static function. (virt_tab_search): New function to search entry in virt_tab_t arrays. Use throughout in /proc and sibling classes instead of loop. (fhandler_proc::exists): Return virtual_ftype_t. * fhandler_process.cc (process_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_process::exists): Return virtual_ftype_t. (fhandler_process::open): Simplify code. * fhandler_procnet.cc (procnet_tab): Sort alphabetically. Use _VN macro to store length. (fhandler_procnet::exists): Return virtual_ftype_t. (fhandler_procnet::open): Simplify. * fhandler_procsys.cc: New file. * fhandler_registry.cc (fhandler_registry::exists): Return virtual_ftype_t. * fhandler_virtual.cc (fhandler_virtual::exists): Ditto. * fhandler_virtual.h (enum virtual_ftype_t): Move to fhandler.h. (virt_tab_t): Add name_len member. (_VN): New macro. (virt_tab_search): Declare. * mount.cc (mount_info::conv_to_win32_path): Fix comment. Backslashify isprocsys_dev paths. * ntdll.h (STATUS_OBJECT_TYPE_MISMATCH): Define (STATUS_INSTANCE_NOT_AVAILABLE): Define. (STATUS_PIPE_NOT_AVAILABLE): Define. (STATUS_INVALID_PIPE_STATE): Define. (STATUS_PIPE_BUSY): Define. (SYMBOLIC_LINK_QUERY): Define. (NtOpenSymbolicLinkObject): Declare. (NtQuerySymbolicLinkObject): Declare. * path.cc (path_conv::check): Accommodate fact that exists method returns virtual_ftype_t now. Add cases for new virtual_ftype_t types. (cygwin_conv_path): Add GLOBALROOT prefix to native device paths. Make sure to strip \\?\ prefix only for actual filesystem-based paths, not for all paths. * path.h (isproc_dev): Add FH_PROCSYS. (isprocsys_dev): Define.
2010-09-06 11:47:01 +02:00
NTSTATUS NTAPI NtQuerySymbolicLinkObject (HANDLE, PUNICODE_STRING, PULONG);
* cygtls.h (struct _local_storage): Add cw_timer member. * cygtls.cc (_cygtls::init_thread): Initialize locals.cw_timer. (_cygtls::fixup_after_fork): Ditto. * tlsoffsets.h: Regenerate. * ntdll.h (enum _TIMER_INFORMATION_CLASS): Define. (struct _TIMER_BASIC_INFORMATION): Define. (NtQueryTimer): Declare function. * thread.h (cancelable_wait): Change timeout argument to PLARGE_INTEGER and provide NULL default. (fast_mutex::lock): Adjust accordingly. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER and default to NULL. * thread.cc (cancelable_wait): Change timeout argument to PLARGE_INTEGER. Initialize _cygtls.locals.cw_timer if needed. Use NT waitable timers for handling timeout. Return remaining time to timeout argument if timeout was relative. (pthread_cond::wait): Change timeout argument to PLARGE_INTEGER. Adjust to change in cancelable_wait. (pthread_mutex::lock): Adjust to change in cancelable_wait. (pthread_spinlock::lock): Ditto. (pthread::join): Ditto. (__pthread_cond_dowait): Change waitlength argument to PLARGE_INTEGER. Adjust to changes in cancelable_wait and pthread_cond::wait. (pthread_cond_timedwait): Adjust to change in __pthread_cond_dowait. (pthread_cond_wait): Ditto. (semaphore::_timedwait): Adjust to change in cancelable_wait. (semaphore::_wait): Ditto. * exceptions.cc (handle_sigsuspend): Ditto. * signal.cc (nanosleep): Ditto. * wait.cc (wait4): Ditto. Fix copyright dates. * times.cc (FACTOR, NSPERSEC): Move from here... * hires.h (FACTOR, NSPERSEC): ...to here.
2011-08-03 18:40:48 +02:00
NTSTATUS NTAPI NtQueryTimer (HANDLE, TIMER_INFORMATION_CLASS, PVOID,
ULONG, PULONG);
NTSTATUS NTAPI NtQueryTimerResolution (PULONG, PULONG, PULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtQueryValueKey (HANDLE, PUNICODE_STRING,
KEY_VALUE_INFORMATION_CLASS, PVOID, ULONG,
PULONG);
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
2013-04-23 11:44:36 +02:00
PVOID, SIZE_T, PSIZE_T);
* autoload.cc (NtQueryVolumeInformationFile): Add. * fhandler.cc (fhandler_base::raw_write): Don't touch has_changed flag. * fhandler.h (enum change_state): Remove. (fhandler_base::status): Revert has_changed to a simple bit. (fhandler_base::fstat_helper): Add nAllocSize parameter. Rename ftCreationTime to ftChangeTime. * fhandler_disk_file.cc: Call fstat_helper with additional allocation size throughout. (fhandler_base::fstat_by_handle): Use NT native functions to get full file information on NT. Call fstat_helper with LastWriteTime as ctime, if ChangeTime is not available. (fhandler_base::fstat_by_name): Call fstat_helper with LastWriteTime as ctime. (fhandler_base::fstat_helper): Add comment. Drop special FAT handling since it's useless. Use nAllocSize for st_blocks if available. (fhandler_disk_file::touch_ctime): Only touch LastWriteTime. (fhandler_disk_file::fchmod): Set has_changed on 9x only. (fhandler_disk_file::fchown): Don't set has_changed. (fhandler_disk_file::facl): Ditto. (fhandler_disk_file::ftruncate): Ditto. (fhandler_disk_file::link): Set has_changed on 9x only and on original file only. (fhandler_base::open_fs): Don't set has_changed in O_TRUNC case. * ntdll.h (FILE_BASIC_INFORMATION): Define. (FILE_STANDARD_INFORMATION): Define. (FILE_INTERNAL_INFORMATION): Define. (FILE_EA_INFORMATION): Define. (FILE_ACCESS_INFORMATION): Define. (FILE_POSITION_INFORMATION): Define. (FILE_MODE_INFORMATION): Define. (FILE_ALIGNMENT_INFORMATION): Define. (FILE_NAME_INFORMATION): Don't define with arbitrary FileName size. (FILE_ALL_INFORMATION): Define. (FILE_INFORMATION_CLASS): Add FileAllInformation. (FILE_FS_VOLUME_INFORMATION): Define. (FS_INFORMATION_CLASS): Define. (NtQueryVolumeInformationFile): Define.
2005-04-12 16:26:31 +02:00
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *,
VOID *, ULONG,
FS_INFORMATION_CLASS);
NTSTATUS NTAPI NtReadFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
PULONG);
NTSTATUS NTAPI NtRollbackTransaction (HANDLE, BOOLEAN);
NTSTATUS NTAPI NtSetEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
NTSTATUS NTAPI NtSetEvent (HANDLE, PULONG);
NTSTATUS NTAPI NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
FILE_INFORMATION_CLASS);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtSetInformationThread (HANDLE, THREAD_INFORMATION_CLASS,
PVOID, ULONG);
NTSTATUS NTAPI NtSetInformationToken (HANDLE, TOKEN_INFORMATION_CLASS, PVOID,
ULONG);
NTSTATUS NTAPI NtSetSecurityObject (HANDLE, SECURITY_INFORMATION,
PSECURITY_DESCRIPTOR);
NTSTATUS NTAPI NtSetTimer (HANDLE, PLARGE_INTEGER, PTIMER_APC_ROUTINE, PVOID,
BOOLEAN, LONG, PBOOLEAN);
NTSTATUS NTAPI NtSetTimerResolution (ULONG, BOOLEAN, PULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI NtSetValueKey (HANDLE, PUNICODE_STRING, ULONG, ULONG, PVOID,
ULONG);
NTSTATUS NTAPI NtUnlockFile (HANDLE, PIO_STATUS_BLOCK, PLARGE_INTEGER,
PLARGE_INTEGER, ULONG);
2013-04-23 11:44:36 +02:00
NTSTATUS NTAPI NtUnlockVirtualMemory (HANDLE, PVOID *, PSIZE_T, ULONG);
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
NTSTATUS NTAPI NtWriteFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
PULONG);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlAbsoluteToSelfRelativeSD (PSECURITY_DESCRIPTOR,
PSECURITY_DESCRIPTOR, PULONG);
VOID NTAPI RtlAcquirePebLock ();
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlAddAccessAllowedAce (PACL, ULONG, ACCESS_MASK, PSID);
NTSTATUS NTAPI RtlAddAccessAllowedAceEx (PACL, ULONG, ULONG, ACCESS_MASK,
PSID);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlAddAccessDeniedAce (PACL, ULONG, ACCESS_MASK, PSID);
NTSTATUS NTAPI RtlAddAccessDeniedAceEx (PACL, ULONG, ULONG, ACCESS_MASK,
PSID);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlAddAce (PACL, ULONG, ULONG, PVOID, ULONG);
PVOID NTAPI RtlAllocateHeap (PVOID, ULONG, SIZE_T);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR);
NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING,
PUNICODE_STRING);
NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING,
BOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlCheckRegistryKey (ULONG, PCWSTR);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
NTSTATUS NTAPI RtlConvertToAutoInheritSecurityObject (PSECURITY_DESCRIPTOR,
2011-06-06 07:02:13 +02:00
PSECURITY_DESCRIPTOR,
PSECURITY_DESCRIPTOR *,
GUID *, BOOLEAN,
PGENERIC_MAPPING);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlCopySid (ULONG, PSID, PSID);
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlCreateAcl (PACL, ULONG, ULONG);
PDEBUG_BUFFER NTAPI RtlCreateQueryDebugBuffer (ULONG, BOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlCreateRegistryKey (ULONG, PCWSTR);
NTSTATUS NTAPI RtlCreateSecurityDescriptor (PSECURITY_DESCRIPTOR, ULONG);
BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
NTSTATUS NTAPI RtlDeleteSecurityObject (PSECURITY_DESCRIPTOR *);
NTSTATUS NTAPI RtlDestroyQueryDebugBuffer (PDEBUG_BUFFER);
* dcrt0.cc: Include string.h. (initial_env): Use small_printf's %P specifier. * dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * dll_init.h (struct dll): Ditto. * environ.cc: Include string.h. (win_env::add_cache): Use temporary local buffer for path conversion. (posify): Ditto. * exceptions.cc (try_to_debug): Use CreateProcessW to allow long path names. * miscfuncs.cc: Drop unused implementations of strcasematch and strncasematch. (ch_case_eq): Drop. (strcasestr): Drop. (cygwin_wcscasecmp): New function. (cygwin_wcsncasecmp): New function. (cygwin_strcasecmp): New function. (cygwin_strncasecmp): New function. (cygwin_wcslwr): New function. (cygwin_wcsupr): New function. (cygwin_strlwr): New function. (cygwin_strupr): New function. * ntdll.h (RtlDowncaseUnicodeString): Declare. (RtlUpcaseUnicodeString): Declare. (RtlInt64ToHexUnicodeString): Fix typo in comment. * string.h: Disable not NLS aware implementations of strcasematch and strncasematch. (cygwin_strcasecmp): Declare. (strcasecmp): Define as cygwin_strcasecmp. (cygwin_strncasecmp): Declare. (strncasecmp): Define as cygwin_strncasecmp. (strcasematch):Define using cygwin_strcasecmp. (strncasematch):Define using cygwin_strncasecmp. (cygwin_strlwr): Declare. (strlwr): Define as cygwin_strlwr. (cygwin_strupr): Declare. (strupr): Define as cygwin_strupr. * wchar.h: New file. * wincap.cc (wincapc::init): Use "NT" as fix OS string. * winsup.h (strcasematch): Drop declaration. (strncasematch): Ditto. (strcasestr): Ditto.
2007-12-12 13:12:24 +01:00
NTSTATUS NTAPI RtlDowncaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlEnterCriticalSection (PRTL_CRITICAL_SECTION);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
BOOLEAN NTAPI RtlEqualPrefixSid (PSID, PSID);
BOOLEAN NTAPI RtlEqualSid (PSID, PSID);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
VOID NTAPI RtlFreeAnsiString (PANSI_STRING);
2013-04-23 11:44:36 +02:00
BOOLEAN NTAPI RtlFreeHeap (HANDLE, ULONG, PVOID);
VOID NTAPI RtlFreeOemString (POEM_STRING);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
BOOLEAN NTAPI RtlFirstFreeAce (PACL, PVOID *);
NTSTATUS NTAPI RtlGetAce (PACL, ULONG, PVOID);
NTSTATUS NTAPI RtlGetControlSecurityDescriptor (PSECURITY_DESCRIPTOR,
PSECURITY_DESCRIPTOR_CONTROL,
PULONG);
HANDLE NTAPI RtlGetCurrentTransaction ();
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
PACL *, PBOOLEAN);
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
2011-06-06 07:02:13 +02:00
PBOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
2011-06-06 07:02:13 +02:00
PBOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
VOID NTAPI RtlInitAnsiString (PANSI_STRING, PCSTR);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
NTSTATUS NTAPI RtlLeaveCriticalSection (PRTL_CRITICAL_SECTION);
ULONG NTAPI RtlLengthSecurityDescriptor (PSECURITY_DESCRIPTOR);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
ULONG NTAPI RtlLengthSid (PSID);
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
BOOLEAN);
BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlQueryProcessDebugInformation (ULONG, ULONG, PDEBUG_BUFFER);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlQueryRegistryValues (ULONG, PCWSTR,
PRTL_QUERY_REGISTRY_TABLE, PVOID,
PVOID);
VOID NTAPI RtlReleasePebLock ();
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER);
NTSTATUS NTAPI RtlSetCurrentDirectory_U (PUNICODE_STRING);
BOOLEAN NTAPI RtlSetCurrentTransaction (HANDLE);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlSetControlSecurityDescriptor (PSECURITY_DESCRIPTOR,
SECURITY_DESCRIPTOR_CONTROL,
SECURITY_DESCRIPTOR_CONTROL);
NTSTATUS NTAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, BOOLEAN,
PACL, BOOLEAN);
NTSTATUS NTAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
2011-06-06 07:02:13 +02:00
BOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
2011-06-06 07:02:13 +02:00
BOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
ULONG NTAPI RtlUnicodeStringToAnsiSize (PUNICODE_STRING);
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
BOOLEAN);
WCHAR NTAPI RtlUpcaseUnicodeChar (WCHAR);
* dcrt0.cc: Include string.h. (initial_env): Use small_printf's %P specifier. * dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * dll_init.h (struct dll): Ditto. * environ.cc: Include string.h. (win_env::add_cache): Use temporary local buffer for path conversion. (posify): Ditto. * exceptions.cc (try_to_debug): Use CreateProcessW to allow long path names. * miscfuncs.cc: Drop unused implementations of strcasematch and strncasematch. (ch_case_eq): Drop. (strcasestr): Drop. (cygwin_wcscasecmp): New function. (cygwin_wcsncasecmp): New function. (cygwin_strcasecmp): New function. (cygwin_strncasecmp): New function. (cygwin_wcslwr): New function. (cygwin_wcsupr): New function. (cygwin_strlwr): New function. (cygwin_strupr): New function. * ntdll.h (RtlDowncaseUnicodeString): Declare. (RtlUpcaseUnicodeString): Declare. (RtlInt64ToHexUnicodeString): Fix typo in comment. * string.h: Disable not NLS aware implementations of strcasematch and strncasematch. (cygwin_strcasecmp): Declare. (strcasecmp): Define as cygwin_strcasecmp. (cygwin_strncasecmp): Declare. (strncasecmp): Define as cygwin_strncasecmp. (strcasematch):Define using cygwin_strcasecmp. (strncasematch):Define using cygwin_strncasecmp. (cygwin_strlwr): Declare. (strlwr): Define as cygwin_strlwr. (cygwin_strupr): Declare. (strupr): Define as cygwin_strupr. * wchar.h: New file. * wincap.cc (wincapc::init): Use "NT" as fix OS string. * winsup.h (strcasematch): Drop declaration. (strncasematch): Ditto. (strcasestr): Ditto.
2007-12-12 13:12:24 +01:00
NTSTATUS NTAPI RtlUpcaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
NTSTATUS NTAPI RtlWriteRegistryValue (ULONG, PCWSTR, PCWSTR, ULONG, PVOID,
ULONG);
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
#ifdef __cplusplus
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
/* A few Rtl functions are either actually macros, or they just don't
exist even though they would be a big help. We implement them here,
partly as inline functions. */
/* RtlInitEmptyUnicodeString is defined as a macro in wdm.h, but that file
is missing entirely in w32api. */
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
inline
VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf,
USHORT len)
{
dest->Length = 0;
dest->MaximumLength = len;
dest->Buffer = (PWSTR) buf;
}
/* Like RtlInitEmptyUnicodeString, but initialize Length to len, too.
This is for instance useful when creating a UNICODE_STRING from an
NtQueryInformationFile info buffer, where the length of the filename
is known, but you can't rely on the string being 0-terminated.
If you know it's 0-terminated, just use RtlInitUnicodeString(). */
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
inline
VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf,
USHORT len)
* dir.cc (readdir_worker): Drop dir parameter from call to readdir_get_ino. * fhandler.h (fhandler_disk_file::readdir_helper): Switch file name parameter to PUNICODE_STRING. * fhandler_disk_file.cc: Drop including ntdef.h. (class __DIR_mounts): Store mount points in UNICODE. Additionally store cygdrive prefix in unicode here. Change methods accordingly. (__DIR_mounts::eval_ino): Call new stat_worker instead of lstat64. (__DIR_mounts::~__DIR_mounts): New destructor to free UNICODE buffers. (path_conv::ndisk_links): Rewrite using native NT functions. (fhandler_base::fstat_by_handle): Use NAME_MAX instead of CYG_MAX_PATH. Always set pfvi->VolumeSerialNumber to non-0. Remove last resort code. (fhandler_base::fstat_by_name): Rewrite using native NT functions. (fhandler_base::fstat_fs): Always call fstat_by_name if fstat_by_handle fails. (fhandler_base::fstat_helper): Rely on dwVolumeSerialNumber. (fhandler_disk_file::facl): Call fstat_by_name if fstat_by_handle fails. (DIR_BUF_SIZE): Define using NAME_MAX instead of CYG_MAX_PATH. (__DIR_cache): Remove __name. (d_dirname): Remove. (fhandler_disk_file::opendir): Drop pathname length check. Remove outdated comment. Use get_name method instead of accessing pc.normalized_path directly. (readdir_get_ino): Drop unused dir parameter. Accomodate throughout. Allocate fname dynamically. Call new stat_worker instead of lstat64. Call NtOpenFile instead of CreateFile. Call NtClose instead of CloseHandle. (fhandler_disk_file::readdir_helper): Use native NT functions. Check for volume mount points and use correct inode number. (fhandler_disk_file::readdir): Simplify slightly. Use get_name instead of pc.normalized_path. (fhandler_disk_file::rewinddir): Use RtlInitUnicodeString. (fhandler_cygdrive::fstat): Ignore floppy drives. Set st_nlink correctly. (fhandler_cygdrive::readdir): Ignore floppy drives. * fhandler_netdrive.cc (fhandler_netdrive::readdir): Accommodate change to readdir_get_ino. * fhandler_proc.cc (PROC_DIR_COUNT): Define. (fhandler_proc::fstat): Evaluate correct link count for /proc. * ntdll.h (struct _FILE_DIRECTORY_INFORMATION): Define. (NtFsControlFile): Declare. (RtlAppendUnicodeToString): Declare. (RtlAppendUnicodeStringToString): Declare. (RtlCompareUnicodeString): Declare. (RtlCopyUnicodeString): Declare. (RtlCreateUnicodeStringFromAsciiz): Declare. (RtlEqualUnicodeString): Declare. (RtlFreeUnicodeString): Declare. (RtlInitEmptyUnicodeString): Declare. (RtlSecondsSince1970ToTime): Declare. (RtlInitEmptyUnicodeString): Define as inline function. (RtlInitCountedUnicodeString): Define as inline function. * path.cc (path_conv::check): New method with PUNICODE_STRING as path, preliminary implementation. (mount_info::get_mounts_here): Change to create UNICODE_STRINGs. Also copy cygpath prefix into UNICODE_STRING. (is_floppy): Drop 9x consideration. * path.h: Drop including ntdef.h. (path_conv::check): Add declaration. (path_conv::path_conv): Add constructor for UNICODE_STRING paths. * shared_info.h (mount_info::get_mounts_here): Change declaration. * syscalls.cc: Drop forward declaration of stat_worker. (stat_worke): Take path_conv as parameter. Drop nofollow flag. (stat64): Create matching path_conv and call stat_worker with it. (lstat64): Ditto. * winsup.h: Include ntdef.h. (stat_worker): Declare. (readdir_get_ino): Change declaration.
2007-07-26 19:30:54 +02:00
{
dest->Length = dest->MaximumLength = len;
dest->Buffer = (PWSTR) buf;
}
/* Split path into dirname and basename part. This function does not
copy anything! It just initializes the dirname and basename
UNICODE_STRINGs so that their Buffer members point to the right spot
into path's Buffer, and the Length (and MaximumLength) members are set
to match the dirname part and the basename part.
Note that dirname's Length is set so that it also includes the trailing
backslash. If you don't need it, just subtract sizeof(WCHAR) from
dirname.Length. */
inline
VOID NTAPI RtlSplitUnicodePath (PUNICODE_STRING path, PUNICODE_STRING dirname,
PUNICODE_STRING basename)
{
USHORT len = path->Length / sizeof (WCHAR);
while (len > 0 && path->Buffer[--len] != L'\\')
;
++len;
if (dirname)
RtlInitCountedUnicodeString (dirname, path->Buffer, len * sizeof (WCHAR));
if (basename)
RtlInitCountedUnicodeString (basename, &path->Buffer[len],
path->Length - len * sizeof (WCHAR));
}
/* Check if prefix is a prefix of path. */
inline
BOOLEAN NTAPI RtlEqualUnicodePathPrefix (PUNICODE_STRING path,
PUNICODE_STRING prefix,
BOOLEAN caseinsensitive)
{
UNICODE_STRING p;
RtlInitCountedUnicodeString (&p, path->Buffer,
prefix->Length < path->Length
? prefix->Length : path->Length);
return RtlEqualUnicodeString (&p, prefix, caseinsensitive);
}
/* Check if suffix is a suffix of path. */
inline
BOOL NTAPI RtlEqualUnicodePathSuffix (PUNICODE_STRING path,
PUNICODE_STRING suffix,
BOOLEAN caseinsensitive)
{
UNICODE_STRING p;
if (suffix->Length < path->Length)
RtlInitCountedUnicodeString (&p, (PWCHAR) ((PBYTE) path->Buffer
+ path->Length - suffix->Length),
suffix->Length);
else
RtlInitCountedUnicodeString (&p, path->Buffer, path->Length);
return RtlEqualUnicodeString (&p, suffix, caseinsensitive);
}
/* Implemented in strfuncs.cc. Create a Hex UNICODE_STRING from a given
64 bit integer value. If append is TRUE, append the hex string,
* dcrt0.cc: Include string.h. (initial_env): Use small_printf's %P specifier. * dll_init.cc (dll_list::alloc): Use PATH_MAX instead of CYG_MAX_PATH for path name buffer size. * dll_init.h (struct dll): Ditto. * environ.cc: Include string.h. (win_env::add_cache): Use temporary local buffer for path conversion. (posify): Ditto. * exceptions.cc (try_to_debug): Use CreateProcessW to allow long path names. * miscfuncs.cc: Drop unused implementations of strcasematch and strncasematch. (ch_case_eq): Drop. (strcasestr): Drop. (cygwin_wcscasecmp): New function. (cygwin_wcsncasecmp): New function. (cygwin_strcasecmp): New function. (cygwin_strncasecmp): New function. (cygwin_wcslwr): New function. (cygwin_wcsupr): New function. (cygwin_strlwr): New function. (cygwin_strupr): New function. * ntdll.h (RtlDowncaseUnicodeString): Declare. (RtlUpcaseUnicodeString): Declare. (RtlInt64ToHexUnicodeString): Fix typo in comment. * string.h: Disable not NLS aware implementations of strcasematch and strncasematch. (cygwin_strcasecmp): Declare. (strcasecmp): Define as cygwin_strcasecmp. (cygwin_strncasecmp): Declare. (strncasecmp): Define as cygwin_strncasecmp. (strcasematch):Define using cygwin_strcasecmp. (strncasematch):Define using cygwin_strncasecmp. (cygwin_strlwr): Declare. (strlwr): Define as cygwin_strlwr. (cygwin_strupr): Declare. (strupr): Define as cygwin_strupr. * wchar.h: New file. * wincap.cc (wincapc::init): Use "NT" as fix OS string. * winsup.h (strcasematch): Drop declaration. (strncasematch): Ditto. (strcasestr): Ditto.
2007-12-12 13:12:24 +01:00
otherwise overwrite dest. Returns either STATUS_SUCCESS, or
STATUS_BUFFER_OVERFLOW, if the unicode buffer is too small (hasn't
room for 16 WCHARs). */
NTSTATUS NTAPI RtlInt64ToHexUnicodeString (ULONGLONG value,
PUNICODE_STRING dest,
BOOLEAN append);
/* Set file attributes. Don't change file times. */
inline
NTSTATUS NTAPI NtSetAttributesFile (HANDLE h, ULONG attr)
{
IO_STATUS_BLOCK io;
FILE_BASIC_INFORMATION fbi;
fbi.CreationTime.QuadPart = fbi.LastAccessTime.QuadPart =
fbi.LastWriteTime.QuadPart = fbi.ChangeTime.QuadPart = 0LL;
fbi.FileAttributes = attr ?: FILE_ATTRIBUTE_NORMAL;
return NtSetInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
}
/* This test for a signalled event is twice as fast as calling
WaitForSingleObject (event, 0). */
inline
BOOL NTAPI IsEventSignalled (HANDLE event)
{
EVENT_BASIC_INFORMATION ebi;
return NT_SUCCESS (NtQueryEvent (event, EventBasicInformation,
&ebi, sizeof ebi, NULL))
&& ebi.SignalState != 0;
}
}
* ntdll.h: Allow usage from plain C code. (FSCTL_PIPE_IMPERSONATE): Define. (enum _THREAD_INFORMATION_CLASS): Define. (RTL_QUERY_REGISTRY_xxx): Define. (RTL_REGISTRY_xxx): Define. (PRTL_QUERY_REGISTRY_ROUTINE): Define. (struct _RTL_QUERY_REGISTRY_TABLE): Define. (enum _KEY_VALUE_INFORMATION_CLASS): Define. (struct _KEY_VALUE_PARTIAL_INFORMATION): Define. (NtAccessCheck): Declare. (NtAllocateLocallyUniqueId): Declare. (NtCreateKey): Declare. (NtDuplicateToken): Declare. (NtLoadKey): Declare. (NtOpenKey): Declare. (NtOpenProcessToken): Declare. (NtOpenThreadToken): Declare. (NtPrivilegeCheck): Declare. (NtQueryInformationToken): Declare. (NtQueryValueKey): Declare. (NtSetInformationThread): Declare. (NtSetInformationToken): Declare. (NtSetValueKey): Declare. (RtlAbsoluteToSelfRelativeSD): Declare. (RtlAddAccessAllowedAce): Declare. (RtlAddAccessDeniedAce): Declare. (RtlAddAce): Declare. (RtlCheckRegistryKey): Declare. (RtlCopySid): Declare. (RtlCreateAcl): Declare. (RtlCreateRegistryKey): Declare. (RtlCreateSecurityDescriptor): Declare. (RtlEqualPrefixSid): Declare. (RtlEqualSid): Declare. (RtlFirstFreeAce): Declare. (RtlGetAce): Declare. (RtlGetDaclSecurityDescriptor): Declare. (RtlGetGroupSecurityDescriptor): Declare. (RtlGetOwnerSecurityDescriptor): Declare. (RtlIdentifierAuthoritySid): Declare. (RtlInitializeSid): Declare. (RtlLengthSid): Declare. (RtlQueryRegistryValues): Declare. (RtlSetControlSecurityDescriptor): Declare. (RtlSetDaclSecurityDescriptor): Declare. (RtlSetGroupSecurityDescriptor): Declare. (RtlSetOwnerSecurityDescriptor): Declare. (RtlSubAuthorityCountSid): Declare. (RtlSubAuthoritySid): Declare. (RtlWriteRegistryValue): Declare.
2011-03-31 18:08:01 +02:00
#endif