Hello,
I have some patches which enables channel/librdpdr support for windows.
Attached are the patches for review, but only for the
freerdp code, and not for the Visual Studio .vcproj project files,
they are only in the repository.
The repository is here:
http://gitorious.org/freerdp-smartcard/winport
I have never used "git" thus most likely I made some stupid mistakes.
But I could pull the patches into a clone of freerdp master with
the command:
git pull g...@gitorious.org:freerdp-smartcard/winport.git winport
Is it possible to apply these?
regards,
Martin
channels/common/chan_plugin.c | 34 +++--
channels/common/chan_stream.c | 2 +
channels/common/wait_obj.c | 2 +-
channels/common/wait_obj.h | 2 +-
channels/common/wait_obj_win.c | 164 ++++++++++++++++++++++
channels/rdpdr/devman.c | 37 +++++-
channels/rdpdr/devman.h | 2 +-
channels/rdpdr/irp_queue.c | 3 +-
channels/rdpdr/rdpdr_capabilities.c | 4 +
channels/rdpdr/rdpdr_constants.h | 4 +
channels/rdpdr/rdpdr_main.c | 61 +++++----
channels/rdpdr/rdpdr_main.h | 8 +-
channels/rdpdr/rdpdr_types.h | 4 +-
include/freerdp/os/os.h | 111 +++++++++++++++
include/freerdp/types_ui.h | 4 +-
libfreerdp/os/os_win.c | 98 ++++++++++++++
libfreerdp/stream.h | 6 +
libfreerdp/tcp.c | 2 +-
libfreerdpchanman/libfreerdpchanman.c | 44 +------
win/freerdp.sln | 16 +++
win/libcommon.vcproj | 202 ++++++++++++++++++++++++++++
win/libfreerdp.vcproj | 8 +
win/librdpdr.def | 10 ++
win/librdpdr.vcproj | 239 +++++++++++++++++++++++++++++++++
win/wfreerdp/wf_event.h | 1 -
win/wfreerdp/wf_win.cpp | 3 +-
win/wfreerdp/wf_win.h | 1 -
win/wfreerdp/wfreerdp.cpp | 51 +++++++-
28 files changed, 1012 insertions(+), 111 deletions(-)
commit b97554c77eba551bfa7ba2ee618db89ece50f36e
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
fix compiler warnings
diff --git a/libfreerdp/stream.h b/libfreerdp/stream.h
index d3779ab..88b3c4d 100644
--- a/libfreerdp/stream.h
+++ b/libfreerdp/stream.h
@@ -22,8 +22,14 @@
#define __STREAM_H
#if !(defined(L_ENDIAN) || defined(B_ENDIAN))
+#ifdef __GNUC__
#warning no endian defined
#endif
+#ifdef _MSC_VER
+#pragma message("no endian defined")
+#endif
+#endif
+
#include "debug.h"
commit 6e858f98f351e444ffb47473695f656a43d3a654
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
this file is a start for abstracting the underlying OS calls.
Nearly all of it is done with defines. A future improvement may
add functions for generic event mechanisms and more
diff --git a/include/freerdp/os/os.h b/include/freerdp/os/os.h
new file mode 100644
index 0000000..888d722
--- /dev/null
+++ b/include/freerdp/os/os.h
@@ -0,0 +1,111 @@
+
+#ifndef __FREERDP_OS_H
+#define __FREERDP_OS_H
+
+#ifdef _WIN32
+#include <winsock2.h>
+#include <windows.h>
+#include <assert.h>
+
+/**
+ windows native build does not have config.h, but some places
+ need at least a minimum of definitions
+*/
+#define PACKAGE_VERSION "windows default build version"
+#define PLUGIN_PATH L"Z:\\win\\debug\\"
+
+/**
+ OS/API wrappers
+*/
+#define MUTEX HANDLE
+#define MUTEX_INIT(m) m = CreateMutex(NULL, FALSE, NULL)
+#define MUTEX_LOCK(m) WaitForSingleObject(m, INFINITE)
+#define MUTEX_UNLOCK(m) ReleaseMutex(m)
+#define MUTEX_DESTROY(m) CloseHandle(m)
+#define THREAD HANDLE
+#define THREAD_CREATE(thread,attr,start,arg) \
+ thread=CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)start,arg,0,NULL);
+#define THREAD_DETACH(m) ;
+#define SEMAPHORE HANDLE
+/** the m,m in CreateSemaphore is correct.
+ In Linux sem_init is: int sem_init(sem_t *sem, int pshared, unsigned int
value);
+ where pshared has no equivalent and value is the initial value.
+ The asserts make sure that the windows version can only be used in a
way that
+ it may work
+ */
+#define SEMAPHORE_INIT(s, i, m) s = CreateSemaphore(NULL, m, m,
NULL);assert(i==0);assert(m>0);
+#define SEMAPHORE_WAIT(s) WaitForSingleObject(s, INFINITE)
+#define SEMAPHORE_POST(s) ReleaseSemaphore(s, 1, NULL)
+#define SEMAPHORE_DESTROY(s) CloseHandle(s)
+#define DLHANDLE HMODULE
+#define DLOPEN(f) LoadLibrary(f)
+#define DLOPEN_A(f) LoadLibraryA(f)
+#define DLSYM(f, n) GetProcAddress(f, n)
+#define DLCLOSE(f) FreeLibrary(f)
+#define PATH_SEPARATOR L"\\"
+#define PLUGIN_EXT L"dll"
+#define STRCHR wcschr
+#define WIN32_EXPORT __declspec(dllexport)
+#define IOHANDLE HANDLE
+typedef DWORD int32_t;
+typedef unsigned char uint8_t;
+typedef unsigned int uint32_t;
+typedef unsigned short uint16_t;
+
+/**
+ function prototypes
+ */
+
+
+
+/**
+ Windows uses unicode, the rest of freerdp only knows about char*
+ This function convers unicode->char* and introduce a possible
+ memory leak, if the char* (or unicode) string is not freed
+*/
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WIN32_EXPORT HRESULT UnicodeToAnsi(wchar_t* pszW,char** ppszA);
+WIN32_EXPORT HRESULT AnsiToUnicode(char* pszA,wchar_t** ppszW);
+
+#ifdef __cplusplus
+}
+#endif
+
+#else
+#include <pthread.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/select.h>
+#include <semaphore.h>
+#include <dlfcn.h>
+
+#define THREAD_RETURN void*
+#define THREAD pthread_t
+#define THREAD_CREATE(thread,attr,start,arg)
pthread_create(&thread,attr,start,arg)
+#define THREAD_DETACH(m) pthread_detach(m)
+#define MUTEX pthread_mutex_t
+#define MUTEX_INIT(m) pthread_mutex_init(&m, 0)
+#define MUTEX_LOCK(m) pthread_mutex_lock(&m)
+#define MUTEX_UNLOCK(m) pthread_mutex_unlock(&m)
+#define MUTEX_DESTROY(m) pthread_mutex_destroy(&m)
+#define SEMAPHORE sem_t
+#define SEMAPHORE_INIT(s, i, m) sem_init(&s, i, m)
+#define SEMAPHORE_WAIT(s) sem_wait(&s)
+#define SEMAPHORE_POST(s) sem_post(&s)
+#define SEMAPHORE_DESTROY(s) sem_destroy(&s)
+#define DLHANDLE void*
+#define DLOPEN(f) dlopen(f, RTLD_LOCAL | RTLD_LAZY)
+#define DLOPEN_A(f) dlopen(f, RTLD_LOCAL | RTLD_LAZY)
+#define DLSYM(f, n) dlsym(f, n)
+#define DLCLOSE(f) dlclose(f)
+#define PATH_SEPARATOR '/'
+#define PLUGIN_EXT "so"
+#define STRCHR strchr
+#define IOHANDLE uint32_t;
+#define WIN32_EXPORT
+#endif
+
+#endif
commit 122f9fc8498a288cb763d51e572230fcd0a682ad
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
add helper functions for unicode/ansi conversion
for windows this means that some libraries which
do not have a dependency to libfreerdp now needs
this dependency
diff --git a/libfreerdp/os/os_win.c b/libfreerdp/os/os_win.c
new file mode 100644
index 0000000..3f533a7
--- /dev/null
+++ b/libfreerdp/os/os_win.c
@@ -0,0 +1,98 @@
+/*
+ implementation of OS system specific functions
+ Copyright (C) 2010 Martin Vogt
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation.
+
+ For more information look at the file COPYRIGHT in this package
+
+ */
+
+
+
+#include <freerdp/os/os.h>
+
+
+
+
+HRESULT UnicodeToAnsi(wchar_t* pszW,char** ppszA)
+{
+
+ ULONG cbAnsi, cCharacters;
+ DWORD dwError;
+
+ // If input is null then just return the same.
+ if (pszW == NULL)
+ {
+ *ppszA = NULL;
+ return NOERROR;
+ }
+
+ cCharacters = wcslen(pszW)+1;
+ // Determine number of bytes to be allocated for ANSI string. An
+ // ANSI string can have at most 2 bytes per character (for Double
+ // Byte Character Strings.)
+ cbAnsi = cCharacters*2;
+
+ // Use of the OLE allocator is not required because the resultant
+ // ANSI string will never be passed to another COM component. You
+ // can use your own allocator.
+ *ppszA = (char*) malloc(cbAnsi);
+ if (NULL == *ppszA)
+ return E_OUTOFMEMORY;
+
+ // Convert to ANSI.
+ if (0 == WideCharToMultiByte(CP_ACP, 0, pszW, cCharacters, *ppszA,
+ cbAnsi, NULL, NULL))
+ {
+ dwError = GetLastError();
+ free(*ppszA);
+ *ppszA = NULL;
+ return HRESULT_FROM_WIN32(dwError);
+ }
+ return NOERROR;
+
+}
+
+
+/*
+ * AnsiToUnicode converts the ANSI string pszA to a Unicode string
+ * and returns the Unicode string through ppszW. Space for the
+ * the converted string is allocated by AnsiToUnicode.
+ */
+
+HRESULT AnsiToUnicode(char* pszA,wchar_t** ppszW)
+{
+
+ ULONG cCharacters;
+ DWORD dwError;
+
+ // If input is null then just return the same.
+ if (NULL == pszA)
+ {
+ *ppszW = NULL;
+ return NOERROR;
+ }
+
+ // Determine number of wide characters to be allocated for the
+ // Unicode string.
+ cCharacters = strlen(pszA)+1;
+
+ *ppszW = (wchar_t*) malloc(cCharacters*2);
+ if (NULL == *ppszW)
+ return E_OUTOFMEMORY;
+
+ // Covert to Unicode.
+ if (0 == MultiByteToWideChar(CP_ACP, 0, pszA, cCharacters,
+ *ppszW, cCharacters))
+ {
+ dwError = GetLastError();
+ free(*ppszW);
+ *ppszW = NULL;
+ return HRESULT_FROM_WIN32(dwError);
+ }
+
+ return NOERROR;
+}
commit 0afaca5f7c51414f5407f5a02d056022a357c91a
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
switch C file to use the header
diff --git a/libfreerdpchanman/libfreerdpchanman.c
b/libfreerdpchanman/libfreerdpchanman.c
index af9219d..2ee1933 100644
--- a/libfreerdpchanman/libfreerdpchanman.c
+++ b/libfreerdpchanman/libfreerdpchanman.c
@@ -36,47 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#ifdef _WIN32
-#include <windows.h>
-#define MUTEX HANDLE
-#define MUTEX_INIT(m) m = CreateMutex(NULL, FALSE, NULL)
-#define MUTEX_LOCK(m) WaitForSingleObject(m, INFINITE)
-#define MUTEX_UNLOCK(m) ReleaseMutex(m)
-#define MUTEX_DESTROY(m) CloseHandle(m)
-#define SEMAPHORE HANDLE
-#define SEMAPHORE_INIT(s, i, m) s = CreateSemaphore(NULL, i, m, NULL)
-#define SEMAPHORE_WAIT(s) WaitForSingleObject(s, INFINITE)
-#define SEMAPHORE_POST(s) ReleaseSemaphore(s, 1, NULL)
-#define SEMAPHORE_DESTROY(s) CloseHandle(s)
-#define DLOPEN(f) LoadLibrary(f)
-#define DLSYM(f, n) GetProcAddress(f, n)
-#define DLCLOSE(f) FreeLibrary(f)
-#define PATH_SEPARATOR L'\\'
-#define PLUGIN_EXT L"dll"
-#define STRCHR wcschr
-#else
-#include <dlfcn.h>
-#include <semaphore.h>
-#include <netdb.h>
-#include <unistd.h>
-#include <pthread.h>
-#define MUTEX pthread_mutex_t
-#define MUTEX_INIT(m) pthread_mutex_init(&m, 0)
-#define MUTEX_LOCK(m) pthread_mutex_lock(&m)
-#define MUTEX_UNLOCK(m) pthread_mutex_unlock(&m)
-#define MUTEX_DESTROY(m) pthread_mutex_destroy(&m)
-#define SEMAPHORE sem_t
-#define SEMAPHORE_INIT(s, i, m) sem_init(&s, i, m)
-#define SEMAPHORE_WAIT(s) sem_wait(&s)
-#define SEMAPHORE_POST(s) sem_post(&s)
-#define SEMAPHORE_DESTROY(s) sem_destroy(&s)
-#define DLOPEN(f) dlopen(f, RTLD_LOCAL | RTLD_LAZY)
-#define DLSYM(f, n) dlsym(f, n)
-#define DLCLOSE(f) dlclose(f)
-#define PATH_SEPARATOR '/'
-#define PLUGIN_EXT "so"
-#define STRCHR strchr
-#endif
+#include <freerdp/os/os.h>
#include <freerdp/freerdp.h>
#include <freerdp/chanman.h>
#include <freerdp/vchan.h>
commit 3e6471b2608f1f529c8277ac95ce6e7084d142d8
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
Convert chan_plugin to the os wrapper.
This needs to shift the initialization
into the init function.
diff --git a/channels/common/chan_plugin.c b/channels/common/chan_plugin.c
index 2d8a9ca..6b1c763 100644
--- a/channels/common/chan_plugin.c
+++ b/channels/common/chan_plugin.c
@@ -24,11 +24,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
+
+#include <freerdp/os/os.h>
#include <freerdp/types_ui.h>
#include <freerdp/vchan.h>
#include "chan_plugin.h"
+
/* The list of all plugin instances. */
typedef struct rdp_chan_plugin_list rdpChanPluginList;
struct rdp_chan_plugin_list
@@ -40,19 +42,21 @@ struct rdp_chan_plugin_list
static rdpChanPluginList * g_chan_plugin_list = NULL;
/* For locking the global resources */
-static pthread_mutex_t * g_mutex = NULL;
+static MUTEX g_mutex;
void
chan_plugin_init(rdpChanPlugin * chan_plugin)
{
+ static int lneed_init=1;
+
rdpChanPluginList * list;
/* The channel manager will guarantee only one thread can call
VirtualChannelInit at a time. So this should be safe. */
- if (g_mutex == NULL)
+ if (lneed_init == 1)
{
- g_mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(g_mutex, 0);
+ lneed_init=0;
+ MUTEX_INIT(g_mutex);
}
chan_plugin->init_handle = NULL;
@@ -63,10 +67,10 @@ chan_plugin_init(rdpChanPlugin * chan_plugin)
list = (rdpChanPluginList *) malloc(sizeof(rdpChanPluginList));
list->chan_plugin = chan_plugin;
- pthread_mutex_lock(g_mutex);
+ MUTEX_LOCK(g_mutex);
list->next = g_chan_plugin_list;
g_chan_plugin_list = list;
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
}
void
@@ -76,7 +80,7 @@ chan_plugin_uninit(rdpChanPlugin * chan_plugin)
rdpChanPluginList * prev;
/* Remove from global list */
- pthread_mutex_lock(g_mutex);
+ MUTEX_LOCK(g_mutex);
for (prev = NULL, list = g_chan_plugin_list; list; prev = list, list =
list->next)
{
if (list->chan_plugin == chan_plugin)
@@ -96,7 +100,7 @@ chan_plugin_uninit(rdpChanPlugin * chan_plugin)
}
free(list);
}
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
}
int
@@ -137,17 +141,17 @@ chan_plugin_find_by_init_handle(void * init_handle)
rdpChanPluginList * list;
rdpChanPlugin * chan_plugin;
- pthread_mutex_lock(g_mutex);
+ MUTEX_LOCK(g_mutex);
for (list = g_chan_plugin_list; list; list = list->next)
{
chan_plugin = list->chan_plugin;
if (chan_plugin->init_handle == init_handle)
{
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
return chan_plugin;
}
}
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
return NULL;
}
@@ -158,7 +162,7 @@ chan_plugin_find_by_open_handle(int open_handle)
rdpChanPlugin * chan_plugin;
int lindex;
- pthread_mutex_lock(g_mutex);
+ MUTEX_LOCK(g_mutex);
for (list = g_chan_plugin_list; list; list = list->next)
{
chan_plugin = list->chan_plugin;
@@ -166,12 +170,12 @@ chan_plugin_find_by_open_handle(int open_handle)
{
if (chan_plugin->open_handle[lindex] == open_handle)
{
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
return chan_plugin;
}
}
}
- pthread_mutex_unlock(g_mutex);
+ MUTEX_UNLOCK(g_mutex);
return NULL;
}
commit 5aef00cacf7f539de4673687bdc9758b707329e7
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
fix the config.h include
diff --git a/channels/common/chan_stream.c b/channels/common/chan_stream.c
index 50ba2a2..da13dac 100644
--- a/channels/common/chan_stream.c
+++ b/channels/common/chan_stream.c
@@ -18,7 +18,9 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
commit f6bc0e2113d51e7deec0e178de04fc0bd785b5e6
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
numobj cannot be negative
diff --git a/channels/common/wait_obj.h b/channels/common/wait_obj.h
index 8d1d6db..99b9a5c 100644
--- a/channels/common/wait_obj.h
+++ b/channels/common/wait_obj.h
@@ -35,7 +35,7 @@ wait_obj_set(struct wait_obj * obj);
int
wait_obj_clear(struct wait_obj * obj);
int
-wait_obj_select(struct wait_obj ** listobj, int numobj, int * listr, int numr,
+wait_obj_select(struct wait_obj ** listobj, unsigned int numobj, int * listr,
int numr,
int timeout);
#endif
commit 9055f6b1df254c64af943cd6641a6bfe7dbaef6d
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
change function signature to "unsigned" for the linux implementation
diff --git a/channels/common/wait_obj.c b/channels/common/wait_obj.c
index a9f68b0..47e15bd 100644
--- a/channels/common/wait_obj.c
+++ b/channels/common/wait_obj.c
@@ -127,7 +127,7 @@ wait_obj_clear(struct wait_obj * obj)
}
int
-wait_obj_select(struct wait_obj ** listobj, int numobj, int * listr, int numr,
+wait_obj_select(struct wait_obj ** listobj, unsigned int numobj, int * listr,
int numr,
int timeout)
{
int max;
commit d5ef6ddbd466cae63cdb9e2c0639d38025bc93ab
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
windows cannot do a select on a pipe. (only on sockets)
I tried to implement the same behaviour with
Events/SendEvents which seems to work(tm), although the code looks
a bit racy.
diff --git a/channels/common/wait_obj_win.c b/channels/common/wait_obj_win.c
new file mode 100644
index 0000000..492a707
--- /dev/null
+++ b/channels/common/wait_obj_win.c
@@ -0,0 +1,164 @@
+/*
+ Windows implemtenation for wait obj
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <freerdp/os/os.h>
+
+#include "wait_obj.h"
+
+
+#define LOG_LEVEL 1
+#define LLOG(_level, _args) \
+ do { if (_level < LOG_LEVEL) { printf _args ; } } while (0)
+#define LLOGLN(_level, _args) \
+ do { if (_level < LOG_LEVEL) { printf _args ; printf("\n"); } } while (0)
+
+
+struct wait_obj
+{
+ MUTEX isSetMutex;
+ int isSet;
+ HANDLE hWriteEvent;
+
+};
+
+struct wait_obj *
+wait_obj_new(const char * name)
+{
+ struct wait_obj * obj;
+
+ obj = (struct wait_obj *) malloc(sizeof(struct wait_obj));
+ if (obj == NULL) {
+ LLOGLN(0, ("init_wait_obj: malloc failed"));
+ return NULL;
+ }
+
+ obj->hWriteEvent=CreateEvent(
+ NULL, // default security attributes
+ TRUE, // manual-reset event object
+ FALSE, // initial state is nonsignaled
+ NULL); // unnamed object
+ if (obj->hWriteEvent == NULL) {
+ LLOGLN(0, ("init_wait_obj: %s",GetLastError()));
+ free(obj);
+ return NULL;
+ }
+ MUTEX_INIT(obj->isSetMutex);
+ obj->isSet=FALSE;
+ return obj;
+}
+
+int
+wait_obj_free(struct wait_obj * obj)
+{
+ CloseHandle(obj->hWriteEvent);
+ LLOGLN(0, ("wait obj freed"));
+ return 0;
+}
+
+int
+wait_obj_is_set(struct wait_obj * obj)
+{
+ int ret;
+ //printf("wait_obj_is_set -s\n");
+ MUTEX_LOCK(obj->isSetMutex);
+ ret=obj->isSet;
+ MUTEX_UNLOCK(obj->isSetMutex);
+ //printf("wait_obj_is_set -e\n");
+ return (ret>0);
+}
+
+int
+wait_obj_set(struct wait_obj * obj)
+{
+ //printf("wait_obj_set -s\n");
+ if (wait_obj_is_set(obj))
+ {
+ //printf("wait_obj_is_set_fast_path -e\n");
+ return 0;
+ }
+ if ( !SetEvent(obj->hWriteEvent) )
+ {
+ LLOGLN(0, ("wait_obj_set:%s", GetLastError()));
+ return 1;
+ }
+ //printf("wait_obj_set -e\n");
+ return 0;
+}
+
+int
+wait_obj_clear(struct wait_obj * obj)
+{
+ //printf("wait_obj_clear -s\n");
+ MUTEX_LOCK(obj->isSetMutex);
+ obj->isSet--;
+ MUTEX_UNLOCK(obj->isSetMutex);
+ //printf("wait_obj_clear -e\n");
+ if ( !ResetEvent(obj->hWriteEvent) )
+ {
+ LLOGLN(0, ("wait_obj_clear:%s", GetLastError()));
+ return 1;
+ }
+ return 0;
+}
+
+int
+wait_obj_select(struct wait_obj ** listobj, unsigned int numobj, int * listr,
int numr,
+ int timeout)
+{
+ DWORD i;
+ DWORD dwEvent;
+ HANDLE hEvents[5]; // 5 is enough for everything
+
+ //printf("wait_obj_select -s\n");
+ assert(numobj <= sizeof(hEvents));
+ for(i=0;i<numobj;i++) {
+ hEvents[i]=listobj[i]->hWriteEvent;
+ }
+ //printf("wait_obj_select: going wait -s\n");
+ dwEvent = WaitForMultipleObjects(
+ numobj, // number of objects in array
+ hEvents, // array of objects
+ FALSE, // wait for any object
+ INFINITE); // millisecond or INFINITE
+ //printf("wait_obj_select: end wait -e\n");
+ for(i=0;i<numobj;i++) {
+ if (dwEvent == i) {
+ MUTEX_LOCK(listobj[i]->isSetMutex);
+ listobj[i]->isSet++;
+ MUTEX_UNLOCK(listobj[i]->isSetMutex);
+ //printf("wait_obj_select: found object -e\n");
+ return i;
+ }
+ }
+ if (dwEvent == WAIT_TIMEOUT) {
+ //printf("wait_obj_select: timeout -e\n");
+ return 0;
+ }
+ LLOGLN(0, ("wait_obj_select:%s", GetLastError()));
+ //ASSERT(TRUE);
+ return 0;
+}
+
commit fb3f92314b1d36aadc5e30da94d74a60de5b5b64
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
make it compile (I think this path to the header is needed for double
quotes.)
diff --git a/channels/rdpdr/rdpdr_types.h b/channels/rdpdr/rdpdr_types.h
index 77cdd85..40f5744 100644
--- a/channels/rdpdr/rdpdr_types.h
+++ b/channels/rdpdr/rdpdr_types.h
@@ -24,8 +24,8 @@
#include <freerdp/types_ui.h>
#include <freerdp/vchan.h>
-#include "chan_plugin.h"
-#include "chan_stream.h"
+#include "../common/chan_plugin.h"
+#include "../common/chan_stream.h"
#define LOG_LEVEL 1
#define LLOG(_level, _args) \
commit 9812c05a461c6b31ca610334460e23cb91a61739
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
convert to DLOPEN,DLSYM and deal with the filename which is passed as
char* but needs to be unicode in windows
diff --git a/channels/rdpdr/devman.c b/channels/rdpdr/devman.c
index e882952..66e1ee9 100644
--- a/channels/rdpdr/devman.c
+++ b/channels/rdpdr/devman.c
@@ -19,12 +19,15 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include <dlfcn.h>
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-
+#ifdef HAVE_CONFIG_H
#include "config.h"
+#endif
+
+#include <freerdp/os/os.h>
#include "rdpdr_types.h"
#include "rdpdr_constants.h"
#include "devman.h"
@@ -273,10 +276,30 @@ devman_get_service_by_type(DEVMAN* devman, int type)
int
devman_load_device_service(DEVMAN* devman, char* filename)
{
- void* dl;
- char* fn;
+ DLHANDLE dl;
PDEVICE_SERVICE_ENTRY pDeviceServiceEntry = NULL;
+#ifdef _WIN32
+ /* deal with unicode here. The filename is ansi, which would not work
+ in unicode windows */
+ wchar_t* fn=NULL;
+ wchar_t* filename_w=NULL;
+ if (AnsiToUnicode(filename,&filename_w) != 0)
+ return 1;
+ if (wcschr(filename_w, PATH_SEPARATOR))
+ {
+ fn=filename_w;
+ }
+ else
+ {
+ size_t fn_len;
+ fn_len=(wcslen(PLUGIN_PATH) +
wcslen(filename_w))*sizeof(wchar_t) + 20;
+ fn = malloc(fn_len);
+ swprintf(fn,fn_len, PLUGIN_PATH L"\\%s." PLUGIN_EXT,
filename_w);
+ free(filename_w);
+ }
+#else
+ char* fn=NULL;
if (strchr(filename, '/'))
{
fn = strdup(filename);
@@ -286,9 +309,11 @@ devman_load_device_service(DEVMAN* devman, char* filename)
fn = malloc(strlen(PLUGIN_PATH) + strlen(filename) + 10);
sprintf(fn, PLUGIN_PATH "/%s.so", filename);
}
- dl = dlopen(fn, RTLD_LOCAL | RTLD_LAZY);
+#endif
+
+ dl = DLOPEN(fn);
- pDeviceServiceEntry = (PDEVICE_SERVICE_ENTRY)dlsym(dl,
"DeviceServiceEntry");
+ pDeviceServiceEntry = (PDEVICE_SERVICE_ENTRY)DLSYM(dl,
"DeviceServiceEntry");
if(pDeviceServiceEntry != NULL)
{
commit 9edce04994f1b414984641660ee781cdda77cd1a
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
C requires to have the declaration directly after a block start
(gcc complains, ms c compiler throws an error)
diff --git a/channels/rdpdr/irp_queue.c b/channels/rdpdr/irp_queue.c
index 46c917f..27ade72 100644
--- a/channels/rdpdr/irp_queue.c
+++ b/channels/rdpdr/irp_queue.c
@@ -78,11 +78,12 @@ irp_queue_push(IRPQueue * queue, IRP * irp)
void
irp_queue_pop(IRPQueue * queue)
{
+ struct irp_queue_node* dying;
if (irp_queue_empty(queue))
return;
/* IRP *taken = queue->head->irp; */
- struct irp_queue_node *dying = queue->head;
+ dying = queue->head;
queue->head = queue->head->next;
free(dying->irp);
commit b12ac7b509dd065c53d6c005f75eed2a48ac22e2
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
linux specific include ifdefed
diff --git a/channels/rdpdr/rdpdr_capabilities.c
b/channels/rdpdr/rdpdr_capabilities.c
index c9a73a6..30f9a08 100644
--- a/channels/rdpdr/rdpdr_capabilities.c
+++ b/channels/rdpdr/rdpdr_capabilities.c
@@ -20,8 +20,12 @@
*/
#include <stdio.h>
#include <stdlib.h>
+//FIXME: is this really needed here?
+#ifndef _WIN32
#include <unistd.h>
#include <sys/time.h>
+#endif
+
#include "rdpdr_types.h"
#include "rdpdr_constants.h"
commit dffbecb9ee9940de8ab3d2393fcc1c4370c94268
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
Added search path and ported the mutex to the os.h wrapper.
IRPQueue needs to be defined, thus its included
diff --git a/channels/rdpdr/rdpdr_main.h b/channels/rdpdr/rdpdr_main.h
index bccff37..b8ca630 100644
--- a/channels/rdpdr/rdpdr_main.h
+++ b/channels/rdpdr/rdpdr_main.h
@@ -22,10 +22,10 @@
#ifndef __RDPDR_MAIN_H
#define __RDPDR_MAIN_H
-#include <pthread.h>
-
+#include <freerdp/os/os.h>
#include "rdpdr_types.h"
-#include "wait_obj.h"
+#include "irp_queue.h"
+#include "../common/wait_obj.h"
struct data_in_item
{
@@ -50,7 +50,7 @@ struct rdpdr_plugin
struct data_in_item * list_head;
struct data_in_item * list_tail;
/* for locking the linked list */
- pthread_mutex_t * mutex;
+ MUTEX mutex;
int thread_status;
uint16 versionMinor;
commit b0db5e358a78dc3758bcebca74f0b65f9d7bd983
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
ported rdpdr_main.c to the windows wrapper os.h.
mostley pthread_ to the #define in os.h
shuffled around an initilization of IRP after the open bracktes
the pointer to pthread_mutex_t* is now in the header a struct,
so its no necessary anymore to allocate/free it
diff --git a/channels/rdpdr/rdpdr_main.c b/channels/rdpdr/rdpdr_main.c
index b082d52..92d51ae 100644
--- a/channels/rdpdr/rdpdr_main.c
+++ b/channels/rdpdr/rdpdr_main.c
@@ -24,10 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <sys/select.h>
+#include <freerdp/os/os.h>
#include "rdpdr_types.h"
#include "rdpdr_main.h"
@@ -37,6 +34,9 @@
#include "irp.h"
#include "irp_queue.h"
+
+
+
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
/* called by main thread
@@ -52,7 +52,7 @@ signal_data_in(rdpdrPlugin * plugin)
plugin->data_in = 0;
item->data_size = plugin->data_in_size;
plugin->data_in_size = 0;
- pthread_mutex_lock(plugin->mutex);
+ MUTEX_LOCK(plugin->mutex);
if (plugin->list_tail == 0)
{
plugin->list_head = item;
@@ -63,7 +63,7 @@ signal_data_in(rdpdrPlugin * plugin)
plugin->list_tail->next = item;
plugin->list_tail = item;
}
- pthread_mutex_unlock(plugin->mutex);
+ MUTEX_UNLOCK(plugin->mutex);
wait_obj_set(plugin->data_in_event);
}
@@ -575,11 +575,11 @@ rdpdr_process_irp(rdpdrPlugin * plugin, char* data, int
data_size)
irp.outputBufferLength = 0;
}
}
-
+
if (irp_get_event(&irp, &result) && irp.rwBlocking)
{
+ IRP* pending = 0;
LLOGLN(10, ("IRP process pending events"));
- IRP * pending = 0;
while (!irp_queue_empty(plugin->queue))
{
pending = irp_queue_first(plugin->queue);
@@ -744,11 +744,10 @@ thread_process_data(rdpdrPlugin * plugin)
break;
}
- pthread_mutex_lock(plugin->mutex);
-
+ MUTEX_LOCK(plugin->mutex);
if (plugin->list_head == 0)
{
- pthread_mutex_unlock(plugin->mutex);
+ MUTEX_UNLOCK(plugin->mutex);
break;
}
@@ -762,7 +761,7 @@ thread_process_data(rdpdrPlugin * plugin)
plugin->list_tail = 0;
}
- pthread_mutex_unlock(plugin->mutex);
+ MUTEX_UNLOCK(plugin->mutex);
if (data != 0)
{
thread_process_message(plugin, data, data_size);
@@ -867,8 +866,10 @@ OpenEventProcessReceived(uint32 openHandle, void * pData,
uint32 dataLength,
}
}
-static void
-OpenEvent(uint32 openHandle, uint32 event, void * pData, uint32 dataLength,
+
+/* OpenEvent without an underscore is defined in windows "winbase.h" */
+static void VCHAN_CC
+_OpenEvent(uint32 openHandle, uint32 event, void * pData, uint32 dataLength,
uint32 totalLength, uint32 dataFlags)
{
LLOGLN(10, ("OpenEvent: event %d", event));
@@ -889,7 +890,7 @@ InitEventProcessConnected(void * pInitHandle, void * pData,
uint32 dataLength)
{
rdpdrPlugin * plugin;
uint32 error;
- pthread_t thread;
+ THREAD thread;
plugin = (rdpdrPlugin *) chan_plugin_find_by_init_handle(pInitHandle);
if (plugin == NULL)
@@ -898,15 +899,16 @@ InitEventProcessConnected(void * pInitHandle, void *
pData, uint32 dataLength)
}
error = plugin->ep.pVirtualChannelOpen(pInitHandle,
&(plugin->open_handle),
- plugin->channel_def.name, OpenEvent);
+ plugin->channel_def.name, _OpenEvent);
if (error != CHANNEL_RC_OK)
{
LLOGLN(0, ("InitEventProcessConnected: Open failed"));
}
chan_plugin_register_open_handle((rdpChanPlugin *) plugin,
plugin->open_handle);
- pthread_create(&thread, 0, thread_func, plugin);
- pthread_detach(thread);
+ THREAD_CREATE(thread, 0, thread_func, plugin);
+ THREAD_DETACH(thread);
+
}
static void
@@ -928,13 +930,18 @@ InitEventProcessTerminated(void * pInitHandle)
while ((plugin->thread_status > 0) && (index < 100))
{
index++;
- usleep(250 * 1000);
+//FIXME: Linux sleep here?
+#ifdef _WIN32
+ Sleep(250);
+#else
+ usleep(250 * 1000);
+#endif
}
wait_obj_free(plugin->term_event);
wait_obj_free(plugin->data_in_event);
- pthread_mutex_destroy(plugin->mutex);
- free(plugin->mutex);
-
+ // freeing the mutex is not necessary, because its not a pointer
(anymore)
+ MUTEX_DESTROY(plugin->mutex);
+
/* free the un-processed in/out queue */
while (plugin->list_head != 0)
{
@@ -949,7 +956,7 @@ InitEventProcessTerminated(void * pInitHandle)
free(plugin);
}
-static void
+static void VCHAN_CC
InitEvent(void * pInitHandle, uint32 event, void * pData, uint32 dataLength)
{
LLOGLN(10, ("InitEvent: event %d", event));
@@ -966,8 +973,7 @@ InitEvent(void * pInitHandle, uint32 event, void * pData,
uint32 dataLength)
}
}
-int
-VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
+WIN32_EXPORT int VCHAN_CC VirtualChannelEntry(PCHANNEL_ENTRY_POINTS
pEntryPoints)
{
rdpdrPlugin * plugin;
void * data;
@@ -987,9 +993,8 @@ VirtualChannelEntry(PCHANNEL_ENTRY_POINTS pEntryPoints)
plugin->channel_def.options = CHANNEL_OPTION_INITIALIZED |
CHANNEL_OPTION_ENCRYPT_RDP | CHANNEL_OPTION_COMPRESS_RDP;
strcpy(plugin->channel_def.name, "rdpdr");
-
- plugin->mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
- pthread_mutex_init(plugin->mutex, 0);
+ // mutex is not a pointer anymore
+ MUTEX_INIT(plugin->mutex);
plugin->list_head = 0;
plugin->list_tail = 0;
commit 87bc48a94573fbf613c489329c472656a9b5b199
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:56 2011 +0100
-compile fix
-forward events to the chanmanager
diff --git a/win/wfreerdp/wf_win.cpp b/win/wfreerdp/wf_win.cpp
index 6f34269..b7eeef3 100644
--- a/win/wfreerdp/wf_win.cpp
+++ b/win/wfreerdp/wf_win.cpp
@@ -27,6 +27,7 @@
#include "wf_event.h"
#include "wf_color.h"
#include "wf_win.h"
+#include <freerdp/chanman.h>
extern LPCTSTR g_wnd_class_name;
extern HINSTANCE g_hInstance;
@@ -1004,7 +1005,7 @@ static void
l_ui_channel_data(struct rdp_inst * inst, int chan_id, char * data, int
data_size,
int flags, int total_size)
{
- //TODO
+ freerdp_chanman_data(inst, chan_id, data, data_size, flags, total_size);
}
static int
commit 92efacca200cd2bb09b3aec6617c8dd59b8f632e
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
make it compile
diff --git a/win/wfreerdp/wf_win.h b/win/wfreerdp/wf_win.h
index b3a10d3..457f247 100644
--- a/win/wfreerdp/wf_win.h
+++ b/win/wfreerdp/wf_win.h
@@ -24,7 +24,6 @@
#ifndef __WF_WIN_H
#define __WF_WIN_H
-#include <windows.h>
#include <freerdp/freerdp.h>
int
commit 665a64e022e23332ac792d6f8097332b5db41dab
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
compile
diff --git a/win/wfreerdp/wf_event.h b/win/wfreerdp/wf_event.h
index 12b107b..d56ac89 100644
--- a/win/wfreerdp/wf_event.h
+++ b/win/wfreerdp/wf_event.h
@@ -24,7 +24,6 @@
#ifndef __WF_EVENT_H
#define __WF_EVENT_H
-#include <windows.h>
#include <freerdp/types_ui.h>
#define SET_WFI(_inst, _wfi) (_inst)->param1 = _wfi
commit 9faba0c8c82751b5210d10f5072af5243953fbc3
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
Added option parsing for plugin data
Something like this should work:
freerdp -u <username> --plugin rdpdr --data scard:scard -- <hostname>
diff --git a/win/wfreerdp/wfreerdp.cpp b/win/wfreerdp/wfreerdp.cpp
index cc0b8d2..f7b1b98 100644
--- a/win/wfreerdp/wfreerdp.cpp
+++ b/win/wfreerdp/wfreerdp.cpp
@@ -21,7 +21,6 @@
DEALINGS IN THE SOFTWARE.
*/
-#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,6 +39,7 @@
LPCTSTR g_wnd_class_name = L"wfreerdp";
HINSTANCE g_hInstance;
HCURSOR g_default_cursor;
+#define MAX_PLUGIN_DATA 20
struct thread_data
{
@@ -279,17 +279,58 @@ process_params(rdpSet * settings, rdpChanMan * chan_man,
int argc, LPWSTR * argv
settings->tls = 0;
}
#endif
- else if (wcscmp(L"-plugin", argv[*pindex]) == 0)
+
+ else if (wcscmp(L"--plugin", argv[*pindex]) == 0)
{
+ RD_PLUGIN_DATA plugin_data[MAX_PLUGIN_DATA + 1];
+ int index;
+
+
*pindex = *pindex + 1;
- if (*pindex == argc)
+ if (*pindex == argc)
{
printf("missing plugin name\n");
return 1;
}
- /* TODO: Handle --data ... -- */
- freerdp_chanman_load_plugin(chan_man, settings,
argv[*pindex], NULL);
+
+ /* Handle --data
+ TODO: fix memleak UnicodeToAnsi
+ NOTE: this is ugly code it deals with the unicode/ansi
problem
+ in win/freerdp. As everybody else I copied the source
from
+ the linux implementation and modified it so that it
acutally works
+ in windows. But I think this should be solved
+ with some generic functions and should be implemented
for all architectures
+ at some common place.
+ */
+ index = *pindex;
+ memset(plugin_data, 0, sizeof(plugin_data));
+ if (*pindex < argc - 1 && wcscmp(L"--data",
argv[*pindex + 1]) == 0)
+ {
+ int i,j;
+ *pindex = *pindex + 2;
+ i = 0;
+ while (*pindex < argc && wcscmp(L"--",
argv[*pindex]) != 0 && i < MAX_PLUGIN_DATA)
+ {
+ plugin_data[i].size =
sizeof(RD_PLUGIN_DATA);
+ for (j = 0, p = argv[*pindex]; j < 4 &&
p != NULL; j++) {
+ LPSTR ansi=NULL;
+ char* p1;
+ UnicodeToAnsi(p,&ansi);
+ plugin_data[i].data[j] =
(char*)ansi;
+ p1 =
strchr(plugin_data[i].data[j], ':');
+ p=wcschr(p,':');
+ if (p1 != NULL) {
+ *p1 = 0;
+ p++;
+ }
+ }
+ *pindex = *pindex + 1;
+ i++;
+ }
+ }
+ freerdp_chanman_load_plugin(chan_man, settings,
argv[index], plugin_data);
}
+
else if ((wcscmp(L"-h", argv[*pindex]) == 0) ||
wcscmp(L"--help", argv[*pindex]) == 0)
{
out_args();
commit 46bc565e1a8c2647d0f7cf3d703eee8d28122d54
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
make the export declaration work in windows
diff --git a/channels/rdpdr/devman.h b/channels/rdpdr/devman.h
index 04e3256..ac1f751 100644
--- a/channels/rdpdr/devman.h
+++ b/channels/rdpdr/devman.h
@@ -40,7 +40,7 @@ struct _DEVMAN_ENTRY_POINTS
typedef struct _DEVMAN_ENTRY_POINTS DEVMAN_ENTRY_POINTS;
typedef DEVMAN_ENTRY_POINTS * PDEVMAN_ENTRY_POINTS;
-typedef int (*PDEVICE_SERVICE_ENTRY)(PDEVMAN, PDEVMAN_ENTRY_POINTS);
+typedef int (VCHAN_CC *PDEVICE_SERVICE_ENTRY)(PDEVMAN, PDEVMAN_ENTRY_POINTS);
DEVMAN*
devman_new(void* data);
commit 2874e6301bfd3a78929f904391e18fd27cd5df57
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
convert plugin loader definitions to os.h wrapper
diff --git a/libfreerdpchanman/libfreerdpchanman.c
b/libfreerdpchanman/libfreerdpchanman.c
index 2ee1933..dbc7e67 100644
--- a/libfreerdpchanman/libfreerdpchanman.c
+++ b/libfreerdpchanman/libfreerdpchanman.c
@@ -643,7 +643,7 @@ freerdp_chanman_load_plugin(rdpChanMan * chan_man, rdpSet *
settings,
if (STRCHR(filename, PATH_SEPARATOR) == NULL)
{
#ifdef _WIN32
- swprintf(path, sizeof(path), L"./%s." PLUGIN_EXT, filename);
+ swprintf(path, sizeof(path), PLUGIN_PATH L"\\lib%s."
PLUGIN_EXT, filename);
#else
snprintf(path, sizeof(path), PLUGIN_PATH "/%s." PLUGIN_EXT,
filename);
#endif
commit 488df508045bb4a6d5307673fafa1bd67d0575cf
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
fix nasty compiler warning. These are not error, but they mess up the
compiler log.
diff --git a/channels/rdpdr/rdpdr_constants.h b/channels/rdpdr/rdpdr_constants.h
index 7435bb6..d4b42db 100644
--- a/channels/rdpdr/rdpdr_constants.h
+++ b/channels/rdpdr/rdpdr_constants.h
@@ -97,6 +97,7 @@
#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
/* DR_CREATE_REQ.DesiredAccess [MS-SMB2] */
+#ifndef _WIN32
#define FILE_READ_DATA 0x00000001
#define FILE_WRITE_DATA 0x00000002
#define FILE_APPEND_DATA 0x00000004
@@ -116,6 +117,7 @@
#define GENERIC_EXECUTE 0x20000000
#define GENERIC_WRITE 0x40000000
#define GENERIC_READ 0x80000000
+#endif
/* DR_CREATE_RSP.Information */
/* DR_DRIVE_CREATE_RSP.DeviceCreateResponse */
@@ -225,6 +227,7 @@
#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
/* [MS-FSCC] FSCTL Structures */
+#ifndef _WIN32
#define FSCTL_GET_REPARSE_POINT 0x900a8
#define FSCTL_GET_RETRIEVAL_POINTERS 0x90073
#define FSCTL_IS_PATHNAME_VALID 0x9002c
@@ -249,6 +252,7 @@
#define FSCTL_SET_ZERO_ON_DEALLOCATION 0x90194
#define FSCTL_SIS_COPYFILE 0x90100
#define FSCTL_WRITE_USN_CLOSE_RECORD 0x900ef
+#endif
/* [MS-FSCC] FileFsAttributeInformation.FileSystemAttributes */
#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
commit c6b6eb2fcea4a23d97b7c56147729f696c9f9e93
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
compile
diff --git a/include/freerdp/types_ui.h b/include/freerdp/types_ui.h
index 1d6e900..0281df4 100644
--- a/include/freerdp/types_ui.h
+++ b/include/freerdp/types_ui.h
@@ -27,6 +27,8 @@
#ifndef __TYPES_UI_H
#define __TYPES_UI_H
+#include <freerdp/os/os.h>
+
typedef unsigned char uint8;
typedef signed char sint8;
typedef unsigned short uint16;
@@ -98,7 +100,7 @@ RD_BRUSH;
typedef struct _RD_PLUGIN_DATA
{
uint16 size;
- void * data[4];
+ char* data[4];
}
RD_PLUGIN_DATA;
commit 974360eedf63bce5862f4e9a420be953c5c495ba
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
windows has something like perror too
diff --git a/libfreerdp/tcp.c b/libfreerdp/tcp.c
index ff9829b..9312e8a 100644
--- a/libfreerdp/tcp.c
+++ b/libfreerdp/tcp.c
@@ -41,7 +41,7 @@
#ifdef _WIN32
#define socklen_t int
#define TCP_CLOSE(_sck) closesocket(_sck)
-#define TCP_STRERROR "tcp error"
+#define TCP_STRERROR strerror(errno)
#define TCP_BLOCKS (WSAGetLastError() == WSAEWOULDBLOCK)
#define MSG_NOSIGNAL 0
#else
commit 5a24c885494516a7c9d0306f7cef07942d2943e0
Author: Martin Vogt <mvo...@gmail.com>
Date: Sat Jan 15 16:05:57 2011 +0100
librdpdr exports the function VirtualChannelEntry, which is the main entry
point if the library is loaded on runtime. Unfortunately it seems only
possible to export this function with a .def file. My tests with #ifdef
_cpluspls
and try to export it as undecorated C function seems not to work.
I think this .def file is needed, it cannot work without it.
diff --git a/win/librdpdr.def b/win/librdpdr.def
new file mode 100644
index 0000000..ee311c7
--- /dev/null
+++ b/win/librdpdr.def
@@ -0,0 +1,10 @@
+# in linux its easy to discover a function name with a call
+# to dlsym. In windows there is GetProcAddress.
+# Unfortunately GetProcAddress expects a name which reflects the name #
mangeling
+# during comile time of the dll.
+# http://blogs.msdn.com/b/oldnewthing/archive/2004/01/12/57833.aspx
+# With .def files we can export the undecorated version of a function
+# name.
+LIBRARY "librdpdr"
+EXPORTS VirtualChannelEntry
+
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Freerdp-devel mailing list
Freerdp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel