当前位置: 首页>>代码示例>>C++>>正文


C++ s2ws函数代码示例

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


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

示例1: request_custom_command

DWORD request_custom_command(Remote *remote, Packet *packet)
{
	Packet * response = packet_create_response(packet);
	Tlv argTlv             = {0};
	DWORD index            = 0;
	vector<wstring> args;

	LPCSTR func = packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION);
	dprintf("Function: %s", packet_get_tlv_value_string(packet, TLV_TYPE_MIMIKATZ_FUNCTION));
	wstring function = s2ws(func);

	while( packet_enum_tlv( packet, index++, TLV_TYPE_MIMIKATZ_ARGUMENT, &argTlv ) == ERROR_SUCCESS )
	{
		dprintf("Arg: %s", (PCHAR)argTlv.buffer);
		args.push_back(s2ws((PCHAR)argTlv.buffer));
	}

	clear_buffer();

	initialize_mimikatz();
	myMimiKatz->doCommandeLocale(&function, &args);

	wchar_t* output = convert_wstring_to_wchar_t(oss.str());
	
	clear_buffer();

	packet_add_tlv_raw(response, TLV_TYPE_MIMIKATZ_RESULT, output, (DWORD)(wcslen(output)*sizeof(wchar_t)));
	packet_transmit_response(ERROR_SUCCESS, remote, response);

	return ERROR_SUCCESS;	
}
开发者ID:AnwarMohamed,项目名称:metasploit-payloads,代码行数:31,代码来源:main.cpp

示例2: comp

static bool comp(string a, string b)
{
	bool ret;

	std::wstring stemp1 = s2ws(a);
	LPCWSTR lpa1 = stemp1.c_str();

	std::wstring stemp2 = s2ws(b);
	LPCWSTR lpa2 = stemp2.c_str();

	if (StrCmpLogicalW(lpa1, lpa2) >= 0)
	{
		ret = false;
	}
	else
	{
		ret = true;
	}

	if (reverseflag)
	{
		ret = !ret;
	}

	return ret;
}
开发者ID:OleNet,项目名称:IMVL-Framework,代码行数:26,代码来源:strnatsort.cpp

示例3: IniGetStr

bool CDlgModelPlayer::OnInitDialog()
{
	m_ComboBoxSkeleton.AddItem(L"");
	m_ComboBoxHead.AddItem(L"");
	m_ComboBoxSet.AddItem(L"");
	for (size_t i=0;i<ET_MAX;++i)
	{
		m_ComboBoxEquips[i].AddItem(L"");
	}
	m_ComboBoxLeftHand.AddItem(L"");
	m_ComboBoxRightHand.AddItem(L"");
	m_ComboBoxBack.AddItem(L"");
	std::set<std::wstring>	setString;

	std::string strDirMU = IniGetStr("WorldEditor.cfg","ResDir","mu");
	std::wstring wstrFindPath = s2ws(strDirMU)+L"Player\\";//|{"+wstrFileType+L"}";
	CDir dir;
	dir.ReadDir(wstrFindPath);
	for (size_t i=0; i<dir.m_FileInfo.size(); i++)
	{
		if (!dir.m_FileInfo[i].IsDirectory())
		{
			std::wstring wstrFilename = dir.m_FileInfo[i].wstrFilename;
			std::transform(wstrFilename.begin(),wstrFilename.end(),wstrFilename.begin(),std::toupper);
			//if (wstrFileType.find(GetExtension(dir.m_FileInfo[i].wstrFilename))!=std::wstring::npos)
			if (GetExtension(wstrFilename)==L".bmd")
			{
				if (wstrFilename.find(L"HELMCLASS")!=std::wstring::npos)
				{
					m_ComboBoxHead.AddItem(wstrFilename.c_str());
				}
				else if (wstrFilename.find(L"PLAYER")!=std::wstring::npos)
				{
					m_ComboBoxSkeleton.AddItem(wstrFilename.c_str());
				}
				else
				{
					for (size_t i=0;i<ET_MAX;++i)
					{
						if (wstrFilename.find(s2ws(g_EquipNames[i]))!=std::wstring::npos)
						{
							m_ComboBoxEquips[i].AddItem(wstrFilename.c_str());
							int index=wstrFilename.find(s2ws(g_EquipNames[i]));
							wstrFilename.replace(index, strlen(g_EquipNames[i]), L"*");
							setString.insert(wstrFilename);
							break;
						}
					}
				}
			}
		}
	}
	for (std::set<std::wstring>::iterator it=setString.begin();it!=setString.end();it++)
	{
		m_ComboBoxSet.AddItem(it->c_str());
	}
	return true;
}
开发者ID:50059021,项目名称:wodegongjubao,代码行数:58,代码来源:DlgModelPlayer.cpp

