您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ConvertFromUnicode函数代码示例

51自学网 2021-06-01 20:13:37
  C++
这篇教程C++ ConvertFromUnicode函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ConvertFromUnicode函数的典型用法代码示例。如果您正苦于以下问题:C++ ConvertFromUnicode函数的具体用法?C++ ConvertFromUnicode怎么用?C++ ConvertFromUnicode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ConvertFromUnicode函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cliprdr_server_receive_temporary_directory

/** * Function description * * @return 0 on success, otherwise a Win32 error code */static UINT cliprdr_server_receive_temporary_directory(CliprdrServerContext* context, wStream* s, CLIPRDR_HEADER* header){	int length;	WCHAR* wszTempDir;	CLIPRDR_TEMP_DIRECTORY tempDirectory;	CliprdrServerPrivate* cliprdr = (CliprdrServerPrivate*) context->handle;	size_t slength;	UINT error = CHANNEL_RC_OK;	if ((slength = Stream_GetRemainingLength(s)) < 520)	{		WLog_ERR(TAG, "Stream_GetRemainingLength returned %d but should at least be 520", slength);		return CHANNEL_RC_NO_MEMORY;	}	wszTempDir = (WCHAR*) Stream_Pointer(s);	if (wszTempDir[260] != 0)	{		WLog_ERR(TAG, "wszTempDir[260] was not 0");		return ERROR_INVALID_DATA;	}	free(cliprdr->temporaryDirectory);	cliprdr->temporaryDirectory = NULL;	ConvertFromUnicode(CP_UTF8, 0, wszTempDir, -1,			&(cliprdr->temporaryDirectory), 0, NULL, NULL);	length = strlen(cliprdr->temporaryDirectory);	if (length > 519)		length = 519;	CopyMemory(tempDirectory.szTempDir, cliprdr->temporaryDirectory, length);	tempDirectory.szTempDir[length] = '/0';	WLog_DBG(TAG, "CliprdrTemporaryDirectory: %s", cliprdr->temporaryDirectory);	IFCALLRET(context->TempDirectory, error, context, &tempDirectory);	if (error)		WLog_ERR(TAG, "TempDirectory failed with error %lu!", error);	return error;}
开发者ID:BUGgs,项目名称:FreeRDP,代码行数:50,


示例2: remdesk_recv_ctl_remote_control_desktop_pdu

static int remdesk_recv_ctl_remote_control_desktop_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header){	int status;	int cchStringW;	WCHAR* pStringW;	UINT32 msgLength;	int cbRaConnectionStringW = 0;	WCHAR* raConnectionStringW = NULL;	REMDESK_CTL_REMOTE_CONTROL_DESKTOP_PDU pdu;	msgLength = header->DataLength - 4;	pStringW = (WCHAR*) Stream_Pointer(s);	raConnectionStringW = pStringW;	cchStringW = 0;	while ((msgLength > 0) && pStringW[cchStringW])	{		msgLength -= 2;		cchStringW++;	}	if (pStringW[cchStringW] || !cchStringW)		return -1;	cchStringW++;	cbRaConnectionStringW = cchStringW * 2;	pdu.raConnectionString = NULL;	status = ConvertFromUnicode(CP_UTF8, 0, raConnectionStringW,			cbRaConnectionStringW / 2, &pdu.raConnectionString, 0, NULL, NULL);	if (status <= 0)		return -1;	printf("RaConnectionString: %s/n",			pdu.raConnectionString);	free(pdu.raConnectionString);	remdesk_send_ctl_result_pdu(context, 0);	return 1;}
开发者ID:alexeilebedev,项目名称:FreeRDP,代码行数:45,


示例3: CreateEventW

HANDLE CreateEventW(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState,                    LPCWSTR lpName){	HANDLE handle;	char* name = NULL;	if (lpName)	{		int rc = ConvertFromUnicode(CP_UTF8, 0, lpName, -1, &name, 0, NULL, NULL);		if (rc < 0)			return NULL;	}	handle = CreateEventA(lpEventAttributes, bManualReset, bInitialState, name);	free(name);	return handle;}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:18,


示例4: cliprdr_process_short_format_names

void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT32 length, UINT16 flags){	int i;	BOOL ascii;	int num_formats;	CLIPRDR_FORMAT_NAME* format_name;	num_formats = length / 36;	if (num_formats <= 0)	{		cliprdr->format_names = NULL;		cliprdr->num_format_names = 0;		return;	}	if (num_formats * 36 != length)		DEBUG_WARN("dataLen %d not divided by 36!", length);	ascii = (flags & CB_ASCII_NAMES) ? TRUE : FALSE;	cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats);	cliprdr->num_format_names = num_formats;	for (i = 0; i < num_formats; i++)	{		format_name = &cliprdr->format_names[i];		Stream_Read_UINT32(s, format_name->id);		if (ascii)		{			format_name->name = _strdup((char*) s->pointer);			format_name->length = strlen(format_name->name);		}		else		{			format_name->name = NULL;			format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) s->pointer, 32 / 2, &format_name->name, 0, NULL, NULL);		}		Stream_Seek(s, 32);	}}
开发者ID:AhmadKabakibi,项目名称:FreeRDP,代码行数:44,


示例5: clipboard_synthesize_cf_text

static void* clipboard_synthesize_cf_text(wClipboard* clipboard, UINT32 formatId, const void* data,        UINT32* pSize){	int size;	char* pDstData = NULL;	if (formatId == CF_UNICODETEXT)	{		size_t wsize;		char* str = NULL;		if (*pSize > INT32_MAX)			return NULL;		wsize = _wcsnlen(data, (*pSize) / 2);		size = ConvertFromUnicode(CP_UTF8, 0, (LPCWSTR) data,		                          wsize, (CHAR**) &str, 0, NULL, NULL);		if (!str)			return NULL;		pDstData = ConvertLineEndingToCRLF((const char*) str, &size);		free(str);		*pSize = size;		return pDstData;	}	else if ((formatId == CF_TEXT) || (formatId == CF_OEMTEXT) ||	         (formatId == ClipboardGetFormatId(clipboard, "UTF8_STRING")) ||	         (formatId == ClipboardGetFormatId(clipboard, "text/plain")) ||	         (formatId == ClipboardGetFormatId(clipboard, "TEXT")) ||	         (formatId == ClipboardGetFormatId(clipboard, "STRING")))	{		size = (INT64) * pSize;		pDstData = ConvertLineEndingToCRLF((const char*) data, &size);		if (!pDstData)			return NULL;		*pSize = size;		return pDstData;	}	return NULL;}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:44,


