Extend winpr and client/common to support a new option "/buildconfig".
When used build the following build specific information is print:
* cmake options
* cflags
* compiler
* target architecture
* cmake build type
With this commit the "exported" components (usable with pkg-config and
cmake find module package)
* winpr - winpr library and headers
* freerdp - core library and headers
* freerdp-client - client specific library
* freerdp-server - server specific library
* rdtk - rdtk headers and library
To allow the installation of multiple different version (different major
number) the include files were moved into the respective sub folder:
freerdp -> freerdp{MAJOR}/freerdp (currently freerdp2/freerdp/)
winpr -> winpr{MAJOR}/winpr (currently winrp1/winpr/)
rdtk -> rdpk{MAJOR}/rdtk (currently rdtk0/rdtk/
The generated pkg-config and cmake find modules now also include the major
version number. Currently the following pkg-config are generated and
installed.
* winpr1
* freerdp2
* freerdp-server2
* freerdp-client2
* rdtk0
As cmake is able to handle multiple versions out of the box the
following can be used to find a specific module:
find_package(WinPR)
find_package(FreeRDP)
find_package(FreeRDP-Server)
find_package(FreeRDP-Client)
find_package(RdTk)
As cmake doesn't automatically resolve dependencies for packages it is
necessary to manually include the requirements. For example if
FreeRDP-Client is required WinPR and FreeRDP need to be included
(find_package) as well.
This commit also fixes the installation when STATIC_CHANNELS are built.
WITH STATIC_CHANNELS all channels are linked into libfreerdp-client, for
this all channels are generated as linker archive and linked together in
the final step. Before the intermediate linker archives were, although
not required and useful, installed. Same applies for server side
channels.
There exist two definitions of WINPR_FILE: in file/ and in nt/.
Both are different definitions used differently. Therefore split them
into WINPR_FILE and WINPR_NT_FILE.
Visual Studio 2010 use a compiler that supports only C89, which
only supports declaring variable at top of a local scope. Moving
scope variable to the top of function should solve this problem.
Don't set the identifier to "winpr" as default value because journald
will use the programs name as default if no identifier is set.
This way a program using WLog doesn't need to set an identifier (except
it want something different then it's name).
* only expose necessary functions and types in header
* don't expose appender internals
* add generic function WLog_ConfigureAppender to have the possibility
to configure appender specific settings
* detect appender availability if WLog_SetLogAppenderType or
WLog_Appender_New return FALSE or NULL respectively the appender isn't
available or the initialization failed. This is very useful for the
use with optional appenders.
* add Free to the appender interface. At the time of the Free the
appender is known and available so it can be called directly (instead
of calling the right function according to the type)
* make all appender internal function static
* all appenders return the generic wLogAppender type now. Typecasts
are internally done where necessary this abstracts the appenders more
cleanly
build-config.h should contain configure/compile time settings that are
relevant for projects that use FreeRDP.
For example the compiled in plugin search paths.
This appender allows to receive the logs over a network connection using UDP packets.
You can see the logs using a listening netcat, for example: nc -ul 127.0.0.1 20000.
* expose EnvironmentBlockToEnvpA
* cleanup includes in process.c
* removed unused "flag" variable in _CreateProcessExA
* make ProcessHandleCloseHandle static
winpr/libwinpr/utils/wlog/wlog.c: In function ‘WLog_PrintMessageVA’:
winpr/libwinpr/utils/wlog/wlog.c:234:7: warning: ‘status’ may be
used uninitialized in this function [-Wmaybe-uninitialized]
BOOL status;
^
gcc 4.9.2
wlog used to return an int but the only meaning
of the return value was:
* negative ... error
* 0 or positive ... success
but the positve returned value was 1 or some id of some
subsystem, nothing meaningful for the caller.
For a more meaningful returnvalue we now use BOOL.
If something goes wrong FALSE is returned.
It was supported in freerdp 1.0.2 but not supported in lastest master.
We should take empty password if it is explicitly specified with /v option.
If a password is not specified, we could first try SAM file. If the user entry does not exist, prompt for password.
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.
The original makecert tool won't add this tribute to a generated
certificate. Adding this attribute might cause problems when using the
certificate with other apps (i.e. Qt SSL).
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.
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_*.
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.
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.
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]
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.
This patch contains:
* checks for malloc return value + treat callers;
* modified malloc() + ZeroMemory() to calloc();
* misc fixes of micro errors seen during the code audit:
** some invalid checks in gcc.c, also there were some possible
integer overflow. This is interesting because at the end the data are parsed
and freed directly, so it's a vulnerability in some kind of dead code (at least
useless);
** fixed usage of GetComputerNameExA with just one call, when 2 were used
in misc places. According to MSDN GetComputerNameA() is supposed to return
an error when called with NULL;
** there were a bug in the command line parsing of shadow;
** in freerdp_dynamic_channel_collection_add() the size of array was multiplied
by 4 instead of 2 on resize
Unless there is an invalid parameter or internal error, ResetEvent
must return TRUE, even if the object is in nonsignaled state.
Also fixed and improved the CTest TestSynchEvent to test for the
expected/correct SetEvent and ResetEvent return values.
Note: This commit does NOT really fix PathAllocCombine!
- print a warning message that the function is buggy and added a code
comment describing the issues
- fix misuse of the S_FALSE HRESULT in error conditions
- prevent some segfaults
- check result of HeapAlloc
Fortunately PathAllocCombine is unused in FreeRDP
Fix multiple inplementation errors including the incorrect usage of S_FALSE.
Make this function behave like the Windows 8 implementation and
the according MSDN specification.
- return S_OK if the extension was NOT found
- if no extension was found, ppszExt must point to the string's terminating null
- return E_INVALIDARG if pszPath is not null-terminated within the cchPath range
- return E_INVALIDARG if pszPath is NULL
- return E_INVALIDARG if ppszExt is NULL
- return E_INVALIDARG if cchPath is Zero
- return E_NOTIMPL instead of S_OK in PathPathCchFindExtensionW()
Also extended/fixed the TestPathCchFindExtension ctest
Fix incorrect usage of S_FALSE which was used to indicate errors
although it is a HRESULT success code.
Make this function behave like the Windows 8 implementation and
the according MSDN specification.
- return E_INVALIDARG instead of S_FALSE if pszPath is NULL
- return E_INVALIDARG instead of S_FALSE if pszMore is NULL
- return E_INVALIDARG if cchPath is zero
- return E_INVALIDARG if cchPath is greater than PATHCCH_MAX_CCH
- return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE) if the combined
path size exceeds cchPath (this is the same HRESULT which the Windows
implementation returns in this case and which is referred to as
PATHCCH_E_FILENAME_TOO_LONG on msdn)
Also extended/fixed the TestPathCchAppend ctest
And again S_FALSE was incorrectly used to indicate an error.
Fix this and be more compatible to the Windows 8 implementation of
this function:
- return E_INVALIDARG instead of S_FALSE if pszPath is NULL
- return E_INVALIDARG instead of S_FALSE if cchPath < 4
- return E_INVALIDARG if cchPath > PATHCCH_MAX_CCH
- allow stripping of "\\?\c:" and don't require "\\?\c:\"
- verify that the character at the drive letter position is
actually an alphabetic character
- since the passed pszPath must not necessarily be null terminated
and we always have enough space after the memmove we can always
ensure the null termination of the stripped result
Also extended/fixed the TestPathCchStripPrefixctest
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE
Also extended/fixed the corresponding ctest
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE
Also extended/fixed the corresponding ctest
The HRESULT S_FALSE does not indicate an error:
- return E_INVALIDARG instead of S_FALSE
- return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) instead of S_FALSE
Also extended/fixed the corresponding ctest
- HRESULT was unsigned which means that until now all usages of the
SUCCEDED(hr) and FAILED(hr) macros never detected any errors
- Also fixed the (unused) SCODE typedef
- Added new ctest TestTypes
Exposing lzcnt in crt.h might causes compiler errors (redefinition) with
recent versions of gcc (>=4.9) when winpr is included in other projects.
As lzcnt isn't part of crt according to MSDN and also shouldn't be
exported by default it was moved to intrin.h.
The related test was also moved to the top level directory of winpr.
The ntlm_construct_challenge_target_info function can potentially pass NULL as
argument to the ntlm_av_pair_add function (for example DnsDomainName.Buffer).
This NULL finally lands in the CopyMemory (which is macro to the memcpy(3)
function) which can't handle NULL.
- added the unit test: TestThreadExitThread
- fix: ensure thread_list to be up to date before to call ExitThread()
- possibly resolved: Problems with serial redirection #2389
MSDN documentation says it is ensured that all threads in the barrier
have finished using it before allowing the barrier to be released in
DeleteSynchronizationBarrier(). The winpr re-implementation wasn't
keeping to that requirement, which was causing occasional crashes
when shadow client tried to access already freed barrier structure.
The crash was occuring in winpr_Handle_cleanup() after finished
waiting on a barrier's event.