示例4: GuildInfo

//--------------------------------------------------------------------------------------//
//		Load Guild info
//--------------------------------------------------------------------------------------//
void CClientSession::SendLoadGuildInfo(CNtlPacket * pPacket, CChatServer * app)
{

	app->db->prepare("CALL GuildInfo (?, @guild_id,@guild_name,@guild_master,@guild_notice,@guild_rep,@second_guild_master)");
	app->db->setInt(1, this->GetCharacterId());
	app->db->execute();

	app->db->execute("SELECT @guild_id,@guild_name,@guild_master,@guild_notice,@guild_rep,@second_guild_master");
	app->db->fetch();

//Check if user inside guild
	if(app->db->getInt("@guild_id") != 0)
	{
	//SET GUILD INFO
		CNtlPacket packet(sizeof(sTU_GUILD_INFO));
		sTU_GUILD_INFO * res = (sTU_GUILD_INFO *)packet.GetPacketData();

		int guildID = app->db->getInt("@guild_id");
		this->guildName = app->db->getString("@guild_name");

		res->wOpCode = TU_GUILD_INFO;
		res->guildInfo.dwGuildReputation = app->db->getInt("@guild_rep");
		res->guildInfo.guildId = guildID;
		res->guildInfo.guildMaster = app->db->getInt("@guild_master");
		res->guildInfo.guildSecondMaster[0] = app->db->getInt("@second_guild_master");
		wcscpy_s(res->guildInfo.wszName, NTL_MAX_SIZE_GUILD_NAME_IN_UNICODE, s2ws(app->db->getString("@guild_name")).c_str());
		wcscpy_s(res->guildInfo.awchName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(this->GetCharName()).c_str());
		wcscpy_s(res->guildInfo.awchNotice, NTL_MAX_LENGTH_OF_GUILD_NOTICE_UNICODE, s2ws(app->db->getString("@guild_notice")).c_str());
		packet.SetPacketLen( sizeof(sTU_GUILD_INFO));
		int rc = g_pApp->Send( this->GetHandle(), &packet);
		printf("Guild ID: %i \n",guildID);

	//SET GUILD MEMBERS
		CNtlPacket packet2(sizeof(sTU_GUILD_MEMBER_INFO));
		sTU_GUILD_MEMBER_INFO * res2 = (sTU_GUILD_MEMBER_INFO *)packet2.GetPacketData();

		app->db->prepare("SELECT CharID,CharName,Level,Race,Class FROM characters WHERE GuildID = ?");
		app->db->setInt(1, guildID);
		app->db->execute();

		while(app->db->fetch())
		{
			res2->wOpCode = TU_GUILD_MEMBER_INFO;
			res2->guildMemberInfo.bIsOnline = true;
			res2->guildMemberInfo.byClass = app->db->getInt("Class");
			res2->guildMemberInfo.byLevel = app->db->getInt("Level");
			res2->guildMemberInfo.byRace = app->db->getInt("Race");
			res2->guildMemberInfo.charId = app->db->getInt("CharID");
			res2->guildMemberInfo.dwReputation = 0;
			wcscpy_s(res2->guildMemberInfo.wszMemberName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(app->db->getString("CharName")).c_str());

			packet2.SetPacketLen( sizeof(sTU_GUILD_MEMBER_INFO));
			rc = g_pApp->Send( this->GetHandle(), &packet2);
		}
	}

}
开发者ID:philipemassari,项目名称:AKCore-1,代码行数:60,代码来源:PacketChatServer.cpp

示例5: MessageBox