示例6: parallel_process_irp_create

static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp){	char* path;	int status;	UINT32 PathLength;	stream_seek(irp->input, 28);	/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */	/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */	stream_read_UINT32(irp->input, PathLength);	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),			PathLength / 2, &path, 0, NULL, NULL);	if (status < 1)		path = (char*) calloc(1, 1);	parallel->id = irp->devman->id_sequence++;	parallel->file = open(parallel->path, O_RDWR);	if (parallel->file < 0)	{		irp->IoStatus = STATUS_ACCESS_DENIED;		parallel->id = 0;		DEBUG_WARN("failed to create %s: %s", parallel->path, strerror(errno));	}	else	{		/* all read and write operations should be non-blocking */		if (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)			DEBUG_WARN("%s fcntl %s", path, strerror(errno));		DEBUG_SVC("%s(%d) created", parallel->path, parallel->file);	}	stream_write_UINT32(irp->output, parallel->id);	stream_write_BYTE(irp->output, 0);	free(path);	irp->Complete(irp);}
开发者ID:Arkantos7,项目名称:FreeRDP,代码行数:43,


示例7: _IoCreateDeviceEx

NTSTATUS _IoCreateDeviceEx(PDRIVER_OBJECT_EX DriverObject, ULONG DeviceExtensionSize, PUNICODE_STRING DeviceName,		DEVICE_TYPE DeviceType, ULONG DeviceCharacteristics, BOOLEAN Exclusive, PDEVICE_OBJECT_EX* DeviceObject){	int status;	char* DeviceBasePath;	DEVICE_OBJECT_EX* pDeviceObjectEx;	DeviceBasePath = GetDeviceFileUnixDomainSocketBaseFilePathA();	if (!PathFileExistsA(DeviceBasePath))	{		if (!mkdir(DeviceBasePath, S_IRUSR | S_IWUSR | S_IXUSR))		{			free(DeviceBasePath);			return STATUS_ACCESS_DENIED;		}	}	pDeviceObjectEx = (DEVICE_OBJECT_EX*) malloc(sizeof(DEVICE_OBJECT_EX));	if (!pDeviceObjectEx)	{		return STATUS_NO_MEMORY;	}	ZeroMemory(pDeviceObjectEx, sizeof(DEVICE_OBJECT_EX));	ConvertFromUnicode(CP_UTF8, 0, DeviceName->Buffer, DeviceName->Length / 2, &(pDeviceObjectEx->DeviceName), 0, NULL, NULL);	pDeviceObjectEx->DeviceFileName = GetDeviceFileUnixDomainSocketFilePathA(pDeviceObjectEx->DeviceName);	if (PathFileExistsA(pDeviceObjectEx->DeviceFileName))	{		unlink(pDeviceObjectEx->DeviceFileName);	}	status = mkfifo(pDeviceObjectEx->DeviceFileName, 0666);	*((ULONG_PTR*) (DeviceObject)) = (ULONG_PTR) pDeviceObjectEx;	return STATUS_SUCCESS;}
开发者ID:AMV007,项目名称:FreeRDP,代码行数:42,


示例8: rdp_redirection_read_unicode_string

static BOOL rdp_redirection_read_unicode_string(wStream* s, char** str, size_t maxLength){	UINT32 length;	WCHAR* wstr = NULL;	if (Stream_GetRemainingLength(s) < 4)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: cannot read length");		return FALSE;	}	Stream_Read_UINT32(s, length);	if ((length % 2) || length < 2 || length > maxLength)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: invalid unicode string length: %"PRIu32"", length);		return FALSE;	}	if (Stream_GetRemainingLength(s) < length)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: insufficient stream length (%"PRIu32" bytes required)", length);		return FALSE;	}	wstr = (WCHAR*) Stream_Pointer(s);	if (wstr[length / 2 - 1])	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: unterminated unicode string");		return FALSE;	}	if (ConvertFromUnicode(CP_UTF8, 0, wstr, -1, str, 0, NULL, NULL) < 1)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: string conversion failed");		return FALSE;	}	Stream_Seek(s, length);	return TRUE;}
开发者ID:JunaidLoonat,项目名称:FreeRDP,代码行数:41,


示例9: cliprdr_process_long_format_names

void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, wStream* s, UINT32 length, UINT16 flags){	int allocated_formats = 8;	BYTE* end_mark;	CLIPRDR_FORMAT_NAME* format_name;		Stream_GetPointer(s, end_mark);	end_mark += length;			cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);	cliprdr->num_format_names = 0;	while (Stream_GetRemainingLength(s) >= 6)	{		BYTE* p;		int name_len;				if (cliprdr->num_format_names >= allocated_formats)		{			allocated_formats *= 2;			cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) realloc(cliprdr->format_names,					sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);		}				format_name = &cliprdr->format_names[cliprdr->num_format_names++];		Stream_Read_UINT32(s, format_name->id);				format_name->name = NULL;		format_name->length = 0;		for (p = Stream_Pointer(s), name_len = 0; p + 1 < end_mark; p += 2, name_len += 2)		{			if (*((unsigned short*) p) == 0)				break;		}				format_name->length = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), name_len / 2, &format_name->name, 0, NULL, NULL);		Stream_Seek(s, name_len + 2);	}}
开发者ID:AhmadKabakibi,项目名称:FreeRDP,代码行数:41,


示例10: nsMsgI18NEncodeMimePartIIStr

