Commit Graph

115 Commits

Author SHA1 Message Date
Bernhard Miklautz
0da2fb6915 fix/build: handle GNU/kFreeBSD like other BSDs
Based on a patch for Debian from
Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
2017-11-27 17:04:52 +01:00
Bernhard Miklautz
bbd11eef1d Merge pull request #4045 from akallabeth/drive_fixes_overlayfs
Drive fixes overlayfs
2017-09-22 17:22:00 +02:00
Bernhard Miklautz
52fbfb7b12 fix clang warnings, directly include wtypes.h (#4097)
* build: clang use -Wno-unused-command-line-argument

With clang 5.0 builds are quite noisy otherwise.

* Directly include wtypes.h

Directly include winpr/wtypes.h where _fseeki64 or _ftelli64 is used.

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: parentheses-equality

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning: tautological-compare

* fix build warnings with clang 5

clang version: 5.0.0-svn310678-1~exp1 (branches/release_50)
Warning:
incompatible pointer types passing 'size_t *' (aka 'unsigned
long *') to parameter of type 'UINT32 *' (aka 'unsigned int *')
[-Wincompatible-pointer-types]
2017-08-29 09:09:38 +02:00
Bernhard Miklautz
ed36f55f3e Merge pull request #4088 from akallabeth/file_api_64bit_fixes
fseeko and ftello for 64bit file support.
2017-08-16 10:04:13 +02:00
Armin Novak
c3d4b7d262 fseeko and ftello for 64bit file support. 2017-08-14 08:42:49 +02:00
Armin Novak
82d9ebc380 Fixed FileSetFilePointer warnings 2017-08-10 16:56:20 +02:00
Armin Novak
7d7e5487ab Fixed SetFilePointer, added SetFilePointerEx 2017-08-08 10:51:50 +02:00
Armin Novak
0a23bdf61f Abort CreateFile for existing files of type FIFO 2017-08-03 14:45:19 +02:00
Armin Novak
436829142e Mapped ENOTCONN to ERROR_FILE_NOT_FOUND 2017-08-03 14:38:20 +02:00
David Fort
c84065f40c Merge pull request #4069 from yurashek/master
Build on Solaris
2017-08-02 09:53:38 +02:00
Armin Novak
c8f97efb40 Added EROFS mapping. 2017-07-26 11:02:55 +02:00
Armin Novak
2beaf2c612 Added error message in case of unmapped ERRNO value. 2017-07-24 15:08:44 +02:00
Armin Novak
d1ebc39b07 Fixed file errno mapping. 2017-07-24 15:05:48 +02:00
Armin Novak
06f6c0f8cb Removed STANDARD_RIGHTS_WRITE from writeable check. 2017-07-24 11:31:48 +02:00
ilammy
987d7dd886 winpr/file: add missing NULL check
ValidFileNameComponent() has been missing a NULL check for its argument.
It's pretty obvious that NULL is not a valid file name component.
2017-05-24 23:19:39 +03:00
Jura Sasek
4edb5cf7e6 Build for Solaris 2017-05-24 04:27:01 -07:00
ilammy
44b04cafef wClipboard: disallow Windows reserved names
Another issue revealed during testing is that older Windows systems
cannot handle the reserved file names well. While Windows 8 and 10 are
fine (they silently abort the file transfer), using reserved names with
Windows 7 can flat out crash explorer.exe or result into weird error
messages like "fatal error: 0x00000000 ERROR_SUCCESS".

This is not required by MS-RDPECLIP specification, but we should try to
avoid this issue as not using reserved file names seems to be assumed
a common sense in Windows protocols.

The most convenient way to handle the issue would be on wClipboard level
so that WinPR's clients do not bother with it. We should prohibit the
reserved names from being used in FILEDESCRIPTOR, failing the conversion
if we see such a file.

POSIX subsystem (the only one at the moment) handles remote file names
in two places so move the Unicode conversion and the new validation
check into a separate function.

The reserved file name predicate is placed into <winpr/file.h> so that
it can be used in other places too. For example, other wClipboard local
file subsystems will need it. (It would be really nice to enforce this
check somewhere in the common code, so that the subsystems can't miss
it, but other places can miss some errors thus we're doing it here, as
early as possible.)

The predicate acts on separate file name components rather than full
file names because the backslash is a reserved character too. If we
process full file names this can result in phantom directory entry in
the remote file name. Not to say that handling ready-made components
spares us from splitting the full file name to extract them :)

The implementation is... a bit verbose, but that's fine by me. In the
absence of functions for case-insensitive wide string comparison and
the need to check for the [0-9] at the end of some file names this is
quite readable. Thanks to FAT and NTFS for being case-insensitive and
to MS-DOS for having reserved file names in the first place.
2017-04-09 03:17:07 +03:00
David PHAM-VAN
b46aaeb973 Fix memory leaks, Mixed declarations 2017-03-27 11:15:22 -07:00
David PHAM-VAN
5a66fe841a Misc Fixes 2017-03-17 14:07:33 -07:00
David PHAM-VAN
d6f78df195 Verify ConvertFromUnicode return values 2017-03-16 16:27:01 -07:00
David PHAM-VAN
ca0398ffc2 Fix FileGetMode writable detection 2017-03-14 12:41:11 -07:00
David PHAM-VAN
bc87fa69df Fix WinPR File creation functions 2017-03-13 14:18:59 -07:00
David PHAM-VAN
07c60ca8a4 Add Windows Errors to File operations 2017-03-13 14:18:55 -07:00
David PHAM-VAN
b89bfaaae4 Add missing functions to WinPR 2017-03-13 14:18:37 -07:00
Armin Novak
c90a0be205 Fixed time conversion in FileSetFileTime. #3508 2017-02-13 15:14:20 +01:00
Norbert Federa
f71b6b46e8 fix string format specifiers
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
2016-12-16 13:48:43 +01:00
Armin Novak
88be64f10b Fixed apple file times. 2016-10-06 13:43:04 +02:00
Armin Novak
3eb136d167 Fixed SetFileTime for mac. 2016-09-27 13:28:39 +02:00
Norbert Federa
e718fb324b fix race conditions, tests and some invalid return values
Since the current winpr implementation for overlapped operations is
incomplete and buggy, all affected functions will now fail if they are
called with a set FILE_FLAG_OVERLAPPED flag or a non-null pointer to
a OVERLAPPED structure.

winpr/nt:
- use proper one-time initialization on win32
- fix TestNtCreateFile
- fix broken/incomplete _RtlAnsiStringToUnicodeString
- unimplemented functions return appropriate error codes

winpr/pipe:
- improved TestPipeCreateNamedPipe
- rewrite the completely broken TestPipeCreateNamedPipeOverlapped test

rdtk:
- improve test and don't blindly return success

winpr/synch:
- fix race condition in TestSynchTimerQueue

winpr/ssspi:
- fix TestEnumerateSecurityPackages printf output
- fix TestQuerySecurityPackageInfo printf output

winpr/environment:
- fix GetEnvironmentStrings printf output

winpr/comm:
- unimplemented functions return appropriate error codes

winpr/io:
- unimplemented functions return appropriate error codes

winpr/thread:
- implement SwitchToThread() via sched_yield()
2016-06-01 16:26:26 +02:00
Marc-André Moreau
cedf6d98e2 freerdp: more UWP porting 2016-03-29 20:34:52 -04:00
Marc-André Moreau
4d629a7999 freerdp: UWP porting 2016-03-29 16:03:15 -04:00
Marc-André Moreau
ceefc4b099 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-03-07 10:19:50 -05:00
Armin Novak
34b12362cb Fixed FreeBSD support for filetime settings. 2016-03-06 15:01:58 +01:00
Armin Novak
98d4a9347a Added support for android SetFileTime.
Deactivated libjpeg support for android.
2016-02-26 12:27:59 +01:00
Armin Novak
5537230298 Fixed missing iOS UTIME_OMIT. 2016-02-26 11:43:54 +01:00
Armin Novak
436be2441a Implemented SetFileTime 2016-02-26 11:00:17 +01:00
Martin Fleisz
1b881e47d3 winpr/file: Add missing include (io.h) for windows builds 2016-02-23 09:55:55 +01:00
Marc-André Moreau
bfca674f2d Merge branch 'master' of github.com:FreeRDP/FreeRDP 2016-02-05 11:39:45 -05:00
Armin Novak
a1617c734c Fixed unused check. 2016-02-03 11:22:27 +01:00
Armin Novak
9b160d4570 Fixed uninitialized value. 2016-01-15 09:33:21 +01:00
Bernhard Miklautz
06307f1ac1 winpr/file: disable buffering
When FILE streams are used per default buffering is enabled but
WriteFile/ReadFile shouldn't do any extra buffering.
2015-12-16 18:47:42 +01:00
Armin Novak
5b2f4f50a0 Fixed FILE* leak and EndOfFile settings. 2015-12-16 17:35:59 +01:00
Armin Novak
6010932984 Fixed possible race on file creation. 2015-12-14 09:32:42 +01:00
Armin Novak
fe51dd1e10 Fixed logging, added file name. 2015-12-10 10:39:37 +01:00
Armin Novak
400d1b8b96 Fixed open mode for fdopen. 2015-12-10 10:37:44 +01:00
Armin Novak
19744f3bb8 Added additional file functions and tests. 2015-12-09 18:29:16 +01:00
Marc-André Moreau
c0c9c9353e winpr: more Win32 fixes 2015-11-25 14:41:32 -05:00
Martin Haimberger
925e4ea4d4 winpr/file: extend API
added windows code
fixed compiler issue
2015-09-15 04:14:30 -07:00
Bernhard Miklautz
074854735f winpr/file: extend API
Add function GetFileHandleForFileDescriptor to get
a file handle for a valid file descriptor.
2015-09-15 02:16:36 -07:00
Bernhard Miklautz
0f5e7c60a7 winpr/file: don't close stdin/stdout/stderr
If the handle is closed stdin/stdout/stderr should be left open.
2015-09-09 17:07:40 +02:00