本文整理汇总了C++中PathString::GetUnicode方法的典型用法代码示例。如果您正苦于以下问题:C++ PathString::GetUnicode方法的具体用法?C++ PathString::GetUnicode怎么用?C++ PathString::GetUnicode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathString
的用法示例。
在下文中一共展示了PathString::GetUnicode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogResult
HRESULT BindingLog::LogResult(BindResult *pBindResult)
{
HRESULT hr = S_OK;
BINDER_LOG_ENTER(L"BindingLog::LogResult");
PathString assemblyDisplayName;
PathString format;
PathString info;
pBindResult->GetAssemblyName()->GetDisplayName(assemblyDisplayName,
AssemblyName::INCLUDE_VERSION |
AssemblyName::INCLUDE_ARCHITECTURE);
IF_FAIL_GO(format.LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_TO_ID));
info.Printf(format.GetUnicode(), assemblyDisplayName.GetUnicode());
IF_FAIL_GO(Log(info));
IUnknown *pIUnknownAssembly;
pIUnknownAssembly = pBindResult->GetAssembly(FALSE /* fAddRef */);
Assembly *pAssembly;
pAssembly = static_cast<Assembly *>(static_cast<void *>(pIUnknownAssembly));
_ASSERTE(pAssembly != NULL);
if (pAssembly->GetIsInGAC())
{
IF_FAIL_GO(info.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_GAC));
}
else if (pAssembly->GetIsByteArray())
{
IF_FAIL_GO(info.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_BYTE_ARRAY));
}
else
{
PathString assemblyPath;
BinderGetImagePath(pAssembly->GetPEImage(), assemblyPath);
IF_FAIL_GO(format.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_ASSEMBLY_STATUS_BOUND_TO_LOCATION));
info.Printf(format.GetUnicode(), assemblyPath.GetUnicode());
}
IF_FAIL_GO(Log(info));
Exit:
BINDER_LOG_LEAVE_HR(L"BindingLog::LogResult", hr);
return hr;
}
示例2: StaticInitialize
void Disassembler::StaticInitialize()
{
LIMITED_METHOD_CONTRACT;
#if USE_COREDISTOOLS_DISASSEMBLER
_ASSERTE(!IsAvailable());
PathString libPath;
HMODULE libraryHandle = LoadCoreDisToolsModule(libPath);
if (libraryHandle == nullptr)
return;
External_InitDisasm =
reinterpret_cast<decltype(External_InitDisasm)>(GetProcAddress(libraryHandle, "InitDisasm"));
if (External_InitDisasm == nullptr)
{
DISPLAYERROR(
W("GetProcAddress failed for library '%s', function 'InitDisasm': error %u\n"),
libPath.GetUnicode(),
GetLastError());
return;
}
External_DisasmInstruction =
reinterpret_cast<decltype(External_DisasmInstruction)>(GetProcAddress(libraryHandle, "DisasmInstruction"));
if (External_DisasmInstruction == nullptr)
{
DISPLAYERROR(
W("GetProcAddress failed for library '%s', function 'DisasmInstruction': error %u\n"),
libPath.GetUnicode(),
GetLastError());
return;
}
External_FinishDisasm =
reinterpret_cast<decltype(External_FinishDisasm)>(GetProcAddress(libraryHandle, "FinishDisasm"));
if (External_FinishDisasm == nullptr)
{
DISPLAYERROR(
W("GetProcAddress failed for library '%s', function 'FinishDisasm': error %u\n"),
libPath.GetUnicode(),
GetLastError());
return;
}
// Set this last to indicate successful load of the library and all exports
s_libraryHandle = libraryHandle;
_ASSERTE(IsAvailable());
#endif // USE_COREDISTOOLS_DISASSEMBLER
}
示例3: WszGetModuleFileName
FCIMPLEND
FCIMPL0(StringObject*, SystemNative::_GetModuleFileName)
{
FCALL_CONTRACT;
STRINGREF refRetVal = NULL;
HELPER_METHOD_FRAME_BEGIN_RET_1(refRetVal);
if (g_pCachedModuleFileName)
{
refRetVal = StringObject::NewString(g_pCachedModuleFileName);
}
else
{
PathString wszFilePathString;
DWORD lgth = WszGetModuleFileName(NULL, wszFilePathString);
if (!lgth)
{
COMPlusThrowWin32();
}
refRetVal = StringObject::NewString(wszFilePathString.GetUnicode());
}
HELPER_METHOD_FRAME_END();
return (StringObject*)OBJECTREFToObject(refRetVal);
}
示例4: LogAssert
VOID LogAssert(
LPCSTR szFile,
int iLine,
LPCSTR szExpr
)
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_SO_TOLERANT;
STATIC_CONTRACT_DEBUG_ONLY;
// Log asserts to the stress log. Note that we can't include the szExpr b/c that
// may not be a string literal (particularly for formatt-able asserts).
STRESS_LOG2(LF_ASSERT, LL_ALWAYS, "ASSERT:%s, line:%d\n", szFile, iLine);
SYSTEMTIME st;
#ifndef FEATURE_PAL
GetLocalTime(&st);
#else
GetSystemTime(&st);
#endif
PathString exename;
WszGetModuleFileName(NULL, exename);
LOG((LF_ASSERT,
LL_FATALERROR,
"FAILED ASSERT(PID %d [0x%08x], Thread: %d [0x%x]) (%lu/%lu/%lu: %02lu:%02lu:%02lu %s): File: %s, Line %d : %s\n",
GetCurrentProcessId(),
GetCurrentProcessId(),
GetCurrentThreadId(),
GetCurrentThreadId(),
(ULONG)st.wMonth,
(ULONG)st.wDay,
(ULONG)st.wYear,
1 + (( (ULONG)st.wHour + 11 ) % 12),
(ULONG)st.wMinute,
(ULONG)st.wSecond,
(st.wHour < 12) ? "am" : "pm",
szFile,
iLine,
szExpr));
LOG((LF_ASSERT, LL_FATALERROR, "RUNNING EXE: %ws\n", exename.GetUnicode()));
}
示例5: FileOrDirectoryExists
HRESULT FileOrDirectoryExists(PathString &path)
{
HRESULT hr = S_FALSE;
DWORD dwFileAttributes = WszGetFileAttributes(path.GetUnicode());
if (dwFileAttributes == INVALID_FILE_ATTRIBUTES)
{
hr = HRESULT_FROM_GetLastError();
if ((hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) ||
(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)))
{
hr = S_FALSE;
}
}
else
{
hr = S_TRUE;
}
return hr;
}
示例6: LogPreBindState
HRESULT BindingLog::LogPreBindState(ApplicationContext *pApplicationContext,
AssemblyName *pAssemblyName,
SString &assemblyPath,
PEAssembly *pParentAssembly)
{
HRESULT hr = S_OK;
BINDER_LOG_ENTER(L"BindingLog::LogPreBindState");
PathString format;
PathString info;
IF_FAIL_GO(info.LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_BINDING_PRE_BIND_STATE_BEGIN));
IF_FAIL_GO(Log(info));
if (pAssemblyName != NULL)
{
PathString assemblyDisplayName;
pAssemblyName->GetDisplayName(assemblyDisplayName,
AssemblyName::INCLUDE_VERSION |
AssemblyName::INCLUDE_ARCHITECTURE |
AssemblyName::INCLUDE_RETARGETABLE);
IF_FAIL_GO(format.LoadResourceAndReturnHR(CCompRC::Debugging,
GetPreBindStateName(pAssemblyName)));
info.Printf(format.GetUnicode(), assemblyDisplayName.GetUnicode());
}
else
{
IF_FAIL_GO(format.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_BINDING_PRE_BIND_STATE_WHERE_REF));
info.Printf(format.GetUnicode(), assemblyPath.GetUnicode());
}
IF_FAIL_GO(Log(info));
if (pParentAssembly != NULL)
{
PathString parentAssemblyDisplayName;
IF_FAIL_GO(BinderGetDisplayName(pParentAssembly, parentAssemblyDisplayName));
IF_FAIL_GO(format.LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_BINDING_PRE_BIND_STATE_CALLER));
info.Printf(format.GetUnicode(), parentAssemblyDisplayName.GetUnicode());
}
else
{
IF_FAIL_GO(info.
LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_BINDING_PRE_BIND_STATE_CALLER_UNKNOWN));
}
IF_FAIL_GO(Log(info));
IF_FAIL_GO(info.LoadResourceAndReturnHR(CCompRC::Debugging,
ID_FUSLOG_BINDING_PRE_BIND_STATE_END));
IF_FAIL_GO(Log(info));
Exit:
BINDER_LOG_LEAVE_HR(L"BindingLog::LogPreBindState", hr);
return hr;
}
示例7: StaticInitialize
void Disassembler::StaticInitialize()
{
LIMITED_METHOD_CONTRACT;
#if USE_COREDISTOOLS_DISASSEMBLER
_ASSERTE(!IsAvailable());
HMODULE libraryHandle = nullptr;
PathString libPath;
DWORD result = WszGetModuleFileName(nullptr, libPath);
if (result == 0) {
#ifdef _DEBUG
wprintf(
W("GetModuleFileName failed, function 'DisasmInstruction': error %u\n"),
GetLastError());
#endif // _DEBUG
return;
}
#if defined(FEATURE_PAL)
WCHAR delim = W('/');
#else
WCHAR delim = W('\\');
#endif
LPCWSTR libFileName = MAKEDLLNAME(W("coredistools"));
PathString::Iterator iter = libPath.End();
if (libPath.FindBack(iter, delim)) {
libPath.Truncate(++iter);
libPath.Append(libFileName);
}
else {
_ASSERTE(!"unreachable");
}
LPCWSTR libraryName = libPath.GetUnicode();
libraryHandle = CLRLoadLibrary(libraryName);
do
{
if (libraryHandle == nullptr)
{
#ifdef _DEBUG
wprintf(W("LoadLibrary failed for '%s': error %u\n"), libraryName, GetLastError());
#endif // _DEBUG
break;
}
External_InitDisasm =
reinterpret_cast<decltype(External_InitDisasm)>(GetProcAddress(libraryHandle, "InitDisasm"));
if (External_InitDisasm == nullptr)
{
#ifdef _DEBUG
wprintf(
W("GetProcAddress failed for library '%s', function 'InitDisasm': error %u\n"),
libraryName,
GetLastError());
#endif // _DEBUG
break;
}
External_DisasmInstruction =
reinterpret_cast<decltype(External_DisasmInstruction)>(GetProcAddress(libraryHandle, "DisasmInstruction"));
if (External_DisasmInstruction == nullptr)
{
#ifdef _DEBUG
wprintf(
W("GetProcAddress failed for library '%s', function 'DisasmInstruction': error %u\n"),
libraryName,
GetLastError());
#endif // _DEBUG
break;
}
External_FinishDisasm =
reinterpret_cast<decltype(External_FinishDisasm)>(GetProcAddress(libraryHandle, "FinishDisasm"));
if (External_FinishDisasm == nullptr)
{
#ifdef _DEBUG
wprintf(
W("GetProcAddress failed for library '%s', function 'FinishDisasm': error %u\n"),
libraryName,
GetLastError());
#endif // _DEBUG
break;
}
// Set this last to indicate successful load of the library and all exports
s_libraryHandle = libraryHandle;
_ASSERTE(IsAvailable());
return;
} while (false);
_ASSERTE(!IsAvailable());
#endif // USE_COREDISTOOLS_DISASSEMBLER
}
示例8: DbgDllMain
//*****************************************************************************
// The main dll entry point for this module. This routine is called by the
// OS when the dll gets loaded. Control is simply deferred to the main code.
//*****************************************************************************
BOOL WINAPI DbgDllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
// Save off the instance handle for later use.
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
#ifndef FEATURE_PAL
g_hInst = hInstance;
#else
int err = PAL_InitializeDLL();
if(err != 0)
{
return FALSE;
}
#endif
#if defined(_DEBUG)
static int BreakOnDILoad = -1;
if (BreakOnDILoad == -1)
BreakOnDILoad = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_BreakOnDILoad);
if (BreakOnDILoad)
{
_ASSERTE(!"DI Loaded");
}
#endif
#if defined(LOGGING)
{
PathString rcFile;
WszGetModuleFileName(hInstance, rcFile);
LOG((LF_CORDB, LL_INFO10000,
"DI::DbgDllMain: load right side support from file '%s'\n",
rcFile.GetUnicode()));
}
#endif
#ifdef RSCONTRACTS
// alloc a TLS slot
DbgRSThread::s_TlsSlot = TlsAlloc();
_ASSERTE(DbgRSThread::s_TlsSlot != TLS_OUT_OF_INDEXES);
#endif
#if defined(FEATURE_DBGIPC_TRANSPORT_DI)
g_pDbgTransportTarget = new (nothrow) DbgTransportTarget();
if (g_pDbgTransportTarget == NULL)
return FALSE;
if (FAILED(g_pDbgTransportTarget->Init()))
return FALSE;
#endif // FEATURE_DBGIPC_TRANSPORT_DI
}
break;
case DLL_THREAD_DETACH:
{
#ifdef STRESS_LOG
StressLog::ThreadDetach((ThreadStressLog*) ClrFlsGetValue(TlsIdx_StressLog));
#endif
#ifdef RSCONTRACTS
// DbgRSThread are lazily created when we call GetThread(),
// So we don't need to do anything in DLL_THREAD_ATTACH,
// But this is our only chance to destroy the thread object.
DbgRSThread * p = DbgRSThread::GetThread();
p->Destroy();
#endif
}
break;
case DLL_PROCESS_DETACH:
{
#if defined(FEATURE_DBGIPC_TRANSPORT_DI)
if (g_pDbgTransportTarget != NULL)
{
g_pDbgTransportTarget->Shutdown();
delete g_pDbgTransportTarget;
g_pDbgTransportTarget = NULL;
}
#endif // FEATURE_DBGIPC_TRANSPORT_DI
#ifdef RSCONTRACTS
TlsFree(DbgRSThread::s_TlsSlot);
DbgRSThread::s_TlsSlot = TLS_OUT_OF_INDEXES;
#endif
}
break;
}
return TRUE;
}