Beispiel #1
0
	filePathLinkW(const wstring& path) :m_ntType(L"\\??\\")
	{
		if (path.length() > 4 && path.substr(0, 4) == L"\\??\\")
		{
			m_ntType.append(path.substr(4));
		}
		else
		{
			m_ntType.append(path);
		}
		static DWORD tick = 0;
		wchar_t tmpBuffer[100];
		StringCbPrintfW(tmpBuffer, 100, L"%x%x%x%x", GetCurrentThreadId(), GetTickCount(), rand(), ++tick);
		m_pathDefine = wstring(FS_BYPASS_DEFINE_PREFIX_W) + tmpBuffer;
		if (DefineDosDeviceW(DDD_RAW_TARGET_PATH, m_pathDefine.c_str(), m_ntType.c_str()))
		{
			m_pathLink = wstring(L"\\\\.\\") + FS_BYPASS_DEFINE_PREFIX_W + tmpBuffer;
			m_transformed = true;
		}
		else
		{
			m_pathLink = path;
			m_transformed = false;
		}
	}
Beispiel #2
0
// See https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_string_as_a_parameter
// Some tricky test cases:
// "abcdefghijklmn".replace(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)/, "$001"): "$001"
// "abcdefghijklmn".replace(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)/, "$01"): "a"
// "abcdefghijklmn".replace(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)/, "$10"): "j"
// "abcdefghijklmn".replace(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)/, "$15"): "a5"
// "abcdefghijklmn".replace(/(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)/, "$20"): "b0"
void insertReplacedString(wstring& builder, const wstring& base, const wstring& str, const RegExpMatch& match)
{
	const vector<wstring>& substrings = match.substrings;
	const wstring& mstr = substrings[0];
	for (size_t i = 0; i < str.length(); i++)
	{
		if (str[i] == L'$' && str.length() > i + 1)
		{
			wchar_t ch = str[++i];
			switch (ch)
			{
			case L'$': // insert a '$'
				builder.push_back(ch);
				break;
			case L'&': // insert the matched string
				builder.append(mstr);
				break;
			case L'`': // insert the portion preceding the matched string
				builder.append(base.begin(), base.begin() + match.index);
				break;
			case L'\'': // insert the portion following the matched string
				builder.append(base.begin() + match.index + mstr.length(), base.end());
				break;
			default:
				if (ch >= L'0' && ch <= L'9')
				{
					int expidx = 0;
					wchar_t ch2 = str.length() > i + 1 ? str[i + 1] : L'\0';
					if (ch2 >= L'0' && ch2 <= L'9')
					{
						expidx = ch2 - L'0' + 10 * (ch - L'0');
						// if expidx overflows, fall back to single-digit
						if (expidx == 0 || expidx >= (int)substrings.size())
						{
							expidx = ch - L'0';
							ch2 = 0;
						}
					}
					else
					{
						ch2 = 0;
						expidx = ch - L'0';
					}
					// substrings.size() is 1 bigger than actual sub matches
					if (expidx < (int)substrings.size() && expidx > 0)
					{
						const wstring& submstr = substrings[expidx];
						builder.append(submstr);
						if (ch2) ++i;
						break;
					}
				}
				// $ escape fails, output as is
				builder.push_back(L'$');
				builder.push_back(ch);
			}
		}
		else builder.push_back(str[i]);
	}
}
Beispiel #3
0
BOOL CConvertMacro2::Convert(wstring macro, PLUGIN_RESERVE_INFO* info, EPG_EVENT_INFO* epgInfo, wstring& convert)
{
	convert = L"";

	for( size_t pos = 0;; ){
		size_t next = macro.find(L'$', pos);
		if( next == wstring::npos ){
			convert.append(macro, pos, wstring::npos);
			break;
		}
		convert.append(macro, pos, next - pos);
		pos = next;

		next = macro.find(L'$', pos + 1);
		if( next == wstring::npos ){
			convert.append(macro, pos, wstring::npos);
			break;
		}
		if( ExpandMacro(macro.substr(pos + 1, next - pos - 1), info, epgInfo, convert) == FALSE ){
			convert += L'$';
			pos++;
		}else{
			pos = next + 1;
		}
	}
	Replace(convert, L"\r", L"");
	Replace(convert, L"\n", L"");

	return TRUE;
}
Beispiel #4
0
void AppendString(wstring& str0, const wstring& str1, const wstring& str2) {
  if (str1.empty())
    return;

  if (!str0.empty())
    str0.append(str2);

  str0.append(str1);
}
Beispiel #5
0
void displayModel_t::generateWhitespaceXML(HWND hwnd, long baseline, wstring& text) {
	wstringstream s;
	s<<L"<text ";
	s<<L"hwnd=\""<<hwnd<<L"\" ";
	s<<L"baseline=\""<<baseline<<L"\" ";
	s<<L">";
	text.append(s.str());
	text.append(L" ");
	text.append(L"</text>");
}
Beispiel #6
0
void process_file(wstring& output, set<wstring>& file_set, const wstring& file_path, const list<wstring>& include_dirs) {
  if (file_set.count(file_path)) return;
  file_set.insert(file_path);
  list<wstring> include_files = get_include_file_list(file_path, include_dirs);
  if (!include_files.empty()) {
    output.append(file_path).append(1, L':');
    for (list<wstring>::const_iterator inc_file = include_files.begin(); inc_file != include_files.end(); inc_file++) {
      output.append(1, L' ').append(*inc_file);
    }
    output.append(1, L'\n');
  }
  for (list<wstring>::const_iterator inc_file = include_files.begin(); inc_file != include_files.end(); inc_file++) {
    process_file(output, file_set, *inc_file, include_dirs);
  }
}
Beispiel #7
0
void BuildTreeString(vector<AccessibleChild>& children, wstring& str, int indent) {
    for (auto it = children.begin(); it != children.end(); ++it) {
        str.append(indent * 4, L' ');
        str += L"[" + it->role + L"] " + it->name + L" = " + it->value + L"\n";
        BuildTreeString(it->children, str, indent + 1);
    }
}
Beispiel #8
0
	void CCilDisasm::dumpLabel( wstring& str )
	{
		//32 chars
		str.append( L":" );
		swprintf_s( m_wstrBuffer, ARRAYSIZE( m_wstrBuffer ), L"%-32s", str.data() );
		wcout << m_wstrBuffer;
	}
