From 619432b80d677c740829f3a4c00682cf312d78af Mon Sep 17 00:00:00 2001 From: anderson.peterle@previdencia.gov.br Date: Mon, 29 Mar 2010 18:56:09 +0000 Subject: [PATCH] Pequenas correcoes --- srcacic/WinVNC/MS-Logon/MSLogonACL/vncExportACL.cpp | 2 +- srcacic/WinVNC/WinVNC/CACIC_Auth.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------- srcacic/WinVNC/WinVNC/CACIC_Auth.h | 2 +- srcacic/WinVNC/WinVNC/CACIC_Con.cpp | 8 +++++--- srcacic/WinVNC/WinVNC/CACIC_Utils.cpp | 8 ++++++++ srcacic/WinVNC/WinVNC/CACIC_Utils.h | 26 +++++++++++++++++++++++++- srcacic/WinVNC/WinVNC/TextChat.cpp | 16 ++++++++-------- srcacic/WinVNC/WinVNC/WinVNC.vcproj | 4 ++++ srcacic/WinVNC/WinVNC/black_layered.cpp | 18 +++++++++--------- srcacic/WinVNC/WinVNC/inifile.cpp | 12 ++++++------ srcacic/WinVNC/WinVNC/rfbMisc.h | 2 +- srcacic/WinVNC/WinVNC/supInfoDlg.cpp | 5 +++-- srcacic/WinVNC/WinVNC/tableinitcmtemplate.cpp | 12 ++++++------ srcacic/WinVNC/WinVNC/videodriver.cpp | 2 +- srcacic/WinVNC/WinVNC/vistahook.cpp | 30 +++++++++++++++--------------- srcacic/WinVNC/WinVNC/vncDesktopSW.cpp | 12 ++++++------ srcacic/WinVNC/WinVNC/vncEncodeTight.cpp | 10 +++++----- srcacic/WinVNC/WinVNC/vncEncodeUltra.cpp | 12 ++++++------ srcacic/WinVNC/WinVNC/vncEncodeZlib.cpp | 26 +++++++++++++------------- srcacic/WinVNC/WinVNC/vncEncodeZlibHex.cpp | 20 ++++++++++---------- srcacic/WinVNC/WinVNC/vncbuffer.cpp | 16 ++++++++-------- srcacic/WinVNC/WinVNC/vncclient.cpp | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------- srcacic/WinVNC/WinVNC/vncdesktop.cpp | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------- srcacic/WinVNC/WinVNC/vncdesktopthread.cpp | 80 ++++++++++++++++++++++++++++++++++++++++---------------------------------------- srcacic/WinVNC/WinVNC/vncencodemgr.h | 42 +++++++++++++++++++++--------------------- srcacic/WinVNC/WinVNC/vncencoder.cpp | 32 ++++++++++++++++---------------- srcacic/WinVNC/WinVNC/vncencoderCursor.cpp | 14 +++++++------- srcacic/WinVNC/WinVNC/vnckeymap.cpp | 40 ++++++++++++++++++++-------------------- srcacic/WinVNC/WinVNC/vnclog.cpp | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- srcacic/WinVNC/WinVNC/vnclog.h | 13 ++++++++----- srcacic/WinVNC/WinVNC/vncmenu.cpp | 68 ++++++++++++++++++++++++++++++++++---------------------------------- srcacic/WinVNC/WinVNC/vncpasswd.h | 6 +++--- srcacic/WinVNC/WinVNC/vncserver.cpp | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------- srcacic/WinVNC/WinVNC/vncservice.cpp | 76 ++++++++++++++++++++++++++++++++++++++-------------------------------------- srcacic/WinVNC/WinVNC/vncsockconnect.cpp | 8 ++++---- srcacic/WinVNC/WinVNC/vsocket.cpp | 41 +++++++++++++++++++++-------------------- srcacic/WinVNC/WinVNC/winvnc.cpp | 61 +++++++++++++++++++++++++++++++------------------------------ srcacic/WinVNC/WinVNC/winvnc.rc | 6 +++--- 38 files changed, 809 insertions(+), 615 deletions(-) diff --git a/srcacic/WinVNC/MS-Logon/MSLogonACL/vncExportACL.cpp b/srcacic/WinVNC/MS-Logon/MSLogonACL/vncExportACL.cpp index 9d8d08f..05a26a6 100644 --- a/srcacic/WinVNC/MS-Logon/MSLogonACL/vncExportACL.cpp +++ b/srcacic/WinVNC/MS-Logon/MSLogonACL/vncExportACL.cpp @@ -35,7 +35,7 @@ bool vncExportACL::GetACL(PACL *pACL){ if (ERROR_SUCCESS != RegOpenKeyEx( HKEY_LOCAL_MACHINE, _T("Software\\ORL\\WinVNC3"), 0, KEY_QUERY_VALUE, &hk )){ - _ftprintf(stderr, _T("== Error %d: RegOpenKeyEx\n"), GetLastError()); + _ftprintf(stderr, _T("== Error %d: RegOpenKeyEx"), GetLastError()); __leave; } // Read the ACL value from the VNC registry key diff --git a/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp b/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp index 18147f4..b36114e 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp +++ b/srcacic/WinVNC/WinVNC/CACIC_Auth.cpp @@ -25,7 +25,7 @@ const UINT CACIC_Auth::TEMPO_IDLE = 15; bool CACIC_Auth::autentica() { - vnclog.Print(LL_SRLOG, VNCLOG("Autenticando o usuário no gerente web.\n")); + vnclog.Print(LL_SRLOG, VNCLOG("Autenticando o usuário no gerente web.")); string post = getPostComum(); @@ -40,16 +40,17 @@ bool CACIC_Auth::autentica() if (!autenticaUsuario(listaDominios)) return false; - vnclog.Print(LL_SRLOG, VNCLOG("Autenticação OK!\n")); + vnclog.Print(LL_SRLOG, VNCLOG("Autenticação OK!")); return true; } bool CACIC_Auth::autenticaUsuario(vector &listaDominios) { - string post; + string post ; char resposta[TAMANHO_RESPOSTA]; + vncPassDlg passDlg(listaDominios); if (listaDominios.at(0).id.compare("0") == 0) { @@ -59,8 +60,7 @@ bool CACIC_Auth::autenticaUsuario(vector &listaDominios) } // apresenta o dialogo de autenticação - do - { + do{ if (!passDlg.DoDialog()) return false; post.clear(); @@ -73,33 +73,47 @@ bool CACIC_Auth::autenticaUsuario(vector &listaDominios) post += "&id_servidor_autenticacao="; post += CACIC_Crypt::codifica(passDlg.m_dominio); + vnclog.Print(LL_SRLOG, post.data()); string session_script = m_scriptsPath; session_script.append(SET_SESSION_SCRIPT); - + CACIC_Con::sendHtppPost(m_servidorWeb, session_script, post, resposta, TAMANHO_RESPOSTA); - if(verificaAuthDominio(resposta)) { + + if(verificaAuthDominio(resposta)) { passDlg.m_authStat = vncPassDlg::AUTENTICADO; } else { passDlg.m_authStat = vncPassDlg::FALHA_AUTENTICACAO; } } while (passDlg.m_authStat != vncPassDlg::AUTENTICADO); - + + if (passDlg.m_authStat != vncPassDlg::SEM_AUTENTICACAO) { string msginfo = "Usuário Autenticado: "; msginfo += m_usuario; passDlg.m_authStat = vncPassDlg::AUTENTICADO; passDlg.m_msgInfo = msginfo; - if (!passDlg.DoDialog()) return false; - } + + if (listaDominios.at(0).id.compare("0") == 0) { + //Usuario sem autenticação + //Não necessita da atualização da "Janela" + return true; + } else { + //Usuario autenticado. + //Ocorre atualização da "Janela" de autenticação. + if (!passDlg.DoDialog()) return false; + } + } + return true; } + bool CACIC_Auth::validaTecnico(char nm_usuario_cli[], char te_senha_cli[], char te_node_address_cli[], char te_documento_referencial[], char te_motivo_conexao[], char te_so_cli[], const short vncCID, const char peerName[]) @@ -121,20 +135,48 @@ bool CACIC_Auth::validaTecnico(char nm_usuario_cli[], char te_senha_cli[], char post += te_motivo_conexao; post += "&te_so_cli="; post += te_so_cli; + + + + FILE *arq = NULL; + arq = fopen("ip_log5.txt","w"); + fprintf(arq, "IP1 > %d\n", (int)peerName); + fprintf(arq, "IP1 > %s\n",peerName); string auth_client_script = m_scriptsPath; auth_client_script += AUTH_CLIENT_SCRIPT; char resposta[TAMANHO_RESPOSTA]; - CACIC_Con::sendHtppPost(m_servidorWeb, auth_client_script, post, resposta, TAMANHO_RESPOSTA); + char ip_cliente[16]; + + //(Provisório) + //Salva ip do cliente para ser utilizado na estação de trabalho de suporte remoto. + //Após sendHttpPost() peerName irá possuir o IP do servidor. + sprintf(ip_cliente, "%s",peerName); + + fprintf(arq, "IP2 > %d\n", (int)peerName); + fprintf(arq, "IP2 > %s\n",peerName); + + CACIC_Con::sendHtppPost(m_servidorWeb, auth_client_script, post, resposta, TAMANHO_RESPOSTA); + + fprintf(arq, "IP3 > %d\n", (int)peerName); + fprintf(arq, "IP3 > %s\n",peerName); + + //Passando ip_cliente no lugar de peerName if (!verificaAuthTecnico(resposta, te_node_address_cli, te_documento_referencial, - te_motivo_conexao, te_so_cli, vncCID, peerName)) + te_motivo_conexao, te_so_cli, vncCID, ip_cliente)) { + fprintf(arq, "IP4 > %d\n", (int)peerName); + fprintf(arq, "IP4 > %s\n",peerName); + fclose(arq); + arq = NULL; + m_efetuarLogout = false; return false; } - + fclose(arq); + arq = NULL; return true; } @@ -250,7 +292,8 @@ bool CACIC_Auth::verificaAuthTecnico(char resposta[], char te_node_address_cli[] novoCliente.te_motivo_conexao = te_motivo_conexao_dec; novoCliente.te_so_visitante = te_so_cli; novoCliente.dt_hr_inicio_sessao = dt_hr_inicio_sessao_dec; - novoCliente.peerName = peerName; + novoCliente.peerName = peerName; + // adiciona o novo usuario a lista de usuarios visitantes m_listaClientes.push_back(novoCliente); diff --git a/srcacic/WinVNC/WinVNC/CACIC_Auth.h b/srcacic/WinVNC/WinVNC/CACIC_Auth.h index 1013d9a..c4d875e 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Auth.h +++ b/srcacic/WinVNC/WinVNC/CACIC_Auth.h @@ -39,7 +39,7 @@ public: * Exibida enquanto há suporte em andamento. */ supInfoDlg m_infoDlg; - + /** * Variável de decisão sobre o logout do sistema após o suporte. */ diff --git a/srcacic/WinVNC/WinVNC/CACIC_Con.cpp b/srcacic/WinVNC/WinVNC/CACIC_Con.cpp index 61bbe64..b47ca15 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Con.cpp +++ b/srcacic/WinVNC/WinVNC/CACIC_Con.cpp @@ -16,7 +16,7 @@ void CACIC_Con::conecta() if (!m_hSession) { - throw SRCException("Erro na conexão com o gerente web."); + throw SRCException("Circuito não disponível para abertura de sessão com o gerente web."); return; } @@ -25,7 +25,7 @@ void CACIC_Con::conecta() if (!m_hConnect) { - throw SRCException("Erro na conexão com o gerente web."); + throw SRCException("Protocolo HTTP não disponível para conexão com o gerente web."); return; } } @@ -69,8 +69,9 @@ bool CACIC_Con::getResponse(char buff[], unsigned long sz) } void CACIC_Con::sendHtppPost(const string &servidor, const string &script, string &post, - char resposta[], unsigned long sz) + char resposta[], unsigned long sz) { + memset(resposta, 0, sz); CACIC_Con cCon; @@ -82,6 +83,7 @@ void CACIC_Con::sendHtppPost(const string &servidor, const string &script, strin CACIC_Utils::simpleUrlEncode(post); cCon.sendRequest(HTTP_POST, script.c_str(), (char*) post.c_str()); cCon.getResponse(resposta, sz); + } catch(SRCException ex) { diff --git a/srcacic/WinVNC/WinVNC/CACIC_Utils.cpp b/srcacic/WinVNC/WinVNC/CACIC_Utils.cpp index 897ae94..bb3daef 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Utils.cpp +++ b/srcacic/WinVNC/WinVNC/CACIC_Utils.cpp @@ -277,3 +277,11 @@ string CACIC_Utils::getSOID() { return soIDStr; } + +int CACIC_Utils::DateCompare (SYSTEMTIME d1, SYSTEMTIME d2){ + if (Compare(d1.wYear,d2.wYear)!=0) + return Compare(d1.wYear,d2.wYear); + else if (Compare(d1.wMonth,d2.wMonth)!=0) + return Compare(d1.wMonth,d2.wMonth); + else return Compare(d1.wDay,d2.wDay); +}; \ No newline at end of file diff --git a/srcacic/WinVNC/WinVNC/CACIC_Utils.h b/srcacic/WinVNC/WinVNC/CACIC_Utils.h index d70395d..6fbbedc 100644 --- a/srcacic/WinVNC/WinVNC/CACIC_Utils.h +++ b/srcacic/WinVNC/WinVNC/CACIC_Utils.h @@ -10,7 +10,7 @@ #include using namespace std; -#include "windows.h" +#include /** * Struct referente a um usuário cliente. @@ -18,6 +18,7 @@ using namespace std; struct ClienteSRC { short vncCID; string peerName; + string id_usuario_visitante; string id_usuario_cli; string id_conexao; @@ -42,6 +43,23 @@ struct Dominio { string nome; }; +/** +* Função de Comparação de objetos de mesmo tipo. Resultados possíveis: +* maior, menor ou igual. +*/ +template +int Compare (T a, T b){ + if (a > b) return 1; + else if (a < b) return -1; + return 0; +}; + + /** + * Função que compara Datas do sistema, atraves da função declarada + * anteriormente: Compare. + */ + //int DateCompare (SYSTEMTIME d1, SYSTEMTIME d2); + class CACIC_Utils { public: @@ -142,6 +160,12 @@ public: */ static string getSOID(); + /** + * Função que compara Datas do sistema, atraves da função declarada + * anteriormente: Compare. + */ + static int DateCompare (SYSTEMTIME d1, SYSTEMTIME d2); + private: /** diff --git a/srcacic/WinVNC/WinVNC/TextChat.cpp b/srcacic/WinVNC/WinVNC/TextChat.cpp index 9b0b1dd..e182a5e 100644 --- a/srcacic/WinVNC/WinVNC/TextChat.cpp +++ b/srcacic/WinVNC/WinVNC/TextChat.cpp @@ -347,8 +347,8 @@ LRESULT CALLBACK TextChat::DoDialogThread(LPVOID lpParameter) _this->m_fTextChatRunning = true; // TODO: Place code here. HDESK desktop; - //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n")); - //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n")); + //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop ")); + //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL")); desktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | @@ -357,9 +357,9 @@ LRESULT CALLBACK TextChat::DoDialogThread(LPVOID lpParameter) ); if (desktop == NULL) - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error ")); else - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK")); HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId()); DWORD dummy; @@ -368,18 +368,18 @@ LRESULT CALLBACK TextChat::DoDialogThread(LPVOID lpParameter) if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy)) { - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation ")); } - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x"), new_name, desktop, old_desktop); if (!SetThreadDesktop(desktop)) { - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop ")); } if (!CloseDesktop(old_desktop)) - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)\n"), old_desktop, GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)"), old_desktop, GetLastError()); // [v1.0.2-jp1 fix] //DialogBoxParam(hAppInstance, MAKEINTRESOURCE(IDD_TEXTCHAT_DLG), diff --git a/srcacic/WinVNC/WinVNC/WinVNC.vcproj b/srcacic/WinVNC/WinVNC/WinVNC.vcproj index 8e4fb0e..1d3bd08 100644 --- a/srcacic/WinVNC/WinVNC/WinVNC.vcproj +++ b/srcacic/WinVNC/WinVNC/WinVNC.vcproj @@ -2955,6 +2955,10 @@ RelativePath=".\ClassDiagram.cd" > + + m_nomeVisitante.data()); SetDlgItemText(hwnd, IDC_INFO_IP, (LPSTR) _this->m_ip.data()); SetDlgItemText(hwnd, IDC_INFO_INICIO, (LPSTR) _this->m_dataInicio.data()); @@ -142,7 +143,7 @@ BOOL CALLBACK supInfoDlg::supInfoDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP ShowWindow(GetDlgItem(hwnd, IDC_ATENCAO_STATIC), FALSE); ShowWindow(GetDlgItem(hwnd, IDC_AVISO_SUPORTE), FALSE); ShowWindow(GetDlgItem(hwnd, IDC_NOME_LBL), FALSE); - ShowWindow(GetDlgItem(hwnd, IDC_IP_LBL), FALSE); + ShowWindow(GetDlgItem(hwnd, IDC_IP_LBL), FALSE); // ShowWindow(GetDlgItem(hwnd, IDC_INICIO_LBL), FALSE); ShowWindow(GetDlgItem(hwnd, IDC_DOC_LBL), FALSE); ShowWindow(GetDlgItem(hwnd, IDC_INFO_NOME), FALSE); diff --git a/srcacic/WinVNC/WinVNC/tableinitcmtemplate.cpp b/srcacic/WinVNC/WinVNC/tableinitcmtemplate.cpp index d8e07b0..88e164f 100644 --- a/srcacic/WinVNC/WinVNC/tableinitcmtemplate.cpp +++ b/srcacic/WinVNC/WinVNC/tableinitcmtemplate.cpp @@ -30,7 +30,7 @@ rfbInitColourMapSingleTableOUTVNC (char **table, rfbPixelFormat *in, rfbPixelFormat *out) { - vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable called\n")); + vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable called")); // ALLOCATE SPACE FOR COLOUR TABLE @@ -41,18 +41,18 @@ rfbInitColourMapSingleTableOUTVNC (char **table, *table = (char *)malloc(nEntries * sizeof(OUT_T)); if (*table == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to allocate translation table\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to allocate translation table")); return; } // Obtain the system palette HDC hDC = GetDcMirror(); - if (hDC==NULL) vnclog.Print(LL_ALL, VNCLOG("Using video Palette\n")); - else vnclog.Print(LL_ALL, VNCLOG("Using mirror video Palette\n")); + if (hDC==NULL) vnclog.Print(LL_ALL, VNCLOG("Using video Palette")); + else vnclog.Print(LL_ALL, VNCLOG("Using mirror video Palette")); if (hDC==NULL) hDC = GetDC(NULL); PALETTEENTRY palette[256]; UINT entries = ::GetSystemPaletteEntries(hDC, 0, 256, palette); - vnclog.Print(LL_INTINFO, VNCLOG("got %u palette entries\n"), GetLastError()); + vnclog.Print(LL_INTINFO, VNCLOG("got %u palette entries"), GetLastError()); ReleaseDC(NULL, hDC); // - Set the rest of the palette to something nasty but usable @@ -88,7 +88,7 @@ rfbInitColourMapSingleTableOUTVNC (char **table, #endif } - vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable done\n")); + vnclog.Print(LL_ALL, VNCLOG("rfbInitColourMapSingleTable done")); } #undef OUT_T diff --git a/srcacic/WinVNC/WinVNC/videodriver.cpp b/srcacic/WinVNC/WinVNC/videodriver.cpp index a04686d..97c0cff 100644 --- a/srcacic/WinVNC/WinVNC/videodriver.cpp +++ b/srcacic/WinVNC/WinVNC/videodriver.cpp @@ -154,7 +154,7 @@ PCHAR VIDEODRIVER::VideoMemory_GetSharedMemory(void) } else { - vnclog.Print(LL_INTERR, VNCLOG("Error video.dat \n")); + vnclog.Print(LL_INTERR, VNCLOG("Error video.dat ")); } return pVideoMemory; diff --git a/srcacic/WinVNC/WinVNC/vistahook.cpp b/srcacic/WinVNC/WinVNC/vistahook.cpp index a254177..60e1311 100644 --- a/srcacic/WinVNC/WinVNC/vistahook.cpp +++ b/srcacic/WinVNC/WinVNC/vistahook.cpp @@ -48,7 +48,7 @@ DWORD WINAPI hookwatch(LPVOID lpParam) bool vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache) { - vnclog.Print(LL_INTERR, VNCLOG("counter,g_Oldcounter %i %i \n"),ringbuffer->counter,g_Oldcounter); + vnclog.Print(LL_INTERR, VNCLOG("counter,g_Oldcounter %i %i "),ringbuffer->counter,g_Oldcounter); if (ringbuffer->counter==g_Oldcounter) return 0; int counter=ringbuffer->counter; if (counter<1 || counter>1999) return 0; @@ -67,7 +67,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache rect.br.x-=m_desktop->m_ScreenOffsetx; rect.tl.y-=m_desktop->m_ScreenOffsety; rect.br.y-=m_desktop->m_ScreenOffsety; - //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); + //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i "),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); rect = rect.intersect(m_desktop->m_Cliprect); if (!rect.is_empty()) @@ -83,7 +83,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache cinfo.cbSize=sizeof(MyCURSORINFO); MyGetCursorInfo(&cinfo); m_desktop->SetCursor(cinfo.hCursor); - //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i \n"),cinfo.hCursor); + //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i "),cinfo.hCursor); }*/ @@ -107,7 +107,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache rect.br.x-=m_desktop->m_ScreenOffsetx; rect.tl.y-=m_desktop->m_ScreenOffsety; rect.br.y-=m_desktop->m_ScreenOffsety; - //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); + //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i "),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); rect = rect.intersect(m_desktop->m_Cliprect); if (!rect.is_empty()) @@ -123,7 +123,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache cinfo.cbSize=sizeof(MyCURSORINFO); MyGetCursorInfo(&cinfo); m_desktop->SetCursor(cinfo.hCursor); - //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i \n"),cinfo.hCursor); + //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i "),cinfo.hCursor); }*/ } @@ -141,7 +141,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache rect.br.x-=m_desktop->m_ScreenOffsetx; rect.tl.y-=m_desktop->m_ScreenOffsety; rect.br.y-=m_desktop->m_ScreenOffsety; - //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); + //vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i "),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); rect = rect.intersect(m_desktop->m_Cliprect); if (!rect.is_empty()) @@ -157,7 +157,7 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache cinfo.cbSize=sizeof(MyCURSORINFO); MyGetCursorInfo(&cinfo); m_desktop->SetCursor(cinfo.hCursor); - //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i \n"),cinfo.hCursor); + //vnclog.Print(LL_INTERR, VNCLOG("Cursor %i "),cinfo.hCursor); }*/ } @@ -171,8 +171,8 @@ vncDesktopThread::Handle_Ringbuffer(mystruct *ringbuffer,rfb::Region2D &rgncache DWORD WINAPI Cadthread(LPVOID lpParam) { HDESK desktop; - //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n")); - //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n")); + //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop ")); + //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL")); desktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | @@ -181,9 +181,9 @@ DWORD WINAPI Cadthread(LPVOID lpParam) ); if (desktop == NULL) - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error ")); else - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK")); HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId()); DWORD dummy; @@ -192,21 +192,21 @@ DWORD WINAPI Cadthread(LPVOID lpParam) if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy)) { - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation ")); } - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x"), new_name, desktop, old_desktop); if (!SetThreadDesktop(desktop)) { - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop ")); } char user[150]; DWORD length=150; GetUserName(user, &length); if (!CloseDesktop(old_desktop)) - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d) %s\n"), old_desktop, GetLastError(),user); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d) %s"), old_desktop, GetLastError(),user); //Full path needed, sometimes it just default to system32 char WORKDIR[MAX_PATH]; diff --git a/srcacic/WinVNC/WinVNC/vncDesktopSW.cpp b/srcacic/WinVNC/WinVNC/vncDesktopSW.cpp index 67cc1cb..57e9c93 100644 --- a/srcacic/WinVNC/WinVNC/vncDesktopSW.cpp +++ b/srcacic/WinVNC/WinVNC/vncDesktopSW.cpp @@ -102,7 +102,7 @@ BOOL vncDesktop:: CalculateSWrect(RECT &rect) //eliminate other little windows if ((m_SWHeight!=(rect.bottom-rect.top)) || (m_SWWidth!=(rect.right-rect.left))) m_SWSizeChanged=TRUE; - //vnclog.Print(LL_INTINFO, VNCLOG("screen format %d %d %d %d\n"), + //vnclog.Print(LL_INTINFO, VNCLOG("screen format %d %d %d %d"), // rect.top, // rect.bottom,rect.right,rect.left); if ((rect.bottom-rect.top)<64||(rect.right-rect.left)<128 || rect.bottom<0 ||rect.top<0 || rect.right<0 || @@ -145,13 +145,13 @@ void vncDesktop::SWinit() m_SWmoved=FALSE; m_SWOffsetx=0; m_SWOffsety=0; - vnclog.Print(LL_INTINFO, VNCLOG("SWinit \n")); + vnclog.Print(LL_INTINFO, VNCLOG("SWinit ")); } rfb::Rect vncDesktop::GetSize() { -//vnclog.Print(LL_INTINFO, VNCLOG("GetSize \n")); +//vnclog.Print(LL_INTINFO, VNCLOG("GetSize ")); if (m_server->SingleWindow()) { RECT rect; @@ -170,7 +170,7 @@ else if (!m_videodriver) } else { -// vnclog.Print(LL_INTINFO, VNCLOG("GetSize \n")); +// vnclog.Print(LL_INTINFO, VNCLOG("GetSize ")); return rfb::Rect(0,0,mymonitor[current_monitor-1].Width,mymonitor[current_monitor-1].Height); } } @@ -178,7 +178,7 @@ else if (!m_videodriver) rfb::Rect vncDesktop::GetQuarterSize() { - vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize \n")); + vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize ")); if (m_server->SingleWindow()) { RECT rect; @@ -217,7 +217,7 @@ else m_Cliprect.tl.y=0; m_Cliprect.br.x=m_bmrect.br.x; m_Cliprect.br.y=m_bmrect.br.y; - vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize \n")); + vnclog.Print(LL_INTINFO, VNCLOG("GetQuarterSize ")); return rfb::Rect(0, 0, m_bmrect.br.x, m_bmrect.br.y/4); } } diff --git a/srcacic/WinVNC/WinVNC/vncEncodeTight.cpp b/srcacic/WinVNC/WinVNC/vncEncodeTight.cpp index bc58080..25b884e 100644 --- a/srcacic/WinVNC/WinVNC/vncEncodeTight.cpp +++ b/srcacic/WinVNC/WinVNC/vncEncodeTight.cpp @@ -743,13 +743,13 @@ vncEncodeTight::CompressData(BYTE *dest, int streamId, int dataLen, pz->opaque = Z_NULL; vnclog.Print(LL_INTINFO, - VNCLOG("calling deflateInit2 with zlib level:%d\n"), + VNCLOG("calling deflateInit2 with zlib level:%d"), zlibLevel); int err = deflateInit2 (pz, zlibLevel, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, zlibStrategy); if (err != Z_OK) { vnclog.Print(LL_INTINFO, - VNCLOG("deflateInit2 returned error:%d:%s\n"), + VNCLOG("deflateInit2 returned error:%d:%s"), err, pz->msg); return -1; } @@ -769,12 +769,12 @@ vncEncodeTight::CompressData(BYTE *dest, int streamId, int dataLen, // Change compression parameters if needed. if (zlibLevel != m_zsLevel[streamId]) { vnclog.Print(LL_INTINFO, - VNCLOG("calling deflateParams with zlib level:%d\n"), + VNCLOG("calling deflateParams with zlib level:%d"), zlibLevel); int err = deflateParams (pz, zlibLevel, zlibStrategy); if (err != Z_OK) { vnclog.Print(LL_INTINFO, - VNCLOG("deflateParams returned error:%d:%s\n"), + VNCLOG("deflateParams returned error:%d:%s"), err, pz->msg); return -1; } @@ -784,7 +784,7 @@ vncEncodeTight::CompressData(BYTE *dest, int streamId, int dataLen, // Actual compression. if ( deflate (pz, Z_SYNC_FLUSH) != Z_OK || pz->avail_in != 0 || pz->avail_out == 0 ) { - vnclog.Print(LL_INTINFO, VNCLOG("deflate() call failed.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("deflate() call failed.")); return -1; } diff --git a/srcacic/WinVNC/WinVNC/vncEncodeUltra.cpp b/srcacic/WinVNC/WinVNC/vncEncodeUltra.cpp index b35a33e..adeaa34 100644 --- a/srcacic/WinVNC/WinVNC/vncEncodeUltra.cpp +++ b/srcacic/WinVNC/WinVNC/vncEncodeUltra.cpp @@ -87,10 +87,10 @@ vncEncodeUltra::~vncEncodeUltra() m_QueueCompressedbuffer = NULL; } - vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder stats: rawdata=%d protocol=%d compressed=%d transmitted=%d\n"),dataSize, rectangleOverhead, encodedSize,transmittedSize); + vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder stats: rawdata=%d protocol=%d compressed=%d transmitted=%d"),dataSize, rectangleOverhead, encodedSize,transmittedSize); if (dataSize != 0) { - vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder efficiency: %.3f%%\n"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize)); + vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder efficiency: %.3f%%"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize)); } } @@ -154,7 +154,7 @@ vncEncodeUltra::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const rfb partialRect.bottom = rect.br.y; /* WBB: For testing purposes only! */ - // vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d\n"), rect.right, rect.left, rect.top, rect.bottom); + // vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d"), rect.right, rect.left, rect.top, rect.bottom); if (rectW==0) return 0; if (rectH==0) return 0; @@ -173,7 +173,7 @@ vncEncodeUltra::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const rfb partialRect.bottom = partialRect.top + linesToComp; /* WBB: For testing purposes only! */ - // vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d\n"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom); + // vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom); partialSize = EncodeOneRect( source,dest, partialRect,outConn ); totalSize += partialSize; @@ -332,7 +332,7 @@ vncEncodeUltra::AddToQueu2(BYTE *source,int sizerect,VSocket *outConn,int update // Format the UltraHeader CacheZipHeader->nBytes = Swap32IfLE(out_len); - vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),out_len,rawDataSize,1); + vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d"),out_len,rawDataSize,1); outConn->SendExactQueue((char *)m_QueueCompressedbuffer, out_len+sz_rfbFramebufferUpdateRectHeader+sz_rfbZlibHeader); // Update statistics encodedSize += sz_rfbZlibHeader + out_len; @@ -389,7 +389,7 @@ vncEncodeUltra::SendUltrarects(VSocket *outConn) rfbZlibHeader CacheZipHeader; CacheZipHeader.nBytes = Swap32IfLE(out_len); - vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),out_len,rawDataSize,NRects); + vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d"),out_len,rawDataSize,NRects); outConn->SendExactQueue((char *)&CacheRectsHeader, sizeof(CacheRectsHeader)); outConn->SendExactQueue((char *)&CacheZipHeader, sizeof(CacheZipHeader)); outConn->SendExactQueue((char *)m_QueueCompressedbuffer, out_len); diff --git a/srcacic/WinVNC/WinVNC/vncEncodeZlib.cpp b/srcacic/WinVNC/WinVNC/vncEncodeZlib.cpp index 4825dd0..ea01a90 100644 --- a/srcacic/WinVNC/WinVNC/vncEncodeZlib.cpp +++ b/srcacic/WinVNC/WinVNC/vncEncodeZlib.cpp @@ -102,10 +102,10 @@ vncEncodeZlib::~vncEncodeZlib() } compStreamInited = false; - vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder stats: rawdata=%d protocol=%d compressed=%d transmitted=%d\n"),dataSize, rectangleOverhead, encodedSize,transmittedSize); + vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder stats: rawdata=%d protocol=%d compressed=%d transmitted=%d"),dataSize, rectangleOverhead, encodedSize,transmittedSize); if (dataSize != 0) { - vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder efficiency: %.3f%%\n"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize)); + vnclog.Print(LL_INTINFO, VNCLOG("Zlib Xor encoder efficiency: %.3f%%"),(double)((double)((dataSize - transmittedSize) * 100) / dataSize)); } } @@ -182,7 +182,7 @@ vncEncodeZlib::EncodeRect(BYTE *source,BYTE *source2, VSocket *outConn, BYTE *de partialRect.bottom = rect.br.y; /* WBB: For testing purposes only! */ - // vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d\n"), rect.right, rect.left, rect.top, rect.bottom); + // vnclog.Print(LL_INTINFO, VNCLOG("rect.right=%d rect.left=%d rect.top=%d rect.bottom=%d"), rect.right, rect.left, rect.top, rect.bottom); maxLines = ( ZLIB_MAX_SIZE(rectW) / rectW ); linesRemaining = rectH; @@ -199,7 +199,7 @@ vncEncodeZlib::EncodeRect(BYTE *source,BYTE *source2, VSocket *outConn, BYTE *de partialRect.bottom = partialRect.top + linesToComp; /* WBB: For testing purposes only! */ - // vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d\n"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom); + // vnclog.Print(LL_INTINFO, VNCLOG("partialRect.right=%d partialRect.left=%d partialRect.top=%d partialRect.bottom=%d"), partialRect.right, partialRect.left, partialRect.top, partialRect.bottom); partialSize = EncodeOneRect( source,source2, dest, partialRect,outConn ); totalSize += partialSize; @@ -302,7 +302,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT { surh->encoding = Swap32IfLE(rfbEncodingSolidColor); memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,compStream.avail_in); - //vnclog.Print(LL_INTINFO, VNCLOG("Solid \n")); + //vnclog.Print(LL_INTINFO, VNCLOG("Solid ")); if (m_queueEnable) { AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +newsize,outConn,0); @@ -314,7 +314,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT { compStream.avail_in = newsize; surh->encoding = Swap32IfLE(rfbEncodingXORMonoColor_Zlib); - //vnclog.Print(LL_INTINFO, VNCLOG("Mono \n")); + //vnclog.Print(LL_INTINFO, VNCLOG("Mono ")); if (m_queueEnable) { memcpy(dest+sz_rfbFramebufferUpdateRectHeader,m_buffer,newsize); @@ -328,7 +328,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT { compStream.avail_in = newsize; surh->encoding = Swap32IfLE(rfbEncodingXORMultiColor_Zlib); - ///vnclog.Print(LL_INTINFO, VNCLOG("MultiColor \n")); + ///vnclog.Print(LL_INTINFO, VNCLOG("MultiColor ")); break; } @@ -342,7 +342,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT AddToQueu(dest,sz_rfbFramebufferUpdateRectHeader +newsize,outConn,1); return 0; } - ///vnclog.Print(LL_INTINFO, VNCLOG("XOR \n")); + ///vnclog.Print(LL_INTINFO, VNCLOG("XOR ")); break; } @@ -357,7 +357,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT } surh->encoding = Swap32IfLE(rfbEncodingZlib); - ///vnclog.Print(LL_INTINFO, VNCLOG("Pure \n")); + ///vnclog.Print(LL_INTINFO, VNCLOG("Pure ")); break; } } @@ -377,7 +377,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT compStream.zfree = Z_NULL; compStream.opaque = Z_NULL; - //vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d\n"), m_compresslevel); + //vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d"), m_compresslevel); deflateResult = deflateInit2( &compStream, m_compresslevel, @@ -387,7 +387,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT Z_DEFAULT_STRATEGY ); if ( deflateResult != Z_OK ) { - vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s\n"), deflateResult, compStream.msg); + vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s"), deflateResult, compStream.msg); return vncEncoder::EncodeRect(source, dest, rect); } compStreamInited = true; @@ -401,7 +401,7 @@ vncEncodeZlib::EncodeOneRect(BYTE *source,BYTE *source2, BYTE *dest, const RECT if ( deflateResult != Z_OK ) { - vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s\n"), deflateResult, compStream.msg); + vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s"), deflateResult, compStream.msg); return vncEncoder::EncodeRect(source, dest, rect); } @@ -665,7 +665,7 @@ vncEncodeZlib::SendZlibrects(VSocket *outConn) rfbZlibHeader CacheZipHeader; CacheZipHeader.nBytes = Swap32IfLE(maxCompSize); - vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d\r\n"),maxCompSize,rawDataSize,NRects); + vnclog.Print(LL_INTINFO, VNCLOG("********QUEUEQUEUE********** %d %d %d"),maxCompSize,rawDataSize,NRects); outConn->SendExactQueue((char *)&CacheRectsHeader, sizeof(CacheRectsHeader)); outConn->SendExactQueue((char *)&CacheZipHeader, sizeof(CacheZipHeader)); outConn->SendExactQueue((char *)m_QueueCompressedbuffer, maxCompSize); diff --git a/srcacic/WinVNC/WinVNC/vncEncodeZlibHex.cpp b/srcacic/WinVNC/WinVNC/vncEncodeZlibHex.cpp index bc4e25f..2837756 100644 --- a/srcacic/WinVNC/WinVNC/vncEncodeZlibHex.cpp +++ b/srcacic/WinVNC/WinVNC/vncEncodeZlibHex.cpp @@ -201,10 +201,10 @@ vncEncodeZlibHex::zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct if (lzo_init() == LZO_E_OK) lzo=true; } if (lzo1x_1_compress(from_buf,length,to_buf,&out_len,wrkmem)!=LZO_E_OK) - vnclog.Print(LL_INTINFO, VNCLOG("Error compressing \n")); + vnclog.Print(LL_INTINFO, VNCLOG("Error compressing ")); return out_len;*/ - //vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d \n"), length,out_len); + //vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d "), length,out_len); // If necessary, the first time, initialize the compressor state. @@ -217,7 +217,7 @@ vncEncodeZlibHex::zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct compressor->zfree = Z_NULL; compressor->opaque = Z_NULL; - vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d\n"), m_compresslevel); + vnclog.Print(LL_INTINFO, VNCLOG("calling deflateInit2 with zlib level:%d"), m_compresslevel); deflateResult = deflateInit2( compressor, m_compresslevel, @@ -227,7 +227,7 @@ vncEncodeZlibHex::zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct Z_DEFAULT_STRATEGY ); if ( deflateResult != Z_OK ) { - vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s\n"), deflateResult, compressor->msg); + vnclog.Print(LL_INTINFO, VNCLOG("deflateInit2 returned error:%d:%s"), deflateResult, compressor->msg); return -1; } @@ -241,13 +241,13 @@ vncEncodeZlibHex::zlibCompress(BYTE *from_buf, BYTE *to_buf, UINT length, struct if ( deflateResult != Z_OK ) { - vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s\n"), deflateResult, compressor->msg); + vnclog.Print(LL_INTINFO, VNCLOG("deflate returned error:%d:%s"), deflateResult, compressor->msg); return -1; } -// vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d %d \n"), length,compressor->total_out - previousTotalOut,out_len); -// if (length/2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####50######### \n"), length); -// if (length/3*2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####33######### \n"), length); -// if (length/4*3>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####25######### \n"), length); +// vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d %d %d "), length,compressor->total_out - previousTotalOut,out_len); +// if (length/2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####50######### "), length); +// if (length/3*2>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####33######### "), length); +// if (length/4*3>out_len) vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex length %d #####25######### "), length); return compressor->total_out - previousTotalOut; } @@ -622,7 +622,7 @@ vncEncodeZlibHex::AddToQueu(BYTE *source,int sizerect,VSocket *outConn) outConn->SendExactQueue( (char *)source,sizerect); return; } -// vnclog.Print(LL_INTINFO, VNCLOG("Add %i %i \n"),sizerect,m_Queuelen); +// vnclog.Print(LL_INTINFO, VNCLOG("Add %i %i "),sizerect,m_Queuelen); memcpy(m_Queuebuffer+m_Queuelen,source,sizerect); m_Queuelen+=sizerect; } diff --git a/srcacic/WinVNC/WinVNC/vncbuffer.cpp b/srcacic/WinVNC/WinVNC/vncbuffer.cpp index 92d2d7c..a64e452 100644 --- a/srcacic/WinVNC/WinVNC/vncbuffer.cpp +++ b/srcacic/WinVNC/WinVNC/vncbuffer.cpp @@ -182,7 +182,7 @@ vncBuffer::CheckBuffer() // Check that the local format buffers are sufficient if ((m_backbuffsize != m_desktop->ScreenBuffSize()) || !m_freemainbuff) { - vnclog.Print(LL_INTINFO, VNCLOG("request local buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTINFO, VNCLOG("request local buffer[%d]"), m_desktop->ScreenBuffSize()); if (m_freemainbuff) { // Slow blits were enabled - free the slow blit buffer // Modif rdv@2002 - v1.1.x - Videodriver @@ -223,13 +223,13 @@ vncBuffer::CheckBuffer() if (m_mainbuff) { // Prevent us from freeing the DIBsection buffer m_freemainbuff = FALSE; - vnclog.Print(LL_INTINFO, VNCLOG("fast blits detected - using DIBsection buffer\n")); + vnclog.Print(LL_INTINFO, VNCLOG("fast blits detected - using DIBsection buffer")); } else { // Create our own buffer to copy blits through m_freemainbuff = TRUE; if ((m_mainbuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate main buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate main buffer[%d]"), m_desktop->ScreenBuffSize()); return FALSE; } memset(m_mainbuff, 0, m_desktop->ScreenBuffSize()); @@ -238,7 +238,7 @@ vncBuffer::CheckBuffer() // Always create a back buffer if ((m_backbuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate back buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate back buffer[%d]"), m_desktop->ScreenBuffSize()); return FALSE; } @@ -246,7 +246,7 @@ vncBuffer::CheckBuffer() { if ((m_cachebuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]"), m_desktop->ScreenBuffSize()); return FALSE; } ClearCache(); @@ -261,7 +261,7 @@ vncBuffer::CheckBuffer() // Modif sf@2002 - Scaling if ((m_ScaledBuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate scaled buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate scaled buffer[%d]"), m_desktop->ScreenBuffSize()); return FALSE; } m_ScaledSize = m_desktop->ScreenBuffSize(); @@ -277,7 +277,7 @@ vncBuffer::CheckBuffer() } - vnclog.Print(LL_INTINFO, VNCLOG("local buffer=%d\n"), m_backbuffsize); + vnclog.Print(LL_INTINFO, VNCLOG("local buffer=%d"), m_backbuffsize); return TRUE; } @@ -1053,7 +1053,7 @@ vncBuffer::EnableCache(BOOL enable) } if ((m_cachebuff = new BYTE [m_desktop->ScreenBuffSize()]) == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]\n"), m_desktop->ScreenBuffSize()); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate cache buffer[%d]"), m_desktop->ScreenBuffSize()); return; } ClearCache(); diff --git a/srcacic/WinVNC/WinVNC/vncclient.cpp b/srcacic/WinVNC/WinVNC/vncclient.cpp index 2e7f5a5..1d4e24b 100644 --- a/srcacic/WinVNC/WinVNC/vncclient.cpp +++ b/srcacic/WinVNC/WinVNC/vncclient.cpp @@ -163,7 +163,7 @@ public: if(WAIT_OBJECT_0 != WaitForSingleObject(*phMutex, INFINITE)) { - vnclog.Print(LL_INTERR, VNCLOG("Could not get access to the mutex\n")); + vnclog.Print(LL_INTERR, VNCLOG("Could not get access to the mutex")); } } ~MutexAutoLock() @@ -178,7 +178,7 @@ public: BOOL vncClientUpdateThread::Init(vncClient *client) { - vnclog.Print(LL_INTINFO, VNCLOG("init update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("init update thread")); m_client = client; omni_mutex_lock l(m_client->GetUpdateLock()); @@ -197,7 +197,7 @@ vncClientUpdateThread::~vncClientUpdateThread() { if (m_signal) delete m_signal; if (m_sync_sig) delete m_sync_sig; - vnclog.Print(LL_INTINFO, VNCLOG("update thread gone\n")); + vnclog.Print(LL_INTINFO, VNCLOG("update thread gone")); m_client->m_updatethread=NULL; } @@ -214,7 +214,7 @@ vncClientUpdateThread::Trigger() void vncClientUpdateThread::Kill() { - vnclog.Print(LL_INTINFO, VNCLOG("kill update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("kill update thread")); omni_mutex_lock l(m_client->GetUpdateLock()); m_active=FALSE; @@ -250,9 +250,9 @@ vncClientUpdateThread::EnableUpdates(BOOL enable) { // ALWAYS call this with the UpdateLock held! if (enable) { - vnclog.Print(LL_INTINFO, VNCLOG("enable update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("enable update thread")); } else { - vnclog.Print(LL_INTINFO, VNCLOG("disable update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("disable update thread")); } m_enable = enable; @@ -263,9 +263,9 @@ vncClientUpdateThread::EnableUpdates(BOOL enable) /*if (m_sync_sig->timedwait(now_sec+1,0)==0) { // m_signal->signal(); - vnclog.Print(LL_INTINFO, VNCLOG("thread timeout\n")); + vnclog.Print(LL_INTINFO, VNCLOG("thread timeout")); } */ - vnclog.Print(LL_INTINFO, VNCLOG("enable/disable synced\n")); + vnclog.Print(LL_INTINFO, VNCLOG("enable/disable synced")); } void* @@ -279,7 +279,7 @@ vncClientUpdateThread::run_undetached(void *arg) updates_sent=0; - vnclog.Print(LL_INTINFO, VNCLOG("starting update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("starting update thread")); // Set client update threads to high priority // *** set_priority(omni_thread::PRIORITY_HIGH); @@ -476,9 +476,9 @@ vncClientUpdateThread::run_undetached(void *arg) yield(); } - vnclog.Print(LL_INTINFO, VNCLOG("stopping update thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("stopping update thread")); - vnclog.Print(LL_INTERR, "client sent %lu updates\n", updates_sent); + vnclog.Print(LL_INTERR, "client sent %lu updates", updates_sent); return 0; } @@ -611,7 +611,7 @@ vncClientThread::InitAuthenticate() // Alterando o timeout para que o cliente tenha tempo de enviar as informações do técnico. if (!m_socket->SetTimeout(60000)) - vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); // Lê o username if (!m_socket->ReadExact(nm_usuario_cli, sizeof(nm_usuario_cli))) @@ -636,10 +636,13 @@ vncClientThread::InitAuthenticate() // Voltando o timeout ao normal. if (!m_socket->SetTimeout(30000)) - vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); BOOL auth_ok = TRUE; + + char *name = m_socket->GetPeerName(); + // verifica o técnico que está querendo logar e o adiciona na lista. if (!CACIC_Auth::getInstance()->validaTecnico(nm_usuario_cli, te_senha_cli, te_node_address_cli, te_documento_referencial, @@ -658,6 +661,10 @@ vncClientThread::InitAuthenticate() if (m_auth) { verified = vncServer::aqrAccept; } else { + char *name; + + name = m_socket->GetPeerName(); + verified = m_server->VerifyHost(m_socket->GetPeerName()); } @@ -734,7 +741,7 @@ vncClientThread::InitAuthenticate() if (!ok) { - vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client rejected\n")); + vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client rejected")); // Send an error message to the client CARD32 auth_val = Swap32IfLE(rfbConnFailed); @@ -769,7 +776,7 @@ vncClientThread::InitAuthenticate() if (!ok) { - vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client accepted\n")); + vnclog.Print(LL_CONNERR, VNCLOG("loopback connection attempted - client accepted")); m_client->m_IsLoopback=true; } } @@ -787,7 +794,7 @@ vncClientThread::InitAuthenticate() CARD32 authmsg; if (!auth_ok) { - vnclog.Print(LL_CONNERR, VNCLOG("authentication failed\n")); + vnclog.Print(LL_CONNERR, VNCLOG("authentication failed")); ////////////////// // LOG it also in the event ////////////////// @@ -856,7 +863,7 @@ vncClientThread::InitAuthenticate() // Existing if (m_server->AuthClientCount() > 0) { - vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected\n")); + vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected")); return FALSE; } } @@ -866,14 +873,14 @@ vncClientThread::InitAuthenticate() if (m_server->ConnectPriority() < 1) { // Incoming - vnclog.Print(LL_INTINFO, VNCLOG("non-shared connection - disconnecting old clients\n")); + vnclog.Print(LL_INTINFO, VNCLOG("non-shared connection - disconnecting old clients")); m_server->KillAuthClients(); } else if (m_server->ConnectPriority() > 1) { // Existing if (m_server->AuthClientCount() > 0) { - vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected\n")); + vnclog.Print(LL_CLIENTS, VNCLOG("connections already exist - client rejected")); return FALSE; } } @@ -912,12 +919,12 @@ vncClientThread::AuthMsLogon() { if (!m_socket->ReadExact(passwd, sizeof(passwd))) return FALSE; int64ToBytes(dh.createEncryptionKey(bytesToInt64(resp)), (char*) key); - vnclog.Print(0, "After DH: g=%I64u, m=%I64u, i=%I64u, key=%I64u\n", bytesToInt64(gen), bytesToInt64(mod), bytesToInt64(pub), bytesToInt64((char*) key)); + vnclog.Print(0, "After DH: g=%I64u, m=%I64u, i=%I64u, key=%I64u", bytesToInt64(gen), bytesToInt64(mod), bytesToInt64(pub), bytesToInt64((char*) key)); vncDecryptBytes((unsigned char*) user, sizeof(user), key); user[255] = '\0'; vncDecryptBytes((unsigned char*) passwd, sizeof(passwd), key); passwd[63] = '\0'; int result = CheckUserGroupPasswordUni(user, passwd, m_client->GetClientName()); - vnclog.Print(LL_INTINFO, "CheckUserGroupPasswordUni result=%i\n", result); + vnclog.Print(LL_INTINFO, "CheckUserGroupPasswordUni result=%i", result); if (result == 2) { m_client->EnableKeyboard(false); m_client->EnablePointer(false); @@ -928,7 +935,7 @@ vncClientThread::AuthMsLogon() { return FALSE; if (!result) { - vnclog.Print(LL_CONNERR, VNCLOG("authentication failed\n")); + vnclog.Print(LL_CONNERR, VNCLOG("authentication failed")); return FALSE; } return TRUE; @@ -1002,7 +1009,7 @@ vncClientThread::run(void *arg) // IMPORTANT : ALWAYS call RemoveClient on the server before quitting // this thread. - vnclog.Print(LL_CLIENTS, VNCLOG("client connected : %s (%hd)\n"), + vnclog.Print(LL_CLIENTS, VNCLOG("client connected : %s (%hd)"), m_client->GetClientName(), m_client->GetClientId()); // Save the handle to the thread's original desktop @@ -1010,17 +1017,17 @@ vncClientThread::run(void *arg) // To avoid people connecting and then halting the connection, set a timeout if (!m_socket->SetTimeout(30000)) - vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); // sf@2002 - DSM Plugin - Tell the client's socket where to find the DSMPlugin if (m_server->GetDSMPluginPointer() != NULL) { m_socket->SetDSMPluginPointer(m_server->GetDSMPluginPointer()); - vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Pointer to socket OK\n")); + vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Pointer to socket OK")); } else { - vnclog.Print(LL_INTINFO, VNCLOG("Invalid DSMPlugin Pointer\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Invalid DSMPlugin Pointer")); return; } @@ -1042,7 +1049,7 @@ vncClientThread::run(void *arg) // This is a dirty workaround. We ignore all Multi Viewer connection settings... if (m_server->AuthClientCount() > 0) { - vnclog.Print(LL_CLIENTS, VNCLOG("A connection using DSM already exist - client rejected to avoid crash \n")); + vnclog.Print(LL_CLIENTS, VNCLOG("A connection using DSM already exist - client rejected to avoid crash ")); return; } @@ -1066,7 +1073,7 @@ vncClientThread::run(void *arg) return; } - vnclog.Print(LL_INTINFO, VNCLOG("negotiated version\n")); + vnclog.Print(LL_INTINFO, VNCLOG("negotiated version")); // AUTHENTICATE LINK if (!InitAuthenticate()) @@ -1079,7 +1086,7 @@ vncClientThread::run(void *arg) // Authenticated OK - remove from blacklist and remove timeout m_server->RemAuthHostsBlacklist(m_client->GetClientName()); m_socket->SetTimeout(m_server->AutoIdleDisconnectTimeout()*1000); - vnclog.Print(LL_INTINFO, VNCLOG("authenticated connection\n")); + vnclog.Print(LL_INTINFO, VNCLOG("authenticated connection")); // Set Client Connect time m_client->SetConnectTime(timeGetTime()); @@ -1158,7 +1165,7 @@ vncClientThread::run(void *arg) m_server->RemoveClient(m_client->GetClientId()); return; } - vnclog.Print(LL_INTINFO, VNCLOG("sent pixel format to client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("sent pixel format to client")); // UNLOCK INITIAL SETUP // Initial negotiation is complete, so set the protocol ready flag @@ -1185,7 +1192,7 @@ vncClientThread::run(void *arg) // TODO CACIC tirando o timeout do socket. Quando o chat está aberto sem mensagens, // não há fluxo no socket, fazendo com que ele de timeout, if (!m_socket->SetTimeout(0)) - vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); while (connected) { rfbClientToServerMsg msg; @@ -1264,7 +1271,7 @@ vncClientThread::run(void *arg) // Tell the buffer object of the change if (!m_client->m_encodemgr.SetClientFormat(msg.spf.format)) { - vnclog.Print(LL_CONNERR, VNCLOG("remote pixel format invalid\n")); + vnclog.Print(LL_CONNERR, VNCLOG("remote pixel format invalid")); connected = FALSE; } @@ -1345,7 +1352,7 @@ vncClientThread::run(void *arg) if (Swap32IfLE(encoding) == rfbEncodingCacheEnable) { m_client->m_encodemgr.EnableCache(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("Cache protocol extension enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Cache protocol extension enabled")); continue; } @@ -1353,7 +1360,7 @@ vncClientThread::run(void *arg) // XOR zlib if (Swap32IfLE(encoding) == rfbEncodingXOREnable) { m_client->m_encodemgr.AvailableXOR(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("XOR protocol extension enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("XOR protocol extension enabled")); continue; } @@ -1365,7 +1372,7 @@ vncClientThread::run(void *arg) // Client specified encoding-specific compression level int level = (int)(Swap32IfLE(encoding) - rfbEncodingCompressLevel0); m_client->m_encodemgr.SetCompressLevel(level); - vnclog.Print(LL_INTINFO, VNCLOG("compression level requested: %d\n"), level); + vnclog.Print(LL_INTINFO, VNCLOG("compression level requested: %d"), level); continue; } @@ -1376,14 +1383,14 @@ vncClientThread::run(void *arg) // Client specified image quality level used for JPEG compression int level = (int)(Swap32IfLE(encoding) - rfbEncodingQualityLevel0); m_client->m_encodemgr.SetQualityLevel(level); - vnclog.Print(LL_INTINFO, VNCLOG("image quality level requested: %d\n"), level); + vnclog.Print(LL_INTINFO, VNCLOG("image quality level requested: %d"), level); continue; } // Is this a LastRect encoding request? if (Swap32IfLE(encoding) == rfbEncodingLastRect) { m_client->m_encodemgr.EnableLastRect(TRUE); // We forbid Last Rect for now - vnclog.Print(LL_INTINFO, VNCLOG("LastRect protocol extension enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("LastRect protocol extension enabled")); continue; } @@ -1391,7 +1398,7 @@ vncClientThread::run(void *arg) if (Swap32IfLE(encoding) == rfbEncodingXCursor) { m_client->m_encodemgr.EnableXCursor(TRUE); m_server->EnableXRichCursor(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("X-style cursor shape updates enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("X-style cursor shape updates enabled")); continue; } @@ -1399,34 +1406,34 @@ vncClientThread::run(void *arg) if (Swap32IfLE(encoding) == rfbEncodingRichCursor) { m_client->m_encodemgr.EnableRichCursor(TRUE); m_server->EnableXRichCursor(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("Full-color cursor shape updates enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Full-color cursor shape updates enabled")); continue; } // Is this a PointerPos encoding request? nyama/marscha - PointerPos if (Swap32IfLE(encoding) == rfbEncodingPointerPos) { m_client->m_use_PointerPos = TRUE; - vnclog.Print(LL_INTINFO, VNCLOG("PointerPos protocol extension enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("PointerPos protocol extension enabled")); continue; } // 21 March 2008 jdp - client wants server state updates if (Swap32IfLE(encoding) == rfbEncodingServerState) { m_client->m_wants_ServerStateUpdates = true; m_server->EnableServerStateUpdates(true); - vnclog.Print(LL_INTINFO, VNCLOG("ServerState protocol extension enabled\n")); + vnclog.Print(LL_INTINFO, VNCLOG("ServerState protocol extension enabled")); continue; } // RDV - We try to detect which type of viewer tries to connect if (Swap32IfLE(encoding) == rfbEncodingZRLE) { m_client->m_encodemgr.AvailableZRLE(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("ZRLE found \n")); + vnclog.Print(LL_INTINFO, VNCLOG("ZRLE found ")); // continue; } if (Swap32IfLE(encoding) == rfbEncodingTight) { m_client->m_encodemgr.AvailableTight(TRUE); - vnclog.Print(LL_INTINFO, VNCLOG("Tight found\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Tight found")); // continue; } @@ -1443,11 +1450,11 @@ vncClientThread::run(void *arg) // If no encoding worked then default to RAW! if (!encoding_set) { - vnclog.Print(LL_INTINFO, VNCLOG("defaulting to raw encoder\n")); + vnclog.Print(LL_INTINFO, VNCLOG("defaulting to raw encoder")); omni_mutex_lock l(m_client->GetUpdateLock()); if (!m_client->m_encodemgr.SetEncoding(Swap32IfLE(rfbEncodingRaw),FALSE)) { - vnclog.Print(LL_INTERR, VNCLOG("failed to select raw encoder!\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to select raw encoder!")); connected = FALSE; } @@ -1481,7 +1488,7 @@ vncClientThread::run(void *arg) int sendtime=m_client->Sendtimer.read()*1000; if (m_client->Totalsend>1500 && sendtime!=0) { - //vnclog.Print(LL_SOCKERR, VNCLOG("Send Size %i %i %i %i\n"),m_socket->Totalsend,sendtime,m_socket->Totalsend/sendtime,m_client->m_encodemgr.m_encoding); + //vnclog.Print(LL_SOCKERR, VNCLOG("Send Size %i %i %i %i"),m_socket->Totalsend,sendtime,m_socket->Totalsend/sendtime,m_client->m_encodemgr.m_encoding); m_client->timearray[m_client->m_encodemgr.m_encoding][m_client->roundrobin_counter]=sendtime; m_client->sizearray[m_client->m_encodemgr.m_encoding][m_client->roundrobin_counter]=m_client->Totalsend; m_client->Sendtimer.reset(); @@ -1495,7 +1502,7 @@ vncClientThread::run(void *arg) tottime+=m_client->timearray[j][i]; } if (tottime!=0 && totsize>1500) - vnclog.Print(LL_SOCKERR, VNCLOG("Send Size %i %i %i %i\n"),totsize,tottime,totsize/tottime,j); + vnclog.Print(LL_SOCKERR, VNCLOG("Send Size %i %i %i %i"),totsize,tottime,totsize/tottime,j); } m_client->roundrobin_counter++; if (m_client->roundrobin_counter>30) m_client->roundrobin_counter=0; @@ -1519,11 +1526,11 @@ vncClientThread::run(void *arg) // update.br.x = 2880; // update.br.y = 1200; rfb::Region2D update_rgn = update; -// vnclog.Print(LL_SOCKERR, VNCLOG("Update asked for region %i %i %i %i %i\n"),update.tl.x,update.tl.y,update.br.x,update.br.y,m_client->m_SWOffsetx); +// vnclog.Print(LL_SOCKERR, VNCLOG("Update asked for region %i %i %i %i %i"),update.tl.x,update.tl.y,update.br.x,update.br.y,m_client->m_SWOffsetx); // RealVNC 336 if (update_rgn.is_empty()) { - vnclog.Print(LL_INTERR, VNCLOG("FATAL! client update region is empty!\n")); + vnclog.Print(LL_INTERR, VNCLOG("FATAL! client update region is empty!")); connected = FALSE; break; } @@ -1660,14 +1667,14 @@ vncClientThread::run(void *arg) // offset for multi display int screenX, screenY, screenDepth; m_server->GetScreenInfo(screenX, screenY, screenDepth); -// vnclog.Print(LL_INTINFO, VNCLOG("########mouse :%i %i %i %i \n"),screenX, screenY,m_client->m_ScreenOffsetx,m_client->m_ScreenOffsety ); +// vnclog.Print(LL_INTINFO, VNCLOG("########mouse :%i %i %i %i "),screenX, screenY,m_client->m_ScreenOffsetx,m_client->m_ScreenOffsety ); if (m_client->m_display_type==1) {//primary display always have (0,0) as corner unsigned long x = (msg.pe.x * 65535) / (screenX-1); unsigned long y = (msg.pe.y * 65535) / (screenY-1); // Do the pointer event ::mouse_event(flags, (DWORD) x, (DWORD) y, wheel_movement, 0); -// vnclog.Print(LL_INTINFO, VNCLOG("########mouse_event :%i %i \n"),x,y); +// vnclog.Print(LL_INTINFO, VNCLOG("########mouse_event :%i %i "),x,y); } else {//second or spanned @@ -1803,7 +1810,7 @@ vncClientThread::run(void *arg) //if (msg.sim.status==1) m_client->m_encodemgr.m_buffer->m_desktop->SetDisableInput(true); //if (msg.sim.status==0) m_client->m_encodemgr.m_buffer->m_desktop->SetDisableInput(false); // added jeff - vnclog.Print(LL_INTINFO, VNCLOG("rfbSetServerInput: inputs %s\n"), (msg.sim.status==1) ? "disabled" : "enabled"); + vnclog.Print(LL_INTINFO, VNCLOG("rfbSetServerInput: inputs %s"), (msg.sim.status==1) ? "disabled" : "enabled"); // only allow change if this is the client that originally changed the input state if (m_server->GetDesktopPointer()->GetBlockInputState() && !m_client->m_bClientHasBlockedInput) @@ -1843,7 +1850,7 @@ vncClientThread::run(void *arg) m_client->m_pTextChat->ProcessTextChatMsg(nTO); break; - + /** Trecho referente a parte de Transferencia de Arquivo!*/ // Modif sf@2002 - FileTransfer // File Transfer Message case rfbFileTransfer: @@ -1863,7 +1870,8 @@ vncClientThread::run(void *arg) { switch (msg.ft.contentType) { - // A new file is received from the client + /** UPLOAD: O Cliente faz UPLOAD de um arquivo para o Servidor.*/ + // A new file is received from the client // case rfbFileHeader: case rfbFileTransferOffer: { @@ -1877,7 +1885,7 @@ vncClientThread::run(void *arg) if (!m_socket->ReadExact(m_client->m_szFullDestName, length)) { //MessageBox(NULL, "1. Abort !", "Ultra WinVNC", MB_OK); - // vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive FileName from Viewer. Abort !\n")); + // vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive FileName from Viewer. Abort !")); break; } @@ -1888,7 +1896,7 @@ vncClientThread::run(void *arg) if (!m_socket->ReadExact((char*)&sizeHtmp, sizeof(CARD32))) { //MessageBox(NULL, "2. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive SizeH from Viewer. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to receive SizeH from Viewer. Abort !")); break; } sizeH = Swap32IfLE(sizeHtmp); @@ -2014,7 +2022,7 @@ vncClientThread::run(void *arg) delete m_client->m_pBuff; //MessageBox(NULL, "3. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Dest File size. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Dest File size. Abort !")); break; } @@ -2030,7 +2038,7 @@ vncClientThread::run(void *arg) } break; - + /** DOWNLOAD: O Cliente Solicita o Download de um arquivo no Server.*/ // The client requests a File case rfbFileTransferRequest: { @@ -2044,7 +2052,7 @@ vncClientThread::run(void *arg) if (!m_socket->ReadExact(m_client->m_szSrcFileName, length)) { //MessageBox(NULL, "4. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Cannot read requested filename. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Cannot read requested filename. Abort !")); break; } @@ -2055,7 +2063,7 @@ vncClientThread::run(void *arg) if (nDirZipRet == -1) { //MessageBox(NULL, "5. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to zip requested dir. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Failed to zip requested dir. Abort !")); // [v1.0.2-jp1 fix] Empty directory receive problem rfbFileTransferMsg ft; @@ -2134,6 +2142,14 @@ vncClientThread::run(void *arg) FileTime.wHour, FileTime.wMinute ); + + /** ATENCAO!!! Aqui faz um append que pode não ser muito legal. Ele + * incrementa virgula, data e hora ao nome do arquivo para + * posteriormente imprimir como sendo uma string de um log qualquer. + * A integridade do nome do arquivo eh alterada. Deve-se entaum, obter + * o nome do arquivo transferido de outra forma. Verificar outros + * campos disponíveis. + **/ strcat(m_client->m_szSrcFileName, ","); strcat(m_client->m_szSrcFileName, szSrcFileTime); } @@ -2149,6 +2165,10 @@ vncClientThread::run(void *arg) m_client->m_nCSOffset = 0; m_client->m_nCSBufferSize = 0; + /** Próximo passo na transferencia do arquivo: Pegar o Header do arquivo. + * mens_transf.type = rfbFileTransfer (valor constante pra qqer transferencia). + * mens_transf.contentType = rfbFileHeader (pegar o header do file no proximo ciclo). + */ // Send the FileTransferMsg with rfbFileHeader rfbFileTransferMsg ft; @@ -2167,7 +2187,7 @@ vncClientThread::run(void *arg) if (n2SrcSize.LowPart == 0xFFFFFFFF && n2SrcSize.HighPart == 0xFFFFFFFF) { //MessageBox(NULL, "6. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Src File size. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: Wrong Src File size. Abort !")); break; // If error, we don't send anything else } } @@ -2187,7 +2207,7 @@ vncClientThread::run(void *arg) { CloseHandle(m_client->m_hSrcFile); // MessageBox(NULL, "7. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: File not created on client side. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: File not created on client side. Abort !")); break; } @@ -2197,7 +2217,7 @@ vncClientThread::run(void *arg) { CloseHandle(m_client->m_hSrcFile); //MessageBox(NULL, "8. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate buffer. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate buffer. Abort !")); break; } @@ -2210,7 +2230,7 @@ vncClientThread::run(void *arg) if (m_client->m_pBuff != NULL) delete m_client->m_pBuff; //MessageBox(NULL, "9. Abort !", "Ultra WinVNC", MB_OK); - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate comp. buffer. Abort !\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: rfbFileHeader - Unable to allocate comp. buffer. Abort !")); break; } @@ -2241,7 +2261,7 @@ vncClientThread::run(void *arg) m_client->FinishFileReception(); } break; - + /** ABORT: Trecho referente ao trato com o comando Abort.*/ // We use this message for FileTransfer rights (<=RC18 versions) // The client asks for FileTransfer permission case rfbAbortFileTransfer: @@ -2607,7 +2627,7 @@ vncClientThread::run(void *arg) m_client->m_fFileDownloadError = true; FlushFileBuffers(m_client->m_hDestFile); } - //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: message content reading error\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("*** FileTransfer: message content reading error")); } /* // sf@2005 - Cancel FT User impersonation if possible @@ -2661,7 +2681,7 @@ vncClientThread::run(void *arg) } else { - vnclog.Print(LL_INTERR, VNCLOG("[rfbKeyFrameRequest] Unable to Reset ZRLE Encoding\n")); + vnclog.Print(LL_INTERR, VNCLOG("[rfbKeyFrameRequest] Unable to Reset ZRLE Encoding")); } } break; @@ -2681,7 +2701,7 @@ vncClientThread::run(void *arg) } // TODO CACIC voltando o timeout ao normal if (!m_socket->SetTimeout(30000)) - vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to set socket timeout(%d)"), GetLastError()); // Move into the thread's original desktop // TAG 14 @@ -2694,7 +2714,7 @@ vncClientThread::run(void *arg) // Quit this thread. This will automatically delete the thread and the // associated client. - vnclog.Print(LL_CLIENTS, VNCLOG("client disconnected : %s (%hd)\n"), + vnclog.Print(LL_CLIENTS, VNCLOG("client disconnected : %s (%hd)"), m_client->GetClientName(), m_client->GetClientId()); ////////////////// @@ -2746,7 +2766,7 @@ vncClientThread::run(void *arg) vncClient::vncClient() { - vnclog.Print(LL_INTINFO, VNCLOG("vncClient() executing...\n")); + vnclog.Print(LL_INTINFO, VNCLOG("vncClient() executing...")); m_socket = NULL; m_client_name = 0; @@ -2775,7 +2795,7 @@ vncClient::vncClient() //SINGLE WINDOW m_use_NewSWSize = FALSE; m_SWOffsetx=0; - vnclog.Print(LL_INTINFO, VNCLOG("TEST 4\n")); + vnclog.Print(LL_INTINFO, VNCLOG("TEST 4")); m_SWOffsety=0; m_ScreenOffsetx=0; m_ScreenOffsety=0; @@ -2860,7 +2880,7 @@ vncClient::vncClient() vncClient::~vncClient() { - vnclog.Print(LL_INTINFO, VNCLOG("~vncClient() executing...\n")); + vnclog.Print(LL_INTINFO, VNCLOG("~vncClient() executing...")); // Modif sf@2002 - Text Chat if (m_pTextChat) @@ -2881,7 +2901,7 @@ vncClient::~vncClient() // If we have a socket then kill it if (m_socket != NULL) { - vnclog.Print(LL_INTINFO, VNCLOG("deleting socket\n")); + vnclog.Print(LL_INTINFO, VNCLOG("deleting socket")); delete m_socket; m_socket = NULL; @@ -2905,7 +2925,7 @@ vncClient::~vncClient() #endif //thos give sometimes errors, hlogfile is already removed at this point - //vnclog.Print(LL_INTINFO, VNCLOG("cached %d \n"),totalraw); + //vnclog.Print(LL_INTINFO, VNCLOG("cached %d "),totalraw); } // Init @@ -2924,8 +2944,9 @@ vncClient::Init(vncServer *server, // Save the name of the connecting client char *name = m_socket->GetPeerName(); - if (name != 0) + if (name != 0){ m_client_name = _strdup(name); + } else m_client_name = _strdup(""); @@ -2993,7 +3014,7 @@ vncClient::UpdateMouse() if (m_use_PointerPos && !m_cursor_pos_changed) { POINT cursorPos; GetCursorPos(&cursorPos); - //vnclog.Print(LL_INTINFO, VNCLOG("UpdateMouse m_cursor_pos(%d, %d), new(%d, %d)\n"), + //vnclog.Print(LL_INTINFO, VNCLOG("UpdateMouse m_cursor_pos(%d, %d), new(%d, %d)"), // m_cursor_pos.x, m_cursor_pos.y, cursorPos.x, cursorPos.y); if (cursorPos.x != m_cursor_pos.x || cursorPos.y != m_cursor_pos.y) { // This movement isn't by this client, but generated locally or by other client. @@ -3037,7 +3058,7 @@ void vncClient::UpdateLocalFormat() { DisableProtocol(); - vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format\n")); + vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format")); m_encodemgr.SetServerFormat(); EnableProtocol(); } @@ -3048,7 +3069,7 @@ vncClient::SetNewSWSize(long w,long h,BOOL Desktop) if (!m_use_NewSWSize) return FALSE; DisableProtocol(); - vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format and buffer size\n")); + vnclog.Print(LL_INTERR, VNCLOG("updating local pixel format and buffer size")); m_encodemgr.SetServerFormat(); m_palettechanged = TRUE; // no lock needed Called from desktopthread @@ -3088,7 +3109,7 @@ vncClient::EnableProtocol() { { omni_mutex_lock l(GetUpdateLock()); if (m_disable_protocol == 0) { - vnclog.Print(LL_INTERR, VNCLOG("protocol enabled too many times!\n")); + vnclog.Print(LL_INTERR, VNCLOG("protocol enabled too many times!")); m_socket->Close(); return; } @@ -3108,7 +3129,7 @@ vncClient::SendRFBMsg(CARD8 type, BYTE *buffer, int buflen) // Send the message if (!m_socket->SendExact((char *) buffer, buflen, type)) { - vnclog.Print(LL_CONNERR, VNCLOG("failed to send RFB message to client\n")); + vnclog.Print(LL_CONNERR, VNCLOG("failed to send RFB message to client")); Kill(); return FALSE; @@ -3165,7 +3186,7 @@ vncClient::SendUpdate(rfb::SimpleUpdateTracker &update) else { updates += update_info.cached.size(); - //vnclog.Print(LL_INTERR, "cached %d\n", updates); + //vnclog.Print(LL_INTERR, "cached %d", updates); } } @@ -3183,7 +3204,7 @@ vncClient::SendUpdate(rfb::SimpleUpdateTracker &update) break; } updates += numsubrects; - //vnclog.Print(LL_INTERR, "changed %d\n", updates); + //vnclog.Print(LL_INTERR, "changed %d", updates); } } @@ -3202,7 +3223,7 @@ vncClient::SendUpdate(rfb::SimpleUpdateTracker &update) break; } updates += numsubrects; - //vnclog.Print(LL_INTERR, "cached2 %d\n", updates); + //vnclog.Print(LL_INTERR, "cached2 %d", updates); } } @@ -3281,7 +3302,7 @@ vncClient::SendUpdate(rfb::SimpleUpdateTracker &update) return FALSE; } m_socket->ClearQueue(); - // vnclog.Print(LL_INTINFO, VNCLOG("Update cycle\n")); + // vnclog.Print(LL_INTINFO, VNCLOG("Update cycle")); return TRUE; } @@ -3501,7 +3522,7 @@ vncClient::SendCacheRectangles(const rfb::RectVector &rects) rfb::RectVector::const_iterator i; if (rects.size() == 0) return TRUE; - vnclog.Print(LL_INTINFO, VNCLOG("******** Sending %d Cache Rects \r\n"), rects.size()); + vnclog.Print(LL_INTINFO, VNCLOG("******** Sending %d Cache Rects "), rects.size()); // Work through the list of rectangles, sending each one for (i= rects.begin();i != rects.end();i++) @@ -3658,7 +3679,7 @@ BOOL vncClient::SendCacheZip(const rfb::RectVector &rects) return false; } - vnclog.Print(LL_INTINFO, VNCLOG("*** Sending CacheZip Rects=%d Size=%d (%d)\r\n"), nNbCacheRects, maxCompSize, nNbCacheRects * 14); + vnclog.Print(LL_INTINFO, VNCLOG("*** Sending CacheZip Rects=%d Size=%d (%d)"), nNbCacheRects, maxCompSize, nNbCacheRects * 14); // Send the Update Rect header rfbFramebufferUpdateRectHeader CacheRectsHeader; @@ -3854,7 +3875,9 @@ void vncClient::ReceiveFileChunk(int nLen, int nSize) return; } - +/** Funcao que desativa o status de downloading, seta os tempos do arquivo + atraves do handle e esvazia o buffer. +*/ void vncClient::FinishFileReception() { if (!m_fFileDownloadRunning) @@ -3928,6 +3951,14 @@ void vncClient::FinishFileReception() if (m_pBuff != NULL) delete [] m_pBuff; + time_t now = time(0); + struct tm ts; + char data_tf[20]; + ts = *localtime(&now); + strftime(data_tf, sizeof(data_tf), "%d/%m/%Y %H:%M:%S", &ts); + + vnclog.Print(LL_INTINFO,VNCLOG(">>>>>UPLOAD: %s - %s - %s - %s"), + data_tf, m_szFullDestName, m_szFileTime, m_szSrcFileName); return; } @@ -3979,6 +4010,10 @@ void vncClient::SendFileChunk() if (fAlreadyThere) { + /** Aqui seta um terceiro passo na sequencia de transferencia. Logo apos iniciada (UPLOAD ou DOWNLOAD), + * foi setada a transferencia de header, e agora como terceiro passo, a transferencia de packet VAZIO. + * Isso porque o arquivo ja foi constatado estar no destino. + */ // Send the FileTransferMsg with empty rfbFilePacket rfbFileTransferMsg ft; ft.type = rfbFileTransfer; @@ -4003,7 +4038,7 @@ void vncClient::SendFileChunk() if (nRetC != 0) { - vnclog.Print(LL_INTINFO, VNCLOG("Compress returned error in File Send :%d\n"), nRetC); + vnclog.Print(LL_INTINFO, VNCLOG("Compress returned error in File Send :%d"), nRetC); // Todo: send data uncompressed instead m_fFileUploadError = true; FinishFileSending(); @@ -4016,7 +4051,9 @@ void vncClient::SendFileChunk() if (nMaxCompSize > m_dwNbBytesRead) fCompressed = false; // m_fCompressionEnabled = false; - + /** Nesse momento, como no case anterior, ele seta o terceiro passo na transferencia, a transferencia de Packet. + * Em diferenca, no passo anterior, o arquivo foi comprimido, e agora segue em sequencia a transferencia de Packet. + */ rfbFileTransferMsg ft; ft.type = rfbFileTransfer; @@ -4110,7 +4147,7 @@ bool vncClient::GetSpecialFolderPath(int nId, char* szPath) // int vncClient::ZipPossibleDirectory(LPSTR szSrcFileName) { -// vnclog.Print(0, _T("ZipPossibleDirectory\n")); +// vnclog.Print(0, _T("ZipPossibleDirectory")); char* p1 = strrchr(szSrcFileName, '\\') + 1; char* p2 = strrchr(szSrcFileName, rfbDirSuffix[0]); if ( @@ -4196,7 +4233,7 @@ int vncClient::CheckAndZipDirectoryForChecksuming(LPSTR szSrcFileName) // int vncClient::UnzipPossibleDirectory(LPSTR szFileName) { -// vnclog.Print(0, _T("UnzipPossibleDirectory\n")); +// vnclog.Print(0, _T("UnzipPossibleDirectory")); if (!m_fFileDownloadError && !strncmp(strrchr(szFileName, '\\') + 1, rfbZipDirectoryPrefix, strlen(rfbZipDirectoryPrefix)) @@ -4253,26 +4290,26 @@ bool vncClient::MyGetFileSize(char* szFilePath, ULARGE_INTEGER *n2FileSize) bool vncClient::DoFTUserImpersonation() { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Call\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Call")); omni_mutex_lock l(GetUpdateLock()); if (m_fFileDownloadRunning) return true; if (m_fFileUploadRunning) return true; if (m_fFTUserImpersonatedOk) return true; - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - 1\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - 1")); bool fUserOk = true; if (vncService::IsWSLocked()) { m_fFTUserImpersonatedOk = false; - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - WSLocked\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - WSLocked")); return false; } char username[UNLEN+1]; vncService::CurrentUser((char *)&username, sizeof(username)); - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - currentUser = %s\n"), username); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - currentUser = %s"), username); if (strcmp(username, "") != 0) { // sf@2007 - New method to achieve FTUserImpersonation - Still needs to be further tested... @@ -4287,14 +4324,14 @@ bool vncClient::DoFTUserImpersonation() ) ) { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - OpenProcessToken Error\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - OpenProcessToken Error")); fUserOk = false; } else { if (!ImpersonateLoggedOnUser(hPToken)) { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - ImpersonateLoggedOnUser Failed\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - ImpersonateLoggedOnUser Failed")); fUserOk = false; } } @@ -4307,27 +4344,27 @@ bool vncClient::DoFTUserImpersonation() // Modif Byteboon (Jeremy C.) - Impersonnation if (m_server->m_impersonationtoken) { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Impersonationtoken exists\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - Impersonationtoken exists")); HANDLE newToken; if (DuplicateToken(m_server->m_impersonationtoken, SecurityImpersonation, &newToken)) { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken ok\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken ok")); if(!ImpersonateLoggedOnUser(newToken)) { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - failed to impersonate [%d]\n"),GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - failed to impersonate [%d]"),GetLastError()); fUserOk = false; } CloseHandle(newToken); } else { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken FAILEDk\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - DuplicateToken FAILEDk")); fUserOk = false; } } else { - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - No impersonationtoken\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::DoFTUserImpersonation - No impersonationtoken")); fUserOk = false; } */ @@ -4352,17 +4389,17 @@ bool vncClient::DoFTUserImpersonation() void vncClient::UndoFTUserImpersonation() { - //vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Call\n")); + //vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Call")); omni_mutex_lock l(GetUpdateLock()); if (!m_fFTUserImpersonatedOk) return; if (m_fFileDownloadRunning) return; if (m_fFileUploadRunning) return; - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - 1\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - 1")); DWORD lTime = timeGetTime(); if (lTime - m_lLastFTUserImpersonationTime < 10000) return; - vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Impersonationtoken exists\n")); + vnclog.Print(LL_INTERR, VNCLOG("%%%%%%%%%%%%% vncClient::UNDoFTUserImpersonation - Impersonationtoken exists")); RevertToSelf(); m_fFTUserImpersonatedOk = false; } diff --git a/srcacic/WinVNC/WinVNC/vncdesktop.cpp b/srcacic/WinVNC/WinVNC/vncdesktop.cpp index 380ed27..f9d27a8 100644 --- a/srcacic/WinVNC/WinVNC/vncdesktop.cpp +++ b/srcacic/WinVNC/WinVNC/vncdesktop.cpp @@ -148,13 +148,13 @@ vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bo if (pList != NULL) { m_lGridsList.push_back(pList); - vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid %d created !\n"), i); + vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid %d created !"), i); } } } // We test one zone at a time - // vnclog.Print(LL_INTINFO, VNCLOG("### Polling Grid %d - SubGrid %d\n"), nZone, m_nGridCycle); + // vnclog.Print(LL_INTINFO, VNCLOG("### Polling Grid %d - SubGrid %d"), nZone, m_nGridCycle); GridsList::iterator iGrid; int nIndex = 0; int nGridPos = (nZone * PIXEL_BLOCK_SIZE / GRID_OFFSET) + m_nGridCycle; @@ -171,13 +171,13 @@ vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bo if (nZone == 0 || nZone == 4) { - // vnclog.Print(LL_INTINFO, VNCLOG("### IncCycle Please !\n")); + // vnclog.Print(LL_INTINFO, VNCLOG("### IncCycle Please !")); fIncCycle = true; } if (pThePixelGrid->empty()) { - // vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init\n")); + // vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init")); fInitGrid = true; } @@ -199,7 +199,7 @@ vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bo if (OSversion()==2) PixelColor= CapturePixel( xo, yo); else PixelColor= GetPixel(m_hrootdc, xo, yo); pThePixelGrid->push_back(PixelColor); - // vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init : Pixel xo=%d - yo=%d - C=%ld\n"), xo, yo, (long)PixelColor); + // vnclog.Print(LL_INTINFO, VNCLOG("### PixelsGrid Init : Pixel xo=%d - yo=%d - C=%ld"), xo, yo, (long)PixelColor); continue; } @@ -207,7 +207,7 @@ vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bo COLORREF PixelColor=0; if (OSversion()==2 ) PixelColor = CapturePixel( xo, yo); else PixelColor = GetPixel(m_hrootdc, xo, yo); -// vnclog.Print(LL_INTINFO, VNCLOG("### GetPixel %i\n"),OSversion()); +// vnclog.Print(LL_INTINFO, VNCLOG("### GetPixel %i"),OSversion()); // If the pixel has changed if (*iPixelColor != PixelColor ) { @@ -253,7 +253,7 @@ vncDesktop::FastDetectChanges(rfb::Region2D &rgn, rfb::Rect &rect, int nZone, bo } // char szName[64]; // GetWindowText(hwnd, szName, 64); - // vnclog.Print(LL_INTINFO, VNCLOG("### Changed Window : %s (at x=%d - y=%d)\n"), szName, x, y); + // vnclog.Print(LL_INTINFO, VNCLOG("### Changed Window : %s (at x=%d - y=%d)"), szName, x, y); // return; } } @@ -380,7 +380,7 @@ vncDesktop::vncDesktop() vncDesktop::~vncDesktop() { - vnclog.Print(LL_INTINFO, VNCLOG("killing screen server\n")); + vnclog.Print(LL_INTINFO, VNCLOG("killing screen server")); // If we created a thread then here we delete it // The thread itself does most of the cleanup @@ -472,12 +472,12 @@ vncDesktop::Startup() if (!InitDesktop()) { - vnclog.Print(LL_INTINFO, VNCLOG("InitDesktop Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("InitDesktop Failed")); return FALSE; } // Modif rdv@2002 - v1.1.x - videodriver - vnclog.Print(LL_INTINFO, VNCLOG("InitVideo driver Called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("InitVideo driver Called")); if (FALSE != DriverWantedSet) { m_server->Driver(DriverWanted); @@ -486,29 +486,29 @@ vncDesktop::Startup() } if (m_server->Driver()) { - vnclog.Print(LL_INTINFO, VNCLOG("Driver option enabled \n")); + vnclog.Print(LL_INTINFO, VNCLOG("Driver option enabled ")); if(OSversion()==1 || OSversion()==2 ) { InitVideoDriver(); } } - vnclog.Print(LL_INTINFO, VNCLOG("Driver option disabled \n")); + vnclog.Print(LL_INTINFO, VNCLOG("Driver option disabled ")); if (m_Origpolling) m_server->PollFullScreen(m_Origpolling); m_OrigpollingSet=false; if (VideoBuffer()) { - vnclog.Print(LL_INTINFO, VNCLOG("Break log\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Break log")); } if (!InitBitmap()) { - vnclog.Print(LL_INTINFO, VNCLOG("InitBitmap Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("InitBitmap Failed")); return FALSE; } if (!ThunkBitmapInfo()) { - vnclog.Print(LL_INTINFO, VNCLOG("ThunkBitmapInfo Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("ThunkBitmapInfo Failed")); return FALSE; } @@ -517,25 +517,25 @@ vncDesktop::Startup() if (!SetPixFormat()) { - vnclog.Print(LL_INTINFO, VNCLOG("SetPixFormat Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("SetPixFormat Failed")); return FALSE; } if (!SetPixShifts()) { - vnclog.Print(LL_INTINFO, VNCLOG("SetPixShift Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("SetPixShift Failed")); return FALSE; } if (!SetPalette()) { - vnclog.Print(LL_INTINFO, VNCLOG("SetPalette Failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("SetPalette Failed")); return FALSE; } if (!InitWindow()) { - vnclog.Print(LL_INTINFO, VNCLOG("InitWindow failed\n")); + vnclog.Print(LL_INTINFO, VNCLOG("InitWindow failed")); return FALSE; } @@ -543,7 +543,7 @@ vncDesktop::Startup() { if (VideoBuffer()) { - vnclog.Print(LL_INTINFO, VNCLOG("Removing real Dib buffer and replace by driver communication buffer\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Removing real Dib buffer and replace by driver communication buffer")); if (m_membitmap != NULL) { DeleteObject(m_membitmap); @@ -597,7 +597,7 @@ vncDesktop::Shutdown() if (m_hrootdc != NULL) { if (!DeleteDC(m_hrootdc)) - vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hrootdc\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hrootdc")); m_hrootdc = NULL; } if (m_hmemdc != NULL) @@ -605,7 +605,7 @@ vncDesktop::Shutdown() // Release our device context if (!DeleteDC(m_hmemdc)) { - vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hmemdc\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteDC hmemdc")); } m_hmemdc = NULL; } @@ -614,7 +614,7 @@ vncDesktop::Shutdown() // Release the custom bitmap, if any if (!DeleteObject(m_membitmap)) { - vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteObject\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to DeleteObject")); } m_membitmap = NULL; } @@ -659,7 +659,7 @@ vncDesktop::KillScreenSaver() if (!GetVersionEx(&osversioninfo)) return; - vnclog.Print(LL_INTINFO, VNCLOG("KillScreenSaver...\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillScreenSaver...")); // How to kill the screen saver depends on the OS switch (osversioninfo.dwPlatformId) @@ -687,7 +687,7 @@ vncDesktop::KillScreenSaver() ); if (hDesk != NULL) { - vnclog.Print(LL_INTINFO, VNCLOG("Killing ScreenSaver\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Killing ScreenSaver")); // Close all windows on the screen saver desktop EnumDesktopWindows(hDesk, (WNDENUMPROC) &KillScreenSaverFunc, 0); @@ -794,7 +794,7 @@ vncDesktop::InitBitmap() } if (m_hrootdc == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("No driver used \n")); + vnclog.Print(LL_INTERR, VNCLOG("No driver used ")); //Multi-Monitor changes Checkmonitors(); asked_display=m_buffer.GetDisplay(); @@ -822,19 +822,19 @@ vncDesktop::InitBitmap() m_ScreenOffsety=mymonitor[2].offsety;; } if (m_hrootdc == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("Failed m_rootdc \n")); + vnclog.Print(LL_INTERR, VNCLOG("Failed m_rootdc ")); return FALSE; } } if (current_monitor==3 && !VideoBuffer()) m_bmrect = rfb::Rect(0, 0,mymonitor[2].Width,mymonitor[2].Height); else m_bmrect = rfb::Rect(0, 0,GetDeviceCaps(m_hrootdc, HORZRES),GetDeviceCaps(m_hrootdc, VERTRES)); - vnclog.Print(LL_INTINFO, VNCLOG("bitmap dimensions are %d x %d\n"), m_bmrect.br.x, m_bmrect.br.y); + vnclog.Print(LL_INTINFO, VNCLOG("bitmap dimensions are %d x %d"), m_bmrect.br.x, m_bmrect.br.y); // Create a compatible memory DC m_hmemdc = CreateCompatibleDC(m_hrootdc); if (m_hmemdc == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to create compatibleDC(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to create compatibleDC(%d)"), GetLastError()); return FALSE; } @@ -865,10 +865,10 @@ vncDesktop::InitBitmap() // Create the bitmap to be compatible with the ROOT DC!!! m_membitmap = CreateCompatibleBitmap(m_hrootdc, m_bmrect.br.x, m_bmrect.br.y); if (m_membitmap == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to create memory bitmap(%d)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("failed to create memory bitmap(%d)"), GetLastError()); return FALSE; } - vnclog.Print(LL_INTINFO, VNCLOG("created memory bitmap\n")); + vnclog.Print(LL_INTINFO, VNCLOG("created memory bitmap")); // Get the bitmap's format and colour details int result; @@ -877,15 +877,15 @@ vncDesktop::InitBitmap() m_bminfo.bmi.bmiHeader.biBitCount = 0; result = ::GetDIBits(m_hmemdc, m_membitmap, 0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS); if (result == 0) { - vnclog.Print(LL_INTERR, VNCLOG("unable to get display format\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to get display format")); return FALSE; } result = ::GetDIBits(m_hmemdc, m_membitmap, 0, 1, NULL, &m_bminfo.bmi, DIB_RGB_COLORS); if (result == 0) { - vnclog.Print(LL_INTERR, VNCLOG("unable to get display colour info\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to get display colour info")); return FALSE; } - vnclog.Print(LL_INTINFO, VNCLOG("got bitmap format\n")); + vnclog.Print(LL_INTINFO, VNCLOG("got bitmap format")); // Henceforth we want to use a top-down scanning representation m_bminfo.bmi.bmiHeader.biHeight = - abs(m_bminfo.bmi.bmiHeader.biHeight); @@ -913,7 +913,7 @@ vncDesktop::ThunkBitmapInfo() { case 1: case 4: - vnclog.Print(LL_INTINFO, VNCLOG("DBG:used/bits/planes/comp/size = %d/%d/%d/%d/%d\n"), + vnclog.Print(LL_INTINFO, VNCLOG("DBG:used/bits/planes/comp/size = %d/%d/%d/%d/%d"), (int)m_bminfo.bmi.bmiHeader.biClrUsed, (int)m_bminfo.bmi.bmiHeader.biBitCount, (int)m_bminfo.bmi.bmiHeader.biPlanes, @@ -958,9 +958,9 @@ vncDesktop::SetPixFormat() // If we are using a memory bitmap then check how many planes it uses // The VNC code can only handle formats with a single plane (CHUNKY pixels) if (!m_DIBbits) { - vnclog.Print(LL_INTINFO, VNCLOG("DBG:display context has %d planes!\n"), + vnclog.Print(LL_INTINFO, VNCLOG("DBG:display context has %d planes!"), GetDeviceCaps(m_hrootdc, PLANES)); - vnclog.Print(LL_INTINFO, VNCLOG("DBG:memory context has %d planes!\n"), + vnclog.Print(LL_INTINFO, VNCLOG("DBG:memory context has %d planes!"), GetDeviceCaps(m_hmemdc, PLANES)); if (GetDeviceCaps(m_hmemdc, PLANES) != 1) { @@ -1039,7 +1039,7 @@ vncDesktop::SetPixShifts() // Other pixel formats are only valid if they're palette-based if (m_bminfo.truecolour) { - vnclog.Print(LL_INTERR, "unsupported truecolour pixel format for setpixshifts\n"); + vnclog.Print(LL_INTERR, "unsupported truecolour pixel format for setpixshifts"); return FALSE; } return TRUE; @@ -1069,7 +1069,7 @@ vncDesktop::SetPalette() palette = (LOGPALETTE *) new char[size]; if (palette == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate logical palette\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate logical palette")); return FALSE; } @@ -1081,7 +1081,7 @@ vncDesktop::SetPalette() if (GetSystemPaletteEntries(m_hrootdc, 0, 256, palette->palPalEntry) == 0) { - vnclog.Print(LL_INTERR, VNCLOG("unable to get system palette entries\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to get system palette entries")); delete [] palette; return FALSE; } @@ -1090,7 +1090,7 @@ vncDesktop::SetPalette() HPALETTE pal = CreatePalette(palette); if (pal == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to create HPALETTE\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to create HPALETTE")); delete [] palette; return FALSE; } @@ -1099,7 +1099,7 @@ vncDesktop::SetPalette() HPALETTE oldpalette = SelectPalette(m_hmemdc, pal, FALSE); if (oldpalette == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to select() HPALETTE\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to select() HPALETTE")); delete [] palette; DeleteObject(pal); return FALSE; @@ -1107,13 +1107,13 @@ vncDesktop::SetPalette() // Worked, so realise the palette if (RealizePalette(m_hmemdc) == GDI_ERROR) - vnclog.Print(LL_INTWARN, VNCLOG("warning - failed to RealizePalette\n")); + vnclog.Print(LL_INTWARN, VNCLOG("warning - failed to RealizePalette")); // It worked! delete [] palette; DeleteObject(oldpalette); - vnclog.Print(LL_INTINFO, VNCLOG("initialised palette OK\n")); + vnclog.Print(LL_INTINFO, VNCLOG("initialised palette OK")); return TRUE; } else @@ -1167,7 +1167,7 @@ vncDesktop::SetPalette() } // Not a palette based local screen - forget it! - vnclog.Print(LL_INTERR, VNCLOG("no palette data for truecolour display\n")); + vnclog.Print(LL_INTERR, VNCLOG("no palette data for truecolour display")); return TRUE; } //////////////////////////////////////////////////////////////////////////////// @@ -1282,7 +1282,7 @@ vncDesktop::InitWindow() // Register it m_wndClass = RegisterClassEx(&wndclass); if (!m_wndClass) { - vnclog.Print(LL_INTERR, VNCLOG("failed to register window class\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to register window class")); return FALSE; } } @@ -1300,7 +1300,7 @@ vncDesktop::InitWindow() NULL); if (m_hwnd == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to create hook window\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to create hook window")); return FALSE; } @@ -1331,13 +1331,13 @@ vncDesktop::InitWindow() void vncDesktop::EnableOptimisedBlits() { - vnclog.Print(LL_INTINFO, VNCLOG("attempting to enable DIBsection blits\n")); + vnclog.Print(LL_INTINFO, VNCLOG("attempting to enable DIBsection blits")); // Create a new DIB section //HBITMAP tempbitmap=NULL; HBITMAP tempbitmap = CreateDIBSection(m_hmemdc, &m_bminfo.bmi, DIB_RGB_COLORS, &m_DIBbits, NULL, 0); if (tempbitmap == NULL) { - vnclog.Print(LL_INTINFO, VNCLOG("failed to build DIB section - reverting to slow blits\n")); + vnclog.Print(LL_INTINFO, VNCLOG("failed to build DIB section - reverting to slow blits")); m_DIBbits = NULL; return; } @@ -1350,13 +1350,13 @@ vncDesktop::EnableOptimisedBlits() // Replace old membitmap with DIB section m_membitmap = tempbitmap; - vnclog.Print(LL_INTINFO, VNCLOG("enabled fast DIBsection blits OK\n")); + vnclog.Print(LL_INTINFO, VNCLOG("enabled fast DIBsection blits OK")); } BOOL vncDesktop::Init(vncServer *server) { - vnclog.Print(LL_INTINFO, VNCLOG("initialising desktop handler\n")); + vnclog.Print(LL_INTINFO, VNCLOG("initialising desktop handler")); // Save the server pointer m_server = server; @@ -1374,7 +1374,7 @@ vncDesktop::Init(vncServer *server) // Spawn a thread to handle that window's message queue vncDesktopThread *thread = new vncDesktopThread; if (thread == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to start hook thread\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to start hook thread")); return FALSE; } m_thread = thread; @@ -1444,7 +1444,7 @@ vncDesktop::CaptureMouse(BYTE *scrBuff, UINT scrBuffSize) // Get the cursor position if (!GetCursorPos(&CursorPos)) return; - //vnclog.Print(LL_INTINFO, VNCLOG("CursorPos %i %i\n"),CursorPos.x, CursorPos.y); + //vnclog.Print(LL_INTINFO, VNCLOG("CursorPos %i %i"),CursorPos.x, CursorPos.y); // Translate position for hotspot if (GetIconInfo(m_hcursor, &IconInfo)) { @@ -1642,7 +1642,7 @@ vncDesktop::CopyToBuffer(const rfb::Rect &rect, BYTE *destbuff, UINT destbuffsiz &m_bminfo.bmi, DIB_RGB_COLORS) == 0) { #ifdef _MSC_VER - _RPT1(_CRT_WARN, "vncDesktop : [1] GetDIBits failed! %d\n", GetLastError()); + _RPT1(_CRT_WARN, "vncDesktop : [1] GetDIBits failed! %d", GetLastError()); _RPT3(_CRT_WARN, "vncDesktop : thread = %d, DC = %d, bitmap = %d\n", omni_thread::self(), m_hmemdc, m_membitmap); _RPT2(_CRT_WARN, "vncDesktop : y = %d, height = %d\n", y_inv, (rect.br.y-rect.tl.y)); #endif @@ -1758,9 +1758,9 @@ DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) switch (wParam) { case SC_MONITORPOWER: - vnclog.Print(LL_INTINFO, VNCLOG("Monitor22 %i\n"),lParam); + vnclog.Print(LL_INTINFO, VNCLOG("Monitor22 %i"),lParam); } - vnclog.Print(LL_INTINFO, VNCLOG("Monitor3 %i %i\n"),wParam,lParam); + vnclog.Print(LL_INTINFO, VNCLOG("Monitor3 %i %i"),wParam,lParam); return DefWindowProc(hwnd, iMsg, wParam, lParam); case WM_POWER: case WM_POWERBROADCAST: @@ -1768,9 +1768,9 @@ DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) switch (wParam) { case SC_MONITORPOWER: - vnclog.Print(LL_INTINFO, VNCLOG("Monitor222 %i\n"),lParam); + vnclog.Print(LL_INTINFO, VNCLOG("Monitor222 %i"),lParam); } - vnclog.Print(LL_INTINFO, VNCLOG("Power3 %i %i\n"),wParam,lParam); + vnclog.Print(LL_INTINFO, VNCLOG("Power3 %i %i"),wParam,lParam); return DefWindowProc(hwnd, iMsg, wParam, lParam); case WM_COPYDATA: @@ -1795,7 +1795,7 @@ DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) } } - //vnclog.Print(LL_INTINFO, VNCLOG("copydata\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("copydata")); return 0; // GENERAL @@ -1804,7 +1804,7 @@ DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) // The display resolution is changing // We must kick off any clients since their screen size will be wrong // WE change the clients screensize, if they support it. - vnclog.Print(LL_INTERR, VNCLOG("WM_DISPLAYCHANGE\n")); + vnclog.Print(LL_INTERR, VNCLOG("WM_DISPLAYCHANGE")); // We First check if the Resolution changed is caused by a temp resolution switch // For a temp resolution we don't use the driver, to fix the mirror driver // to the new change, a resolution switch is needed, preventing screensaver locking. @@ -1816,20 +1816,20 @@ DesktopWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) _this->m_displaychanged = TRUE; _this->m_hookdriver=true; _this->m_videodriver->blocked=true; - vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver active\n")); + vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver active")); } else { //Remove display change, cause by driver activation _this->m_videodriver->blocked=false; - vnclog.Print(LL_INTERR, VNCLOG("Resolution switch by driver activation removed\n")); + vnclog.Print(LL_INTERR, VNCLOG("Resolution switch by driver activation removed")); } } else { _this->m_displaychanged = TRUE; _this->m_hookdriver=true; - vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver NOT active\n")); + vnclog.Print(LL_INTERR, VNCLOG("Resolution switch detected, driver NOT active")); } return 0; @@ -1947,7 +1947,7 @@ void vncDesktop::SetBlankMonitor(bool enabled) if (!pSetLayeredWindowAttributes) m_server->BlackAlphaBlending(false); //if (VideoBuffer()) m_server->BlackAlphaBlending(false); - vnclog.Print(LL_INTINFO, VNCLOG("SetBlankMonitor: monitor %s, using alpha %s\n"), + vnclog.Print(LL_INTINFO, VNCLOG("SetBlankMonitor: monitor %s, using alpha %s"), enabled ? "off" : "on", m_server->BlackAlphaBlending() ? "true" : "false"); @@ -2003,7 +2003,7 @@ void vncDesktop::SetDisableInput(bool enabled) { CARD32 state = enabled ? rfbServerState_Disabled : rfbServerState_Enabled; - vnclog.Print(LL_INTINFO, VNCLOG("SetDisableInput: inputs %s\n"), enabled ? "disbled" : "enabled"); + vnclog.Print(LL_INTINFO, VNCLOG("SetDisableInput: inputs %s"), enabled ? "disbled" : "enabled"); //BlockInput block everything on non w2k and XP //if hookdll is used, he take care of input blocking @@ -2015,7 +2015,7 @@ vncDesktop::SetDisableInput(bool enabled) { blocked = (*pbi)(enabled); if (!blocked) - vnclog.Print(LL_INTINFO, VNCLOG("BlockInput failed: Last error %08X\n"), ::GetLastError()); + vnclog.Print(LL_INTINFO, VNCLOG("BlockInput failed: Last error %08X"), ::GetLastError()); if(!enabled) Sleep(1000); blocked = (*pbi)(enabled); } @@ -2036,7 +2036,7 @@ void vncDesktop::SetSW(int x,int y) POINT point; point.x=x; point.y=y; - vnclog.Print(LL_INTERR, VNCLOG("SETW %i %i\n"),x,y); + vnclog.Print(LL_INTERR, VNCLOG("SETW %i %i"),x,y); if (x <= 5 && y<=5 && x>-5 && y>-5) { switch(asked_display) @@ -2147,7 +2147,7 @@ BOOL vncDesktop::InitVideoDriver() omni_mutex_lock l(m_videodriver_lock); if(!(OSversion()==1 || OSversion()==2)) return true; //we need w2k or xp - vnclog.Print(LL_INTERR, VNCLOG("Driver option is enabled\n")); + vnclog.Print(LL_INTERR, VNCLOG("Driver option is enabled")); // If m_videodriver exist, the driver was activated. // This does not mean he is still active // Screen switching disable the driver at kernel level @@ -2159,7 +2159,7 @@ BOOL vncDesktop::InitVideoDriver() if (m_videodriver!=NULL) { - vnclog.Print(LL_INTERR, VNCLOG("Closing pending driver driver version\n")); + vnclog.Print(LL_INTERR, VNCLOG("Closing pending driver driver version")); if (m_videodriver!=NULL) delete m_videodriver; } @@ -2180,14 +2180,14 @@ BOOL vncDesktop::InitVideoDriver() m_ScreenOffsety=mymonitor[2].offsety; m_videodriver->VIDEODRIVER_start(mymonitor[2].offsetx,mymonitor[2].offsety,mymonitor[2].Width,mymonitor[2].Height); } - vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver\n")); + vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver")); m_hookdriver=true; m_hookdll=false; // check if driver has mapped the shared memory if (!m_videodriver->mypVideoMemory) { - vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver Failed\n")); - vnclog.Print(LL_INTERR, VNCLOG("Using non driver mode\n")); + vnclog.Print(LL_INTERR, VNCLOG("Start Mirror driver Failed")); + vnclog.Print(LL_INTERR, VNCLOG("Using non driver mode")); if (m_videodriver!=NULL) delete m_videodriver; m_videodriver=NULL; // If driver selected and fialed to start default to hookdll @@ -2206,10 +2206,10 @@ BOOL vncDesktop::InitVideoDriver() if (m_videodriver->mypVideoMemory) { - vnclog.Print(LL_INTERR, VNCLOG("Driver Used\n")); + vnclog.Print(LL_INTERR, VNCLOG("Driver Used")); if (!m_videodriver->mypVideoMemory) { - vnclog.Print(LL_INTERR, VNCLOG("Unable to map memory\n")); + vnclog.Print(LL_INTERR, VNCLOG("Unable to map memory")); delete m_videodriver; m_videodriver=NULL; // If driver selected and fialed to start default to hookdll @@ -2218,7 +2218,7 @@ BOOL vncDesktop::InitVideoDriver() m_hookdll=true; return false; } - vnclog.Print(LL_INTERR, VNCLOG("Shared memory mapped\n")); + vnclog.Print(LL_INTERR, VNCLOG("Shared memory mapped")); InvalidateRect(NULL,NULL,TRUE); return true; @@ -2258,7 +2258,7 @@ void vncDesktop::SethookMechanism(BOOL hookall,BOOL hookdriver) } // 9,x case - vnclog.Print(LL_INTERR, VNCLOG("SethookMechanism called\r\n")); + vnclog.Print(LL_INTERR, VNCLOG("SethookMechanism calledCR\LF")); if(OSversion()==4 || OSversion()==5) { m_hookdriver=false;//(user driver updates) @@ -2290,14 +2290,14 @@ void vncDesktop::SethookMechanism(BOOL hookall,BOOL hookdriver) else Hookdll_Changed=false; if (OSversion()==2) Hookdll_Changed=true; - vnclog.Print(LL_INTERR, VNCLOG("Sethook_restart_wanted hook=%d driver=%d \r\n"),m_hookdll,m_hookdriver); + vnclog.Print(LL_INTERR, VNCLOG("Sethook_restart_wanted hook=%d driver=%d "),m_hookdll,m_hookdriver); if (Hookdll_Changed) - vnclog.Print(LL_INTERR, VNCLOG("Hookdll status changed \r\n")); + vnclog.Print(LL_INTERR, VNCLOG("Hookdll status changed")); if ((m_hookdriver && !VideoBuffer()) || (!m_hookdriver && VideoBuffer())) { m_hookswitch=true; - vnclog.Print(LL_INTERR, VNCLOG("Driver Status changed\r\n")); + vnclog.Print(LL_INTERR, VNCLOG("Driver Status changed")); } } else //NT4 @@ -2335,12 +2335,12 @@ void vncDesktop::StartStopddihook(BOOL enabled) // Start the child process. if( !CreateProcess( NULL,szCurrentDir, NULL,NULL,FALSE,NULL,NULL,NULL,&ssi,&ppi ) ) { - vnclog.Print(LL_INTERR, VNCLOG("set ddihooks Failed\n")); + vnclog.Print(LL_INTERR, VNCLOG("set ddihooks Failed")); ddihook=false; } else { - vnclog.Print(LL_INTERR, VNCLOG("set ddihooks OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("set ddihooks OK")); ddihook=true; WaitForInputIdle(ppi.hProcess, 10000); m_hddihook=ppi.hProcess; @@ -2365,7 +2365,7 @@ void vncDesktop::StartStophookdll(BOOL enabled) if (SetHook) { SetHook(m_hwnd); - vnclog.Print(LL_INTERR, VNCLOG("set SC hooks OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("set SC hooks OK")); m_hookinited = TRUE; } else if (SetHooks) @@ -2377,14 +2377,14 @@ void vncDesktop::StartStophookdll(BOOL enabled) RFB_MOUSE_UPDATE, ddihook )) { - vnclog.Print(LL_INTERR, VNCLOG("failed to set system hooks\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to set system hooks")); // Switch on full screen polling, so they can see something, at least... m_server->PollFullScreen(TRUE); m_hookinited = FALSE; } else { - vnclog.Print(LL_INTERR, VNCLOG("set hooks OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("set hooks OK")); m_hookinited = TRUE; // Start up the keyboard and mouse filters if (SetKeyboardFilterHook) SetKeyboardFilterHook(m_server->LocalInputsDisabled()); @@ -2402,8 +2402,8 @@ void vncDesktop::StartStophookdll(BOOL enabled) else if (UnSetHooks) { if(!UnSetHooks(GetCurrentThreadId()) ) - vnclog.Print(LL_INTERR, VNCLOG("Unsethooks Failed\n")); - else vnclog.Print(LL_INTERR, VNCLOG("Unsethooks OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("Unsethooks Failed")); + else vnclog.Print(LL_INTERR, VNCLOG("Unsethooks OK")); } } diff --git a/srcacic/WinVNC/WinVNC/vncdesktopthread.cpp b/srcacic/WinVNC/WinVNC/vncdesktopthread.cpp index 65fbb2b..a689e8f 100644 --- a/srcacic/WinVNC/WinVNC/vncdesktopthread.cpp +++ b/srcacic/WinVNC/WinVNC/vncdesktopthread.cpp @@ -40,11 +40,11 @@ vncDesktopThread::copy_bitmaps_to_buffer(ULONG i,rfb::Region2D &rgncache,rfb::Up int w = m_desktop->pchanges_buf->pointrect[i].rect.right-m_desktop->pchanges_buf->pointrect[i].rect.left; int y = m_desktop->pchanges_buf->pointrect[i].rect.top; int h = m_desktop->pchanges_buf->pointrect[i].rect.bottom-m_desktop->pchanges_buf->pointrect[i].rect.top; - //vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i \n"),x,y,w,h); + //vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i "),x,y,w,h); if (!ClipRect(&x, &y, &w, &h, m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.tl.y, m_desktop->m_bmrect.br.x-m_desktop->m_bmrect.tl.x, m_desktop->m_bmrect.br.y-m_desktop->m_bmrect.tl.y)) return; - //vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i \n"),x,y,w,h); + //vnclog.Print(LL_INTINFO, VNCLOG("Driver ************* %i %i %i %i "),x,y,w,h); rect.tl.x = x; rect.br.x = x+w; rect.tl.y = y; @@ -89,7 +89,7 @@ vncDesktopThread::copy_bitmaps_to_buffer(ULONG i,rfb::Region2D &rgncache,rfb::Up rfb::Point delta = rfb::Point(-dx,-dy); rgncache=rgncache.union_(rect); tracker.add_copied(rect, delta); - // vnclog.Print(LL_INTINFO, VNCLOG("Copyrect \n")); + // vnclog.Print(LL_INTINFO, VNCLOG("Copyrect ")); } else { @@ -123,7 +123,7 @@ vncDesktopThread::handle_driver_changes(rfb::Region2D &rgncache,rfb::UpdateTrack int oldaantal=m_desktop->m_videodriver->oldaantal; int counter=m_desktop->pchanges_buf->counter; // int nr_updates=m_desktop->pchanges_buf->pointrect[0].type; -// vnclog.Print(LL_INTERR, VNCLOG("updates, rects %i\n"),oldaantal-counter); +// vnclog.Print(LL_INTERR, VNCLOG("updates, rects %i"),oldaantal-counter); if (oldaantal==counter) return FALSE; if (counter<1 || counter >1999) return FALSE; // m_desktop->pchanges_buf->pointrect[0].type=0; @@ -172,7 +172,7 @@ vncDesktopThread::handle_driver_changes(rfb::Region2D &rgncache,rfb::UpdateTrack copy_bitmaps_to_buffer(i,rgncache,tracker); } } -// vnclog.Print(LL_INTINFO, VNCLOG("Nr rects %i \n"),rgncache.Numrects()); +// vnclog.Print(LL_INTINFO, VNCLOG("Nr rects %i "),rgncache.Numrects()); m_desktop->m_videodriver->oldaantal=counter; // A lot updates left after combining // This generates an overflow @@ -349,10 +349,10 @@ vncDesktopThread::run_undetached(void *arg) // INIT //******************************************************* // SessionFix(); - vnclog.Print(LL_INTERR, VNCLOG("Hook changed 1\n")); + vnclog.Print(LL_INTERR, VNCLOG("Hook changed 1")); // Save the thread's "home" desktop, under NT (no effect under 9x) HDESK home_desktop = GetThreadDesktop(GetCurrentThreadId()); - vnclog.Print(LL_INTERR, VNCLOG("Hook changed 2\n")); + vnclog.Print(LL_INTERR, VNCLOG("Hook changed 2")); // Attempt to initialise and return success or failure m_desktop->KillScreenSaver(); { @@ -438,7 +438,7 @@ vncDesktopThread::run_undetached(void *arg) { if (!PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE)) { -// vnclog.Print(LL_INTERR, VNCLOG("!PeekMessage \n")); +// vnclog.Print(LL_INTERR, VNCLOG("!PeekMessage ")); // MAX 30fps newtick = timeGetTime(); // Better resolution than GetTickCount ;) if ((newtick-oldtick)<33) @@ -458,7 +458,7 @@ vncDesktopThread::run_undetached(void *arg) //******************************************************* if (m_desktop->Hookdll_Changed && !m_desktop->m_hookswitch) { - vnclog.Print(LL_INTERR, VNCLOG("Hook changed \n")); + vnclog.Print(LL_INTERR, VNCLOG("Hook changed ")); m_desktop->StartStophookdll(m_desktop->On_Off_hookdll); if (m_desktop->On_Off_hookdll) m_desktop->m_hOldcursor = NULL; // Force mouse cursor grabbing if hookdll On @@ -481,15 +481,15 @@ vncDesktopThread::run_undetached(void *arg) if (!m_server->All_clients_initialalized()) { Sleep(30); - vnclog.Print(LL_INTERR, VNCLOG("Wait for viewer init \n")); + vnclog.Print(LL_INTERR, VNCLOG("Wait for viewer init ")); } //logging - if (m_desktop->m_displaychanged) vnclog.Print(LL_INTERR, VNCLOG("++++Screensize changed \n")); - if (m_desktop->m_SWtoDesktop) vnclog.Print(LL_INTERR, VNCLOG("m_SWtoDesktop \n")); - if (m_desktop->m_hookswitch) vnclog.Print(LL_INTERR, VNCLOG("m_hookswitch \n")); - if (m_desktop->asked_display!=m_desktop->m_buffer.GetDisplay()) vnclog.Print(LL_INTERR, VNCLOG("desktop switch %i %i \n"),m_desktop->asked_display,m_desktop->m_buffer.GetDisplay()); - if (!vncService::InputDesktopSelected()) vnclog.Print(LL_INTERR, VNCLOG("++++InputDesktopSelected \n")); + if (m_desktop->m_displaychanged) vnclog.Print(LL_INTERR, VNCLOG("++++Screensize changed ")); + if (m_desktop->m_SWtoDesktop) vnclog.Print(LL_INTERR, VNCLOG("m_SWtoDesktop ")); + if (m_desktop->m_hookswitch) vnclog.Print(LL_INTERR, VNCLOG("m_hookswitch ")); + if (m_desktop->asked_display!=m_desktop->m_buffer.GetDisplay()) vnclog.Print(LL_INTERR, VNCLOG("desktop switch %i %i "),m_desktop->asked_display,m_desktop->m_buffer.GetDisplay()); + if (!vncService::InputDesktopSelected()) vnclog.Print(LL_INTERR, VNCLOG("++++InputDesktopSelected ")); BOOL screensize_changed=false; @@ -526,7 +526,7 @@ vncDesktopThread::run_undetached(void *arg) m_desktop->current_monitor=1; if (m_desktop->asked_display==2 && m_desktop->nr_monitors>1) m_desktop->current_monitor=2; if (m_desktop->asked_display==3 && m_desktop->nr_monitors>1) m_desktop->current_monitor=3; - vnclog.Print(LL_INTERR, VNCLOG("OLd Current mon %i %i \n"),old_monitor,m_desktop->current_monitor); + vnclog.Print(LL_INTERR, VNCLOG("OLd Current mon %i %i "),old_monitor,m_desktop->current_monitor); if ( old_monitor!=m_desktop->current_monitor) monitor_changed=true; } @@ -542,7 +542,7 @@ vncDesktopThread::run_undetached(void *arg) monitor_changed=false; if (!m_desktop->Shutdown()) { - vnclog.Print(LL_INTERR, VNCLOG("Shutdown KillAuthClients\n")); + vnclog.Print(LL_INTERR, VNCLOG("Shutdown KillAuthClients")); m_server->KillAuthClients(); break; } @@ -550,7 +550,7 @@ vncDesktopThread::run_undetached(void *arg) vnclog.Print(LL_INTERR, VNCLOG("m_desktop->Startup")); if (!m_desktop->Startup()) { - vnclog.Print(LL_INTERR, VNCLOG("Startup KillAuthClients\n")); + vnclog.Print(LL_INTERR, VNCLOG("Startup KillAuthClients")); m_server->KillAuthClients(); break; } @@ -577,7 +577,7 @@ vncDesktopThread::run_undetached(void *arg) // then the users checks "Video Driver" if (fHookDriverWanted && m_desktop->m_videodriver == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("m_videodriver == NULL \n")); + vnclog.Print(LL_INTERR, VNCLOG("m_videodriver == NULL ")); m_desktop->SethookMechanism(true, false); // InitHookSettings() would work as well; } stop_hookwatch=true; @@ -599,7 +599,7 @@ vncDesktopThread::run_undetached(void *arg) m_desktop->m_SWtoDesktop==TRUE )) { screensize_changed=true; - vnclog.Print(LL_INTINFO, VNCLOG("SCR: new screen format %dx%dx%d\n"), + vnclog.Print(LL_INTINFO, VNCLOG("SCR: new screen format %dx%dx%d"), m_desktop->m_scrinfo.framebufferWidth, m_desktop->m_scrinfo.framebufferHeight, m_desktop->m_scrinfo.format.bitsPerPixel); @@ -615,7 +615,7 @@ vncDesktopThread::run_undetached(void *arg) if (screensize_changed) { - vnclog.Print(LL_INTERR, VNCLOG("Size changed\n")); + vnclog.Print(LL_INTERR, VNCLOG("Size changed")); POINT CursorPos; m_desktop->SWinit(); m_desktop->GetQuarterSize(); @@ -649,7 +649,7 @@ vncDesktopThread::run_undetached(void *arg) m_desktop->mymonitor[m_desktop->current_monitor-1].Height-m_desktop->mymonitor[2].offsety; - vnclog.Print(LL_INTERR, VNCLOG("***********###############************ %i %i %i %i %i %i\n"),m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety + vnclog.Print(LL_INTERR, VNCLOG("***********###############************ %i %i %i %i %i %i"),m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety ,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y,m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y); @@ -671,7 +671,7 @@ vncDesktopThread::run_undetached(void *arg) //******************************************************* if (memcmp(&m_desktop->m_scrinfo.format, &oldscrinfo.format, sizeof(rfbPixelFormat)) != 0) { - vnclog.Print(LL_INTERR, VNCLOG("Format changed\n")); + vnclog.Print(LL_INTERR, VNCLOG("Format changed")); m_server->UpdatePalette(); m_server->UpdateLocalFormat(); } @@ -712,7 +712,7 @@ vncDesktopThread::run_undetached(void *arg) m_desktop->m_SWSizeChanged=FALSE; m_desktop->GetQuarterSize(); rgncache = rgncache.union_(rfb::Region2D(m_desktop->m_Cliprect)); -// vnclog.Print(LL_INTINFO, VNCLOG("4 %i %i %i %i \n"),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("4 %i %i %i %i "),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y); updates.set_clip_region(m_desktop->m_Cliprect); m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety); m_desktop->m_buffer.ClearCache(); @@ -725,7 +725,7 @@ vncDesktopThread::run_undetached(void *arg) updates.set_clip_region(m_desktop->m_Cliprect); m_server->SetSWOffset(m_desktop->m_SWOffsetx,m_desktop->m_SWOffsety); rgncache = rgncache.union_(rfb::Region2D(m_desktop->m_Cliprect)); -// vnclog.Print(LL_INTINFO, VNCLOG("5 %i %i %i %i \n"),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("5 %i %i %i %i "),m_desktop->m_Cliprect.br.x,m_desktop->m_Cliprect.br.y,m_desktop->m_Cliprect.tl.x,m_desktop->m_Cliprect.tl.y); m_desktop->m_buffer.ClearCache(); m_desktop->m_buffer.BlackBack(); } @@ -744,10 +744,10 @@ vncDesktopThread::run_undetached(void *arg) // // CALCULATE CHANGES m_desktop->m_UltraEncoder_used=m_desktop->m_server->IsThereAUltraEncodingClient(); -// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted B\n")); +// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted B")); if (m_desktop->m_server->UpdateWanted()) { -// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted N\n")); +// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted N")); //TEST4 // Re-render the mouse's old location if it's moved BOOL cursormoved = FALSE; @@ -756,7 +756,7 @@ vncDesktopThread::run_undetached(void *arg) ((cursorpos.x != oldcursorpos.x) || (cursorpos.y != oldcursorpos.y))) { -// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted M %i %i %i %i\n"),cursorpos.x, oldcursorpos.x,cursorpos.y,oldcursorpos.y); +// vnclog.Print(LL_INTERR, VNCLOG("UpdateWanted M %i %i %i %i"),cursorpos.x, oldcursorpos.x,cursorpos.y,oldcursorpos.y); cursormoved = TRUE; oldcursorpos = rfb::Point(cursorpos); // nyama/marscha - PointerPos. Inform clients about mouse move. @@ -898,8 +898,8 @@ vncDesktopThread::run_undetached(void *arg) rect.tl.y = y; rect.br.y = y+h; rgncache = rgncache.union_(rect); -// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); -// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i "),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i "),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); } } @@ -968,8 +968,8 @@ vncDesktopThread::run_undetached(void *arg) rect.tl.y = y; rect.br.y = y+h; rgncache = rgncache.union_(rect); -// vnclog.Print(LL_INTINFO, VNCLOG("7 %i %i %i %i \n"),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); -// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i \n"),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("7 %i %i %i %i "),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); +// vnclog.Print(LL_INTINFO, VNCLOG("6 %i %i %i %i "),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); } m_server->UpdateCursorShape(); } @@ -1000,8 +1000,8 @@ vncDesktopThread::run_undetached(void *arg) rect.tl.y = y; rect.br.y = y+h; rgncache = rgncache.union_(rect); - vnclog.Print(LL_INTINFO, VNCLOG("8 %i %i %i %i \n"),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); - vnclog.Print(LL_INTINFO, VNCLOG("8 %i %i %i %i \n"),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); + vnclog.Print(LL_INTINFO, VNCLOG("8 %i %i %i %i "),m_desktop->m_cursorpos.br.x,m_desktop->m_cursorpos.br.y,m_desktop->m_cursorpos.tl.x,m_desktop->m_cursorpos.tl.y); + vnclog.Print(LL_INTINFO, VNCLOG("8 %i %i %i %i "),rect.br.x,rect.br.y,rect.tl.x,rect.tl.y); } } @@ -1072,13 +1072,13 @@ vncDesktopThread::run_undetached(void *arg) { if (!WaitMessage()) { - //vnclog.Print(LL_INTERR, VNCLOG("WaitMessage() failed\n")); + //vnclog.Print(LL_INTERR, VNCLOG("WaitMessage() failed")); break; } - //vnclog.Print(LL_INTERR, VNCLOG("WaitMessage()\n")); + //vnclog.Print(LL_INTERR, VNCLOG("WaitMessage()")); old_updates_sent=updates_sent; } - //else vnclog.Print(LL_INTERR, VNCLOG("WaitMessage() skip\n")); + //else vnclog.Print(LL_INTERR, VNCLOG("WaitMessage() skip")); }//peek message @@ -1096,7 +1096,7 @@ vncDesktopThread::run_undetached(void *arg) rect.br.x-=m_desktop->m_ScreenOffsetx; rect.tl.y-=m_desktop->m_ScreenOffsety; rect.br.y-=m_desktop->m_ScreenOffsety; -// vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i \n"),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); +// vnclog.Print(LL_INTERR, VNCLOG("REct %i %i %i %i "),rect.tl.x,rect.br.x,rect.tl.y,rect.br.y); rect = rect.intersect(m_desktop->m_Cliprect); if (!rect.is_empty()) @@ -1139,7 +1139,7 @@ vncDesktopThread::run_undetached(void *arg) DispatchMessage(&msg); idle_skip = TRUE; } - // vnclog.Print(LL_INTERR, VNCLOG("Message %i\n"),msg.message); + // vnclog.Print(LL_INTERR, VNCLOG("Message %i"),msg.message); }//while stop_hookwatch=true; @@ -1150,7 +1150,7 @@ vncDesktopThread::run_undetached(void *arg) } m_desktop->SetClipboardActive(FALSE); - vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread\n")); + vnclog.Print(LL_INTINFO, VNCLOG("quitting desktop server thread")); // Clear all the hooks and close windows, etc. m_desktop->SetBlankMonitor(false); diff --git a/srcacic/WinVNC/WinVNC/vncencodemgr.h b/srcacic/WinVNC/WinVNC/vncencodemgr.h index 3277697..555be23 100644 --- a/srcacic/WinVNC/WinVNC/vncencodemgr.h +++ b/srcacic/WinVNC/WinVNC/vncencodemgr.h @@ -289,7 +289,7 @@ vncEncodeMgr::GetPalette(RGBQUAD *quadlist, UINT ncolours) // in which case the encoder will be storing RGBQUAD data if (m_encoder == NULL) { - vnclog.Print(LL_INTWARN, VNCLOG("GetPalette called but no encoder set\n")); + vnclog.Print(LL_INTWARN, VNCLOG("GetPalette called but no encoder set")); return FALSE; } @@ -319,7 +319,7 @@ vncEncodeMgr::CheckBuffer() m_scrinfo.framebufferHeight); if (m_clientbuffsize != clientbuffsize) { - vnclog.Print(LL_INTINFO, VNCLOG("request client buffer[%u]\n"), clientbuffsize); + vnclog.Print(LL_INTINFO, VNCLOG("request client buffer[%u]"), clientbuffsize); if (m_clientbuff != NULL) { delete [] m_clientbuff; @@ -330,7 +330,7 @@ vncEncodeMgr::CheckBuffer() m_clientbuff = new BYTE [clientbuffsize]; if (m_clientbuff == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client buffer[%u]\n"), clientbuffsize); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client buffer[%u]"), clientbuffsize); return FALSE; } memset(m_clientbuff, 0, clientbuffsize); @@ -341,7 +341,7 @@ vncEncodeMgr::CheckBuffer() const UINT backbuffsize = m_buffer->m_backbuffsize; if (m_clientbackbuffsize != backbuffsize) { - vnclog.Print(LL_INTINFO, VNCLOG("request client back buffer[%u]\n"), backbuffsize); + vnclog.Print(LL_INTINFO, VNCLOG("request client back buffer[%u]"), backbuffsize); if (m_clientbackbuff) { delete [] m_clientbackbuff; m_clientbackbuff = 0; @@ -350,14 +350,14 @@ vncEncodeMgr::CheckBuffer() m_clientbackbuff = new BYTE[backbuffsize]; if (!m_clientbackbuff) { - vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client back buffer[%u]\n"), backbuffsize); + vnclog.Print(LL_INTERR, VNCLOG("unable to allocate client back buffer[%u]"), backbuffsize); return FALSE; } memset(m_clientbackbuff, 0, backbuffsize); m_clientbackbuffsize = backbuffsize; } - vnclog.Print(LL_INTINFO, VNCLOG("remote buffer=%u\n"), m_clientbuffsize);*/ + vnclog.Print(LL_INTINFO, VNCLOG("remote buffer=%u"), m_clientbuffsize);*/ return TRUE; } @@ -410,7 +410,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingRaw: - vnclog.Print(LL_INTINFO, VNCLOG("raw encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("raw encoder requested")); // Create a RAW encoder m_encoder = new vncEncoder; @@ -420,7 +420,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingRRE: - vnclog.Print(LL_INTINFO, VNCLOG("RRE encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("RRE encoder requested")); // Create a RRE encoder m_encoder = new vncEncodeRRE; @@ -430,7 +430,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingCoRRE: - vnclog.Print(LL_INTINFO, VNCLOG("CoRRE encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("CoRRE encoder requested")); // Create a CoRRE encoder m_encoder = new vncEncodeCoRRE; @@ -440,7 +440,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingHextile: - vnclog.Print(LL_INTINFO, VNCLOG("Hextile encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Hextile encoder requested")); // Create a CoRRE encoder m_encoder = new vncEncodeHexT; @@ -450,7 +450,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingUltra: - vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Ultra encoder requested")); // Create a Zlib encoder, if needed. // If a Zlib encoder was used previously, then reuse it here @@ -476,7 +476,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) break; case rfbEncodingZRLE: - vnclog.Print(LL_INTINFO, VNCLOG("ZRLE encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("ZRLE encoder requested")); if (!zrleEncoder) zrleEncoder = new vncEncodeZRLE; m_encoder = zrleEncoder; @@ -484,7 +484,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) break; case rfbEncodingZYWRLE: - vnclog.Print(LL_INTINFO, VNCLOG("ZYWRLE encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("ZYWRLE encoder requested")); if (!zrleEncoder) zrleEncoder = new vncEncodeZRLE; m_encoder = zrleEncoder; @@ -493,7 +493,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingZlib: - vnclog.Print(LL_INTINFO, VNCLOG("Zlib encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Zlib encoder requested")); // Create a Zlib encoder, if needed. // If a Zlib encoder was used previously, then reuse it here @@ -513,7 +513,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingZlibHex: - vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("ZlibHex encoder requested")); // Create a ZlibHex encoder, if needed. // If a Zlibhex encoder was used previously, then reuse it here @@ -533,7 +533,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) case rfbEncodingTight: - vnclog.Print(LL_INTINFO, VNCLOG("Tight encoder requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Tight encoder requested")); // Create a Tight encoder, if needed. // If a Tight encoder was used previously, then reuse it here @@ -553,7 +553,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) default: // An unknown encoding was specified - vnclog.Print(LL_INTERR, VNCLOG("unknown encoder requested\n")); + vnclog.Print(LL_INTERR, VNCLOG("unknown encoder requested")); return FALSE; } @@ -567,7 +567,7 @@ vncEncodeMgr::SetEncoding(CARD32 encoding,BOOL reinitialize) if (m_clientfmtset) if (!m_encoder->SetRemoteFormat(m_clientformat)) { - vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported\n")); + vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported")); return FALSE; } @@ -634,7 +634,7 @@ vncEncodeMgr::SetServerFormat() inline BOOL vncEncodeMgr::SetClientFormat(rfbPixelFormat &format) { - vnclog.Print(LL_INTINFO, VNCLOG("SetClientFormat called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("SetClientFormat called")); // Save the desired format m_clientfmtset = TRUE; @@ -658,7 +658,7 @@ vncEncodeMgr::EncodeRect(const rfb::Rect &rect,VSocket *outconn) // Call the encoder to encode the rectangle into the client buffer... /*if (!m_clientbackbuffif){*/ if (!m_buffer->m_backbuff){ - vnclog.Print(LL_INTERR, "no client back-buffer available in EncodeRect\n"); + vnclog.Print(LL_INTERR, "no client back-buffer available in EncodeRect"); return 0; } if (zlib_encoder_in_use) @@ -839,7 +839,7 @@ vncEncodeMgr::ResetZRLEEncoding(void) { if (!m_encoder->SetRemoteFormat(m_clientformat)) { - vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported\n")); + vnclog.Print(LL_INTERR, VNCLOG("client pixel format is not supported")); return FALSE; } diff --git a/srcacic/WinVNC/WinVNC/vncencoder.cpp b/srcacic/WinVNC/WinVNC/vncencoder.cpp index 95f2b84..1d3cb6d 100644 --- a/srcacic/WinVNC/WinVNC/vncencoder.cpp +++ b/srcacic/WinVNC/WinVNC/vncencoder.cpp @@ -184,7 +184,7 @@ vncEncoder::EncodeRect(BYTE *source, VSocket *outConn, BYTE *dest, const RECT &r BOOL vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours) { - vnclog.Print(LL_INTINFO, VNCLOG("remote palette data requested\n")); + vnclog.Print(LL_INTINFO, VNCLOG("remote palette data requested")); // If the local server is palette-based then call SetTranslateFunction // to update the palette-to-truecolour mapping: @@ -202,7 +202,7 @@ vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours) if (m_localformat.trueColour) { // Fake BGR233... - vnclog.Print(LL_INTINFO, VNCLOG("generating BGR233 palette data\n")); + vnclog.Print(LL_INTINFO, VNCLOG("generating BGR233 palette data")); int ncolours = 1 << m_transformat.bitsPerPixel; if (m_localpalette != NULL) @@ -224,7 +224,7 @@ vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours) else { // Set up RGBQUAD rfbPixelFormat info - vnclog.Print(LL_INTINFO, VNCLOG("generating 8-bit palette data\n")); + vnclog.Print(LL_INTINFO, VNCLOG("generating 8-bit palette data")); rfbPixelFormat remote; remote.trueColour = TRUE; @@ -245,7 +245,7 @@ vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours) // Did we create some palette info? if (m_localpalette == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to obtain colour map data!\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to obtain colour map data!")); return FALSE; } @@ -258,7 +258,7 @@ vncEncoder::GetRemotePalette(RGBQUAD *quadlist, UINT ncolours) BOOL vncEncoder::SetTranslateFunction() { - vnclog.Print(LL_INTINFO, VNCLOG("settranslatefunction called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("settranslatefunction called")); // By default, the actual format translated to matches the client format m_transformat = m_remoteformat; @@ -270,7 +270,7 @@ vncEncoder::SetTranslateFunction() (m_transformat.bitsPerPixel != 32)) { vnclog.Print(LL_CONNERR, - VNCLOG("only 8, 16 or 32 bits supported remotely - %d requested\n"), + VNCLOG("only 8, 16 or 32 bits supported remotely - %d requested"), m_transformat.bitsPerPixel ); @@ -282,7 +282,7 @@ vncEncoder::SetTranslateFunction() (m_localformat.bitsPerPixel != 32)) { vnclog.Print(LL_CONNERR, - VNCLOG("only 8, 16 or 32 bits supported locally - %d in use\n"), + VNCLOG("only 8, 16 or 32 bits supported locally - %d in use"), m_localformat.bitsPerPixel ); @@ -291,12 +291,12 @@ vncEncoder::SetTranslateFunction() if (!m_transformat.trueColour && (m_transformat.bitsPerPixel != 8)) { - vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported remotely\n")); + vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported remotely")); return FALSE; } if (!m_localformat.trueColour && (m_localformat.bitsPerPixel != 8)) { - vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported locally\n")); + vnclog.Print(LL_CONNERR, VNCLOG("only 8-bit palette format supported locally")); return FALSE; } @@ -310,7 +310,7 @@ vncEncoder::SetTranslateFunction() (m_localformat.bitsPerPixel == m_transformat.bitsPerPixel)) { // Yes, so don't do any encoding - vnclog.Print(LL_INTINFO, VNCLOG("no encoding required - both 8-bit palettized\n")); + vnclog.Print(LL_INTINFO, VNCLOG("no encoding required - both 8-bit palettized")); m_transfunc = rfbTranslateNone; @@ -321,7 +321,7 @@ vncEncoder::SetTranslateFunction() else if (m_localformat.trueColour) { // Local side is truecolour, remote is palettized - vnclog.Print(LL_INTINFO, VNCLOG("local truecolour, remote palettized. using BGR233 palette\n")); + vnclog.Print(LL_INTINFO, VNCLOG("local truecolour, remote palettized. using BGR233 palette")); // Fill out the translation table as if writing to BGR233 m_transformat = BGR233Format; @@ -331,7 +331,7 @@ vncEncoder::SetTranslateFunction() else { // No, so not supported yet... - vnclog.Print(LL_CONNERR, VNCLOG("unknown local pixel format in use!\n")); + vnclog.Print(LL_CONNERR, VNCLOG("unknown local pixel format in use!")); return FALSE; } } @@ -344,7 +344,7 @@ vncEncoder::SetTranslateFunction() // 8-bit palette to truecolour... // Yes, so pick the right translation function! - vnclog.Print(LL_INTINFO, VNCLOG("using 8-bit colourmap to truecolour translation\n")); + vnclog.Print(LL_INTINFO, VNCLOG("using 8-bit colourmap to truecolour translation")); m_transfunc = rfbTranslateWithSingleTableFns [m_localformat.bitsPerPixel / 16] @@ -361,7 +361,7 @@ vncEncoder::SetTranslateFunction() if (PF_EQ(m_transformat,m_localformat)) { // Yes, so use the null translation function - vnclog.Print(LL_INTINFO, VNCLOG("no translation required\n")); + vnclog.Print(LL_INTINFO, VNCLOG("no translation required")); m_transfunc = rfbTranslateNone; @@ -372,7 +372,7 @@ vncEncoder::SetTranslateFunction() if (m_localformat.bitsPerPixel == 16) { // Yes, so use a single lookup-table - vnclog.Print(LL_INTINFO, VNCLOG("single LUT used\n")); + vnclog.Print(LL_INTINFO, VNCLOG("single LUT used")); m_transfunc = rfbTranslateWithSingleTableFns [m_localformat.bitsPerPixel / 16] @@ -384,7 +384,7 @@ vncEncoder::SetTranslateFunction() else { // No, so use three tables - one for each of R, G, B. - vnclog.Print(LL_INTINFO, VNCLOG("triple LUT used\n")); + vnclog.Print(LL_INTINFO, VNCLOG("triple LUT used")); m_transfunc = rfbTranslateWithRGBTablesFns [m_localformat.bitsPerPixel / 16] diff --git a/srcacic/WinVNC/WinVNC/vncencoderCursor.cpp b/srcacic/WinVNC/WinVNC/vncencoderCursor.cpp index 0b28f53..25b960e 100644 --- a/srcacic/WinVNC/WinVNC/vncencoderCursor.cpp +++ b/srcacic/WinVNC/WinVNC/vncencoderCursor.cpp @@ -41,14 +41,14 @@ vncEncoder::SendCursorShape(VSocket *outConn, vncDesktop *desktop) // Check mouse cursor handle HCURSOR hcursor = desktop->GetCursor(); if (hcursor == NULL) { - vnclog.Print(LL_INTINFO, VNCLOG("cursor handle is NULL.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("cursor handle is NULL.")); return FALSE; } // Get cursor info ICONINFO IconInfo; if (!GetIconInfo(hcursor, &IconInfo)) { - vnclog.Print(LL_INTINFO, VNCLOG("GetIconInfo() failed.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("GetIconInfo() failed.")); return FALSE; } BOOL isColorCursor = FALSE; @@ -57,19 +57,19 @@ vncEncoder::SendCursorShape(VSocket *outConn, vncDesktop *desktop) DeleteObject(IconInfo.hbmColor); } if (IconInfo.hbmMask == NULL) { - vnclog.Print(LL_INTINFO, VNCLOG("cursor bitmap handle is NULL.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("cursor bitmap handle is NULL.")); return FALSE; } // Check bitmap info for the cursor BITMAP bmMask; if (!GetObject(IconInfo.hbmMask, sizeof(BITMAP), (LPVOID)&bmMask)) { - vnclog.Print(LL_INTINFO, VNCLOG("GetObject() for bitmap failed.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("GetObject() for bitmap failed.")); DeleteObject(IconInfo.hbmMask); return FALSE; } if (bmMask.bmPlanes != 1 || bmMask.bmBitsPixel != 1) { - vnclog.Print(LL_INTINFO, VNCLOG("incorrect data in cursor bitmap.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("incorrect data in cursor bitmap.")); DeleteObject(IconInfo.hbmMask); return FALSE; } @@ -85,7 +85,7 @@ vncEncoder::SendCursorShape(VSocket *outConn, vncDesktop *desktop) DeleteObject(IconInfo.hbmMask); if (!success) { - vnclog.Print(LL_INTINFO, VNCLOG("GetBitmapBits() failed.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("GetBitmapBits() failed.")); delete[] mbits; return FALSE; } @@ -109,7 +109,7 @@ vncEncoder::SendCursorShape(VSocket *outConn, vncDesktop *desktop) return FALSE; } if (!desktop->GetRichCursorData(cbits, hcursor, width, height)) { - vnclog.Print(LL_INTINFO, VNCLOG("vncDesktop::GetRichCursorData() failed.\n")); + vnclog.Print(LL_INTINFO, VNCLOG("vncDesktop::GetRichCursorData() failed.")); delete[] mbits; delete[] cbits; return FALSE; diff --git a/srcacic/WinVNC/WinVNC/vnckeymap.cpp b/srcacic/WinVNC/WinVNC/vnckeymap.cpp index a73408e..db35c2e 100644 --- a/srcacic/WinVNC/WinVNC/vnckeymap.cpp +++ b/srcacic/WinVNC/WinVNC/vnckeymap.cpp @@ -364,24 +364,24 @@ public: void press() { if (!(GetAsyncKeyState(vkCode) & 0x8000)) { doKeyboardEvent(vkCode, flags); - vnclog.Print(LL_INTINFO, "fake %d down\n", vkCode); + vnclog.Print(LL_INTINFO, "fake %d down", vkCode); pressed = true; } } void release() { if (GetAsyncKeyState(vkCode) & 0x8000) { doKeyboardEvent(vkCode, flags | KEYEVENTF_KEYUP); - vnclog.Print(LL_INTINFO, "fake %d up\n", vkCode); + vnclog.Print(LL_INTINFO, "fake %d up", vkCode); released = true; } } ~KeyStateModifier() { if (pressed) { doKeyboardEvent(vkCode, flags | KEYEVENTF_KEYUP); - vnclog.Print(LL_INTINFO, "fake %d up\n", vkCode); + vnclog.Print(LL_INTINFO, "fake %d up", vkCode); } else if (released) { doKeyboardEvent(vkCode, flags); - vnclog.Print(LL_INTINFO, "fake %d down\n", vkCode); + vnclog.Print(LL_INTINFO, "fake %d down", vkCode); } } int vkCode; @@ -455,11 +455,11 @@ public: void keyEvent(rdr::U32 keysym, bool down, bool jap) { - vnclog.Print(LL_INTWARN, " keysym 0x%x",keysym); + vnclog.Print(LL_INTWARN, "keysym 0x%x",keysym); if (keysym>=XK_dead_grave && keysym <=XK_dead_belowdot)// && down) { keysymDead=keysym; - vnclog.Print(LL_INTWARN, " ************** DEAD KEY"); + vnclog.Print(LL_INTWARN, "************** DEAD KEY"); //we have a dead key //Record dead key return; @@ -470,7 +470,7 @@ public: { if (keysymDead!=0 && down) { - vnclog.Print(LL_INTWARN, " Compose dead 0x%x 0x%x",keysymDead,keysym); + vnclog.Print(LL_INTWARN, "Compose dead 0x%x 0x%x",keysymDead,keysym); switch (keysymDead) { case XK_dead_grave: @@ -552,7 +552,7 @@ public: } } keysymDead=0; - vnclog.Print(LL_INTWARN, " Composed 0x%x",keysym); + vnclog.Print(LL_INTWARN, "Composed 0x%x",keysym); } // ordinary Latin-1 character @@ -572,7 +572,7 @@ public: } } - vnclog.Print(LL_INTWARN, " SHORT s %i",s); + vnclog.Print(LL_INTWARN, "SHORT s %i",s); if (s == -1) { @@ -581,7 +581,7 @@ public: vnclog.Print(LL_INTWARN, "down"); // not a single keypress - try synthesizing dead chars. { - vnclog.Print(LL_INTWARN, " Found key"); + vnclog.Print(LL_INTWARN, "Found key"); //Lookup ascii representation int ascii=0; for (ascii=0;ascii<256;ascii++) @@ -614,7 +614,7 @@ public: } /*if (s == -1) { - vnclog.Print(LL_INTWARN, "ignoring unrecognised Latin-1 keysym %d\n", + vnclog.Print(LL_INTWARN, "ignoring unrecognised Latin-1 keysym %d", keysym); keybd_event( VK_MENU, MapVirtualKey(VK_MENU, 0),0, 0); keybd_event( VK_MENU, MapVirtualKey(VK_MENU, 0),KEYEVENTF_KEYUP, 0); @@ -657,7 +657,7 @@ public: } } vnclog.Print(LL_INTINFO, - "latin-1 key: keysym %d(0x%x) vkCode 0x%x down %d capslockOn %d\n", + "latin-1 key: keysym %d(0x%x) vkCode 0x%x down %d capslockOn %d", keysym, keysym, vkCode, down, capslockOn); doKeyboardEvent(vkCode, down ? 0 : KEYEVENTF_KEYUP); @@ -667,7 +667,7 @@ public: // see if it's a recognised keyboard key, otherwise ignore it if (vkMap.find(keysym) == vkMap.end()) { - vnclog.Print(LL_INTWARN, "ignoring unknown keysym %d\n",keysym); + vnclog.Print(LL_INTWARN, "ignoring unknown keysym %d",keysym); return; } BYTE vkCode = vkMap[keysym]; @@ -676,7 +676,7 @@ public: if (!down) flags |= KEYEVENTF_KEYUP; // vnclog.Print(LL_INTINFO, - // "keyboard key: keysym %d(0x%x) vkCode 0x%x ext %d down %d\n", + // "keyboard key: keysym %d(0x%x) vkCode 0x%x ext %d down %d", // keysym, keysym, vkCode, extendedMap[keysym], down); if (down && (vkCode == VK_DELETE) && @@ -685,12 +685,12 @@ public: vncService::IsWinNT()) { vnclog.Print(LL_INTINFO, - "CAD\n"); + "CAD"); // If running under Vista and started from Session0 in Application mode if (vncService::VersionMajor()>=6 && vncService::RunningFromExternalService() ) { vnclog.Print(LL_INTINFO, - "Vista and runnning as system -> CAD\n"); + "Vista and runnning as system -> CAD"); // Try to run the special Vista cad.exe file... HANDLE ThreadHandle2; @@ -701,13 +701,13 @@ public: else if (vncService::VersionMajor()>=6) { vnclog.Print(LL_INTINFO, - "Vista and runnning as user -> Taskmgr\n"); + "Vista and runnning as user -> Taskmgr"); WinExec("taskmgr.exe", SW_SHOWNORMAL); } else { vnclog.Print(LL_INTINFO, - "Not Vista, use old method\n"); + "Not Vista, use old method"); vncService::SimulateCtrlAltDel(); } return; @@ -747,7 +747,7 @@ SetShiftState(BYTE key, BOOL down) return; vnclog.Print(LL_INTINFO, - VNCLOG("setshiftstate %d - (%s->%s)\n"), + VNCLOG("setshiftstate %d - (%s->%s)"), key, keystate ? "down" : "up", down ? "down" : "up"); @@ -756,7 +756,7 @@ SetShiftState(BYTE key, BOOL down) keystate = (GetAsyncKeyState(key) & 0x8000) != 0; vnclog.Print(LL_INTINFO, - VNCLOG("new state %d (%s)\n"), + VNCLOG("new state %d (%s)"), key, keystate ? "down" : "up"); } diff --git a/srcacic/WinVNC/WinVNC/vnclog.cpp b/srcacic/WinVNC/WinVNC/vnclog.cpp index 48d7734..b24c3ae 100644 --- a/srcacic/WinVNC/WinVNC/vnclog.cpp +++ b/srcacic/WinVNC/WinVNC/vnclog.cpp @@ -30,6 +30,8 @@ #include "CACIC_Con.h" #include "CACIC_Auth.h" +using namespace std; + ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// @@ -43,6 +45,10 @@ const int VNCLog::ToScript = 8; static const int LINE_BUFFER_SIZE = 1024; + + +//static const string srVersion = "2.6.0.0"; + VNCLog::VNCLog() : m_tofile(false) , m_todebug(false) @@ -128,7 +134,7 @@ void VNCLog::OpenFile() { m_todebug = true; m_tofile = false; - Print(0, "Error opening log file\n"); + Print(0, "Error opening log file"); return; } @@ -161,7 +167,7 @@ void VNCLog::OpenFile() // We should throw an exception here m_todebug = true; m_tofile = false; - Print(0, "Error opening log file %s\n", m_filename); + Print(0, "Error opening log file %s", m_filename); } if (m_append) { SetFilePointer( hlogfile, 0, NULL, FILE_END ); @@ -199,12 +205,21 @@ inline void VNCLog::ReallyPrintLine(const char* line) strLine.append(data_buf); strLine.append(" : "); strLine.append("[Suporte Remoto]"); + //if (/*Verificar modo DEBUG!*/){ // strLine.append(" ("); // strLine.append(/*Funcao de retorno da Versao: v.2.6.0.0*/); // strLine.append(")"); // strLine.append(" DEBUG -"); //} + + if (IsDebugModeON()) { + strLine.append(" (v."); + strLine.append(SRVersion()); + strLine.append(")"); + strLine.append(" DEBUG -"); + } + strLine.append(" "); strLine.append(line); DWORD byteswritten; @@ -229,11 +244,14 @@ void VNCLog::ReallyPrint(const char* format, va_list ap) if (dwErrorCode != 0) { FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, dwErrorCode, + //FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwErrorCode, + //FORMAT_MESSAGE_MAX_WIDTH_MASK, NULL, dwErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(char *)&szErrorMsg, LINE_BUFFER_SIZE, NULL); - strcat(line," --"); + strcat(line," -- "); strcat(line,szErrorMsg); } + else strcat(line,"\r\n"); ReallyPrintLine(line); } @@ -251,6 +269,58 @@ VNCLog::~VNCLog() } } +bool VNCLog::IsDebugModeON(){ +// LPCTSTR diretorio_debugs; + +/** Trecho especifico para teste com o Path fixo do Cacic. + string caminho = "C:\\Cacic\\Temp\\debugs"; + diretorio_debugs = caminho.c_str(); +*/ + +// LPTSTR diretorio_corrente; +// string diretorio; +// string diretorio = "Temp\\debugs"; +// SetCurrentDirectory(".."); +// GetCurrentDirectory(MAX_PATH,diretorio_corrente); +// diretorio.append(diretorio_corrente); +// diretorio.replace(diretorio.begin(),diretorio.end(),'\',"\\"); +// diretorio.append ("Temp\\debugs"); +/* + diretorio_corrente = (LPTSTR)diretorio.c_str(); + MessageBox (NULL,diretorio_corrente,"Warning! Nussa!!! o.O", MB_OKCANCEL| MB_ICONASTERISK); +*/ +// diretorio_debugs = diretorio.c_str(); + + HANDLE hDir = CreateFile("Temp\\debugs", + GENERIC_ALL, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (hDir == INVALID_HANDLE_VALUE){ + CloseHandle(hDir); + return false; + } + + FILETIME dirCreationTime; + SYSTEMTIME dirCreationTimeSystem, currentSystemTime; + + if (GetFileTime(hDir, &dirCreationTime, NULL, NULL)) { + FileTimeToSystemTime (&dirCreationTime,&dirCreationTimeSystem); + GetSystemTime(¤tSystemTime); + CloseHandle(hDir); + if (CACIC_Utils::DateCompare (currentSystemTime,dirCreationTimeSystem) == 0){ + return true; + } + else { + return false; + } + } + CloseHandle(hDir); + return false; +} + void VNCLog::GetLastErrorMsg(LPSTR szErrorMsg) const { DWORD dwErrorCode = GetLastError(); diff --git a/srcacic/WinVNC/WinVNC/vnclog.h b/srcacic/WinVNC/WinVNC/vnclog.h index c74d78d..fe88431 100644 --- a/srcacic/WinVNC/WinVNC/vnclog.h +++ b/srcacic/WinVNC/WinVNC/vnclog.h @@ -32,7 +32,7 @@ // Log log; // log.SetFile( _T("myapp.log") ); // ... -// log.Print(2, _T("x = %d\n"), x); +// log.Print(2, _T("x = %d"), x); // #ifndef VNCLOGGING @@ -42,8 +42,12 @@ #include #include +#include "CACIC_Utils.h" + #define SCRIPT "srcacic_set_session.php" +#define SRVERSION "2.6.0.0" + class VNCLog { public: @@ -84,12 +88,11 @@ public: // the log mode includes ToFile void SetFile(const char* filename, bool append = false); - /** - * Verifica a existencia do diretorio debugs. - */ - + /** Verifica a existencia do diretorio debugs em "..\Temp\debugs.*/ + bool IsDebugModeON(); virtual ~VNCLog(); + string SRVersion(){return SRVERSION;}; private: void ReallyPrintLine(const char* line); diff --git a/srcacic/WinVNC/WinVNC/vncmenu.cpp b/srcacic/WinVNC/WinVNC/vncmenu.cpp index 2e77306..65b4a95 100644 --- a/srcacic/WinVNC/WinVNC/vncmenu.cpp +++ b/srcacic/WinVNC/WinVNC/vncmenu.cpp @@ -172,7 +172,7 @@ vncMenu::vncMenu(vncServer *server) //if (strcmp(m_username, "") == 0) // strcpy((char *)&m_username, "SYSTEM"); - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::vncMenu - UserName = %s\n"), m_username); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::vncMenu - UserName = %s"), m_username); // Create a dummy window to handle tray icon messages WNDCLASSEX wndclass; @@ -383,26 +383,26 @@ vncMenu::~vncMenu() void vncMenu::AddTrayIcon() { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon \n")); - vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - UserName = %s\n"), m_username); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon ")); + vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - UserName = %s"), m_username); // If the user name is non-null then we have a user! if (strcmp(m_username, "") != 0 && strcmp(m_username, "SYSTEM") != 0) { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists\n")); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists")); // Make sure the server has not been configured to // suppress the tray icon. HWND tray = FindWindow(("Shell_TrayWnd"), 0); if (!tray) { - vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists, traywnd is not found reset when counter reach %i=20\n"),IconFaultCounter); + vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - User exists, traywnd is not found reset when counter reach %i=20"),IconFaultCounter); IconFaultCounter++; return; } if ( ! m_server->GetDisableTrayIcon()) { -// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - ADD Tray Icon call\n")); +// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::AddTrayIcon - ADD Tray Icon call")); SendTrayMsg(NIM_ADD, FALSE); } if (m_server->AuthClientCount() != 0) { //PGM @ Advantig @@ -417,14 +417,14 @@ vncMenu::AddTrayIcon() void vncMenu::DelTrayIcon() { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::DelTrayIcon - DEL Tray Icon call\n")); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::DelTrayIcon - DEL Tray Icon call")); SendTrayMsg(NIM_DELETE, FALSE); } void vncMenu::FlashTrayIcon(BOOL flash) { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::FlashTrayIcon - FLASH Tray Icon call\n")); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::FlashTrayIcon - FLASH Tray Icon call")); SendTrayMsg(NIM_MODIFY, flash); } @@ -468,7 +468,7 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) m_nid.hIcon = flash ? m_flash_icon : m_winvnc_icon; m_nid.uFlags = NIF_ICON | NIF_MESSAGE; m_nid.uCallbackMessage = WM_TRAYNOTIFY; - //vnclog.Print(LL_INTINFO, VNCLOG("SendTRaymesg\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("SendTRaymesg")); // Use resource string as tip if there is one // [v1.0.2-jp1 fix] @@ -496,7 +496,7 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) } } -// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call\n")); +// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call")); // Send the message if ((msg == NIM_MODIFY) && (IsIconSet == FALSE)) return; //no icon to modify if ((msg ==NIM_ADD) && (IsIconSet != FALSE)) return; //no icon to set @@ -507,9 +507,9 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) } if (Shell_NotifyIcon(msg, &m_nid)) { -// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call SUCCESS\n")); +// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call SUCCESS")); // Set the enabled/disabled state of the menu items - // vnclog.Print(LL_INTINFO, VNCLOG("tray icon added ok\n")); + // vnclog.Print(LL_INTINFO, VNCLOG("tray icon added ok")); //EnableMenuItem(m_hmenu, ID_CLOSE, MF_DISABLED); //EnableMenuItem(m_hmenu, ID_KILLCLIENTS, MF_ENABLED); //EnableMenuItem(m_hmenu, ID_OUTGOING_CONN, MF_ENABLED); @@ -518,23 +518,23 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) { IsIconSet=true; IconFaultCounter=0; - vnclog.Print(LL_INTINFO, VNCLOG("IsIconSet \n")); + vnclog.Print(LL_INTINFO, VNCLOG("IsIconSet ")); } } else { -// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED ( %u ) \n"), 0); +// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED ( %u ) "), 0); if (!vncService::RunningAsService()) { -// //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runasservice\n")); +// //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runasservice")); if (msg == NIM_ADD) { // The tray icon couldn't be created, so use the Properties dialog // as the main program window if (!m_server->RunningFromExternalService()) // sf@2007 - Do not display Properties pages when running in Application0 mode { -// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runfromexternalservice\n")); - //vnclog.Print(LL_INTINFO, VNCLOG("opening dialog box\n")); +// vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::SendTrayMsg - Shell_NotifyIcon call FAILED NOT runfromexternalservice")); + //vnclog.Print(LL_INTINFO, VNCLOG("opening dialog box")); PostQuitMessage(0); } } @@ -545,7 +545,7 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) { IsIconSet=false; IconFaultCounter++; - vnclog.Print(LL_INTINFO, VNCLOG("Failed IsIconSet \n")); + vnclog.Print(LL_INTINFO, VNCLOG("Failed IsIconSet ")); } } } @@ -555,7 +555,7 @@ vncMenu::SendTrayMsg(DWORD msg, BOOL flash) // sf@2007 void vncMenu::Shutdown() { - vnclog.Print(LL_INTERR, VNCLOG("vncMenu::Shutdown: Close menu - Disconnect all - Shutdown server\n")); + vnclog.Print(LL_INTERR, VNCLOG("vncMenu::Shutdown: Close menu - Disconnect all - Shutdown server")); // m_server->AutoRestartFlag(TRUE); // m_server->KillAuthClients(); // m_server->KillSockConnect(); @@ -577,7 +577,7 @@ LRESULT CALLBACK vncMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP vncMenu *_this = (vncMenu *) GetWindowLongPtr(hwnd, GWLP_USERDATA); #endif // Beep(100,10); - // vnclog.Print(LL_INTINFO, VNCLOG("iMsg 0x%x \n"),iMsg); + // vnclog.Print(LL_INTINFO, VNCLOG("iMsg 0x%x "),iMsg); switch (iMsg) { @@ -589,7 +589,7 @@ LRESULT CALLBACK vncMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP if ( ! _this->m_server->GetDisableTrayIcon()) { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack\n")); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack")); if (_this->m_server->RunningFromExternalService()) { @@ -597,20 +597,20 @@ if ( ! _this->m_server->GetDisableTrayIcon()) if (vncService::CurrentUser((char *) &newuser, sizeof(newuser))) { // vnclog.Print(LL_INTINFO, -// VNCLOG("############### Usernames change: old=\"%s\", new=\"%s\"\n"), +// VNCLOG("############### Usernames change: old=\"%s\", new=\"%s\""), // _this->m_username, newuser); // Check whether the user name has changed! if (strcmp(newuser, _this->m_username) != 0 || _this->IconFaultCounter>20) { vnclog.Print(LL_INTINFO, - VNCLOG("user name has changed\n")); + VNCLOG("user name has changed")); // User has changed! strcpy(_this->m_username, newuser); vnclog.Print(LL_INTINFO, - VNCLOG("############## Kill vncMenu thread\n")); + VNCLOG("############## Kill vncMenu thread")); // Order impersonation thread killing PostQuitMessage(0); @@ -621,7 +621,7 @@ if ( ! _this->m_server->GetDisableTrayIcon()) // *** HACK for running servicified if (vncService::RunningAsService()) { - //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack call - Runningasservice\n")); + //vnclog.Print(LL_INTERR, VNCLOG("########### vncMenu::TIMER TrayIcon 5s hack call - Runningasservice")); // Attempt to add the icon if it's not already there _this->AddTrayIcon(); // Trigger a check of the current user @@ -683,7 +683,7 @@ if ( ! _this->m_server->GetDisableTrayIcon()) case ID_KILLCLIENTS: // Disconnect all currently connected clients - vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_KILLCLIENTS \n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_KILLCLIENTS ")); _this->m_server->KillAuthClients(); break; @@ -699,7 +699,7 @@ if ( ! _this->m_server->GetDisableTrayIcon()) case ID_CLOSE: // User selected Close from the tray menu - vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE \n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() ID_CLOSE ")); _this->m_server->KillAuthClients(); fShutdownOrdered=TRUE; PostMessage(hwnd, WM_CLOSE, 0, 0); @@ -718,7 +718,7 @@ if ( ! _this->m_server->GetDisableTrayIcon()) { if (submenu == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("no submenu available\n")); + vnclog.Print(LL_INTERR, VNCLOG("no submenu available")); return 0; } @@ -763,18 +763,18 @@ if ( ! _this->m_server->GetDisableTrayIcon()) if (_this->m_server->RemoveAeroEnabled()) ResetAero(); - vnclog.Print(LL_INTERR, VNCLOG("vncMenu WM_CLOSE call - All cleanup done\n")); + vnclog.Print(LL_INTERR, VNCLOG("vncMenu WM_CLOSE call - All cleanup done")); DestroyWindow(hwnd); break; case WM_DESTROY: // The user wants WinVNC to quit cleanly... - vnclog.Print(LL_INTINFO, VNCLOG("quitting from WM_DESTROY\n")); + vnclog.Print(LL_INTINFO, VNCLOG("quitting from WM_DESTROY")); PostQuitMessage(0); return 0; case WM_QUERYENDSESSION: - vnclog.Print(LL_INTERR, VNCLOG("WM_QUERYENDSESSION\n")); + vnclog.Print(LL_INTERR, VNCLOG("WM_QUERYENDSESSION")); //_this->m_server->KillAuthClients(); //_this->m_server->KillSockConnect(); //_this->m_server->ShutdownServer(); @@ -790,7 +790,7 @@ if ( ! _this->m_server->GetDisableTrayIcon()) break; case WM_ENDSESSION: - vnclog.Print(LL_INTERR, VNCLOG("WM_ENDSESSION\n")); + vnclog.Print(LL_INTERR, VNCLOG("WM_ENDSESSION")); break; case WM_USERCHANGED: @@ -801,14 +801,14 @@ if ( ! _this->m_server->GetDisableTrayIcon()) if (vncService::CurrentUser((char *) &newuser, sizeof(newuser))) { vnclog.Print(LL_INTINFO, - VNCLOG("############### Usernames change: old=\"%s\", new=\"%s\"\n"), + VNCLOG("############### Usernames change: old=\"%s\", new=\"%s\""), _this->m_username, newuser); // Check whether the user name has changed! if (strcmp(newuser, _this->m_username) != 0) { vnclog.Print(LL_INTINFO, - VNCLOG("user name has changed\n")); + VNCLOG("user name has changed")); // User has changed! strcpy(_this->m_username, newuser); diff --git a/srcacic/WinVNC/WinVNC/vncpasswd.h b/srcacic/WinVNC/WinVNC/vncpasswd.h index 1bb58d1..bfc35b3 100644 --- a/srcacic/WinVNC/WinVNC/vncpasswd.h +++ b/srcacic/WinVNC/WinVNC/vncpasswd.h @@ -53,7 +53,7 @@ public: public: inline ToText(const char encrypted[MAXPWLEN]) { - vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : ToText called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : ToText called")); plaintext = vncDecryptPasswd((char *)encrypted); } inline ~ToText() @@ -74,7 +74,7 @@ public: public: inline FromText(char *unencrypted) { - vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromText called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromText called")); vncEncryptPasswd(unencrypted, encrypted); // ZeroMemory(unencrypted, strlen(unencrypted)); } @@ -91,7 +91,7 @@ public: public: inline FromClear() { - vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromClear called\n")); + vnclog.Print(LL_INTINFO, VNCLOG("PASSWD : FromClear called")); vncEncryptPasswd("", encrypted); } inline ~FromClear() diff --git a/srcacic/WinVNC/WinVNC/vncserver.cpp b/srcacic/WinVNC/WinVNC/vncserver.cpp index 25900f1..94cea74 100644 --- a/srcacic/WinVNC/WinVNC/vncserver.cpp +++ b/srcacic/WinVNC/WinVNC/vncserver.cpp @@ -229,7 +229,7 @@ vncServer::vncServer() vncServer::~vncServer() { - //vnclog.Print(LL_STATE, VNCLOG("shutting down server object1\n")); + //vnclog.Print(LL_STATE, VNCLOG("shutting down server object1")); // We don't want to retry when we are shutting down... m_fAutoReconnect = FALSE; @@ -272,7 +272,7 @@ vncServer::~vncServer() while (g_Desktop_running) { Sleep(100); - vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown\n")); + vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown")); } // Don't free the authhosts string until no more connections are possible @@ -299,7 +299,7 @@ vncServer::~vncServer() { delete(m_pDSMPlugin); m_pDSMPlugin=NULL; - vnclog.Print(LL_SOCKINFO, VNCLOG("~server m_pDSMPlugin = NULL \n")); + vnclog.Print(LL_SOCKINFO, VNCLOG("~server m_pDSMPlugin = NULL ")); } // Free the host blacklist @@ -314,14 +314,14 @@ vncServer::~vncServer() // bad hack //Sleep(500); //sometimes crash, vnclog seems already removed - // vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)\n")); + // vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)")); g_Server_running=false; } void vncServer::ShutdownServer() { - vnclog.Print(LL_STATE, VNCLOG("shutting down server object2\n")); + vnclog.Print(LL_STATE, VNCLOG("shutting down server object2")); // We don't want to retry when we are shutting down... m_fAutoReconnect = FALSE; @@ -364,7 +364,7 @@ vncServer::ShutdownServer() while (g_Desktop_running) { Sleep(100); - vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown\n")); + vnclog.Print(LL_STATE, VNCLOG("Waiting for desktop to shutdown")); } // Don't free the authhosts string until no more connections are possible @@ -391,7 +391,7 @@ vncServer::ShutdownServer() { delete(m_pDSMPlugin); m_pDSMPlugin=NULL; - vnclog.Print(LL_SOCKINFO, VNCLOG("ShutdownServer m_pDSMPlugin = NULL \n")); + vnclog.Print(LL_SOCKINFO, VNCLOG("ShutdownServer m_pDSMPlugin = NULL ")); } // Free the host blacklist @@ -406,7 +406,7 @@ vncServer::ShutdownServer() // bad hack //Sleep(500); //sometimes crash, vnclog seems already removed -// vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)\n")); +// vnclog.Print(LL_STATE, VNCLOG("shutting down server object(4)")); g_Server_running=false; } @@ -428,7 +428,7 @@ vncClientId vncServer::AddClient(VSocket *socket, /*BOOL keysenabled, BOOL ptrenabled,*/ rfbProtocolVersionMsg *protocolMsg) { - vnclog.Print(LL_STATE, VNCLOG("AddClient() started\n")); + vnclog.Print(LL_STATE, VNCLOG("AddClient() started")); vncClient *client; @@ -469,7 +469,7 @@ vncClientId vncServer::AddClient(VSocket *socket, if (!client->Init(this, socket, auth, shared, clientid)) { // The client will delete the socket for us... - vnclog.Print(LL_CONNERR, VNCLOG("failed to initialise client object\n")); + vnclog.Print(LL_CONNERR, VNCLOG("failed to initialise client object")); delete client; return -1; } @@ -482,7 +482,7 @@ vncClientId vncServer::AddClient(VSocket *socket, // Notify anyone interested about this event DoNotify(WM_SRV_CLIENT_CONNECT, 0, 0); - vnclog.Print(LL_INTINFO, VNCLOG("AddClient() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("AddClient() done")); return clientid; } @@ -492,9 +492,9 @@ vncServer::Authenticated(vncClientId clientid) { vncClientList::iterator i; BOOL authok = TRUE; -// vnclog.Print(LL_INTINFO, VNCLOG("Lock2\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock2")); omni_mutex_lock l1(m_desktopLock); -// vnclog.Print(LL_INTINFO, VNCLOG("Lock3\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock3")); omni_mutex_lock l2(m_clientsLock); // Search the unauthenticated client list @@ -521,7 +521,7 @@ vncServer::Authenticated(vncClientId clientid) } if (!m_desktop->Init(this)) { - vnclog.Print(LL_INTINFO, VNCLOG("Desktop init failed, unlock in application mode ? \n")); + vnclog.Print(LL_INTINFO, VNCLOG("Desktop init failed, unlock in application mode ? ")); client->Kill(); authok = FALSE; delete m_desktop; @@ -544,7 +544,7 @@ vncServer::Authenticated(vncClientId clientid) // Notify anyone interested of this event DoNotify(WM_SRV_CLIENT_AUTHENTICATED, 0, 0); - vnclog.Print(LL_INTINFO, VNCLOG("Authenticated() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Authenticated() done")); return authok; } @@ -563,7 +563,7 @@ vncServer::KillClient(vncClientId clientid) // Is this the right client? if ((*i) == clientid) { - vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client")); // Ask the client to die vncClient *client = GetClient(clientid); @@ -580,7 +580,7 @@ vncServer::KillClient(vncClientId clientid) // Is this the right client? if ((*i) == clientid) { - vnclog.Print(LL_INTINFO, VNCLOG("killing auth client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("killing auth client")); // Yes, so kill it vncClient *client = GetClient(clientid); @@ -592,7 +592,7 @@ vncServer::KillClient(vncClientId clientid) } } - vnclog.Print(LL_INTINFO, VNCLOG("KillClient() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillClient() done")); } // @@ -609,11 +609,11 @@ void vncServer::KillClient(LPSTR szClientName) pClient = GetClient(*i); if (!_stricmp(pClient->GetClientName(), szClientName)) { - vnclog.Print(LL_INTINFO, VNCLOG("Killing client named: %s\n"), szClientName); + vnclog.Print(LL_INTINFO, VNCLOG("Killing client named: %s"), szClientName); pClient->Kill(); } } - vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done")); } @@ -633,7 +633,7 @@ void vncServer::TextChatClient(LPSTR szClientName) { if (!pClient->IsUltraViewer()) { - vnclog.Print(LL_INTINFO, VNCLOG("Client %s is not Ultra. Doesn't know TextChat\n"), szClientName); + vnclog.Print(LL_INTINFO, VNCLOG("Client %s is not Ultra. Doesn't know TextChat"), szClientName); vncTimedMsgBox::Do( sz_ID_ULTRAVNC_TEXTCHAT, sz_ID_ULTRAVNC_WARNING, @@ -641,12 +641,12 @@ void vncServer::TextChatClient(LPSTR szClientName) ); break; } - vnclog.Print(LL_INTINFO, VNCLOG("TextChat with client named: %s\n"), szClientName); + vnclog.Print(LL_INTINFO, VNCLOG("TextChat with client named: %s"), szClientName); pClient->GetTextChatPointer()->OrderTextChat(); break; } } - vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillClient() from name done")); } @@ -659,13 +659,13 @@ vncServer::KillAuthClients() // Tell all the authorised clients to die! for (i = m_authClients.begin(); i != m_authClients.end(); i++) { - vnclog.Print(LL_INTINFO, VNCLOG("killing auth client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("killing auth client")); // Kill the client GetClient(*i)->Kill(); } - vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() done")); } // @@ -753,13 +753,13 @@ vncServer::KillUnauthClients() // Tell all the authorised clients to die! for (i = m_unauthClients.begin(); i != m_unauthClients.end(); i++) { - vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("killing unauth client")); // Kill the client GetClient(*i)->Kill(); } - vnclog.Print(LL_INTINFO, VNCLOG("KillUnauthClients() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillUnauthClients() done")); } @@ -914,9 +914,9 @@ vncServer::RemoveClient(vncClientId clientid) { vncClientList::iterator i; BOOL done = FALSE; -// vnclog.Print(LL_INTINFO, VNCLOG("Lock1\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock1")); omni_mutex_lock l1(m_desktopLock); -// vnclog.Print(LL_INTINFO, VNCLOG("Lock3\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock3")); { omni_mutex_lock l2(m_clientsLock); // Find the client in one of the two lists @@ -925,7 +925,7 @@ vncServer::RemoveClient(vncClientId clientid) // Is this the right client? if ((*i) == clientid) { - vnclog.Print(LL_INTINFO, VNCLOG("removing unauthorised client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("removing unauthorised client")); // Yes, so remove the client and kill it m_unauthClients.erase(i); @@ -941,7 +941,7 @@ vncServer::RemoveClient(vncClientId clientid) // Is this the right client? if ((*i) == clientid) { - vnclog.Print(LL_INTINFO, VNCLOG("removing authorised client\n")); + vnclog.Print(LL_INTINFO, VNCLOG("removing authorised client")); // Yes, so remove the client and kill it m_authClients.erase(i); @@ -961,7 +961,7 @@ vncServer::RemoveClient(vncClientId clientid) // Are there any authorised clients connected? if (m_authClients.empty() && (m_desktop != NULL)) { - vnclog.Print(LL_STATE, VNCLOG("deleting desktop server\n")); + vnclog.Print(LL_STATE, VNCLOG("deleting desktop server")); // sf@2007 - Do not lock/logoff even if required when WinVNC autorestarts (on desktop change (XP FUS / Vista)) if (!AutoRestartFlag()) @@ -981,7 +981,7 @@ vncServer::RemoveClient(vncClientId clientid) { // Yes - force a user logoff on disconnect! if (!ExitWindowsEx(EWX_LOGOFF, 0)) - vnclog.Print(LL_CONNERR, VNCLOG("client disconnect - failed to logoff user!\n")); + vnclog.Print(LL_CONNERR, VNCLOG("client disconnect - failed to logoff user!")); } } } @@ -989,12 +989,12 @@ vncServer::RemoveClient(vncClientId clientid) // Delete the screen server delete m_desktop; m_desktop = NULL; - vnclog.Print(LL_STATE, VNCLOG("desktop deleted\n")); + vnclog.Print(LL_STATE, VNCLOG("desktop deleted")); } // Notify anyone interested of the change DoNotify(WM_SRV_CLIENT_DISCONNECT, 0, 0); - vnclog.Print(LL_INTINFO, VNCLOG("RemoveClient() done\n")); + vnclog.Print(LL_INTINFO, VNCLOG("RemoveClient() done")); } // NOTIFICATION HANDLING! @@ -1123,7 +1123,7 @@ vncServer::UpdateLocalFormat() void vncServer::UpdateLocalClipText(LPSTR text) { -// vnclog.Print(LL_INTINFO, VNCLOG("Lock5\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock5")); omni_mutex_lock l(m_desktopLock); if (m_desktop != NULL) @@ -1219,7 +1219,7 @@ BOOL vncServer::SockConnect(BOOL On) { // Are we being asked to switch socket connects on or off? - vnclog.Print(20, VNCLOG("SockConnect %d\n"), On); + vnclog.Print(20, VNCLOG("SockConnect %d"), On); if (On) { // Is there a listening socket? @@ -1239,7 +1239,7 @@ vncServer::SockConnect(BOOL On) { m_port = DISPLAY_TO_PORT(i); - vnclog.Print(LL_CLIENTS, VNCLOG("Tentando usar a porta %d...\n"), m_port); + vnclog.Print(LL_CLIENTS, VNCLOG("Tentando usar a porta %d..."), m_port); // Attempt to connect to the port VSocket tempsock; @@ -1278,13 +1278,13 @@ vncServer::SockConnect(BOOL On) // Now let's start the HTTP connection stuff EnableXDMCPConnect(m_enableXdmcpConn); - vnclog.Print(20, VNCLOG("SockConnect Done %d\n"), On); + vnclog.Print(20, VNCLOG("SockConnect Done %d"), On); } } else { // *** JNW - Trying to fix up a lock-up when the listening socket closes - vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() fix up a lock-up \n")); + vnclog.Print(LL_INTINFO, VNCLOG("KillAuthClients() fix up a lock-up ")); KillAuthClients(); KillUnauthClients(); WaitUntilAuthEmpty(); @@ -1387,10 +1387,10 @@ void vncServer::GetScreenInfo(int &width, int &height, int &depth) { rfbServerInitMsg scrinfo; -// vnclog.Print(LL_INTINFO, VNCLOG("Lock6\n")); +// vnclog.Print(LL_INTINFO, VNCLOG("Lock6")); omni_mutex_lock l(m_desktopLock); - //vnclog.Print(LL_INTINFO, VNCLOG("GetScreenInfo called\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("GetScreenInfo called")); // Is a desktop object currently active? // No, so create a dummy desktop and interrogate it @@ -1399,7 +1399,7 @@ vncServer::GetScreenInfo(int &width, int &height, int &depth) HDC hrootdc; hrootdc = GetDC(NULL); if (hrootdc == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("Failed rootdc \n")); + vnclog.Print(LL_INTERR, VNCLOG("Failed rootdc ")); scrinfo.framebufferWidth = 0; scrinfo.framebufferHeight = 0; scrinfo.format.bitsPerPixel = 0; @@ -1493,12 +1493,12 @@ vncServer::SetAuthHosts(const char*hostlist) { omni_mutex_lock l(m_clientsLock); if (hostlist == 0) { - vnclog.Print(LL_INTINFO, VNCLOG("authhosts cleared\n")); + vnclog.Print(LL_INTINFO, VNCLOG("authhosts cleared")); m_auth_hosts = 0; return; } - vnclog.Print(LL_INTINFO, VNCLOG("authhosts set to \"%s\"\n"), hostlist); + vnclog.Print(LL_INTINFO, VNCLOG("authhosts set to \"%s\""), hostlist); if (m_auth_hosts != 0) free(m_auth_hosts); @@ -1586,7 +1586,7 @@ vncServer::VerifyHost(const char *hostname) { // Has a hostname been specified? if (hostname == 0) { - vnclog.Print(LL_INTWARN, VNCLOG("verify failed - null hostname\n")); + vnclog.Print(LL_INTWARN, VNCLOG("verify failed - null hostname")); return vncServer::aqrReject; } @@ -1623,7 +1623,7 @@ vncServer::VerifyHost(const char *hostname) { patternStart = authHostsPos+1; machineMode = vh_ExpectPattern; } else if (m_auth_hosts[authHostsPos] != '\0') { - vnclog.Print(LL_INTWARN, VNCLOG("verify host - malformed AuthHosts string\n")); + vnclog.Print(LL_INTWARN, VNCLOG("verify host - malformed AuthHosts string")); machineMode = vh_ExpectDelimiter; } break; @@ -1636,7 +1636,7 @@ vncServer::VerifyHost(const char *hostname) { (m_auth_hosts[authHostsPos] == '\0')) { if (machineMode == vh_ExpectPattern) { if (patternStart == 0) { - vnclog.Print(LL_INTWARN, VNCLOG("verify host - pattern processing failed!\n")); + vnclog.Print(LL_INTWARN, VNCLOG("verify host - pattern processing failed!")); } else { // Process the match if (MatchStringToTemplate(hostname, hostNameLen, @@ -1775,7 +1775,7 @@ vncServer::SetNewSWSize(long w,long h,BOOL desktop) { // Post the update if (!GetClient(*i)->SetNewSWSize(w,h,desktop)) { - vnclog.Print(LL_INTINFO, VNCLOG("Unable to set new desktop size\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Unable to set new desktop size")); KillClient(*i); } } @@ -1895,19 +1895,19 @@ void vncServer::SetDSMPluginName(char* szDSMPlugin) // BOOL vncServer::SetDSMPlugin(BOOL bForceReload) { - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Entry \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Entry ")); if (AuthClientCount() > 0) return FALSE; if (!IsDSMPluginEnabled()) return FALSE; - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Enabled \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Enabled ")); // If the plugin is loaded, unload it first // sf@2003 - it has been possibly pre-configured by // clicking on the plugin config button if (m_pDSMPlugin->IsLoaded()) { - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Is Loaded \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Is Loaded ")); // sf@2003 - We check if the loaded plugin is the same than // the currently selected one or not @@ -1915,8 +1915,8 @@ BOOL vncServer::SetDSMPlugin(BOOL bForceReload) if (_stricmp(m_pDSMPlugin->GetPluginFileName(), GetDSMPluginName()) || bForceReload) { if (bForceReload) - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - FORCE RELOADING OF THE PLUGIN \n")); - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - New one - Unload the current \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - FORCE RELOADING OF THE PLUGIN ")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - New one - Unload the current ")); m_pDSMPlugin->SetEnabled(false); m_pDSMPlugin->UnloadPlugin(); } @@ -1924,20 +1924,20 @@ BOOL vncServer::SetDSMPlugin(BOOL bForceReload) if (!m_pDSMPlugin->IsLoaded()) { - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin NOT loaded - Try to load it \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin NOT loaded - Try to load it ")); if (!m_pDSMPlugin->LoadPlugin(GetDSMPluginName(), false)) { - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ DSMPlugin cannot be loaded\n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ DSMPlugin cannot be loaded")); return FALSE; } } - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin successfully loaded \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Plugin successfully loaded ")); // Now that it is loaded, init it if (m_pDSMPlugin->InitPlugin()) { - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Init plugin call \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - Init plugin call ")); char szParams[MAXPWLEN + 64]; char password[MAXPWLEN]; GetPassword(password); @@ -1954,25 +1954,25 @@ BOOL vncServer::SetDSMPlugin(BOOL bForceReload) //::MessageBox(NULL, szParams, "SetDSMPlugin info", MB_OK); - vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - SetPluginParams call \n")); + vnclog.Print(LL_INTINFO, VNCLOG("$$$$$$$$$$ SetDSMPlugin - SetPluginParams call ")); if (m_pDSMPlugin->SetPluginParams(NULL, szParams/*vncDecryptPasswd((char *)password)*/)) { m_pDSMPlugin->SetEnabled(true); // The plugin is ready to be used - vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Params OK\n")); + vnclog.Print(LL_INTINFO, VNCLOG("DSMPlugin Params OK")); return TRUE; } else { m_pDSMPlugin->SetEnabled(false); - vnclog.Print(LL_INTINFO, VNCLOG("Unable to set DSMPlugin Params\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Unable to set DSMPlugin Params")); } } else { m_pDSMPlugin->SetEnabled(false); - vnclog.Print(LL_INTINFO, VNCLOG("Unable to init DSMPlugin\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Unable to init DSMPlugin")); } /* @@ -2095,7 +2095,7 @@ void vncServer::AutoConnectRetry( ) { if ( m_fAutoReconnect ) { - vnclog.Print(LL_INTINFO, VNCLOG("AutoConnectRetry(): started\n")); + vnclog.Print(LL_INTINFO, VNCLOG("AutoConnectRetry(): started")); m_retry_timeout = SetTimer( NULL, 0, (1000*30), (TIMERPROC)_timerRetryHandler ); } } @@ -2106,7 +2106,7 @@ void CALLBACK vncServer::_timerRetryHandler( HWND /*hWnd*/, UINT /*uMsg*/, UINT_ } void vncServer::_actualTimerRetryHandler() { - vnclog.Print(LL_INTINFO, VNCLOG("Attempting AutoReconnect....\n")); + vnclog.Print(LL_INTINFO, VNCLOG("Attempting AutoReconnect....")); KillTimer( NULL, m_retry_timeout ); m_retry_timeout = 0; diff --git a/srcacic/WinVNC/WinVNC/vncservice.cpp b/srcacic/WinVNC/WinVNC/vncservice.cpp index 8eea0e6..362c9af 100644 --- a/srcacic/WinVNC/WinVNC/vncservice.cpp +++ b/srcacic/WinVNC/WinVNC/vncservice.cpp @@ -209,7 +209,7 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change { if (vncService::RunningFromExternalService()) { -// vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Forcing g_impersonating_user \n")); +// vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Forcing g_impersonating_user ")); g_impersonating_user = TRUE; } @@ -224,7 +224,7 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change HWINSTA station = GetProcessWindowStation(); if (station == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - ERROR : No window station \n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - ERROR : No window station ")); return FALSE; } @@ -245,12 +245,12 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change // Return "" as the name... if (strlen("") >= size) { - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Bad buffer size \n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Bad buffer size ")); return FALSE; } strcpy(buffer, ""); - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Usersize 0\n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Usersize 0")); return TRUE; } @@ -258,7 +258,7 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change // them then we can't continue! if (!g_impersonating_user) { - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: NOT impersonating user \n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: NOT impersonating user ")); // Return "" as the name... if (strlen("") >= size) return FALSE; @@ -280,7 +280,7 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change // Just call GetCurrentUser DWORD length = size; -// vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - GetUserName call \n")); +// vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - GetUserName call ")); if ( GetConsoleUser(buffer, size) == 0) { if (GetUserName(buffer, &length) == 0) @@ -289,7 +289,7 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change if (error == ERROR_NOT_LOGGED_ON) { - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: No user logged on \n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: No user logged on ")); // No user logged on if (strlen("") >= size) return FALSE; @@ -299,18 +299,18 @@ GetCurrentUser(char *buffer, UINT size) // RealVNC 336 change else { // Genuine error... - vnclog.Print(LL_INTERR, VNCLOG("getusername error %d\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("getusername error %d"), GetLastError()); return FALSE; } } } } - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - UserNAme found: %s \n"), buffer); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - UserNAme found: %s "), buffer); return TRUE; }; // OS was not recognised! - vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Unknown OS \n")); + vnclog.Print(LL_INTERR, VNCLOG("@@@@@@@@@@@@@ GetCurrentUser - Error: Unknown OS ")); return FALSE; } @@ -428,21 +428,21 @@ vncService::SelectHDESK(HDESK new_desktop) char new_name[256]; if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) { - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation ")); return FALSE; } - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, new_desktop, old_desktop); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x"), new_name, new_desktop, old_desktop); // Switch the desktop if(!SetThreadDesktop(new_desktop)) { - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop ")); return FALSE; } // Switched successfully - destroy the old desktop if (!CloseDesktop(old_desktop)) - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)\n"), old_desktop, GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)"), old_desktop, GetLastError()); return TRUE; } @@ -462,10 +462,10 @@ vncService::SelectDesktop(char *name) if (IsWinNT()) { HDESK desktop; - vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop ")); if (name != NULL) { - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 named\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 named")); // Attempt to open the named desktop desktop = OpenDesktop(name, 0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | @@ -475,7 +475,7 @@ vncService::SelectDesktop(char *name) } else { - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL")); // No, so open the input desktop desktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | @@ -486,16 +486,16 @@ vncService::SelectDesktop(char *name) // Did we succeed? if (desktop == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 \n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 ")); return FALSE; } - else vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 OK\n")); + else vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 OK")); // Switch to the new desktop if (!SelectHDESK(desktop)) { // Failed to enter the new desktop, so free it! if (!CloseDesktop(desktop)) - vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop failed to close desktop\n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop failed to close desktop")); return FALSE; } @@ -541,7 +541,7 @@ BOOL CALLBACK WinStationEnumProc(LPTSTR name, LPARAM param) { BOOL vncService::InputDesktopSelected() { -// vnclog.Print(LL_INTERR, VNCLOG("InputDesktopSelected()\n")); +// vnclog.Print(LL_INTERR, VNCLOG("InputDesktopSelected()")); // Are we running on NT? if (IsWinNT()) { @@ -560,9 +560,9 @@ vncService::InputDesktopSelected() { DWORD lasterror; lasterror=GetLastError(); - vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop I\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop I")); if (lasterror==170) return TRUE; - vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop II\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputDesktop II")); return FALSE; } @@ -572,25 +572,25 @@ vncService::InputDesktopSelected() if (!GetUserObjectInformation(threaddesktop, UOI_NAME, &threadname, 256, &dummy)) { if (!CloseDesktop(inputdesktop)) - vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n")); - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(threaddesktop\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(threaddesktop)")); return FALSE; } _ASSERT(dummy <= 256); if (!GetUserObjectInformation(inputdesktop, UOI_NAME, &inputname, 256, &dummy)) { if (!CloseDesktop(inputdesktop)) - vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n")); - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(inputdesktop\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation(inputdesktop)")); return FALSE; } _ASSERT(dummy <= 256); if (!CloseDesktop(inputdesktop)) - vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to close input desktop")); if (strcmp(threadname, inputname) != 0) { - vnclog.Print(LL_INTERR, VNCLOG("threadname, inputname differ\n")); + vnclog.Print(LL_INTERR, VNCLOG("threadname, inputname differ")); return FALSE; } } @@ -609,7 +609,7 @@ SimulateCtrlAltDelThreadFn(void *context) // Switch into the Winlogon desktop if (!vncService::SelectDesktop("Winlogon")) { - vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to select logon desktop")); vncTimedMsgBox::Do( sz_ID_CADERROR, sz_ID_ULTRAVNC_WARNING, @@ -621,7 +621,7 @@ SimulateCtrlAltDelThreadFn(void *context) // 9 April 2008 jdp // turn off capslock if on ClearKeyState(VK_CAPITAL); - vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del\n")); + vnclog.Print(LL_ALL, VNCLOG("generating ctrl-alt-del")); // Fake a hotkey event to any windows we find there.... :( // Winlogon uses hotkeys to trap Ctrl-Alt-Del... @@ -638,12 +638,12 @@ SimulateCtrlAltDelThreadFn(void *context) BOOL vncService::SimulateCtrlAltDel() { - vnclog.Print(LL_ALL, VNCLOG("preparing to generate ctrl-alt-del\n")); + vnclog.Print(LL_ALL, VNCLOG("preparing to generate ctrl-alt-del")); // Are we running on NT? if (IsWinNT()) { - vnclog.Print(LL_ALL, VNCLOG("spawn ctrl-alt-del thread...\n")); + vnclog.Print(LL_ALL, VNCLOG("spawn ctrl-alt-del thread...")); // *** This is an unpleasant hack. Oh dear. @@ -670,16 +670,16 @@ BOOL vncService::LockWorkstation() { if (!IsWinNT()) { - vnclog.Print(LL_INTERR, VNCLOG("unable to lock workstation - not NT\n")); + vnclog.Print(LL_INTERR, VNCLOG("unable to lock workstation - not NT")); return FALSE; } - vnclog.Print(LL_ALL, VNCLOG("locking workstation\n")); + vnclog.Print(LL_ALL, VNCLOG("locking workstation")); // Load the user32 library HMODULE user32 = LoadLibrary("user32.dll"); if (!user32) { - vnclog.Print(LL_INTERR, VNCLOG("unable to load User32 DLL (%u)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("unable to load User32 DLL (%u)"), GetLastError()); return FALSE; } @@ -687,7 +687,7 @@ vncService::LockWorkstation() typedef BOOL (*LWProc) (); LWProc lockworkstation = (LWProc)GetProcAddress(user32, "LockWorkStation"); if (!lockworkstation) { - vnclog.Print(LL_INTERR, VNCLOG("unable to locate LockWorkStation - requires Windows 2000 or above (%u)\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("unable to locate LockWorkStation - requires Windows 2000 or above (%u)"), GetLastError()); FreeLibrary(user32); return FALSE; } @@ -696,7 +696,7 @@ vncService::LockWorkstation() BOOL result = (lockworkstation)(); if (!result) { - vnclog.Print(LL_INTERR, VNCLOG("call to LockWorkstation failed\n")); + vnclog.Print(LL_INTERR, VNCLOG("call to LockWorkstation failed")); FreeLibrary(user32); return FALSE; } diff --git a/srcacic/WinVNC/WinVNC/vncsockconnect.cpp b/srcacic/WinVNC/WinVNC/vncsockconnect.cpp index cfb561c..222dbcd 100644 --- a/srcacic/WinVNC/WinVNC/vncsockconnect.cpp +++ b/srcacic/WinVNC/WinVNC/vncsockconnect.cpp @@ -73,7 +73,7 @@ BOOL vncSockConnectThread::Init(VSocket *socket, vncServer *server) // Code to be executed by the thread void *vncSockConnectThread::run_undetached(void * arg) { - vnclog.Print(LL_STATE, VNCLOG("Thread de conexão iniciada.\n")); + vnclog.Print(LL_STATE, VNCLOG("Thread de conexão iniciada.")); // Go into a loop, listening for connections on the given socket while (!m_shutdown) @@ -84,7 +84,7 @@ void *vncSockConnectThread::run_undetached(void * arg) break; else { - vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s\n"), new_socket->GetPeerName()); + vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s"), new_socket->GetPeerName()); m_server->AddClient(new_socket, FALSE, FALSE,NULL); } @@ -135,7 +135,7 @@ void *vncSockConnectThread::run_undetached(void * arg) //We need at least a RFB start in the message if (strncmp(protocol_ver,"RFB",3)==NULL) { - vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s\n"), new_socket->GetPeerName()); + vnclog.Print(LL_CLIENTS, VNCLOG("accepted connection from %s"), new_socket->GetPeerName()); // Successful accept - start the client unauthenticated m_server->AddClient(new_socket, FALSE, FALSE,&protocol_ver); } @@ -153,7 +153,7 @@ void *vncSockConnectThread::run_undetached(void * arg) //if (new_socket != null) // delete new_socket; - vnclog.Print(LL_STATE, VNCLOG("Terminando a thread de socket...\n")); + vnclog.Print(LL_STATE, VNCLOG("Terminando a thread de socket...")); return NULL; } diff --git a/srcacic/WinVNC/WinVNC/vsocket.cpp b/srcacic/WinVNC/WinVNC/vsocket.cpp index 97adae6..a4cc17e 100644 --- a/srcacic/WinVNC/WinVNC/vsocket.cpp +++ b/srcacic/WinVNC/WinVNC/vsocket.cpp @@ -125,7 +125,7 @@ VSocket::VSocket() { // Clear out the internal socket fields sock = -1; - vnclog.Print(LL_SOCKINFO, VNCLOG("VSocket() m_pDSMPlugin = NULL \n")); + vnclog.Print(LL_SOCKINFO, VNCLOG("VSocket() m_pDSMPlugin = NULL ")); m_pDSMPlugin = NULL; m_fUsePlugin = false; @@ -196,7 +196,7 @@ VSocket::Close() { if (sock >= 0) { - vnclog.Print(LL_SOCKINFO, VNCLOG("closing socket\n")); + vnclog.Print(LL_SOCKINFO, VNCLOG("closing socket")); shutdown(sock, SD_BOTH); #ifdef __WIN32__ @@ -216,7 +216,7 @@ VSocket::Shutdown() { if (sock >= 0) { - vnclog.Print(LL_SOCKINFO, VNCLOG("shutdown socket\n")); + vnclog.Print(LL_SOCKINFO, VNCLOG("shutdown socket")); shutdown(sock, SD_BOTH); // sock = -1; @@ -376,8 +376,9 @@ VSocket::GetPeerName() name = inet_ntoa(address); if (name == NULL) return ""; - else + else{ return name; + } } //////////////////////////// @@ -463,14 +464,14 @@ VSocket::Send(const char *buff, const VCard bufflen) { memcpy(queuebuffer+queuebuffersize,buff2,8192-queuebuffersize); send(sock,queuebuffer,8192,0); -// vnclog.Print(LL_SOCKERR, VNCLOG("SEND %i\n") ,8192); +// vnclog.Print(LL_SOCKERR, VNCLOG("SEND %i") ,8192); buff2+=(8192-queuebuffersize); bufflen2-=(8192-queuebuffersize); queuebuffersize=0; while (bufflen2 > 8192) { if (!send(sock,buff2,8192,0)) return false; -// vnclog.Print(LL_SOCKERR, VNCLOG("SEND 1 %i\n") ,8192); +// vnclog.Print(LL_SOCKERR, VNCLOG("SEND 1 %i") ,8192); buff2+=8192; bufflen2-=8192; } @@ -478,7 +479,7 @@ VSocket::Send(const char *buff, const VCard bufflen) memcpy(queuebuffer+queuebuffersize,buff2,bufflen2); queuebuffersize+=bufflen2; if (!send(sock,queuebuffer,queuebuffersize,0)) return false; -// vnclog.Print(LL_SOCKERR, VNCLOG("SEND 2 %i\n") ,queuebuffersize); +// vnclog.Print(LL_SOCKERR, VNCLOG("SEND 2 %i") ,queuebuffersize); queuebuffersize=0; return bufflen; } @@ -495,14 +496,14 @@ VSocket::SendQueued(const char *buff, const VCard bufflen) { memcpy(queuebuffer+queuebuffersize,buff2,8192-queuebuffersize); send(sock,queuebuffer,8192,0); - // vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q %i\n") ,8192); + // vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q %i") ,8192); buff2+=(8192-queuebuffersize); bufflen2-=(8192-queuebuffersize); queuebuffersize=0; while (bufflen2 > 8192) { if (!send(sock,buff2,8192,0)) return false; - // vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q %i\n") ,8192); + // vnclog.Print(LL_SOCKERR, VNCLOG("SEND Q %i") ,8192); buff2+=8192; bufflen2-=8192; } @@ -517,7 +518,7 @@ VSocket::SendQueued(const char *buff, const VCard bufflen) VBool VSocket::SendExact(const char *buff, const VCard bufflen, unsigned char msgType) { - //vnclog.Print(LL_SOCKERR, VNCLOG("SendExactMsg %i\n") ,bufflen); + //vnclog.Print(LL_SOCKERR, VNCLOG("SendExactMsg %i") ,bufflen); if (m_fUsePlugin && m_pDSMPlugin->IsEnabled()) { // Send the transformed message type first @@ -536,7 +537,7 @@ VSocket::SendExact(const char *buff, const VCard bufflen, unsigned char msgType) VBool VSocket::SendExact(const char *buff, const VCard bufflen) { -// vnclog.Print(LL_SOCKERR, VNCLOG("SendExact %i\n") ,bufflen); +// vnclog.Print(LL_SOCKERR, VNCLOG("SendExact %i") ,bufflen); // sf@2002 - DSMPlugin VCard nBufflen = bufflen; char* pBuffer = NULL; @@ -573,8 +574,8 @@ VSocket::SendExact(const char *buff, const VCard bufflen) VBool VSocket::SendExactQueue(const char *buff, const VCard bufflen) { -// vnclog.Print(LL_SOCKERR, VNCLOG("SendExactQueue %i %i\n") ,bufflen,queuebuffersize); -// vnclog.Print(LL_SOCKERR, VNCLOG("socket size %i\n") ,bufflen); +// vnclog.Print(LL_SOCKERR, VNCLOG("SendExactQueue %i %i") ,bufflen,queuebuffersize); +// vnclog.Print(LL_SOCKERR, VNCLOG("socket size %i") ,bufflen); // sf@2002 - DSMPlugin VCard nBufflen = bufflen; char* pBuffer = NULL; @@ -646,7 +647,7 @@ VSocket::ReadExact(char *buff, const VCard bufflen) { // m_pDSMPlugin->RestoreBufferUnlock(); // throw WarningException("WriteExact: DSMPlugin-RestoreBuffer Alloc Error."); - vnclog.Print(LL_SOCKERR, VNCLOG("WriteExact: DSMPlugin-RestoreBuffer Alloc Error\n")); + vnclog.Print(LL_SOCKERR, VNCLOG("WriteExact: DSMPlugin-RestoreBuffer Alloc Error")); return VFalse; } @@ -663,13 +664,13 @@ VSocket::ReadExact(char *buff, const VCard bufflen) nTransDataLen -= n; } else if (n == 0) { //m_pDSMPlugin->RestoreBufferUnlock(); - vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read1\n")); + vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read1")); return VFalse; } else { if (WSAGetLastError() != WSAEWOULDBLOCK) { //m_pDSMPlugin->RestoreBufferUnlock(); - vnclog.Print(LL_SOCKERR, VNCLOG("socket error 1: %d\n"), WSAGetLastError()); + vnclog.Print(LL_SOCKERR, VNCLOG("socket error 1: %d"), WSAGetLastError()); return VFalse; } } @@ -699,14 +700,14 @@ VSocket::ReadExact(char *buff, const VCard bufflen) buff += n; currlen -= n; } else if (n == 0) { - vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read2\n")); + vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read2")); return VFalse; } else { if (WSAGetLastError() != WSAEWOULDBLOCK) { //int aa=WSAGetLastError(); - //vnclog.Print(LL_SOCKERR, VNCLOG("socket error 2: %d\n"), aa); + //vnclog.Print(LL_SOCKERR, VNCLOG("socket error 2: %d"), aa); return VFalse; } } @@ -777,13 +778,13 @@ VSocket::ReadExactHTTP(char *buff, const VCard bufflen) buff += n; currlen -= n; } else if (n == 0) { - vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read3\n")); + vnclog.Print(LL_SOCKERR, VNCLOG("zero bytes read3")); return VFalse; } else { if (WSAGetLastError() != WSAEWOULDBLOCK) { - vnclog.Print(LL_SOCKERR, VNCLOG("HTTP socket error: %d\n"), WSAGetLastError()); + vnclog.Print(LL_SOCKERR, VNCLOG("HTTP socket error: %d"), WSAGetLastError()); return VFalse; } } diff --git a/srcacic/WinVNC/WinVNC/winvnc.cpp b/srcacic/WinVNC/WinVNC/winvnc.cpp index 6ef9e13..26e959e 100644 --- a/srcacic/WinVNC/WinVNC/winvnc.cpp +++ b/srcacic/WinVNC/WinVNC/winvnc.cpp @@ -103,6 +103,7 @@ void Set_uninstall_service_as_admin(); void Set_install_service_as_admin(); void winvncSecurityEditorHelper_as_admin(); + // [v1.0.2-jp1 fix] Load resouce from dll HINSTANCE hInstResDLL; @@ -229,7 +230,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, if (strncmp(&szCmdLine[0], winvncKill, strlen(winvncKill)) == 0) { - vnclog.Print(LL_SRLOG, VNCLOG("---> Comando -kill recebido.\n")); + vnclog.Print(LL_SRLOG, VNCLOG("---> Comando -kill recebido.")); argfound = TRUE; @@ -250,7 +251,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, if (strncmp(&szCmdLine[0], winvncStart, strlen(winvncStart)) == 0) { - vnclog.Print(LL_SRLOG, VNCLOG("---> Comando -start recebido.\n")); + vnclog.Print(LL_SRLOG, VNCLOG("---> Comando -start recebido.")); argfound = TRUE; char* cmdln[8]; @@ -263,7 +264,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, if (i < 7) { MessageBox(NULL, "Número de parâmetros menor do que o esperado!", "ERRO!", MB_OK | MB_ICONERROR); - vnclog.Print(LL_SRLOG, VNCLOG("Número de parâmetros menor do que o esperado!\n")); + vnclog.Print(LL_SRLOG, VNCLOG("Número de parâmetros menor do que o esperado!")); return 0; } @@ -274,7 +275,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, string filePath = string(cmdln[5]); filePath += CACIC_Auth::AGUARDE_FILENAME; pFile = fopen(filePath.data(), "w+"); - vnclog.Print(LL_SRLOG, VNCLOG("Criando arquivo temporário: aguarde_SRCACIC.txt!\n")); + vnclog.Print(LL_SRLOG, VNCLOG("Criando arquivo temporário: aguarde_SRCACIC.txt!")); // decodifica o host e o script do gerente web string te_end_serv_dec; @@ -308,7 +309,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, if (!argfound) { // If no arguments were given then do not run MessageBox(NULL, "Execução incorreta!", "ERRO!", MB_OK | MB_ICONERROR); - vnclog.Print(LL_SRLOG, VNCLOG("Tentativa incorreta de execução!\n")); + vnclog.Print(LL_SRLOG, VNCLOG("Tentativa incorreta de execução!")); return 0; } @@ -350,11 +351,11 @@ bool ImpersonateCurrentUser_() Token_=NULL; if (GetCurrentUserToken_()==0) { - vnclog.Print(LL_INTERR, VNCLOG("!GetCurrentUserToken_ \n")); + vnclog.Print(LL_INTERR, VNCLOG("!GetCurrentUserToken_ ")); return false; } bool test=(FALSE != ImpersonateLoggedOnUser(Token_)); - if (test==1) vnclog.Print(LL_INTERR, VNCLOG("ImpersonateLoggedOnUser OK \n")); + if (test==1) vnclog.Print(LL_INTERR, VNCLOG("ImpersonateLoggedOnUser OK ")); if (process_) CloseHandle(process_); if (Token_) CloseHandle(Token_); return test; @@ -366,8 +367,8 @@ DWORD WINAPI imp_desktop_thread(LPVOID lpParam) vncServer *server = (vncServer *)lpParam; HDESK desktop; - //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop \n")); - //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL\n")); + //vnclog.Print(LL_INTERR, VNCLOG("SelectDesktop ")); + //vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop2 NULL")); desktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | @@ -376,9 +377,9 @@ DWORD WINAPI imp_desktop_thread(LPVOID lpParam) ); if (desktop == NULL) - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error \n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop Error ")); else - vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK\n")); + vnclog.Print(LL_INTERR, VNCLOG("OpenInputdesktop OK")); HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId()); DWORD dummy; @@ -387,18 +388,18 @@ DWORD WINAPI imp_desktop_thread(LPVOID lpParam) if (!GetUserObjectInformation(desktop, UOI_NAME, &new_name, 256, &dummy)) { - vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation \n")); + vnclog.Print(LL_INTERR, VNCLOG("!GetUserObjectInformation ")); } - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x\n"), new_name, desktop, old_desktop); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK to %s (%x) from %x"), new_name, desktop, old_desktop); if (!SetThreadDesktop(desktop)) { - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop \n")); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK:!SetThreadDesktop ")); } if (!CloseDesktop(old_desktop)) - vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)\n"), old_desktop, GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("SelectHDESK failed to close old desktop %x (Err=%d)"), old_desktop, GetLastError()); // ImpersonateCurrentUser_(); @@ -421,19 +422,19 @@ DWORD WINAPI imp_desktop_thread(LPVOID lpParam) } else { - vnclog.Print(LL_INTERR, VNCLOG("getusername error %d\n"), GetLastError()); + vnclog.Print(LL_INTERR, VNCLOG("getusername error %d"), GetLastError()); return FALSE; } } } } - vnclog.Print(LL_INTERR, VNCLOG("Username %s \n"),m_username); + vnclog.Print(LL_INTERR, VNCLOG("Username %s "),m_username); // Create tray icon and menu vncMenu *menu = new vncMenu(server); if (menu == NULL) { - vnclog.Print(LL_INTERR, VNCLOG("failed to create tray menu\n")); + vnclog.Print(LL_INTERR, VNCLOG("failed to create tray menu")); PostQuitMessage(0); } @@ -458,7 +459,7 @@ DWORD WINAPI imp_desktop_thread(LPVOID lpParam) if (menu != NULL) delete menu; - //vnclog.Print(LL_INTERR, VNCLOG("GetMessage stop \n")); + //vnclog.Print(LL_INTERR, VNCLOG("GetMessage stop ")); CloseDesktop(desktop); // RevertToSelf(); return 0; @@ -472,13 +473,13 @@ void CALLBACK fpTimer(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) { if (hShutdownEvent) { - // vnclog.Print(LL_INTERR, VNCLOG("****************** SDTimer tic\n")); + // vnclog.Print(LL_INTERR, VNCLOG("****************** SDTimer tic")); DWORD result=WaitForSingleObject(hShutdownEvent, 0); if (WAIT_OBJECT_0==result) { ResetEvent(hShutdownEvent); fShutdownOrdered = true; - vnclog.Print(LL_INTERR, VNCLOG("****************** WaitForSingleObject - Shutdown server\n")); + vnclog.Print(LL_INTERR, VNCLOG("****************** WaitForSingleObject - Shutdown server")); } } } @@ -486,14 +487,14 @@ void CALLBACK fpTimer(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2) void InitSDTimer() { if (mmRes != -1) return; - vnclog.Print(LL_INTERR, VNCLOG("****************** Init SDTimer\n")); + vnclog.Print(LL_INTERR, VNCLOG("****************** Init SDTimer")); mmRes = timeSetEvent( 2000, 0, (LPTIMECALLBACK)fpTimer, NULL, TIME_PERIODIC ); } void KillSDTimer() { - vnclog.Print(LL_INTERR, VNCLOG("****************** Kill SDTimer\n")); + vnclog.Print(LL_INTERR, VNCLOG("****************** Kill SDTimer")); timeKillEvent(mmRes); mmRes = -1; } @@ -507,7 +508,7 @@ void KillSDTimer() int WinVNCAppMain() { SetOSVersion(); - vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - WinVNCAPPMain\n")); + vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - WinVNCAPPMain")); #ifdef CRASH_ENABLED LPVOID lpvState = Install(NULL, "rudi.de.vos@skynet.be", "UltraVnc"); #endif @@ -523,7 +524,7 @@ int WinVNCAppMain() return 0; } - //vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Previous instance checked - Trying to create server\n")); + //vnclog.Print(LL_INTINFO, VNCLOG("***** DBG - Previous instance checked - Trying to create server")); // CREATE SERVER vncServer server; @@ -532,7 +533,7 @@ int WinVNCAppMain() server.SetPort(CACIC_Auth::getInstance()->getPorta()); server.SetAutoIdleDisconnectTimeout(CACIC_Auth::getInstance()->getTimeout()); server.SockConnect(TRUE); - vnclog.Print(LL_STATE, VNCLOG("Servidor inicializado com sucesso!\n")); + vnclog.Print(LL_STATE, VNCLOG("Servidor inicializado com sucesso!")); //uninstall driver before cont // sf@2007 - Set Application0 special mode @@ -542,14 +543,14 @@ int WinVNCAppMain() // Subscribe to shutdown event hShutdownEvent = OpenEvent(EVENT_ALL_ACCESS, FALSE, "Global\\SessionEventUltra"); if (hShutdownEvent) ResetEvent(hShutdownEvent); - vnclog.Print(LL_STATE, VNCLOG("SDEvent criado.\n")); + vnclog.Print(LL_STATE, VNCLOG("SDEvent criado.")); // Create the timer that looks periodicaly for shutdown event mmRes = -1; InitSDTimer(); while (!fShutdownOrdered) { - //vnclog.Print(LL_STATE, VNCLOG("################## Creating Imp Thread : %d \n"), nn); + //vnclog.Print(LL_STATE, VNCLOG("################## Creating Imp Thread : %d "), nn); HANDLE threadHandle; DWORD dwTId; @@ -557,14 +558,14 @@ int WinVNCAppMain() WaitForSingleObject( threadHandle, INFINITE ); CloseHandle(threadHandle); - vnclog.Print(LL_STATE, VNCLOG("Fechando a imp thread...\n")); + vnclog.Print(LL_STATE, VNCLOG("Fechando a imp thread...")); } if (instancehan!=NULL) delete instancehan; if (hShutdownEvent)CloseHandle(hShutdownEvent); - vnclog.Print(LL_STATE, VNCLOG("Finalizando o servidor...\n")); + vnclog.Print(LL_STATE, VNCLOG("Finalizando o servidor...")); return 1; }; diff --git a/srcacic/WinVNC/WinVNC/winvnc.rc b/srcacic/WinVNC/WinVNC/winvnc.rc index 6eb8b5c..fda5f14 100644 --- a/srcacic/WinVNC/WinVNC/winvnc.rc +++ b/srcacic/WinVNC/WinVNC/winvnc.rc @@ -118,7 +118,7 @@ BEGIN CTEXT "ESTAÇÃO DE TRABALHO EM SUPORTE REMOTO",IDC_AVISO_SUPORTE,54,12,205,11 CTEXT "ATENÇÃO",IDC_ATENCAO_STATIC,54,2,205,10 LTEXT "Nome:",IDC_NOME_LBL,54,22,24,8 - LTEXT "IP:",IDC_IP_LBL,54,32,10,8 + LTEXT "IP:",IDC_IP_LBL,54,32,10,8 //IDC_IP_LBL LTEXT "Início:",IDC_INICIO_LBL,54,42,20,8 LTEXT "",IDC_INFO_NOME,78,23,181,8,0,WS_EX_TRANSPARENT LTEXT "",IDC_INFO_IP,78,32,181,8,0,WS_EX_TRANSPARENT @@ -223,7 +223,7 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,5,9,0 + FILEVERSION 2,6,0,0 PRODUCTVERSION 2,6,0,0 FILEFLAGSMASK 0x37L #ifdef _DEBUG @@ -242,7 +242,7 @@ BEGIN VALUE "Comments", "Licença: GNU/LGPL" VALUE "CompanyName", "Dataprev-Emp. de TI da Prev Social - UDSL/SSLC" VALUE "FileDescription", "Sistema CACIC - Módulo Suporte Remoto Seguro" - VALUE "FileVersion", "2.5.9.0" + VALUE "FileVersion", "2.6.0.0" VALUE "InternalName", "srCACICsrv" VALUE "LegalCopyright", "Copyright © 2008 DATAPREV" VALUE "ProductName", "srCACIC" -- libgit2 0.21.2