Commit 6f95d8e831bd999fb0520f857776f2e335f8a490

Authored by anderson.peterle@previdencia.gov.br
1 parent 9432bc1d
Exists in master

Acrescentadas informacoes sobre usuario remoto na estacao servidora, via faixa d…

…iscreta no canto superior direito da tela.

git-svn-id: http://svn.softwarepublico.gov.br/svn/cacic/cacic/trunk/agente-windows@803 fecfc0c7-e812-0410-ae72-849f08638ee7
srcacic/WinVNC/WinVNC/CACIC_Auth.cpp
... ... @@ -26,14 +26,12 @@ bool CACIC_Auth::autentica()
26 26 if (!verificaAuthChave(resposta, listaDominios)) return false;
27 27  
28 28 vncPassDlg::EAuthCode authStat;
29   - if (listaDominios.at(0).id == "0")
30   - {
  29 + if (listaDominios.at(0).id == "0") {
31 30 authStat = vncPassDlg::SEM_AUTENTICACAO;
32   - }
33   - else
34   - {
  31 + } else {
35 32 authStat = vncPassDlg::ESPERANDO_AUTENTICACAO;
36 33 }
  34 +
37 35 // apresenta o dialogo de autenticação
38 36 vncPassDlg passDlg(listaDominios);
39 37 do
... ... @@ -61,7 +59,6 @@ bool CACIC_Auth::autentica()
61 59 string session_script = m_scriptsPath.c_str();
62 60 session_script.append(SET_SESSION_SCRIPT);
63 61  
64   - memset(resposta, 0, sizeof(resposta));
65 62 CACIC_Con::sendHtppPost(m_servidorWeb, session_script, post, resposta, TAMANHO_RESPOSTA);
66 63  
67 64 if(verificaAuthDominio(resposta)) {
... ... @@ -69,7 +66,6 @@ bool CACIC_Auth::autentica()
69 66 } else {
70 67 authStat = vncPassDlg::FALHA_AUTENTICACAO;
71 68 }
72   -
73 69 }
74 70 while (authStat != vncPassDlg::AUTENTICADO);
75 71  
... ... @@ -270,8 +266,8 @@ bool CACIC_Auth::verificaAuthTecnico(char resposta[], char te_node_address_cli[]
270 266  
271 267 m_novoCliente = novoCliente;
272 268  
273   - m_infoDlg.nomeVisitante = novoCliente.nm_usuario_completo;
274   - m_infoDlg.dataInicio = novoCliente.dt_hr_inicio_sessao;
  269 + m_infoDlg.m_nomeVisitante = m_novoCliente.nm_usuario_completo;
  270 + m_infoDlg.m_dataInicio = m_novoCliente.dt_hr_inicio_sessao;
275 271  
276 272 return true;
277 273 }
... ...
srcacic/WinVNC/WinVNC/CACIC_Con.cpp
... ... @@ -73,6 +73,8 @@ bool CACIC_Con::getResponse(char buff[], unsigned long sz)
73 73 void CACIC_Con::sendHtppPost(const string &servidor, const string &script, string &post,
74 74 char resposta[], unsigned long sz)
75 75 {
  76 + memset(resposta, 0, sz);
  77 +
76 78 CACIC_Con cCon;
77 79 cCon.setServer(servidor.c_str());
78 80 try
... ...
srcacic/WinVNC/WinVNC/CACIC_Utils.cpp
... ... @@ -137,3 +137,25 @@ void CACIC_Utils::trim(string &str)
137 137 }
138 138 else str.erase(str.begin(), str.end());
139 139 }
  140 +
  141 +
  142 +void CACIC_Utils::changeFont(HWND dlgHandle, int dlgItem, int fontSize, string fontName, bool fontIsBold)
  143 +{
  144 + HFONT hFont ;
  145 + LOGFONT lfFont;
  146 +
  147 + memset(&lfFont, 0x00, sizeof(lfFont));
  148 + memcpy(lfFont.lfFaceName, fontName.data(), 16);
  149 +
  150 + lfFont.lfHeight = fontSize;
  151 + lfFont.lfWeight = (fontIsBold == true) ? FW_BOLD : FW_NORMAL;
  152 + lfFont.lfCharSet = ANSI_CHARSET;
  153 + lfFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
  154 + lfFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
  155 + lfFont.lfQuality = DEFAULT_QUALITY;
  156 +
  157 + // Create the font from the LOGFONT structure passed.
  158 + hFont = CreateFontIndirect (&lfFont);
  159 +
  160 + SendMessage(GetDlgItem(dlgHandle, dlgItem), WM_SETFONT, (int)hFont, MAKELONG(TRUE, 0));
  161 +}
