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


C++ PhFormatString函数代码示例

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


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

示例1: NvGpuQueryDriverVersion

PPH_STRING NvGpuQueryDriverVersion(VOID)
{
    if (NvAPI_SYS_GetDriverAndBranchVersion)
    {
        NvU32 driverVersion = 0;
        NvAPI_ShortString driverAndBranchString = "";

        if (NvAPI_SYS_GetDriverAndBranchVersion(&driverVersion, driverAndBranchString) == NVAPI_OK)
        {
            return PhFormatString(L"%lu.%lu [%hs]", 
                driverVersion / 100, 
                driverVersion % 100, 
                driverAndBranchString
                );
        }
    }

    if (NvAPI_GetDisplayDriverVersion)
    {
        NV_DISPLAY_DRIVER_VERSION nvDisplayDriverVersion = { NV_DISPLAY_DRIVER_VERSION_VER };

        if (NvAPI_GetDisplayDriverVersion(NvGpuDisplayHandleList->Items[0], &nvDisplayDriverVersion) == NVAPI_OK)
        {
            return PhFormatString(L"%lu.%lu [%hs]", 
                nvDisplayDriverVersion.drvVersion / 100, 
                nvDisplayDriverVersion.drvVersion % 100,
                nvDisplayDriverVersion.szBuildBranchString
                );
        }
    }

    return PhCreateString(L"N/A");
}
开发者ID:processhacker2,项目名称:plugins-extra,代码行数:33,代码来源:nvidia.c

示例2: WepGetWindowTitleForSelector

PPH_STRING WepGetWindowTitleForSelector(
    _In_ PWE_WINDOW_SELECTOR Selector
    )
{
    switch (Selector->Type)
    {
    case WeWindowSelectorAll:
        {
            return PhCreateString(L"Windows - All");
        }
        break;
    case WeWindowSelectorThread:
        {
            return PhFormatString(L"Windows - Thread %lu", HandleToUlong(Selector->Thread.ThreadId));
        }
        break;
    case WeWindowSelectorProcess:
        {
            CLIENT_ID clientId;

            clientId.UniqueProcess = Selector->Process.ProcessId;
            clientId.UniqueThread = NULL;

            return PhConcatStrings2(L"Windows - ", PH_AUTO_T(PH_STRING, PhGetClientIdName(&clientId))->Buffer);
        }
        break;
    case WeWindowSelectorDesktop:
        {
            return PhFormatString(L"Windows - Desktop \"%s\"", Selector->Desktop.DesktopName->Buffer);
        }
        break;
    default:
        return PhCreateString(L"Windows");
    }
}
开发者ID:amitamitamitamit,项目名称:processhacker2,代码行数:35,代码来源:wnddlg.c

示例3: PhpProcessMiniDumpCallback

static BOOL CALLBACK PhpProcessMiniDumpCallback(
    _In_ PVOID CallbackParam,
    _In_ const PMINIDUMP_CALLBACK_INPUT CallbackInput,
    _Inout_ PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
    )
{
    PPROCESS_MINIDUMP_CONTEXT context = CallbackParam;
    PPH_STRING message = NULL;

    // Don't try to send status updates if we're creating a dump of the current process.
    if (context->ProcessId == NtCurrentProcessId())
        return TRUE;

    // MiniDumpWriteDump seems to get bored of calling the callback
    // after it begins dumping the process handles. The code is
    // still here in case they fix this problem in the future.

    switch (CallbackInput->CallbackType)
    {
    case CancelCallback:
        {
            if (context->Stop)
                CallbackOutput->Cancel = TRUE;
        }
        break;
    case ModuleCallback:
        {
            message = PhFormatString(L"Processing module %s...", CallbackInput->Module.FullPath);
        }
        break;
    case ThreadCallback:
        {
            message = PhFormatString(L"Processing thread %u...", CallbackInput->Thread.ThreadId);
        }
        break;
    }

    if (message)
    {
        SendMessage(
            context->WindowHandle,
            WM_PH_MINIDUMP_STATUS_UPDATE,
            PH_MINIDUMP_STATUS_UPDATE,
            (LPARAM)message->Buffer
            );
        PhDereferenceObject(message);
    }

    return TRUE;
}
开发者ID:PKRoma,项目名称:ProcessHacker,代码行数:50,代码来源:mdump.c

示例4: PhFormatLogEntry