// MIME encoder, output string should be freed by PR_FREE// XXX : fix callers later to avoid allocation and copychar * nsMsgI18NEncodeMimePartIIStr(const char *header, bool structured, const char *charset, int32_t fieldnamelen, bool usemime) {  // No MIME, convert to the outgoing mail charset.  if (false == usemime) {    nsAutoCString convertedStr;    if (NS_SUCCEEDED(ConvertFromUnicode(charset, NS_ConvertUTF8toUTF16(header),                                        convertedStr)))      return PL_strdup(convertedStr.get());    else      return PL_strdup(header);  }  char *encodedString = nullptr;  nsresult res;  nsCOMPtr<nsIMimeConverter> converter = do_GetService(NS_MIME_CONVERTER_CONTRACTID, &res);  if (NS_SUCCEEDED(res) && nullptr != converter)    res = converter->EncodeMimePartIIStr_UTF8(nsDependentCString(header), structured, charset,      fieldnamelen, nsIMimeConverter::MIME_ENCODED_WORD_SIZE, &encodedString);  return NS_SUCCEEDED(res) ? encodedString : nullptr;}
开发者ID:aleth,项目名称:releases-comm-central,代码行数:23,


示例11: remdesk_recv_ctl_verify_password_pdu

static int remdesk_recv_ctl_verify_password_pdu(RemdeskServerContext* context, wStream* s, REMDESK_CHANNEL_HEADER* header){	int status;	int cbExpertBlobW = 0;	WCHAR* expertBlobW = NULL;	REMDESK_CTL_VERIFY_PASSWORD_PDU pdu;	if (Stream_GetRemainingLength(s) < 8)		return -1;	pdu.expertBlob = NULL;	expertBlobW = (WCHAR*) Stream_Pointer(s);	cbExpertBlobW = header->DataLength - 4;	status = ConvertFromUnicode(CP_UTF8, 0, expertBlobW, cbExpertBlobW / 2, &pdu.expertBlob, 0, NULL, NULL);	printf("ExpertBlob: %s/n", pdu.expertBlob);	remdesk_send_ctl_result_pdu(context, 0);	return 1;}
开发者ID:alexeilebedev,项目名称:FreeRDP,代码行数:22,


示例12: rdp_redirection_read_string

BOOL rdp_redirection_read_string(wStream* s, char** str){	UINT32 length;	if (Stream_GetRemainingLength(s) < 4)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: cannot read length");		return FALSE;	}	Stream_Read_UINT32(s, length);	if (Stream_GetRemainingLength(s) < length)	{		WLog_ERR(TAG,  "rdp_redirection_read_string failure: incorrect length %d", length);		return FALSE;	}	ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), length / 2, str, 0, NULL, NULL);	Stream_Seek(s, length);	return TRUE;}
开发者ID:BenoitDevolutions,项目名称:FreeRDP,代码行数:22,


示例13: drive_process_irp_query_directory

/** * Function description * * @return 0 on success, otherwise a Win32 error code */static UINT drive_process_irp_query_directory(DRIVE_DEVICE* drive, IRP* irp){	char* path = NULL;	int status;	DRIVE_FILE* file;	BYTE InitialQuery;	UINT32 PathLength;	UINT32 FsInformationClass;	Stream_Read_UINT32(irp->input, FsInformationClass);	Stream_Read_UINT8(irp->input, InitialQuery);	Stream_Read_UINT32(irp->input, PathLength);	Stream_Seek(irp->input, 23); /* Padding */	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),	                            PathLength / 2, &path, 0, NULL, NULL);	if (status < 1)		if (!(path = (char*) calloc(1, 1)))		{			WLog_ERR(TAG, "calloc failed!");			return CHANNEL_RC_NO_MEMORY;		}	file = drive_get_file_by_id(drive, irp->FileId);	if (file == NULL)	{		irp->IoStatus = STATUS_UNSUCCESSFUL;		Stream_Write_UINT32(irp->output, 0); /* Length */	}	else if (!drive_file_query_directory(file, FsInformationClass, InitialQuery,	                                     path, irp->output))	{		irp->IoStatus = STATUS_NO_MORE_FILES;	}	free(path);	return irp->Complete(irp);}
开发者ID:dcatonR1,项目名称:FreeRDP,代码行数:43,


示例14: clipboard_synthesize_utf8_string

static void* clipboard_synthesize_utf8_string(wClipboard* clipboard, UINT32 formatId,        const void* data, UINT32* pSize){	INT64 size;	char* pDstData = NULL;	if (formatId == CF_UNICODETEXT)	{		size_t wsize = _wcsnlen(data, (*pSize) / 2);		size = ConvertFromUnicode(CP_UTF8, 0, (LPWSTR) data,		                          wsize, (CHAR**) &pDstData, 0, NULL, NULL);		if (!pDstData)			return NULL;		size = ConvertLineEndingToLF(pDstData, size);		*pSize = size;		return pDstData;	}	else if ((formatId == CF_TEXT) || (formatId == CF_OEMTEXT) ||	         (formatId == ClipboardGetFormatId(clipboard, "text/plain")) ||	         (formatId == ClipboardGetFormatId(clipboard, "TEXT")) ||	         (formatId == ClipboardGetFormatId(clipboard, "STRING")))	{		size = (INT64) * pSize;		pDstData = (char*) malloc(size);		if (!pDstData)			return NULL;		CopyMemory(pDstData, data, size);		size = ConvertLineEndingToLF((char*) pDstData, size);		*pSize = size;		return pDstData;	}	return NULL;}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:38,


示例15: drive_process_irp_query_directory

static void drive_process_irp_query_directory(DRIVE_DEVICE* disk, IRP* irp){	char* path;	int status;	DRIVE_FILE* file;	BYTE InitialQuery;	UINT32 PathLength;	UINT32 FsInformationClass;	stream_read_UINT32(irp->input, FsInformationClass);	stream_read_BYTE(irp->input, InitialQuery);	stream_read_UINT32(irp->input, PathLength);	stream_seek(irp->input, 23); /* Padding */	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),			PathLength / 2, &path, 0, NULL, NULL);	if (status < 1)		path = (char*) calloc(1, 1);	file = drive_get_file_by_id(disk, irp->FileId);	if (file == NULL)	{		irp->IoStatus = STATUS_UNSUCCESSFUL;		stream_write_UINT32(irp->output, 0); /* Length */		DEBUG_WARN("FileId %d not valid.", irp->FileId);	}	else if (!drive_file_query_directory(file, FsInformationClass, InitialQuery, path, irp->output))	{		irp->IoStatus = STATUS_NO_MORE_FILES;	}	free(path);	irp->Complete(irp);}
开发者ID:effort,项目名称:FreeRDP,代码行数:37,


