2014-09-12 19:38:12 +04:00
|
|
|
/**
|
2019-11-06 17:24:51 +03:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Client
|
|
|
|
* FreeRDP Windows Server
|
|
|
|
*
|
|
|
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
2014-09-12 19:38:12 +04:00
|
|
|
|
2022-02-16 13:20:38 +03:00
|
|
|
#include <freerdp/config.h>
|
2014-09-12 19:38:12 +04:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2015-11-05 16:02:07 +03:00
|
|
|
#include <freerdp/build-config.h>
|
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#include <winpr/tchar.h>
|
|
|
|
#include <winpr/windows.h>
|
|
|
|
|
|
|
|
#include "wf_info.h"
|
|
|
|
#include "wf_update.h"
|
|
|
|
#include "wf_mirage.h"
|
|
|
|
#include "wf_dxgi.h"
|
|
|
|
|
|
|
|
#include <freerdp/log.h>
|
|
|
|
#define TAG SERVER_TAG("windows")
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
#define SERVER_KEY "Software\\" FREERDP_VENDOR_STRING "\\" FREERDP_PRODUCT_STRING "\\Server"
|
2015-06-24 12:12:59 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
static wfInfo* wfInfoInstance = NULL;
|
|
|
|
static int _IDcount = 0;
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
BOOL wf_info_lock(wfInfo* wfi)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
DWORD dRes;
|
|
|
|
dRes = WaitForSingleObject(wfi->mutex, INFINITE);
|
|
|
|
|
|
|
|
switch (dRes)
|
|
|
|
{
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_ABANDONED:
|
|
|
|
case WAIT_OBJECT_0:
|
|
|
|
return TRUE;
|
2015-04-03 17:21:01 +03:00
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_TIMEOUT:
|
|
|
|
return FALSE;
|
2015-04-03 17:21:01 +03:00
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_FAILED:
|
|
|
|
WLog_ERR(TAG, "wf_info_lock failed with 0x%08lX", GetLastError());
|
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
BOOL wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
DWORD dRes;
|
|
|
|
dRes = WaitForSingleObject(wfi->mutex, dwMilliseconds);
|
|
|
|
|
|
|
|
switch (dRes)
|
|
|
|
{
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_ABANDONED:
|
|
|
|
case WAIT_OBJECT_0:
|
|
|
|
return TRUE;
|
2015-04-03 17:21:01 +03:00
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_TIMEOUT:
|
|
|
|
return FALSE;
|
2015-04-03 17:21:01 +03:00
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
case WAIT_FAILED:
|
|
|
|
WLog_ERR(TAG, "wf_info_try_lock failed with 0x%08lX", GetLastError());
|
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
BOOL wf_info_unlock(wfInfo* wfi)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2015-04-28 18:00:41 +03:00
|
|
|
if (!ReleaseMutex(wfi->mutex))
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "wf_info_unlock failed with 0x%08lX", GetLastError());
|
2015-04-28 18:00:41 +03:00
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
wfInfo* wf_info_init()
|
|
|
|
{
|
|
|
|
wfInfo* wfi;
|
2019-11-06 17:24:51 +03:00
|
|
|
wfi = (wfInfo*)calloc(1, sizeof(wfInfo));
|
2014-09-12 19:38:12 +04:00
|
|
|
|
|
|
|
if (wfi != NULL)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
|
|
|
LONG status;
|
|
|
|
DWORD dwType;
|
|
|
|
DWORD dwSize;
|
|
|
|
DWORD dwValue;
|
|
|
|
wfi->mutex = CreateMutex(NULL, FALSE, NULL);
|
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (wfi->mutex == NULL)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "CreateMutex error: %lu", GetLastError());
|
2015-04-03 17:21:01 +03:00
|
|
|
free(wfi);
|
|
|
|
return NULL;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
wfi->updateSemaphore = CreateSemaphore(NULL, 0, 32, NULL);
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (!wfi->updateSemaphore)
|
|
|
|
{
|
2016-12-14 00:47:08 +03:00
|
|
|
WLog_ERR(TAG, "CreateSemaphore error: %lu", GetLastError());
|
2015-04-03 17:21:01 +03:00
|
|
|
CloseHandle(wfi->mutex);
|
|
|
|
free(wfi);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
wfi->updateThread = CreateThread(NULL, 0, wf_update_thread, wfi, CREATE_SUSPENDED, NULL);
|
|
|
|
|
|
|
|
if (!wfi->updateThread)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Failed to create update thread");
|
2015-04-03 17:21:01 +03:00
|
|
|
CloseHandle(wfi->mutex);
|
|
|
|
CloseHandle(wfi->updateSemaphore);
|
|
|
|
free(wfi);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
wfi->peers =
|
|
|
|
(freerdp_peer**)calloc(FREERDP_SERVER_WIN_INFO_MAXPEERS, sizeof(freerdp_peer*));
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (!wfi->peers)
|
|
|
|
{
|
|
|
|
WLog_ERR(TAG, "Failed to allocate memory for peer");
|
|
|
|
CloseHandle(wfi->mutex);
|
|
|
|
CloseHandle(wfi->updateSemaphore);
|
|
|
|
CloseHandle(wfi->updateThread);
|
|
|
|
free(wfi);
|
|
|
|
return NULL;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
// Set FPS
|
2018-11-14 17:13:11 +03:00
|
|
|
wfi->framesPerSecond = FREERDP_SERVER_WIN_INFO_DEFAULT_FPS;
|
2019-11-06 17:24:51 +03:00
|
|
|
status =
|
|
|
|
RegOpenKeyExA(HKEY_LOCAL_MACHINE, SERVER_KEY, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
if (status == ERROR_SUCCESS)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
if (RegQueryValueEx(hKey, _T("FramesPerSecond"), NULL, &dwType, (BYTE*)&dwValue,
|
2018-11-14 17:13:11 +03:00
|
|
|
&dwSize) == ERROR_SUCCESS)
|
2015-04-03 17:21:01 +03:00
|
|
|
wfi->framesPerSecond = dwValue;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
RegCloseKey(hKey);
|
2019-11-06 17:24:51 +03:00
|
|
|
// Set input toggle
|
2014-09-12 19:38:12 +04:00
|
|
|
wfi->input_disabled = FALSE;
|
2019-11-06 17:24:51 +03:00
|
|
|
status =
|
|
|
|
RegOpenKeyExA(HKEY_LOCAL_MACHINE, SERVER_KEY, 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
if (status == ERROR_SUCCESS)
|
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
if (RegQueryValueEx(hKey, _T("DisableInput"), NULL, &dwType, (BYTE*)&dwValue,
|
2018-11-14 17:13:11 +03:00
|
|
|
&dwSize) == ERROR_SUCCESS)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
if (dwValue != 0)
|
|
|
|
wfi->input_disabled = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
return wfi;
|
|
|
|
}
|
|
|
|
|
|
|
|
wfInfo* wf_info_get_instance()
|
|
|
|
{
|
|
|
|
if (wfInfoInstance == NULL)
|
|
|
|
wfInfoInstance = wf_info_init();
|
|
|
|
|
|
|
|
return wfInfoInstance;
|
|
|
|
}
|
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
BOOL wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2022-02-17 17:31:16 +03:00
|
|
|
int peerId = 0;
|
2015-04-28 18:00:41 +03:00
|
|
|
|
|
|
|
if (!wfi || !context)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!wf_info_lock(wfi))
|
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
if (wfi->peerCount == FREERDP_SERVER_WIN_INFO_MAXPEERS)
|
2015-04-28 18:00:41 +03:00
|
|
|
goto fail_peer_count;
|
2015-04-03 17:21:01 +03:00
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
context->info = wfi;
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
if (!(context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL)))
|
|
|
|
goto fail_update_event;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
// get the offset of the top left corner of selected screen
|
2015-04-28 18:00:41 +03:00
|
|
|
EnumDisplayMonitors(NULL, NULL, wf_info_monEnumCB, 0);
|
|
|
|
_IDcount = 0;
|
2015-04-03 17:21:01 +03:00
|
|
|
#ifdef WITH_DXGI_1_2
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
if (wfi->peerCount == 0)
|
|
|
|
if (wf_dxgi_init(wfi) != 0)
|
|
|
|
goto fail_driver_init;
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#else
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-28 18:00:41 +03:00
|
|
|
if (!wf_mirror_driver_activate(wfi))
|
|
|
|
goto fail_driver_init;
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#endif
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
// look through the array of peers until an empty slot
|
2024-01-30 12:25:38 +03:00
|
|
|
for (int i = 0; i < FREERDP_SERVER_WIN_INFO_MAXPEERS; ++i)
|
2015-04-28 18:00:41 +03:00
|
|
|
{
|
2019-11-06 17:24:51 +03:00
|
|
|
// empty index will be our peer id
|
2015-04-28 18:00:41 +03:00
|
|
|
if (wfi->peers[i] == NULL)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2015-04-28 18:00:41 +03:00
|
|
|
peerId = i;
|
|
|
|
break;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
2015-04-28 18:00:41 +03:00
|
|
|
}
|
2014-09-12 19:38:12 +04:00
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
wfi->peers[peerId] = ((rdpContext*)context)->peer;
|
2015-04-28 18:00:41 +03:00
|
|
|
wfi->peers[peerId]->pId = peerId;
|
|
|
|
wfi->peerCount++;
|
|
|
|
WLog_INFO(TAG, "Registering Peer: id=%d #=%d", peerId, wfi->peerCount);
|
|
|
|
wf_info_unlock(wfi);
|
2018-11-14 17:13:11 +03:00
|
|
|
wfreerdp_server_peer_callback_event(peerId, FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT);
|
2015-04-28 18:00:41 +03:00
|
|
|
return TRUE;
|
|
|
|
fail_driver_init:
|
|
|
|
CloseHandle(context->updateEvent);
|
|
|
|
context->updateEvent = NULL;
|
|
|
|
fail_update_event:
|
|
|
|
fail_peer_count:
|
|
|
|
context->socketClose = TRUE;
|
|
|
|
wf_info_unlock(wfi);
|
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
|
|
|
|
{
|
2015-04-28 18:00:41 +03:00
|
|
|
if (wf_info_lock(wfi))
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
int peerId;
|
2019-11-06 17:24:51 +03:00
|
|
|
peerId = ((rdpContext*)context)->peer->pId;
|
2014-09-12 19:38:12 +04:00
|
|
|
wfi->peers[peerId] = NULL;
|
|
|
|
wfi->peerCount--;
|
|
|
|
CloseHandle(context->updateEvent);
|
|
|
|
WLog_INFO(TAG, "Unregistering Peer: id=%d, #=%d", peerId, wfi->peerCount);
|
|
|
|
#ifdef WITH_DXGI_1_2
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
if (wfi->peerCount == 0)
|
|
|
|
wf_dxgi_cleanup(wfi);
|
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
#endif
|
2014-09-12 19:38:12 +04:00
|
|
|
wf_info_unlock(wfi);
|
2019-11-06 17:24:51 +03:00
|
|
|
wfreerdp_server_peer_callback_event(peerId,
|
|
|
|
FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_DISCONNECT);
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL wf_info_have_updates(wfInfo* wfi)
|
|
|
|
{
|
2015-04-03 17:21:01 +03:00
|
|
|
#ifdef WITH_DXGI_1_2
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (wfi->framesWaiting == 0)
|
2014-09-12 19:38:12 +04:00
|
|
|
return FALSE;
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#else
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
if (wfi->nextUpdate == wfi->lastUpdate)
|
|
|
|
return FALSE;
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#endif
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_update_changes(wfInfo* wfi)
|
|
|
|
{
|
2015-04-03 17:21:01 +03:00
|
|
|
#ifdef WITH_DXGI_1_2
|
2014-09-12 19:38:12 +04:00
|
|
|
wf_dxgi_nextFrame(wfi, wfi->framesPerSecond * 1000);
|
|
|
|
#else
|
|
|
|
GETCHANGESBUF* buf;
|
2019-11-06 17:24:51 +03:00
|
|
|
buf = (GETCHANGESBUF*)wfi->changeBuffer;
|
2014-09-12 19:38:12 +04:00
|
|
|
wfi->nextUpdate = buf->buffer->counter;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_find_invalid_region(wfInfo* wfi)
|
|
|
|
{
|
2015-04-03 17:21:01 +03:00
|
|
|
#ifdef WITH_DXGI_1_2
|
2014-09-12 19:38:12 +04:00
|
|
|
wf_dxgi_getInvalidRegion(&wfi->invalid);
|
|
|
|
#else
|
|
|
|
GETCHANGESBUF* buf;
|
2019-11-06 17:24:51 +03:00
|
|
|
buf = (GETCHANGESBUF*)wfi->changeBuffer;
|
2014-09-12 19:38:12 +04:00
|
|
|
|
2024-02-15 15:10:45 +03:00
|
|
|
for (ULONG i = wfi->lastUpdate; i != wfi->nextUpdate; i = (i + 1) % MAXCHANGES_BUF)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
LPRECT lpR = &buf->buffer->pointrect[i].rect;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
// need to make sure we only get updates from the selected screen
|
2018-11-14 17:13:11 +03:00
|
|
|
if ((lpR->left >= wfi->servscreen_xoffset) &&
|
|
|
|
(lpR->right <= (wfi->servscreen_xoffset + wfi->servscreen_width)) &&
|
|
|
|
(lpR->top >= wfi->servscreen_yoffset) &&
|
|
|
|
(lpR->bottom <= (wfi->servscreen_yoffset + wfi->servscreen_height)))
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
UnionRect(&wfi->invalid, &wfi->invalid, lpR);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2014-09-12 19:38:12 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (wfi->invalid.left < 0)
|
|
|
|
wfi->invalid.left = 0;
|
|
|
|
|
|
|
|
if (wfi->invalid.top < 0)
|
|
|
|
wfi->invalid.top = 0;
|
|
|
|
|
|
|
|
if (wfi->invalid.right >= wfi->servscreen_width)
|
|
|
|
wfi->invalid.right = wfi->servscreen_width - 1;
|
|
|
|
|
|
|
|
if (wfi->invalid.bottom >= wfi->servscreen_height)
|
|
|
|
wfi->invalid.bottom = wfi->servscreen_height - 1;
|
|
|
|
|
2019-11-06 17:24:51 +03:00
|
|
|
// WLog_DBG(TAG, "invalid region: (%"PRId32", %"PRId32"), (%"PRId32", %"PRId32")",
|
|
|
|
// wfi->invalid.left, wfi->invalid.top, wfi->invalid.right, wfi->invalid.bottom);
|
2014-09-12 19:38:12 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_clear_invalid_region(wfInfo* wfi)
|
|
|
|
{
|
|
|
|
wfi->lastUpdate = wfi->nextUpdate;
|
|
|
|
SetRectEmpty(&wfi->invalid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_invalidate_full_screen(wfInfo* wfi)
|
|
|
|
{
|
|
|
|
SetRect(&wfi->invalid, 0, 0, wfi->servscreen_width, wfi->servscreen_height);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL wf_info_have_invalid_region(wfInfo* wfi)
|
|
|
|
{
|
|
|
|
return IsRectEmpty(&wfi->invalid);
|
|
|
|
}
|
|
|
|
|
|
|
|
void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, BYTE** pBits, int* pitch)
|
|
|
|
{
|
|
|
|
*width = (wfi->invalid.right - wfi->invalid.left);
|
|
|
|
*height = (wfi->invalid.bottom - wfi->invalid.top);
|
2015-04-03 17:21:01 +03:00
|
|
|
#ifdef WITH_DXGI_1_2
|
2014-09-12 19:38:12 +04:00
|
|
|
wf_dxgi_getPixelData(wfi, pBits, pitch, &wfi->invalid);
|
|
|
|
#else
|
|
|
|
{
|
|
|
|
long offset;
|
|
|
|
GETCHANGESBUF* changes;
|
2019-11-06 17:24:51 +03:00
|
|
|
changes = (GETCHANGESBUF*)wfi->changeBuffer;
|
2014-09-12 19:38:12 +04:00
|
|
|
*width += 1;
|
|
|
|
*height += 1;
|
|
|
|
offset = (4 * wfi->invalid.left) + (wfi->invalid.top * wfi->virtscreen_width * 4);
|
2018-11-14 17:13:11 +03:00
|
|
|
*pBits = ((BYTE*)(changes->Userbuffer)) + offset;
|
2014-09-12 19:38:12 +04:00
|
|
|
*pitch = wfi->virtscreen_width * 4;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2018-11-14 17:13:11 +03:00
|
|
|
BOOL CALLBACK wf_info_monEnumCB(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor,
|
|
|
|
LPARAM dwData)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
2018-11-14 17:13:11 +03:00
|
|
|
wfInfo* wfi;
|
2014-09-12 19:38:12 +04:00
|
|
|
wfi = wf_info_get_instance();
|
2018-11-14 17:13:11 +03:00
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (!wfi)
|
|
|
|
return FALSE;
|
2014-09-12 19:38:12 +04:00
|
|
|
|
2015-04-03 17:21:01 +03:00
|
|
|
if (_IDcount == wfi->screenID)
|
2014-09-12 19:38:12 +04:00
|
|
|
{
|
|
|
|
wfi->servscreen_xoffset = lprcMonitor->left;
|
|
|
|
wfi->servscreen_yoffset = lprcMonitor->top;
|
|
|
|
}
|
2015-04-03 17:21:01 +03:00
|
|
|
|
|
|
|
_IDcount++;
|
2014-09-12 19:38:12 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|