///////////////////////////////////////////////////////////
/// Warning Message Box
///////////////////////////////////////////////////////////
void MsgBox::Warning(std::string msg, std::string title) {
	if (msg.length() == 0) return;
	if (msg.length() == 1 && (msg[0] == '\n' || msg[0] == '\r')) return;
#ifdef UNICODE
	MessageBox(0, s2ws(msg).c_str(), s2ws(title).c_str(), MB_OK | MB_ICONEXCLAMATION);
#else
	MessageBox(0, msg.c_str(), title.c_str(), MB_OK | MB_ICONEXCLAMATION);
#endif
}
开发者ID:cstrahan,项目名称:argss,代码行数:12,代码来源:msgbox.cpp

示例6: s2ws

void TransfersDialog::populateList()
{
    vector<Transfer*> &transfers = Transfer::getTransfers();
    ListBox1->Clear();
    for (auto it : transfers) {
        wxString var = s2ws(it->getVarName());
        wxString descr = s2ws(it->getDescription());
        wxString src = s2ws(it->getSourceNameAlt());
        wxString dest = s2ws(it->getDestNameAlt());
        ListBox1->Append(descr + _(" (") + var + _(") : ") + src + _(" to ") + dest);
    }
}
开发者ID:Obson,项目名称:SimX,代码行数:12,代码来源:TransfersDialog.cpp

示例7: FindFirstFile

