일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
Tags
- 벤자민플랭클린
- 이모지메모
- 파이썬
- 명심보감
- 장자명언
- 좋은글필사하기
- 소울칼리버6
- DART
- recyclerview
- androidx
- 공자명언
- 공부집중
- kotlin
- ASMR
- 코틀린
- Streaming
- Freesound
- Linux
- 명언모음
- 이모지
- jetpack compose
- Flutter
- Android
- 1인개발자
- FSM
- Coroutine
- 오픈소스
- 넷플릭스
- bash
- Firebase
Archives
- Today
- Total
Vintage appMaker의 Tech Blog
OutputDebugString을 이용한 debug_log_monitor 본문
Source code or Tip/Windows
OutputDebugString을 이용한 debug_log_monitor
VintageappMaker 2020. 11. 11. 21:51VintageAppMaker/debug_log_monitor
윈도우 디버그출력 API를 이용한 서버로그관리. Contribute to VintageAppMaker/debug_log_monitor development by creating an account on GitHub.
github.com
목적
- window에서 서버를 개발하다보면 디버깅을 하기 위해 log를 많이 사용하는 경우가 많다.
- 통신에 프로그램에 log를 사용하다보면 속도저하와 시스템 불안 있다.
서버 프로그램의 경우, 디버깅을 할 수 있는 경우가 적기 때문에 log에 많은 의존을 한다. 그러다보니 “log를 추가/삭제”하는 일이 빈번하게 되고 그로인한 예기치않은 버그도 생기게 된다.
그러므로 서버 개발(또는 디버깅)을 할 때는 디버깅 메시지가 출력되고 실제 서비스 될 때는 디버깅 메시지가 출력 안되게 할 필요가 생긴다. 이런 목적을 달성하기 위해 windows의 OutputDebugString() 함수와 Debugging API를 사용해보도록 한다.
<DEBSTRING.h>
#ifndef __PSW_DEBUGSTRING__
#define __PSW_DEBUGSTRING__
// John Robbins
inline BOOL AntiHackIsDebuggerPresent()
{
BOOL bRet = TRUE;
__asm
{
MOV EAX, FS:[00000018H]
MOV EAX, DWORD PTR [EAX+030H]
MOVZX EAX, BYTE PTR [EAX+002H]
MOV bRet, EAX
}
return bRet;
}
#define LOG( a ) if( AntiHackIsDebuggerPresent() ) OutputDebugString(a);
#endif
구성
실행
'Source code or Tip > Windows' 카테고리의 다른 글
[github] DLL에 인증기능 넣기 - DLL Injection, Shellcode (0) | 2020.12.05 |
---|---|
WindowProcessMonitor (0) | 2020.07.20 |
Comments