#include <unistd.h>
#endif
- #include "serial_tty.h"
- #include "serial_constants.h"
-
+ #include <winpr/collections.h>
+ #include <winpr/comm.h>
#include <winpr/crt.h>
- #include <winpr/wlog.h>
+ #include <winpr/stream.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
- #include <winpr/stream.h>
- #include <winpr/collections.h>
+ /* #include <winpr/wlog.h> */
#include <freerdp/freerdp.h>
-#include <freerdp/utils/list.h>
#include <freerdp/channels/rdpdr.h>
-#include <freerdp/utils/svc_plugin.h>
+ #define MAX_IRP_THREADS 5
+
typedef struct _SERIAL_DEVICE SERIAL_DEVICE;
struct _SERIAL_DEVICE
break;
default:
- DEBUG_WARN("MajorFunction 0x%X not supported", irp->MajorFunction);
irp->IoStatus = STATUS_NOT_SUPPORTED;
- irp->Complete(irp);
break;
}
}
if (count > 2)
serial->Path = _strdup(params[2]);
+ if (count > 3)
+ serial->Driver = _strdup(params[3]);
+
freerdp_device_collection_add(settings, (RDPDR_DEVICE*) serial);
- settings->DeviceRedirection = TRUE;
return 1;
}
WINPR_API int UnixChangeFileMode(const char* filename, int flags);
++WINPR_API BOOL IsNamedPipeFileNameA(LPCSTR lpName);
WINPR_API char* GetNamedPipeNameWithoutPrefixA(LPCSTR lpName);
WINPR_API char* GetNamedPipeUnixDomainSocketBaseFilePathA(void);
WINPR_API char* GetNamedPipeUnixDomainSocketFilePathA(LPCSTR lpName);
#include <unistd.h>
#endif
+#include <assert.h>
+
#include "../handle/handle.h"
+ /* _HandleCreators is a NULL-terminated array with a maximun of HANDLE_CREATOR_MAX HANDLE_CREATOR */
+ #define HANDLE_CLOSE_CB_MAX 128
+ static HANDLE_CLOSE_CB **_HandleCloseCbs = NULL;
+
+ static pthread_once_t _HandleCloseCbsInitialized = PTHREAD_ONCE_INIT;
+ static void _HandleCloseCbsInit()
+ {
+ /* NB: error management to be done outside of this function */
+
+ assert(_HandleCloseCbs == NULL);
+
+ _HandleCloseCbs = (HANDLE_CLOSE_CB**)calloc(HANDLE_CLOSE_CB_MAX+1, sizeof(HANDLE_CLOSE_CB*));
+
+ assert(_HandleCloseCbs != NULL);
+ }
+
+ /**
+ * Returns TRUE on success, FALSE otherwise.
+ */
+ BOOL RegisterHandleCloseCb(HANDLE_CLOSE_CB *pHandleCloseCb)
+ {
+ int i;
+
+ if (pthread_once(&_HandleCloseCbsInitialized, _HandleCloseCbsInit) != 0)
+ {
+ return FALSE;
+ }
+
+ if (_HandleCloseCbs == NULL)
+ {
+ return FALSE;
+ }
+
+
+ for (i=0; i<HANDLE_CLOSE_CB_MAX; i++)
+ {
+ if (_HandleCloseCbs[i] == NULL)
+ {
+ _HandleCloseCbs[i] = pHandleCloseCb;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+ }
+
+
+
BOOL CloseHandle(HANDLE hObject)
{
+ int i;
ULONG Type;
PVOID Object;