summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/hookapi.cc
Commit message (Collapse)AuthorAgeFilesLines
* * Merge in cygwin-64bit-branch.Corinna Vinschen2013-04-231-112/+152
|
* whitespace cleanupChristopher Faylor2012-08-161-1/+1
|
* * hookapi.cc (find_first_notloaded_dll): Remove unused assignment ofChristopher Faylor2012-07-041-2/+0
| | | | importRVASize found by Clang.
* * hookapi.cc (find_first_notloaded_dll): Extend comment. Fix usage ofCorinna Vinschen2012-05-301-8/+14
| | | | | | | | mapped memory. Shorten static library name buffer to MAX_PATH. Use strlcpy to copy library name to buffer. Only Unmap "map" if it has been Mapped before. * pinfo.cc (status_exit): Drop unneeded declaration of find_first_notloaded_dll in favor of the declaration in winsup.h.
* * hookapi.cc (rvadelta): Compute max_size using SizeOfRawData ratherCorinna Vinschen2012-04-041-1/+1
| | | | than VirtualSize.
* * hookapi.cc (hook_or_detect_cygwin): Change condition when to useCorinna Vinschen2012-03-131-11/+13
| | | | | importRVAMaxSize or importRVASize for the mapping size. Make sure to map never more than the section size. Change comments accordingly.
* * hookapi.cc (find_first_notloaded_dll): Fix a compiler warning.Corinna Vinschen2012-03-091-1/+1
|
* * hookapi.cc (rvadelta): Add parameter to return maximum availableCorinna Vinschen2012-03-091-17/+98
| | | | | | | | | | | | size from start of import RVA table to end of section. (find_first_notloaded_dll): Take big executables into account. Use offset and size computation as in hook_or_detect_cygwin, just simpler. (hook_or_detect_cygwin): Return NULL rather than false througout. Change computation of required mapping size to take non-gcc compilers into account. Explain the differences and what we do against them. Don't alloca buf if fn is NULL. Never use buf if fn is NULL. Fix name and address in previous ChangeLog entry.
* * hookapi.cc (hook_or_detect_cygwin): Take additional handleCorinna Vinschen2011-10-251-4/+34
| | | | | | | | | to a file mapping as parameter. If this handle is not NULL, create another file mapping for the IAT. * spawn.cc (av::fixup): Only map the first 64K of an image and keep the mapping handle to use as argument to hook_or_detect_cygwin. * winsup.h (hook_or_detect_cygwin): Add mapping handle as default parameter in declaration.
* Throughout, open console handles with sharing for reading and writing.Corinna Vinschen2011-07-041-1/+1
| | | | | | * dcrt0.cc (insert_file): Open file with full sharing allowed. * hookapi.cc (find_first_notloaded_dll): Ditto. * spawn.cc (av::fixup): Ditto.
* * Throughout fix copyright dates.Corinna Vinschen2011-02-151-1/+1
|
* * hookapi.cc (hook_or_detect_cygwin): Prevent i from being consideredChristopher Faylor2011-02-091-1/+1
| | | | uninitialized by gcc.
* * cygheap.cc (creturn): Reorganize to avoid a new compiler warning/error.Christopher Faylor2008-09-111-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dtable.cc (handle_to_fn): Ditto. * fhandler_console.cc (fhandler_console::read): Ditto. (fhandler_console::scroll_screen): Ditto. (dev_console::set_color): Ditto. * fhandler_dsp.cc (fhandler_dev_dsp::write): Ditto. (fhandler_dev_dsp::read): Ditto. * fhandler_tape.cc (mtinfo_drive::get_status): Ditto. * hookapi.cc (find_first_notloaded_dll): Ditto. * mmap.cc (msync): Ditto. * pipe.cc (pipesync::pipesync): Ditto. * sec_acl.cc (getace): Ditto. * sec_auth.cc (create_token): Ditto. (lsaauth): Ditto. * select.cc (peek_pipe): Ditto. * spawn.cc (av::fixup): Ditto. * syscalls.cc (popen): Ditto. * tty.cc (tty::init_session): Ditto. * uinfo.cc (pwdgrp::load): Ditto. * fhandler.cc (fhandler_base::setup_overlapped): Ditto. (fhandler_base::wait_overlapped): Rename second use of res variable to wres or errors are not returned correctly. * dcrt0.cc: Remove obsolete variable. * dll_init.cc (release_upto): Fix typo involving incorrect use of '|'. * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Avoid a compiler warning regarding coercing type-punned variables. (fhandler_base::fstat_by_name): Ditto. fhandler_fifo.cc (fhandler_fifo::open_nonserver): Fix = vs. == typo. (fhandler_fifo::wait): Add all conditions to switch statement to avoid a compiler warning. * fhandler_process.cc: Avoid unneeded initialization of variables to zero. (fhandler_socket::listen): Add braces around initializer. * flock.cc (inode_t::get_all_locks_list): Reorganize to avoid a compiler warning. Fix problem with EWOULDBLOCK error return. * path.cc (GUID_shortcut): Use braces around struct initializer. (cygwin_conv_path): Reorganize to avoid a compiler warning. * random.cc (dummy): Mark variable as volatile to avoid a "used uninitialized" warning. * libc/getopt.c: Mark some variables as dllexport although gcc doesn't seem to do the right thing with them. * libc/minires-os-if.c (get_registry_dns_items): Coerce some function arguments to avoid a compiler warning.
* Remove unneeded header files from source files throughout.Christopher Faylor2008-04-071-3/+0
|
* * hookapi.cc (find_first_notloaded_dll): New function.Christopher Faylor2008-03-271-5/+74
| | | | | | | | | | | | | | * pinfo.cc (status_exit): New function. Issue message when dll not found. Use find_first_notloaded_dll to find a nonexistent dll. (pinfo::maybe_set_exit_code_from_windows): Call status_exit when exit code >= 0xc0000000UL. * sigproc.cc (child_info::proc_retry): Return exit code when STATUS_DLL_NOT_FOUND. * spawn.cc (spawn_guts): Minor cleanup. * syscalls.cc (close_all_files): Don't actually close stderr filehandle. Just make it noninheritable. * winsup.h (find_first_notloaded_dll): Declare new function. * ntdll.h: Add several missing NTSTATUS defines.
* * string.h: Re-enable inline strcasematch and strncasematchCorinna Vinschen2008-02-011-2/+2
| | | | | | | | | | | | | | | implementations and rename to ascii_strcasematch/ascii_strncasematch. * dcrt0.cc: Replace str[n]casematch with ascii_str[n]casematch where applicable. * environ.cc: Ditto. * fhandler_process.cc: Ditto. * hookapi.cc: Ditto. * path.cc: Ditto. * spawn.cc: Ditto. * strace.cc: Ditto. * syscalls.cc: Ditto. * uinfo.cc: Ditto. * winf.cc: Ditto.
* Change many cygheap allocation routines to their *_abort analogs.Christopher Faylor2007-11-261-1/+1
| | | | | | * cygheap.cc (cmalloc_abort): New function. (crealloc_abort): Ditto. (ccalloc_abort): Ditto.
* * hookapi.cc (ld_preload): Call LoadLibraryW.Corinna Vinschen2007-08-201-1/+2
| | | | * path.h (path_conv::get_wide_win32_path_len): Define.
* * path.h (path_conv::operator char *): Delete.Corinna Vinschen2007-08-161-1/+1
| | | | | | | | | | | | | (path_conv::operator const char *): Delete. * dlfcn.cc: Throughout, replace path_conv::operator char * and path_conv::operator const char * by call to path_conv::get_win32 for easier transition to UNICODE_PATHs. * fhandler_socket.cc: Ditto. * hookapi.cc: Ditto. * path.cc: Ditto. * spawn.cc: Ditto. * syscalls.cc: Ditto. * uinfo.cc: Ditto.
* * hookapi.cc: Add comment headerChristopher Faylor2006-07-061-4/+14
| | | | | | | | | (putmem): Make static. (get_export): Ditto. (rvadelta): Ditto. Don't assume that a section which ends where the import_rva begins is the import list. * child_info.h: Update copyright. * fork.cc: Ditto.
* * winsup.h (cygwin_hmodule): Declare.Christopher Faylor2006-02-231-1/+0
| | | | | | | | | * exceptions.cc (inside_kernel): Reverse return values to reflect function name. Return true if we're in cygwin1.dll or if we're executing in dll_entry. (_cygtls::interrupt_now): Reflect reversal of inside_kernel return value. * hookapi.cc (cygwin_hmodule): Remove declaration. * init.cc (dll_entry): Use in_dllentry global to record that we are executing in dllentry.
* * cygheap.cc (init_cygheap::manage_console_count): Revert previous change.Christopher Faylor2005-12-211-1/+3
| | | | | | | | | | | | | Handle this a different way. * external.cc (cygwin_internal): Accommodate extra hook_or_detect_cygwin argument. * hookapi.cc (cygwin_internal): Fill in subsys variable with the subsystem of the executable. * spawn.cc (av::iscui): New variable. (spawn_guts): Hide window when we don't have a console and this isn't NT/XP/2003. (av::fixup): Set iscui flag. * winsup.h (hook_or_detect_cygwin): Accommodate extra argument.
* * hookapi.cc (putmem): Remove query of previous memory protection since we getChristopher Faylor2005-12-161-14/+3
| | | | that for free the first time we call VirtualProtect.
* * hookapi.cc (hook_or_detect_cygwin): Correct inverted test for whether toChristopher Faylor2005-09-281-1/+1
| | | | allocate a buffer by always allocating a buffer.
* * hookapi.cc (hook_or_detect_cygwin): Simplify very slightly.Christopher Faylor2005-09-151-1/+1
| | | | | * spawn.cc (av::fixup): Guard against problems reading an executable which does not match Microsoft's documentation about PE format.
* * hookapi.cc (rvadelta): Change argument to DWORD to eliminate a compilerChristopher Faylor2005-09-081-1/+1
| | | | | | | | | | warning. * path.h (path_conv::set_cygexec): New function. * spawn.cc (av::iscygwin): Eliminate. (av::av): Don't initialize iscygwin. (spawn_guts): Just use real_path.iscygexec for all tests. (av::fixup): Short circuit test if .exe extension and known cygexec. Set cygexec flag appropriately if we find that program uses cygwin1.dll.
* * dcrt0.cc (initial_env): Don't attempt stracing if dynamically loaded.Christopher Faylor2005-09-071-6/+22
| | | | | | | | | | | | | | | (dll_crt0_0): Move console initialization earlier. * init.cc (dll_entry): Move console initialization here. * exceptions.cc (init_console_handler): Fully remove any old console handler. * spawn.cc (spawn_guts): Don't fill out windows argv if we've deduced that this is a cygwin-using program. (av::fixup): Always check executables to see if they are using cygwin1.dll. Don't consider .com files to be scripts. * hookapi.cc (rvadelta): New function. (PEHeaderFromHModule): Simplify slightly. (hook_or_detect_cygwin): Use passed in name argument for "HMODULE" rather than incorrectly reading current program. Calculate delta needed to read image data and file names if this isn't a real "HMODULE".
* * child_info.h (child_info::sync): Pass pid and HANDLE rather than using pinfo.Christopher Faylor2005-07-171-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | (child_info::child_info): Accept an argument controlling whether to create proc_subproc. (child_info_spawn::child_info_spawn): Ditto. * sigproc.cc (child_info::child_info): Ditto. (child_info_spawn::child_info_spawn): Ditto. (child_info::sync): Use passed in pid and HANDLE. * fork.cc (fork_parent): Reflect additional arguments required for child_info::sync. * hookapi.cc (hook_or_detect_cygwin): Rename. Change so that NULL 'fn' argument just returns "true", indicating that program uses cygwin1.dll. * spawn.cc (av::win16_exe): New element. * spawn.cc (av::iscygwin): New element. (av::fixup): New function. (spawn_guts): Protect against SEGV. Use fixup function to detect when it is safe to wait for a spawned (as opposed to an execed) program. Reflect changes in child_info::sync arguments. * external.cc (cygwin_internal): Reflect function renaming to hook_or_detect_cygwin. * cygheap.cc (cygheap_fixup_in_child): Close handle after debug fixup has been done to prevent false positives in handle collision. * exceptions.cc (try_to_debug): Notify debugger if already being debugged.
* Eliminate (void) cast on standalone function calls throughout.Christopher Faylor2005-07-061-1/+1
|
* * dcrt0.cc (do_global_dtors): Run DLL dtors.Christopher Faylor2005-04-141-1/+1
| | | | | | | | | | | | | | | | | (__main): Don't rely on atexit to run dtors. (do_exit): Specifically call do_global_dtors here. (cygwin_exit): Ditto. * dll_init.cc (dll_global_dtors): Make global. Only run dtors once. (dll_list::init): Just set flag that dtors should be run. Don't rely on atexit. * dll_init.h (dll_global_dtors): Declare. * exceptions.cc (sigrelse): Define. * path.h (is_fs_device): New method. (is_lnk_special): Ditto. * fhandler_disk_file.cc (fhandler_disk_file::link): Use "is_lnk_special" rather than "is_lnk_symlink". * syscalls.cc (rename): Ditto. * hookapi.cc (ld_preload): Use colon as a separator rather than space.
* * Makefile.in (DLL_OFILES): Add hookapi.o. Eliminate some cruft.Christopher Faylor2005-03-221-0/+218
* cygheap.h (cygheap_types): Add new enum: HEAP_1_HOOK. (hook_chain): New struct. (init_cygheap::hooks): Define new element. * cygheap.cc (cygheap_fixup_in_child): Zero hook chain on exec. * dcrt0.cc (dll_crt0_1): Call ld_preload just before calling main function. * external.cc (cygwin_internal): Implement CW_HOOK. * fork.cc (fork_child): Call fixup_hooks_after_fork. * init.cc (cygwin_hmodule): Reinstate after a long absence. * include/sys/cygwin.h: Define CW_HOOK. * hookapi.cc: New file. * select.cc (start_thread_socket): Add debugging output. * fhandler_disk_file.cc (fhandler_disk_file::fchmod): gcc 4.x accommodation. * fhandler_socket.cc (fhandler_socket::connect): Make sure that err is initialized.