diff --git a/server/Mac/mf_peer.c b/server/Mac/mf_peer.c index 37987c6af..93ab74e6e 100644 --- a/server/Mac/mf_peer.c +++ b/server/Mac/mf_peer.c @@ -186,16 +186,13 @@ int mf_peer_context_new(freerdp_peer* client, mfPeerContext* context) context->s = Stream_New(NULL, 0xFFFF); - //#ifdef WITH_SERVER_CHANNELS context->vcm = WTSOpenServerA((LPSTR) client->context); - //#endif mf_info_peer_register(context->info, context); return 0; } - /* Called after a peer disconnects */ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context) { @@ -221,9 +218,7 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context) rdpsnd_server_context_free(context->rdpsnd); //#endif - //#ifdef WITH_SERVER_CHANNELS WTSCloseServer(context->vcm); - //#endif } } @@ -253,7 +248,6 @@ void mf_peer_init(freerdp_peer* client) } } - BOOL mf_peer_post_connect(freerdp_peer* client) { mfPeerContext* context = (mfPeerContext*) client->context; @@ -308,7 +302,6 @@ BOOL mf_peer_post_connect(freerdp_peer* client) return TRUE; } - BOOL mf_peer_activate(freerdp_peer* client) { mfPeerContext* context = (mfPeerContext*) client->context; @@ -319,21 +312,6 @@ BOOL mf_peer_activate(freerdp_peer* client) return TRUE; } -/*BOOL wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, BOOL automatic) - { - fprintf(stderr, "PeerLogon\n"); - - if (automatic) - { - _tprintf(_T("Logon: User:%s Domain:%s Password:%s\n"), - identity->User, identity->Domain, identity->Password); - } - - - wfreerdp_server_peer_callback_event(((rdpContext*) client->context)->peer->pId, WF_SRV_CALLBACK_EVENT_AUTH); - return TRUE; - }*/ - void mf_peer_synchronize_event(rdpInput* input, UINT32 flags) { fprintf(stderr, "Client sent a synchronize event (flags:0x%08X)\n", flags); @@ -408,70 +386,6 @@ void mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client) pthread_detach(th); } -/*DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam) - { - int i, fds; - int rcount; - int max_fds; - void* rfds[32]; - fd_set rfds_set; - wfPeerContext* context; - freerdp_peer* client = (freerdp_peer*) lpParam; - - ZeroMemory(rfds, sizeof(rfds)); - context = (wfPeerContext*) client->context; - - fprintf(stderr, "PeerSocketListener\n"); - - while (1) - { - rcount = 0; - - if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE) - { - fprintf(stderr, "Failed to get peer file descriptor\n"); - break; - } - - max_fds = 0; - FD_ZERO(&rfds_set); - - for (i = 0; i < rcount; i++) - { - fds = (int)(long)(rfds[i]); - - if (fds > max_fds) - max_fds = fds; - - FD_SET(fds, &rfds_set); - } - - if (max_fds == 0) - break; - - select(max_fds + 1, &rfds_set, NULL, NULL, NULL); - - SetEvent(context->socketEvent); - WaitForSingleObject(context->socketSemaphore, INFINITE); - - if (context->socketClose) - break; - } - - fprintf(stderr, "Exiting Peer Socket Listener Thread\n"); - - return 0; - } - - void wf_peer_read_settings(freerdp_peer* client) - { - if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), _T("CertificateFile"), &(client->settings->CertificateFile))) - client->settings->CertificateFile = _strdup("server.crt"); - - if (!wf_settings_read_string_ascii(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), _T("PrivateKeyFile"), &(client->settings->PrivateKeyFile))) - client->settings->PrivateKeyFile = _strdup("server.key"); - }*/ - void* mf_peer_main_loop(void* arg) { int i; @@ -528,9 +442,7 @@ void* mf_peer_main_loop(void* arg) break; } - //#ifdef WITH_SERVER_CHANNELS WTSVirtualChannelManagerGetFileDescriptor(context->vcm, rfds, &rcount); - //#endif max_fds = 0; FD_ZERO(&rfds_set); @@ -566,18 +478,17 @@ void* mf_peer_main_loop(void* arg) fprintf(stderr, "Failed to check freerdp file descriptor\n"); break; } + if ((mf_peer_check_fds(client)) != TRUE) { fprintf(stderr, "Failed to check mfreerdp file descriptor\n"); break; } - - //#ifdef WITH_SERVER_CHANNELS if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE) + { break; - //#endif - + } } fprintf(stderr, "Client %s disconnected.\n", client->local ? "(local)" : client->hostname); diff --git a/server/Mac/mfreerdp.c b/server/Mac/mfreerdp.c index e1679d36a..2ac3122a2 100644 --- a/server/Mac/mfreerdp.c +++ b/server/Mac/mfreerdp.c @@ -33,10 +33,12 @@ #include #include +#include +#include #include -//#include -//#include +#include +#include #include "mfreerdp.h" #include "mf_peer.h" @@ -107,6 +109,8 @@ int main(int argc, char* argv[]) signal(SIGPIPE, SIG_IGN); + WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi()); + instance = freerdp_listener_new(); instance->PeerAccepted = mf_peer_accepted;