示例16: ConvertToUnicode

wxArrayString HunspellInterface::GetSuggestions(const wxString& strMisspelledWord){  wxArrayString wxReturnArray;  wxReturnArray.Empty();  if (m_pHunspell)  {    char **wlst;    wxCharBuffer misspelledWordCharBuffer = ConvertToUnicode(strMisspelledWord);    if ( misspelledWordCharBuffer != NULL)    {        int ns = m_pHunspell->suggest(&wlst, misspelledWordCharBuffer);        for (int i=0; i < ns; i++)        {          wxReturnArray.Add(ConvertFromUnicode(wlst[i]));          free(wlst[i]);        }        free(wlst);    }  }  return wxReturnArray;}
开发者ID:stahta01,项目名称:EmBlocks,代码行数:24,


示例17: rail_CreateWindow

void rail_CreateWindow(rdpRail* rail, rdpWindow* window){    if (window->titleInfo.length > 0)    {        ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) window->titleInfo.string, window->titleInfo.length / 2,                           &window->title, 0, NULL, NULL);    }    else    {        window->title = (char*) malloc(sizeof("RAIL"));        memcpy(window->title, "RAIL", sizeof("RAIL"));    }    IFCALL(rail->rail_CreateWindow, rail, window);    if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)    {        IFCALL(rail->rail_SetWindowRects, rail, window);    }    if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)    {        IFCALL(rail->rail_SetWindowVisibilityRects, rail, window);    }}
开发者ID:ranjumk,项目名称:FreeRDP,代码行数:24,


示例18: rdpdr_server_receive_client_name_request

static int rdpdr_server_receive_client_name_request(RdpdrServerContext* context, wStream* s, RDPDR_HEADER* header){	UINT32 UnicodeFlag;	UINT32 ComputerNameLen;	Stream_Read_UINT32(s, UnicodeFlag); /* UnicodeFlag (4 bytes) */	Stream_Seek_UINT32(s); /* CodePage (4 bytes), MUST be set to zero */	Stream_Read_UINT32(s, ComputerNameLen); /* ComputerNameLen (4 bytes) */	/**	 * Caution: ComputerNameLen is given *bytes*,	 * not in characters, including the NULL terminator!	 */	if (context->priv->ClientComputerName)	{		free(context->priv->ClientComputerName);		context->priv->ClientComputerName = NULL;	}	if (UnicodeFlag)	{		ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s),			-1, &(context->priv->ClientComputerName), 0, NULL, NULL);	}	else	{		context->priv->ClientComputerName = _strdup((char*) Stream_Pointer(s));	}	Stream_Seek(s, ComputerNameLen);	CLOG_DBG("ClientComputerName: %s/n", context->priv->ClientComputerName);	return 0;}
开发者ID:JozLes77,项目名称:FreeRDP,代码行数:36,


示例19: wf_rail_window_common

static void wf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState){	wfRailWindow* railWindow = NULL;	wfContext* wfc = (wfContext*) context;	RailClientContext* rail = wfc->rail;	UINT32 fieldFlags = orderInfo->fieldFlags;	PrintRailWindowState(orderInfo, windowState);	if (fieldFlags & WINDOW_ORDER_STATE_NEW)	{		HANDLE hInstance;		WCHAR* titleW = NULL;		WNDCLASSEX wndClassEx;		railWindow = (wfRailWindow*) calloc(1, sizeof(wfRailWindow));		if (!railWindow)			return;		railWindow->wfc = wfc;		railWindow->dwStyle = windowState->style;		railWindow->dwStyle &= ~RAIL_DISABLED_WINDOW_STYLES;		railWindow->dwExStyle = windowState->extendedStyle;		railWindow->dwExStyle &= ~RAIL_DISABLED_EXTENDED_WINDOW_STYLES;		railWindow->x = windowState->windowOffsetX;		railWindow->y = windowState->windowOffsetY;		railWindow->width = windowState->windowWidth;		railWindow->height = windowState->windowHeight;		if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)		{			char* title = NULL;			ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,				   windowState->titleInfo.length / 2, &title, 0, NULL, NULL);			railWindow->title = title;		}		else		{			railWindow->title = _strdup("RdpRailWindow");		}		ConvertToUnicode(CP_UTF8, 0, railWindow->title, -1, &titleW, 0);		hInstance = GetModuleHandle(NULL);		ZeroMemory(&wndClassEx, sizeof(WNDCLASSEX));		wndClassEx.cbSize = sizeof(WNDCLASSEX);		wndClassEx.style = 0;		wndClassEx.lpfnWndProc = wf_RailWndProc;		wndClassEx.cbClsExtra = 0;		wndClassEx.cbWndExtra = 0;		wndClassEx.hIcon = NULL;		wndClassEx.hCursor = NULL;		wndClassEx.hbrBackground = NULL;		wndClassEx.lpszMenuName = NULL;		wndClassEx.lpszClassName = _T("RdpRailWindow");		wndClassEx.hInstance = hInstance;		wndClassEx.hIconSm = NULL;		RegisterClassEx(&wndClassEx);		railWindow->hWnd = CreateWindowExW(				railWindow->dwExStyle, /* dwExStyle */				_T("RdpRailWindow"), /* lpClassName */				titleW, /* lpWindowName */				railWindow->dwStyle, /* dwStyle */				railWindow->x, /* x */				railWindow->y, /* y */				railWindow->width, /* nWidth */				railWindow->height, /* nHeight */				NULL, /* hWndParent */				NULL, /* hMenu */				hInstance, /* hInstance */				NULL /* lpParam */				);		SetWindowLongPtr(railWindow->hWnd, GWLP_USERDATA, (LONG_PTR) railWindow);		HashTable_Add(wfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId, (void*) railWindow);		free(titleW);		UpdateWindow(railWindow->hWnd);		return;	}	else	{		railWindow = (wfRailWindow*) HashTable_GetItemValue(wfc->railWindows,			(void*) (UINT_PTR) orderInfo->windowId);	}	if (!railWindow)		return;//.........这里部分代码省略.........
开发者ID:AMV007,项目名称:FreeRDP,代码行数:101,


示例20: xf_rail_window_common

