wfreerdp-server: Fixed screen detection issue and home directory issue

This commit is contained in:
Corey C 2013-03-21 16:31:55 -04:00
parent e1075e2b4b
commit bf7a370760
4 changed files with 45 additions and 2 deletions

View File

@ -52,6 +52,7 @@ BOOL CALLBACK moncb(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARA
int main(int argc, char* argv[])
{
BOOL screen_selected = FALSE;
int index;
wfServer* server;
@ -108,6 +109,7 @@ int main(int argc, char* argv[])
if (strcmp("--screen", argv[index]) == 0)
{
screen_selected = TRUE;
index++;
if (index == argc)
{
@ -127,6 +129,38 @@ int main(int argc, char* argv[])
}
}
if (screen_selected == FALSE)
{
_TCHAR name[128];
int width;
int height;
int bpp;
int i;
_tprintf(_T("screen id not provided. attempting to detect...\n"));
_tprintf(_T("Detecting screens...\n"));
_tprintf(_T("\nID\tResolution\t\tName (Interface)\n\n"));
for (i=0; ; i++)
{
if (get_screen_info(i, name, &width, &height, &bpp) != 0)
{
if ( (width * height * bpp) == 0 )
continue;
_tprintf(_T("%d\t%dx%dx%d\t"), i, width, height, bpp);
_tprintf(_T("%s\n"), name);
set_screen_id(i);
break;
}
else
{
break;
}
}
}
printf("Starting server\n");
wfreerdp_server_start(server);

View File

@ -50,7 +50,7 @@ int get_screen_info(int id, _TCHAR* name, int* width, int* height, int* bpp)
if (name != NULL)
_stprintf(name, _T("%s (%s)"), dd.DeviceName, dd.DeviceString);
dc = CreateDC(NULL, dd.DeviceName, NULL, NULL);
dc = CreateDC(dd.DeviceName, NULL, NULL, NULL);
*width = GetDeviceCaps(dc, HORZRES);
*height = GetDeviceCaps(dc, VERTRES);
*bpp = GetDeviceCaps(dc, BITSPIXEL);

View File

@ -186,7 +186,7 @@ BOOL wf_mirror_driver_update(wfInfo* wfi, int mode)
DEVMODE* deviceMode;
LONG disp_change_status;
DWORD dmf_devmodewext_magic_sig = 0xDF20C0DE;
if ( (mode != MIRROR_LOAD) && (mode != MIRROR_UNLOAD) )
{
printf("Invalid mirror mode!\n");

View File

@ -85,6 +85,7 @@ BOOL wf_peer_post_connect(freerdp_peer* client)
(wfi->bitsPerPixel == 0) )
{
_tprintf(_T("postconnect: error getting screen info for screen %d\n"), wfi->screenID);
_tprintf(_T("\t%dx%dx%d\n"), wfi->servscreen_height, wfi->servscreen_width, wfi->bitsPerPixel);
return FALSE;
}
@ -224,6 +225,14 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
wfPeerContext* context;
freerdp_peer* client = (freerdp_peer*) lpParam;
if (!getenv("HOME"))
{
char home[MAX_PATH * 2] = "HOME=";
strcat(home, getenv("HOMEDRIVE"));
strcat(home, getenv("HOMEPATH"));
_putenv(home);
}
wf_peer_init(client);
settings = client->settings;