笔者在开始使用 Windows CE 事件日志服务时,由于自身条件限制未能获得 Microsoft 的技术支持,故只能使用 IDA Pro 对 eventlog.dll 进行分析。
笔者感觉事件日志服务相关的注册表设置可能对嵌入式系统软件工程师比较有用,所以注重分析 StartAllLoggers、InitFormattersAndOutputters、CLogEventLog::Initialize 和 CLogHandle::AssociateEventLog 等函数/方法。
StartAllLoggers 函数
eventlog.dll 的导出函数 EventLogStart 在 .text:10001B3A 调用函数 EventLogWorkerThread;然后,函数 EventLogWorkerThread 在 .text:100030FA 调用本函数。
.text:10002CC8 ;
int
__cdecl StartAllLoggers(
void
)
.text:10002CC8 ? StartAllLoggers@@YAHXZ proc near ; CODE XREF: EventLogWorkerThread( void * ) + 15
.text:10002CC8
.text:10002CC8 szName = word ptr - 218h
.text:10002CC8 pReg = dword ptr - 10h
.text:10002CC8
.text:10002CC8 push ebp
.text:10002CC9 mov ebp, esp
.text:10002CCB sub esp, 218h
.text:10002CD1 push ebx
.text:10002CD2 push esi
.text:10002CD3 push edi
.text:10002CD4 push offset ?? _C@_1EE@DKEDOPGO@ ? $AAS ? $AAY ? $AAS ? $AAT ? $AAE ? $AAM ? $AA ? 2 ? $AAC ? $AAu ? $AAr ? $AAr ? $AAe ? $AAn ? $AAt ? $AAC ? $AAo ? $AAn ? $AAt ? $AAr ? $AAo@ ; " SYSTEM/CurrentControlSet/EventLog "
.text:10002CD9 push HKEY_LOCAL_MACHINE
.text:10002CDE lea ecx, [ebp + pReg]
.text:10002CE1 call ?? 0CReg@@QAE@PAUHKEY__@@PBG@Z ; CReg::CReg(HKEY__ * , ushort const * )
.text:10002CE6 xor ebx, ebx
.text:10002CE8 cmp [ebp + pReg], ebx
.text:10002CEB jz loc_10002E7A
.text:10002CF1 push g_pvAllocData ; pvData
.text:10002CF7 push 20
.text:10002CF9 pop esi
.text:10002CFA push esi ; iSize
.text:10002CFB call g_funcAlloc
.text:10002D01 cmp eax, ebx
.text:10002D03 pop ecx
.text:10002D04 pop ecx
.text:10002D05 jz short loc_10002D1D
.text:10002D07 push esi
.text:10002D08 push offset ? DeleteEntry@CLogEventLog@@SAXPAX@Z ; CLogEventLog::DeleteEntry( void * )
.text:10002D0D push 52
.text:10002D0F mov ecx, eax
.text:10002D11 call ?? 0SVSLinkManager@@QAE@KP6AXPAX@ZK@Z ; SVSLinkManager::SVSLinkManager( ulong , void ( * )( void
.text:10002CC8 ? StartAllLoggers@@YAHXZ proc near ; CODE XREF: EventLogWorkerThread( void * ) + 15
.text:10002CC8
.text:10002CC8 szName = word ptr - 218h
.text:10002CC8 pReg = dword ptr - 10h
.text:10002CC8
.text:10002CC8 push ebp
.text:10002CC9 mov ebp, esp
.text:10002CCB sub esp, 218h
.text:10002CD1 push ebx
.text:10002CD2 push esi
.text:10002CD3 push edi
.text:10002CD4 push offset ?? _C@_1EE@DKEDOPGO@ ? $AAS ? $AAY ? $AAS ? $AAT ? $AAE ? $AAM ? $AA ? 2 ? $AAC ? $AAu ? $AAr ? $AAr ? $AAe ? $AAn ? $AAt ? $AAC ? $AAo ? $AAn ? $AAt ? $AAr ? $AAo@ ; " SYSTEM/CurrentControlSet/EventLog "
.text:10002CD9 push HKEY_LOCAL_MACHINE
.text:10002CDE lea ecx, [ebp + pReg]
.text:10002CE1 call ?? 0CReg@@QAE@PAUHKEY__@@PBG@Z ; CReg::CReg(HKEY__ * , ushort const * )
.text:10002CE6 xor ebx, ebx
.text:10002CE8 cmp [ebp + pReg], ebx
.text:10002CEB jz loc_10002E7A
.text:10002CF1 push g_pvAllocData ; pvData
.text:10002CF7 push 20
.text:10002CF9 pop esi
.text:10002CFA push esi ; iSize
.text:10002CFB call g_funcAlloc
.text:10002D01 cmp eax, ebx
.text:10002D03 pop ecx
.text:10002D04 pop ecx
.text:10002D05 jz short loc_10002D1D
.text:10002D07 push esi
.text:10002D08 push offset ? DeleteEntry@CLogEventLog@@SAXPAX@Z ; CLogEventLog::DeleteEntry( void * )
.text:10002D0D push 52
.text:10002D0F mov ecx, eax
.text:10002D11 call ?? 0SVSLinkManager@@QAE@KP6AXPAX@ZK@Z ; SVSLinkManager::SVSLinkManager( ulong , void ( * )( void