首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏Eureka的技术时光轴

    VC调试时输出调试信息到Debug窗口

    将信息输出到afxDump对象,只在_DEBUG定义时输出,最多输出512个字符,格式化与printf类似) afxDump对象(afx.h, CDumpContext) (afxDump调用OutputDebugString 把信息输出到Debug窗口,继承CObject的类可以重载Dump方法格式化此类的Dump信息,输出时把afxDump作为Dump方法的参数) OutputDebugString(windows.h ) (TRACE, afxDump在使用MFC时使用,不使用MFC时可以用OutputDebugString,AfxOutputDebugString和OutputDebugString用法一样) 用法示例 DEBUG char strErr[512]; sprintf(strErr, "Count = %d, Description = %s\n", nCount, strDesc); OutputDebugString

    2K40发布于 2019-07-24
  • 来自专栏程序员互动联盟

    【编程基础】Win32窗口下调试输出

    其实在窗口模式下,windows提供了一个函数OutputDebugString,用于向开发环境的debug窗口输出信息,结合C语言的可变参数,就能实现跟printf一样的功能了,下面就是一个简单的采用 OutputDebugString封装的调试输出函数,用法跟printf一样: #include <windows.h> #include <stdarg.h> void OutputDbgInfo( va_start(arg, format); _vsntprintf(szData, sizeof(szData)-1, format, arg); va_end(arg); OutputDebugString 在console下,用这个函数格式化后直接用printf输出,在窗口程序下结合上面的OutputDebugString函数,也能方面的知道错误描述了,完整的函数如下: #include <windows.h (LPTSTR)lpDisplayBuf, LocalSize(lpDisplayBuf), TEXT("err code: %d, %s"), dwErrcode, lpMsgBuf); OutputDebugString

    2.1K80发布于 2018-03-13
  • 来自专栏逆向技术

    编写内核驱动加载工具

    if (m_CreateService == NULL) { ::CloseServiceHandle(m_CreateService); //OutputDebugString bRet) { // OutputDebugString(TEXT("安装驱动失败")); } bRet = StartDriver(ServiceName bRet) { //OutputDebugString(TEXT("启动驱动失败")); return; } Sleep(3000); bRet) { //OutputDebugString(TEXT("停止驱动失败")); return; } Sleep(1000); bRet) { //OutputDebugString(TEXT("删除驱动失败")); return; } } int APIENTRY wWinMain

    1.9K10编辑于 2022-05-10
  • 来自专栏全栈程序员必看

    readprocessmemory error 299

    numByteWritten = 0; if(ReadProcessMemory(hProc, baseOffs,buf,si.dwPageSize,&numByteWritten) == FALSE) OutputDebugString (TEXT("bad\n")); //GetLastError()==ERROR_PARTIALLY_READ; numByteWritten == 0; else OutputDebugString( ReadProcessMemory(hProc, baseOffs,buf,si.dwPageSize,&numByteWritten) == FALSE) { assert(mbi.Protect & 0x100); OutputDebugString (mbi.Protect & 0x100)); OutputDebugString(TEXT("good\n")); } 版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。

    52320编辑于 2022-11-09
  • 来自专栏全栈程序员必看

    Visual Studio——使用多字节字符集与使用Unicode字符集

    , “Title”, MB_OK); 例子2:OutputDebugString的使用 windows API对OutputDebugString的定义如下: WINBASEAPI VOID WINAPI OutputDebugStringW #else #define OutputDebugString OutputDebugStringA #endif // ! UNICODE 当选则“使用Unicode字符集”时,调用函数OutputDebugString,实际使用的是OutputDebugStringW,OutputDebugStringW的入参的类型是LPCWSTR ,使用OutputDebugString时,字符串前需加L OutputDebugString(L“测试12345”); 当选则“使用多字节字符集”时,调用函数OutputDebugString,实际使用的是 OutputDebugStringA,OutputDebugStringA的入参类型是LPCSTR OutputDebugString(“测试12345”); 因此,“使用Unicode字符集”和“使用多字节字符集

    4.9K20编辑于 2022-11-03
  • 来自专栏xingoo, 一个梦想做发明家的程序员

    IO处理线程

    IO,具体代码如下: DOWRD WINAPI CIOCPServer::_WorkerThreadProc(LPVOID lpParam) { #ifdef _DEBUG ::OutputDebugString lpol,WSA_INFINITE); if(dwTrans == -1) { #ifdef _DEBUG ::OutputDebugString } pThis->HandleIO(dwKey,pBuffer,dwTrans,nError); } #ifdef _DEBUG ::OutputDebugString dwTrans,int nError) { CIOCPContext *pContext = (CIOCPContext*)dwKey; #ifdef _DEBUG ::OutputDebugString //检查套接字是否已经打开 if(pContext->bClosing) { #ifdef _DEBUG ::OutputDebugString

    93390发布于 2018-01-17
  • 来自专栏逆向技术

    系统权限远程线程注入到Explorer.exe

    //进行注入 if (NULL == hProHandle) { OutputDebugString 是我们自己写的 //wcscat(szBuf, TEXT("x64Test.dll"));//DLL这里就不写了,用我的吧,我会发上去的 OutputDebugString hThreadHandle) { OutputDebugString(TEXT("注入失败了")); return; } OutputDebugString(TEXT("注入了")); return;

    1.3K30发布于 2019-05-25
  • 来自专栏全栈程序员必看

    【语言-C++】多线程通同步 临界区 CCriticalSection 与 CSingleLock

    m_EventImageShow); DeleteCriticalSection(&m_DealImageMutex); } 处理线程 void Thread_DealImage(LPVOID *lpParam) { OutputDebugString WAIT_OBJECT_0 == WaitForMultipleObjects(2,eventHandle,TRUE,0)) { _CRITICAL_LOCK(_critical_data2); OutputDebugString } ResetEvent(MultiThrDlg->m_EventDealImage); ResetEvent(MultiThrDlg->m_EventAllowReceiveImage); OutputDebugString WAIT_OBJECT_0 == WaitForSingleObject((MultiThrDlg->m_EventImageShow),0)) { _CRITICAL_LOCK(_critical_data2); OutputDebugString ; } } ResetEvent(MultiThrDlg->m_EventImageShow); ResetEvent(MultiThrDlg->m_EventAllowReceiveImage); OutputDebugString

    1.2K40编辑于 2022-09-09
  • 来自专栏RTSP/RTMP直播相关

    Windows平台RTMP/RTSP播放器如何实现实时音量调节

    nSBCode << " nPos:" << nPos << " GetPos():" << slider_audio_device_volume_.GetPos() << "\r\n"; OutputDebugString L"SB_THUMBPOSITION" << " nPos:" << nPos << " GetPos():" << slider_audio_device_volume_.GetPos() << "\r\n"; OutputDebugString L"SB_THUMBTRACK" << " nPos:" << nPos << " GetPos():" << slider_audio_device_volume_.GetPos() << "\r\n"; OutputDebugString

    1.2K20发布于 2021-01-21
  • 来自专栏C++

    Windows核心编程:第13章 内存体系结构

    DWORD d = *(UNALIGNED PDWORD)test;//UNALIGNED在x86平台无效 if ((int)&d % sizeof(d) == 0) OutputDebugString (TEXT("***********对齐***********\n")); else OutputDebugString(TEXT("***********未对齐********

    56340发布于 2019-02-22
  • 来自专栏全栈程序员必看

    Windows线程漫谈界面线程和工作者线程

    线程函数是一个全局函数,如下: DWORD WINAPI Thread1(LPVOID lpParam) { while(1) { OutputDebugString(“11111”); g_bExitThread) { OutputDebugString(“11111”); Sleep(10); } return 0; } 然后在需要它退出的时候把g_bExitThread pDlg->m_bExitThread) { OutputDebugString(“11111”); Sleep(10); } return 0; } 当有几个线程一起跑的时候 pDlg->m_bExitThread) { OutputDebugString(“11111”); pDlg->m_csForVec.Lock(); pDlg->m_vecTest.push_back pDlg->m_bExitThread2) { OutputDebugString(“222”); pDlg->m_csForVec.Lock(); pDlg->m_vecTest.push_back

    91120编辑于 2022-07-15
  • 来自专栏jiajia_deng

    重载 new、delete 检测内存泄露

    MAX_PATH]; BOOL bRecord = FALSE; PROCESS_HEAP_ENTRY phe = {}; HeapLock(GetProcessHeap()); OutputDebugString i].m_pszSourceFile,g_pMemBlockList[i].m_iSourceLine,phe.lpData,phe.cbData); OutputDebugString T("未记录的内存块(Point=0x%08X,Size=%u)\n") ,phe.lpData,phe.cbData); //OutputDebugString (pszOutPutInfo); } } } HeapUnlock(GetProcessHeap()); OutputDebugString

    65140编辑于 2023-10-21
  • 来自专栏全栈程序员必看

    Lua使用心得(1)

    OutputDebugString(“The Length of stack is %d/n”, nTop); //输出栈顶位置 for (int i = 1; i <= nTop; ++ i) { int t = lua_type(L, i); OutputDebugString(“%s:”, lua_typename switch(t) { case LUA_TNUMBER: OutputDebugString(“%f” , lua_tostring(L,i)); break; case LUA_TNIL: OutputDebugString (“Is NULL”); break; case LUA_TBOOLEAN: OutputDebugString

    71610编辑于 2022-07-15
  • 来自专栏逆向技术

    Ring3挂起进程,跟恢复进程.

    LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) { CloseHandle(hToken); OutputDebugString hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &oldtp, &dwSize)) { CloseHandle(hToken); OutputDebugString

    1.6K30发布于 2019-05-25
  • 来自专栏ccf19881030的博客

    Simple Windows Service in C++

    g_ServiceStatus.dwCheckPoint = 0; if (SetServiceStatus (g_StatusHandle , &g_ServiceStatus) == FALSE) { OutputDebugString g_ServiceStatus.dwCheckPoint = 1; if (SetServiceStatus (g_StatusHandle, &g_ServiceStatus) == FALSE) { OutputDebugString g_ServiceStatus.dwCheckPoint = 0; if (SetServiceStatus (g_StatusHandle, &g_ServiceStatus) == FALSE) { OutputDebugString g_ServiceStatus.dwCheckPoint = 3; if (SetServiceStatus (g_StatusHandle, &g_ServiceStatus) == FALSE) { OutputDebugString ; if (SetServiceStatus (g_StatusHandle, &g_ServiceStatus) == FALSE) { OutputDebugString

    4.4K20发布于 2019-07-02
  • 来自专栏bit哲学院

    C++输出到Output窗口

    ];         swprintf_s(buffer, length, CastToWideChar(format), CastToWideChar(parameter));         OutputDebugString wchar_t *buffer = new wchar_t[length];         swprintf_s(buffer, length, format, parameter);         OutputDebugString

    1.1K20发布于 2021-02-19
  • 来自专栏逆向技术

    windows下,提权代码.

    LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &luid)) { CloseHandle(hToken); OutputDebugString hToken, FALSE, &tp, sizeof(TOKEN_PRIVILEGES), &oldtp, &dwSize)) { CloseHandle(hToken); OutputDebugString

    74020发布于 2019-05-25
  • 来自专栏C++

    Windows核心编程:第8章 用户模式下的线程同步

    for (int i = 0; i < 100; ++i) { AcquireSRWLockExclusive(&g_rw); //写 OutputDebugString { for (int i = 0; i < 100; ++i) { AcquireSRWLockShared(&g_rw); //读 OutputDebugString

    73520发布于 2019-02-22
  • 来自专栏全栈程序员必看

    debugview使用方法_debugger怎么用

    可以捕获程序中由 TRACE()和 OutputDebugString()输出的信息。 说的具体一点,在程序中使用如下函数: 1)、 OutputDebugString 或者在MFC中使用TRACE 2)、内核模式中使用Out_Debug_String,DbgPrint ,_Debug_Printf_Service

    2.1K30编辑于 2022-11-17
  • 来自专栏逆向技术

    MFC原理第三讲.RTTI运行时类型识别

    str); str = ""; str.Format(TEXT("类的大小 = %d \r\n"),pCurClass->m_nObjectSize); OutputDebugString (str); str = ""; str.Format(TEXT("类的编号%d \r\n"), pCurClass->m_wSchema); OutputDebugString str); str = ""; str.Format(TEXT("类的父类指针 %p \r\n"), pCurClass->m_pBaseClass); OutputDebugString str.Format(TEXT("类的父类名称 %s \r\n"), pCurClass->m_pBaseClass->m_lpszClassName); OutputDebugString str); } str = TEXT("--------------------------------\r\n"); OutputDebugString

    1.7K30发布于 2019-05-25
领券