static BOOL xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState){	xfAppWindow* appWindow = NULL;	xfContext* xfc = (xfContext*) context;	UINT32 fieldFlags = orderInfo->fieldFlags;	if (fieldFlags & WINDOW_ORDER_STATE_NEW)	{		appWindow = (xfAppWindow*) calloc(1, sizeof(xfAppWindow));		if (!appWindow)			return FALSE;		appWindow->xfc = xfc;		appWindow->windowId = orderInfo->windowId;		appWindow->dwStyle = windowState->style;		appWindow->dwExStyle = windowState->extendedStyle;		appWindow->x = appWindow->windowOffsetX = windowState->windowOffsetX;		appWindow->y = appWindow->windowOffsetY = windowState->windowOffsetY;		appWindow->width = appWindow->windowWidth = windowState->windowWidth;		appWindow->height = appWindow->windowHeight = windowState->windowHeight;		appWindow->localWindowOffsetCorrX = 0;		appWindow->localWindowOffsetCorrY = 0;		if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)		{			char* title = NULL;			ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,				   windowState->titleInfo.length / 2, &title, 0, NULL, NULL);			appWindow->title = title;		}		else		{			appWindow->title = _strdup("RdpRailWindow");		}		if (!appWindow->title)		{			free(appWindow);			return FALSE;		}		HashTable_Add(xfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId, (void*) appWindow);		xf_AppWindowInit(xfc, appWindow);		return TRUE;	}	else	{		appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows,			(void*) (UINT_PTR) orderInfo->windowId);	}	if (!appWindow)		return FALSE;	/* Update Parameters */	if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||		(fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))	{		if (fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)		{			appWindow->windowOffsetX = windowState->windowOffsetX;			appWindow->windowOffsetY = windowState->windowOffsetY;			/*			 * The rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,			 * but we can only send unsigned integers to the rail server. Therefore, we maintain a local offset.			 */			if (appWindow->windowOffsetX < 0)				appWindow->localWindowOffsetCorrX = 0 - appWindow->windowOffsetX;			else				appWindow->localWindowOffsetCorrX = 0;			if (appWindow->windowOffsetY < 0)				appWindow->localWindowOffsetCorrY = 0 - appWindow->windowOffsetY;			else				appWindow->localWindowOffsetCorrY = 0;		}		if (fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)		{			appWindow->windowWidth = windowState->windowWidth;			appWindow->windowHeight = windowState->windowHeight;		}	}	if (fieldFlags & WINDOW_ORDER_FIELD_OWNER)	{		appWindow->ownerWindowId = windowState->ownerWindowId;	}	if (fieldFlags & WINDOW_ORDER_FIELD_STYLE)//.........这里部分代码省略.........
开发者ID:bceverly,项目名称:FreeRDP,代码行数:101,


示例21: PrintRailWindowState

void PrintRailWindowState(WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState){	if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_NEW)		WLog_INFO(TAG, "WindowCreate: WindowId: 0x%04X", orderInfo->windowId);	else		WLog_INFO(TAG, "WindowUpdate: WindowId: 0x%04X", orderInfo->windowId);	WLog_INFO(TAG, "{");	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER)	{		WLog_INFO(TAG, "/tOwnerWindowId: 0x%04X", windowState->ownerWindowId);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)	{		WLog_INFO(TAG, "/tStyle: 0x%04X ExtendedStyle: 0x%04X",			windowState->style, windowState->extendedStyle);				PrintWindowStyles(windowState->style);		PrintExtendedWindowStyles(windowState->extendedStyle);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW)	{		WLog_INFO(TAG, "/tShowState: %d", windowState->showState);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)	{		char* title = NULL;		ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,				   windowState->titleInfo.length / 2, &title, 0, NULL, NULL);		WLog_INFO(TAG, "/tTitleInfo: %s (length = %d)", title,			windowState->titleInfo.length);		free(title);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)	{		WLog_INFO(TAG, "/tClientOffsetX: %d ClientOffsetY: %d",			windowState->clientOffsetX, windowState->clientOffsetY);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)	{		WLog_INFO(TAG, "/tClientAreaWidth: %d ClientAreaHeight: %d",			windowState->clientAreaWidth, windowState->clientAreaHeight);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)	{		WLog_INFO(TAG, "/tRPContent: %d", windowState->RPContent);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)	{		WLog_INFO(TAG, "/tRootParentHandle: 0x%04X", windowState->rootParentHandle);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)	{		WLog_INFO(TAG, "/tWindowOffsetX: %d WindowOffsetY: %d",			windowState->windowOffsetX, windowState->windowOffsetY);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)	{		WLog_INFO(TAG, "/tWindowClientDeltaX: %d WindowClientDeltaY: %d",			windowState->windowClientDeltaX, windowState->windowClientDeltaY);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)	{		WLog_INFO(TAG, "/tWindowWidth: %d WindowHeight: %d",			windowState->windowWidth, windowState->windowHeight);	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)	{		UINT32 index;		RECTANGLE_16* rect;		WLog_INFO(TAG, "/tnumWindowRects: %d", windowState->numWindowRects);		for (index = 0; index < windowState->numWindowRects; index++)		{			rect = &windowState->windowRects[index];			WLog_INFO(TAG, "/twindowRect[%d]: left: %d top: %d right: %d bottom: %d",				index, rect->left, rect->top, rect->right, rect->bottom);		}	}	if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)	{		WLog_INFO(TAG, "/tvisibileOffsetX: %d visibleOffsetY: %d",//.........这里部分代码省略.........
开发者ID:AMV007,项目名称:FreeRDP,代码行数:101,


示例22: drive_process_irp_create

static void drive_process_irp_create(DRIVE_DEVICE* disk, IRP* irp){	char* path;	int status;	UINT32 FileId;	DRIVE_FILE* file;	BYTE Information;	UINT32 DesiredAccess;	UINT32 CreateDisposition;	UINT32 CreateOptions;	UINT32 PathLength;	stream_read_UINT32(irp->input, DesiredAccess);	stream_seek(irp->input, 16); /* AllocationSize(8), FileAttributes(4), SharedAccess(4) */	stream_read_UINT32(irp->input, CreateDisposition);	stream_read_UINT32(irp->input, CreateOptions);	stream_read_UINT32(irp->input, PathLength);	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) stream_get_tail(irp->input),			PathLength / 2, &path, 0, NULL, NULL);	if (status < 1)		path = (char*) calloc(1, 1);	FileId = irp->devman->id_sequence++;	file = drive_file_new(disk->path, path, FileId,		DesiredAccess, CreateDisposition, CreateOptions);	if (file == NULL)	{		irp->IoStatus = STATUS_UNSUCCESSFUL;		FileId = 0;		Information = 0;		DEBUG_WARN("failed to create %s.", path);	}	else if (file->err)	{		FileId = 0;		Information = 0;		/* map errno to windows result */		irp->IoStatus = drive_map_posix_err(file->err);		drive_file_free(file);	}	else	{		list_enqueue(disk->files, file);		switch (CreateDisposition)		{			case FILE_SUPERSEDE:			case FILE_OPEN:			case FILE_CREATE:			case FILE_OVERWRITE:				Information = FILE_SUPERSEDED;				break;			case FILE_OPEN_IF:				Information = FILE_OPENED;				break;			case FILE_OVERWRITE_IF:				Information = FILE_OVERWRITTEN;				break;			default:				Information = 0;				break;		}		DEBUG_SVC("%s(%d) created.", file->fullpath, file->id);	}	stream_write_UINT32(irp->output, FileId);	stream_write_BYTE(irp->output, Information);	free(path);	irp->Complete(irp);}
开发者ID:effort,项目名称:FreeRDP,代码行数:78,