PPH_STRING PhFormatLogEntry(
    _In_ PPH_LOG_ENTRY Entry
    )
{
    switch (Entry->Type)
    {
    case PH_LOG_ENTRY_PROCESS_CREATE:
        return PhFormatString(
            L"Process created: %s (%u) started by %s (%u)",
            Entry->Process.Name->Buffer,
            (ULONG)Entry->Process.ProcessId,
            PhGetStringOrDefault(Entry->Process.ParentName, L"Unknown Process"),
            (ULONG)Entry->Process.ParentProcessId
            );
    case PH_LOG_ENTRY_PROCESS_DELETE:
        return PhFormatString(L"Process terminated: %s (%u)", Entry->Process.Name->Buffer, (ULONG)Entry->Process.ProcessId);
    case PH_LOG_ENTRY_SERVICE_CREATE:
        return PhFormatString(L"Service created: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_SERVICE_DELETE:
        return PhFormatString(L"Service deleted: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_SERVICE_START:
        return PhFormatString(L"Service started: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_SERVICE_STOP:
        return PhFormatString(L"Service stopped: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_SERVICE_CONTINUE:
        return PhFormatString(L"Service continued: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_SERVICE_PAUSE:
        return PhFormatString(L"Service paused: %s (%s)", Entry->Service.Name->Buffer, Entry->Service.DisplayName->Buffer);
    case PH_LOG_ENTRY_MESSAGE:
        PhReferenceObject(Entry->Message);
        return Entry->Message;
    default:
        return PhReferenceEmptyString();
    }
}
开发者ID:JamesLinus,项目名称:processhacker_2.33,代码行数:35,代码来源:log.c

示例5: NvGpuQueryFoundry

PPH_STRING NvGpuQueryFoundry(VOID)
{
    if (NvAPI_GPU_GetFoundry)
    {
        NV_FOUNDRY nvFoundryType = NV_FOUNDRY_NONE;

        if (NvAPI_GPU_GetFoundry(NvGpuPhysicalHandleList->Items[0], &nvFoundryType) == NVAPI_OK)
        {
            switch (nvFoundryType)
            {
            case NV_FOUNDRY_TSMC:
                return PhCreateString(L"Taiwan Semiconductor Manufacturing Company (TSMC)");
            case NV_FOUNDRY_UMC:
                return PhCreateString(L"United Microelectronics Corporation (UMC)");
            case NV_FOUNDRY_IBM:
                return PhCreateString(L"IBM Microelectronics");
            case NV_FOUNDRY_SMIC:
                return PhCreateString(L"Semiconductor Manufacturing International Corporation (SMIC)");
            case NV_FOUNDRY_CSM:
                return PhCreateString(L"Chartered Semiconductor Manufacturing (CSM)");
            case NV_FOUNDRY_TOSHIBA:
                return PhCreateString(L"Toshiba Corporation");
            default:
                return PhFormatString(L"%lu", nvFoundryType);
            }
        }
    }

    return PhCreateString(L"N/A");
}
开发者ID:processhacker2,项目名称:plugins-extra,代码行数:30,代码来源:nvidia.c

示例6: PhCreateProcessPropContext

PPH_PROCESS_PROPCONTEXT PhCreateProcessPropContext(
    _In_ HWND ParentWindowHandle,
    _In_ PPH_PROCESS_ITEM ProcessItem
    )
{
    static PH_INITONCE initOnce = PH_INITONCE_INIT;
    PPH_PROCESS_PROPCONTEXT propContext;
    PROPSHEETHEADER propSheetHeader;

    if (PhBeginInitOnce(&initOnce))
    {
        PhpProcessPropContextType = PhCreateObjectType(L"ProcessPropContext", 0, PhpProcessPropContextDeleteProcedure);
        PhpProcessPropPageContextType = PhCreateObjectType(L"ProcessPropPageContext", 0, PhpProcessPropPageContextDeleteProcedure);
        PhEndInitOnce(&initOnce);
    }

    propContext = PhCreateObjectZero(sizeof(PH_PROCESS_PROPCONTEXT), PhpProcessPropContextType);
    propContext->PropSheetPages = PhAllocateZero(sizeof(HPROPSHEETPAGE) * PH_PROCESS_PROPCONTEXT_MAXPAGES);

    if (!PH_IS_FAKE_PROCESS_ID(ProcessItem->ProcessId))
    {
        propContext->Title = PhFormatString(
            L"%s (%u)",
            ProcessItem->ProcessName->Buffer,
            HandleToUlong(ProcessItem->ProcessId)
            );
    }
    else
    {
        PhSetReference(&propContext->Title, ProcessItem->ProcessName);
    }

    memset(&propSheetHeader, 0, sizeof(PROPSHEETHEADER));
    propSheetHeader.dwSize = sizeof(PROPSHEETHEADER);
    propSheetHeader.dwFlags =
        PSH_MODELESS |
        PSH_NOAPPLYNOW |
        PSH_NOCONTEXTHELP |
        PSH_PROPTITLE |
        PSH_USECALLBACK |
        PSH_USEHICON;
    propSheetHeader.hInstance = PhInstanceHandle;
    propSheetHeader.hwndParent = ParentWindowHandle;
    propSheetHeader.hIcon = ProcessItem->SmallIcon;
    propSheetHeader.pszCaption = propContext->Title->Buffer;
    propSheetHeader.pfnCallback = PhpPropSheetProc;

    propSheetHeader.nPages = 0;
    propSheetHeader.nStartPage = 0;
    propSheetHeader.phpage = propContext->PropSheetPages;

    if (PhCsForceNoParent)
        propSheetHeader.hwndParent = NULL;

    memcpy(&propContext->PropSheetHeader, &propSheetHeader, sizeof(PROPSHEETHEADER));

    PhSetReference(&propContext->ProcessItem, ProcessItem);

    return propContext;
}
开发者ID:PKRoma,项目名称:ProcessHacker,代码行数:60,代码来源:procprp.c

示例7: PhGetThreadPriorityWin32String

PPH_STRING PhGetThreadPriorityWin32String(
    __in LONG PriorityWin32
    )
{
    switch (PriorityWin32)
    {
    case THREAD_PRIORITY_TIME_CRITICAL:
        return PhCreateString(L"Time Critical");
    case THREAD_PRIORITY_HIGHEST:
        return PhCreateString(L"Highest");
    case THREAD_PRIORITY_ABOVE_NORMAL:
        return PhCreateString(L"Above Normal");
    case THREAD_PRIORITY_NORMAL:
        return PhCreateString(L"Normal");
    case THREAD_PRIORITY_BELOW_NORMAL:
        return PhCreateString(L"Below Normal");
    case THREAD_PRIORITY_LOWEST:
        return PhCreateString(L"Lowest");
    case THREAD_PRIORITY_IDLE:
        return PhCreateString(L"Idle");
    case THREAD_PRIORITY_ERROR_RETURN:
        return NULL;
    default:
        return PhFormatString(L"%d", PriorityWin32);
    }
}
开发者ID:john-peterson,项目名称:processhacker,代码行数:26,代码来源:thrdprv.c

示例8: UpdateVersionString

static PPH_STRING UpdateVersionString(
    VOID
    )
{
    ULONG majorVersion;
    ULONG minorVersion;
    ULONG revisionVersion;
    PPH_STRING currentVersion = NULL;
    PPH_STRING versionHeader = NULL;

    PhGetPhVersionNumbers(
        &majorVersion,
        &minorVersion,
        NULL,
        &revisionVersion
        );

    currentVersion = PhFormatString(
        L"%lu.%lu.%lu",
        majorVersion,
        minorVersion,
        revisionVersion
        );

    if (currentVersion)
    {
        versionHeader = PhConcatStrings2(L"ProcessHacker-Build: ", currentVersion->Buffer);
        PhDereferenceObject(currentVersion);
    }

    return versionHeader;
}
开发者ID:digitalsensejbkim,项目名称:processhacker2,代码行数:32,代码来源:updater.c

示例9: ConnectionAvailable

static BOOL ConnectionAvailable(
    VOID
    )
{
    if (WindowsVersion > WINDOWS_XP)
    {
        INetworkListManager *pNetworkListManager;

        // Create an instance of the INetworkListManger COM object.
        if (SUCCEEDED(CoCreateInstance(&CLSID_NetworkListManager, NULL, CLSCTX_ALL, &IID_INetworkListManager, &pNetworkListManager)))
        {
            VARIANT_BOOL isConnected = VARIANT_FALSE;
            VARIANT_BOOL isConnectedInternet = VARIANT_FALSE;

            // Query the relevant properties.
            INetworkListManager_get_IsConnected(pNetworkListManager, &isConnected);
            INetworkListManager_get_IsConnectedToInternet(pNetworkListManager, &isConnectedInternet);

            // Cleanup the INetworkListManger COM object.
            INetworkListManager_Release(pNetworkListManager);
            pNetworkListManager = NULL;

            // Check if Windows is connected to a network and it's connected to the internet.
            if (isConnected == VARIANT_TRUE && isConnectedInternet == VARIANT_TRUE)
            {
                // We're online and connected to the internet.
                return TRUE;
            }

            // We're not connected to anything.
            return FALSE;
        }

        // If we reached here, we were unable to init the INetworkListManager, fall back to InternetGetConnectedState.
        goto NOT_SUPPORTED;
    }
    else
NOT_SUPPORTED:
    {
        DWORD dwType;

        if (InternetGetConnectedState(&dwType, 0))
        {
            return TRUE;
        }
        else
        {
            LogEvent(NULL, PhFormatString(L"Updater: (ConnectionAvailable) InternetGetConnectedState failed to detect an active Internet connection (%d)", GetLastError()));
        }

        //if (!InternetCheckConnection(NULL, FLAG_ICC_FORCE_CONNECTION, 0))
        //{
        // LogEvent(PhFormatString(L"Updater: (ConnectionAvailable) InternetCheckConnection failed connection to Sourceforge.net (%d)", GetLastError()));
        // return FALSE;
        //}
    }

    return FALSE;
}
开发者ID:john-peterson,项目名称:processhacker,代码行数:59,代码来源:updater.c

示例10: PhpWalkThreadStackCallback

static BOOLEAN NTAPI PhpWalkThreadStackCallback(
    _In_ PPH_THREAD_STACK_FRAME StackFrame,
    _In_opt_ PVOID Context
    )
{
    PTHREAD_STACK_CONTEXT threadStackContext = (PTHREAD_STACK_CONTEXT)Context;
    PPH_STRING symbol;
    PTHREAD_STACK_ITEM item;

    if (threadStackContext->StopWalk)
        return FALSE;

    PhAcquireQueuedLockExclusive(&threadStackContext->StatusLock);
    PhMoveReference(&threadStackContext->StatusMessage,
        PhFormatString(L"Processing frame %u...", threadStackContext->NewList->Count));
    PhReleaseQueuedLockExclusive(&threadStackContext->StatusLock);
    PostMessage(threadStackContext->ProgressWindowHandle, WM_PH_STATUS_UPDATE, 0, 0);

    symbol = PhGetSymbolFromAddress(
        threadStackContext->SymbolProvider,
        (ULONG64)StackFrame->PcAddress,
        NULL,
        NULL,
        NULL,
        NULL
        );

    if (symbol &&
        (StackFrame->Flags & PH_THREAD_STACK_FRAME_I386) &&
        !(StackFrame->Flags & PH_THREAD_STACK_FRAME_FPO_DATA_PRESENT))
    {
        PhMoveReference(&symbol, PhConcatStrings2(symbol->Buffer, L" (No unwind info)"));
    }

    item = PhAllocate(sizeof(THREAD_STACK_ITEM));
    item->StackFrame = *StackFrame;
    item->Index = threadStackContext->NewList->Count;

    if (PhPluginsEnabled)
    {
        PH_PLUGIN_THREAD_STACK_CONTROL control;

        control.Type = PluginThreadStackResolveSymbol;
        control.UniqueKey = threadStackContext;
        control.u.ResolveSymbol.StackFrame = StackFrame;
        control.u.ResolveSymbol.Symbol = symbol;
        PhInvokeCallback(PhGetGeneralCallback(GeneralCallbackThreadStackControl), &control);

        symbol = control.u.ResolveSymbol.Symbol;
    }

    item->Symbol = symbol;
    PhAddItemList(threadStackContext->NewList, item);

    return TRUE;
}
开发者ID:processhacker2,项目名称:processhacker2,代码行数:56,代码来源:thrdstk.c

示例11: WepGetWindowTitleForSelector

PPH_STRING WepGetWindowTitleForSelector(
    _In_ PWE_WINDOW_SELECTOR Selector
    )
{
    PPH_STRING title;
    CLIENT_ID clientId;
    PPH_STRING clientIdName;

    switch (Selector->Type)
    {
    case WeWindowSelectorAll:
        {
            return PhCreateString(L"Windows - All");
        }
        break;
    case WeWindowSelectorThread:
        {
            return PhFormatString(L"Windows - Thread %u", (ULONG)Selector->Thread.ThreadId);
        }
        break;
    case WeWindowSelectorProcess:
        {
            clientId.UniqueProcess = Selector->Process.ProcessId;
            clientId.UniqueThread = NULL;
            clientIdName = PhGetClientIdName(&clientId);

            title = PhConcatStrings2(L"Windows - ", clientIdName->Buffer);
            PhDereferenceObject(clientIdName);

            return title;
        }
        break;
    case WeWindowSelectorDesktop:
        {
            return PhFormatString(L"Windows - Desktop \"%s\"", Selector->Desktop.DesktopName->Buffer);
        }
        break;
    default:
        return PhCreateString(L"Windows");
    }
}
开发者ID:JamesLinus,项目名称:processhacker_2.33,代码行数:41,代码来源:wnddlg.c

示例12: PhpSettingToString

static PPH_STRING PhpSettingToString(
    _In_ PH_SETTING_TYPE Type,
    _In_ PPH_SETTING Setting
    )
{
    switch (Type)
    {
    case StringSettingType:
        {
            if (!Setting->u.Pointer)
                return PhReferenceEmptyString();

            PhReferenceObject(Setting->u.Pointer);

            return (PPH_STRING)Setting->u.Pointer;
        }
    case IntegerSettingType:
        {
            return PhFormatString(L"%x", Setting->u.Integer);
        }
    case IntegerPairSettingType:
        {
            PPH_INTEGER_PAIR integerPair = &Setting->u.IntegerPair;

            return PhFormatString(L"%d,%d", integerPair->X, integerPair->Y);
        }
    case ScalableIntegerPairSettingType:
        {
            PPH_SCALABLE_INTEGER_PAIR scalableIntegerPair = Setting->u.Pointer;

            if (!scalableIntegerPair)
                return PhReferenceEmptyString();

            return PhFormatString(L"@%u|%d,%d", scalableIntegerPair->Scale, scalableIntegerPair->X, scalableIntegerPair->Y);
        }
    }

    return PhReferenceEmptyString();
}
开发者ID:poizan42,项目名称:processhacker2,代码行数:39,代码来源:settings.c

示例13: NvGpuQueryRopsCount

PPH_STRING NvGpuQueryRopsCount(VOID)
{
    if (NvAPI_GPU_GetPartitionCount)
    {
        NvU32 value = 0;

        if (NvAPI_GPU_GetPartitionCount(NvGpuPhysicalHandleList->Items[0], &value) == NVAPI_OK)
        {
            if (GpuArchType >= 0x120)
            {
                return PhFormatString(L"%lu", value * 16);
            }
            else if (GpuArchType >= 0x0c0)
            {
                return PhFormatString(L"%lu", value * 8);
            }
             
            return PhFormatString(L"%lu", value * 4);
        }
    }

    return PhCreateString(L"N/A");
}
开发者ID:processhacker2,项目名称:plugins-extra,代码行数:23,代码来源:nvidia.c

示例14: NvGpuQueryShaderCount

PPH_STRING NvGpuQueryShaderCount(VOID)
{
    if (NvAPI_GPU_GetGpuCoreCount)
    {
        NvU32 value = 0;

        if (NvAPI_GPU_GetGpuCoreCount(NvGpuPhysicalHandleList->Items[0], &value) == NVAPI_OK)
        {
            return PhFormatString(L"%lu Unified", value);
        }
    }

    return PhCreateString(L"N/A");
}
开发者ID:processhacker2,项目名称:plugins-extra,代码行数:14,代码来源:nvidia.c

示例15: NvGpuQueryFanSpeed

PPH_STRING NvGpuQueryFanSpeed(VOID)
{
    NvU32 tachValue = 0;
    NV_GPU_COOLER_SETTINGS coolerInfo = { NV_GPU_COOLER_SETTINGS_VER };

    if (NvAPI_GPU_GetTachReading && NvAPI_GPU_GetTachReading(NvGpuPhysicalHandleList->Items[0], &tachValue) == NVAPI_OK)
    {
        if (NvAPI_GPU_GetCoolerSettings && NvAPI_GPU_GetCoolerSettings(NvGpuPhysicalHandleList->Items[0], NVAPI_COOLER_TARGET_ALL, &coolerInfo) == NVAPI_OK)
        {
            return PhFormatString(L"%lu RPM (%lu%%)", tachValue, coolerInfo.cooler[0].currentLevel);
        }

        return PhFormatString(L"%lu RPM", tachValue);
    }
    else
    {
        if (NvAPI_GPU_GetCoolerSettings && NvAPI_GPU_GetCoolerSettings(NvGpuPhysicalHandleList->Items[0], NVAPI_COOLER_TARGET_ALL, &coolerInfo) == NVAPI_OK)
        {
            return PhFormatString(L"%lu%%", coolerInfo.cooler[0].currentLevel);
        }
    }

    return PhCreateString(L"N/A");
}
开发者ID:processhacker2,项目名称:plugins-extra,代码行数:24,代码来源:nvidia.c


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