blob: 6830a0341398e64d73b6e16f1fe6092eb0d39926 [file] [log] [blame] [edit]
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/libvncclient/listen.c libvncserver-LibVNCServer-0.9.12/libvncclient/listen.c
--- libvncserver-LibVNCServer-0.9.12-orig/libvncclient/listen.c 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/libvncclient/listen.c 2019-06-14 22:07:07.537989200 +0300
@@ -30,7 +30,7 @@
#endif
#include <sys/types.h>
#ifdef WIN32
-#define close closesocket
+//#define close closesocket
#include <winsock2.h>
#else // #ifdef WIN32
#include <sys/wait.h>
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/libvncserver/main.c libvncserver-LibVNCServer-0.9.12/libvncserver/main.c
--- libvncserver-LibVNCServer-0.9.12-orig/libvncserver/main.c 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/libvncserver/main.c 2019-06-14 22:10:32.112690200 +0300
@@ -29,12 +29,15 @@
#include <sys/types.h>
#endif
-#ifndef WIN32
+#ifdef WIN32
+#include <io.h>
+#define pipe(a) _pipe((a), 0, _O_BINARY | _O_NOINHERIT)
+#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
-#include <fcntl.h>
#endif
+#include <fcntl.h>
#include <signal.h>
#include <time.h>
@@ -646,7 +649,12 @@
cl->pipe_notify_client_thread[0] = -1;
cl->pipe_notify_client_thread[1] = -1;
}
+#ifdef _WIN32
+ u_long nonblock = 1;
+ ioctlsocket(cl->pipe_notify_client_thread[0], FIONBIO, &nonblock);
+#else
fcntl(cl->pipe_notify_client_thread[0], F_SETFL, O_NONBLOCK);
+#endif
pthread_create(&cl->client_thread, NULL, clientInput, (void *)cl);
}
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/filetransfermsg.c libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/filetransfermsg.c
--- libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/filetransfermsg.c 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/filetransfermsg.c 2019-06-14 21:55:44.369914200 +0300
@@ -786,9 +786,10 @@
* Method to handle create directory request.
******************************************************************************/
-#ifdef _MSC_VER
+#ifdef _WIN32
#undef CreateDirectory /* Prevent macro clashes under Windows */
-#endif /* _MSC_VER */
+#define mkdir(path,mode) _mkdir(path)
+#endif /* _WIN32 */
void
CreateDirectory(char* dirName)
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/filetransfermsg.h libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/filetransfermsg.h
--- libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/filetransfermsg.h 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/filetransfermsg.h 2019-06-14 22:10:52.216840100 +0300
@@ -26,10 +26,10 @@
#ifndef FILE_TRANSFER_MSG_H
#define FILE_TRANSFER_MSG_H
-#ifdef _MSC_VER
+#ifdef _WIN32
#pragma push_macro("CreateDirectory")
#undef CreateDirectory /* Prevent macro clashes under Windows */
-#endif /* _MSC_VER */
+#endif /* _WIN32 */
typedef struct _FileTransferMsg {
char* data;
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c
--- libvncserver-LibVNCServer-0.9.12-orig/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/libvncserver/tightvnc-filetransfer/handlefiletransferrequest.c 2019-06-14 22:11:49.243101800 +0300
@@ -22,9 +22,12 @@
* Date : 14th July 2005
*/
-#ifndef _MSC_VER
+#ifdef _WIN32
+#include <windows.h>
+#include <shlobj.h>
+#else
#include <pwd.h>
-#endif /* _MSC_VER */
+#endif /* _WIN32*/
#include <stdio.h>
#include <stdlib.h>
@@ -60,7 +63,11 @@
void InitFileTransfer();
int SetFtpRoot(char* path);
+#ifdef _WIN32
+char* GetHomeDir();
+#else
char* GetHomeDir(uid_t uid);
+#endif
void FreeHomeDir(char *homedir);
/*
@@ -73,7 +80,9 @@
InitFileTransfer()
{
char* userHome = NULL;
+#ifndef _WIN32
uid_t uid = geteuid();
+#endif
if(fileTransferInitted)
return;
@@ -82,7 +91,11 @@
memset(ftproot, 0, sizeof(ftproot));
+#ifdef _WIN32
+ userHome = GetHomeDir();
+#else
userHome = GetHomeDir(uid);
+#endif
if((userHome != NULL) && (strlen(userHome) != 0)) {
SetFtpRoot(userHome);
@@ -157,6 +170,18 @@
* is not found or any error. The returned string must be freed by calling the
* freehomedir function.
*/
+#ifdef _WIN32
+char*
+GetHomeDir() {
+ char *homedir = NULL;
+ char path[ MAX_PATH ];
+ if (SHGetFolderPathA( NULL, CSIDL_PROFILE, NULL, 0, path ) == S_OK) {
+ homedir = strdup (path);
+ }
+
+ return homedir;
+}
+#else
char*
GetHomeDir(uid_t uid)
{
@@ -173,6 +198,7 @@
return homedir;
}
+#endif
/*
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/rfb/rfb.h libvncserver-LibVNCServer-0.9.12/rfb/rfb.h
--- libvncserver-LibVNCServer-0.9.12-orig/rfb/rfb.h 2019-01-06 22:09:30.000000000 +0300
+++ libvncserver-LibVNCServer-0.9.12/rfb/rfb.h 2019-06-14 17:05:09.465694700 +0300
@@ -54,7 +54,7 @@
#ifdef WIN32
#undef SOCKET
-typedef UINT32 in_addr_t;
+typedef uint32_t in_addr_t;
#include <winsock2.h>
#ifdef LIBVNCSERVER_HAVE_WS2TCPIP_H
#undef socklen_t
diff -Naur libvncserver-LibVNCServer-0.9.12-orig/CMakeLists.txt libvncserver-LibVNCServer-0.9.12/CMakeLists.txt
--- libvncserver-LibVNCServer-0.9.12-orig/CMakeLists.txt 2019-06-14 22:17:12.893613500 +0300
+++ libvncserver-LibVNCServer-0.9.12/CMakeLists.txt 2019-06-14 22:17:17.525878500 +0300
@@ -454,7 +454,7 @@
add_library(vncclient ${LIBVNCCLIENT_SOURCES})
add_library(vncserver ${LIBVNCSERVER_SOURCES})
if(WIN32)
- set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ws2_32)
+ set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ws2_32 shlwapi)
endif(WIN32)
target_link_libraries(vncclient