示例23: NS_ASSERTION

//.........这里部分代码省略.........    // Conversion to plain text desired.    //    PRInt32       width = 72;    nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));    if (pPrefBranch)      pPrefBranch->GetIntPref("mailnews.wraplength", &width);    // Let sanity reign!    if (width == 0)      width = 72;    else if (width < 10)      width = 10;    else if (width > 30000)      width = 30000;    //    // Now use the converter service here to do the right    // thing and convert this data to plain text for us!    //    nsAutoString      conData;    if (NS_SUCCEEDED(LoadDataFromFile(mTmpFile, conData, true)))    {      if (NS_SUCCEEDED(ConvertBufToPlainText(conData, UseFormatFlowed(m_charset.get()))))      {        if (mDeleteFile)          mTmpFile->Remove(false);        nsCOMPtr<nsIOutputStream> outputStream;        nsresult rv = NS_NewLocalFileOutputStream(getter_AddRefs(outputStream), mTmpFile,  PR_WRONLY | PR_CREATE_FILE, 00600);        if (NS_SUCCEEDED(rv))        {          nsCAutoString tData;          if (NS_FAILED(ConvertFromUnicode(m_charset.get(), conData, tData)))            LossyCopyUTF16toASCII(conData, tData);          if (!tData.IsEmpty())          {            PRUint32 bytesWritten;            (void) outputStream->Write(tData.get(), tData.Length(), &bytesWritten);          }          outputStream->Close();          // this silliness is because Windows nsILocalFile caches its file size          // so if an output stream writes to it, it will still return the original          // cached size.          if (mTmpFile)          {            nsCOMPtr <nsIFile> tmpFile;            mTmpFile->Clone(getter_AddRefs(tmpFile));            mTmpFile = do_QueryInterface(tmpFile);          }        }      }    }    m_type = m_desiredType;    m_desiredType.Truncate();    m_encoding.Truncate();  }  PRUint32 pendingAttachmentCount = 0;  m_mime_delivery_state->GetPendingAttachmentCount(&pendingAttachmentCount);  NS_ASSERTION (pendingAttachmentCount > 0, "no more pending attachment");  m_mime_delivery_state->SetPendingAttachmentCount(pendingAttachmentCount - 1);
开发者ID:vanto,项目名称:comm-central,代码行数:66,


示例24: drive_process_irp_create

/** * Function description * * @return 0 on success, otherwise a Win32 error code */static UINT drive_process_irp_create(DRIVE_DEVICE* drive, IRP* irp){	int status;	void* key;	UINT32 FileId;	DRIVE_FILE* file;	BYTE Information;	UINT32 DesiredAccess;	UINT32 CreateDisposition;	UINT32 CreateOptions;	UINT32 PathLength;	char* path = NULL;	Stream_Read_UINT32(irp->input, DesiredAccess);	Stream_Seek(irp->input,	            16); /* AllocationSize(8), FileAttributes(4), SharedAccess(4) */	Stream_Read_UINT32(irp->input, CreateDisposition);	Stream_Read_UINT32(irp->input, CreateOptions);	Stream_Read_UINT32(irp->input, PathLength);	status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(irp->input),	                            PathLength / 2, &path, 0, NULL, NULL);	if (status < 1)	{		path = (char*) calloc(1, 1);		if (!path)		{			WLog_ERR(TAG, "calloc failed!");			return CHANNEL_RC_NO_MEMORY;		}	}	FileId = irp->devman->id_sequence++;	file = drive_file_new(drive->path, path, FileId,	                      DesiredAccess, CreateDisposition, CreateOptions);	if (!file)	{		irp->IoStatus = STATUS_UNSUCCESSFUL;		FileId = 0;		Information = 0;	}	else if (file->err)	{		FileId = 0;		Information = 0;		/* map errno to windows result */		irp->IoStatus = drive_map_posix_err(file->err);		drive_file_free(file);	}	else	{		key = (void*)(size_t) file->id;		if (!ListDictionary_Add(drive->files, key, file))		{			WLog_ERR(TAG, "ListDictionary_Add failed!");			free(path);			return ERROR_INTERNAL_ERROR;		}		switch (CreateDisposition)		{			case FILE_SUPERSEDE:			case FILE_OPEN:			case FILE_CREATE:			case FILE_OVERWRITE:				Information = FILE_SUPERSEDED;				break;			case FILE_OPEN_IF:				Information = FILE_OPENED;				break;			case FILE_OVERWRITE_IF:				Information = FILE_OVERWRITTEN;				break;			default:				Information = 0;				break;		}	}	Stream_Write_UINT32(irp->output, FileId);	Stream_Write_UINT8(irp->output, Information);	free(path);	return irp->Complete(irp);}
开发者ID:dcatonR1,项目名称:FreeRDP,代码行数:94,


示例25: drive_file_set_information

