本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}