Commit Graph

1466 Commits

Author SHA1 Message Date
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
Bryan Everly
37b3881f06 Merge remote-tracking branch 'upstream/master' 2015-09-14 13:21:00 -04:00
Bryan Everly
bd149a284d Cleaned up previous OpenBSD change per recommendation 2015-09-14 13:20:11 -04:00
Bernhard Miklautz
0d9dfb974d winpr/file: integrate pull request feedback
* simplify RemoveDirectory
* move std handle function into an extern C block
2015-09-10 11:50:10 +02: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
Bernhard Miklautz
8091530779 winpr/file: fix ios build
comm is only build on linux.
2015-09-09 17:07:13 +02:00
Bernhard Miklautz
6b52a2e5cc winpr/file: initial regular file support
Add initial support for "regular" files. First implemented call is
GetStdHandle to get stdin/stdout/stderr.
2015-09-09 16:47:03 +02:00
Bernhard Miklautz
204ae5462a winpr/file: refactoring
The used method for initalizing and registering the handle creators
had certain disadvantages like that it was necessary to have the creators
initialized before the first call to CreateFile. In case of comm it
wouldn't have been possible to open an comm port without calling any
other call related function first.
Now the handle creators are initialized the first time CreateFile is
called. This way it is also possible to ensure a certain order of the
handler invocations.

This commit also splits out the client side named pipe code from
the generic file handling (now called generic.c instead of file.c) and
uses the new handle creator infrastructure to register.
2015-09-09 15:48:59 +02:00
MartinHaimberger
d971116457 Merge pull request #2765 from akallabeth/connect_abort
Connect abort and unified TCP connect
2015-09-07 10:05:24 +02:00
Armin Novak
7d8ab23877 WSAEvent fixes ported from realjiangms pull 2870. 2015-09-05 15:18:01 +02:00
MartinHaimberger
74817efbdb Merge pull request #2852 from bmiklautz/process_env
Update CreateProcess and rfx
2015-09-02 10:09:11 +02:00
Armin Novak
5cad081cc8 Fixed memory leak. 2015-08-28 11:07:25 +02:00
Bernhard Miklautz
72f13aeacb CreateProcess: add stdin/out/err redirection
When launching a new process stdin/stdout/stderr can be redirected by
passing the corresponding HANDLEs in the passed lpStartupInfo structure.
This is required for example if a pipe should be used as stdin/stdout.

If set in lpStartupInfo the file descriptor of the passed handle is
now used. The test was updated accordingly.
2015-08-28 10:41:23 +02:00
Marc-André Moreau
e1e4d2ae98 Merge pull request #2827 from HenryJacques/winpr_cleanup
Remove unused variable in RegQueryValueExA()
2015-08-27 10:11:50 -04:00
Armin Novak
134a16d522 Fixed WSAEventSelect mode reset. 2015-08-27 15:33:06 +02:00
Armin Novak
1abd652530 Fixed GetComputerNameExA and GetComputerNameA. 2015-08-25 17:43:22 +02:00
HenryJacques
e9a7da3b4e Remove unused variable 2015-08-05 18:38:50 +02:00
Martin Haimberger
008d9f3b79 fixed misc *_free functions to accept NULL
Following types of collections support now
NULL in the free call:

