请问C++代码怎么看呀。看得头晕呀?最近在分析RealVNC4.1
int main(int argc, const char* argv[]) {
int result = 0;
try {
// - Initialise the available loggers
//freopen("\\\\drupe\\tjr\\WinVNC4.log","ab",stderr);
//setbuf(stderr, 0);
initStdIOLoggers();
initFileLogger("C:\\temp\\WinVNC4.log");
rfb::win32::initEventLogLogger(VNCServerService::Name);
// - By default, just log errors to stderr
logParams.setParam("*:stderr:0");
// - Print program details and process the command line
programInfo();
processParams(argc, argv);
// - Run the server if required
if (runServer) {
// Start the network subsystem and run the server
VNCServerWin32 server;
if (runAsService) {
printf("Starting Service-Mode VNC Server.\n");
VNCServerService service(server);
service.start();
result = service.getStatus().dwWin32ExitCode;
} else {
printf("Starting User-Mode VNC Server.\n");
result = server.run(); //这里是我进入VNCServerWin32这个类的代码,也是我要进入的。
}
}
vlog.debug("WinVNC service destroyed");
} catch (rdr::Exception& e) {
MsgBoxOrLog(e.str(), true);
}
vlog.debug("WinVNC process quitting");
return result;
}
************************************下面就不知道哪个函数是主要的了。一个一个注释了还是找不到。好像是和消息有关。
下面进入 result = server.run(); //
int VNCServerWin32::run() {
{ Lock l(runLock);
hostThread = Thread::self();
runServer = true;
}
// - Create the tray icon (if possible)
trayIcon = new STrayIconThread(*this, IDI_ICON, IDI_CONNECTED, IDR_TRAY);
// - Register for notification of configuration changes
config.setCallback(this);
if (isServiceProcess())
config.setKey(HKEY_LOCAL_MACHINE, RegConfigPath);
else
config.setKey(HKEY_CURRENT_USER, RegConfigPath);
// - Set the address-changed handler for the RFB socket
rfbSock.setAddressChangeNotifier(this);
DWORD result = 0;
try {
vlog.debug("Entering message loop");
// - Run the server until we're told to quit
MSG msg;
int result = 0;
while (runServer) {
result = sockMgr.getMessage(&msg, NULL, 0, 0);
if (result < 0)
throw rdr::SystemException("getMessage", GetLastError());
if (!isServiceProcess() && (result == 0))
break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
vlog.debug("Server exited cleanly");
} catch (rdr::SystemException &s) {
vlog.error(s.str());
result = s.err;
} catch (rdr::Exception &e) {
vlog.error(e.str());
}
{ Lock l(runLock);
runServer = false;
hostThread = 0;
}
return result;
}
在这里找不到监听端口的代码。大虾们帮忙找一下。我要找到监听部分。看他是从哪里读取的密码
附件太大上传不了。有会分析的帮忙一下,QQ327543449:说明一下VNC分析
[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法