コード例 #1
0
ファイル: settings.c プロジェクト: HUTTAMI/FreeRDP
rdpSettings* freerdp_settings_new(DWORD flags)
{
	rdpSettings* settings;

	settings = (rdpSettings*) malloc(sizeof(rdpSettings));

	if (settings)
	{
		ZeroMemory(settings, sizeof(rdpSettings));

		settings->ServerMode = (flags & FREERDP_SETTINGS_SERVER_MODE) ? TRUE : FALSE;

		settings->DesktopWidth = 1024;
		settings->DesktopHeight = 768;
		settings->Workarea = FALSE;
		settings->Fullscreen = FALSE;
		settings->GrabKeyboard = TRUE;
		settings->Decorations = TRUE;
		settings->RdpVersion = 7;
		settings->ColorDepth = 16;
		settings->ExtSecurity = FALSE;
		settings->NlaSecurity = TRUE;
		settings->TlsSecurity = TRUE;
		settings->RdpSecurity = TRUE;
		settings->NegotiateSecurityLayer = TRUE;
		settings->RestrictedAdminModeRequired = FALSE;
		settings->MstscCookieMode = FALSE;
		settings->CookieMaxLength = DEFAULT_COOKIE_MAX_LENGTH;
		settings->ClientBuild = 2600;
		settings->KeyboardType = 4;
		settings->KeyboardSubType = 0;
		settings->KeyboardFunctionKey = 12;
		settings->KeyboardLayout = 0;
		settings->DisableEncryption = FALSE;
		settings->SaltedChecksum = TRUE;
		settings->ServerPort = 3389;
		settings->DesktopResize = TRUE;
		settings->ToggleFullscreen = TRUE;
		settings->DesktopPosX = 0;
		settings->DesktopPosY = 0;

		settings->PerformanceFlags = PERF_FLAG_NONE;
		settings->AllowFontSmoothing = FALSE;
		settings->AllowDesktopComposition = FALSE;
		settings->DisableWallpaper = TRUE;
		settings->DisableFullWindowDrag = TRUE;
		settings->DisableMenuAnims = TRUE;
		settings->DisableThemes = FALSE;
		settings->ConnectionType = CONNECTION_TYPE_LAN;

		settings->AutoReconnectionEnabled = TRUE;

		settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
		settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;

		settings->Authentication = TRUE;
		settings->AuthenticationOnly = FALSE;
		settings->CredentialsFromStdin = FALSE;

		settings->ChannelCount = 0;
		settings->ChannelDefArraySize = 32;
		settings->ChannelDefArray = (rdpChannel*) malloc(sizeof(rdpChannel) * settings->ChannelDefArraySize);
		ZeroMemory(settings->ChannelDefArray, sizeof(rdpChannel) * settings->ChannelDefArraySize);

		settings->MonitorCount = 0;
		settings->MonitorDefArraySize = 32;
		settings->MonitorDefArray = (rdpMonitor*) malloc(sizeof(rdpMonitor) * settings->MonitorDefArraySize);
		ZeroMemory(settings->MonitorDefArray, sizeof(rdpMonitor) * settings->MonitorDefArraySize);

		settings_get_computer_name(settings);

		settings->ReceivedCapabilities = malloc(32);
		settings->OrderSupport = malloc(32);
		ZeroMemory(settings->ReceivedCapabilities, 32);
		ZeroMemory(settings->OrderSupport, 32);

		settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE;
		settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE;
		settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE;
		settings->OrderSupport[NEG_MEMBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MEM3BLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = TRUE;
		settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
		settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
		settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
		settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = TRUE;
		settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = TRUE;

		settings->ClientHostname = malloc(32);
		settings->ClientProductId = malloc(32);
		ZeroMemory(settings->ClientHostname, 32);
		ZeroMemory(settings->ClientProductId, 32);

		gethostname(settings->ClientHostname, 31);
		settings->ClientHostname[31] = 0;

		settings->ColorPointerFlag = TRUE;
		settings->LargePointerFlag = TRUE;
		settings->PointerCacheSize = 20;
		settings->SoundBeepsEnabled = TRUE;

		settings->DrawGdiPlusEnabled = FALSE;

		settings->FrameMarkerCommandEnabled = FALSE;
		settings->BitmapCacheV3Enabled = FALSE;

		settings->BitmapCacheEnabled = TRUE;
		settings->BitmapCachePersistEnabled = FALSE;
		settings->AllowCacheWaitingList = TRUE;

		settings->BitmapCacheV2NumCells = 5;
		settings->BitmapCacheV2CellInfo = (BITMAP_CACHE_V2_CELL_INFO*) malloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6);
		settings->BitmapCacheV2CellInfo[0].numEntries = 600;
		settings->BitmapCacheV2CellInfo[0].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[1].numEntries = 600;
		settings->BitmapCacheV2CellInfo[1].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[2].numEntries = 2048;
		settings->BitmapCacheV2CellInfo[2].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[3].numEntries = 4096;
		settings->BitmapCacheV2CellInfo[3].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[4].numEntries = 2048;
		settings->BitmapCacheV2CellInfo[4].persistent = FALSE;

		settings->NoBitmapCompressionHeader = TRUE;

		settings->RefreshRect = TRUE;
		settings->SuppressOutput = TRUE;

		settings->GlyphSupportLevel = GLYPH_SUPPORT_FULL;
		settings->GlyphCache = malloc(sizeof(GLYPH_CACHE_DEFINITION) * 10);
		settings->FragCache = malloc(sizeof(GLYPH_CACHE_DEFINITION));
		settings->GlyphCache[0].cacheEntries = 254;
		settings->GlyphCache[0].cacheMaximumCellSize = 4;
		settings->GlyphCache[1].cacheEntries = 254;
		settings->GlyphCache[1].cacheMaximumCellSize = 4;
		settings->GlyphCache[2].cacheEntries = 254;
		settings->GlyphCache[2].cacheMaximumCellSize = 8;
		settings->GlyphCache[3].cacheEntries = 254;
		settings->GlyphCache[3].cacheMaximumCellSize = 8;
		settings->GlyphCache[4].cacheEntries = 254;
		settings->GlyphCache[4].cacheMaximumCellSize = 16;
		settings->GlyphCache[5].cacheEntries = 254;
		settings->GlyphCache[5].cacheMaximumCellSize = 32;
		settings->GlyphCache[6].cacheEntries = 254;
		settings->GlyphCache[6].cacheMaximumCellSize = 64;
		settings->GlyphCache[7].cacheEntries = 254;
		settings->GlyphCache[7].cacheMaximumCellSize = 128;
		settings->GlyphCache[8].cacheEntries = 254;
		settings->GlyphCache[8].cacheMaximumCellSize = 256;
		settings->GlyphCache[9].cacheEntries = 64;
		settings->GlyphCache[9].cacheMaximumCellSize = 256;
		settings->FragCache->cacheEntries = 256;
		settings->FragCache->cacheMaximumCellSize = 256;

		settings->OffscreenSupportLevel = TRUE;
		settings->OffscreenCacheSize = 7680;
		settings->OffscreenCacheEntries = 2000;

		settings->DrawNineGridCacheSize = 2560;
		settings->DrawNineGridCacheEntries = 256;

		settings->ClientDir = _strdup(client_dll);

		settings->RemoteAppNumIconCaches = 3;
		settings->RemoteAppNumIconCacheEntries = 12;

		settings->VirtualChannelChunkSize = CHANNEL_CHUNK_LENGTH;

		settings->MultifragMaxRequestSize = 0xFFFF;

		settings->GatewayUseSameCredentials = TRUE;

		settings->FastPathInput = TRUE;
		settings->FastPathOutput = TRUE;

		settings->FrameAcknowledge = 2;
		settings->MouseMotion = TRUE;

		settings->AutoReconnectionEnabled = TRUE;
		settings->AutoReconnectMaxRetries = 20;

		settings->ClientAutoReconnectCookie = (ARC_CS_PRIVATE_PACKET*) malloc(sizeof(ARC_CS_PRIVATE_PACKET));
		settings->ServerAutoReconnectCookie = (ARC_SC_PRIVATE_PACKET*) malloc(sizeof(ARC_SC_PRIVATE_PACKET));
		ZeroMemory(settings->ClientAutoReconnectCookie, sizeof(ARC_CS_PRIVATE_PACKET));
		ZeroMemory(settings->ServerAutoReconnectCookie, sizeof(ARC_SC_PRIVATE_PACKET));

		settings->ClientTimeZone = (TIME_ZONE_INFO*) malloc(sizeof(TIME_ZONE_INFO));
		ZeroMemory(settings->ClientTimeZone, sizeof(TIME_ZONE_INFO));

		settings->DeviceArraySize = 16;
		settings->DeviceArray = (RDPDR_DEVICE**) malloc(sizeof(RDPDR_DEVICE*) * settings->DeviceArraySize);
		ZeroMemory(settings->DeviceArray, sizeof(RDPDR_DEVICE*) * settings->DeviceArraySize);

		settings->StaticChannelArraySize = 16;
		settings->StaticChannelArray = (ADDIN_ARGV**)
				malloc(sizeof(ADDIN_ARGV*) * settings->StaticChannelArraySize);
		ZeroMemory(settings->StaticChannelArray, sizeof(ADDIN_ARGV*) * settings->StaticChannelArraySize);

		settings->DynamicChannelArraySize = 16;
		settings->DynamicChannelArray = (ADDIN_ARGV**)
				malloc(sizeof(ADDIN_ARGV*) * settings->DynamicChannelArraySize);
		ZeroMemory(settings->DynamicChannelArray, sizeof(ADDIN_ARGV*) * settings->DynamicChannelArraySize);

		settings->HomePath = GetKnownPath(KNOWN_PATH_HOME);
		settings->ConfigPath = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME, "freerdp");

		settings_load_hkey_local_machine(settings);

		settings->SettingsModified = (BYTE*) malloc(sizeof(rdpSettings) / 8 );
		ZeroMemory(settings->SettingsModified, sizeof(rdpSettings) / 8);
	}

	return settings;
}
コード例 #2
0
ファイル: settings.c プロジェクト: BUGgs/FreeRDP
rdpSettings* freerdp_settings_new(DWORD flags)
{
	char* base;
	rdpSettings* settings;

	settings = (rdpSettings*) calloc(1, sizeof(rdpSettings));
	if (!settings)
		return NULL;

		settings->ServerMode = (flags & FREERDP_SETTINGS_SERVER_MODE) ? TRUE : FALSE;
		settings->WaitForOutputBufferFlush = TRUE;

		settings->DesktopWidth = 1024;
		settings->DesktopHeight = 768;
		settings->Workarea = FALSE;
		settings->Fullscreen = FALSE;
		settings->GrabKeyboard = TRUE;
		settings->Decorations = TRUE;
		settings->RdpVersion = 7;
		settings->ColorDepth = 16;
		settings->ExtSecurity = FALSE;
		settings->NlaSecurity = TRUE;
		settings->TlsSecurity = TRUE;
		settings->RdpSecurity = TRUE;
		settings->NegotiateSecurityLayer = TRUE;
		settings->RestrictedAdminModeRequired = FALSE;
		settings->MstscCookieMode = FALSE;
		settings->CookieMaxLength = DEFAULT_COOKIE_MAX_LENGTH;
		settings->ClientBuild = 2600;
		settings->KeyboardType = 4;
		settings->KeyboardSubType = 0;
		settings->KeyboardFunctionKey = 12;
		settings->KeyboardLayout = 0;
		settings->UseRdpSecurityLayer = FALSE;
		settings->SaltedChecksum = TRUE;
		settings->ServerPort = 3389;
		settings->GatewayPort = 443;
		settings->DesktopResize = TRUE;
		settings->ToggleFullscreen = TRUE;
		settings->DesktopPosX = 0;
		settings->DesktopPosY = 0;

		settings->PerformanceFlags = PERF_FLAG_NONE;
		settings->AllowFontSmoothing = FALSE;
		settings->AllowDesktopComposition = FALSE;
		settings->DisableWallpaper = TRUE;
		settings->DisableFullWindowDrag = TRUE;
		settings->DisableMenuAnims = TRUE;
		settings->DisableThemes = FALSE;
		settings->ConnectionType = CONNECTION_TYPE_LAN;

		settings->EncryptionMethods = ENCRYPTION_METHOD_NONE;
		settings->EncryptionLevel = ENCRYPTION_LEVEL_NONE;

		settings->CompressionEnabled = TRUE;

		if (settings->ServerMode)
				settings->CompressionLevel = PACKET_COMPR_TYPE_RDP61;
		else
				settings->CompressionLevel = PACKET_COMPR_TYPE_RDP61;

		settings->Authentication = TRUE;
		settings->AuthenticationOnly = FALSE;
		settings->CredentialsFromStdin = FALSE;
		settings->DisableCredentialsDelegation = FALSE;
		settings->AuthenticationLevel = 2;

		settings->ChannelCount = 0;
		settings->ChannelDefArraySize = 32;
		settings->ChannelDefArray = (CHANNEL_DEF*) calloc(settings->ChannelDefArraySize, sizeof(CHANNEL_DEF));
		if (!settings->ChannelDefArray)
				goto out_fail;

		settings->MonitorCount = 0;
		settings->MonitorDefArraySize = 32;
		settings->MonitorDefArray = (rdpMonitor*) calloc(settings->MonitorDefArraySize, sizeof(rdpMonitor));
		if (!settings->MonitorDefArray)
				goto out_fail;

		settings->MonitorLocalShiftX = 0;
		settings->MonitorLocalShiftY = 0;

		settings->MonitorIds = (UINT32*) calloc(16, sizeof(UINT32));
		if(!settings->MonitorIds)
				goto out_fail;

		if (!settings_get_computer_name(settings))
			goto out_fail;

		settings->ReceivedCapabilities = calloc(1, 32);
		if (!settings->ReceivedCapabilities)
				goto out_fail;

		settings->OrderSupport = calloc(1, 32);
		if (!settings->OrderSupport)
				goto out_fail;

		settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_OPAQUE_RECT_INDEX] = TRUE;
		settings->OrderSupport[NEG_DRAWNINEGRID_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIDSTBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIPATBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTISCRBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTIOPAQUERECT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MULTI_DRAWNINEGRID_INDEX] = TRUE;
		settings->OrderSupport[NEG_LINETO_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYLINE_INDEX] = TRUE;
		settings->OrderSupport[NEG_MEMBLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_MEM3BLT_INDEX] = TRUE;
		settings->OrderSupport[NEG_SAVEBITMAP_INDEX] = TRUE;
		settings->OrderSupport[NEG_GLYPH_INDEX_INDEX] = TRUE;
		settings->OrderSupport[NEG_FAST_INDEX_INDEX] = TRUE;
		settings->OrderSupport[NEG_FAST_GLYPH_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYGON_SC_INDEX] = TRUE;
		settings->OrderSupport[NEG_POLYGON_CB_INDEX] = TRUE;
		settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = TRUE;
		settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = TRUE;

		settings->ClientProductId = calloc(1, 32);
		if (!settings->ClientProductId)
				goto out_fail;

		settings->ClientHostname = calloc(1, 32);
		if (!settings->ClientHostname)
				goto out_fail;
		gethostname(settings->ClientHostname, 31);
		settings->ClientHostname[31] = 0;

		settings->ColorPointerFlag = TRUE;
		settings->LargePointerFlag = TRUE;
		settings->PointerCacheSize = 20;
		settings->SoundBeepsEnabled = TRUE;

		settings->DrawGdiPlusEnabled = FALSE;

		settings->DrawAllowSkipAlpha = TRUE;
		settings->DrawAllowColorSubsampling = FALSE;
		settings->DrawAllowDynamicColorFidelity = FALSE;

		settings->FrameMarkerCommandEnabled = TRUE;
		settings->SurfaceFrameMarkerEnabled = TRUE;
		settings->BitmapCacheV3Enabled = FALSE;

		settings->BitmapCacheEnabled = TRUE;
		settings->BitmapCachePersistEnabled = FALSE;
		settings->AllowCacheWaitingList = TRUE;

		settings->BitmapCacheV2NumCells = 5;
		settings->BitmapCacheV2CellInfo = (BITMAP_CACHE_V2_CELL_INFO*) malloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6);
		if (!settings->BitmapCacheV2CellInfo)
				goto out_fail;
		settings->BitmapCacheV2CellInfo[0].numEntries = 600;
		settings->BitmapCacheV2CellInfo[0].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[1].numEntries = 600;
		settings->BitmapCacheV2CellInfo[1].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[2].numEntries = 2048;
		settings->BitmapCacheV2CellInfo[2].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[3].numEntries = 4096;
		settings->BitmapCacheV2CellInfo[3].persistent = FALSE;
		settings->BitmapCacheV2CellInfo[4].numEntries = 2048;
		settings->BitmapCacheV2CellInfo[4].persistent = FALSE;

		settings->NoBitmapCompressionHeader = TRUE;

		settings->RefreshRect = TRUE;
		settings->SuppressOutput = TRUE;

		settings->GlyphSupportLevel = GLYPH_SUPPORT_FULL;
		settings->GlyphCache = malloc(sizeof(GLYPH_CACHE_DEFINITION) * 10);
		if(!settings->GlyphCache)
				goto out_fail;
		settings->FragCache = malloc(sizeof(GLYPH_CACHE_DEFINITION));
		if(!settings->FragCache)
				goto out_fail;
		settings->GlyphCache[0].cacheEntries = 254;
		settings->GlyphCache[0].cacheMaximumCellSize = 4;
		settings->GlyphCache[1].cacheEntries = 254;
		settings->GlyphCache[1].cacheMaximumCellSize = 4;
		settings->GlyphCache[2].cacheEntries = 254;
		settings->GlyphCache[2].cacheMaximumCellSize = 8;
		settings->GlyphCache[3].cacheEntries = 254;
		settings->GlyphCache[3].cacheMaximumCellSize = 8;
		settings->GlyphCache[4].cacheEntries = 254;
		settings->GlyphCache[4].cacheMaximumCellSize = 16;
		settings->GlyphCache[5].cacheEntries = 254;
		settings->GlyphCache[5].cacheMaximumCellSize = 32;
		settings->GlyphCache[6].cacheEntries = 254;
		settings->GlyphCache[6].cacheMaximumCellSize = 64;
		settings->GlyphCache[7].cacheEntries = 254;
		settings->GlyphCache[7].cacheMaximumCellSize = 128;
		settings->GlyphCache[8].cacheEntries = 254;
		settings->GlyphCache[8].cacheMaximumCellSize = 256;
		settings->GlyphCache[9].cacheEntries = 64;
		settings->GlyphCache[9].cacheMaximumCellSize = 256;
		settings->FragCache->cacheEntries = 256;
		settings->FragCache->cacheMaximumCellSize = 256;

		settings->OffscreenSupportLevel = TRUE;
		settings->OffscreenCacheSize = 7680;
		settings->OffscreenCacheEntries = 2000;

		settings->DrawNineGridCacheSize = 2560;
		settings->DrawNineGridCacheEntries = 256;

		settings->ClientDir = _strdup(client_dll);
		if (!settings->ClientDir)
				goto out_fail;

		settings->RemoteAppNumIconCaches = 3;
		settings->RemoteAppNumIconCacheEntries = 12;

		settings->VirtualChannelChunkSize = CHANNEL_CHUNK_LENGTH;

		settings->MultifragMaxRequestSize = 0xFFFF;

		settings->GatewayUseSameCredentials = FALSE;
		settings->GatewayBypassLocal = FALSE;
		settings->GatewayRpcTransport = TRUE;
		settings->GatewayHttpTransport = TRUE;
		settings->GatewayUdpTransport = TRUE;

		settings->FastPathInput = TRUE;
		settings->FastPathOutput = TRUE;

		settings->FrameAcknowledge = 2;
		settings->MouseMotion = TRUE;

		settings->NSCodecColorLossLevel = 3;
		settings->NSCodecAllowSubsampling = TRUE;
		settings->NSCodecAllowDynamicColorFidelity = TRUE;

		settings->AutoReconnectionEnabled = FALSE;
		settings->AutoReconnectMaxRetries = 20;

		settings->GfxThinClient = TRUE;
		settings->GfxSmallCache = FALSE;
		settings->GfxProgressive = FALSE;
		settings->GfxProgressiveV2 = FALSE;
		settings->GfxH264 = FALSE;

		settings->ClientAutoReconnectCookie = (ARC_CS_PRIVATE_PACKET*) calloc(1, sizeof(ARC_CS_PRIVATE_PACKET));
		if (!settings->ClientAutoReconnectCookie)
				goto out_fail;
		settings->ServerAutoReconnectCookie = (ARC_SC_PRIVATE_PACKET*) calloc(1, sizeof(ARC_SC_PRIVATE_PACKET));
		if (!settings->ServerAutoReconnectCookie)
				goto out_fail;

		settings->ClientTimeZone = (TIME_ZONE_INFO*) calloc(1,sizeof(TIME_ZONE_INFO));
		if (!settings->ClientTimeZone)
				goto out_fail;

		settings->DeviceArraySize = 16;
		settings->DeviceArray = (RDPDR_DEVICE**) calloc(1, sizeof(RDPDR_DEVICE*) * settings->DeviceArraySize);
		if (!settings->DeviceArray)
				goto out_fail;

		settings->StaticChannelArraySize = 16;
		settings->StaticChannelArray = (ADDIN_ARGV**)
						calloc(1, sizeof(ADDIN_ARGV*) * settings->StaticChannelArraySize);
		if (!settings->StaticChannelArray)
				goto out_fail;

		settings->DynamicChannelArraySize = 16;
		settings->DynamicChannelArray = (ADDIN_ARGV**)
						calloc(1, sizeof(ADDIN_ARGV*) * settings->DynamicChannelArraySize);
		if(!settings->DynamicChannelArray)
				goto out_fail;

		settings->HomePath = GetKnownPath(KNOWN_PATH_HOME);
		if (!settings->HomePath)
				goto out_fail;

		/* For default FreeRDP continue using same config directory
		 * as in old releases.
		 * Custom builds use <Vendor>/<Product> as config folder. */
		if (_stricmp(FREERDP_VENDOR_STRING, FREERDP_PRODUCT_STRING))
		{
			base = GetKnownSubPath(KNOWN_PATH_XDG_CONFIG_HOME,
					       FREERDP_VENDOR_STRING);
			if (base)
			{
				settings->ConfigPath = GetCombinedPath(
							       base,
							       FREERDP_PRODUCT_STRING);
			}
			free (base);
		} else {
			int i;
			char product[sizeof(FREERDP_PRODUCT_STRING)];

			memset(product, 0, sizeof(product));
			for (i=0; i<sizeof(product); i++)
				product[i] = tolower(FREERDP_PRODUCT_STRING[i]);

			settings->ConfigPath = GetKnownSubPath(
						       KNOWN_PATH_XDG_CONFIG_HOME,
						       product);
		}

		if (!settings->ConfigPath)
				goto out_fail;

		settings_load_hkey_local_machine(settings);

		settings->SettingsModified = (BYTE*) calloc(1, sizeof(rdpSettings) / 8 );
		if(!settings->SettingsModified)
				goto out_fail;

	return settings;

out_fail:
    free(settings->HomePath);
    free(settings->ConfigPath);
    free(settings->DynamicChannelArray);
    free(settings->StaticChannelArray);
    free(settings->DeviceArray);
    free(settings->ClientTimeZone);
    free(settings->ServerAutoReconnectCookie);
    free(settings->ClientAutoReconnectCookie);
    free(settings->ClientDir);
    free(settings->FragCache);
    free(settings->GlyphCache);
    free(settings->BitmapCacheV2CellInfo);
    free(settings->ClientProductId);
    free(settings->ClientHostname);
    free(settings->OrderSupport);
    free(settings->ReceivedCapabilities);
    free(settings->ComputerName);
    free(settings->MonitorIds);
    free(settings->MonitorDefArray);
    free(settings->ChannelDefArray);
    free(settings);
    return NULL;
}
コード例 #3
0
ファイル: settings.c プロジェクト: celsius/FreeRDP
rdpSettings* settings_new(void* instance)
{
	rdpSettings* settings;

	settings = (rdpSettings*) xzalloc(sizeof(rdpSettings));

	if (settings != NULL)
	{
		settings->instance = instance;

		settings->width = 1024;
		settings->height = 768;
		settings->workarea = false;
		settings->fullscreen = false;
		settings->grab_keyboard = true;
		settings->decorations = true;
		settings->rdp_version = 7;
		settings->color_depth = 16;
		settings->nla_security = true;
		settings->tls_security = true;
		settings->rdp_security = true;
		settings->client_build = 2600;
		settings->kbd_type = 4; /* @msdn{cc240510} 'IBM enhanced (101- or 102-key) keyboard' */
		settings->kbd_subtype = 0;
		settings->kbd_fn_keys = 12;
		settings->kbd_layout = 0;
		settings->encryption = false;
		settings->salted_checksum = true;
		settings->port = 3389;
		settings->desktop_resize = true;

		settings->performance_flags =
				PERF_DISABLE_FULLWINDOWDRAG |
				PERF_DISABLE_MENUANIMATIONS |
				PERF_DISABLE_WALLPAPER;

		settings->auto_reconnection = true;

		settings->encryption_method = ENCRYPTION_METHOD_NONE;
		settings->encryption_level = ENCRYPTION_LEVEL_NONE;

		settings->authentication = true;
		settings->authentication_only = false;
		settings->from_stdin = false;

		settings->received_caps = xzalloc(32);
		settings->order_support = xzalloc(32);

		settings->order_support[NEG_DSTBLT_INDEX] = true;
		settings->order_support[NEG_PATBLT_INDEX] = true;
		settings->order_support[NEG_SCRBLT_INDEX] = true;
		settings->order_support[NEG_OPAQUE_RECT_INDEX] = true;
		settings->order_support[NEG_DRAWNINEGRID_INDEX] = true;
		settings->order_support[NEG_MULTIDSTBLT_INDEX] = true;
		settings->order_support[NEG_MULTIPATBLT_INDEX] = true;
		settings->order_support[NEG_MULTISCRBLT_INDEX] = true;
		settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true;
		settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = true;
		settings->order_support[NEG_LINETO_INDEX] = true;
		settings->order_support[NEG_POLYLINE_INDEX] = true;
		settings->order_support[NEG_MEMBLT_INDEX] = true;
		settings->order_support[NEG_MEM3BLT_INDEX] = true;
		settings->order_support[NEG_SAVEBITMAP_INDEX] = true;
		settings->order_support[NEG_GLYPH_INDEX_INDEX] = true;
		settings->order_support[NEG_FAST_INDEX_INDEX] = true;
		settings->order_support[NEG_FAST_GLYPH_INDEX] = true;
		settings->order_support[NEG_POLYGON_SC_INDEX] = true;
		settings->order_support[NEG_POLYGON_CB_INDEX] = true;
		settings->order_support[NEG_ELLIPSE_SC_INDEX] = true;
		settings->order_support[NEG_ELLIPSE_CB_INDEX] = true;

		settings->client_hostname = xzalloc(32);
		settings->client_product_id = xzalloc(32);

		settings->color_pointer = true;
		settings->large_pointer = true;
		settings->pointer_cache_size = 20;
		settings->sound_beeps = true;
		settings->disable_wallpaper = false;
		settings->disable_full_window_drag = false;
		settings->disable_menu_animations = false;
		settings->disable_theming = false;
		settings->connection_type = 0;

		settings->draw_gdi_plus = false;

		settings->frame_marker = false;
		settings->bitmap_cache_v3 = false;

		settings->bitmap_cache = true;
		settings->persistent_bitmap_cache = false;
		settings->bitmapCacheV2CellInfo = xzalloc(sizeof(BITMAP_CACHE_V2_CELL_INFO) * 6);

		settings->refresh_rect = true;
		settings->suppress_output = true;

		settings->glyph_cache = true;
		settings->glyphSupportLevel = GLYPH_SUPPORT_NONE;
		settings->glyphCache = xzalloc(sizeof(GLYPH_CACHE_DEFINITION) * 10);
		settings->fragCache = xnew(GLYPH_CACHE_DEFINITION);
		settings->glyphCache[0].cacheEntries = 254;
		settings->glyphCache[0].cacheMaximumCellSize = 4;
		settings->glyphCache[1].cacheEntries = 254;
		settings->glyphCache[1].cacheMaximumCellSize = 4;
		settings->glyphCache[2].cacheEntries = 254;
		settings->glyphCache[2].cacheMaximumCellSize = 8;
		settings->glyphCache[3].cacheEntries = 254;
		settings->glyphCache[3].cacheMaximumCellSize = 8;
		settings->glyphCache[4].cacheEntries = 254;
		settings->glyphCache[4].cacheMaximumCellSize = 16;
		settings->glyphCache[5].cacheEntries = 254;
		settings->glyphCache[5].cacheMaximumCellSize = 32;
		settings->glyphCache[6].cacheEntries = 254;
		settings->glyphCache[6].cacheMaximumCellSize = 64;
		settings->glyphCache[7].cacheEntries = 254;
		settings->glyphCache[7].cacheMaximumCellSize = 128;
		settings->glyphCache[8].cacheEntries = 254;
		settings->glyphCache[8].cacheMaximumCellSize = 256;
		settings->glyphCache[9].cacheEntries = 64;
		settings->glyphCache[9].cacheMaximumCellSize = 256;
		settings->fragCache->cacheEntries = 256;
		settings->fragCache->cacheMaximumCellSize = 256;

		settings->offscreen_bitmap_cache = true;
		settings->offscreen_bitmap_cache_size = 7680;
		settings->offscreen_bitmap_cache_entries = 100;

		settings->draw_nine_grid_cache_size = 2560;
		settings->draw_nine_grid_cache_entries = 256;

		settings->client_dir = xstrdup(client_dll);

		settings->num_icon_caches = 3;
		settings->num_icon_cache_entries = 12;

		settings->vc_chunk_size = CHANNEL_CHUNK_LENGTH;

		settings->multifrag_max_request_size = 0x200000;

		settings->fastpath_input = true;
		settings->fastpath_output = true;

		settings->frame_acknowledge = 2;

		settings->uniconv = freerdp_uniconv_new();
		gethostname(settings->client_hostname, 31);
		settings->client_hostname[31] = 0;
		settings->mouse_motion = true;

		settings->client_auto_reconnect_cookie = xnew(ARC_CS_PRIVATE_PACKET);
		settings->server_auto_reconnect_cookie = xnew(ARC_SC_PRIVATE_PACKET);

		settings->client_time_zone = xnew(TIME_ZONE_INFO);
		settings->server_random = xnew(rdpBlob);
		settings->server_certificate = xnew(rdpBlob);

		freerdp_detect_paths(settings);

		settings_load_hkey_local_machine(settings);
	}

	return settings;
}