* ArrayList
* BitStream
* ContdownEvent
* Dictionary
* KeyValuePair
* MessageQueue
2015-07-30 07:02:36 -07:00
Martin Haimberger
479157b69c winpr: WaitFor*Ojbect/s set lastError now 2015-07-30 02:52:11 -07:00
Marc-André Moreau
611c194f80 Merge pull request #2801 from bmiklautz/fix/thread
winpr/thread: small cleanups
2015-07-28 08:47:06 -04:00
Marc-André Moreau
b33ea8aee9 Merge pull request #2804 from bmiklautz/fix/misc
Misc fixes
2015-07-28 08:46:27 -04:00
Marc-André Moreau
06c3f2fca4 Merge pull request #2793 from rkondratenko/pcsclite-transactions
Fix for transactions support for Smart Cards
2015-07-28 08:44:58 -04:00
Bernhard Miklautz
c3ea07f3d9 winpr/thread: don't close invalid file descriptors
In case the file descriptor is -1 don't call close.
2015-07-24 14:57:47 +02:00
Bernhard Miklautz
81d422588e winrp/thread: don't call pthread_exit on return
As the pthread_exit man page states pthread_exit is called implicitly
when the start function returns.
2015-07-24 14:52:31 +02:00
Bernhard Miklautz
4250f3f030 winpr/event: remove critical section
The critical section isn't required and not used anymore since
commit 8a2220a3d9.
2015-07-24 13:29:48 +02:00
Bernhard Miklautz
ca150f2255 winpr/thread: small cleanups
Also adds error checking of winpr_StartThread in winpr_StartThread.
2015-07-23 11:52:49 +02:00
Rostislav Kondratenko
3f81ff87a6 Removing private context on hCard so that transaction will properly unlock when context is released. 2015-07-17 18:13:41 +03:00
Rostislav Kondratenko
f2863fabf5 Re-enabled PCSC-Lite transactions and fixed smartcard deinitialization so it will release all contexts to unblock calls waiting for transactions 2015-07-17 16:37:44 +03:00
Armin Novak
9af2e22d51 Fixed mutex unlocking and return checks. 2015-07-16 17:07:29 +02:00
MartinHaimberger
b06d83ba80 Merge pull request #2766 from akallabeth/snprintf_to_sprintf_s
Replaced snprintf with sprintf_s
2015-07-15 09:47:43 +02:00
Bernhard Miklautz
68e8569110 winpr/synch: remove the dependency on winsock.h
winsock.h pulls in a lot of defines and dependencies that are not
required and partially unwanted in winpr's core (for parts that are not
related to network). In order to get rid of this dependency and have an
independent defines for extended winpr functions the WINPR_FD_* defines
are used internally (and for exposed functions). Where required, like in
WSAEventSelect, the FD_* is mapped to WINPR_FD_*.
2015-07-14 11:39:41 +02:00
Armin Novak
cf9f975341 Replaced snprintf with sprintf_s 2015-07-03 13:26:15 +02:00
Armin Novak
776f15e135 Fixed inverted bAttached setting.
If bAttached is TRUE, the resources of the event are not
cleaned up on CloseHandle.
2015-07-03 12:42:04 +02:00
Armin Novak
c21de0dae6 Fixed pr comments. 2015-07-03 11:13:48 +02:00
Armin Novak
d18b0fbeb4 Handle API updated. 2015-07-03 09:52:52 +02:00
Armin Novak
77204aa6b6 WSAEventSelect: Handle lNetworkEvents == 0
WSAEventSelect did ignore the lNetworkEvents argument.
In case this argument is 0, the non blocking socket must
be set to blocking again to mimic windows behavior.
2015-07-03 09:29:36 +02:00
Armin Novak
6243a9374b Added write event support to handle functions.
Allows the WinPR HANDLE functions WaitForSingleObject and
WaitForMultipleObjects to signal in case of write events.
This is used by CreateFileDescriptor and SetEventFileDescriptor,
which got an API change accomodating for this new feature.
2015-07-03 09:29:18 +02:00
Armin Novak
7dc96c412f Added convenience function winpr_log_backtrace. 2015-07-03 09:22:02 +02:00
Bernhard Miklautz
c7adb569ff CreateProcess: fix setting of default handler
If SA_SIGINFO isn't set in the flags sa_handler is used
instead of sa_sigaction.

This fixes also the compiler warning:

FreeRDP/winpr/libwinpr/thread/process.c: In function ‘_CreateProcessExA’:
FreeRDP/winpr/libwinpr/thread/process.c:282:20: warning: assignment from
       incompatible pointer type [enabled by default]
2015-07-02 12:25:48 +02:00
Bernhard Miklautz
be53e9e029 CreateProcess: two fixes
* change to lpCurrentDirectory if set even if no token was supplied
* fix wrong check - add missing !

This was part of akallabeth's PR #2714.
2015-07-02 12:05:46 +02:00
Norbert Federa
c84e90bf06 winpr: fix CreateProcess signal handler issues
The calling thread of CreateProcess can be in any library and
can have arbitrary signal masks and handlers.

We now save the caller's mask and  block all signals before forking.
After fork:
- child resets the handlers and unblocks all signals.
- parent restores the caller's original signal mask.
2015-07-02 11:28:06 +02:00
Armin Novak
78eeb861d5 Fixed mixed declarations and code. 2015-07-01 16:20:56 +02:00
Norbert Federa
1c43a6e115 Merge pull request #2738 from bmiklautz/ffuncs
hardening: check fread and fwrite return values
2015-07-01 13:02:32 +02:00
Bernhard Miklautz
1cee185e3c hardening: check fread and fwrite return values 2015-06-26 20:38:30 +02:00
Marc-André Moreau
5ec19d2045 Merge branch 'master' of github.com:FreeRDP/FreeRDP 2015-06-26 14:00:03 -04:00
Norbert Federa
ac95b7274e Merge pull request #2727 from akallabeth/leak_fixes_reformat
Fixed leaks, NULL dereferences and broken init.
2015-06-26 15:01:08 +02:00
Hardening
b411c11f6e Merge pull request #2729 from akallabeth/win_reg_key_by_vendor_product_define
Replaced hard coded registry keys with cmake defines.
2015-06-26 11:15:09 +02:00
Armin Novak
b81aaa9cc2 Fixed mutex trylock in MutexCloseHandle. 2015-06-25 12:24:28 +02:00
Bernhard Miklautz
cbbc680131 clipboard: fix of by one error on cleanup 2015-06-25 11:53:03 +02:00