예제 #1
0
파일: w32dc.cpp 프로젝트: kant/livecode
LPWSTR MCScreenDC::convertutf8towide(const char *p_utf8_string)
{
	int t_new_length;
	t_new_length = UTF8ToUnicode(p_utf8_string, strlen(p_utf8_string), NULL, 0);

	LPWSTR t_result;
	t_result = new WCHAR[t_new_length + 2];

	t_new_length = UTF8ToUnicode(p_utf8_string, strlen(p_utf8_string), (uint2*)t_result, t_new_length);
	t_result[t_new_length / 2] = 0;

	return t_result;
}
예제 #2
0
파일: execpt.cpp 프로젝트: bduck/livecode
void MCExecPoint::dounicodetomultibyte(bool p_native, bool p_reverse)
{
	const char *t_input;
	t_input = getsvalue() . getstring();

	uint4 t_input_length;
	t_input_length = getsvalue() . getlength();

	uint4 t_output_length;
	if (p_reverse)
	{
		if (p_native)
			MCS_multibytetounicode(t_input, t_input_length, NULL, 0, t_output_length, LCH_ROMAN);
		else
			t_output_length = UTF8ToUnicode(t_input, t_input_length, NULL, 0);
	}
	else
	{
		if (p_native)
			MCS_unicodetomultibyte(t_input, t_input_length, NULL, 0, t_output_length, LCH_ROMAN);
		else
			t_output_length = UnicodeToUTF8((uint2 *)t_input, t_input_length, NULL, 0);
	}

	char *t_buffer;
	uint4 t_buffer_length;
	t_buffer_length = (t_output_length + EP_PAD) & EP_MASK;
	t_buffer = new char[t_buffer_length];

	if (p_reverse)
	{
		if (p_native)
			MCS_multibytetounicode(t_input, t_input_length, t_buffer, t_output_length, t_output_length, LCH_ROMAN);
		else
			t_output_length = UTF8ToUnicode(t_input, t_input_length, (uint2 *)t_buffer, t_output_length);
	}
	else
	{
		if (p_native)
			MCS_unicodetomultibyte(t_input, t_input_length, t_buffer, t_output_length, t_output_length, LCH_ROMAN);
		else
			t_output_length = UnicodeToUTF8((uint2 *)t_input, t_input_length, t_buffer, t_output_length);
	}

	delete buffer;

	buffer = t_buffer;
	size = t_buffer_length;

	svalue . set(buffer, t_output_length);
}
예제 #3
0
PTEntity::MultiLegOrder::MultiLegOrder( const trade::MultiLegOrder* pEntity )
{
	OrderId = Marshal::PtrToStringAnsi((IntPtr) (char *) pEntity->orderid().c_str());
	PortfolioId = Marshal::PtrToStringAnsi((IntPtr) (char *) pEntity->portfolioid().c_str());
	Quantity = pEntity->quantity();
	
	OpenOrderId = Marshal::PtrToStringAnsi((IntPtr) (char *) pEntity->openorderid().c_str());
	OpenDate = Marshal::PtrToStringAnsi((IntPtr) (char *) pEntity->opendate().c_str());
	Reason = static_cast<SubmitReason>(pEntity->reason());
	HasWarn = pEntity->haswarn();

	wchar_t* uniStr = UTF8ToUnicode(pEntity->statusmsg().c_str());
	StatusMsg = Marshal::PtrToStringAuto((IntPtr)uniStr);
	delete[] uniStr;

	Offset = static_cast<MlOrderOffset>(pEntity->offset());

	// legs
	List<Order^> ^legOrders = gcnew List<Order^>();
	int legCount = pEntity->legs_size();
	for(int i = 0; i < legCount; ++i)
	{
		Order^ o = gcnew Order(&(pEntity->legs(i)));
		legOrders->Add(o);
	}
	Legs = legOrders->ToArray();
}
예제 #4
0
	std::wstring UTF8ToUnicode(const char* str)
	{
		if ( !str )
		{
			return std::wstring(L"");
		}
		return UTF8ToUnicode(std::string(str));
	}