Beispiel #9
0
/** 
 * @brief	std::string → std::wstring変換
 *
 * @param[out]	dst		変換結果バッファ
 * @param		src		変換するマルチバイト文字列
 * @param		loc		変換に使用するlocale
 * @param		cvt		変換関数を提供するcodecvt
 */
void ToWideString(wstring &dst, const string &src, const codecvt<wstring::value_type, string::value_type, mbstate_t>& cvt)
{
	typedef wstring::value_type wchar_type;
	typedef string::value_type char_type;
	typedef codecvt<wchar_type, char_type, mbstate_t> cvt_type;

	size_t len = src.length();
	wchar_type * buff = new wchar_type[len*2];
	
	const char_type* const pbegin = src.c_str();
	const char_type* const pend = pbegin + src.length();
	const char_type* pnext = pbegin;
	wchar_type* const pwbegin = &buff[0];
	wchar_type* const pwend = &buff[len*2];
	wchar_type* pwnext = pwbegin;

	dst.clear();
	mbstate_t state(0);
	for(;;){
		cvt_type::result result = cvt.in(state, pbegin, pend, pnext, pwbegin, pwend, pwnext);
		dst.append(pwbegin, pwnext - pwbegin);
		if(result == cvt_type::ok) {
			break;
		}

		assert(result == cvt_type::error);
	}

	delete[] buff;
}
Beispiel #10
0
// Append a backslash to the current string 
inline wstring AppendBackslash(wstring str)
{
    if (str.length() == 0)
        return wstring(L"\\");
    if (str[str.length() - 1] == L'\\')
        return str;
    return str.append(L"\\");
}
Beispiel #11
0
void displayModelChunk_t::generateXML(wstring& text) {
	wstringstream s;
	s<<L"<text ";
	s<<L"hwnd=\""<<hwnd<<L"\" ";
	s<<L"baseline=\""<<baseline<<L"\" ";
	s<<L"direction=\""<<direction<<L"\" ";
	s<<L" font-name=\""<<formatInfo.fontName<<L"\" ";
	s<<L" font-size=\""<<formatInfo.fontSize<<L"pt\" ";
	if(this->formatInfo.bold) s<<L" bold=\"true\"";
	if(this->formatInfo.italic) s<<L" italic=\"true\"";
	if(this->formatInfo.underline) s<<L" underline=\"true\"";
	s<<L" color=\""<<this->formatInfo.color<<L"\"";
	s<<L" background-color=\""<<this->formatInfo.backgroundColor<<L"\"";
	s<<L">";
	text.append(s.str());
	for(wstring::iterator i=this->text.begin();i!=this->text.end();++i) appendCharToXML(*i,text);
	text.append(L"</text>");
}
Beispiel #12
0
HRESULT CDataTuple::ReadLine(FILE *fp, wstring &line)
{
	HRESULT hRet = E_FAIL;

    TCHAR buffer[256];
	line.clear();

	if (NULL != fp)
	{
		buffer[0] = TEXT('\0');
		TCHAR * pStr = _fgetts(buffer, ARRAYSIZE(buffer), fp);
		errno_t err;
		_get_errno(&err);

		if (feof(fp) != 0 || err != 0)
		{
			return hRet;
		}

		line.append(buffer);
		size_t cBuffer = _tcslen(buffer);
		if (cBuffer <= 0)
		{
			return hRet;
		}

		while (cBuffer > 0 && buffer[cBuffer-1] != TEXT('\n') )
		{
			buffer[0] = TEXT('\0');
			pStr = _fgetts(buffer, ARRAYSIZE(buffer), fp);
			line.append(buffer);
			cBuffer = _tcslen(buffer);
		}

		if (line.length() > 0)
		{
			hRet = S_OK;
		}

	}
	return hRet;
}
//----------------------------------------------------------------------
// Converts a UTF8 encoded string to a unicode string
// See the following document for more information:
// RFC2279: UTF-8, a transformation format of ISO 10646
// Author: pdaehne
//----------------------------------------------------------------------
void TextFace::convertUTF8ToUnicode(const string &utf8Text, wstring &text)
{
    // Clear and prepare the result string
    text.erase();
    text.reserve(utf8Text.length());

    // Transform UTF8 sequences to UTF16 sequences
    const char *pos = utf8Text.c_str();
    while (*pos != '\0')
        text.append(1, utf8Char2Unicode(pos));
}
Beispiel #14
0
//可同时处理目录和文件:path可以是路径,也可以是文件名,或者文件通配符
wstring find(wstring path,bool cursive)
{ 
     //取路径名最后一个"//"之前的部分,包括"//"
	replace_allW(path,L"\\",L"/");
	UINT index=path.find_last_of('/');
	if(index+1==path.length()){
		path.append(L"*.*");
	}
    wstring prefix=path.substr(0,path.find_last_of('/')+1);

    WIN32_FIND_DATA FindFileData;
    HANDLE hFind=::FindFirstFile(path.data(),&FindFileData);
	std::wstringstream ss;
    if(INVALID_HANDLE_VALUE == hFind)
    {
       ss<<L"[]";
	   FindClose(hFind);
	   return ss.str();
    }
	else{
		ss<<L"[";
	}
    while(TRUE)
    {
		bool flag=false;;
      //目录
        if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
        {
            //不是当前目录,也不是父目录
            if(cursive&&FindFileData.cFileName[0]!='.')
            {
				wstring temp=prefix+FindFileData.cFileName;
				ss<<L"{\"name\":\""<<FindFileData.cFileName<<L"\",\"list\":"<<find(temp+L"/*.*",cursive).data()<<L"}";
				flag=true;
            }
        }
        //文件
        else
        {   
             ss<<L"\""<<FindFileData.cFileName<<L"\"";
			flag=true;
        }
        if(!FindNextFile(hFind,&FindFileData))
              break;
		else if(flag){
			ss<<L",";
		}
    }
	ss<<L"]";
    FindClose(hFind);
	return ss.str();
}
Beispiel #15
0
void ini_get_wstring(INI_Reader &ini, wstring &wscValue)
{
	string scValue = ini.get_value_string();
	wscValue = L"";
	long lHiByte;
	long lLoByte;
	while(sscanf(scValue.c_str(), "%02X%02X", &lHiByte, &lLoByte) == 2)
	{
		scValue = scValue.substr(4);
		wchar_t wChar = (wchar_t)((lHiByte << 8) | lLoByte);
		wscValue.append(1, wChar);
	}
}
Beispiel #16
0
// READ GLOBALS - Read the global code file
void AutocodeManager::ReadGlobals(wstring dir_path) {
	wstring full_path = dir_path.append(L"\\");
	full_path = full_path.append(GLOBALCODE_FNAME);

	// 
    wifstream code_file(WStr2Str(full_path).c_str(), ios::binary|ios::in);
	if(code_file.is_open() == false) {
		code_file.close();
		return;
	}

	Parse(&code_file, true);

	code_file.close();
}
Beispiel #17
0
inline void getCurrentStyleInfoFromHTMLDOMNode(IHTMLDOMNode* pHTMLDOMNode, bool& dontRender, bool& isBlock, bool& hidden, wstring& listStyle) {
	BSTR tempBSTR=NULL;
	IHTMLElement2* pHTMLElement2=NULL;
	int res=pHTMLDOMNode->QueryInterface(IID_IHTMLElement2,(void**)&pHTMLElement2);
	if(res!=S_OK||!pHTMLElement2) {
		LOG_DEBUG(L"Could not get IHTMLElement2");
		return;
	}
	IHTMLCurrentStyle* pHTMLCurrentStyle=NULL;
	res=pHTMLElement2->get_currentStyle(&pHTMLCurrentStyle);
	pHTMLElement2->Release();
	if(res!=S_OK||!pHTMLCurrentStyle) {
		LOG_DEBUG(L"Could not get IHTMLCurrentStyle");
		return;
	}
	//get visibility
	pHTMLCurrentStyle->get_visibility(&tempBSTR);
	if(tempBSTR) {
		LOG_DEBUG(L"Got visibility");
		hidden=(_wcsicmp(tempBSTR,L"hidden")==0);
		SysFreeString(tempBSTR);
		tempBSTR=NULL;
	} else {
		LOG_DEBUG(L"Failed to get visibility");\
	}
	//get display
	pHTMLCurrentStyle->get_display(&tempBSTR);
	if(tempBSTR) {
		LOG_DEBUG(L"Got display");
		if (_wcsicmp(tempBSTR,L"none")==0) {
			dontRender=true;
			isBlock=false;
		}
		if (_wcsicmp(tempBSTR,L"inline")==0||_wcsicmp(tempBSTR,L"inline-block")==0) isBlock=false;
		SysFreeString(tempBSTR);
		tempBSTR=NULL;
	} else {
		LOG_DEBUG(L"Failed to get display");
	}
	BSTR _listStyle;
	pHTMLCurrentStyle->get_listStyleType(&_listStyle);
	if(_listStyle) {
		listStyle.append(_listStyle);
		SysFreeString(_listStyle);
	}
	if (pHTMLCurrentStyle) pHTMLCurrentStyle->Release();
}
// ansi 文件内容读取
void getFileContentAnsii(const TCHAR *path, wstring &ret)
{
		wstring lineString;
		wifstream sqlFile;
		register TCHAR buffer[2048] = {0};
		sqlFile.imbue(std::locale("chs"));
		sqlFile.open(path);
		if (sqlFile.is_open())
		{
			while(!sqlFile.eof())
			{
				getline(sqlFile, lineString);
				ret.append(lineString);
			}
		}
		sqlFile.close();
}
Beispiel #19
0
bool file::open (const open_spec& spec, wstring filename)
{
    close();
    filename.append (L'\0');
    ratwin::types::HANDLE new_h= CreateFile (filename.get_buffer(), spec.access, spec.share, spec.how, spec.even_more_flags);
    if (new_h == 0)  throw classics::exception ("Tomahawk", "That can't happen!", __FILE__, __LINE__);
    if (new_h == ratwin::types::HANDLE(0xffffffff)) {
        if (spec.CanFail)  return false;
        else {
            Error X (__LINE__);
            wFmt(X) << L"Can't open file named \"" << filename << L"\"." << endl;
            throw X;
        }
    }
    H= new_h;
    return true;
}
Beispiel #20
0
// READ FILE - Read the autocode file in the level folder
void AutocodeManager::ReadFile(wstring dir_path) {

	// Form full path
	//wstring full_path = removeExtension(dir_path);
	wstring full_path = dir_path.append(Level::GetName());	
	full_path = removeExtension(full_path);
	full_path = full_path.append(L"\\");
	full_path = full_path.append(AUTOCODE_FNAME);	

    wifstream code_file(WStr2Str(full_path).c_str(), ios::binary|ios::in);
	if(code_file.is_open() == false) {
		code_file.close();
		return;
	}
	
	m_Enabled = true;
	Parse(&code_file, false);

	code_file.close();
}
Beispiel #21
0
static const wstring& fontsPath()
{
    static wstring path;
    static bool initialized;

    if (initialized)
        return path;
    initialized = true;

    DWORD size = GetEnvironmentVariable(fontsEnvironmentVariable, 0, 0);
    Vector<TCHAR> buffer(size);
    if (GetEnvironmentVariable(fontsEnvironmentVariable, buffer.data(), buffer.size())) {
        path = buffer.data();
        if (path[path.length() - 1] != '\\')
            path.append(L"\\");
        return path;
    }

    path = exePath() + TEXT("DumpRenderTree.resources\\");
    return path;
}
Beispiel #22
0
bool mod_pipe::readFromPipe(wstring &laReponse)
{
	bool reussite = false;
	wchar_t monBuffer[128]; 

	bool fSuccess;
	DWORD longueurReponse;
	laReponse.clear();

	do 
	{ 
		fSuccess = ReadFile(hPipe, monBuffer, sizeof(monBuffer), &longueurReponse, NULL) ? true : false;
		if (reussite = (fSuccess || GetLastError() == ERROR_MORE_DATA)/* && longueurReponse != 0 */)
		{
			laReponse.append(monBuffer, longueurReponse / sizeof(wchar_t));
		}
		else
		{
			break;
		}
	} while (!fSuccess);

	return reussite;
}
Beispiel #23
0
static void int2str(wstring &buffer, int i){
	wstringstream out;
	out << i;
	buffer.append(out.str());
}
Beispiel #24
0
void displayModel_t::renderText(const RECT& rect, const int minHorizontalWhitespace, const int minVerticalWhitespace, const bool stripOuterWhitespace, wstring& text, deque<RECT>& characterLocations) {
	RECT tempCharLocation;
	RECT tempRect;
	wstring curLineText;
	deque<RECT> curLineCharacterLocations;
	int curLineMinTop=-1;
	int curLineMaxBottom=-1;
	int curLineBaseline=-1;
	int lastChunkRight=rect.left;
	HWND lastChunkHwnd=NULL;
	int lastLineBottom=rect.top;
	//Walk through all the chunks looking for any that intersect the rectangle
	displayModelChunksByPointMap_t::iterator chunkIt=chunksByYX.begin();
	while(chunkIt!=chunksByYX.end()) {
		displayModelChunk_t* chunk=NULL;
		BOOL isTempChunk=FALSE;
		if(IntersectRect(&tempRect,&rect,&(chunkIt->second->rect))) {
			chunk=chunkIt->second;
			//If this chunk is not fully covered by the rectangle
			//Copy it and truncate it so that it is fully covered
			if(chunk->rect.left<tempRect.left||chunk->rect.right>tempRect.right) {
				chunk=new displayModelChunk_t(*chunk);
				isTempChunk=TRUE;
				if(chunk->rect.left<tempRect.left) chunk->truncate(tempRect.left,TRUE);
				if(chunk->rect.right>tempRect.right) chunk->truncate(tempRect.right,FALSE);
			}
		}
		//Find out the current line's baseline
		curLineBaseline=chunkIt->first.first;
		//Iterate to the next possible chunk
		++chunkIt;
		//If we have a valid chunk then add it to the current line
		if(chunk&&chunk->text.length()>0) {
			//Update the maximum height of the line
			if(curLineText.length()==0) {
				curLineMinTop=chunk->rect.top;
				curLineMaxBottom=chunk->rect.bottom;
			} else {
				if(chunk->rect.top<curLineMinTop) curLineMinTop=chunk->rect.top;
				if(chunk->rect.bottom>curLineMaxBottom) curLineMaxBottom=chunk->rect.bottom;
			}
			//Add space before this chunk if necessary
			if(((chunk->rect.left-lastChunkRight)>=minHorizontalWhitespace)&&(lastChunkRight>rect.left||!stripOuterWhitespace)) {
				generateWhitespaceXML((chunk->hwnd==lastChunkHwnd)?lastChunkHwnd:hwnd,curLineBaseline,curLineText);
				tempCharLocation.left=lastChunkRight;
				tempCharLocation.top=curLineBaseline-1;
				tempCharLocation.right=chunk->rect.left;
				tempCharLocation.bottom=curLineBaseline+1;
				curLineCharacterLocations.push_back(tempCharLocation);
			}
			//Add text from this chunk to the current line
			chunk->generateXML(curLineText);
			//Copy the character X positions from this chunk  in to the current line
			deque<long>::const_iterator cxaIt=chunk->characterXArray.begin();
			deque<RECT>::iterator curLineCharacterLocationsOldEnd=curLineCharacterLocations.end();
			while(cxaIt!=chunk->characterXArray.end()) {
				tempCharLocation.left=*cxaIt;
				tempCharLocation.top=chunk->rect.top;
				++cxaIt;
				tempCharLocation.right=(cxaIt!=chunk->characterXArray.end())?*cxaIt:chunk->rect.right;
				tempCharLocation.bottom=chunk->rect.bottom;
				curLineCharacterLocations.push_back(tempCharLocation);
			}
			lastChunkRight=chunk->rect.right;
			lastChunkHwnd=chunk->hwnd;
		}
		if((chunkIt==chunksByYX.end()||chunkIt->first.first>curLineBaseline)&&curLineText.length()>0) {
			//This is the end of the line
			if(((curLineMinTop-lastLineBottom)>=minVerticalWhitespace)&&(lastLineBottom>rect.top||!stripOuterWhitespace)) {
				//There is space between this line and the last,
				//Insert a blank line in between.
				generateWhitespaceXML(hwnd,-1,text);
				tempCharLocation.left=rect.left;
				tempCharLocation.top=lastLineBottom;
				tempCharLocation.right=rect.right;
				tempCharLocation.bottom=curLineMinTop;
				characterLocations.push_back(tempCharLocation);
			}
			//Insert this line in to the output.
			text.append(curLineText);
			characterLocations.insert(characterLocations.end(),curLineCharacterLocations.begin(),curLineCharacterLocations.end());
			//Add a linefeed to complete the line
			if(!stripOuterWhitespace) {
				generateWhitespaceXML(hwnd,curLineBaseline,text);
				tempCharLocation.left=lastChunkRight;
				tempCharLocation.top=curLineBaseline-1;
				tempCharLocation.right=rect.right;
				tempCharLocation.bottom=curLineBaseline+1;
				characterLocations.push_back(tempCharLocation);
			}
			//Reset the current line values
			curLineText.clear();
			curLineCharacterLocations.clear();
			lastChunkRight=rect.left;
			lastChunkHwnd=NULL;
			lastLineBottom=curLineMaxBottom;
			if(chunk&&isTempChunk) delete chunk;
		}
	}
	if(!stripOuterWhitespace&&(rect.bottom-lastLineBottom)>=minVerticalWhitespace) {
		//There is a gap between the bottom of the final line and the bottom of the requested rectangle,
		//So add a blank line.
		generateWhitespaceXML(hwnd,-1,text);
		tempCharLocation.left=rect.left;
		tempCharLocation.top=lastLineBottom;
		tempCharLocation.right=rect.right;
		tempCharLocation.bottom=rect.bottom;
		characterLocations.push_back(tempCharLocation);
	}
}
Beispiel #25
0
bool ObjFormatNativeKeyName
(
    __inout wstring &Name
)
{
    const static wstring hklmPrefix = L"\\Registry\\Machine";
    const static wstring hkcrPrefix = L"\\Registry\\Machine\\Software\\Classes";
    const static wstring hkuPrefix = L"\\Registry\\User";
    static wstring hkcuPrefix;
    static wstring hkcucrPrefix;
    // Fix string.
    const static wstring hklmString = L"HKLM";
    const static wstring hkcrString = L"HKCR";
    const static wstring hkuString = L"HKU";
    const static wstring hkcuString = L"HKCU";
    const static wstring hkcucrString = L"HKCU\\Software\\Classes";
    // Mark
    static PT_void inited = NULL;
    if (blpp_initOnce(&inited))
    {
        HANDLE Token;
        PTOKEN_USER tokenUser;
        WCHAR stringSid[MAX_PATH] = {0};
        Token = ObjpGetToken();
        if (Token != NULL)
        {
            if (NT_SUCCESS(ObjpQueryTokenVariableSize(Token,TokenUser,(PVOID *)&tokenUser)))
            {
                ObjSidToStringSid(tokenUser->User.Sid,stringSid,MAX_PATH*sizeof(WCHAR));
                blpp_mem_free(tokenUser);
            }
            NtClose(Token);
        }
        if (stringSid[0] != 0)
        {
            const static PWSTR registryUserPrefix = L"\\Registry\\User\\";
            const static PWSTR classesString = L"_Classes";
            hkcuPrefix = registryUserPrefix;
            hkcuPrefix.append(stringSid);
            hkcucrPrefix = hkcuPrefix;
            hkcucrPrefix.append(classesString);
        }
        else
        {
            hkcuPrefix = L"...";
            hkcucrPrefix = L"...";
        }
    }
    if (isStartWithStringW(Name,hkcrPrefix,true))
    {
        Name.replace(0,hkcrPrefix.length(),hkcrString);
    }
    else if (isStartWithStringW(Name,hklmPrefix,true))
    {
        Name.replace(0,hklmPrefix.length(),hklmString);
    }
    else if (isStartWithStringW(Name,hkcucrPrefix,true))
    {
        Name.replace(0,hkcucrPrefix.length(),hkcucrString);
    }
    else if (isStartWithStringW(Name,hkcuPrefix,true))
    {
        Name.replace(0,hkcuPrefix.length(),hkcuString);
    }
    else if (isStartWithStringW(Name,hkuPrefix,true))
    {
        Name.replace(0,hkuPrefix.length(),hkuString);
    }
    else
    {
        return false;
    }
    return true;
}
void TransparentWnd::RunAppIn(CefString appName, CefString param, CefString baseUrl){
	wstring appNameW=appName.ToWString();
	if(appNameW.find(L":")==-1){
		wstring path;
		if(!baseUrl.length()){
			path=modulePath;//szPath;
		}
		else{
			path=baseUrl.ToWString();
			replace_allW(path, L"\\", L"/");
			path=path.substr(0,path.find_last_of('/')+1);
		}
		appNameW=path.append(appNameW);
	}
	replace_allW(appNameW, L"\\", L"/");
	int w,h,_x,_y;
	int enableDrag=0,disableTransparent=0,exStyle=0,hasBorder=false,_max=false,_enableResize=false,disableRefresh=0,disableDevelop=0;
	TCHAR url[1000],name[100],iconPath[1000];
	wstring _folder=appNameW.substr(0,appNameW.find_last_of('/')+1);
	folder=_folder;
	GetPrivateProfileString(L"BASE",L"url",NULL,url,1000,appNameW.data());
	GetPrivateProfileString(L"BASE",L"name",NULL,name,100,appNameW.data());
	GetPrivateProfileString(L"BASE",L"icon",NULL,iconPath,1000,appNameW.data());
	w=GetPrivateProfileInt(L"BASE",L"width",0,appNameW.data());
	h=GetPrivateProfileInt(L"BASE",L"height",0,appNameW.data());
	_x=GetPrivateProfileInt(L"BASE",L"x",0,appNameW.data());
	_y=GetPrivateProfileInt(L"BASE",L"y",0,appNameW.data());
	enableDrag=GetPrivateProfileInt(L"BASE",L"enableDrag",0,appNameW.data());
	disableRefresh=GetPrivateProfileInt(L"BASE",L"disableRefresh",0,appNameW.data());
	disableDevelop=GetPrivateProfileInt(L"BASE",L"disableDevelop",0,appNameW.data());
	_enableResize=GetPrivateProfileInt(L"BASE",L"enableResize",0,appNameW.data());
	disableTransparent=GetPrivateProfileInt(L"BASE",L"disableTransparent",0,appNameW.data());
	hasBorder=GetPrivateProfileInt(L"BASE",L"hasBorder",0,appNameW.data());
	_max=GetPrivateProfileInt(L"BASE",L"max",0,appNameW.data());
	exStyle=GetPrivateProfileInt(L"BASE",L"exStyle",0,appNameW.data());
	int l=wcslen(iconPath);
	if(l>0){
		hIcon=GetIcon(iconPath);
	}
	if(_enableResize>0){
		enableResize=true;
	}
	enableRefresh=disableRefresh==0;
	enableDevelop=disableDevelop==0;
	CefString cefFile(url);
	wstring file=cefFile.ToWString();
	if(file.find(L":")==-1){
		file=_folder.append(file);
	}
	bool isTransparent=disableTransparent==0;
	if(hasBorder){
		char t[10];
		_itoa(isTransparent,t,10);
		CefString ct(t);
		wstring _name(name);
		file=modulePath.append(L"window\\index.html?name=").append(_name).append(L"&url=").append(file).append(L"&transparent=").append(ct.ToWString().data()).append(L"&x=");
		_itoa(_x,t,10);
		ct=t;
		file.append(ct.ToWString().data());
		file.append(L"&y=");
		_itoa(_y,t,10);
		ct=t;
		file.append(ct.ToWString().data());
		file.append(L"&width=");
		_itoa(w,t,10);
		ct=t;
		file.append(ct.ToWString().data());
		file.append(L"&height=");
		_itoa(h,t,10);
		ct=t;
		file.append(ct.ToWString().data());
		file.append(L"&max=");
		_itoa(_max,t,10);
		ct=t;
		file.append(ct.ToWString().data());
		isTransparent=true;
		if(param.length()){
			file.append(L"&param="+param.ToWString());
		}
	}
	else {
		if(param.length()){
			file.append(L"?param="+param.ToWString());
		}
	}
	CreateBrowserWindow(file, exStyle, isTransparent);
	if(_max){
		this->Max();
	}
	else{
		SetSize(w,h);
		Move(_x,_y);
	}
	this->SetTitle(name);
	if(enableDrag>0){
		EnableDrag();
	}

}