From 552df0892672492054bf44ddeec9d9750f202e19 Mon Sep 17 00:00:00 2001 From: David FORT Date: Mon, 16 Mar 2015 21:29:19 +0100 Subject: [PATCH 1/2] Implement ReadFile() and WriteFile() as handle operation --- winpr/libwinpr/file/file.c | 230 ++------------------------- winpr/libwinpr/handle/handle.h | 6 + winpr/libwinpr/pipe/pipe.c | 283 ++++++++++++++++++++++++++++++--- winpr/libwinpr/pipe/pipe.h | 5 + 4 files changed, 287 insertions(+), 237 deletions(-) diff --git a/winpr/libwinpr/file/file.c b/winpr/libwinpr/file/file.c index 6edf471e5..4b545f671 100644 --- a/winpr/libwinpr/file/file.c +++ b/winpr/libwinpr/file/file.c @@ -343,11 +343,14 @@ int InstallAioSignalHandler() #endif /* HAVE_AIO_H */ + static HANDLE_OPS ops = { FileIsHandled, FileCloseHandle, FileGetFd, - NULL /* CleanupHandle */ + NULL, /* CleanupHandle */ + NamedPipeRead, + NamedPipeWrite }; HANDLE CreateFileA(LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, @@ -473,12 +476,10 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, { ULONG Type; PVOID Object; - BOOL status = TRUE; + WINPR_HANDLE *handle; if (hFile == INVALID_HANDLE_VALUE) - { return FALSE; - } /* * from http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467%28v=vs.85%29.aspx @@ -491,119 +492,11 @@ BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, if (!winpr_Handle_GetInfo(hFile, &Type, &Object)) return FALSE; - if (Type == HANDLE_TYPE_ANONYMOUS_PIPE) - { - int io_status; - WINPR_PIPE* pipe; - pipe = (WINPR_PIPE*) Object; - - do - { - io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead); - } - while ((io_status < 0) && (errno == EINTR)); - - if (io_status < 0) - { - status = FALSE; - - switch (errno) - { - case EWOULDBLOCK: - SetLastError(ERROR_NO_DATA); - break; - } - } - - if (lpNumberOfBytesRead) - *lpNumberOfBytesRead = io_status; - - return status; - } - else if (Type == HANDLE_TYPE_NAMED_PIPE) - { - int io_status; - WINPR_NAMED_PIPE* pipe; - pipe = (WINPR_NAMED_PIPE*) Object; - - if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) - { - if (pipe->clientfd == -1) - return FALSE; - - do - { - io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead); - } - while ((io_status < 0) && (errno == EINTR)); - - if (io_status == 0) - { - SetLastError(ERROR_BROKEN_PIPE); - status = FALSE; - } - else if (io_status < 0) - { - status = FALSE; - - switch (errno) - { - case EWOULDBLOCK: - SetLastError(ERROR_NO_DATA); - break; - - default: - SetLastError(ERROR_BROKEN_PIPE); - break; - } - } - - if (lpNumberOfBytesRead) - *lpNumberOfBytesRead = io_status; - } - else - { - /* Overlapped I/O */ - if (!lpOverlapped) - return FALSE; - - if (pipe->clientfd == -1) - return FALSE; - - pipe->lpOverlapped = lpOverlapped; -#ifdef HAVE_AIO_H - { - int aio_status; - struct aiocb cb; - ZeroMemory(&cb, sizeof(struct aiocb)); - cb.aio_fildes = pipe->clientfd; - cb.aio_buf = lpBuffer; - cb.aio_nbytes = nNumberOfBytesToRead; - cb.aio_offset = lpOverlapped->Offset; - cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - cb.aio_sigevent.sigev_signo = SIGIO; - cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped; - InstallAioSignalHandler(); - aio_status = aio_read(&cb); - WLog_DBG(TAG, "aio_read status: %d", aio_status); - - if (aio_status < 0) - status = FALSE; - - return status; - } -#else - /* synchronous behavior */ - lpOverlapped->Internal = 0; - lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToRead; - lpOverlapped->Pointer = (PVOID) lpBuffer; - SetEvent(lpOverlapped->hEvent); -#endif - } - - return status; - } + handle = (WINPR_HANDLE *)hFile; + if (handle->ops->ReadFile) + return handle->ops->ReadFile(Object, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped); + WLog_ERR(TAG, "ReadFile operation not implemented"); return FALSE; } @@ -624,114 +517,19 @@ BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, { ULONG Type; PVOID Object; - BOOL status = TRUE; + WINPR_HANDLE *handle; if (hFile == INVALID_HANDLE_VALUE) - { return FALSE; - } if (!winpr_Handle_GetInfo(hFile, &Type, &Object)) return FALSE; - if (Type == HANDLE_TYPE_ANONYMOUS_PIPE) - { - int io_status; - WINPR_PIPE* pipe; - pipe = (WINPR_PIPE*) Object; - - do - { - io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite); - } - while ((io_status < 0) && (errno == EINTR)); - - if ((io_status < 0) && (errno == EWOULDBLOCK)) - io_status = 0; - - *lpNumberOfBytesWritten = io_status; - return TRUE; - } - else if (Type == HANDLE_TYPE_NAMED_PIPE) - { - int io_status; - WINPR_NAMED_PIPE* pipe; - pipe = (WINPR_NAMED_PIPE*) Object; - - if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) - { - io_status = nNumberOfBytesToWrite; - - if (pipe->clientfd == -1) - return FALSE; - - do - { - io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite); - } - while ((io_status < 0) && (errno == EINTR)); - - if (io_status < 0) - { - *lpNumberOfBytesWritten = 0; - - switch (errno) - { - case EWOULDBLOCK: - io_status = 0; - status = TRUE; - break; - - default: - status = FALSE; - } - } - - *lpNumberOfBytesWritten = io_status; - return status; - } - else - { - /* Overlapped I/O */ - if (!lpOverlapped) - return FALSE; - - if (pipe->clientfd == -1) - return FALSE; - - pipe->lpOverlapped = lpOverlapped; -#ifdef HAVE_AIO_H - { - struct aiocb cb; - ZeroMemory(&cb, sizeof(struct aiocb)); - cb.aio_fildes = pipe->clientfd; - cb.aio_buf = (void*) lpBuffer; - cb.aio_nbytes = nNumberOfBytesToWrite; - cb.aio_offset = lpOverlapped->Offset; - cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; - cb.aio_sigevent.sigev_signo = SIGIO; - cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped; - InstallAioSignalHandler(); - io_status = aio_write(&cb); - WLog_DBG("aio_write status: %d", io_status); - - if (io_status < 0) - status = FALSE; - - return status; - } -#else - /* synchronous behavior */ - lpOverlapped->Internal = 1; - lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToWrite; - lpOverlapped->Pointer = (PVOID) lpBuffer; - SetEvent(lpOverlapped->hEvent); -#endif - } - - return TRUE; - } + handle = (WINPR_HANDLE *)hFile; + if (handle->ops->WriteFile) + return handle->ops->WriteFile(Object, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped); + WLog_ERR(TAG, "ReadFile operation not implemented"); return FALSE; } diff --git a/winpr/libwinpr/handle/handle.h b/winpr/libwinpr/handle/handle.h index fcb237b23..faaea58dd 100644 --- a/winpr/libwinpr/handle/handle.h +++ b/winpr/libwinpr/handle/handle.h @@ -47,6 +47,10 @@ typedef BOOL (*pcIsHandled)(HANDLE handle); typedef BOOL (*pcCloseHandle)(HANDLE handle); typedef int (*pcGetFd)(HANDLE handle); typedef DWORD (*pcCleanupHandle)(HANDLE handle); +typedef BOOL (*pcReadFile)(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); +typedef BOOL (*pcWriteFile)(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped); typedef struct _HANDLE_OPS { @@ -54,6 +58,8 @@ typedef struct _HANDLE_OPS pcCloseHandle CloseHandle; pcGetFd GetFd; pcCleanupHandle CleanupHandle; + pcReadFile ReadFile; + pcWriteFile WriteFile; } HANDLE_OPS; struct winpr_handle diff --git a/winpr/libwinpr/pipe/pipe.c b/winpr/libwinpr/pipe/pipe.c index 5fdcded8f..eea960c6d 100644 --- a/winpr/libwinpr/pipe/pipe.c +++ b/winpr/libwinpr/pipe/pipe.c @@ -36,14 +36,24 @@ #include "../handle/handle.h" +#include #include #include #include #include #include +#include #include #include +#ifdef HAVE_AIO_H +#undef HAVE_AIO_H /* disable for now, incomplete */ +#endif + +#ifdef HAVE_AIO_H +#include +#endif + #include "pipe.h" #include "../log.h" @@ -71,7 +81,6 @@ typedef struct _NamedPipeServerSocketEntry int references; } NamedPipeServerSocketEntry; -static BOOL PipeCloseHandle(HANDLE handle); static BOOL PipeIsHandled(HANDLE handle) { @@ -96,7 +105,7 @@ static int PipeGetFd(HANDLE handle) return pipe->fd; } -BOOL PipeCloseHandle(HANDLE handle) { +static BOOL PipeCloseHandle(HANDLE handle) { WINPR_PIPE* pipe = (WINPR_PIPE *)handle; if (!PipeIsHandled(handle)) @@ -112,7 +121,70 @@ BOOL PipeCloseHandle(HANDLE handle) { return TRUE; } -static BOOL NamedPipeCloseHandle(HANDLE handle); +static BOOL PipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) +{ + int io_status; + WINPR_PIPE* pipe; + BOOL status = TRUE; + + pipe = (WINPR_PIPE *)Object; + do + { + io_status = read(pipe->fd, lpBuffer, nNumberOfBytesToRead); + } + while ((io_status < 0) && (errno == EINTR)); + + if (io_status < 0) + { + status = FALSE; + + switch (errno) + { + case EWOULDBLOCK: + SetLastError(ERROR_NO_DATA); + break; + } + } + + if (lpNumberOfBytesRead) + *lpNumberOfBytesRead = io_status; + + return status; +} + +static BOOL PipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) +{ + int io_status; + WINPR_PIPE* pipe; + + pipe = (WINPR_PIPE *)Object; + + do + { + io_status = write(pipe->fd, lpBuffer, nNumberOfBytesToWrite); + } + while ((io_status < 0) && (errno == EINTR)); + + if ((io_status < 0) && (errno == EWOULDBLOCK)) + io_status = 0; + + *lpNumberOfBytesWritten = io_status; + return TRUE; +} + + +static HANDLE_OPS ops = { + PipeIsHandled, + PipeCloseHandle, + PipeGetFd, + NULL, /* CleanupHandle */ + PipeRead, + PipeWrite +}; + + static BOOL NamedPipeIsHandled(HANDLE handle) { @@ -168,6 +240,187 @@ BOOL NamedPipeCloseHandle(HANDLE handle) { return TRUE; } +BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) +{ + int io_status; + WINPR_NAMED_PIPE* pipe; + BOOL status = TRUE; + + pipe = (WINPR_NAMED_PIPE *)Object; + + if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) + { + if (pipe->clientfd == -1) + return FALSE; + + do + { + io_status = read(pipe->clientfd, lpBuffer, nNumberOfBytesToRead); + } + while ((io_status < 0) && (errno == EINTR)); + + if (io_status == 0) + { + SetLastError(ERROR_BROKEN_PIPE); + status = FALSE; + } + else if (io_status < 0) + { + status = FALSE; + + switch (errno) + { + case EWOULDBLOCK: + SetLastError(ERROR_NO_DATA); + break; + + default: + SetLastError(ERROR_BROKEN_PIPE); + break; + } + } + + if (lpNumberOfBytesRead) + *lpNumberOfBytesRead = io_status; + } + else + { + /* Overlapped I/O */ + if (!lpOverlapped) + return FALSE; + + if (pipe->clientfd == -1) + return FALSE; + + pipe->lpOverlapped = lpOverlapped; +#ifdef HAVE_AIO_H + { + int aio_status; + struct aiocb cb; + ZeroMemory(&cb, sizeof(struct aiocb)); + cb.aio_fildes = pipe->clientfd; + cb.aio_buf = lpBuffer; + cb.aio_nbytes = nNumberOfBytesToRead; + cb.aio_offset = lpOverlapped->Offset; + cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; + cb.aio_sigevent.sigev_signo = SIGIO; + cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped; + InstallAioSignalHandler(); + aio_status = aio_read(&cb); + WLog_DBG(TAG, "aio_read status: %d", aio_status); + + if (aio_status < 0) + status = FALSE; + + return status; + } +#else + /* synchronous behavior */ + lpOverlapped->Internal = 0; + lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToRead; + lpOverlapped->Pointer = (PVOID) lpBuffer; + SetEvent(lpOverlapped->hEvent); +#endif + } + + return status; +} + +BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) +{ + int io_status; + WINPR_NAMED_PIPE* pipe; + BOOL status = TRUE; + + pipe = (WINPR_NAMED_PIPE*) Object; + + if (!(pipe->dwFlagsAndAttributes & FILE_FLAG_OVERLAPPED)) + { + io_status = nNumberOfBytesToWrite; + + if (pipe->clientfd == -1) + return FALSE; + + do + { + io_status = write(pipe->clientfd, lpBuffer, nNumberOfBytesToWrite); + } + while ((io_status < 0) && (errno == EINTR)); + + if (io_status < 0) + { + *lpNumberOfBytesWritten = 0; + + switch (errno) + { + case EWOULDBLOCK: + io_status = 0; + status = TRUE; + break; + + default: + status = FALSE; + } + } + + *lpNumberOfBytesWritten = io_status; + return status; + } + else + { + /* Overlapped I/O */ + if (!lpOverlapped) + return FALSE; + + if (pipe->clientfd == -1) + return FALSE; + + pipe->lpOverlapped = lpOverlapped; +#ifdef HAVE_AIO_H + { + struct aiocb cb; + ZeroMemory(&cb, sizeof(struct aiocb)); + cb.aio_fildes = pipe->clientfd; + cb.aio_buf = (void*) lpBuffer; + cb.aio_nbytes = nNumberOfBytesToWrite; + cb.aio_offset = lpOverlapped->Offset; + cb.aio_sigevent.sigev_notify = SIGEV_SIGNAL; + cb.aio_sigevent.sigev_signo = SIGIO; + cb.aio_sigevent.sigev_value.sival_ptr = (void*) lpOverlapped; + InstallAioSignalHandler(); + io_status = aio_write(&cb); + WLog_DBG("aio_write status: %d", io_status); + + if (io_status < 0) + status = FALSE; + + return status; + } +#else + /* synchronous behavior */ + lpOverlapped->Internal = 1; + lpOverlapped->InternalHigh = (ULONG_PTR) nNumberOfBytesToWrite; + lpOverlapped->Pointer = (PVOID) lpBuffer; + SetEvent(lpOverlapped->hEvent); +#endif + } + + return TRUE; + +} + +static HANDLE_OPS namedOps = { + NamedPipeIsHandled, + NamedPipeCloseHandle, + NamedPipeGetFd, + NULL, /* CleanupHandle */ + NamedPipeRead, + NamedPipeWrite +}; + + static void InitWinPRPipeModule() { if (g_NamedPipeServerSockets) @@ -176,12 +429,6 @@ static void InitWinPRPipeModule() g_NamedPipeServerSockets = ArrayList_New(FALSE); } -static HANDLE_OPS ops = { - PipeIsHandled, - PipeCloseHandle, - PipeGetFd, - NULL /* CleanupHandle */ -}; /* @@ -273,12 +520,6 @@ static void winpr_unref_named_pipe(WINPR_NAMED_PIPE* pNamedPipe) ArrayList_Unlock(g_NamedPipeServerSockets); } -static HANDLE_OPS namedOps = { - NamedPipeIsHandled, - NamedPipeCloseHandle, - NamedPipeGetFd, - NULL /* CleanupHandle */ -}; HANDLE CreateNamedPipeA(LPCSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances, DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes) @@ -496,14 +737,14 @@ BOOL DisconnectNamedPipe(HANDLE hNamedPipe) BOOL PeekNamedPipe(HANDLE hNamedPipe, LPVOID lpBuffer, DWORD nBufferSize, LPDWORD lpBytesRead, LPDWORD lpTotalBytesAvail, LPDWORD lpBytesLeftThisMessage) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return TRUE; } BOOL TransactNamedPipe(HANDLE hNamedPipe, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize, LPDWORD lpBytesRead, LPOVERLAPPED lpOverlapped) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return TRUE; } @@ -544,7 +785,7 @@ BOOL WaitNamedPipeA(LPCSTR lpNamedPipeName, DWORD nTimeOut) BOOL WaitNamedPipeW(LPCWSTR lpNamedPipeName, DWORD nTimeOut) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return TRUE; } @@ -589,19 +830,19 @@ BOOL SetNamedPipeHandleState(HANDLE hNamedPipe, LPDWORD lpMode, LPDWORD lpMaxCol BOOL ImpersonateNamedPipeClient(HANDLE hNamedPipe) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return FALSE; } BOOL GetNamedPipeClientComputerNameA(HANDLE Pipe, LPCSTR ClientComputerName, ULONG ClientComputerNameLength) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return FALSE; } BOOL GetNamedPipeClientComputerNameW(HANDLE Pipe, LPCWSTR ClientComputerName, ULONG ClientComputerNameLength) { - WLog_ERR(TAG, "Not implemented"); + WLog_ERR(TAG, "%s: Not implemented", __FUNCTION__); return FALSE; } diff --git a/winpr/libwinpr/pipe/pipe.h b/winpr/libwinpr/pipe/pipe.h index 3084a8b48..dca562fca 100644 --- a/winpr/libwinpr/pipe/pipe.h +++ b/winpr/libwinpr/pipe/pipe.h @@ -66,6 +66,11 @@ struct winpr_named_pipe BOOL winpr_destroy_named_pipe(WINPR_NAMED_PIPE* pNamedPipe); +BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, + LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped); +BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, + LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped); + #endif #endif /* WINPR_PIPE_PRIVATE_H */ From f3d6a791e725c0479992ac70815587b01fd57461 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Tue, 17 Mar 2015 13:02:41 +0100 Subject: [PATCH 2/2] Fixed resize for software GDI. --- client/Windows/wf_client.c | 46 +++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index c11743f44..e05bb46ff 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -131,6 +131,7 @@ void wf_sw_desktop_resize(wfContext* wfc) rdpGdi* gdi; rdpContext* context; rdpSettings* settings; + freerdp *instance = wfc->instance; context = (rdpContext*) wfc; settings = wfc->instance->settings; @@ -138,13 +139,16 @@ void wf_sw_desktop_resize(wfContext* wfc) wfc->width = settings->DesktopWidth; wfc->height = settings->DesktopHeight; - gdi_resize(gdi, wfc->width, wfc->height); + gdi_free(instance); if (wfc->primary) { wf_image_free(wfc->primary); - wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, gdi->primary_buffer); + wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL); } + gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, wfc->primary->pdata); + gdi = instance->context->gdi; + wfc->hdc = gdi->primary->hdc; } void wf_hw_begin_paint(wfContext* wfc) @@ -410,7 +414,7 @@ BOOL wf_post_connect(freerdp* instance) if (settings->EmbeddedWindow) settings->Decorations = FALSE; - + if (wfc->fullscreen) dwStyle = WS_POPUP; else if (!settings->Decorations) @@ -436,13 +440,13 @@ BOOL wf_post_connect(freerdp* instance) EventArgsInit(&e, "wfreerdp"); e.embed = FALSE; e.handle = (void*) wfc->hwnd; - PubSub_OnEmbedWindow(context->pubSub, context, &e); - + PubSub_OnEmbedWindow(context->pubSub, context, &e); + ShowWindow(wfc->hwnd, SW_SHOWNORMAL); UpdateWindow(wfc->hwnd); if (settings->SoftwareGdi) - { + { instance->update->BeginPaint = (pBeginPaint) wf_sw_begin_paint; instance->update->EndPaint = (pEndPaint) wf_sw_end_paint; instance->update->DesktopResize = (pDesktopResize) wf_sw_desktop_resize; @@ -700,7 +704,7 @@ DWORD WINAPI wf_client_thread(LPVOID lpParam) } } - if (freerdp_shall_disconnect(instance)) + if (freerdp_shall_disconnect(instance)) break; quit_msg = FALSE; @@ -893,11 +897,11 @@ void wf_size_scrollbars(wfContext* wfc, UINT32 client_width, UINT32 client_heigh if (!horiz && client_width < wfc->instance->settings->DesktopWidth) { - horiz = TRUE; + horiz = TRUE; } else if (horiz && client_width >= wfc->instance->settings->DesktopWidth/* - GetSystemMetrics(SM_CXVSCROLL)*/) { - horiz = FALSE; + horiz = FALSE; } if (!vert && client_height < wfc->instance->settings->DesktopHeight) @@ -936,32 +940,32 @@ void wf_size_scrollbars(wfContext* wfc, UINT32 client_width, UINT32 client_heigh if (horiz) { - // The horizontal scrolling range is defined by - // (bitmap_width) - (client_width). The current horizontal - // scroll value remains within the horizontal scrolling range. + // The horizontal scrolling range is defined by + // (bitmap_width) - (client_width). The current horizontal + // scroll value remains within the horizontal scrolling range. wfc->xMaxScroll = MAX(wfc->instance->settings->DesktopWidth - client_width, 0); wfc->xCurrentScroll = MIN(wfc->xCurrentScroll, wfc->xMaxScroll); - si.cbSize = sizeof(si); - si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; si.nMin = wfc->xMinScroll; si.nMax = wfc->instance->settings->DesktopWidth; - si.nPage = client_width; + si.nPage = client_width; si.nPos = wfc->xCurrentScroll; SetScrollInfo(wfc->hwnd, SB_HORZ, &si, TRUE); } if (vert) { - // The vertical scrolling range is defined by - // (bitmap_height) - (client_height). The current vertical - // scroll value remains within the vertical scrolling range. + // The vertical scrolling range is defined by + // (bitmap_height) - (client_height). The current vertical + // scroll value remains within the vertical scrolling range. wfc->yMaxScroll = MAX(wfc->instance->settings->DesktopHeight - client_height, 0); wfc->yCurrentScroll = MIN(wfc->yCurrentScroll, wfc->yMaxScroll); - si.cbSize = sizeof(si); - si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; + si.cbSize = sizeof(si); + si.fMask = SIF_RANGE | SIF_PAGE | SIF_POS; si.nMin = wfc->yMinScroll; si.nMax = wfc->instance->settings->DesktopHeight; - si.nPage = client_height; + si.nPage = client_height; si.nPos = wfc->yCurrentScroll; SetScrollInfo(wfc->hwnd, SB_VERT, &si, TRUE); }