BOOL drive_file_set_information(DRIVE_FILE* file, UINT32 FsInformationClass, UINT32 Length, wStream* input){	char* s = NULL;        mode_t m;	UINT64 size;	int status;	char* fullpath;	struct STAT st;	struct timeval tv[2];	UINT64 LastWriteTime;	UINT32 FileAttributes;	UINT32 FileNameLength;	m = 0;	switch (FsInformationClass)	{		case FileBasicInformation:			/* http://msdn.microsoft.com/en-us/library/cc232094.aspx */			Stream_Seek_UINT64(input); /* CreationTime */			Stream_Seek_UINT64(input); /* LastAccessTime */			Stream_Read_UINT64(input, LastWriteTime);			Stream_Seek_UINT64(input); /* ChangeTime */			Stream_Read_UINT32(input, FileAttributes);			if (FSTAT(file->fd, &st) != 0)				return FALSE;			tv[0].tv_sec = st.st_atime;			tv[0].tv_usec = 0;			tv[1].tv_sec = (LastWriteTime > 0 ? FILE_TIME_RDP_TO_SYSTEM(LastWriteTime) : st.st_mtime);			tv[1].tv_usec = 0;#ifndef WIN32/* TODO on win32 */                        #ifdef ANDROID			utimes(file->fullpath, tv);#else			futimes(file->fd, tv);#endif			if (FileAttributes > 0)			{				m = st.st_mode;				if ((FileAttributes & FILE_ATTRIBUTE_READONLY) == 0)					m |= S_IWUSR;				else					m &= ~S_IWUSR;				if (m != st.st_mode)					fchmod(file->fd, m);			}#endif                        break;		case FileEndOfFileInformation:			/* http://msdn.microsoft.com/en-us/library/cc232067.aspx */		case FileAllocationInformation:			/* http://msdn.microsoft.com/en-us/library/cc232076.aspx */			Stream_Read_UINT64(input, size);			if (ftruncate(file->fd, size) != 0)				return FALSE;			break;		case FileDispositionInformation:			/* http://msdn.microsoft.com/en-us/library/cc232098.aspx */			/* http://msdn.microsoft.com/en-us/library/cc241371.aspx */			if (Length)				Stream_Read_UINT8(input, file->delete_pending);			else				file->delete_pending = 1;			if (file->delete_pending && file->is_dir)			{				/* mstsc causes this to FAIL if the directory is not empty,				 * and that's what the server is expecting.  If we wait for				 * the close to flag a failure, cut and paste of a folder				 * will lose the folder's contents.				 */				int status;				status = rmdir(file->fullpath);				if (status == 0)				{					/* Put it back so the normal pending delete will work. */					mkdir(file->fullpath, 0755);				}				else				{					return FALSE;				}			}			break;		case FileRenameInformation:			/* http://msdn.microsoft.com/en-us/library/cc232085.aspx */			Stream_Seek_UINT8(input); /* ReplaceIfExists */			Stream_Seek_UINT8(input); /* RootDirectory */			Stream_Read_UINT32(input, FileNameLength);			status = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(input),					FileNameLength / 2, &s, 0, NULL, NULL);			if (status < 1)//.........这里部分代码省略.........
开发者ID:pevik,项目名称:debian-freerdp,代码行数:101,


示例26: NS_ENSURE_ARG_POINTER

//.........这里部分代码省略.........        if (op == nsMsgSearchOp::IsGreaterThan)          sizeValue += 1024;        searchTermValue.AppendInt(sizeValue);        value = ToNewCString(searchTermValue);        valueWasAllocated = true;      }      else      if (IS_STRING_ATTRIBUTE(attrib))      {        PRUnichar *convertedValue; // = reallyDredd ? MSG_EscapeSearchUrl (term->m_value.u.string) : msg_EscapeImapSearchProtocol(term->m_value.u.string);        nsString searchTermValue;        searchValue->GetStr(searchTermValue);        // Ugly switch for Korean mail/news charsets.        // We want to do this here because here is where        // we know what charset we want to use.#ifdef DOING_CHARSET        if (reallyDredd)          dest_csid = INTL_DefaultNewsCharSetID(dest_csid);        else          dest_csid = INTL_DefaultMailCharSetID(dest_csid);#endif        // do all sorts of crazy escaping        convertedValue = reallyDredd ? EscapeSearchUrl (searchTermValue.get()) :        EscapeImapSearchProtocol(searchTermValue.get());        useQuotes = ((!reallyDredd ||                    (nsDependentString(convertedValue).FindChar(PRUnichar(' ')) != -1)) &&           (attrib != nsMsgSearchAttrib::Keywords));        // now convert to char* and escape quoted_specials        nsCAutoString valueStr;        nsresult rv = ConvertFromUnicode(NS_LossyConvertUTF16toASCII(destCharset).get(),          nsDependentString(convertedValue), valueStr);        if (NS_SUCCEEDED(rv))        {          const char *vptr = valueStr.get();          // max escaped length is one extra character for every character in the cmd.          nsAutoArrayPtr<char> newValue(new char[2*strlen(vptr) + 1]);          if (newValue)          {            char *p = newValue;            while (1)            {              char ch = *vptr++;              if (!ch)                break;              if ((useQuotes ? ch == '"' : 0) || ch == '//')                *p++ = '//';              *p++ = ch;            }            *p = '/0';            value = strdup(newValue); // realloc down to smaller size          }        }        else          value = strdup("");        NS_Free(convertedValue);        valueWasAllocated = true;      }    }    // this should be rewritten to use nsCString    int subLen =
开发者ID:alanyjw,项目名称:comm-central,代码行数:67,


示例27: gcc_read_client_core_data

BOOL gcc_read_client_core_data(wStream* s, rdpMcs* mcs, UINT16 blockLength){	char* str = NULL;	UINT32 version;	BYTE connectionType = 0;	UINT32 clientColorDepth;	UINT16 colorDepth = 0;	UINT16 postBeta2ColorDepth = 0;	UINT16 highColorDepth = 0;	UINT16 supportedColorDepths = 0;	UINT32 serverSelectedProtocol = 0;	UINT32 desktopPhysicalWidth = 0;	UINT32 desktopPhysicalHeight = 0;	UINT16 desktopOrientation = 0;	UINT32 desktopScaleFactor = 0;	UINT32 deviceScaleFactor = 0;	UINT16 earlyCapabilityFlags = 0;	rdpSettings* settings = mcs->settings;	/* Length of all required fields, until imeFileName */	if (blockLength < 128)		return FALSE;	Stream_Read_UINT32(s, version); /* version (4 bytes) */	settings->RdpVersion = (version == RDP_VERSION_4 ? 4 : 7);	Stream_Read_UINT16(s, settings->DesktopWidth); /* DesktopWidth (2 bytes) */	Stream_Read_UINT16(s, settings->DesktopHeight); /* DesktopHeight (2 bytes) */	Stream_Read_UINT16(s, colorDepth); /* ColorDepth (2 bytes) */	Stream_Seek_UINT16(s); /* SASSequence (Secure Access Sequence) (2 bytes) */	Stream_Read_UINT32(s, settings->KeyboardLayout); /* KeyboardLayout (4 bytes) */	Stream_Read_UINT32(s, settings->ClientBuild); /* ClientBuild (4 bytes) */	/* clientName (32 bytes, null-terminated unicode, truncated to 15 characters) */	ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 32 / 2, &str, 0, NULL, NULL);	Stream_Seek(s, 32);	sprintf_s(settings->ClientHostname, 31, "%s", str);	settings->ClientHostname[31] = 0;	free(str);	str = NULL;	Stream_Read_UINT32(s, settings->KeyboardType); /* KeyboardType (4 bytes) */	Stream_Read_UINT32(s, settings->KeyboardSubType); /* KeyboardSubType (4 bytes) */	Stream_Read_UINT32(s, settings->KeyboardFunctionKey); /* KeyboardFunctionKey (4 bytes) */	WLog_DBG(TAG, "KeyboardLayout=%x, KeyboardType=%x, KeyboardSubType=%x, KeyboardFunctionKey=%x",		settings->KeyboardLayout, settings->KeyboardType, settings->KeyboardSubType, settings->KeyboardFunctionKey);	Stream_Seek(s, 64); /* imeFileName (64 bytes) */	blockLength -= 128;	/**	 * The following fields are all optional. If one field is present, all of the preceding	 * fields MUST also be present. If one field is not present, all of the subsequent fields	 * MUST NOT be present.	 * We must check the bytes left before reading each field.	 */	do	{		if (blockLength < 2)			break;		Stream_Read_UINT16(s, postBeta2ColorDepth); /* postBeta2ColorDepth (2 bytes) */		blockLength -= 2;		if (blockLength < 2)			break;		Stream_Seek_UINT16(s); /* clientProductID (2 bytes) */		blockLength -= 2;		if (blockLength < 4)			break;		Stream_Seek_UINT32(s); /* serialNumber (4 bytes) */		blockLength -= 4;		if (blockLength < 2)			break;		Stream_Read_UINT16(s, highColorDepth); /* highColorDepth (2 bytes) */		blockLength -= 2;		if (blockLength < 2)			break;		Stream_Read_UINT16(s, supportedColorDepths); /* supportedColorDepths (2 bytes) */		blockLength -= 2;		if (blockLength < 2)			break;		Stream_Read_UINT16(s, earlyCapabilityFlags); /* earlyCapabilityFlags (2 bytes) */		settings->EarlyCapabilityFlags = (UINT32) earlyCapabilityFlags;		blockLength -= 2;		if (blockLength < 64)			break;		ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), 64 / 2, &str, 0, NULL, NULL);		Stream_Seek(s, 64); /* clientDigProductId (64 bytes) */		sprintf_s(settings->ClientProductId, 32, "%s", str);		free(str);		blockLength -= 64;//.........这里部分代码省略.........
开发者ID:vworkspace,项目名称:FreeRDP,代码行数:101,


示例28: rdp_read_extended_info_packet

BOOL rdp_read_extended_info_packet(rdpRdp* rdp, wStream* s){	UINT16 clientAddressFamily;	UINT16 cbClientAddress;	UINT16 cbClientDir;	UINT16 cbAutoReconnectLen;	rdpSettings* settings = rdp->settings;	if (Stream_GetRemainingLength(s) < 4)		return FALSE;	Stream_Read_UINT16(s, clientAddressFamily); /* clientAddressFamily (2 bytes) */	Stream_Read_UINT16(s, cbClientAddress); /* cbClientAddress (2 bytes) */	settings->IPv6Enabled = (clientAddressFamily == ADDRESS_FAMILY_INET6 ? TRUE : FALSE);	if (Stream_GetRemainingLength(s) < cbClientAddress)		return FALSE;	if (settings->ClientAddress)	{		free(settings->ClientAddress);		settings->ClientAddress = NULL;	}	ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), cbClientAddress / 2, &settings->ClientAddress, 0, NULL, NULL);	Stream_Seek(s, cbClientAddress);	if (Stream_GetRemainingLength(s) < 2)		return FALSE;	Stream_Read_UINT16(s, cbClientDir); /* cbClientDir (2 bytes) */	if (Stream_GetRemainingLength(s) < cbClientDir)		return FALSE;	if (settings->ClientDir)	{		free(settings->ClientDir);		settings->ClientDir = NULL;	}	ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) Stream_Pointer(s), cbClientDir / 2, &settings->ClientDir, 0, NULL, NULL);	Stream_Seek(s, cbClientDir);	if (!rdp_read_client_time_zone(s, settings))		return FALSE;	if (Stream_GetRemainingLength(s) < 10)		return FALSE;	Stream_Seek_UINT32(s); /* clientSessionId (4 bytes), should be set to 0 */	Stream_Read_UINT32(s, settings->PerformanceFlags); /* performanceFlags (4 bytes) */	freerdp_performance_flags_split(settings);	Stream_Read_UINT16(s, cbAutoReconnectLen); /* cbAutoReconnectLen (2 bytes) */	if (cbAutoReconnectLen > 0)		return rdp_read_client_auto_reconnect_cookie(rdp, s); /* autoReconnectCookie */	/* reserved1 (2 bytes) */	/* reserved2 (2 bytes) */	return TRUE;}
开发者ID:C4rt,项目名称:FreeRDP,代码行数:65,



注:本文中的ConvertFromUnicode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ ConvertToUnicode函数代码示例
C++ ConvertDefault函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。