예제 #5
0
void xstring_utf8_to_unicode(XScriptVM* vm)
{
	CheckParam(string.utf8tounicode, 0, str, OP_TYPE_STRING);
	std::string s(stringRawValue(&str));
	std::wstring result = UTF8ToUnicode(s);
	XString* x = vm->NewXString((char*)result.c_str(), result.length() * sizeof(wchar_t));
	vm->setReturnAsValue(vm->ConstructValue(x));
}
예제 #6
0
int LcdFont::getRenderWidth(const char * text, const bool utf8_encoded)
{
	pthread_mutex_lock(&renderer->render_mutex);
	
// fribidi
#if defined (ENABLE_FRIBIDI)
	std::string Text = fribidiShapeChar(text, utf8_encoded);
	text = Text.c_str();
#endif	
	
	FT_Error err;
#ifdef FT_NEW_CACHE_API
	FTC_ScalerRec scaler;
	scaler.face_id = font.face_id;
	scaler.width   = font.width;
	scaler.height  = font.height;
	scaler.pixel   = true;

	err = FTC_Manager_LookupSize(renderer->cacheManager, &scaler, &size);
#else
	err = FTC_Manager_Lookup_Size(renderer->cacheManager, &font.font, &face, &size);
#endif
	if (err != 0)
	{ 
		dprintf(DEBUG_NORMAL, "LcdFont::getRenderWidth: FTC_Manager_Lookup_Size failed! (0x%x)\n", err);
		pthread_mutex_unlock(&renderer->render_mutex);
		return -1;
	}
	int x=0;
	for (; *text; text++)
	{
		FTC_SBit glyph;

		int unicode_value = UTF8ToUnicode(text, utf8_encoded);

		if (unicode_value == -1)
			break;

#ifdef FT_NEW_CACHE_API
		int index = FT_Get_Char_Index(size->face, unicode_value);
#else
		int index=FT_Get_Char_Index(face, unicode_value);
#endif

		if (!index)
			continue;
		if (getGlyphBitmap(index, &glyph))
		{
			dprintf(DEBUG_NORMAL, "LcdFont::getRenderWidth: failed to get glyph bitmap.\n");
			continue;
		}
    
		x+=glyph->xadvance+1;
	}
	pthread_mutex_unlock(&renderer->render_mutex);
	return x;
}
예제 #7
0
파일: srvcgi.cpp 프로젝트: bduck/livecode
static bool cgi_native_from_encoding(MCSOutputTextEncoding p_encoding, const char *p_text, uint32_t p_text_length, char *&r_native, uint32_t &r_native_length)
{
	bool t_success = true;

	uint8_t *t_native = NULL;
	uint32_t t_native_length = 0;

	if (p_encoding == kMCSOutputTextEncodingUTF8)
	{
		int32_t t_unicode_length;
		t_unicode_length = UTF8ToUnicode(p_text, p_text_length, NULL, 0);
		
		uint16_t *t_unicode = NULL;
		t_success = MCMemoryAllocate(t_unicode_length, t_unicode);
		if (t_success)
		{
			UTF8ToUnicode(p_text, p_text_length, t_unicode, t_unicode_length);
			t_success = MCConvertNativeFromUTF16(t_unicode, t_unicode_length / 2, t_native, t_native_length);
		}
		MCMemoryDeallocate(t_unicode);
	}
	else if (p_encoding == kMCSOutputTextEncodingWindows1252)
		t_success = MCConvertNativeFromWindows1252((uint8_t*)p_text, p_text_length, t_native, t_native_length);
	else if (p_encoding == kMCSOutputTextEncodingMacRoman)
		t_success = MCConvertNativeFromMacRoman((uint8_t*)p_text, p_text_length, t_native, t_native_length);
	else if (p_encoding == kMCSOutputTextEncodingISO8859_1)
		t_success = MCConvertNativeFromISO8859_1((uint8_t*)p_text, p_text_length, t_native, t_native_length);

	if (t_success)
	{
		r_native = (char*)t_native;
		r_native_length = t_native_length;
	}

	return t_success;
}
예제 #8
0
파일: BaseFile.cpp 프로젝트: zhangshpX/Test
//UTF8转换ANSI
char* UTF8ToANSI(const char* str)
{
	if (NULL == str)
	{
		return NULL;
	}
	char* result = NULL;
	wchar_t* pUTF16 = UTF8ToUnicode(str);
	if (pUTF16)
	{
		result = UnicodeToANSI(pUTF16);
		free(pUTF16);
		pUTF16 = NULL;
	}
	return result;
}
예제 #9
0
std::wstring XMLManager::GetStringTableID(int _index)
{
	ticpp::Element *parentElement = stringTableFile_.FirstChildElement("StaticData", false)->FirstChildElement("StringTable", false);
	ticpp::Iterator<ticpp::Element> child;
	child = child.begin(parentElement);
	int n = 0;
	while(n < _index)
	{
		child++;
		n++;
	}
	std::string tempid;
	child->GetValue(&tempid);
	std::wstring id;
	UTF8ToUnicode(tempid,id);
	return id;
}
예제 #10
0
파일: dirops.c 프로젝트: leedo/MoarVM
/* Create a directory recursively. */
void MVM_dir_mkdir(MVMThreadContext *tc, MVMString *path, MVMint64 mode) {
    char * const pathname = MVM_string_utf8_encode_C_string(tc, path);

#ifdef _WIN32
    /* Must using UTF8ToUnicode for supporting CJK Windows file name. */
    wchar_t *wpathname = UTF8ToUnicode(pathname);
    int str_len = wcslen(wpathname);

    if (str_len > MAX_PATH) {
        wchar_t  abs_dirname[4096]; /* 4096 should be enough for absolute path */
        wchar_t *lpp_part;

        /* You cannot use the "\\?\" prefix with a relative path,
         * relative paths are always limited to a total of MAX_PATH characters.
         * see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx */
        if (!GetFullPathNameW(wpathname, 4096, abs_dirname, &lpp_part)) {
            MVM_exception_throw_adhoc(tc, "Directory path is wrong: %d", GetLastError());
        }

        MVM_free(wpathname);

        str_len  = wcslen(abs_dirname);
        wpathname = (wchar_t *)MVM_malloc((str_len + 4) * sizeof(wchar_t));
        wcscpy(wpathname, L"\\\\?\\");
        wcscat(wpathname, abs_dirname);
    }

    if (!mkdir_p(wpathname, mode)) {
        DWORD error = GetLastError();
        if (error != ERROR_ALREADY_EXISTS) {
            MVM_free(pathname);
            MVM_free(wpathname);
            MVM_exception_throw_adhoc(tc, "Failed to mkdir: %d", error);
        }
    }
    MVM_free(wpathname);
#else

    if (mkdir_p(pathname, mode) == -1 && errno != EEXIST) {
        MVM_free(pathname);
        MVM_exception_throw_adhoc(tc, "Failed to mkdir: %d", errno);
    }

#endif
    MVM_free(pathname);
}
예제 #11
0
char* UTF8ToAnsi( const char* utf8String )
{
	//сначала преобразовываем utf8 в unicode
	wchar_t* unicodeString = UTF8ToUnicode(utf8String);
	if( unicodeString == 0 ) return 0;
	char* res = 0;  
	// тест на возможность преобразования
	int resLen = (int)pWideCharToMultiByte( 1251, 0, unicodeString, -1, 0, 0, 0, 0 );
	if( resLen == 0 ) return 0;
	// выделяем память
	res = STR::Alloc(resLen);
 	if( !res ) return 0;
	// преобразование
	if( !pWideCharToMultiByte( 1251, 0, unicodeString, -1, res, resLen, 0, 0))
	{
		STR::Free(res);
		res = 0;
	}
	return res;
}
예제 #12
0
파일: DLupClass.cpp 프로젝트: DLive/itbook
BOOL CDLupClass::getSerClass()
{
	CDLsyn getSer;
	if(!getSer.openSession(_T("dlive.sinaapp.com"),_T("test.php")))
	{
		AfxMessageBox(_T("链接服务器出错"));
		return FALSE;
	}
	Json::Value *val=new Json::Value();
	
	getSer.getClass((void *)val);
	for(int i=0;i<val->size();i++){
		string abc = (*val)[i]["name"].asString(); 
		wstring test=UTF8ToUnicode(abc);
		int index=m_pSelClass->AddString(test.c_str());
		(*val)[i]["term_id"].asString();
		m_pSelClass->SetItemData(index,atoi((*val)[i]["term_id"].asString().c_str()));
		m_pSelClass->SetCurSel(0);
	}
	return TRUE;
}
예제 #13
0
CString CStringConverter::stringToCString( string const &strSource )
{
	return UTF8ToUnicode( strSource.c_str() );

	/*
	 * another method
	wchar_t* pString(NULL);
	int iSize = ::MultiByteToWideChar(CP_ACP, 0, strSource.c_str(), -1, pString, 0);
	if(iSize > 0)
	{
		pString = new wchar_t[iSize + 1];
		iSize = ::MultiByteToWideChar(CP_ACP, 0, strSource.c_str(), -1, pString, iSize + 1);
		pString[iSize] = L'\0';
		CString strString = pString;
		delete[] pString;

		return strString;
	}
	return _T("");
	*/
}
//将Tag翻译为字符串,此处的Tag就是键值对中的键
LPWSTR ReadTagString(char *tagString)//pdf中#23代表'#'
{
	int index = 0;
	int len=(int)strlen(tagString);
	List output=InitList();//每个data是byte值
	while (index < len)
	{
		if (tagString[index] != '#')
		{
			AddNode(output,(void*)tagString[index] );
			index++;
		}
		else
		{
			if (tagString[index + 1] == '#')//正常pdf几乎不可能遇到的情况,两个#相连
			{
				AddNode(output,(void*)'#');
				AddNode(output,(void*)'#');
				index += 2;
			}
			else
			{
				if (!TestValid(Substring(tagString,index + 1, 2)))//如果不符合#00~#FF的形式,原样输出,正常pdf几乎不可能遇到的情况
				{
					AddNode(output,(void*)'#');
					AddNode(output,(void*)tagString[index+1]);
					AddNode(output,(void*)tagString[index+2]);
					index+=3;
				}
				else
				{
					AddNode(output,(void*)GetDecimal(Substring(tagString,index + 1, 2)));
					index += 3;
				}
			}
		}
	}
	return UTF8ToUnicode(CharListGetString(output));
}
예제 #15
0
파일: Font.cpp 프로젝트: caidongyun/SE
int UTF8StrToUnicodeStr(uint16_t * unicode_str, uint8_t * utf8_str, int unicode_str_size){
	uint16_t unicode = 0;
	int n = 0;
	int count = 0;
	unsigned char *s = NULL;
	unsigned short *e = NULL;

	s = utf8_str;
	e = unicode_str;

	if ((utf8_str) && (unicode_str))
	{
		while (*s)
		{
			if ((n = UTF8ToUnicode(&unicode, s, 4)) > 0)
			{
				if (++count >= unicode_str_size)
				{
					return count;
				}
				else
				{
					*e = (unsigned short)unicode;
					e++;
					*e = 0;

					s += n;
				}
			}
			else
			{
				/* Converting error occurs */
				return count;
			}
		}
	}

	return count;
}
예제 #16
0
파일: io.c 프로젝트: MattOates/MoarVM
MVMint64 MVM_platform_unlink(const char *pathname) {
    /* Must using UTF8ToUnicode for supporting CJK Windows file name. */
    wchar_t *wpathname = UTF8ToUnicode(pathname);
    int str_len = wcslen(wpathname);
    int r;
    DWORD attrs;


    if (str_len > MAX_PATH) {
        wchar_t  abs_wpathname[4096]; /* 4096 should be enough for absolute path */
        wchar_t *lpp_part;

        /* You cannot use the "\\?\" prefix with a relative path,
         * relative paths are always limited to a total of MAX_PATH characters.
         * see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx */
        if (!GetFullPathNameW(wpathname, 4096, abs_wpathname, &lpp_part)) {
            errno = ENOENT;
            return -1;
        }

        MVM_free(wpathname);

        str_len  = wcslen(abs_wpathname);
        wpathname = (wchar_t *)MVM_malloc((str_len + 4) * sizeof(wchar_t));
        wcscpy(wpathname, L"\\\\?\\");
        wcscat(wpathname, abs_wpathname);
    }

    attrs = GetFileAttributesW(wpathname);

    if (attrs == INVALID_FILE_ATTRIBUTES) {
        MVM_free(wpathname);
        errno = ENOENT;
        return -1;
    }
    else if (attrs & FILE_ATTRIBUTE_READONLY) {
        (void)SetFileAttributesW(wpathname, attrs & ~FILE_ATTRIBUTE_READONLY);

        r = DeleteFileW(wpathname);
        if (r == 0) {
            (void)SetFileAttributesW(wpathname, attrs);
        }

    } else {
        r = DeleteFileW(wpathname);
    }

    if (r == 0) {
        DWORD LastError = GetLastError();
        MVM_free(wpathname);

        if (LastError == ERROR_FILE_NOT_FOUND) {
            errno = ENOENT;
        }

        else if (LastError == ERROR_ACCESS_DENIED) {
            errno = EACCES;
        }

        return -1;
    }

    MVM_free(wpathname);

    return 0;
}
예제 #17
0
BOOL CPostData::UseHttpSendReqEx( std::string& lpost)
{
	long lgg;
	lgg = lpost.size();

	USES_CONVERSION;
	INTERNET_BUFFERS BufferIn;
	DWORD dwBytesWritten;

	BOOL bRet;

	TCHAR head[1024];        
	std::wstring strt = MS_CONTENTTYPE;
	std::wstring strt1 = CA2W(CSNManager::GetInstance()->GetSN().c_str());
	_stprintf_s(head, _countof(head), _T("%s\r\nSN: %s;\r\nMoneyhubUID: %s;\r\n"), strt.c_str() ,strt1.c_str() ,m_strHWID.c_str());
	//TCHAR head[]= strt.c_str(); 

	BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
    BufferIn.Next = NULL; 
    BufferIn.lpcszHeader = head;
    BufferIn.dwHeadersLength = 0;
    BufferIn.dwHeadersTotal = sizeof(head);
    BufferIn.lpvBuffer = (LPSTR)lpost.c_str();                
    BufferIn.dwBufferLength = 0;
    BufferIn.dwBufferTotal = lgg; // This is the only member used other than dwStructSize
    BufferIn.dwOffsetLow = 0;
    BufferIn.dwOffsetHigh = 0;

    if(!HttpSendRequestEx( m_hInetFile, &BufferIn, NULL, 0, 2))
    {
		CloseHandles();
        printf( "Error on HttpSendRequestEx %d\n",GetLastError() );
        return FALSE;
    }

	bRet=TRUE;
	bRet = InternetWriteFile( m_hInetFile, (LPSTR)lpost.c_str(), lgg, &dwBytesWritten);

	if(!bRet)
	{
     	CloseHandles();
        printf( "\nError on InternetWriteFile %lu\n",GetLastError() );
        return FALSE;
    }

	bRet = HttpEndRequest(m_hInetFile, NULL, 0, 0);
    if(!bRet)
    {
    	CloseHandles();
        printf( "Error on HttpEndRequest %lu \n", GetLastError());
        return FALSE;
    }

		char pcBuffer[BUFFSIZE];
		DWORD dwBytesRead;
	    LPSTR	lpszData1;
		lpszData1 = new char[1024*1024];
		lpszData1[0]='\0';

		//printf("\nThe following was returned by the server:\n");
		do
		{	dwBytesRead=0;
			if(InternetReadFile(m_hInetFile, pcBuffer, BUFFSIZE-1, &dwBytesRead))
			{
				pcBuffer[dwBytesRead]=0x00; // Null-terminate buffer
        		strcat(lpszData1,pcBuffer);
				//printf("%s", pcBuffer);
			}
			else
                return FALSE;
				//lpszData1 ="";
				//printf("\nInternetReadFile failed");
		}while(dwBytesRead>0);
		//printf("\n");
		lpost = "";
		lpost = CW2A(UTF8ToUnicode(lpszData1).c_str());
	    delete []lpszData1;

	CloseHandles();
	//return  ERR_SUCCESS;
	return TRUE;
}
예제 #18
0
void LcdFont::RenderString(int x, int y, const int width, const char * text, const int color, const int selected, const bool utf8_encoded)
{
	int err;
	pthread_mutex_lock(&renderer->render_mutex);

#ifdef FT_NEW_CACHE_API
	FTC_ScalerRec scaler;

	scaler.face_id = font.face_id;
	scaler.width   = font.width;
	scaler.height  = font.height;
	scaler.pixel   = true;

	if ((err = FTC_Manager_LookupSize(renderer->cacheManager, &scaler, &size)) != 0)
#else
	if ((err=FTC_Manager_Lookup_Size(renderer->cacheManager, &font.font, &face, &size))!=0)
#endif
	{ 
		printf("FTC_Manager_Lookup_Size failed! (%d)\n",err);
		pthread_mutex_unlock(&renderer->render_mutex);
		return;
	}
	int left=x, step_y=(size->metrics.height >> 6 )*3/4 + 4;

	int pos =0;
	for (; *text; text++)
	{
		pos++;
		FTC_SBit glyph;
		//if ((x + size->metrics.x_ppem > (left+width)) || (*text=='\n'))
		if (x + size->metrics.x_ppem > (left+width))
		{ //width clip
			break;
		}
		if (*text=='\n')
		{
		  x  = left;
		  y += step_y;
		}

		int unicode_value = UTF8ToUnicode(text, utf8_encoded);

		if (unicode_value == -1)
			break;

#ifdef FT_NEW_CACHE_API
		int index = FT_Get_Char_Index(size->face, unicode_value);
#else
		int index = FT_Get_Char_Index(face, unicode_value);
#endif

		if (!index)
		  continue;
		if (getGlyphBitmap(index, &glyph))
		{
		  printf("failed to get glyph bitmap.\n");
		  continue;
		}
    
		int rx=x+glyph->left;
		int ry=y-glyph->top;
		if(pos==selected)
		{
			framebuffer->draw_fill_rect(x-2,y-glyph->height-2, x+glyph->width+2, y+2, CLCDDisplay::PIXEL_INV );
		}
		
		for (int ay=0; ay<glyph->height; ay++)
		{
			int ax=0;
			int w=glyph->width;
			int xpos = rx;
			for (; ax<w; ax++)
			{
				unsigned char c = glyph->buffer[ay*abs(glyph->pitch)+(ax>>3)];
				if((c>>(7-(ax&7)))&1)
				framebuffer->draw_point(xpos,ry, color);
				xpos ++;
			}
		ry++;
		}

		x+=glyph->xadvance+1;
	}
	pthread_mutex_unlock(&renderer->render_mutex);
}
예제 #19
0
파일: DLsyn.cpp 프로젝트: DLive/npadBook
bool CDLsyn::upFileToLoc(CStringArray &data){
	CConndb db;
	CString gsql;
	CString key;
	for(int j=0;j<data.GetCount();j++){
		key+=data.GetAt(j);
		key+=_T(",");
	}
	key.Delete(key.GetLength()-1,1);
	gsql.Format(_T("select uniquetag from articles where id IN(%s)"),key);
	db.search(gsql);
	if(db.m_query->eof())
	{
		return false;
	}
	int i=0;
	CString uniquetag,uniquetags;
	_variant_t var;
	while(!db.m_query->eof())
	{
		var=db.m_query->getStringField(_T("uniquetag"));
		if(var.vt!=VT_NULL)
			uniquetag=(LPCSTR)_bstr_t(var);
		uniquetags+=_T("'");
		uniquetags+=uniquetag;
		uniquetags+=_T("',");
		db.m_query->nextRow();
	}
	uniquetags.Delete(uniquetags.GetLength()-1,1);
	CString strFormData=_T("ac=upsome&uniques=");
	strFormData+=uniquetags;
	char *tmpdata=unicodeToUtf8(strFormData.GetBuffer());
	BOOL result = m_pFile->SendRequest(m_strHeaders,(LPVOID)tmpdata,strlen(tmpdata));
	if(result == FALSE) return false;
	
	free(tmpdata);
	DWORD dwRet;
	m_pFile->QueryInfoStatusCode(dwRet);
	//返回错误没处理! 哈哈
	CStringA m_strHtml="";
	char szBuff[1024];
	UINT nRead;
	while ((nRead = m_pFile->Read(szBuff,1024))>0)
	{
		m_strHtml+=CStringA(szBuff,nRead);
		memset(szBuff,'\0',1024);
	}
	char *retdata=m_strHtml.GetBuffer();//UTF8ToUnicode(m_strHtml.GetBuffer());//"[{\"term_id\":\"1\",\"name\":\"\u672a\u5206\u7c7b\"},{\"term_id\":\"4\",\"name\":\"\u7f51\u7edc\u5b89\u5168\"}]";//unicodeToUtf8(m_strHtml.GetBuffer());
	Json::Reader reader; 
	Json::Value value; 
	//reader.parse(m_strHtml.GetBuffer(), value);
	if(reader.parse(retdata, value)) 
	{ 
		
		CString sql;
		std::string tmpvalue;
		for(int i=0; i<value.size(); i++) 
		{
			tmpvalue = value[i]["post_title"].asString(); 
			wstring titlename=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["post_content"].asString(); 
			CString contenttext=UTF8ToUnicode(tmpvalue).c_str();
			//tmpvalue = value[i]["name"].asString(); 
			//wstring rclassid=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring data=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["uniquetag"].asString(); 
			wstring uniquetag=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["post_date"].asString(); 
			wstring post_date=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring artype=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring m_keyword=UTF8ToUnicode(tmpvalue);
			contenttext.Replace(_T("'"),_T("''"));

			sql.Format(_T("update articles set title='%s',content='%s',addtime='%s' where uniquetag=%s"),
				titlename.c_str(),contenttext.GetBuffer(),post_date.c_str(),uniquetag.c_str());
			db.excuteSql(sql);
		} 
	} 

	if (dwRet == HTTP_STATUS_OK)
	{
		return true;
	}
	return true;
}
예제 #20
0
int isValidUTF8(char *text) {
	while (*text)
		if (-1 == UTF8ToUnicode(&text, 1))
			return 0;
	return 1;
}
void ZombieEscapeRedraw()
{
	// Check Mod
	if(g_iMod != 10) return;

	// First Make Start Pos
	int iX,iY;
	iY = 100;
	iX = (g_sScreenInfo.iWidth - g_Texture[g_ze_bar].iWidth)/2;

	// Draw Bar & Flag
	MH_DrawTGAFunction(g_Texture[g_ze_bar].iTexture,255,255,255,255,iX,iY,1);
	
	/*Tri_Enable(GL_TEXTURE_2D);
	Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_bar].texid);
	gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
	Tri_Enable(GL_BLEND);
	Tri_Enable(GL_ALPHA_TEST);
	Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
	Tri_AlphaFunc(GL_GREATER, 0.0);
	gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
	gEngfuncs.pTriAPI->TexCoord2f(0,1);
	gEngfuncs.pTriAPI->Vertex3f(iX,iY+g_MHTga[g_ze_bar].height,0);

	gEngfuncs.pTriAPI->TexCoord2f(0,0);
	gEngfuncs.pTriAPI->Vertex3f(iX ,iY,0);

	gEngfuncs.pTriAPI->TexCoord2f(1,0);
	gEngfuncs.pTriAPI->Vertex3f(iX+g_MHTga[g_ze_bar].width,iY,0);

	gEngfuncs.pTriAPI->TexCoord2f(1,1);
	gEngfuncs.pTriAPI->Vertex3f(iX+g_MHTga[g_ze_bar].width,g_MHTga[g_ze_bar].height+iY,0);
		
	gEngfuncs.pTriAPI->End();*/

	int iTempX = iX;
	int iTempY = iY;
	iTempX = iX + g_Texture[g_ze_bar].iWidth - 53;
	iTempY -=26 ;
	

	MH_DrawTGAFunction(g_Texture[g_ze_flag].iTexture,255,255,255,255,iTempX,iTempY,1);
	/*Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_flag].texid);
	Tri_Enable(GL_BLEND);
	Tri_Enable(GL_ALPHA_TEST);
	Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
	Tri_AlphaFunc(GL_GREATER, 0.0);
	gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
	gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
	gEngfuncs.pTriAPI->TexCoord2f(0,1);
	gEngfuncs.pTriAPI->Vertex3f(iTempX,iTempY+g_MHTga[g_ze_flag].height,0);

	gEngfuncs.pTriAPI->TexCoord2f(0,0);
	gEngfuncs.pTriAPI->Vertex3f(iTempX ,iTempY,0);

	gEngfuncs.pTriAPI->TexCoord2f(1,0);
	gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_flag].width,iTempY,0);

	gEngfuncs.pTriAPI->TexCoord2f(1,1);
	gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_flag].width,g_MHTga[g_ze_flag].height+iTempY,0);*/
		
	gEngfuncs.pTriAPI->End();

	static int m_point[20][3];
	static float fNearst = 9999.0f;
	static int iLocalPos;
	int iIndex = gEngfuncs.GetLocalPlayer()->index;
	

	if(g_iZeCheck < g_flTime)
	{
		memset(m_point,0,sizeof(m_point));
		g_iZeCheck = g_flTime + 0.1f;
		//
		for ( int i = 1; i < MAX_PLAYERS; i++ )
		{
			gEngfuncs.pfnGetPlayerInfo( i, &g_PlayerInfoList[i] );
		
			if(g_PlayerInfoList[i].name == NULL) 
			{
				iValidPlayer[i] = 0;
				g_PlayerExtraInfo[i].frags = 0;
				continue;
			}
			iValidPlayer[i] = 1;
		}
		// Make Info
		for(int i =1;i<33;i++)
		{
			fNearst = 9999.0f;
			if(iValidPlayer[i] && !(g_PlayerExtraInfo[i].iFlag & SCOREATTRIB_DEAD))
			{

				static Vector vOrigin;
				int iPoint;
				vOrigin = gEngfuncs.GetEntityByIndex(i)->origin;

				for(int k = 0;k<20;k++)
				{
					static Vector iTemp2;
					iTemp2[0] = vOrigin[0] - g_ZePoint[k][0];
					iTemp2[1] = vOrigin[1] - g_ZePoint[k][1];
					iTemp2[2] = vOrigin[2] - g_ZePoint[k][2];
					float fDis = iTemp2.Length();
					if(fDis < fNearst)
					{
						fNearst = fDis;
						iPoint = k;
					}
				}
				if( (g_player_lastcount[i]-iPoint)>1 || (g_player_lastcount[i]-iPoint)<-1)
				{
					iPoint = g_player_lastcount[i];
				}
				else g_player_lastcount[i] = iPoint;
				// Check Team
				if(vPlayer[i].team == 1)
				{
					m_point[iPoint][1]++;
				}
				else if(vPlayer[i].team == 2)
				{
					m_point[iPoint][2]++;
				}
				if(iIndex == i) iLocalPos = iPoint;
			}
		}
	}

	for(int j =0 ;j<20;j++)
	{
		if(m_point[j][1])
		{
			// Human
			iTempX = iX + 53;
			iTempY = iY - 18 ;

			iTempX = iTempX + 21 * j;

			MH_DrawTGAFunction(g_Texture[g_ze_hm].iTexture,255,255,255,255,iTempX,iTempY,1);
			
			/*gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
			Tri_Enable(GL_BLEND);
			Tri_Enable(GL_ALPHA_TEST);
			Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
			Tri_AlphaFunc(GL_GREATER, 0.0);
			
			Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_hm].texid);
			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(iTempX,iTempY+g_MHTga[g_ze_hm].height,0);
	
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(iTempX ,iTempY,0);

			gEngfuncs.pTriAPI->TexCoord2f(1,0);
			gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_hm].width,iTempY,0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_hm].width,g_MHTga[g_ze_hm].height+iTempY,0);
		
			gEngfuncs.pTriAPI->End();
			gEngfuncs.pfnDrawSetTextColor(1.0f,1.0f,1.0f);*/
			char p[3];
			sprintf(p,"%d",m_point[j][1]);
			iTempX += 16;
			iTempY += 24;

			if(m_point[j][1]>9)
			{
				iTempX -= 3;
			}
			Fonts_SetColor(255,255,255,255);
			Fonts_SetSize(14,14);
			Fonts_Draw(UTF8ToUnicode(p),iTempX, iTempY,100,100);
		}
		if(m_point[j][2])
		{
			// Zombie
			iTempX = iX + 53;
			iTempY = 20 +iY ;

			iTempX = iTempX + 21 * j;

			MH_DrawTGAFunction(g_Texture[g_ze_zb].iTexture,255,255,255,255,iTempX,iTempY,1);
			/*Tri_Enable(GL_TEXTURE_2D);
			Tri_Enable(GL_BLEND);
			Tri_Enable(GL_ALPHA_TEST);
			Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
			Tri_AlphaFunc(GL_GREATER, 0.0);
			
			Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_zb].texid);
			gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
			gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
			gEngfuncs.pTriAPI->TexCoord2f(0,1);
			gEngfuncs.pTriAPI->Vertex3f(iTempX,iTempY+g_MHTga[g_ze_zb].height,0);
	
			gEngfuncs.pTriAPI->TexCoord2f(0,0);
			gEngfuncs.pTriAPI->Vertex3f(iTempX ,iTempY,0);

			gEngfuncs.pTriAPI->TexCoord2f(1,0);
			gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_zb].width,iTempY,0);

			gEngfuncs.pTriAPI->TexCoord2f(1,1);
			gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_zb].width,g_MHTga[g_ze_zb].height+iTempY,0);
		
			gEngfuncs.pTriAPI->End();*/
			char p[3];
			sprintf(p,"%d",m_point[j][2]);
			iTempX += 16;
			iTempY += 24;

			if(m_point[j][2]>9)
			{
				iTempX -= 3;
			}
			Fonts_SetColor(255,255,255,255);
			Fonts_SetSize(14,14);
			Fonts_Draw(UTF8ToUnicode(p),iTempX, iTempY,100,100);
		}
	}
	// Draw Me
	
	if(iValidPlayer[iIndex] && !(g_PlayerExtraInfo[iIndex].iFlag & SCOREATTRIB_DEAD) && vPlayer[iIndex].team == 2)
	{
		iTempX = iX + 53;
		iTempY = 20 +iY ;
		iTempX = iTempX + 21 * iLocalPos;


		MH_DrawTGAFunction(g_Texture[g_ze_me].iTexture,255,255,255,255,iTempX,iTempY,1);
		/*Tri_Enable(GL_TEXTURE_2D);
		Tri_Enable(GL_BLEND);
		Tri_Enable(GL_ALPHA_TEST);
		Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
		Tri_AlphaFunc(GL_GREATER, 0.0);

		Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_me].texid);
		gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(iTempX,iTempY+g_MHTga[g_ze_me].height,0);
	
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(iTempX ,iTempY,0);

		gEngfuncs.pTriAPI->TexCoord2f(1,0);
		gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_me].width,iTempY,0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_me].width,g_MHTga[g_ze_me].height+iTempY,0);
		
		gEngfuncs.pTriAPI->End();*/
	}
	if(iValidPlayer[iIndex] && !(g_PlayerExtraInfo[iIndex].iFlag & SCOREATTRIB_DEAD) && vPlayer[iIndex].team == 1)
	{
		iTempX = iX + 53;
		iTempY = iY - 18 ;

		iTempX = iTempX + 21 * iLocalPos;

		MH_DrawTGAFunction(g_Texture[g_ze_me].iTexture,255,255,255,255,iTempX,iTempY,1);
		/*Tri_Enable(GL_TEXTURE_2D);
		Tri_Enable(GL_BLEND);
		Tri_Enable(GL_ALPHA_TEST);
		Tri_BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 
		Tri_AlphaFunc(GL_GREATER, 0.0);
		Tri_BindTexture(GL_TEXTURE_2D, g_MHTga[g_ze_me].texid);
		gEngfuncs.pTriAPI->Color4ub(255,255,255,255);
		gEngfuncs.pTriAPI->Begin(TRI_QUADS);
		
		gEngfuncs.pTriAPI->TexCoord2f(0,1);
		gEngfuncs.pTriAPI->Vertex3f(iTempX,iTempY+g_MHTga[g_ze_me].height,0);
	
		gEngfuncs.pTriAPI->TexCoord2f(0,0);
		gEngfuncs.pTriAPI->Vertex3f(iTempX ,iTempY,0);

		gEngfuncs.pTriAPI->TexCoord2f(1,0);
		gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_me].width,iTempY,0);

		gEngfuncs.pTriAPI->TexCoord2f(1,1);
		gEngfuncs.pTriAPI->Vertex3f(iTempX+g_MHTga[g_ze_me].width,g_MHTga[g_ze_me].height+iTempY,0);
		
		gEngfuncs.pTriAPI->End();
		glDisable(GL_BLEND);
		glDisable(GL_ALPHA_TEST);*/
	}
	return;
}
예제 #22
0
파일: dirops.c 프로젝트: leedo/MoarVM
/* Open a filehandle, returning a handle. */
MVMObject * MVM_dir_open(MVMThreadContext *tc, MVMString *dirname) {
    MVMOSHandle  * const result = (MVMOSHandle *)MVM_repr_alloc_init(tc, tc->instance->boot_types.BOOTIO);
    MVMIODirIter * const data   = calloc(1, sizeof(MVMIODirIter));
#ifdef _WIN32
    char *name;
    int str_len;
    wchar_t *wname;
    wchar_t *dir_name;

    name  = MVM_string_utf8_encode_C_string(tc, dirname);
    wname = UTF8ToUnicode(name);
    MVM_free(name);

    str_len = wcslen(wname);

    if (str_len > MAX_PATH - 2) { // the length of later appended '\*' is 2
        wchar_t  abs_dirname[4096]; /* 4096 should be enough for absolute path */
        wchar_t *lpp_part;

        /* You cannot use the "\\?\" prefix with a relative path,
         * relative paths are always limited to a total of MAX_PATH characters.
         * see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247%28v=vs.85%29.aspx */
        if (!GetFullPathNameW(wname, 4096, abs_dirname, &lpp_part)) {
            MVM_free(wname);
            MVM_exception_throw_adhoc(tc, "Directory path is wrong: %d", GetLastError());
        }
        MVM_free(wname);

        str_len  = wcslen(abs_dirname);
        dir_name = (wchar_t *)MVM_malloc((str_len + 7) * sizeof(wchar_t));
        wcscpy(dir_name, L"\\\\?\\");
        wcscat(dir_name, abs_dirname);
    } else {
        dir_name = (wchar_t *)MVM_malloc((str_len + 3) * sizeof(wchar_t));
        wcscpy(dir_name, wname);
        MVM_free(wname);
    }

    wcscat(dir_name, L"\\*");     /* Three characters are for the "\*" plus NULL appended.
                                   * see http://msdn.microsoft.com/en-us/library/windows/desktop/aa365200%28v=vs.85%29.aspx */

    data->dir_name   = dir_name;
    data->dir_handle = INVALID_HANDLE_VALUE;

#else
    char * const dir_name = MVM_string_utf8_encode_C_string(tc, dirname);
    DIR * const dir_handle = opendir(dir_name);
    MVM_free(dir_name);

    if (!dir_handle)
        MVM_exception_throw_adhoc(tc, "Failed to open dir: %d", errno);

    data->dir_handle = dir_handle;
#endif

    data->encoding = MVM_encoding_type_utf8;
    result->body.ops  = &op_table;
    result->body.data = data;

    return (MVMObject *)result;
}
예제 #23
0
char* UTF8ToANSI(const char* str)
{
	return UnicodeToANSI(UTF8ToUnicode(str));
}
예제 #24
0
파일: DLsyn.cpp 프로젝트: DLive/npadBook
BOOL CDLsyn::upClassFileToLocal(CString cid){
	CConndb db;
	CString gsql;
	gsql.Format(_T("select distancecid from class where id=%s"),cid);
	db.search(gsql);
	if(db.m_query->eof())
		return false;
	int i=0;
	_variant_t var;
	CString rid;
	while(!db.m_query->eof())
	{
		var=db.m_query->getStringField(_T("distancecid"));
		if(var.vt!=VT_NULL)
			rid=(LPCSTR)_bstr_t(var);
		db.m_query->nextRow();
	}
	CString strFormData=_T("ac=upclasstoloc&cid=");
	strFormData+=rid;
	char *tmpdata=unicodeToUtf8(strFormData.GetBuffer());
	BOOL result = m_pFile->SendRequest(m_strHeaders,(LPVOID)tmpdata,strlen(tmpdata));
	if(result == FALSE) return false;
	free(tmpdata);
	DWORD dwRet;
	m_pFile->QueryInfoStatusCode(dwRet);
	//返回错误没处理! 哈哈
	CStringA m_strHtml="";
	char szBuff[1024];
	UINT nRead;
	while ((nRead = m_pFile->Read(szBuff,1024))>0)
	{
		m_strHtml+=CStringA(szBuff,nRead);
		memset(szBuff,'\0',1024);
	}
	char *retdata=m_strHtml.GetBuffer();//UTF8ToUnicode(m_strHtml.GetBuffer());//"[{\"term_id\":\"1\",\"name\":\"\u672a\u5206\u7c7b\"},{\"term_id\":\"4\",\"name\":\"\u7f51\u7edc\u5b89\u5168\"}]";//unicodeToUtf8(m_strHtml.GetBuffer());
	Json::Reader reader; 
	Json::Value value; 
	//reader.parse(m_strHtml.GetBuffer(), value);
	if(reader.parse(retdata, value)) 
	{ 
		CString sql;
		std::string tmpvalue;
		for(int i=0; i<value.size(); i++) 
		{
			tmpvalue = value[i]["post_title"].asString(); 
			wstring titlename=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["post_content"].asString(); 
			CString contenttext=UTF8ToUnicode(tmpvalue).c_str();
			//tmpvalue = value[i]["name"].asString(); 
			//wstring rclassid=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring data=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["uniquetag"].asString(); 
			wstring uniquetag=UTF8ToUnicode(tmpvalue);
			tmpvalue = value[i]["post_date"].asString(); 
			wstring post_date=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring artype=UTF8ToUnicode(tmpvalue);
			//tmpvalue = value[i]["name"].asString(); 
			//wstring m_keyword=UTF8ToUnicode(tmpvalue);
			contenttext.Replace(_T("'"),_T("''"));
			if(uniquetag.empty()){
				SYSTEMTIME sysTime;
				GetLocalTime(&sysTime);
				CTime m_tTime(sysTime);
				time_t unixTime = m_tTime.GetTime();
				CString utag;
				utag.Format(_T("%d"),unixTime);
				sql.Format(_T("insert into articles (title,content,addtime,classid,artitletype,uniquetag) values ('%s','%s','%s','%s','txt','%s')"),
					titlename.c_str(),contenttext.GetBuffer(),post_date.c_str(),cid,utag);
				//db.excuteSql(sql);
				db.insert(sql);
			}else{
				sql.Format(_T("update articles set title='%s',content='%s',addtime='%s' where uniquetag=%s"),
					titlename.c_str(),contenttext.GetBuffer(),post_date.c_str(),uniquetag.c_str());
				db.excuteSql(sql);
			}
			
		} 
	} 

	if (dwRet == HTTP_STATUS_OK)
	{
		return true;
	}
	return true;
}
예제 #25
0
BOOL CPostData::UseHttpSendReqEx( std::string& lpost)
{
	USES_CONVERSION;
	long lgg;					CString strtemp;
	lgg = lpost.size();

	INTERNET_BUFFERS BufferIn;
	DWORD dwBytesWritten;

	BOOL bRet;

	TCHAR head[1024];        
	std::wstring strt = MS_CONTENTTYPE;
	std::wstring strt1 = CA2W(CSNManager::GetInstance()->GetSN().c_str());
	//_stprintf_s(head, _countof(head), _T("%s\r\nSN: %s;\r\nMoneyhubuid: %s;\r\n"), strt.c_str() ,strt1.c_str() ,m_strHWID.c_str());
	_stprintf_s(head, _countof(head), _T("Sn: %s\r\nMoneyhubuid: %s\r\n"), strt1.c_str() ,m_strHWID.c_str());
	//TCHAR head[]= strt.c_str(); 

	BufferIn.dwStructSize = sizeof( INTERNET_BUFFERS ); // Must be set or error will occur
    BufferIn.Next = NULL; 
    BufferIn.lpcszHeader = head;
    BufferIn.dwHeadersLength = 0;
    BufferIn.dwHeadersTotal = sizeof(head);
    BufferIn.lpvBuffer = (LPSTR)lpost.c_str();                
    BufferIn.dwBufferLength = 0;
    BufferIn.dwBufferTotal = lgg; // This is the only member used other than dwStructSize
    BufferIn.dwOffsetLow = 0;
    BufferIn.dwOffsetHigh = 0;

	DWORD dwFlags = 0;
		DWORD dwBuffLen = sizeof(dwFlags);
		InternetQueryOption (m_hInetFile, INTERNET_OPTION_SECURITY_FLAGS,
			(LPVOID)&dwFlags, &dwBuffLen);

		dwFlags |=	(SECURITY_FLAG_IGNORE_UNKNOWN_CA | SECURITY_FLAG_IGNORE_CERT_CN_INVALID);
		InternetSetOption (m_hInetFile, INTERNET_OPTION_SECURITY_FLAGS, &dwFlags, sizeof (dwFlags) );

    if(!HttpSendRequestEx( m_hInetFile, &BufferIn, NULL, 0, 0))
    {
		strtemp.Format(_T("Error on HttpSendRequestEx %d\n"),GetLastError()); 
		int nLen = strtemp.GetLength();
		strt =strtemp.GetBuffer(nLen);
		strtemp.ReleaseBuffer();
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, strt);
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, L"HttpSendRequestEx");
		CloseHandles();
        printf( "Error on HttpSendRequestEx %d\n",GetLastError() );
        return FALSE;
    }

	bRet=TRUE;
	bRet = InternetWriteFile( m_hInetFile, (LPSTR)lpost.c_str(), lgg, &dwBytesWritten);

	if(!bRet)
	{
		strtemp.Format(_T("Error on HttpSendRequestEx %d\n"),GetLastError()); 
		int nLen = strtemp.GetLength();
		strt =strtemp.GetBuffer(nLen);
		strtemp.ReleaseBuffer();
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, strt);
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, L"HttpSendRequestEx  InternetWriteFile");
     	CloseHandles();
        printf( "\nError on InternetWriteFile %lu\n",GetLastError() );
        return FALSE;
    }

	bRet = HttpEndRequest(m_hInetFile, NULL, 0, 0);
    if(!bRet)
    {
		strtemp.Format(_T("Error on HttpSendRequestEx %d\n"),GetLastError()); 
		int nLen = strtemp.GetLength();
		strt =strtemp.GetBuffer(nLen);
		strtemp.ReleaseBuffer();
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, strt);
		CRecordProgram::GetInstance()->RecordWarnInfo(MY_PRO_NAME, MY_COMMON_ERROR, L"HttpSendRequestEx   HttpEndRequest");
    	CloseHandles();
        printf( "Error on HttpEndRequest %lu \n", GetLastError());
        return FALSE;
    }

		char pcBuffer[BUFFSIZE];
		DWORD dwBytesRead;
	    LPSTR	lpszData1;
		lpszData1 = new char[1024*1024];
		lpszData1[0]='\0';

		//printf("\nThe following was returned by the server:\n");
		do
		{	dwBytesRead=0;
			if(InternetReadFile(m_hInetFile, pcBuffer, BUFFSIZE-1, &dwBytesRead))
			{
				pcBuffer[dwBytesRead]=0x00; // Null-terminate buffer
        		strcat(lpszData1,pcBuffer);
				//printf("%s", pcBuffer);
			}
			else
                return FALSE;
				//lpszData1 ="";
				//printf("\nInternetReadFile failed");
		}while(dwBytesRead>0);
		//printf("\n");
		lpost = "";
		lpost = CW2A(UTF8ToUnicode(lpszData1).c_str());
	    delete []lpszData1;

	CloseHandles();
	//return  ERR_SUCCESS;
	return TRUE;
}