... ...
srcacic/WinVNC/WinVNC/CACIC_Utils.h
... ... @@ -25,6 +25,10 @@ public:
25 25 static char hexToAscii(char first, char second);
26 26 static void trim(string &str);
27 27  
  28 + static void changeFont(HWND dlgHandle, int dlgItem,
  29 + int fontSize, string fontName,
  30 + bool fontIsBold = false);
  31 +
28 32 private:
29 33  
30 34 virtual void cutils() = 0; // Truque para tornar a classe abstrata.
... ...
srcacic/WinVNC/WinVNC/resource.h
... ... @@ -144,6 +144,10 @@
144 144 #define IDC_ATENCAO_STATIC 1147
145 145 #define IDC_ATENCAO 1147
146 146 #define IDC_SRCACIC_IMG 1148
  147 +#define IDC_EDIT3 1150
  148 +#define IDC_INFO_NOME 1152
  149 +#define IDC_INFO_IP 1153
  150 +#define IDC_INFO_INICIO 1154
147 151 #define IDC_FINGER 9000
148 152 #define IDC_GAMMAGRAY 9001
149 153 #define IDC_STATIC_SPLIT 9002
... ... @@ -225,7 +229,7 @@
225 229 #ifndef APSTUDIO_READONLY_SYMBOLS
226 230 #define _APS_NEXT_RESOURCE_VALUE 164
227 231 #define _APS_NEXT_COMMAND_VALUE 40019
228   -#define _APS_NEXT_CONTROL_VALUE 1149
  232 +#define _APS_NEXT_CONTROL_VALUE 1155
229 233 #define _APS_NEXT_SYMED_VALUE 101
230 234 #endif
231 235 #endif
... ...
srcacic/WinVNC/WinVNC/supInfoDlg.cpp
... ... @@ -12,15 +12,15 @@ supInfoDlg::~supInfoDlg()
12 12 HWND supInfoDlg::showInfoDialog()
13 13 {
14 14 DWORD threadID;
15   - infoDlgThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) supInfoDlg::showDialog, (LPVOID) this, 0, &threadID);
16   - ResumeThread(infoDlgThread);
  15 + m_hInfoDlgThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) supInfoDlg::showDialog, (LPVOID) this, 0, &threadID);
  16 + ResumeThread(m_hInfoDlgThread);
17 17  
18 18 return (HWND) 0;
19 19 }
20 20  
21 21 HWND supInfoDlg::closeInfoDialog()
22 22 {
23   - TerminateThread(infoDlgThread, 0);
  23 + TerminateThread(m_hInfoDlgThread, 0);
24 24  
25 25 return (HWND) 0;
26 26 }
... ... @@ -86,13 +86,9 @@ BOOL CALLBACK supInfoDlg::supInfoDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
86 86 dlgRect.bottom - dlgRect.top,
87 87 SWP_SHOWWINDOW);
88 88  
89   - string text = TEXTO_SUPORTE;
90   - text.append("\n\nInício: ");
91   - text.append(_this->dataInicio);
92   - text.append("\nUsuário Remoto: ");
93   - text.append(_this->nomeVisitante);
94   - SetDlgItemText(hwnd, IDC_ATENCAO_STATIC, (LPSTR) "ATENÇÃO");
95   - SetDlgItemText(hwnd, IDC_AVISO_SUPORTE, (LPSTR) text.data());
  89 + SetDlgItemText(hwnd, IDC_INFO_NOME, (LPSTR) _this->m_nomeVisitante.data());
  90 + SetDlgItemText(hwnd, IDC_INFO_IP, (LPSTR) _this->m_ip.data());
  91 + SetDlgItemText(hwnd, IDC_INFO_INICIO, (LPSTR) _this->m_dataInicio.data());
96 92  
97 93 changeFont(hwnd, IDC_ATENCAO_STATIC);
98 94  
... ... @@ -122,12 +118,16 @@ BOOL CALLBACK supInfoDlg::supInfoDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
122 118 }
123 119 break;
124 120  
  121 + // muda a cor de fundo dos itens do dialog