bool ZipResourceDepot::RegisterPackages(std::wstring basePackagePath)
{
	HANDLE fileHandle;
	WIN32_FIND_DATA findData;

	//Get first file
	std::wstring pathSpec = basePackagePath + L"*";
	fileHandle = FindFirstFile(pathSpec.c_str(), &findData);
	if (fileHandle != INVALID_HANDLE_VALUE)
	{
		//Loop on all remaining entries
		while (FindNextFile(fileHandle, &findData))
		{
			//Skip if file is hidden
			if (findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
			{
				continue;
			}

			//Do not currently support packages within directories, so throw Warning
			if (findData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
			{
				//Do not warn for directory symbol
				if (findData.cFileName != s2ws(".."))
				{
					BE_WARNING("Packages within Directories are ignored");
				}
			}
			else
			{
				std::wstring filename = findData.cFileName;
				std::wstring lowerPackageName = filename;

				std::transform(lowerPackageName.begin(), lowerPackageName.end(), lowerPackageName.begin(), (int(*)(int))std::tolower);
				lowerPackageName = lowerPackageName.substr(0, lowerPackageName.find_last_of('.'));

				pathSpec = pathSpec.substr(0, pathSpec.find_last_of('/'));
				pathSpec = pathSpec + s2ws("/") + filename;

				//Add Package to mapping
				m_packageMap[ws2s(lowerPackageName)] = PackageMappingDetails(m_numPackages, ws2s(pathSpec));
				m_numPackages++;
			}
		}
	}

	FindClose(fileHandle);


	return true;
}
开发者ID:jel-massih,项目名称:BombastEngine,代码行数:51,代码来源:ResourceDepot.cpp

示例8: initSoundManifest

//Parse our array of values to get the initial mappings
void initSoundManifest()
{
	//ofstream oHash("hash3.txt");
	for(u32 i = 0; i < NUM_MAPPINGS; i++)
	{
		g_mSoundIDToString[g_soundMap[i].id] = s2ws(g_soundMap[i].name);
		g_mStringToSoundID[s2ws(g_soundMap[i].name)] = g_soundMap[i].id;
		//oHash << "id: " << g_soundMap[i].id << ", filename: " << g_soundMap[i].name << ", filename hashed: " << hash(g_soundMap[i].name) << endl;
		//if(g_soundMap[i].id != hash(g_soundMap[i].name))
		//	oHash << "Hash failed." << endl;
		//else
		//	oHash << "Hash worked!" << endl;
	}
}
开发者ID:Haapavuo,项目名称:liTools,代码行数:15,代码来源:sndmanifest.cpp

示例9: remove

BOOL CCBitmapConvert::TranstToBMP(string srcPath,string destPath)
{
	remove(destPath.c_str());
	WCHAR wCH[255] = {0};
	WCHAR wCH1[255] = {0};
	wstring wstrPath = s2ws(srcPath);
	wcscpy(wCH,wstrPath.c_str());
	Image img(wCH);//这里的图片可以是其它格式	
	CLSID pngClsid;
	GetImageCLSID(L"image/bmp", &pngClsid);//这里的图片可以是其它格式,此处转化为BMP格式
	wstrPath = s2ws(destPath);
	wcscpy(wCH1, wstrPath.c_str());
	img.Save(wCH1, &pngClsid, NULL);
	return TRUE;
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:15,代码来源:CBitmapConvert.cpp

示例10: s2ws

int CellmlModelDefinition::loadModelFromString(const std::string &ms)
{
    std::cout << "Creating CellML Model Definition from the given model string"
              << std::endl;
    mUrl = "";
    std::wstring msW = s2ws(ms);
    ObjRef<iface::cellml_api::CellMLBootstrap> cb = CreateCellMLBootstrap();
    ObjRef<iface::cellml_api::DOMModelLoader> ml = cb->modelLoader();
    int code;
    try
    {
        ObjRef<iface::cellml_api::Model> model = ml->createFromText(msW);
        model->fullyInstantiateImports();
        // we have a model, so we can start grabbing hold of the CellML API objects
        mCapi = new CellmlApiObjects();
        mCapi->model = model;
        code = instantiateCellmlApiObjects();
    }
    catch (...)
    {
      std::wcerr << L"Error loading model from string." << std::endl;
      return -1;
    }
    return code;
}
开发者ID:nickerso,项目名称:csim,代码行数:25,代码来源:cellml_model_definition.cpp

示例11: pStg

void OIBReader::ReadSequenceOib()
{
   for (int i=0; i<(int)m_oib_info.size(); i++)
   {
      wstring path_name = m_oib_info[i].filename;

      if (path_name == m_path_name)
         m_cur_time = i;
	  
	   //storage
	   POLE::Storage pStg("temp_storage.txt"); 
	   //open
	   if (pStg.open()) {
		  //enumerate
		  std::list<std::string> entries = 
			  pStg.entries();
		  for(std::list<std::string>::iterator it = entries.begin();
			  it != entries.end(); ++it) {
                  m_oib_t = i;
			  if (!pStg.isDirectory(*it)) {
				  std::wstring st = s2ws(*it);
				  ReadStream(pStg,st);
			  }
		  }
	   }
	   //release
	   pStg.close();
   }
}
开发者ID:jefferis,项目名称:fluorender,代码行数:29,代码来源:oib_reader.cpp

示例12: s2ws

std::vector<std::string>* DataInDirectoryInvestigator::SearchFiles(std::string fileType){
	this->fileType = fileType;

	std::string searchQuery = dirPath;
	searchQuery.append(fileType);
	
	std::wstring stemp = s2ws(searchQuery);
	LPCWSTR DIRPATH = stemp.c_str();
	
	std::cout << "Searching Files in " << dirPath << std::endl;
	std::vector<std::string> * acquiredFilePaths = new std::vector<std::string>();

	HANDLE hFind;
	WIN32_FIND_DATA w32fd;
	hFind = FindFirstFile(DIRPATH, &w32fd);
	if( hFind != INVALID_HANDLE_VALUE){
		do {
			//std::cout << "cAlternateFileName : " << ws2s(w32fd.cAlternateFileName) << std::endl;
			//printf("ファイル名:%S\n", w32fd.cFileName);
			std::cout << "ファイル名: " << ws2s(w32fd.cFileName) << std::endl;
			acquiredFilePaths->push_back(ws2s(w32fd.cFileName));
		} while (FindNextFile (hFind, &w32fd));
		FindClose(hFind);
	}
	return acquiredFilePaths;
}
开发者ID:RozKen,项目名称:SATest,代码行数:26,代码来源:DataInDirectoryInvestigator.cpp

示例13: D3DReflect

//-----------------------------------------------------------------------------
bool CPUTShaderDX11::ShaderRequiresPerModelPayload( CPUTConfigBlock &properties )
{
    ID3D11ShaderReflection *pReflector = NULL;

    D3DReflect( mpBlob->GetBufferPointer(), mpBlob->GetBufferSize(), IID_ID3D11ShaderReflection, (void**)&pReflector);
    // Walk through the shader input bind descriptors.
    // If any of them begin with '@', then we need a unique material per model (i.e., we need to clone the material).
    int ii=0;
    D3D11_SHADER_INPUT_BIND_DESC desc;
    HRESULT hr = pReflector->GetResourceBindingDesc( ii++, &desc );
    while( SUCCEEDED(hr) )
    {
        cString tagName = s2ws(desc.Name);
        CPUTConfigEntry *pValue = properties.GetValueByName(tagName);
        if( !pValue->IsValid() )
        {
            // We didn't find our property in the file.  Is it in the global config block?
            pValue = CPUTMaterial::mGlobalProperties.GetValueByName(tagName);
        }
        cString boundName = pValue->ValueAsString();
        if( (boundName.length() > 0) && ((boundName[0] == '@') || (boundName[0] == '#')) )
        {
            return true;
        }
        hr = pReflector->GetResourceBindingDesc( ii++, &desc );
    }
    return false;
}
开发者ID:yumingsam,项目名称:OcclusionCulling,代码行数:29,代码来源:CPUTShaderDX11.cpp

示例14: dlopen

void *LibLoader::loadFromPath(const std::string & p)
{
	
	std::cout << "loading lib: " << p << std::endl;
#ifdef __unix
	void *lib;
	lib = dlopen(p.c_str(), RTLD_LAZY);
#elif _WIN32
	#ifdef UNICODE
	std::wstring stemp = s2ws(p);
	HINSTANCE lib = LoadLibrary(stemp.c_str());
	#else
	HINSTANCE lib = LoadLibrary(p.c_str());
	#endif
#endif
	if (!lib)
	{
		char *error;
		#ifdef __unix
		if ((error = dlerror()))
		#else
		if (!lib)
			error = "Cannot open the lib";
		#endif
			throw(MyException(error));
	}
	_libs[lib] = p;
	return lib;
}
开发者ID:MartinLestas,项目名称:Epitech_project,代码行数:29,代码来源:LibLoader.cpp

示例15: UpdateGuildNotice

//--------------------------------------------------------------------------------------//
//		Change guild notice
//--------------------------------------------------------------------------------------//
void CClientSession::SendGuildChangeNotice(CNtlPacket * pPacket, CChatServer * app)
{
	sUT_GUILD_CHANGE_NOTICE_REQ * req = (sUT_GUILD_CHANGE_NOTICE_REQ *)pPacket->GetPacketData();

	app->db->prepare("CALL UpdateGuildNotice (?,?, @wResultCode)");
	app->db->setInt(1, this->GetCharacterId());
	app->db->setString(2, Ntl_WC2MB(req->awchNotice));
	app->db->execute();

	app->db->execute("SELECT @wResultCode");
	app->db->fetch();

	CNtlPacket packet(sizeof(sTU_GUILD_CHANGE_NOTICE_RES));
	sTU_GUILD_CHANGE_NOTICE_RES * res = (sTU_GUILD_CHANGE_NOTICE_RES *)packet.GetPacketData();
	res->wOpCode = TU_GUILD_CHANGE_NOTICE_RES;
	res->wResultCode = app->db->getInt("@wResultCode");
	packet.SetPacketLen( sizeof(sTU_GUILD_CHANGE_NOTICE_RES));
	int rc = g_pApp->Send( this->GetHandle(), &packet);

	if(app->db->getInt("@wResultCode") == 300)
	{
		CNtlPacket packet2(sizeof(sTU_GUILD_CHANGE_NOTICE_NFY));
		sTU_GUILD_CHANGE_NOTICE_NFY * res2 = (sTU_GUILD_CHANGE_NOTICE_NFY *)packet2.GetPacketData();
		res2->wOpCode = TU_GUILD_CHANGE_NOTICE_NFY;
		wcscpy_s(res2->awchCharName, NTL_MAX_SIZE_CHAR_NAME_UNICODE, s2ws(this->GetCharName()).c_str());
		memcpy(res2->awchNotice, req->awchNotice, sizeof(wchar_t)* NTL_MAX_LENGTH_OF_GUILD_NOTICE_UNICODE);
		res2->wNoticeLengthInUnicode = req->wNoticeLengthInUnicode;
		//app->UserBroadcastothers(&packet2, this); // CHANGE THAT IT ONLY BROADCAST TO OTHER GUILD MEMBERS
		packet2.SetPacketLen( sizeof(sTU_GUILD_CHANGE_NOTICE_NFY));
		rc = g_pApp->Send( this->GetHandle(), &packet2);
	}
	
}
开发者ID:philipemassari,项目名称:AKCore-1,代码行数:36,代码来源:PacketChatServer.cpp


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