summaryrefslogtreecommitdiff
path: root/win32 (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* win32: make version info and manifest resources configurableRon Yorston2018-07-242-3/+7
|
* win32: tweaks to manifestRon Yorston2018-07-242-26/+26
| | | | | | - Use CRLF line endings in manifest file. - Add '-b' option to sed command to insert version in manifest file.
* win32: add manifest resourceRon Yorston2018-07-123-0/+31
| | | | | Add a manifest to declare the requested execution level of the busybox-w32 executable.
* win32: better error message in kill(2)Ron Yorston2018-07-121-0/+2
| | | | | | When the process architecture of busybox-w32 didn't match that of the target process the error reported was 'Function not implemented'. Change this to 'Permission denied'.
* realpath: implement realpath(3) and enable realpath(1)realpathRon Yorston2018-06-091-3/+56
| | | | | The implementation of realpath(3) is based on code by Stuart Dootson (studoot on GitHub).
* win32: remove some code from procps_scanRon Yorston2018-04-101-3/+0
| | | | | Now that we're calling memset to clear data for each process it's no longer necessary to zero the process times by hand.
* win32: don't leak pipe data structuresRon Yorston2018-04-071-58/+66
| | | | | | | | | | | | popen uses an array of pipe_data structures to record information that's later used by pclose. pclose releases the structure after use. The lower-level pipe function mingw_popen_fd was also using this array of structures but didn't provide any way to release them. Avoid this leak by letting mingw_popen_fd use a local structure instead.
* ps: indicate forkshell processes in listingRon Yorston2018-04-051-1/+1
|
* win32: exclude termios codeRon Yorston2018-04-052-14/+0
| | | | | The code to manipulate terminal settings serves no purpose in WIN32. Use conditional compilation to exclude much of it.
* win32: ensure timeout works in read_keyRon Yorston2018-04-051-4/+4
| | | | | | Move the wait for timeout into the while loop of read_key. Otherwise the timeout won't be checked after any event that doesn't result in a value being returned.
* ps: obtain applet names from other BusyBox processesRon Yorston2018-04-041-18/+89
| | | | | | | | | | | | | | | Remove the code which passed applet names to child processes using environment variables. This only allowed ps to display names for its ancestors. Instead attempt to read applet names from the memory of unrelated processes. The Microsoft documentation alone wasn't enough to figure out how to do this. Additional hints from: https://stackoverflow.com/questions/4298331/exe-or-dll-image-base-address https://stackoverflow.com/questions/14467229/get-base-address-of-process
* win32: improvements to get_terminal_width_heightRon Yorston2018-04-032-18/+23
| | | | | | | | - move winansi_get_terminal_width_height from winansi.c to ioctl.c, the only caller; - check both stdout and stderr for a connection to a console; - omit unnecessary code in get_terminal_width_height (because the WIN32 implementation ignores the file descriptor).
* win32: simplify isatty replacementRon Yorston2018-04-031-5/+1
| | | | | Don't treat input and output file descriptors differently: if we aren't connected to a console GetConsoleMode will fail for either.
* win32: return correct exit status from waitpidRon Yorston2018-03-291-1/+5
| | | | | | | | | | | The exit status from _cwait wasn't being correctly returned. This resulted, for example, in the exit status of xargs being incorrect. Running this: $ ls | xargs ls in a directory containing filenames with spaces should cause 'ls' to fail and 'xargs' to return an exit status of 123.
* win32: save a few bytesRon Yorston2018-03-291-4/+3
| | | | | | | | In the recently-added code to pass applet names to child processes use local arrays to build the environment variables rather that allocating them every time. mingw_spawn can call mingw_spawn_proc instead of mingw_spawn_1.
* win32: improve dependency checking for resourcesRon Yorston2018-03-291-2/+5
|
* ps: display applet names in process listingRon Yorston2018-03-281-1/+16
| | | | | | | | | | | | | | | | In standalone shell mode all busybox-w32 applets are displayed as 'busybox.exe' in a process listing. I haven't found a satisfactory way to query a running instance of busybox-w32 to determine which applet it's running. Handle a couple of cases: - the process running the process scan knows its own PID and knows which applet it is; - just before invoking applet_main set an environment variable whose name contains the PID and whose value is the current applet name. Children running a process scan will inherit their parent's environment and can therefore match the parent's PID to its applet name.
* ps: clear status for each processRon Yorston2018-03-281-0/+2
| | | | | | | | | The original procps_scan function takes care to clear the status information before handling each process. Do the same for the WIN32 version. This requires moving the snapshot handle to the part of the structure that isn't cleared on each iteration.
* Add a VERSIONINFO resource to the binaryRon Yorston2018-03-282-2/+34
| | | | | | | | | | If icons are enabled we might as well store some version information. The string manipulation is based on this: https://stackoverflow.com/questions/8540485/how-do-i-split-a-string-in-make Closes issue #108.
* win32: changes to kill(2)Ron Yorston2018-03-271-14/+20
| | | | | | | | | The names of the callbacks to kill processes with a given signal were confusing because they referred to the implementation rather than the intent. Create the new function kill_SIGTERM_by_handle which is more efficient when a handle to the process to be killed is already available.
* Allow icon resources to be included in the binaryRon Yorston2018-03-277-0/+39
| | | | | Include two styles of icon from the GNOME Adwaita theme. These are enabled by default and add 30 Kbytes to the size of the binary.
* win32: save a few bytes in device file supportRon Yorston2018-03-231-35/+35
|
* win32: allow use of shell's PRNG for /dev/urandomRon Yorston2018-03-222-5/+82
| | | | | | Allow either ISAAC or the shell's built-in pseudo-random number generator to be used for /dev/urandom. The latter is smaller so it's the default.
* win32: tighten up code slightly in isaac.cRon Yorston2018-03-221-13/+5
|
* win32: small changes to reduce size of binaryRon Yorston2018-03-222-13/+8
| | | | | | | | Reduce the size of the binary by about 32 bytes: - use xzalloc to allocate static buffers so we don't have to initialise them; - avoid duplicated code in spawnveq.
* win32: don't test DLLs for executable formatRon Yorston2018-03-181-0/+5
| | | | | | | | | | | Moving detection of file formats from access(2) to stat(2) in commit 650f67507 was acknowledged to slow down stat. One problematic case is c:/windows/system32 which contains about 2000 DLLs and was found to slow 'ls' unacceptably. Treat DLLs as a special case in has_exec_format. See GitHub issue #101.
* win32: add a function to convert backslashes to slashesRon Yorston2018-03-181-11/+14
|
* win32: try harder to get file attributesRon Yorston2018-03-171-0/+16
| | | | | | | | | Reading the attributes of files like c:/pagefile.sys fails with error code ERROR_SHARING_VIOLATION, which breaks 'ls'. If this happens try an alternative API call to get the attributes. See GitHub issue #101.
* win32: tidy up popen implementationRon Yorston2018-03-151-206/+75
| | | | | | | | | Make mingw_popen_fd sufficiently general that it can be used to implement the other two popen routines. mingw_popen now just creates a command line and passes it to mingw_popen_fd. The one call to mingw_popen2 has been replaced by a call to mingw_popen_fd.
* wget: add support for httpsRon Yorston2018-03-151-0/+103
| | | | | | | | | | | | | | | | Allow wget to support https URLs. Changes are: - Add mingw_popen2 which uses a named pipe to allow bidirectional communication with a child process; - Modify ssl_client to accept a WIN32 handle instead of a file descriptor as an argument; - Allow tls_get_random to open /dev/urandom; - Using the above changes implement a WIN32 version of spawn_ssl_client in wget. This closes GitHub issue #75. Also, enable authentication in wget.
* ash: remove special treatment of device filesRon Yorston2018-03-151-1/+3
| | | | | Since device files are now handled in mingw_open there's no need for any special treatment in ash redirection.
* win32: restrict visibility of special devicesRon Yorston2018-03-151-7/+24
| | | | | | | | | | | | | | | Handling of the special devices /dev/zero and /dev/urandom was inconsistent: - they could be used as arguments to 'cat' but not 'od'; - they could not be used in shell redirection. Restrict the use of these devices to two places: - as input files to 'dd' with the 'if=' argument; - internally within 'shred'. See GitHub issue #98.
* winansi: check for broken pipe in winansi_writeRon Yorston2018-03-091-7/+21
| | | | | | | write(2) is commonly used in applets like cat and tr so we should check for broken pipes there too. See issue #99.
* winansi: check for broken pipeRon Yorston2018-03-061-6/+29
| | | | | | | | | | | | | | Microsoft Windows doesn't support SIGPIPE and its support for the EPIPE error is somewhat inadequate. Most of the time a broken pipe leads to an EINVAL error which is misleading: $ yes hello | head -1 hello yes: Invalid argument Add a function to test for the underlying Windows error that indicates a broken pipe and set errno to EPIPE. Call this function in a few strategic places.
* winansi: changes to puts, fputs and fwriteRon Yorston2018-03-061-18/+3
| | | | | | | Rewrite winansi_puts using winansi_fputs and putchar. There's no need to use winansi_putchar. Improve error return values from winansi_fputs and winansi_fwrite.
* winansi: improve error return values in ANSI emulationRon Yorston2018-03-061-20/+23
| | | | Also tighten up the code slightly.
* winansi: create and use functions to test for consoleRon Yorston2018-03-061-51/+20
|
* win32: squeeze a few bytes out of strftimeRon Yorston2018-03-051-4/+6
|
* win32: use strchrnul from BusyBox in fnmatchRon Yorston2018-03-051-1/+5
| | | | | | BusyBox ensures that strchrnul is always available, either from the target platform or by including its own version. Therefore it isn't necessary for fnmatch to use its equivalent.
* win32: reduce amount of static dataRon Yorston2018-03-044-101/+127
| | | | | | | It appears that uninitialised static variables are placed in the data section rather than bss, increasing the size of the binary. Rewrite some code to reduce the amount of static data.
* Minor improvements to buildRon Yorston2018-03-021-2/+1
| | | | | | | | | | | | Exclude source files in libbb that aren't used by busybox-w32. This speeds up the build marginally. They can always be reinstated if necessary. Provide fake routines for everything in inode_hash.c so that it can be excluded. inode_hash.c is now unchanged from upstream. Use last_char_is in has_exe_suffix_or_dot. It doesn't save any bytes but it makes the code neater.
* win32: make has_exec_format staticRon Yorston2018-03-011-55/+55
| | | | The only other caller (in spawnveq) has been removed.
* win32: additional improvements to handling of executablesRon Yorston2018-02-281-10/+24
| | | | | | | | | | | | | Consistent processing of file extensions, as described in the previous commit, has been applied to the 'which' applet and the functions find_executable and mingw_spawn_interpreter. In spawnveq check that the file to be executed exists and is executable, and ensure that it won't have any extensions added by spawnve. It's intended that all files passed to spawnve should have their names fully specified. If this isn't the case the tests here will cause errors which will need to be fixed.
* win32: don't add extensions to filenames ending with a dotRon Yorston2018-02-281-1/+7
| | | | | | | A filename ending with a dot is a signal to spawnve not to try adding extensions but to use the name unmodified. The add_win32_extension function should follow the same rule.
* win32: fix code to check for file extensionsRon Yorston2018-02-271-1/+1
| | | | | The has_win_suffix function didn't check that the extension started with a '.'. As a result the shell was unable to execute cmd.exe.
* win32: move detection of file formats to stat(2)Ron Yorston2018-02-262-54/+77
| | | | | | | | | | | | | | | | | | | | | Move the code to detect shell scripts and binary executables from mingw_access to a separate function, has_exec_format. Call this function in do_lstat to decide whether to set the executable bits in the file mode. This will slow down stat but has a couple of advantages: - shell scripts are highlighted in ls output - the test applet can use stat(2) to detect executable files The new function is used to handle another corner case in spawnveq: binary executables without the usual .exe extension are only run by spawnve if the file name ends with '.'. Two minor changes: - file_is_win32_executable has been renamed add_win32_extension to clarify what it does - a call to file_is_executable has been removed from find_command in ash as it resulted in unhelpful error messages.
* win32: improvements to stat(2) emulationRon Yorston2018-02-261-25/+18
| | | | | | | Set all mode bits rather than just setting user modes and then extending them to group and other. Combine common code in mingw_fstat.
* win32: add support for batch filesRon Yorston2018-02-262-12/+59
| | | | | | | | Support batch files with .bat and .cmd extensions, similar to what's done for .exe and .com. Check extensions in the same order as Windows' spawn function: .com, .exe, .bat, .cmd.
* win32: make /dev/urandom more randomRon Yorston2018-02-233-2/+242
|
* win32: handle /dev/zero and /dev/urandom in open and read functionsRon Yorston2018-02-222-3/+60
| | | | | | | | | | | | | | | | | | | | | | | Currently /dev/zero is handled as a special case in dd. Add hacks to the open and read functions in mingw.c to handle the zero and urandom devices. - Opening /dev/zero or /dev/urandom actually opens the special Windows file 'nul' which behaves like /dev/null. This allows manipulation of the file descriptor with things like seek and close - When /dev/zero or /dev/urandom is opened the resulting file descriptor is stored and used to override the behaviour of read. - No attempt is made to track duplicated file descriptors, so using these devices for redirections in the shell isn't going to work and won't be permitted. (Could be, but won't.) - Limited control of the special file descriptors is provided by allowing the internal variables to be changed. - The numbers from /dev/urandom aren't very random.