125 122 case WM_CTLCOLORSTATIC:
126 123 {
127 124 HDC hdc = (HDC)wParam;
128 125 HWND hwndStatic = (HWND)lParam;
129 126  
130   - if (hwndStatic == GetDlgItem(hwnd, IDC_AVISO_SUPORTE))
  127 + SetBkMode(hdc, TRANSPARENT);
  128 + return (LRESULT)vrsBkColor;
  129 +
  130 + /*if (hwndStatic == GetDlgItem(hwnd, IDC_AVISO_SUPORTE))
131 131 {
132 132 SetBkMode(hdc, TRANSPARENT);
133 133 return (LRESULT)vrsBkColor;
... ... @@ -136,10 +136,15 @@ BOOL CALLBACK supInfoDlg::supInfoDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
136 136 {
137 137 SetBkMode(hdc, TRANSPARENT);
138 138 return (LRESULT)vrsBkColor;
139   - }
  139 + }*/
140 140 }
141 141 break;
142 142  
  143 + // muda a cor de fundo do dialog
  144 + case WM_CTLCOLORDLG:
  145 + return (LONG)vrsBkColor;
  146 + break;
  147 +
143 148 }
144 149  
145 150 return FALSE;
... ...
srcacic/WinVNC/WinVNC/supInfoDlg.h
... ... @@ -12,8 +12,6 @@ using namespace std;
12 12  
13 13 #pragma once
14 14  
15   -#define TEXTO_SUPORTE "ESTA ESTAÇÃO ENCONTRA-SE EM SUPORTE REMOTO."
16   -
17 15 class supInfoDlg {
18 16  
19 17 public:
... ... @@ -23,11 +21,12 @@ public:
23 21 HWND showInfoDialog();
24 22 HWND closeInfoDialog();
25 23  
26   - string nomeVisitante;
27   - string dataInicio;
  24 + string m_nomeVisitante;
  25 + string m_ip;
  26 + string m_dataInicio;
28 27  
29 28 private:
30   - HANDLE infoDlgThread;
  29 + HANDLE m_hInfoDlgThread;
31 30  
32 31 static LRESULT CALLBACK supInfoDlg::showDialog(LPVOID lpParameter);
33 32 static BOOL CALLBACK supInfoDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
... ...
srcacic/WinVNC/WinVNC/vncPassDlg.cpp
... ... @@ -8,19 +8,21 @@ vncPassDlg::vncPassDlg(vector<Dominio> &listaDominios) {
8 8 m_listaDominios = listaDominios;
9 9 m_authStat = vncPassDlg::ESPERANDO_AUTENTICACAO;
10 10  
11   - memset(m_usuario, '\0', 32);
12   - memset(m_senha, '\0', 32);
13   - memset(m_dominio, '\0', 16);
  11 + memset(m_usuario, 0, 32);
  12 + memset(m_senha, 0, 32);
  13 + memset(m_dominio, 0, 16);
14 14 }
15 15  
16   -vncPassDlg::~vncPassDlg()
17   -{
  16 +vncPassDlg::~vncPassDlg() {
  17 + memset(m_usuario, 0, 32);
  18 + memset(m_senha, 0, 32);
  19 + memset(m_dominio, 0, 16);
18 20 }
19 21  
20   -BOOL vncPassDlg::DoDialog(EAuthCode authStat, string msginfo)
  22 +BOOL vncPassDlg::DoDialog(EAuthCode authStat, string msgInfo)
21 23 {
22 24 m_authStat = authStat;
23   - m_msgInfo = msginfo;
  25 + m_msgInfo = msgInfo;
24 26  
25 27 BOOL retVal;
26 28 if (m_authStat == vncPassDlg::SEM_AUTENTICACAO)
... ... @@ -34,7 +36,7 @@ BOOL vncPassDlg::DoDialog(EAuthCode authStat, string msginfo)
34 36 {
35 37 retVal = DialogBoxParam(hInstResDLL, MAKEINTRESOURCE(IDD_AUTH_DLG),
36 38 NULL, (DLGPROC) vncAuthDlgProc, (LONG) this);
37   - }
  39 + }
38 40  
39 41 return retVal;
40 42 }
... ... @@ -90,12 +92,6 @@ BOOL CALLBACK vncPassDlg::vncAuthDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
90 92 if (found != string::npos)
91 93 SendMessage(hDominios, CB_SELECTSTRING, 0, (LPARAM) nm_dominio.c_str());
92 94 }
93   -
94   - //HWND num_con_cb = GetDlgItem(hwnd, IDC_NUMCON_CB);
95   - //SendMessage(num_con_cb, CB_ADDSTRING, 0, (LPARAM)"1");
96   - //SendMessage(num_con_cb, CB_ADDSTRING, 0, (LPARAM)"2");
97   - //SendMessage(num_con_cb, CB_ADDSTRING, 0, (LPARAM)"3");
98   - //SendMessage(num_con_cb, CB_SETCURSEL, 0, 0);
99 95  
100 96 if (_this->m_authStat == vncPassDlg::FALHA_AUTENTICACAO)
101 97 {
... ... @@ -104,6 +100,7 @@ BOOL CALLBACK vncPassDlg::vncAuthDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
104 100 SendMessage(hDominios, CB_SELECTSTRING, 0, (LPARAM) _this->m_listaDominios.at(_this->m_indiceDominio).nome.c_str());
105 101 SetDlgItemText(hwnd, IDC_USER_EDIT, _this->m_usuario);
106 102 SetDlgItemText(hwnd, IDC_PASS_EDIT, _this->m_senha);
  103 +
107 104 SetDlgItemText(hwnd, IDC_MSG, (LPSTR) "Falha na autenticação!");
108 105 }
109 106 else if (_this->m_authStat == vncPassDlg::AUTENTICADO)
... ... @@ -121,11 +118,6 @@ BOOL CALLBACK vncPassDlg::vncAuthDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
121 118 HWND hSenha = GetDlgItem(hwnd, IDC_PASS_EDIT);
122 119 EnableWindow( hSenha, FALSE );
123 120  
124   - //HWND h_num_con_lbl = GetDlgItem(hwnd, IDC_STATIC_N_CON);
125   - //ShowWindow( h_num_con_lbl, TRUE );
126   - //HWND h_num_con = GetDlgItem(hwnd, IDC_NUMCON_CB);
127   - //ShowWindow( h_num_con, TRUE );
128   -
129 121 SetDlgItemText( hwnd, IDC_MSG, (LPSTR)_this->m_msgInfo.c_str() );
130 122 }
131 123  
... ... @@ -141,11 +133,6 @@ BOOL CALLBACK vncPassDlg::vncAuthDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
141 133 {
142 134 if (_this->m_authStat == vncPassDlg::AUTENTICADO)
143 135 {
144   - /*HWND numcon_cb = GetDlgItem(hwnd, IDC_NUMCON_CB);
145   - int numcon = SendMessage(numcon_cb, CB_GETCURSEL, 0, 0);
146   - numcon++;
147   - MAX_VNC_CLIENTS = numcon;*/
148   -
149 136 EndDialog(hwnd, IDOK);
150 137 }
151 138  
... ... @@ -155,28 +142,18 @@ BOOL CALLBACK vncPassDlg::vncAuthDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
155 142 HWND hDominios = GetDlgItem(hwnd, IDC_DOMAIN_CB);
156 143 _this->m_indiceDominio = SendMessage(hDominios, CB_GETCURSEL, 0, 0);
157 144  
158   - memset(_this->m_usuario, '\0', 32);
159   - memset(_this->m_senha, '\0', 32);
160   - memset(_this->m_dominio, '\0', 16);
  145 + memset(_this->m_usuario, 0, 32);
  146 + memset(_this->m_senha, 0, 32);
  147 + memset(_this->m_dominio, 0, 16);
161 148  
162 149 GetDlgItemText(hwnd, IDC_USER_EDIT, _this->m_usuario, 32);
  150 + GetDlgItemText(hwnd, IDC_PASS_EDIT, _this->m_senha, 32);
  151 + strcpy(_this->m_dominio, _this->m_listaDominios.at(_this->m_indiceDominio).id.c_str());
163 152  
164   - if (_this->m_authStat == vncPassDlg::SEM_AUTENTICACAO)
165   - {
166   - strcpy(_this->m_senha, "0");
167   - strcpy(_this->m_dominio, "0");
168   - }
169   - else
  153 + if (_this->m_usuario[0] == '\0' || _this->m_senha[0] == '\0' || _this->m_dominio[0] == '\0')
170 154 {
171   - GetDlgItemText(hwnd, IDC_PASS_EDIT, _this->m_senha, 32);
172   -
173   - strcpy(_this->m_dominio, _this->m_listaDominios.at(_this->m_indiceDominio).id.c_str());
174   -
175   - if (_this->m_usuario[0] == '\0' || _this->m_senha[0] == '\0' || _this->m_dominio[0] == '\0')
176   - {
177   - MessageBox(hwnd, "Os campos devem ser preenchidos!", "Erro!", MB_ICONERROR | MB_OK);
178   - return FALSE;
179   - }
  155 + MessageBox(hwnd, "Os campos devem ser preenchidos!", "Erro!", MB_ICONERROR | MB_OK);
  156 + return FALSE;
180 157 }
181 158  
182 159 EndDialog(hwnd, IDOK);
... ...
srcacic/WinVNC/WinVNC/vncPassDlg.h
... ... @@ -44,7 +44,7 @@ public:
44 44  
45 45 EAuthCode m_authStat;
46 46  
47   - BOOL vncPassDlg::DoDialog(EAuthCode authStat, string msginfo);
  47 + BOOL DoDialog(EAuthCode authStat, string msgInfo);
48 48  
49 49 private:
50 50 static BOOL CALLBACK vncAuthDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
... ...
srcacic/WinVNC/WinVNC/winvnc.rc
... ... @@ -110,14 +110,20 @@ BEGIN
110 110 EDITTEXT IDC_DOC_REF,68,41,163,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
111 111 END
112 112  
113   -IDD_INFO_DLG DIALOGEX 0, 0, 269, 46
  113 +IDD_INFO_DLG DIALOGEX 0, 0, 261, 51
114 114 STYLE DS_SYSMODAL | DS_SETFONT | DS_FIXEDSYS | WS_POPUP
115 115 EXSTYLE WS_EX_PALETTEWINDOW | WS_EX_DLGMODALFRAME | WS_EX_NOPARENTNOTIFY | WS_EX_ACCEPTFILES | WS_EX_TRANSPARENT | WS_EX_MDICHILD
116 116 FONT 8, "MS Shell Dlg", 400, 0, 0x0
117 117 BEGIN
118   - CTEXT "",IDC_AVISO_SUPORTE,51,11,218,35
119   - CTEXT "",IDC_ATENCAO_STATIC,52,0,217,11
120   - CONTROL 163,IDC_SRCACIC_IMG,"Static",SS_BITMAP,0,0,51,47
  118 + CTEXT "ESTAÇÃO DE TRABALHO EM SUPORTE REMOTO",IDC_AVISO_SUPORTE,54,12,205,11
  119 + CTEXT "ATENÇÃO",IDC_ATENCAO_STATIC,54,2,205,10
  120 + CONTROL 163,IDC_SRCACIC_IMG,"Static",SS_BITMAP,0,2,51,47
  121 + LTEXT "Nome:",IDC_STATIC,54,22,24,8
  122 + LTEXT "IP:",IDC_STATIC,54,32,10,8
  123 + LTEXT "Início:",IDC_STATIC,54,41,20,8
  124 + LTEXT "",IDC_INFO_NOME,78,23,181,8,0,WS_EX_TRANSPARENT
  125 + LTEXT "",IDC_INFO_IP,78,32,181,8,0,WS_EX_TRANSPARENT
  126 + LTEXT "",IDC_INFO_INICIO,78,41,181,8,0,WS_EX_TRANSPARENT
121 127 END
122 128  
123 129  
... ... @@ -195,7 +201,13 @@ BEGIN
195 201  
196 202 IDD_INFO_DLG, DIALOG
197 203 BEGIN
198   - HORZGUIDE, 11
  204 + VERTGUIDE, 54
  205 + VERTGUIDE, 78
  206 + VERTGUIDE, 259
  207 + BOTTOMMARGIN, 49
  208 + HORZGUIDE, 2
  209 + HORZGUIDE, 10
  210 + HORZGUIDE, 49
199 211 END
200 212 END
201 213 #endif // APSTUDIO_INVOKED
... ...