问题1:一下代码dbgevent我声明成dim dbgevent as debug_bug直接报错。貌似还需要开头声明debug??
问题2:while(key)该怎么翻译成vb的?注:我开头已经声明了dim key as boolean ( key=true)
bool CDebugInjector::Run( void )
{
DEBUG_EVENT dbgEvent;
DWORD dwContinueStatus;
// The debug loop. Runs until the debuggee terminats
while ( true )
{
WaitForDebugEvent(&dbgEvent, INFINITE);
dwContinueStatus = HandleDebugEvent( dbgEvent );
if ( dbgEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )
break;
ContinueDebugEvent( dbgEvent.dwProcessId,
dbgEvent.dwThreadId,
dwContinueStatus );
}
return true;
}
问题2:while(key)该怎么翻译成vb的?注:我开头已经声明了dim key as boolean ( key=true)
bool CDebugInjector::Run( void )
{
DEBUG_EVENT dbgEvent;
DWORD dwContinueStatus;
// The debug loop. Runs until the debuggee terminats
while ( true )
{
WaitForDebugEvent(&dbgEvent, INFINITE);
dwContinueStatus = HandleDebugEvent( dbgEvent );
if ( dbgEvent.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT )
break;
ContinueDebugEvent( dbgEvent.dwProcessId,
dbgEvent.dwThreadId,
dwContinueStatus );
}
return true;
}
while(key)是条件语句的VB表述是:
If key Then
……
End If
或:
If key=True Then
……
End If
dwDebugEventCode As Long
dwProcessId As Long
dwThreadId As Long
DATA(20) As Long '此处的声明方式不是绝对标准,仅是相对可处理的办法.
'实际代码中如果设计到(先假设变量被定义为 Dim DE As DEBUG_EVENT)
'如果出现 DE.XXX 而其中的XXX不是上面结构中前三个成员的时候,
'你的代码要根据这个结构做出修改.
End Type'然后才可以在程序里声明:
Dim dbgEvent As DEBUG_EVENT 'while ( true ) 比较好翻译,可以类似下面
Do While True
'相关执行代码
'注意: DO 的循环是条件真时一直循环,而你给的条件就是个 True(一直为真)
'所以可以说这里是个死循环, 一般的情况是,在此处的代码中会有一定的判断:
'符合了某条件就会跳出循环.
Loop
另外,DEBUG_EVENT是调试事件通知结构,属于底层较复杂结构,这么看起来你那个程序编写难度不低哦,所以如果你对 VB 了解不是太多的话,转起来恐怕。