📄 convert.c
字号:
/* * convert.c * * Copyright (C) 2006 Insigme Co., Ltd * * Authors: * - Lixing Chu * * This software has been developed while working on the Linux Unified Kernel * project (http://linux.insigma.com.cn) in the Insigma Reaserch Institute, * which is a subdivision of Insigma Co., Ltd (http://www.insigma.com.cn). * * The project is sponsored by Insigma Co., Ltd. * * The authors can be reached at linux@insigma.com.cn. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * Revision History: * Jan 2006 - Created. *//* * convert.c:convert unicode string to char string */#include <linux/module.h>#include <linux/fs.h>#include <linux/nls.h>#include <linux/win32_process.h>#include "win32.h"#ifdef CONFIG_UNIFIED_KERNELextern struct ethread *thread_find(void);int unistr2charstr(PWSTR unistr, LPCSTR chstr){ struct ethread *thread; struct nls_table *nls; UCHAR *pch; WCHAR *wc; int retval = -EFAULT; int charlen=0; thread = thread_find(); if(!thread) return -EINVAL; pch = (UCHAR *)chstr; nls = thread->threads_process->ep_nls; if(nls){ for(wc = unistr; *wc != 0; wc++){ retval = nls->uni2char(*wc, pch, 2); if(retval>0){ charlen += retval; pch += retval; } else return retval; } *pch = 0; return charlen; } return retval;} /* end unistr2charstr() */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -