summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--PumpKINDlg.cpp20
-rw-r--r--pumpkin.rc2
2 files changed, 15 insertions, 7 deletions
diff --git a/PumpKINDlg.cpp b/PumpKINDlg.cpp
index fc24596..b6b8a36 100644
--- a/PumpKINDlg.cpp
+++ b/PumpKINDlg.cpp
@@ -176,1619 +176,1627 @@ BOOL CPumpKINDlg::OnInitDialog()
176 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu); 176 pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
177 } 177 }
178 178
179 // Set the icon for this dialog. The framework does this automatically 179 // Set the icon for this dialog. The framework does this automatically
180 // when the application's main window is not a dialog 180 // when the application's main window is not a dialog
181 SetIcon(m_hIcon, TRUE); // Set big icon 181 SetIcon(m_hIcon, TRUE); // Set big icon
182 SetIcon(m_hIcon, FALSE); // Set small icon 182 SetIcon(m_hIcon, FALSE); // Set small icon
183 183
184 VERIFY(m_Retrier->Create(NULL,"PumpKIN-Retrier",WS_CHILD,CRect(0,0,0,0),this,0)); 184 VERIFY(m_Retrier->Create(NULL,"PumpKIN-Retrier",WS_CHILD,CRect(0,0,0,0),this,0));
185 185
186 186
187 m_Images.Create(16,16,TRUE,2,1); 187 m_Images.Create(16,16,TRUE,2,1);
188 m_iRRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_RRQ)); 188 m_iRRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_RRQ));
189 m_iWRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_WRQ)); 189 m_iWRQ = m_Images.Add(AfxGetApp()->LoadIcon(IDI_WRQ));
190 ASSERT(m_iRRQ>=0); 190 ASSERT(m_iRRQ>=0);
191 ASSERT(m_iWRQ>=0); 191 ASSERT(m_iWRQ>=0);
192 m_List.SetImageList(&m_Images,LVSIL_NORMAL); 192 m_List.SetImageList(&m_Images,LVSIL_NORMAL);
193 m_List.SetImageList(&m_Images,LVSIL_SMALL); 193 m_List.SetImageList(&m_Images,LVSIL_SMALL);
194 m_List.SetImageList(&m_Images,LVSIL_STATE); 194 m_List.SetImageList(&m_Images,LVSIL_STATE);
195 m_List.SetTextColor(RGB(255,255,0));// Yellow 195 m_List.SetTextColor(RGB(255,255,0));// Yellow
196 m_List.SetTextBkColor(RGB(12,167,0));// Green 196 m_List.SetTextBkColor(RGB(12,167,0));// Green
197 m_List.SetBkColor(RGB(12,167,0));// Green 197 m_List.SetBkColor(RGB(12,167,0));// Green
198CRect listrc; 198CRect listrc;
199 m_List.GetClientRect(&listrc); 199 m_List.GetClientRect(&listrc);
200 m_List.InsertColumn(0,"File",LVCFMT_LEFT,listrc.Width()-((listrc.Width()/7)*3+listrc.Width()*2/7),subitemFile); 200 m_List.InsertColumn(0,"File",LVCFMT_LEFT,listrc.Width()-((listrc.Width()/7)*3+listrc.Width()*2/7),subitemFile);
201 m_List.InsertColumn(1,"type",LVCFMT_CENTER,listrc.Width()/7,subitemType); 201 m_List.InsertColumn(1,"type",LVCFMT_CENTER,listrc.Width()/7,subitemType);
202 m_List.InsertColumn(2,"peer",LVCFMT_LEFT,listrc.Width()*2/7,subitemPeer); 202 m_List.InsertColumn(2,"peer",LVCFMT_LEFT,listrc.Width()*2/7,subitemPeer);
203 m_List.InsertColumn(3,"ACK",LVCFMT_RIGHT,listrc.Width()/7,subitemBytes); 203 m_List.InsertColumn(3,"ACK",LVCFMT_RIGHT,listrc.Width()/7,subitemBytes);
204 m_List.InsertColumn(4,"tsize",LVCFMT_RIGHT,listrc.Width()/7,subitemTSize); 204 m_List.InsertColumn(4,"tsize",LVCFMT_RIGHT,listrc.Width()/7,subitemTSize);
205 205
206 LogLine(IDS_LOG_START); 206 LogLine(IDS_LOG_START);
207 207
208 SetupButtons(); 208 SetupButtons();
209 209
210CRect rc, drc; 210CRect rc, drc;
211 GetWindowRect(rc); 211 GetWindowRect(rc);
212 GetDesktopWindow()->GetWindowRect(drc); 212 GetDesktopWindow()->GetWindowRect(drc);
213 SetWindowPos(NULL,drc.right-6-rc.Width(),6,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER); 213 SetWindowPos(NULL,drc.right-6-rc.Width(),6,0,0,SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
214 214
215 if(m_bShown) 215 if(m_bShown)
216 ShowWindow(SW_SHOW); 216 ShowWindow(SW_SHOW);
217 else 217 else
218 ShowWindow(SW_HIDE); 218 ShowWindow(SW_HIDE);
219 219
220 // CG: The following block was added by the ToolTips component. 220 // CG: The following block was added by the ToolTips component.
221 { 221 {
222 // Create the ToolTip control. 222 // Create the ToolTip control.
223 m_tooltip.Create(this); 223 m_tooltip.Create(this);
224 m_tooltip.Activate(TRUE); 224 m_tooltip.Activate(TRUE);
225 225
226 m_tooltip.AddTool(&m_List,IDC_CONNECTIONS); 226 m_tooltip.AddTool(&m_List,IDC_CONNECTIONS);
227 m_tooltip.AddTool(GetDlgItem(IDC_PUT),IDC_PUT); 227 m_tooltip.AddTool(GetDlgItem(IDC_PUT),IDC_PUT);
228 m_tooltip.AddTool(GetDlgItem(IDC_GET),IDC_GET); 228 m_tooltip.AddTool(GetDlgItem(IDC_GET),IDC_GET);
229 m_tooltip.AddTool(&m_AbortCtl,IDC_ABORT); 229 m_tooltip.AddTool(&m_AbortCtl,IDC_ABORT);
230 m_tooltip.AddTool(GetDlgItem(IDC_OPTIONS),IDC_OPTIONS); 230 m_tooltip.AddTool(GetDlgItem(IDC_OPTIONS),IDC_OPTIONS);
231 m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT); 231 m_tooltip.AddTool(GetDlgItem(IDC_EXIT),IDC_EXIT);
232 m_tooltip.AddTool(GetDlgItem(ID_HELP),ID_HELP); 232 m_tooltip.AddTool(GetDlgItem(ID_HELP),ID_HELP);
233 m_tooltip.AddTool(GetDlgItem(IDC_LOG),IDC_LOG); 233 m_tooltip.AddTool(GetDlgItem(IDC_LOG),IDC_LOG);
234 } 234 }
235 return TRUE; // return TRUE unless you set the focus to a control 235 return TRUE; // return TRUE unless you set the focus to a control
236} 236}
237 237
238void CPumpKINDlg::OnSysCommand(UINT nID, LPARAM lParam) 238void CPumpKINDlg::OnSysCommand(UINT nID, LPARAM lParam)
239{ 239{
240 if ((nID & 0xFFF0) == IDM_ABOUTBOX) 240 if ((nID & 0xFFF0) == IDM_ABOUTBOX)
241 { 241 {
242 CAboutDlg dlgAbout; 242 CAboutDlg dlgAbout;
243 dlgAbout.DoModal(); 243 dlgAbout.DoModal();
244 } 244 }
245 else 245 else
246 { 246 {
247 CDialog::OnSysCommand(nID, lParam); 247 CDialog::OnSysCommand(nID, lParam);
248 } 248 }
249} 249}
250 250
251void CPumpKINDlg::OnDestroy() 251void CPumpKINDlg::OnDestroy()
252{ 252{
253 SaveSettings(); 253 SaveSettings();
254 254
255NOTIFYICONDATA nid; 255NOTIFYICONDATA nid;
256 memset(&nid,0,sizeof(nid)); 256 memset(&nid,0,sizeof(nid));
257 nid.cbSize=sizeof(nid); 257 nid.cbSize=sizeof(nid);
258 nid.hWnd=m_Trayer->m_hWnd; 258 nid.hWnd=m_Trayer->m_hWnd;
259 nid.uID=IDC_TRAYICON; 259 nid.uID=IDC_TRAYICON;
260 nid.uFlags=0; 260 nid.uFlags=0;
261 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid)); 261 VERIFY(Shell_NotifyIcon(NIM_DELETE,&nid));
262 262
263 WinHelp(0L, HELP_QUIT); 263 WinHelp(0L, HELP_QUIT);
264 CDialog::OnDestroy(); 264 CDialog::OnDestroy();
265POSITION p = m_LogTimes.GetStartPosition(); 265POSITION p = m_LogTimes.GetStartPosition();
266 while(p){ 266 while(p){
267 CTime *t,*tt; 267 CTime *t,*tt;
268 m_LogTimes.GetNextAssoc(p,t,tt); 268 m_LogTimes.GetNextAssoc(p,t,tt);
269 ASSERT(t && tt && t==tt); 269 ASSERT(t && tt && t==tt);
270 delete t; 270 delete t;
271 } 271 }
272 // *** Abort and cleanup transfers 272 // *** Abort and cleanup transfers
273 m_LogTimes.RemoveAll(); 273 m_LogTimes.RemoveAll();
274} 274}
275 275
276// If you add a minimize button to your dialog, you will need the code below 276// If you add a minimize button to your dialog, you will need the code below
277// to draw the icon. For MFC applications using the document/view model, 277// to draw the icon. For MFC applications using the document/view model,
278// this is automatically done for you by the framework. 278// this is automatically done for you by the framework.
279 279
280void CPumpKINDlg::OnPaint() 280void CPumpKINDlg::OnPaint()
281{ 281{
282 if (IsIconic()) 282 if (IsIconic())
283 { 283 {
284 CPaintDC dc(this); // device context for painting 284 CPaintDC dc(this); // device context for painting
285 285
286 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); 286 SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
287 287
288 // Center icon in client rectangle 288 // Center icon in client rectangle
289 int cxIcon = GetSystemMetrics(SM_CXICON); 289 int cxIcon = GetSystemMetrics(SM_CXICON);
290 int cyIcon = GetSystemMetrics(SM_CYICON); 290 int cyIcon = GetSystemMetrics(SM_CYICON);
291 CRect rect; 291 CRect rect;
292 GetClientRect(&rect); 292 GetClientRect(&rect);
293 int x = (rect.Width() - cxIcon + 1) / 2; 293 int x = (rect.Width() - cxIcon + 1) / 2;
294 int y = (rect.Height() - cyIcon + 1) / 2; 294 int y = (rect.Height() - cyIcon + 1) / 2;
295 295
296 // Draw the icon 296 // Draw the icon
297 dc.DrawIcon(x, y, m_hIcon); 297 dc.DrawIcon(x, y, m_hIcon);
298 } 298 }
299 else 299 else
300 { 300 {
301 CPaintDC pDC(this); 301 CPaintDC pDC(this);
302 CDC bmpDC; 302 CDC bmpDC;
303 bmpDC.CreateCompatibleDC(&pDC); 303 bmpDC.CreateCompatibleDC(&pDC);
304 bmpDC.SelectObject(&m_bmpBack); 304 bmpDC.SelectObject(&m_bmpBack);
305 CRect rc; 305 CRect rc;
306 GetClientRect(&rc); 306 GetClientRect(&rc);
307 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth) 307 for(int x=-m_bitmapBack.bmWidth*2/4;x<rc.Width();x+=m_bitmapBack.bmWidth)
308 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight) 308 for(int y=-m_bitmapBack.bmHeight*2/4;y<rc.Height();y+=m_bitmapBack.bmHeight)
309 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY); 309 pDC.BitBlt(x,y,m_bitmapBack.bmWidth,m_bitmapBack.bmHeight,&bmpDC,0,0,SRCCOPY);
310 bmpDC.DeleteDC(); 310 bmpDC.DeleteDC();
311 CDialog::OnPaint(); 311 CDialog::OnPaint();
312 } 312 }
313} 313}
314 314
315// The system calls this to obtain the cursor to display while the user drags 315// The system calls this to obtain the cursor to display while the user drags
316// the minimized window. 316// the minimized window.
317HCURSOR CPumpKINDlg::OnQueryDragIcon() 317HCURSOR CPumpKINDlg::OnQueryDragIcon()
318{ 318{
319 return (HCURSOR) m_hIcon; 319 return (HCURSOR) m_hIcon;
320} 320}
321 321
322int CPumpKINDlg::OnCreate(LPCREATESTRUCT lpCreateStruct) 322int CPumpKINDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
323{ 323{
324 if (CDialog::OnCreate(lpCreateStruct) == -1) 324 if (CDialog::OnCreate(lpCreateStruct) == -1)
325 return -1; 325 return -1;
326 326
327 m_Listener.m_Daddy=this; 327 m_Listener.m_Daddy=this;
328 if(!m_Listener.Create(m_ListenPort,SOCK_DGRAM)){ 328 if(!m_Listener.Create(m_ListenPort,SOCK_DGRAM)){
329 TRACE0("Failed to create socket\n"); 329 TRACE0("Failed to create socket\n");
330 AfxMessageBox(IDS_BOX_CANTBIND,MB_OK|MB_ICONEXCLAMATION); 330 AfxMessageBox(IDS_BOX_CANTBIND,MB_OK|MB_ICONEXCLAMATION);
331 return -1; 331 return -1;
332 } 332 }
333 333
334 if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){ 334 if(!m_Trayer->Create(NULL,"PumpKIN TrayIcon",WS_CHILD,CRect(0,0,0,0),this,0)){
335 TRACE0("Failed to create trayer\n"); 335 TRACE0("Failed to create trayer\n");
336 return -1; 336 return -1;
337 } 337 }
338 338
339NOTIFYICONDATA nid; 339NOTIFYICONDATA nid;
340 memset(&nid,0,sizeof(nid)); 340 memset(&nid,0,sizeof(nid));
341 nid.cbSize=sizeof(nid); 341 nid.cbSize=sizeof(nid);
342 nid.hWnd=m_Trayer->m_hWnd; 342 nid.hWnd=m_Trayer->m_hWnd;
343 nid.uID=IDC_TRAYICON; 343 nid.uID=IDC_TRAYICON;
344 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP; 344 nid.uFlags=NIF_MESSAGE|NIF_ICON|NIF_TIP;
345 nid.uCallbackMessage=WM_TRAYICON; 345 nid.uCallbackMessage=WM_TRAYICON;
346 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME); 346 nid.hIcon=AfxGetApp()->LoadIcon(IDR_MAINFRAME);
347 // *** Load from resource 347 // *** Load from resource
348 strcpy(nid.szTip,"PumpKIN"); 348 strcpy(nid.szTip,"PumpKIN");
349 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid)); 349 VERIFY(Shell_NotifyIcon(NIM_ADD,&nid));
350 350
351 return 0; 351 return 0;
352} 352}
353 353
354void CListenSocket::OnReceive(int nErrorCode) 354void CListenSocket::OnReceive(int nErrorCode)
355{ 355{
356 ASSERT(m_Daddy); 356 ASSERT(m_Daddy);
357 if(nErrorCode){ 357 if(nErrorCode){
358 m_Daddy->LogLine(IDS_LOG_LISTENRECEIVEERROR); 358 m_Daddy->LogLine(IDS_LOG_LISTENRECEIVEERROR);
359 return; 359 return;
360 } 360 }
361DWORD fionread = 0; 361DWORD fionread = 0;
362 VERIFY(IOCtl(FIONREAD,&fionread));// *** Do some checking on the value acquired 362 VERIFY(IOCtl(FIONREAD,&fionread));// *** Do some checking on the value acquired
363tftp *tftpRQ = tftp::Allocate(fionread); 363tftp *tftpRQ = tftp::Allocate(fionread);
364 ASSERT(tftpRQ); 364 ASSERT(tftpRQ);
365SOCKADDR_IN sin; 365SOCKADDR_IN sin;
366 if(!tftpRQ->Receive(this,fionread,&sin)){ 366 if(!tftpRQ->Receive(this,fionread,&sin)){
367 m_Daddy->LogLine(IDS_LOG_LISTENACCEPTERROR); 367 m_Daddy->LogLine(IDS_LOG_LISTENACCEPTERROR);
368 delete tftpRQ; 368 delete tftpRQ;
369 return; 369 return;
370 } 370 }
371 #ifndefNDEBUG 371 #ifndefNDEBUG
372CString tmp; 372CString tmp;
373 tmp.Format("%u - %s - %u\n",tftpRQ->Opcode(),inet_ntoa(sin.sin_addr),sin.sin_port); 373 tmp.Format("%u - %s - %u\n",tftpRQ->Opcode(),inet_ntoa(sin.sin_addr),sin.sin_port);
374 TRACE0(tmp); 374 TRACE0(tmp);
375#endif 375#endif
376POSITION p = m_Daddy->m_Xfers.GetStartPosition(); 376POSITION p = m_Daddy->m_Xfers.GetStartPosition();
377 while(p){ 377 while(p){
378 SOCKET key; 378 SOCKET key;
379 CXferSocket *sock; 379 CXferSocket *sock;
380 m_Daddy->m_Xfers.GetNextAssoc(p,key,sock); 380 m_Daddy->m_Xfers.GetNextAssoc(p,key,sock);
381 ASSERT(sock); 381 ASSERT(sock);
382 if(sock->m_Peer.sin_addr.s_addr==sin.sin_addr.s_addr && sock->m_Peer.sin_port==sin.sin_port){ 382 if(sock->m_Peer.sin_addr.s_addr==sin.sin_addr.s_addr && sock->m_Peer.sin_port==sin.sin_port){
383 TRACE0("Ignoring request which we are already processing\n"); 383 TRACE0("Ignoring request which we are already processing\n");
384 delete tftpRQ; 384 delete tftpRQ;
385 return; 385 return;
386 } 386 }
387 } 387 }
388 switch(tftpRQ->Opcode()){ 388 switch(tftpRQ->Opcode()){
389 case tftp::opRRQ: 389 case tftp::opRRQ:
390 // Read Request 390 // Read Request
391 { 391 {
392 CString tmp; 392 CString tmp;
393 tmp.Format(IDS_LOG_RRQSERVE,tftpRQ->rqFileName(),tftpRQ->rqType(),inet_ntoa(sin.sin_addr)); 393 tmp.Format(IDS_LOG_RRQSERVE,tftpRQ->rqFileName(),tftpRQ->rqType(),inet_ntoa(sin.sin_addr));
394 m_Daddy->LogLine(tmp); 394 m_Daddy->LogLine(tmp);
395 CRRQSocket *s = new CRRQSocket(m_Daddy,tftpRQ->rqFileName(),tftpRQ->rqType(),&sin); 395 CRRQSocket *s = new CRRQSocket(m_Daddy,tftpRQ->rqFileName(),tftpRQ->rqType(),&sin);
396 ASSERT(s); 396 ASSERT(s);
397 tftpRQ->GetOptions(&s->m_Options); 397 tftpRQ->GetOptions(&s->m_Options);
398 if(!s->Create()) 398 if(!s->Create())
399 s->Destroy(FALSE); 399 s->Destroy(FALSE);
400 } 400 }
401 break; 401 break;
402 case tftp::opWRQ: 402 case tftp::opWRQ:
403 // Write Request 403 // Write Request
404 { 404 {
405 CString tmp; 405 CString tmp;
406 tmp.Format(IDS_LOG_WRQSERVE,tftpRQ->rqFileName(),tftpRQ->rqType(),inet_ntoa(sin.sin_addr)); 406 tmp.Format(IDS_LOG_WRQSERVE,tftpRQ->rqFileName(),tftpRQ->rqType(),inet_ntoa(sin.sin_addr));
407 m_Daddy->LogLine(tmp); 407 m_Daddy->LogLine(tmp);
408 CWRQSocket *s = new CWRQSocket(m_Daddy,tftpRQ->rqFileName(),tftpRQ->rqType(),&sin); 408 CWRQSocket *s = new CWRQSocket(m_Daddy,tftpRQ->rqFileName(),tftpRQ->rqType(),&sin);
409 ASSERT(s); 409 ASSERT(s);
410 tftpRQ->GetOptions(&s->m_Options); 410 tftpRQ->GetOptions(&s->m_Options);
411 if(!s->Create(NULL,NULL)) 411 if(!s->Create(NULL,NULL))
412 s->Destroy(FALSE); 412 s->Destroy(FALSE);
413 } 413 }
414 break; 414 break;
415 default: 415 default:
416 m_Daddy->LogLine(IDS_LOG_LISTENOPCODE); 416 m_Daddy->LogLine(IDS_LOG_LISTENOPCODE);
417 delete tftpRQ; 417 delete tftpRQ;
418 return; 418 return;
419 } 419 }
420 delete tftpRQ; 420 delete tftpRQ;
421} 421}
422 422
423BOOL tftp::Receive(CAsyncSocket* socket,UINT maxLength,SOCKADDR_IN *sin) 423BOOL tftp::Receive(CAsyncSocket* socket,UINT maxLength,SOCKADDR_IN *sin)
424{ 424{
425 ASSERT(socket); 425 ASSERT(socket);
426int saddrLen = sizeof(SOCKADDR_IN); 426int saddrLen = sizeof(SOCKADDR_IN);
427 length = sin ? 427 length = sin ?
428 socket->ReceiveFrom(udpBase(),maxLength,(SOCKADDR*)sin,&saddrLen) 428 socket->ReceiveFrom(udpBase(),maxLength,(SOCKADDR*)sin,&saddrLen)
429 : 429 :
430 socket->Receive(udpBase(),maxLength) 430 socket->Receive(udpBase(),maxLength)
431 ; 431 ;
432 if(!length) 432 if(!length)
433 return FALSE; 433 return FALSE;
434 if(length==(tftpLength)SOCKET_ERROR) 434 if(length==(tftpLength)SOCKET_ERROR)
435 return FALSE; 435 return FALSE;
436 return TRUE; 436 return TRUE;
437} 437}
438 438
439UINT tftp::Opcode() 439UINT tftp::Opcode()
440{ 440{
441 return REVERSEBYTES(opcode); 441 return REVERSEBYTES(opcode);
442} 442}
443 443
444CString tftp::rqFileName() 444CString tftp::rqFileName()
445{ 445{
446 ASSERT(length); 446 ASSERT(length);
447 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ); 447 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ);
448CString rv; 448CString rv;
449 if(memchr(&data.m_RQ.data,0,length-sizeof(opcode))) 449 if(memchr(&data.m_RQ.data,0,length-sizeof(opcode)))
450 rv = (LPCTSTR)data.m_RQ.data; 450 rv = (LPCTSTR)data.m_RQ.data;
451 return rv; 451 return rv;
452} 452}
453 453
454CString tftp::rqType() 454CString tftp::rqType()
455{ 455{
456 ASSERT(length); 456 ASSERT(length);
457 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ); 457 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ);
458CString rv; 458CString rv;
459char *tmp = (char*)memchr(&data.m_RQ.data,0,length-sizeof(opcode)); 459char *tmp = (char*)memchr(&data.m_RQ.data,0,length-sizeof(opcode));
460 if(tmp++) 460 if(tmp++)
461 rv = (LPCTSTR)tmp; 461 rv = (LPCTSTR)tmp;
462 return rv; 462 return rv;
463} 463}
464 464
465UINT tftp::GetOptions(tftp::tftpOptions* ops) 465UINT tftp::GetOptions(tftp::tftpOptions* ops)
466{ 466{
467 ASSERT(length); 467 ASSERT(length);
468 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ || Opcode()==opOACK); 468 ASSERT(Opcode()==opRRQ || Opcode()==opWRQ || Opcode()==opOACK);
469 ASSERT(ops); 469 ASSERT(ops);
470tftpOptions& o = *ops; 470tftpOptions& o = *ops;
471LPSTR base = (LPSTR)&data.m_RQ.data; 471LPSTR base = (LPSTR)&data.m_RQ.data;
472UINT basePtr = 0; 472UINT basePtr = 0;
473 if(Opcode()==opRRQ || Opcode()==opWRQ){ 473 if(Opcode()==opRRQ || Opcode()==opWRQ){
474 base = (LPSTR)memchr(&data.m_RQ.data,0,length-sizeof(opcode)); 474 base = (LPSTR)memchr(&data.m_RQ.data,0,length-sizeof(opcode));
475 if(!base) 475 if(!base)
476 return 0; 476 return 0;
477 base++; 477 base++;
478 basePtr = (base-(LPSTR)&data.m_RQ.data); 478 basePtr = (base-(LPSTR)&data.m_RQ.data);
479 base = (LPSTR)memchr(base,0,length-basePtr); 479 base = (LPSTR)memchr(base,0,length-basePtr);
480 if(!base) 480 if(!base)
481 return 0; 481 return 0;
482 base++; 482 base++;
483 basePtr = (base-(LPSTR)&data.m_RQ.data); 483 basePtr = (base-(LPSTR)&data.m_RQ.data);
484 } 484 }
485 ops->RemoveAll(); 485 ops->RemoveAll();
486UINT rv = 0; 486UINT rv = 0;
487 while(basePtr<(length-sizeof(opcode))){ 487 while(basePtr<(length-sizeof(opcode))){
488 CString onam = (LPSTR)&data.m_RQ.data[basePtr]; 488 CString onam = (LPSTR)&data.m_RQ.data[basePtr];
489 basePtr+=onam.GetLength()+1; 489 basePtr+=onam.GetLength()+1;
490 CString oval = (LPSTR)&data.m_RQ.data[basePtr]; 490 CString oval = (LPSTR)&data.m_RQ.data[basePtr];
491 basePtr+=oval.GetLength()+1; 491 basePtr+=oval.GetLength()+1;
492 onam.MakeLower(); 492 onam.MakeLower();
493 o[onam]=oval; 493 o[onam]=oval;
494 rv++; 494 rv++;
495 } 495 }
496 return rv; 496 return rv;
497} 497}
498 498
499tftp::tftp() 499tftp::tftp()
500{ 500{
501 length=0; 501 length=0;
502} 502}
503 503
504 504
505void CXferSocket::OnSend(int nErrorCode) 505void CXferSocket::OnSend(int nErrorCode)
506{ 506{
507 if(nErrorCode){ 507 if(nErrorCode){
508 ASSERT(m_Daddy); 508 ASSERT(m_Daddy);
509 m_Daddy->LogLine(IDS_LOG_XFERSEND); 509 m_Daddy->LogLine(IDS_LOG_XFERSEND);
510 return; 510 return;
511 } 511 }
512 if(!m_Queue.IsEmpty()){ 512 if(!m_Queue.IsEmpty()){
513 tftp *p = m_Queue.GetHead(); 513 tftp *p = m_Queue.GetHead();
514 ASSERT(p); 514 ASSERT(p);
515 m_Queue.RemoveHead(); 515 m_Queue.RemoveHead();
516 if(!p->Send(this,&m_Peer)){ 516 if(!p->Send(this,&m_Peer)){
517 ASSERT(m_Daddy); 517 ASSERT(m_Daddy);
518 m_Daddy->LogLine(IDS_LOG_XFERUDPSEND); 518 m_Daddy->LogLine(IDS_LOG_XFERUDPSEND);
519 } 519 }
520 delete p; 520 delete p;
521 } 521 }
522 DoSelect(); 522 DoSelect();
523 if(m_Queue.IsEmpty()){ 523 if(m_Queue.IsEmpty()){
524 switch(state){ 524 switch(state){
525 case stateDeny: 525 case stateDeny:
526 Destroy(FALSE); 526 Destroy(FALSE);
527 break; 527 break;
528 case stateFinish: 528 case stateFinish:
529 Destroy(TRUE); 529 Destroy(TRUE);
530 break; 530 break;
531 } 531 }
532 } 532 }
533} 533}
534 534
535BOOL tftp::Send(CAsyncSocket *socket,SOCKADDR_IN* saddr) 535BOOL tftp::Send(CAsyncSocket *socket,SOCKADDR_IN* saddr)
536{ 536{
537 ASSERT(socket); 537 ASSERT(socket);
538int rv = socket->SendTo(udpBase(),length,(SOCKADDR*)saddr,sizeof(SOCKADDR_IN)); 538int rv = socket->SendTo(udpBase(),length,(SOCKADDR*)saddr,sizeof(SOCKADDR_IN));
539 if(rv!=length) 539 if(rv!=length)
540 return FALSE; 540 return FALSE;
541 return TRUE; 541 return TRUE;
542} 542}
543 543
544void CXferSocket::DoSelect() 544void CXferSocket::DoSelect()
545{ 545{
546 if(m_Peer.sin_addr.s_addr!=INADDR_NONE) 546 if(m_Peer.sin_addr.s_addr!=INADDR_NONE)
547 AsyncSelect(FD_CLOSE|FD_READ|(m_Queue.IsEmpty()?0:FD_WRITE)); 547 AsyncSelect(FD_CLOSE|FD_READ|(m_Queue.IsEmpty()?0:FD_WRITE));
548} 548}
549 549
550void CXferSocket::OnReceive(int nErrorCode) 550void CXferSocket::OnReceive(int nErrorCode)
551{ 551{
552 if(nErrorCode){ 552 if(nErrorCode){
553 ASSERT(m_Daddy); 553 ASSERT(m_Daddy);
554 m_Daddy->LogLine(IDS_LOG_XFERRECEIVE); 554 m_Daddy->LogLine(IDS_LOG_XFERRECEIVE);
555 return; 555 return;
556 } 556 }
557 ASSERT(m_Daddy); 557 ASSERT(m_Daddy);
558DWORD fionread = 0; 558DWORD fionread = 0;
559 VERIFY(IOCtl(FIONREAD,&fionread)); 559 VERIFY(IOCtl(FIONREAD,&fionread));
560tftp *p = tftp::Allocate(fionread); 560tftp *p = tftp::Allocate(fionread);
561 ASSERT(p); 561 ASSERT(p);
562SOCKADDR_IN sin; 562SOCKADDR_IN sin;
563 if(!p->Receive(this,fionread,&sin)){ 563 if(!p->Receive(this,fionread,&sin)){
564 m_Daddy->LogLine(IDS_LOG_XFERUDPRECEIVE); 564 m_Daddy->LogLine(IDS_LOG_XFERUDPRECEIVE);
565 delete p; 565 delete p;
566 }else 566 }else
567 if(m_Peer.sin_addr.s_addr==INADDR_NONE){ 567 if(m_Peer.sin_addr.s_addr==INADDR_NONE){
568 m_Peer.sin_addr=sin.sin_addr; 568 m_Peer.sin_addr=sin.sin_addr;
569 m_Peer.sin_port=sin.sin_port; 569 m_Peer.sin_port=sin.sin_port;
570 } 570 }
571BOOL alive = TRUE; 571BOOL alive = TRUE;
572 if(state==stateInit){ 572 if(state==stateInit){
573 state=stateXfer; 573 state=stateXfer;
574 m_Peer.sin_port=sin.sin_port; 574 m_Peer.sin_port=sin.sin_port;
575 UpdateList(); 575 UpdateList();
576 } 576 }
577 if(sin.sin_addr.s_addr!=m_Peer.sin_addr.s_addr || sin.sin_port!=m_Peer.sin_port){ 577 if(sin.sin_addr.s_addr!=m_Peer.sin_addr.s_addr || sin.sin_port!=m_Peer.sin_port){
578 m_Daddy->LogLine(IDS_LOG_XFERSOURCETID); 578 m_Daddy->LogLine(IDS_LOG_XFERSOURCETID);
579 // *** Bounce it! 579 // *** Bounce it!
580 }else{ 580 }else{
581 alive = OnTFTP(p); 581 alive = OnTFTP(p);
582 } 582 }
583 delete p; 583 delete p;
584 if(alive){ 584 if(alive){
585 DoSelect(); 585 DoSelect();
586 ResetTimeout(); 586 ResetTimeout();
587 } 587 }
588} 588}
589 589
590void CXferSocket::SetPeer(SOCKADDR_IN *sin) 590void CXferSocket::SetPeer(SOCKADDR_IN *sin)
591{ 591{
592 ASSERT(sin); 592 ASSERT(sin);
593 memmove(&m_Peer,sin,sizeof(m_Peer)); 593 memmove(&m_Peer,sin,sizeof(m_Peer));
594} 594}
595 595
596void CXferSocket::UpdateList() 596void CXferSocket::UpdateList()
597{ 597{
598 ASSERT(m_Daddy); 598 ASSERT(m_Daddy);
599LV_FINDINFO lvf; 599LV_FINDINFO lvf;
600 memset(&lvf,0,sizeof(lvf)); 600 memset(&lvf,0,sizeof(lvf));
601 lvf.flags=LVFI_PARAM; 601 lvf.flags=LVFI_PARAM;
602 lvf.lParam=(LPARAM)this; 602 lvf.lParam=(LPARAM)this;
603int i = m_Daddy->m_List.FindItem(&lvf); 603int i = m_Daddy->m_List.FindItem(&lvf);
604 if(i<0){ 604 if(i<0){
605 ASSERT(IsKindOf(RUNTIME_CLASS(CRRQSocket)) || IsKindOf(RUNTIME_CLASS(CWRQSocket))); 605 ASSERT(IsKindOf(RUNTIME_CLASS(CRRQSocket)) || IsKindOf(RUNTIME_CLASS(CWRQSocket)));
606 i=m_Daddy->m_List.InsertItem(0,m_FileName,IsKindOf(RUNTIME_CLASS(CRRQSocket))?m_Daddy->m_iRRQ:m_Daddy->m_iWRQ); 606 i=m_Daddy->m_List.InsertItem(0,m_FileName,IsKindOf(RUNTIME_CLASS(CRRQSocket))?m_Daddy->m_iRRQ:m_Daddy->m_iWRQ);
607 ASSERT(!(i<0)); 607 ASSERT(!(i<0));
608 m_Daddy->m_List.SetItemData(i,(DWORD)this); 608 m_Daddy->m_List.SetItemData(i,(DWORD)this);
609 } 609 }
610 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemFile,m_FileName); 610 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemFile,m_FileName);
611 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemType,m_Type); 611 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemType,m_Type);
612 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemPeer,inet_ntoa(m_Peer.sin_addr)); 612 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemPeer,inet_ntoa(m_Peer.sin_addr));
613CString tmp; 613CString tmp;
614 tmp.Format(IDS_FMT_BYTES,GetACK()); 614 tmp.Format(IDS_FMT_BYTES,GetACK());
615 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemBytes,tmp); 615 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemBytes,tmp);
616 if(m_xferSize>=0){ 616 if(m_xferSize>=0){
617 tmp.Format(IDS_FMT_BYTES,m_xferSize); 617 tmp.Format(IDS_FMT_BYTES,m_xferSize);
618 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemTSize,tmp); 618 m_Daddy->m_List.SetItemText(i,CPumpKINDlg::subitemTSize,tmp);
619 } 619 }
620} 620}
621 621
622CXferSocket::CXferSocket() 622CXferSocket::CXferSocket()
623 : m_wndResolver(NULL), m_Retry(NULL), m_bRetry(FALSE), 623 : m_wndResolver(NULL), m_Retry(NULL), m_bRetry(FALSE),
624 m_blkSize(512), m_timeOut(30), m_xferSize(-1), 624 m_blkSize(512), m_timeOut(30), m_xferSize(-1),
625 m__blkSize(512), m__timeOut(30) 625 m__blkSize(512), m__timeOut(30)
626{ 626{
627 m_Daddy=NULL; 627 m_Daddy=NULL;
628 m_Peer.sin_addr.s_addr=INADDR_NONE; 628 m_Peer.sin_addr.s_addr=INADDR_NONE;
629 m_Peer.sin_family=AF_INET; 629 m_Peer.sin_family=AF_INET;
630 state=stateNone; 630 state=stateNone;
631} 631}
632 632
633ULONG CXferSocket::GetACK() 633ULONG CXferSocket::GetACK()
634{ 634{
635 return 0; 635 return 0;
636} 636}
637 637
638CXferSocket::CXferSocket(CPumpKINDlg *daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN* sin) 638CXferSocket::CXferSocket(CPumpKINDlg *daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN* sin)
639 : m_wndResolver(NULL), m_Retry(NULL), m_bRetry(FALSE), 639 : m_wndResolver(NULL), m_Retry(NULL), m_bRetry(FALSE),
640 m_blkSize(512), m_timeOut(30), m_xferSize(-1), 640 m_blkSize(512), m_timeOut(30), m_xferSize(-1),
641 m__blkSize(512), m__timeOut(30) 641 m__blkSize(512), m__timeOut(30)
642{ 642{
643 m_Peer.sin_family=AF_INET; 643 m_Peer.sin_family=AF_INET;
644 state=stateNone; 644 state=stateNone;
645 ASSERT(daddy); 645 ASSERT(daddy);
646 m_Daddy=daddy; 646 m_Daddy=daddy;
647 m_timeOut=m__timeOut=m_Daddy->m_TFTPTimeOut.GetTotalSeconds(); 647 m_timeOut=m__timeOut=m_Daddy->m_TFTPTimeOut.GetTotalSeconds();
648 if(sin){ 648 if(sin){
649 m_Peer.sin_addr.s_addr=sin->sin_addr.s_addr; 649 m_Peer.sin_addr.s_addr=sin->sin_addr.s_addr;
650 m_Peer.sin_port=sin->sin_port; 650 m_Peer.sin_port=sin->sin_port;
651 }else 651 }else
652 m_Peer.sin_addr.s_addr=INADDR_NONE; 652 m_Peer.sin_addr.s_addr=INADDR_NONE;
653 m_FileName=fileName; 653 m_FileName=fileName;
654 m_Type=type; 654 m_Type=type;
655} 655}
656 656
657BOOL CRRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName) 657BOOL CRRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName)
658{ 658{
659 if(!CAsyncSocket::Create(0,SOCK_DGRAM)) 659 if(!CAsyncSocket::Create(0,SOCK_DGRAM))
660 return FALSE; 660 return FALSE;
661 ASSERT(m_Daddy); 661 ASSERT(m_Daddy);
662 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName); 662 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName);
663 m_Daddy->m_Xfers[m_hSocket]=this; 663 m_Daddy->m_Xfers[m_hSocket]=this;
664CString lFile = localFile?localFile:m_FileName; 664CString lFile = localFile?localFile:m_FileName;
665 TurnSlashes(lFile,TRUE); 665 TurnSlashes(lFile,TRUE);
666 UpdateList(); 666 UpdateList();
667 if(!localFile){// Check only if server 667 if(!localFile){// Check only if server
668 if(CheckBadRelativeness(m_FileName)){ 668 if(CheckBadRelativeness(m_FileName)){
669 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS); 669 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS);
670 return TRUE; 670 return TRUE;
671 } 671 }
672 switch(m_Daddy->m_RRQMode){ 672 switch(m_Daddy->m_RRQMode){
673 case CPumpKINDlg::rrqGiveAll: 673 case CPumpKINDlg::rrqGiveAll:
674 break; 674 break;
675 case CPumpKINDlg::rrqAlwaysConfirm: 675 case CPumpKINDlg::rrqAlwaysConfirm:
676 if(ConfirmRequest()) 676 if(ConfirmRequest())
677 break; 677 break;
678 case CPumpKINDlg::rrqDenyAll: 678 case CPumpKINDlg::rrqDenyAll:
679 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS); 679 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS);
680 return TRUE; 680 return TRUE;
681 } 681 }
682 } 682 }
683CString fn = localFile?ApplyRootGently(lFile):ApplyRoot(lFile); 683CString fn = localFile?ApplyRootGently(lFile):ApplyRoot(lFile);
684CFileException e; 684CFileException e;
685 if(!m_File.Open(fn,CFile::modeRead|CFile::shareDenyWrite,&e)){ 685 if(!m_File.Open(fn,CFile::modeRead|CFile::shareDenyWrite,&e)){
686 if(localFile){ 686 if(localFile){
687 CString tmp; 687 CString tmp;
688 tmp.Format(IDS_LOG_FAILEDLOCALFILE,fn); 688 tmp.Format(IDS_LOG_FAILEDLOCALFILE,fn);
689 m_Daddy->LogLine(tmp); 689 m_Daddy->LogLine(tmp);
690 return FALSE; 690 return FALSE;
691 } 691 }
692 Deny(&e); 692 Deny(&e);
693 return TRUE; 693 return TRUE;
694 } 694 }
695 m_xferSize=m_File.GetLength();// *** HANDLE EXCEPTION 695 m_xferSize=m_File.GetLength();// *** HANDLE EXCEPTION
696 if(hostName){ 696 if(hostName){
697 m_HostName=hostName; 697 m_HostName=hostName;
698 698
699 CString tmp; 699 CString tmp;
700 tmp.Format(IDS_LOG_SENDING,m_FileName,m_HostName); 700 tmp.Format(IDS_LOG_SENDING,m_FileName,m_HostName);
701 m_Daddy->LogLine(tmp); 701 m_Daddy->LogLine(tmp);
702 702
703 CString inAddr = hostName; 703 CString inAddr = hostName;
704 int at = inAddr.Find('@'); 704 int at = inAddr.Find('@');
705 if(at>=0) 705 if(at>=0)
706 inAddr=inAddr.Mid(at+1); 706 inAddr=inAddr.Mid(at+1);
707 if((m_Peer.sin_addr.s_addr=inet_addr((LPCTSTR)inAddr))==INADDR_NONE){ 707 if((m_Peer.sin_addr.s_addr=inet_addr((LPCTSTR)inAddr))==INADDR_NONE){
708 ASSERT(!m_wndResolver); 708 ASSERT(!m_wndResolver);
709 m_wndResolver = new CResolver(this); 709 m_wndResolver = new CResolver(this);
710 ASSERT(m_wndResolver); 710 ASSERT(m_wndResolver);
711 return m_wndResolver->Resolve(); 711 return m_wndResolver->Resolve();
712 } 712 }
713 else 713 else
714 OnHostKnown(); 714 OnHostKnown();
715 }else{ 715 }else{
716 tftp::tftpOptions o; 716 tftp::tftpOptions o;
717 CString v; 717 CString v;
718 if(m_Options.Lookup(tftpoBSize,v)){ 718 if(m_Options.Lookup(tftpoBSize,v)){
719 m__blkSize=atoi(v); 719 m__blkSize=atoi(v);
720 if(m__blkSize){ 720 if(m__blkSize){
721 m_blkSize=m__blkSize; 721 m_blkSize=m__blkSize;
722 v.Format("%u",m_blkSize); 722 v.Format("%u",m_blkSize);
723 o[tftpoBSize]=v; 723 o[tftpoBSize]=v;
724 } 724 }
725 } 725 }
726 if(m_Options.Lookup(tftpoTSize,v)){ 726 if(m_Options.Lookup(tftpoTSize,v)){
727 v.Format("%lu",m_xferSize); 727 v.Format("%lu",m_xferSize);
728 o[tftpoTSize]=v; 728 o[tftpoTSize]=v;
729 } 729 }
730 if(m_Options.Lookup(tftpoTOut,v)){ 730 if(m_Options.Lookup(tftpoTOut,v)){
731 m__timeOut=atoi(v); 731 m__timeOut=atoi(v);
732 if(m__timeOut){ 732 if(m__timeOut){
733 m_timeOut=m__timeOut; 733 m_timeOut=m__timeOut;
734 v.Format("%u",m_timeOut); 734 v.Format("%u",m_timeOut);
735 o[tftpoTOut]=v; 735 o[tftpoTOut]=v;
736 } 736 }
737 } 737 }
738 state = stateXfer; 738 state = stateXfer;
739 m_ACK=0; 739 m_ACK=0;
740 if(o.GetCount()){ 740 if(o.GetCount()){
741 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&o)); 741 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&o));
742 ASSERT(p); 742 ASSERT(p);
743 p->SetOpcode(tftp::opOACK); 743 p->SetOpcode(tftp::opOACK);
744 p->data.m_OACK.Set(&o); 744 p->data.m_OACK.Set(&o);
745 PostTFTP(p,TRUE); 745 PostTFTP(p,TRUE);
746 }else 746 }else
747 DoXfer(); 747 DoXfer();
748 } 748 }
749 return TRUE; 749 return TRUE;
750} 750}
751 751
752CRRQSocket::CRRQSocket(CPumpKINDlg *daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin) 752CRRQSocket::CRRQSocket(CPumpKINDlg *daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin)
753 : CXferSocket(daddy,fileName,type,sin) 753 : CXferSocket(daddy,fileName,type,sin)
754{ 754{
755 m_ACK=0; 755 m_ACK=0;
756 m_LastSlack=0; 756 m_LastSlack=0;
757} 757}
758 758
759UINT tftp::tftpERROR::tftpSize(LPCTSTR msg) 759UINT tftp::tftpERROR::tftpSize(LPCTSTR msg)
760{ 760{
761 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpERROR::tftpErrorCode)+strlen(msg)+1; 761 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpERROR::tftpErrorCode)+strlen(msg)+1;
762} 762}
763 763
764tftp* tftp::Allocate(UINT tftpSize) 764tftp* tftp::Allocate(UINT tftpSize)
765{ 765{
766 ASSERT(tftpSize); 766 ASSERT(tftpSize);
767tftp* rv = (tftp*) new BYTE[tftpSlackSize+tftpSize]; 767tftp* rv = (tftp*) new BYTE[tftpSlackSize+tftpSize];
768 ASSERT(rv); 768 ASSERT(rv);
769 rv->length=tftpSize; 769 rv->length=tftpSize;
770 return rv; 770 return rv;
771} 771}
772 772
773void tftp::errSet(UINT code,LPCTSTR msg) 773void tftp::errSet(UINT code,LPCTSTR msg)
774{ 774{
775 ASSERT(this); 775 ASSERT(this);
776 ASSERT(length>=data.m_ERROR.tftpSize(msg)); 776 ASSERT(length>=data.m_ERROR.tftpSize(msg));
777 strcpy((char*)data.m_ERROR.data,msg); 777 strcpy((char*)data.m_ERROR.data,msg);
778 data.m_ERROR.SetCode(code); 778 data.m_ERROR.SetCode(code);
779} 779}
780 780
781void CXferSocket::PostTFTP(tftp* p,BOOL retryable) 781void CXferSocket::PostTFTP(tftp* p,BOOL retryable)
782{ 782{
783 ASSERT(p); 783 ASSERT(p);
784 m_Queue.AddTail(p); 784 m_Queue.AddTail(p);
785 DoSelect(); 785 DoSelect();
786 if(!m_bRetry){ 786 if(!m_bRetry){
787 if(retryable) 787 if(retryable)
788 SetTry(p); 788 SetTry(p);
789 else 789 else
790 SetTry(); 790 SetTry();
791 } 791 }
792 ResetTimeout(); 792 ResetTimeout();
793} 793}
794 794
795void CXferSocket::Deny(UINT errCode,UINT errID) 795void CXferSocket::Deny(UINT errCode,UINT errID)
796{ 796{
797 PostError(errCode,errID); 797 PostError(errCode,errID);
798 state=stateDeny; 798 state=stateDeny;
799} 799}
800 800
801void CRRQSocket::DoXfer() 801void CRRQSocket::DoXfer()
802{ 802{
803tftp *p = tftp::Allocate(tftp::tftpDATA::tftpSize(m_blkSize)); 803tftp *p = tftp::Allocate(tftp::tftpDATA::tftpSize(m_blkSize));
804 ASSERT(p); 804 ASSERT(p);
805 p->SetOpcode(tftp::opDATA); 805 p->SetOpcode(tftp::opDATA);
806 TRY{ 806 TRY{
807 m_File.Seek(m_ACK*m_blkSize,CFile::begin); 807 m_File.Seek(m_ACK*m_blkSize,CFile::begin);
808 int bytes = m_File.Read(p->data.m_DATA.data,m_blkSize); 808 int bytes = m_File.Read(p->data.m_DATA.data,m_blkSize);
809 p->data.m_DATA.SetBlock(m_ACK+1); 809 p->data.m_DATA.SetBlock(m_ACK+1);
810 p->length=p->length-m_blkSize+bytes; 810 p->length=p->length-m_blkSize+bytes;
811 m_LastSlack = m_blkSize-bytes; 811 m_LastSlack = m_blkSize-bytes;
812 PostTFTP(p); 812 PostTFTP(p);
813 if(bytes<m_blkSize){ 813 if(bytes<m_blkSize){
814 state=stateFinish; 814 state=stateFinish;
815 ASSERT(m_Daddy); 815 ASSERT(m_Daddy);
816 CString tmp; 816 CString tmp;
817 tmp.Format(IDS_LOG_XFERRRQFINISHED,(LPCTSTR)m_FileName); 817 tmp.Format(IDS_LOG_XFERRRQFINISHED,(LPCTSTR)m_FileName);
818 m_Daddy->LogLine(tmp); 818 m_Daddy->LogLine(tmp);
819 } 819 }
820 }CATCH(CFileException,e){ 820 }CATCH(CFileException,e){
821 Deny(e); 821 Deny(e);
822 }END_CATCH 822 }END_CATCH
823} 823}
824 824
825UINT tftp::tftpDATA::tftpSize(UINT blkSize) 825UINT tftp::tftpDATA::tftpSize(UINT blkSize)
826{ 826{
827 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpDATA) 827 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpDATA)
828 -sizeof(BYTE)+blkSize; 828 -sizeof(BYTE)+blkSize;
829} 829}
830 830
831void CXferSocket::Deny(CFileException* e) 831void CXferSocket::Deny(CFileException* e)
832{ 832{
833 PostError(e); 833 PostError(e);
834 state=stateDeny; 834 state=stateDeny;
835} 835}
836 836
837void CXferSocket::PostError(UINT errCode,UINT errID) 837void CXferSocket::PostError(UINT errCode,UINT errID)
838{ 838{
839CString msg; 839CString msg;
840 msg.LoadString(errID); 840 msg.LoadString(errID);
841 ASSERT(m_Daddy); 841 ASSERT(m_Daddy);
842 /*// *** 842 /*// ***
843CString tmp; 843CString tmp;
844 tmp.Format(IDS_LOG_SENTTFTPERROR,errCode,(LPCTSTR)msg); 844 tmp.Format(IDS_LOG_SENTTFTPERROR,errCode,(LPCTSTR)msg);
845 m_Daddy->LogLine(tmp); 845 m_Daddy->LogLine(tmp);
846 */ 846 */
847tftp* err = tftp::Allocate(tftp::tftpERROR::tftpSize(msg)); 847tftp* err = tftp::Allocate(tftp::tftpERROR::tftpSize(msg));
848err->SetOpcode(tftp::opERROR); 848err->SetOpcode(tftp::opERROR);
849 err->errSet(errCode,msg); 849 err->errSet(errCode,msg);
850 PostTFTP(err); 850 PostTFTP(err);
851} 851}
852 852
853void CXferSocket::PostError(CFileException* e) 853void CXferSocket::PostError(CFileException* e)
854{ 854{
855UINT eCode; 855UINT eCode;
856UINT eMsgID; 856UINT eMsgID;
857 switch(e->m_cause){ 857 switch(e->m_cause){
858 case CFileException::fileNotFound: 858 case CFileException::fileNotFound:
859 eCode=tftp::errNotFound; 859 eCode=tftp::errNotFound;
860 eMsgID=IDS_TFTP_ERROR_NOTFOUND; 860 eMsgID=IDS_TFTP_ERROR_NOTFOUND;
861 break; 861 break;
862 case CFileException::accessDenied: 862 case CFileException::accessDenied:
863 eCode=tftp::errAccessViolation; 863 eCode=tftp::errAccessViolation;
864 eMsgID=IDS_TFTP_ERROR_ACCESS; 864 eMsgID=IDS_TFTP_ERROR_ACCESS;
865 break; 865 break;
866 case CFileException::directoryFull: 866 case CFileException::directoryFull:
867 eCode=tftp::errDiskFull; 867 eCode=tftp::errDiskFull;
868 eMsgID=IDS_TFTP_ERROR_DIRFULL; 868 eMsgID=IDS_TFTP_ERROR_DIRFULL;
869 break; 869 break;
870 case CFileException::sharingViolation: 870 case CFileException::sharingViolation:
871 eCode=tftp::errAccessViolation; 871 eCode=tftp::errAccessViolation;
872 eMsgID=IDS_TFTP_ERROR_SHARING; 872 eMsgID=IDS_TFTP_ERROR_SHARING;
873 break; 873 break;
874 case CFileException::diskFull: 874 case CFileException::diskFull:
875 eCode=tftp::errDiskFull; 875 eCode=tftp::errDiskFull;
876 eMsgID=IDS_TFTP_ERROR_DISKFULL; 876 eMsgID=IDS_TFTP_ERROR_DISKFULL;
877 break; 877 break;
878 default: 878 default:
879 eCode=tftp::errUndefined; 879 eCode=tftp::errUndefined;
880 eMsgID=IDS_TFTP_ERROR_UNDEFINED; 880 eMsgID=IDS_TFTP_ERROR_UNDEFINED;
881 break; 881 break;
882 } 882 }
883 PostError(eCode,eMsgID); 883 PostError(eCode,eMsgID);
884} 884}
885 885
886ULONG CRRQSocket::GetACK(void) 886ULONG CRRQSocket::GetACK(void)
887{ 887{
888 return (m_ACK*m_blkSize)-m_LastSlack; 888 return (m_ACK*m_blkSize)-m_LastSlack;
889} 889}
890 890
891BOOL CRRQSocket::OnTFTP(tftp* p) 891BOOL CRRQSocket::OnTFTP(tftp* p)
892{ 892{
893BOOL rv = TRUE; 893BOOL rv = TRUE;
894 switch(p->Opcode()){ 894 switch(p->Opcode()){
895 case tftp::opOACK: 895 case tftp::opOACK:
896 m_ACK=0; 896 m_ACK=0;
897 ASSERT(state!=stateFinish); 897 ASSERT(state!=stateFinish);
898 { 898 {
899 tftp::tftpOptions o; 899 tftp::tftpOptions o;
900 if(p->GetOptions(&o)){ 900 if(p->GetOptions(&o)){
901 CString v; 901 CString v;
902 if(o.Lookup(tftpoBSize,v)){ 902 if(o.Lookup(tftpoBSize,v)){
903 m_blkSize=atoi(v); 903 m_blkSize=atoi(v);
904 if(!m_blkSize){// *** More sanity checks 904 if(!m_blkSize){// *** More sanity checks
905 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE); 905 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE);
906 rv = TRUE; 906 rv = TRUE;
907 break; 907 break;
908 } 908 }
909 } 909 }
910 if(o.Lookup(tftpoTOut,v)){ 910 if(o.Lookup(tftpoTOut,v)){
911 m_timeOut=atoi(v); 911 m_timeOut=atoi(v);
912 if(!m_timeOut){// *** More sanity checks 912 if(!m_timeOut){// *** More sanity checks
913 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT); 913 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT);
914 rv = TRUE; 914 rv = TRUE;
915 break; 915 break;
916 } 916 }
917 } 917 }
918 if(o.Lookup(tftpoXResume,v)){ 918 if(o.Lookup(tftpoXResume,v)){
919 m_ACK=atoi(v); 919 m_ACK=atoi(v);
920 } 920 }
921 } 921 }
922 UpdateList(); 922 UpdateList();
923 DoXfer(); 923 DoXfer();
924 } 924 }
925 break; 925 break;
926 case tftp::opACK: 926 case tftp::opACK:
927 m_ACK=p->data.m_ACK.Block(); 927 m_ACK=p->data.m_ACK.Block();
928 if(state!=stateFinish){ 928 if(state!=stateFinish){
929 UpdateList(); 929 UpdateList();
930 DoXfer(); 930 DoXfer();
931 } 931 }
932 break; 932 break;
933 case tftp::opERROR: 933 case tftp::opERROR:
934 { 934 {
935 ASSERT(m_Daddy); 935 ASSERT(m_Daddy);
936 CString tmp; 936 CString tmp;
937 tmp.Format(IDS_LOG_GOTTFTPERROR,p->data.m_ERROR.Code(),(LPCTSTR)p->errMessage()); 937 tmp.Format(IDS_LOG_GOTTFTPERROR,p->data.m_ERROR.Code(),(LPCTSTR)p->errMessage());
938 m_Daddy->LogLine(tmp); 938 m_Daddy->LogLine(tmp);
939 } 939 }
940 Destroy(FALSE); 940 Destroy(FALSE);
941 rv = FALSE; 941 rv = FALSE;
942 break; 942 break;
943 default: 943 default:
944 ASSERT(m_Daddy); 944 {
945 m_Daddy->LogLine(IDS_LOG_XFEROPCODE); 945 ASSERT(m_Daddy);
946 // *** Self destruct maybe?? 946 CString tmp;
947 tmp.Format(IDS_LOG_XFEROPCODE,p->Opcode());
948 m_Daddy->LogLine(tmp);
949 // *** Self destruct maybe??
950 }
947 break; 951 break;
948 } 952 }
949 return rv; 953 return rv;
950} 954}
951 955
952BOOL CWRQSocket::OnTFTP(tftp* p) 956BOOL CWRQSocket::OnTFTP(tftp* p)
953{ 957{
954 switch(p->Opcode()){ 958 switch(p->Opcode()){
955 case tftp::opOACK: 959 case tftp::opOACK:
956 ASSERT(state!=stateFinish); 960 ASSERT(state!=stateFinish);
957 { 961 {
958 if(m_bResume) 962 if(m_bResume)
959 m_ACK=m_File.GetLength()/m_blkSize; 963 m_ACK=m_File.GetLength()/m_blkSize;
960 else 964 else
961 m_ACK=0; 965 m_ACK=0;
962 tftp::tftpOptions o; 966 tftp::tftpOptions o;
963 if(p->GetOptions(&o)){ 967 if(p->GetOptions(&o)){
964 CString v; 968 CString v;
965 if(o.Lookup(tftpoBSize,v)){ 969 if(o.Lookup(tftpoBSize,v)){
966 m_blkSize=atoi(v); 970 m_blkSize=atoi(v);
967 if(!m_blkSize){// *** More sanity checks 971 if(!m_blkSize){// *** More sanity checks
968 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE); 972 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE);
969 return TRUE; 973 return TRUE;
970 } 974 }
971 } 975 }
972 if(o.Lookup(tftpoTOut,v)){ 976 if(o.Lookup(tftpoTOut,v)){
973 m_timeOut=atoi(v); 977 m_timeOut=atoi(v);
974 if(!m_timeOut){// *** More sanity checks 978 if(!m_timeOut){// *** More sanity checks
975 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT); 979 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT);
976 return TRUE; 980 return TRUE;
977 } 981 }
978 } 982 }
979 if(o.Lookup(tftpoTSize,v)){ 983 if(o.Lookup(tftpoTSize,v)){
980 m_xferSize=atoi(v); 984 m_xferSize=atoi(v);
981 } 985 }
982 } 986 }
983 UpdateList(); 987 UpdateList();
984 DoXfer(); 988 DoXfer();
985 } 989 }
986 break; 990 break;
987 case tftp::opDATA: 991 case tftp::opDATA:
988 { 992 {
989 UINTblock = p->data.m_DATA.Block(); 993 UINTblock = p->data.m_DATA.Block();
990 TRY{ 994 TRY{
991 m_File.Seek((block-1)*m_blkSize,CFile::begin); 995 m_File.Seek((block-1)*m_blkSize,CFile::begin);
992 int bytes = p->length-sizeof(p->data.m_DATA.block)-(tftpHdrSize-tftpSlackSize); 996 int bytes = p->length-sizeof(p->data.m_DATA.block)-(tftpHdrSize-tftpSlackSize);
993 if(bytes){ 997 if(bytes){
994 m_File.Write(p->data.m_DATA.data,bytes); 998 m_File.Write(p->data.m_DATA.data,bytes);
995 // *** Move to the other place where we can do it not that often 999 // *** Move to the other place where we can do it not that often
996 m_File.SetLength(m_File.GetPosition()); 1000 m_File.SetLength(m_File.GetPosition());
997 } 1001 }
998 if(bytes<m_blkSize){ 1002 if(bytes<m_blkSize){
999 state=stateFinish; 1003 state=stateFinish;
1000 ASSERT(m_Daddy); 1004 ASSERT(m_Daddy);
1001 CString tmp; 1005 CString tmp;
1002 tmp.Format(IDS_LOG_XFERWRQFINISHED,(LPCTSTR)m_FileName); 1006 tmp.Format(IDS_LOG_XFERWRQFINISHED,(LPCTSTR)m_FileName);
1003 m_Daddy->LogLine(tmp); 1007 m_Daddy->LogLine(tmp);
1004 } 1008 }
1005 m_ACK=block; 1009 m_ACK=block;
1006 m_LastSlack=m_blkSize-bytes; 1010 m_LastSlack=m_blkSize-bytes;
1007 UpdateList(); 1011 UpdateList();
1008 DoXfer(); 1012 DoXfer();
1009 }CATCH(CFileException,e){ 1013 }CATCH(CFileException,e){
1010 Deny(e); 1014 Deny(e);
1011 }END_CATCH 1015 }END_CATCH
1012 } 1016 }
1013 break; 1017 break;
1014 case tftp::opERROR: 1018 case tftp::opERROR:
1015 { 1019 {
1016 ASSERT(m_Daddy); 1020 ASSERT(m_Daddy);
1017 CString tmp; 1021 CString tmp;
1018 tmp.Format(IDS_LOG_GOTTFTPERROR,p->data.m_ERROR.Code(),(LPCTSTR)p->errMessage()); 1022 tmp.Format(IDS_LOG_GOTTFTPERROR,p->data.m_ERROR.Code(),(LPCTSTR)p->errMessage());
1019 m_Daddy->LogLine(tmp); 1023 m_Daddy->LogLine(tmp);
1020 } 1024 }
1021 Destroy(FALSE); 1025 Destroy(FALSE);
1022 return FALSE; 1026 return FALSE;
1023 default: 1027 default:
1024 ASSERT(m_Daddy); 1028 {
1025 m_Daddy->LogLine(IDS_LOG_XFEROPCODE); 1029 ASSERT(m_Daddy);
1026 // *** Self destruct maybe?? 1030 CString tmp;
1031 tmp.Format(IDS_LOG_XFEROPCODE,p->Opcode());
1032 m_Daddy->LogLine(tmp);
1033 // *** Self destruct maybe??
1034 }
1027 break; 1035 break;
1028 } 1036 }
1029 return TRUE; 1037 return TRUE;
1030} 1038}
1031 1039
1032void tftp::SetOpcode(WORD op) 1040void tftp::SetOpcode(WORD op)
1033{ 1041{
1034 opcode = REVERSEBYTES(op); 1042 opcode = REVERSEBYTES(op);
1035} 1043}
1036void tftp::tftpDATA::SetBlock(WORD b) 1044void tftp::tftpDATA::SetBlock(WORD b)
1037{ 1045{
1038 block=REVERSEBYTES(b); 1046 block=REVERSEBYTES(b);
1039} 1047}
1040WORD tftp::tftpDATA::Block() 1048WORD tftp::tftpDATA::Block()
1041{ 1049{
1042 return REVERSEBYTES(block); 1050 return REVERSEBYTES(block);
1043} 1051}
1044WORD tftp::tftpACK::Block() 1052WORD tftp::tftpACK::Block()
1045{ 1053{
1046 return REVERSEBYTES(block); 1054 return REVERSEBYTES(block);
1047} 1055}
1048void tftp::tftpACK::SetBlock(WORD b) 1056void tftp::tftpACK::SetBlock(WORD b)
1049{ 1057{
1050 block = REVERSEBYTES(b); 1058 block = REVERSEBYTES(b);
1051} 1059}
1052WORD tftp::tftpERROR::Code() 1060WORD tftp::tftpERROR::Code()
1053{ 1061{
1054 return REVERSEBYTES(code); 1062 return REVERSEBYTES(code);
1055} 1063}
1056void tftp::tftpERROR::SetCode(WORD c) 1064void tftp::tftpERROR::SetCode(WORD c)
1057{ 1065{
1058 code = REVERSEBYTES(c); 1066 code = REVERSEBYTES(c);
1059} 1067}
1060 1068
1061 1069
1062CString tftp::errMessage() 1070CString tftp::errMessage()
1063{ 1071{
1064CString rv; 1072CString rv;
1065 if(memchr(data.m_ERROR.data,0,length-(tftpHdrSize-tftpSlackSize)-sizeof(data.m_ERROR.code))) 1073 if(memchr(data.m_ERROR.data,0,length-(tftpHdrSize-tftpSlackSize)-sizeof(data.m_ERROR.code)))
1066 rv = (LPCTSTR)data.m_ERROR.data; 1074 rv = (LPCTSTR)data.m_ERROR.data;
1067 return rv; 1075 return rv;
1068} 1076}
1069 1077
1070void CXferSocket::Destroy(BOOL success) 1078void CXferSocket::Destroy(BOOL success)
1071{ 1079{
1072 if(m_wndResolver){ 1080 if(m_wndResolver){
1073 delete m_wndResolver; 1081 delete m_wndResolver;
1074 m_wndResolver=NULL; 1082 m_wndResolver=NULL;
1075 } 1083 }
1076 SetTry(); 1084 SetTry();
1077 m_Daddy->m_bnw.StartSound( 1085 m_Daddy->m_bnw.StartSound(
1078 success 1086 success
1079 ? m_Daddy->m_bnwSuccess 1087 ? m_Daddy->m_bnwSuccess
1080 : m_Daddy->m_bnwAbort 1088 : m_Daddy->m_bnwAbort
1081 ); 1089 );
1082 if(m_File.m_hFile!=CFile::hFileNull){ 1090 if(m_File.m_hFile!=CFile::hFileNull){
1083 TRY{ 1091 TRY{
1084 m_File.Close(); 1092 m_File.Close();
1085 }CATCH(CFileException,e){ 1093 }CATCH(CFileException,e){
1086 TRACE0("Error closing file\n"); 1094 TRACE0("Error closing file\n");
1087 }END_CATCH 1095 }END_CATCH
1088 } 1096 }
1089 ASSERT(m_Daddy); 1097 ASSERT(m_Daddy);
1090 m_Daddy->KillTimer(m_hSocket); 1098 m_Daddy->KillTimer(m_hSocket);
1091 m_Daddy->m_Xfers.RemoveKey(m_hSocket); 1099 m_Daddy->m_Xfers.RemoveKey(m_hSocket);
1092LV_FINDINFO lvf; 1100LV_FINDINFO lvf;
1093 memset(&lvf,0,sizeof(lvf)); 1101 memset(&lvf,0,sizeof(lvf));
1094 lvf.flags=LVFI_PARAM; 1102 lvf.flags=LVFI_PARAM;
1095 lvf.lParam=(LPARAM)this; 1103 lvf.lParam=(LPARAM)this;
1096int i = m_Daddy->m_List.FindItem(&lvf); 1104int i = m_Daddy->m_List.FindItem(&lvf);
1097 if(i>=0) 1105 if(i>=0)
1098 m_Daddy->m_List.DeleteItem(i); 1106 m_Daddy->m_List.DeleteItem(i);
1099 delete this; 1107 delete this;
1100} 1108}
1101 1109
1102void CPumpKINDlg::LogLine(LPCTSTR str) 1110void CPumpKINDlg::LogLine(LPCTSTR str)
1103{ 1111{
1104 ASSERT(m_LogLength); 1112 ASSERT(m_LogLength);
1105 while(m_Log.GetCount()>m_LogLength && m_Log.GetCount()!=LB_ERR){ 1113 while(m_Log.GetCount()>m_LogLength && m_Log.GetCount()!=LB_ERR){
1106 CTime *t = (CTime*)m_Log.GetItemData(0); 1114 CTime *t = (CTime*)m_Log.GetItemData(0);
1107 if(((DWORD)t)!=LB_ERR){ 1115 if(((DWORD)t)!=LB_ERR){
1108 ASSERT(t); 1116 ASSERT(t);
1109 m_LogTimes.RemoveKey(t); 1117 m_LogTimes.RemoveKey(t);
1110 delete t; 1118 delete t;
1111 } 1119 }
1112 m_Log.DeleteString(0); 1120 m_Log.DeleteString(0);
1113 } 1121 }
1114int i = m_Log.AddString(str); 1122int i = m_Log.AddString(str);
1115 ASSERT(i!=LB_ERR); 1123 ASSERT(i!=LB_ERR);
1116CTime *t = new CTime(CTime::GetCurrentTime()); 1124CTime *t = new CTime(CTime::GetCurrentTime());
1117 m_Log.SetItemData(i,(DWORD)(m_LogTimes[t]=t)); 1125 m_Log.SetItemData(i,(DWORD)(m_LogTimes[t]=t));
1118 m_Log.SetCurSel(i); 1126 m_Log.SetCurSel(i);
1119} 1127}
1120 1128
1121void CPumpKINDlg::LogLine(UINT msgID) 1129void CPumpKINDlg::LogLine(UINT msgID)
1122{ 1130{
1123CString tmp; 1131CString tmp;
1124 tmp.Format(msgID); 1132 tmp.Format(msgID);
1125 LogLine(tmp); 1133 LogLine(tmp);
1126} 1134}
1127 1135
1128void CXferSocket::TurnSlashes(CString& fn,BOOL bBack) 1136void CXferSocket::TurnSlashes(CString& fn,BOOL bBack)
1129{ 1137{
1130 ints = fn.Find(bBack?'/':'\\'); 1138 ints = fn.Find(bBack?'/':'\\');
1131 while(s>=0){ 1139 while(s>=0){
1132 fn.SetAt(s,bBack?'\\':'/'); 1140 fn.SetAt(s,bBack?'\\':'/');
1133 s = fn.Find(bBack?'/':'\\'); 1141 s = fn.Find(bBack?'/':'\\');
1134 } 1142 }
1135} 1143}
1136 1144
1137CString CXferSocket::ApplyRoot(LPCTSTR fileName) 1145CString CXferSocket::ApplyRoot(LPCTSTR fileName)
1138{ 1146{
1139 ASSERT(m_Daddy); 1147 ASSERT(m_Daddy);
1140CString fn = fileName; 1148CString fn = fileName;
1141CString rv = m_Daddy->m_TFTPRoot; 1149CString rv = m_Daddy->m_TFTPRoot;
1142 if(rv.IsEmpty()) 1150 if(rv.IsEmpty())
1143 rv = "."; 1151 rv = ".";
1144 if(rv[rv.GetLength()-1]!='\\') 1152 if(rv[rv.GetLength()-1]!='\\')
1145 rv+="\\"; 1153 rv+="\\";
1146 while((!fn.IsEmpty()) && fn[0]=='\\') 1154 while((!fn.IsEmpty()) && fn[0]=='\\')
1147 fn=fn.Mid(1); 1155 fn=fn.Mid(1);
1148 rv+=fn; 1156 rv+=fn;
1149 return rv; 1157 return rv;
1150} 1158}
1151 1159
1152void CPumpKINDlg::OnOptions() 1160void CPumpKINDlg::OnOptions()
1153{ 1161{
1154CPropertySheet cps(IDS_TITLE_OPTIONS,this); 1162CPropertySheet cps(IDS_TITLE_OPTIONS,this);
1155CPropsServer server; 1163CPropsServer server;
1156CPropsNetwork network; 1164CPropsNetwork network;
1157CPropsSounds sounds; 1165CPropsSounds sounds;
1158 1166
1159 server.m_RRQMode=m_RRQMode; 1167 server.m_RRQMode=m_RRQMode;
1160 server.m_TFTPRoot=m_TFTPRoot; 1168 server.m_TFTPRoot=m_TFTPRoot;
1161 server.m_TFTPSubdirs=m_bTFTPSubdirs; 1169 server.m_TFTPSubdirs=m_bTFTPSubdirs;
1162 server.m_WRQMode=m_WRQMode; 1170 server.m_WRQMode=m_WRQMode;
1163 server.m_PromptTimeOut=m_PromptTimeOut; 1171 server.m_PromptTimeOut=m_PromptTimeOut;
1164 1172
1165 network.m_ListenPort=m_ListenPort; 1173 network.m_ListenPort=m_ListenPort;
1166 network.m_SpeakPort=m_SpeakPort; 1174 network.m_SpeakPort=m_SpeakPort;
1167 network.m_TimeOut=m_TFTPTimeOut.GetTotalSeconds(); 1175 network.m_TimeOut=m_TFTPTimeOut.GetTotalSeconds();
1168 network.m_BlockSize=m_BlockSize; 1176 network.m_BlockSize=m_BlockSize;
1169 1177
1170 sounds.m_Request = m_bnwRequest; 1178 sounds.m_Request = m_bnwRequest;
1171 sounds.m_Success = m_bnwSuccess; 1179 sounds.m_Success = m_bnwSuccess;
1172 sounds.m_Abort = m_bnwAbort; 1180 sounds.m_Abort = m_bnwAbort;
1173 1181
1174 cps.AddPage(&server); 1182 cps.AddPage(&server);
1175 cps.AddPage(&network); 1183 cps.AddPage(&network);
1176 cps.AddPage(&sounds); 1184 cps.AddPage(&sounds);
1177 if(cps.DoModal()==IDOK){ 1185 if(cps.DoModal()==IDOK){
1178 m_RRQMode=server.m_RRQMode; 1186 m_RRQMode=server.m_RRQMode;
1179 m_TFTPRoot=server.m_TFTPRoot; 1187 m_TFTPRoot=server.m_TFTPRoot;
1180 m_bTFTPSubdirs=server.m_TFTPSubdirs; 1188 m_bTFTPSubdirs=server.m_TFTPSubdirs;
1181 m_WRQMode=server.m_WRQMode; 1189 m_WRQMode=server.m_WRQMode;
1182 m_PromptTimeOut=server.m_PromptTimeOut; 1190 m_PromptTimeOut=server.m_PromptTimeOut;
1183 1191
1184 m_ListenPort=network.m_ListenPort; 1192 m_ListenPort=network.m_ListenPort;
1185 m_SpeakPort=network.m_SpeakPort; 1193 m_SpeakPort=network.m_SpeakPort;
1186 m_TFTPTimeOut=CTimeSpan(network.m_TimeOut); 1194 m_TFTPTimeOut=CTimeSpan(network.m_TimeOut);
1187 m_BlockSize=network.m_BlockSize; 1195 m_BlockSize=network.m_BlockSize;
1188 1196
1189 m_bnwRequest = sounds.m_Request; 1197 m_bnwRequest = sounds.m_Request;
1190 m_bnwSuccess = sounds.m_Success; 1198 m_bnwSuccess = sounds.m_Success;
1191 m_bnwAbort = sounds.m_Abort; 1199 m_bnwAbort = sounds.m_Abort;
1192 } 1200 }
1193} 1201}
1194 1202
1195BOOL CRRQSocket::ConfirmRequest() 1203BOOL CRRQSocket::ConfirmRequest()
1196{ 1204{
1197CConfirmRRQDlg cd(NULL); 1205CConfirmRRQDlg cd(NULL);
1198 cd.m_Daddy=this; 1206 cd.m_Daddy=this;
1199 cd.m_File=m_FileName; 1207 cd.m_File=m_FileName;
1200 cd.m_Host=inet_ntoa(m_Peer.sin_addr); 1208 cd.m_Host=inet_ntoa(m_Peer.sin_addr);
1201 if(cd.DoModal()==IDOK) 1209 if(cd.DoModal()==IDOK)
1202 return TRUE; 1210 return TRUE;
1203 return FALSE; 1211 return FALSE;
1204} 1212}
1205 1213
1206CWRQSocket::CWRQSocket(CPumpKINDlg* daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin) 1214CWRQSocket::CWRQSocket(CPumpKINDlg* daddy,LPCTSTR fileName,LPCTSTR type,SOCKADDR_IN *sin)
1207 : CXferSocket(daddy,fileName,type,sin) 1215 : CXferSocket(daddy,fileName,type,sin)
1208{ 1216{
1209 state=stateNone; 1217 state=stateNone;
1210 m_ACK=0; 1218 m_ACK=0;
1211 m_LastSlack=0; 1219 m_LastSlack=0;
1212 m_bResume=FALSE; 1220 m_bResume=FALSE;
1213} 1221}
1214 1222
1215BOOL CWRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName) 1223BOOL CWRQSocket::Create(LPCTSTR localFile,LPCTSTR hostName)
1216{ 1224{
1217 if(!CAsyncSocket::Create(0,SOCK_DGRAM)) 1225 if(!CAsyncSocket::Create(0,SOCK_DGRAM))
1218 return FALSE; 1226 return FALSE;
1219 ASSERT(m_Daddy); 1227 ASSERT(m_Daddy);
1220 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName); 1228 ASSERT(m_Peer.sin_addr.s_addr!=INADDR_NONE || hostName);
1221 m_Daddy->m_Xfers[m_hSocket]=this; 1229 m_Daddy->m_Xfers[m_hSocket]=this;
1222 UpdateList(); 1230 UpdateList();
1223CString lf; 1231CString lf;
1224 if(!localFile) { 1232 if(!localFile) {
1225 lf = m_FileName; 1233 lf = m_FileName;
1226 TurnSlashes(lf,TRUE); 1234 TurnSlashes(lf,TRUE);
1227 } 1235 }
1228CString fn = localFile?ApplyRootGently(localFile):ApplyRoot(lf); 1236CString fn = localFile?ApplyRootGently(localFile):ApplyRoot(lf);
1229 if(!localFile){// This is an incoming request.. 1237 if(!localFile){// This is an incoming request..
1230 if(CheckBadRelativeness(m_FileName)){ 1238 if(CheckBadRelativeness(m_FileName)){
1231 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS); 1239 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS);
1232 return TRUE; 1240 return TRUE;
1233 } 1241 }
1234 BOOL exists; 1242 BOOL exists;
1235 if(!_access((LPCTSTR)fn,0)) 1243 if(!_access((LPCTSTR)fn,0))
1236 m_Rename=exists=TRUE; 1244 m_Rename=exists=TRUE;
1237 else 1245 else
1238 m_Rename=exists=FALSE; 1246 m_Rename=exists=FALSE;
1239 // *** m_WRQMode only if server transfer 1247 // *** m_WRQMode only if server transfer
1240 switch(m_Daddy->m_WRQMode){ 1248 switch(m_Daddy->m_WRQMode){
1241 case CPumpKINDlg::wrqTakeAll: 1249 case CPumpKINDlg::wrqTakeAll:
1242 if(exists){ 1250 if(exists){
1243 if(!RenameFile(fn)){ 1251 if(!RenameFile(fn)){
1244 Deny(tftp::errDiskFull,IDS_TFTP_ERROR_FAILEDTORENAME); 1252 Deny(tftp::errDiskFull,IDS_TFTP_ERROR_FAILEDTORENAME);
1245 return TRUE; 1253 return TRUE;
1246 } 1254 }
1247 } 1255 }
1248 break; 1256 break;
1249 case CPumpKINDlg::wrqConfirmIfExists: 1257 case CPumpKINDlg::wrqConfirmIfExists:
1250 if(!exists) 1258 if(!exists)
1251 break; 1259 break;
1252 case CPumpKINDlg::wrqAlwaysConfirm: 1260 case CPumpKINDlg::wrqAlwaysConfirm:
1253 if(exists) 1261 if(exists)
1254 m_bResume=TRUE; 1262 m_bResume=TRUE;
1255 if(ConfirmRequest()){ 1263 if(ConfirmRequest()){
1256 if(m_Rename){ 1264 if(m_Rename){
1257 RenameFile(fn); 1265 RenameFile(fn);
1258 if(SaveAs(fn)) 1266 if(SaveAs(fn))
1259 break; 1267 break;
1260 }else 1268 }else
1261 break; 1269 break;
1262 } 1270 }
1263 case CPumpKINDlg::wrqDenyAll: 1271 case CPumpKINDlg::wrqDenyAll:
1264 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS); 1272 Deny(tftp::errAccessViolation,IDS_TFTP_ERROR_ACCESS);
1265 return TRUE; 1273 return TRUE;
1266 } 1274 }
1267 } 1275 }
1268CFileException e; 1276CFileException e;
1269 if(!m_File.Open( 1277 if(!m_File.Open(
1270 fn, 1278 fn,
1271 m_bResume 1279 m_bResume
1272 ?(CFile::modeWrite|CFile::shareDenyWrite) 1280 ?(CFile::modeWrite|CFile::shareDenyWrite)
1273 :(CFile::modeCreate|CFile::modeWrite|CFile::shareDenyWrite), 1281 :(CFile::modeCreate|CFile::modeWrite|CFile::shareDenyWrite),
1274 &e 1282 &e
1275 )){ 1283 )){
1276 if(localFile){// Outgoing request 1284 if(localFile){// Outgoing request
1277 CString tmp; 1285 CString tmp;
1278 tmp.Format(IDS_LOG_FAILEDTOOPEN,fn); 1286 tmp.Format(IDS_LOG_FAILEDTOOPEN,fn);
1279 m_Daddy->LogLine(tmp); 1287 m_Daddy->LogLine(tmp);
1280 return FALSE; 1288 return FALSE;
1281 }else{ 1289 }else{
1282 Deny(&e); 1290 Deny(&e);
1283 return TRUE; 1291 return TRUE;
1284 } 1292 }
1285 } 1293 }
1286 if(hostName){ 1294 if(hostName){
1287 m_HostName=hostName; 1295 m_HostName=hostName;
1288 1296
1289 CString tmp; 1297 CString tmp;
1290 tmp.Format(IDS_LOG_REQUESTING,m_FileName,m_HostName); 1298 tmp.Format(IDS_LOG_REQUESTING,m_FileName,m_HostName);
1291 m_Daddy->LogLine(tmp); 1299 m_Daddy->LogLine(tmp);
1292 1300
1293 CString inAddr = hostName; 1301 CString inAddr = hostName;
1294 int at = inAddr.Find('@'); 1302 int at = inAddr.Find('@');
1295 if(at>=0) 1303 if(at>=0)
1296 inAddr=inAddr.Mid(at+1); 1304 inAddr=inAddr.Mid(at+1);
1297 if((m_Peer.sin_addr.s_addr=inet_addr((LPCTSTR)inAddr))==INADDR_NONE){ 1305 if((m_Peer.sin_addr.s_addr=inet_addr((LPCTSTR)inAddr))==INADDR_NONE){
1298 ASSERT(!m_wndResolver); 1306 ASSERT(!m_wndResolver);
1299 m_wndResolver = new CResolver(this); 1307 m_wndResolver = new CResolver(this);
1300 ASSERT(m_wndResolver); 1308 ASSERT(m_wndResolver);
1301 return m_wndResolver->Resolve(); 1309 return m_wndResolver->Resolve();
1302 }else{ 1310 }else{
1303 OnHostKnown(); 1311 OnHostKnown();
1304 return TRUE; 1312 return TRUE;
1305 } 1313 }
1306 } 1314 }
1307CString v; 1315CString v;
1308tftp::tftpOptions oack; 1316tftp::tftpOptions oack;
1309 if(m_Options.Lookup(tftpoTSize,v)){ 1317 if(m_Options.Lookup(tftpoTSize,v)){
1310 m_xferSize=atol(v); 1318 m_xferSize=atol(v);
1311 if(!m_xferSize){ 1319 if(!m_xferSize){
1312 Deny(tftp::errOption,IDS_TFTP_ERROR_TSIZE); 1320 Deny(tftp::errOption,IDS_TFTP_ERROR_TSIZE);
1313 return TRUE; 1321 return TRUE;
1314 } 1322 }
1315 } 1323 }
1316 if(m_Options.Lookup(tftpoBSize,v)){ 1324 if(m_Options.Lookup(tftpoBSize,v)){
1317 m_blkSize=atoi(v); 1325 m_blkSize=atoi(v);
1318 if(!m_blkSize){// *** Do more about sanity check 1326 if(!m_blkSize){// *** Do more about sanity check
1319 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE); 1327 Deny(tftp::errOption,IDS_TFTP_ERROR_BSIZE);
1320 return TRUE; 1328 return TRUE;
1321 } 1329 }
1322 v.Format("%u",m_blkSize); 1330 v.Format("%u",m_blkSize);
1323 oack[tftpoBSize]=v; 1331 oack[tftpoBSize]=v;
1324 } 1332 }
1325 if(m_Options.Lookup(tftpoTOut,v)){ 1333 if(m_Options.Lookup(tftpoTOut,v)){
1326 m_timeOut=atoi(v); 1334 m_timeOut=atoi(v);
1327 if(!m_timeOut){// *** Do more about sanity check 1335 if(!m_timeOut){// *** Do more about sanity check
1328 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT); 1336 Deny(tftp::errOption,IDS_TFTP_ERROR_TOUT);
1329 return TRUE; 1337 return TRUE;
1330 } 1338 }
1331 v.Format("%u",m_timeOut); 1339 v.Format("%u",m_timeOut);
1332 oack[tftpoTOut]=v; 1340 oack[tftpoTOut]=v;
1333 } 1341 }
1334 if(m_Options.Lookup(tftpoXResume,v) && m_bResume){ 1342 if(m_Options.Lookup(tftpoXResume,v) && m_bResume){
1335 m_ACK=m_File.GetLength()/m_blkSize; 1343 m_ACK=m_File.GetLength()/m_blkSize;
1336 v.Format("%u",m_ACK); 1344 v.Format("%u",m_ACK);
1337 oack[tftpoXResume]=v; 1345 oack[tftpoXResume]=v;
1338 }else 1346 }else
1339 m_ACK=0; 1347 m_ACK=0;
1340 state=stateXfer; 1348 state=stateXfer;
1341 if(oack.GetCount()){ 1349 if(oack.GetCount()){
1342 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&oack)); 1350 tftp *p = tftp::Allocate(tftp::tftpOACK::tftpSize(&oack));
1343 ASSERT(p); 1351 ASSERT(p);
1344 p->SetOpcode(tftp::opOACK); 1352 p->SetOpcode(tftp::opOACK);
1345 p->data.m_OACK.Set(&oack); 1353 p->data.m_OACK.Set(&oack);
1346 PostTFTP(p,TRUE); 1354 PostTFTP(p,TRUE);
1347 }else 1355 }else
1348 DoXfer(); 1356 DoXfer();
1349 return TRUE; 1357 return TRUE;
1350} 1358}
1351 1359
1352BOOL CWRQSocket::ConfirmRequest() 1360BOOL CWRQSocket::ConfirmRequest()
1353{ 1361{
1354CConfirmWRQDlg cd(NULL); 1362CConfirmWRQDlg cd(NULL);
1355 cd.m_Daddy=this; 1363 cd.m_Daddy=this;
1356 cd.m_File=m_FileName; 1364 cd.m_File=m_FileName;
1357 cd.m_Host=inet_ntoa(m_Peer.sin_addr); 1365 cd.m_Host=inet_ntoa(m_Peer.sin_addr);
1358 switch(cd.DoModal()){ 1366 switch(cd.DoModal()){
1359 case IDOK: 1367 case IDOK:
1360 m_Rename=FALSE; 1368 m_Rename=FALSE;
1361 m_bResume=FALSE; 1369 m_bResume=FALSE;
1362 return TRUE; 1370 return TRUE;
1363 case IDC_RENAME: 1371 case IDC_RENAME:
1364 m_bResume=FALSE; 1372 m_bResume=FALSE;
1365 m_Rename=TRUE; 1373 m_Rename=TRUE;
1366 return TRUE; 1374 return TRUE;
1367 case IDC_RESUME: 1375 case IDC_RESUME:
1368 m_Rename=FALSE; 1376 m_Rename=FALSE;
1369 m_bResume=TRUE; 1377 m_bResume=TRUE;
1370 return TRUE; 1378 return TRUE;
1371 case IDCANCEL: 1379 case IDCANCEL:
1372 return FALSE; 1380 return FALSE;
1373 } 1381 }
1374 return FALSE; 1382 return FALSE;
1375} 1383}
1376 1384
1377BOOL CWRQSocket::RenameFile(CString& fn) 1385BOOL CWRQSocket::RenameFile(CString& fn)
1378{ 1386{
1379CString renamed = fn; 1387CString renamed = fn;
1380 if(fn.IsEmpty()) 1388 if(fn.IsEmpty())
1381 return FALSE; 1389 return FALSE;
1382 if(fn[fn.GetLength()-1]==')'){ 1390 if(fn[fn.GetLength()-1]==')'){
1383 int op = fn.ReverseFind('('); 1391 int op = fn.ReverseFind('(');
1384 if(op>0 && fn[op-1]==' '){ 1392 if(op>0 && fn[op-1]==' '){
1385 if(fn.Mid(op+1,fn.GetLength()-op-2).SpanExcluding("0123456789").IsEmpty()) 1393 if(fn.Mid(op+1,fn.GetLength()-op-2).SpanExcluding("0123456789").IsEmpty())
1386 renamed = renamed.Left(op-1); 1394 renamed = renamed.Left(op-1);
1387 } 1395 }
1388 } 1396 }
1389CString testFN; 1397CString testFN;
1390 for(UINT tmp=0;tmp<32768;tmp++){ 1398 for(UINT tmp=0;tmp<32768;tmp++){
1391 testFN.Format("%s (%u)",(LPCTSTR)renamed,tmp); 1399 testFN.Format("%s (%u)",(LPCTSTR)renamed,tmp);
1392 if(!_access((LPCTSTR)testFN,0)) 1400 if(!_access((LPCTSTR)testFN,0))
1393 continue; 1401 continue;
1394 fn=testFN; 1402 fn=testFN;
1395 return TRUE; 1403 return TRUE;
1396 } 1404 }
1397 return FALSE; 1405 return FALSE;
1398} 1406}
1399 1407
1400BOOL CWRQSocket::SaveAs(CString& fn) 1408BOOL CWRQSocket::SaveAs(CString& fn)
1401{ 1409{
1402CFileDialog cfd(FALSE,NULL,fn,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,NULL,m_Daddy); 1410CFileDialog cfd(FALSE,NULL,fn,OFN_EXPLORER|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST,NULL,m_Daddy);
1403CString title; 1411CString title;
1404 title.LoadString(IDS_RENAME_TITLE); 1412 title.LoadString(IDS_RENAME_TITLE);
1405 cfd.m_ofn.lpstrTitle=(LPCTSTR)title; 1413 cfd.m_ofn.lpstrTitle=(LPCTSTR)title;
1406 if(cfd.DoModal()!=IDOK) 1414 if(cfd.DoModal()!=IDOK)
1407 return FALSE; 1415 return FALSE;
1408 fn = cfd.GetPathName(); 1416 fn = cfd.GetPathName();
1409 return TRUE; 1417 return TRUE;
1410} 1418}
1411 1419
1412void CWRQSocket::DoXfer() 1420void CWRQSocket::DoXfer()
1413{ 1421{
1414tftp *p = tftp::Allocate(tftp::tftpACK::tftpSize()); 1422tftp *p = tftp::Allocate(tftp::tftpACK::tftpSize());
1415 ASSERT(p); 1423 ASSERT(p);
1416 p->SetOpcode(tftp::opACK); 1424 p->SetOpcode(tftp::opACK);
1417 p->data.m_ACK.SetBlock(m_ACK); 1425 p->data.m_ACK.SetBlock(m_ACK);
1418 TRACE1("WRQ-ACK-%u\n",m_ACK); 1426 TRACE1("WRQ-ACK-%u\n",m_ACK);
1419 PostTFTP(p,TRUE);// *** ??? Hope this is right 1427 PostTFTP(p,TRUE);// *** ??? Hope this is right
1420} 1428}
1421 1429
1422UINT tftp::tftpACK::tftpSize() 1430UINT tftp::tftpACK::tftpSize()
1423{ 1431{
1424 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpACK); 1432 return tftpHdrSize-tftpSlackSize+sizeof(tftp::tftpACK);
1425} 1433}
1426 1434
1427ULONG CWRQSocket::GetACK() 1435ULONG CWRQSocket::GetACK()
1428{ 1436{
1429 return (m_ACK*m_blkSize)-m_LastSlack; 1437 return (m_ACK*m_blkSize)-m_LastSlack;
1430} 1438}
1431 1439
1432void CXferSocket::ResetTimeout() 1440void CXferSocket::ResetTimeout()
1433{ 1441{
1434 ASSERT(m_Daddy); 1442 ASSERT(m_Daddy);
1435 m_Daddy->m_Retrier->KillTimer(m_hSocket); 1443 m_Daddy->m_Retrier->KillTimer(m_hSocket);
1436 if(m_Retry) 1444 if(m_Retry)
1437 m_Daddy->m_Retrier->SetTimer(m_hSocket,min(60,m_Daddy->m_RetryTimeOut.GetTotalSeconds())*1000,NULL); 1445 m_Daddy->m_Retrier->SetTimer(m_hSocket,min(60,m_Daddy->m_RetryTimeOut.GetTotalSeconds())*1000,NULL);
1438 if(!m_bRetry){ 1446 if(!m_bRetry){
1439 m_Daddy->KillTimer(m_hSocket); 1447 m_Daddy->KillTimer(m_hSocket);
1440 m_Daddy->SetTimer(m_hSocket,min(60,m_timeOut)*1000,NULL); 1448 m_Daddy->SetTimer(m_hSocket,min(60,m_timeOut)*1000,NULL);
1441 } 1449 }
1442} 1450}
1443 1451
1444void CXferSocket::Abort() 1452void CXferSocket::Abort()
1445{ 1453{
1446 ASSERT(m_Daddy); 1454 ASSERT(m_Daddy);
1447CString tmp; 1455CString tmp;
1448 tmp.Format(IDS_LOG_XFERABORTED,(LPCTSTR)m_FileName); 1456 tmp.Format(IDS_LOG_XFERABORTED,(LPCTSTR)m_FileName);
1449 m_Daddy->LogLine(tmp); 1457 m_Daddy->LogLine(tmp);
1450 Destroy(FALSE); 1458 Destroy(FALSE);
1451} 1459}
1452 1460
1453void CPumpKINDlg::OnTimer(UINT nIDEvent) 1461void CPumpKINDlg::OnTimer(UINT nIDEvent)
1454{ 1462{
1455CXferSocket *socket; 1463CXferSocket *socket;
1456 if(m_Xfers.Lookup(nIDEvent,socket)){ 1464 if(m_Xfers.Lookup(nIDEvent,socket)){
1457 CString tmp; 1465 CString tmp;
1458 tmp.Format(IDS_LOG_TIMEDOUT,socket->m_FileName); 1466 tmp.Format(IDS_LOG_TIMEDOUT,socket->m_FileName);
1459 LogLine(tmp); 1467 LogLine(tmp);
1460 socket->Abort(); 1468 socket->Abort();
1461 }else{ 1469 }else{
1462 TRACE0("Failed to find timed out socket!\n"); 1470 TRACE0("Failed to find timed out socket!\n");
1463 } 1471 }
1464 CDialog::OnTimer(nIDEvent); 1472 CDialog::OnTimer(nIDEvent);
1465} 1473}
1466 1474
1467void CPumpKINDlg::OnExit() 1475void CPumpKINDlg::OnExit()
1468{ 1476{
1469 if(!m_Xfers.IsEmpty()){ 1477 if(!m_Xfers.IsEmpty()){
1470 CString title,text; 1478 CString title,text;
1471 title.LoadString(IDS_CONFIRMEXIT_TITLE); 1479 title.LoadString(IDS_CONFIRMEXIT_TITLE);
1472 text.LoadString(IDS_CONFIRMEXIT_TEXT); 1480 text.LoadString(IDS_CONFIRMEXIT_TEXT);
1473 if(MessageBox(text,title,MB_ICONQUESTION|MB_YESNO)!=IDYES) 1481 if(MessageBox(text,title,MB_ICONQUESTION|MB_YESNO)!=IDYES)
1474 return; 1482 return;
1475 } 1483 }
1476 m_bExiting=TRUE; 1484 m_bExiting=TRUE;
1477 EndDialog(IDOK); 1485 EndDialog(IDOK);
1478} 1486}
1479 1487
1480void CPumpKINDlg::OnPut() 1488void CPumpKINDlg::OnPut()
1481{ 1489{
1482CRequestDlg crd(NULL); 1490CRequestDlg crd(NULL);
1483 crd.m_Put=TRUE; 1491 crd.m_Put=TRUE;
1484 crd.m_BSize=m_BlockSize; 1492 crd.m_BSize=m_BlockSize;
1485 if(crd.DoModal()==IDOK){ 1493 if(crd.DoModal()==IDOK){
1486 CRRQSocket *socket = new CRRQSocket(this,crd.m_RemoteFile,crd.m_Type,NULL); 1494 CRRQSocket *socket = new CRRQSocket(this,crd.m_RemoteFile,crd.m_Type,NULL);
1487 if(crd.m_BSize) 1495 if(crd.m_BSize)
1488 socket->m__blkSize=crd.m_BSize; 1496 socket->m__blkSize=crd.m_BSize;
1489 if(!socket->Create(crd.m_LocalFile,crd.m_Host)) 1497 if(!socket->Create(crd.m_LocalFile,crd.m_Host))
1490 socket->Destroy(); 1498 socket->Destroy();
1491 } 1499 }
1492} 1500}
1493 1501
1494void CPumpKINDlg::OnGet() 1502void CPumpKINDlg::OnGet()
1495{ 1503{
1496CRequestDlg crd(NULL); 1504CRequestDlg crd(NULL);
1497 crd.m_Put=FALSE; 1505 crd.m_Put=FALSE;
1498 crd.m_BSize=m_BlockSize; 1506 crd.m_BSize=m_BlockSize;
1499 if(crd.DoModal()==IDOK){ 1507 if(crd.DoModal()==IDOK){
1500 CWRQSocket *socket = new CWRQSocket(this,crd.m_RemoteFile,crd.m_Type,NULL); 1508 CWRQSocket *socket = new CWRQSocket(this,crd.m_RemoteFile,crd.m_Type,NULL);
1501 if(crd.m_BSize) 1509 if(crd.m_BSize)
1502 socket->m__blkSize=crd.m_BSize; 1510 socket->m__blkSize=crd.m_BSize;
1503 if(!socket->Create(crd.m_LocalFile,crd.m_Host)) 1511 if(!socket->Create(crd.m_LocalFile,crd.m_Host))
1504 socket->Destroy(); 1512 socket->Destroy();
1505 } 1513 }
1506} 1514}
1507 1515
1508void CPumpKINDlg::SetupButtons() 1516void CPumpKINDlg::SetupButtons()
1509{ 1517{
1510 m_AbortCtl.EnableWindow(m_List.GetSelectedCount()>0); 1518 m_AbortCtl.EnableWindow(m_List.GetSelectedCount()>0);
1511} 1519}
1512 1520
1513void CPumpKINDlg::OnDeleteallitemsConnections(NMHDR* pNMHDR, LRESULT* pResult) 1521void CPumpKINDlg::OnDeleteallitemsConnections(NMHDR* pNMHDR, LRESULT* pResult)
1514{ 1522{
1515 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 1523 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
1516 SetupButtons(); 1524 SetupButtons();
1517 *pResult = 0; 1525 *pResult = 0;
1518} 1526}
1519 1527
1520void CPumpKINDlg::OnDeleteitemConnections(NMHDR* pNMHDR, LRESULT* pResult) 1528void CPumpKINDlg::OnDeleteitemConnections(NMHDR* pNMHDR, LRESULT* pResult)
1521{ 1529{
1522 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 1530 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
1523 SetupButtons(); 1531 SetupButtons();
1524 *pResult = 0; 1532 *pResult = 0;
1525} 1533}
1526 1534
1527void CPumpKINDlg::OnInsertitemConnections(NMHDR* pNMHDR, LRESULT* pResult) 1535void CPumpKINDlg::OnInsertitemConnections(NMHDR* pNMHDR, LRESULT* pResult)
1528{ 1536{
1529 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 1537 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
1530 SetupButtons(); 1538 SetupButtons();
1531 *pResult = 0; 1539 *pResult = 0;
1532} 1540}
1533 1541
1534void CPumpKINDlg::OnItemchangedConnections(NMHDR* pNMHDR, LRESULT* pResult) 1542void CPumpKINDlg::OnItemchangedConnections(NMHDR* pNMHDR, LRESULT* pResult)
1535{ 1543{
1536 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; 1544 NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
1537 SetupButtons(); 1545 SetupButtons();
1538 *pResult = 0; 1546 *pResult = 0;
1539} 1547}
1540 1548
1541void CPumpKINDlg::OnAbort() 1549void CPumpKINDlg::OnAbort()
1542{ 1550{
1543 if(!m_List.GetSelectedCount()) 1551 if(!m_List.GetSelectedCount())
1544 return; 1552 return;
1545 intitems = m_List.GetItemCount(); 1553 intitems = m_List.GetItemCount();
1546 for(int tmp=0;tmp<items;tmp++){ 1554 for(int tmp=0;tmp<items;tmp++){
1547 if(!(m_List.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED)) 1555 if(!(m_List.GetItemState(tmp,LVIS_SELECTED)&LVIS_SELECTED))
1548 continue; 1556 continue;
1549 CXferSocket *xfer = (CXferSocket*) m_List.GetItemData(tmp); 1557 CXferSocket *xfer = (CXferSocket*) m_List.GetItemData(tmp);
1550 ASSERT(xfer); 1558 ASSERT(xfer);
1551 xfer->Abort(); 1559 xfer->Abort();
1552 } 1560 }
1553} 1561}
1554 1562
1555void CXferSocket::OnFailedToResolve() 1563void CXferSocket::OnFailedToResolve()
1556{ 1564{
1557 TRACE0("Resolve failed\n"); 1565 TRACE0("Resolve failed\n");
1558 delete m_wndResolver; 1566 delete m_wndResolver;
1559 m_wndResolver=NULL; 1567 m_wndResolver=NULL;
1560 ASSERT(m_Daddy); 1568 ASSERT(m_Daddy);
1561CString tmp; 1569CString tmp;
1562 tmp.Format(IDS_LOG_RESOLVEFAILED,m_HostName); 1570 tmp.Format(IDS_LOG_RESOLVEFAILED,m_HostName);
1563 m_Daddy->LogLine(tmp); 1571 m_Daddy->LogLine(tmp);
1564 Abort(); 1572 Abort();
1565} 1573}
1566 1574
1567void CXferSocket::OnResolved() 1575void CXferSocket::OnResolved()
1568{ 1576{
1569 delete m_wndResolver; 1577 delete m_wndResolver;
1570 m_wndResolver=NULL; 1578 m_wndResolver=NULL;
1571 TRACE0("Resolved\n"); 1579 TRACE0("Resolved\n");
1572 m_Peer.sin_addr.s_addr = *(DWORD*)(((hostent*)m_ResolveBuff)->h_addr); 1580 m_Peer.sin_addr.s_addr = *(DWORD*)(((hostent*)m_ResolveBuff)->h_addr);
1573} 1581}
1574 1582
1575void CRRQSocket::OnResolved() 1583void CRRQSocket::OnResolved()
1576{ 1584{
1577 CXferSocket::OnResolved(); 1585 CXferSocket::OnResolved();
1578 OnHostKnown(); 1586 OnHostKnown();
1579} 1587}
1580 1588
1581void CRRQSocket::OnHostKnown() 1589void CRRQSocket::OnHostKnown()
1582{ 1590{
1583 ASSERT(m_Daddy); 1591 ASSERT(m_Daddy);
1584 m_Peer.sin_port=htons(m_Daddy->m_SpeakPort); 1592 m_Peer.sin_port=htons(m_Daddy->m_SpeakPort);
1585tftp::tftpOptions o; 1593tftp::tftpOptions o;
1586CString v; 1594CString v;
1587 ASSERT(m_xferSize>=0); 1595 ASSERT(m_xferSize>=0);
1588 v.Format("%lu",m_xferSize); 1596 v.Format("%lu",m_xferSize);
1589 o[tftpoTSize] = v; 1597 o[tftpoTSize] = v;
1590 ASSERT(m__blkSize); 1598 ASSERT(m__blkSize);
1591 v.Format("%u",m__blkSize); 1599 v.Format("%u",m__blkSize);
1592 o[tftpoBSize] = v; 1600 o[tftpoBSize] = v;
1593 ASSERT(m__timeOut); 1601 ASSERT(m__timeOut);
1594 v.Format("%u",m__timeOut); 1602 v.Format("%u",m__timeOut);
1595 o[tftpoTOut] = v; 1603 o[tftpoTOut] = v;
1596 o[tftpoXResume] = "0"; 1604 o[tftpoXResume] = "0";
1597 tftp*p = tftp::Allocate(tftp::tftpWRQ::tftpSize(m_FileName,m_Type,&o)); 1605 tftp*p = tftp::Allocate(tftp::tftpWRQ::tftpSize(m_FileName,m_Type,&o));
1598 ASSERT(p); 1606 ASSERT(p);
1599 p->SetOpcode(tftp::opWRQ); 1607 p->SetOpcode(tftp::opWRQ);
1600 p->data.m_WRQ.Set(m_FileName,m_Type,&o); 1608 p->data.m_WRQ.Set(m_FileName,m_Type,&o);
1601 PostTFTP(p,TRUE); 1609 PostTFTP(p,TRUE);
1602 state=stateInit; 1610 state=stateInit;
1603 UpdateList(); 1611 UpdateList();
1604} 1612}
1605 1613
1606UINT tftp::tftpRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1614UINT tftp::tftpRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1607{ 1615{
1608UINT rv = tftpHdrSize-tftpSlackSize+strlen(file)+1+strlen(type)+1; 1616UINT rv = tftpHdrSize-tftpSlackSize+strlen(file)+1+strlen(type)+1;
1609 if(ops){ 1617 if(ops){
1610 tftpOptions& o = *ops; 1618 tftpOptions& o = *ops;
1611 POSITION p = o.GetStartPosition(); 1619 POSITION p = o.GetStartPosition();
1612 while(p){ 1620 while(p){
1613 CString n,v; 1621 CString n,v;
1614 o.GetNextAssoc(p,n,v); 1622 o.GetNextAssoc(p,n,v);
1615 rv+=n.GetLength()+1+v.GetLength()+1; 1623 rv+=n.GetLength()+1+v.GetLength()+1;
1616 } 1624 }
1617 } 1625 }
1618 return rv; 1626 return rv;
1619} 1627}
1620UINT tftp::tftpRRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1628UINT tftp::tftpRRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1621{ 1629{
1622 return tftp::tftpRQ::tftpSize(file,type,ops); 1630 return tftp::tftpRQ::tftpSize(file,type,ops);
1623} 1631}
1624UINT tftp::tftpWRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1632UINT tftp::tftpWRQ::tftpSize(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1625{ 1633{
1626 return tftp::tftpRQ::tftpSize(file,type,ops); 1634 return tftp::tftpRQ::tftpSize(file,type,ops);
1627} 1635}
1628UINT tftp::tftpOACK::tftpSize(tftp::tftpOptions* ops) 1636UINT tftp::tftpOACK::tftpSize(tftp::tftpOptions* ops)
1629{ 1637{
1630UINT rv = tftpHdrSize-tftpSlackSize; 1638UINT rv = tftpHdrSize-tftpSlackSize;
1631 if(ops){ 1639 if(ops){
1632 tftpOptions& o = *ops; 1640 tftpOptions& o = *ops;
1633 POSITION p = o.GetStartPosition(); 1641 POSITION p = o.GetStartPosition();
1634 while(p){ 1642 while(p){
1635 CString n,v; 1643 CString n,v;
1636 o.GetNextAssoc(p,n,v); 1644 o.GetNextAssoc(p,n,v);
1637 rv+=n.GetLength()+1+v.GetLength()+1; 1645 rv+=n.GetLength()+1+v.GetLength()+1;
1638 } 1646 }
1639 } 1647 }
1640 return rv; 1648 return rv;
1641} 1649}
1642void tftp::tftpRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1650void tftp::tftpRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1643{ 1651{
1644 // MAY BE DANGEROUS! 1652 // MAY BE DANGEROUS!
1645UINT ptr = 0; 1653UINT ptr = 0;
1646 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1; 1654 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1;
1647 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1; 1655 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1;
1648 if(ops){ 1656 if(ops){
1649 tftpOptions& o = *ops; 1657 tftpOptions& o = *ops;
1650 POSITION p = o.GetStartPosition(); 1658 POSITION p = o.GetStartPosition();
1651 while(p){ 1659 while(p){
1652 CString n,v; 1660 CString n,v;
1653 o.GetNextAssoc(p,n,v); 1661 o.GetNextAssoc(p,n,v);
1654 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1; 1662 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1;
1655 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1; 1663 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1;
1656 } 1664 }
1657 } 1665 }
1658} 1666}
1659void tftp::tftpRRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1667void tftp::tftpRRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1660{ 1668{
1661 // MAY BE DANGEROUS! 1669 // MAY BE DANGEROUS!
1662UINT ptr = 0; 1670UINT ptr = 0;
1663 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1; 1671 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1;
1664 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1; 1672 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1;
1665 if(ops){ 1673 if(ops){
1666 tftpOptions& o = *ops; 1674 tftpOptions& o = *ops;
1667 POSITION p = o.GetStartPosition(); 1675 POSITION p = o.GetStartPosition();
1668 while(p){ 1676 while(p){
1669 CString n,v; 1677 CString n,v;
1670 o.GetNextAssoc(p,n,v); 1678 o.GetNextAssoc(p,n,v);
1671 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1; 1679 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1;
1672 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1; 1680 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1;
1673 } 1681 }
1674 } 1682 }
1675} 1683}
1676void tftp::tftpWRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops) 1684void tftp::tftpWRQ::Set(LPCTSTR file,LPCTSTR type,tftp::tftpOptions* ops)
1677{ 1685{
1678 // MAY BE DANGEROUS! 1686 // MAY BE DANGEROUS!
1679UINT ptr = 0; 1687UINT ptr = 0;
1680 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1; 1688 strcpy((LPTSTR)&data[ptr],file); ptr+=strlen(file)+1;
1681 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1; 1689 strcpy((LPTSTR)&data[ptr],type); ptr+=strlen(type)+1;
1682 if(ops){ 1690 if(ops){
1683 tftpOptions& o = *ops; 1691 tftpOptions& o = *ops;
1684 POSITION p = o.GetStartPosition(); 1692 POSITION p = o.GetStartPosition();
1685 while(p){ 1693 while(p){
1686 CString n,v; 1694 CString n,v;
1687 o.GetNextAssoc(p,n,v); 1695 o.GetNextAssoc(p,n,v);
1688 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1; 1696 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1;
1689 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1; 1697 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1;
1690 } 1698 }
1691 } 1699 }
1692} 1700}
1693void tftp::tftpOACK::Set(tftpOptions* ops) 1701void tftp::tftpOACK::Set(tftpOptions* ops)
1694{ 1702{
1695 ASSERT(ops); 1703 ASSERT(ops);
1696UINT ptr = 0; 1704UINT ptr = 0;
1697tftpOptions& o = *ops; 1705tftpOptions& o = *ops;
1698POSITION p = o.GetStartPosition(); 1706POSITION p = o.GetStartPosition();
1699 while(p){ 1707 while(p){
1700 CString n,v; 1708 CString n,v;
1701 o.GetNextAssoc(p,n,v); 1709 o.GetNextAssoc(p,n,v);
1702 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1; 1710 strcpy((LPTSTR)&data[ptr],(LPCTSTR)n); ptr+=n.GetLength()+1;
1703 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1; 1711 strcpy((LPTSTR)&data[ptr],(LPCTSTR)v); ptr+=v.GetLength()+1;
1704 } 1712 }
1705} 1713}
1706 1714
1707void CWRQSocket::OnResolved() 1715void CWRQSocket::OnResolved()
1708{ 1716{
1709 CXferSocket::OnResolved(); 1717 CXferSocket::OnResolved();
1710 OnHostKnown(); 1718 OnHostKnown();
1711} 1719}
1712 1720
1713void CWRQSocket::OnHostKnown() 1721void CWRQSocket::OnHostKnown()
1714{ 1722{
1715 ASSERT(m_Daddy); 1723 ASSERT(m_Daddy);
1716 m_Peer.sin_port=htons(m_Daddy->m_SpeakPort); 1724 m_Peer.sin_port=htons(m_Daddy->m_SpeakPort);
1717tftp::tftpOptions o; 1725tftp::tftpOptions o;
1718CString v; 1726CString v;
1719 o[tftpoTSize]="0"; 1727 o[tftpoTSize]="0";
1720 if(m__blkSize){ 1728 if(m__blkSize){
1721 v.Format("%u",m__blkSize); 1729 v.Format("%u",m__blkSize);
1722 o[tftpoBSize]=v; 1730 o[tftpoBSize]=v;
1723 } 1731 }
1724 if(m__timeOut){ 1732 if(m__timeOut){
1725 v.Format("%u",m__timeOut); 1733 v.Format("%u",m__timeOut);
1726 o[tftpoTOut]=v; 1734 o[tftpoTOut]=v;
1727 } 1735 }
1728 tftp*p = tftp::Allocate(tftp::tftpRRQ::tftpSize(m_FileName,m_Type,&o)); 1736 tftp*p = tftp::Allocate(tftp::tftpRRQ::tftpSize(m_FileName,m_Type,&o));
1729 ASSERT(p); 1737 ASSERT(p);
1730 p->SetOpcode(tftp::opRRQ); 1738 p->SetOpcode(tftp::opRRQ);
1731 p->data.m_RRQ.Set(m_FileName,m_Type,&o); 1739 p->data.m_RRQ.Set(m_FileName,m_Type,&o);
1732 PostTFTP(p,TRUE); 1740 PostTFTP(p,TRUE);
1733 state=stateInit; 1741 state=stateInit;
1734 UpdateList(); 1742 UpdateList();
1735} 1743}
1736 1744
1737void CPumpKINDlg::OnClose() 1745void CPumpKINDlg::OnClose()
1738{ 1746{
1739 OnTrayShowpumpkinwindow(); 1747 OnTrayShowpumpkinwindow();
1740} 1748}
1741 1749
1742void CPumpKINDlg::OnTrayShowpumpkinwindow() 1750void CPumpKINDlg::OnTrayShowpumpkinwindow()
1743{ 1751{
1744 if(IsWindowVisible()){ 1752 if(IsWindowVisible()){
1745 m_bShown=FALSE; 1753 m_bShown=FALSE;
1746 ShowWindow(SW_HIDE); 1754 ShowWindow(SW_HIDE);
1747 }else{ 1755 }else{
1748 m_bShown=TRUE; 1756 m_bShown=TRUE;
1749 ShowWindow(SW_SHOW); 1757 ShowWindow(SW_SHOW);
1750 SetForegroundWindow(); 1758 SetForegroundWindow();
1751 SetFocus(); 1759 SetFocus();
1752 } 1760 }
1753} 1761}
1754 1762
1755void CPumpKINDlg::OnTrayExit() 1763void CPumpKINDlg::OnTrayExit()
1756{ 1764{
1757 OnExit(); 1765 OnExit();
1758} 1766}
1759 1767
1760void CPumpKINDlg::OnTrayAboutpumpkin() 1768void CPumpKINDlg::OnTrayAboutpumpkin()
1761{ 1769{
1762CAboutDlg dlgAbout; 1770CAboutDlg dlgAbout;
1763 dlgAbout.DoModal(); 1771 dlgAbout.DoModal();
1764} 1772}
1765 1773
1766void CPumpKINDlg::OnTrayFetchfile() 1774void CPumpKINDlg::OnTrayFetchfile()
1767{ 1775{
1768 OnGet(); 1776 OnGet();
1769} 1777}
1770 1778
1771void CPumpKINDlg::OnTrayHelp() 1779void CPumpKINDlg::OnTrayHelp()
1772{ 1780{
1773 OnHelp(); 1781 OnHelp();
1774} 1782}
1775 1783
1776void CPumpKINDlg::OnTrayOptions() 1784void CPumpKINDlg::OnTrayOptions()
1777{ 1785{
1778 OnOptions(); 1786 OnOptions();
1779} 1787}
1780 1788
1781void CPumpKINDlg::OnTraySendfile() 1789void CPumpKINDlg::OnTraySendfile()
1782{ 1790{
1783 OnPut(); 1791 OnPut();
1784} 1792}
1785 1793
1786void CPumpKINDlg::LoadSettings() 1794void CPumpKINDlg::LoadSettings()
1787{ 1795{
1788CWinApp *app = AfxGetApp(); 1796CWinApp *app = AfxGetApp();
1789 ASSERT(app); 1797 ASSERT(app);
1790 m_bnwRequest=app->GetProfileString("BellsNWhistles","Request",m_bnwRequest); 1798 m_bnwRequest=app->GetProfileString("BellsNWhistles","Request",m_bnwRequest);
1791 m_bnwSuccess=app->GetProfileString("BellsNWhistles","Success",m_bnwSuccess); 1799 m_bnwSuccess=app->GetProfileString("BellsNWhistles","Success",m_bnwSuccess);
1792 m_bnwAbort=app->GetProfileString("BellsNWhistles","Abort",m_bnwAbort); 1800 m_bnwAbort=app->GetProfileString("BellsNWhistles","Abort",m_bnwAbort);
1793 m_bTFTPSubdirs=app->GetProfileInt("TFTPSettings","Subdirs",m_bTFTPSubdirs); 1801 m_bTFTPSubdirs=app->GetProfileInt("TFTPSettings","Subdirs",m_bTFTPSubdirs);
1794 m_ListenPort=app->GetProfileInt("TFTPSettings","ListenPort",m_ListenPort); 1802 m_ListenPort=app->GetProfileInt("TFTPSettings","ListenPort",m_ListenPort);
diff --git a/pumpkin.rc b/pumpkin.rc
index 7f3bbde..1bf0fd3 100644
--- a/pumpkin.rc
+++ b/pumpkin.rc
@@ -1,607 +1,607 @@
1//Microsoft Developer Studio generated resource script. 1//Microsoft Developer Studio generated resource script.
2// 2//
3#include "resource.h" 3#include "resource.h"
4 4
5#define APSTUDIO_READONLY_SYMBOLS 5#define APSTUDIO_READONLY_SYMBOLS
6///////////////////////////////////////////////////////////////////////////// 6/////////////////////////////////////////////////////////////////////////////
7// 7//
8// Generated from the TEXTINCLUDE 2 resource. 8// Generated from the TEXTINCLUDE 2 resource.
9// 9//
10#include "afxres.h" 10#include "afxres.h"
11 11
12///////////////////////////////////////////////////////////////////////////// 12/////////////////////////////////////////////////////////////////////////////
13#undef APSTUDIO_READONLY_SYMBOLS 13#undef APSTUDIO_READONLY_SYMBOLS
14 14
15///////////////////////////////////////////////////////////////////////////// 15/////////////////////////////////////////////////////////////////////////////
16// English (U.S.) resources 16// English (U.S.) resources
17 17
18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 18#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
19#ifdef _WIN32 19#ifdef _WIN32
20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21#pragma code_page(1252) 21#pragma code_page(1252)
22#endif //_WIN32 22#endif //_WIN32
23 23
24#ifdef APSTUDIO_INVOKED 24#ifdef APSTUDIO_INVOKED
25///////////////////////////////////////////////////////////////////////////// 25/////////////////////////////////////////////////////////////////////////////
26// 26//
27// TEXTINCLUDE 27// TEXTINCLUDE
28// 28//
29 29
301 TEXTINCLUDE DISCARDABLE 301 TEXTINCLUDE DISCARDABLE
31BEGIN 31BEGIN
32 "resource.h\0" 32 "resource.h\0"
33END 33END
34 34
352 TEXTINCLUDE DISCARDABLE 352 TEXTINCLUDE DISCARDABLE
36BEGIN 36BEGIN
37 "#include ""afxres.h""\r\n" 37 "#include ""afxres.h""\r\n"
38 "\0" 38 "\0"
39END 39END
40 40
413 TEXTINCLUDE DISCARDABLE 413 TEXTINCLUDE DISCARDABLE
42BEGIN 42BEGIN
43 "#define _AFX_NO_SPLITTER_RESOURCES\r\n" 43 "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
44 "#define _AFX_NO_OLE_RESOURCES\r\n" 44 "#define _AFX_NO_OLE_RESOURCES\r\n"
45 "#define _AFX_NO_TRACKER_RESOURCES\r\n" 45 "#define _AFX_NO_TRACKER_RESOURCES\r\n"
46 "#define _AFX_NO_PROPERTY_RESOURCES\r\n" 46 "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
47 "\r\n" 47 "\r\n"
48 "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" 48 "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
49 "#ifdef _WIN32\r\n" 49 "#ifdef _WIN32\r\n"
50 "LANGUAGE 9, 1\r\n" 50 "LANGUAGE 9, 1\r\n"
51 "#pragma code_page(1252)\r\n" 51 "#pragma code_page(1252)\r\n"
52 "#endif\r\n" 52 "#endif\r\n"
53 "#include ""res\\PumpKIN.rc2"" // non-Microsoft Visual C++ edited resources\r\n" 53 "#include ""res\\PumpKIN.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
54 "#include ""afxres.rc"" // Standard components\r\n" 54 "#include ""afxres.rc"" // Standard components\r\n"
55 "#endif\0" 55 "#endif\0"
56END 56END
57 57
58#endif // APSTUDIO_INVOKED 58#endif // APSTUDIO_INVOKED
59 59
60 60
61///////////////////////////////////////////////////////////////////////////// 61/////////////////////////////////////////////////////////////////////////////
62// 62//
63// Icon 63// Icon
64// 64//
65 65
66// Icon with lowest ID value placed first to ensure application icon 66// Icon with lowest ID value placed first to ensure application icon
67// remains consistent on all systems. 67// remains consistent on all systems.
68IDI_RRQ ICON DISCARDABLE "res\\wrq.ico" 68IDI_RRQ ICON DISCARDABLE "res\\wrq.ico"
69IDI_WRQ ICON DISCARDABLE "res\\rrq.ico" 69IDI_WRQ ICON DISCARDABLE "res\\rrq.ico"
70IDI_BROWSE ICON DISCARDABLE "shared-data/browse-icon.ico" 70IDI_BROWSE ICON DISCARDABLE "shared-data/browse-icon.ico"
71IDR_MAINFRAME ICON DISCARDABLE "res\\pumpkin.ico" 71IDR_MAINFRAME ICON DISCARDABLE "res\\pumpkin.ico"
72IDI_PLAY ICON DISCARDABLE "shared-data/play-icon.ico" 72IDI_PLAY ICON DISCARDABLE "shared-data/play-icon.ico"
73 73
74///////////////////////////////////////////////////////////////////////////// 74/////////////////////////////////////////////////////////////////////////////
75// 75//
76// Dialog 76// Dialog
77// 77//
78 78
79IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 74 79IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 74
80STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 80STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
81CAPTION "About PumpKIN" 81CAPTION "About PumpKIN"
82FONT 8, "MS Sans Serif" 82FONT 8, "MS Sans Serif"
83BEGIN 83BEGIN
84 ICON IDR_MAINFRAME,IDC_STATIC,7,17,18,20 84 ICON IDR_MAINFRAME,IDC_STATIC,7,17,18,20
85 LTEXT "PumpKIN, Version 2.5.1-trunk",IDC_STATIC,40,15,119,8, 85 LTEXT "PumpKIN, Version 2.5.1-trunk",IDC_STATIC,40,15,119,8,
86 SS_NOPREFIX 86 SS_NOPREFIX
87 LTEXT "Copyright © 1997-2004 Klever Group",IDC_STATIC,40,30, 87 LTEXT "Copyright © 1997-2004 Klever Group",IDC_STATIC,40,30,
88 170,8 88 170,8
89 DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP 89 DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP
90 PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,124,53,86,14 90 PUSHBUTTON "http://www.klever.net/",IDC_KLEVERNET,124,53,86,14
91END 91END
92 92
93IDD_PUMPKIN_DIALOG DIALOGEX 0, 0, 362, 191 93IDD_PUMPKIN_DIALOG DIALOGEX 0, 0, 362, 191
94STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION | 94STYLE DS_MODALFRAME | DS_3DLOOK | WS_POPUP | WS_VISIBLE | WS_CAPTION |
95 WS_SYSMENU 95 WS_SYSMENU
96EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW 96EXSTYLE WS_EX_ACCEPTFILES | WS_EX_APPWINDOW
97CAPTION " PumpKIN" 97CAPTION " PumpKIN"
98FONT 8, "MS Sans Serif", 0, 0, 0x1 98FONT 8, "MS Sans Serif", 0, 0, 0x1
99BEGIN 99BEGIN
100 CONTROL "List1",IDC_CONNECTIONS,"SysListView32",LVS_REPORT | 100 CONTROL "List1",IDC_CONNECTIONS,"SysListView32",LVS_REPORT |
101 LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,7,295,108, 101 LVS_AUTOARRANGE | WS_BORDER | WS_TABSTOP,7,7,295,108,
102 WS_EX_DLGMODALFRAME 102 WS_EX_DLGMODALFRAME
103 PUSHBUTTON "&Get File",IDC_GET,305,7,50,17,BS_NOTIFY, 103 PUSHBUTTON "&Get File",IDC_GET,305,7,50,17,BS_NOTIFY,
104 WS_EX_CLIENTEDGE 104 WS_EX_CLIENTEDGE
105 PUSHBUTTON "&Put File",IDC_PUT,305,25,50,17,BS_NOTIFY, 105 PUSHBUTTON "&Put File",IDC_PUT,305,25,50,17,BS_NOTIFY,
106 WS_EX_CLIENTEDGE 106 WS_EX_CLIENTEDGE
107 PUSHBUTTON "&Abort xfer",IDC_ABORT,305,43,50,17,BS_NOTIFY, 107 PUSHBUTTON "&Abort xfer",IDC_ABORT,305,43,50,17,BS_NOTIFY,
108 WS_EX_CLIENTEDGE 108 WS_EX_CLIENTEDGE
109 PUSHBUTTON "&Options",IDC_OPTIONS,305,61,50,17,BS_NOTIFY, 109 PUSHBUTTON "&Options",IDC_OPTIONS,305,61,50,17,BS_NOTIFY,
110 WS_EX_CLIENTEDGE 110 WS_EX_CLIENTEDGE
111 PUSHBUTTON "E&xit",IDC_EXIT,305,79,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE 111 PUSHBUTTON "E&xit",IDC_EXIT,305,79,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE
112 PUSHBUTTON "&Help",ID_HELP,305,97,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE 112 PUSHBUTTON "&Help",ID_HELP,305,97,50,17,BS_NOTIFY,WS_EX_CLIENTEDGE
113 LISTBOX IDC_LOG,7,115,348,69,LBS_USETABSTOPS | LBS_NOSEL | 113 LISTBOX IDC_LOG,7,115,348,69,LBS_USETABSTOPS | LBS_NOSEL |
114 WS_VSCROLL | WS_HSCROLL,WS_EX_DLGMODALFRAME 114 WS_VSCROLL | WS_HSCROLL,WS_EX_DLGMODALFRAME
115 PUSHBUTTON "..",IDCANCEL,0,183,6,7,NOT WS_VISIBLE | NOT WS_TABSTOP 115 PUSHBUTTON "..",IDCANCEL,0,183,6,7,NOT WS_VISIBLE | NOT WS_TABSTOP
116END 116END
117 117
118IDD_PROPS_SERVER DIALOG DISCARDABLE 0, 0, 210, 154 118IDD_PROPS_SERVER DIALOG DISCARDABLE 0, 0, 210, 154
119STYLE WS_CHILD | WS_DISABLED | WS_CAPTION 119STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
120CAPTION "Server" 120CAPTION "Server"
121FONT 8, "MS Sans Serif" 121FONT 8, "MS Sans Serif"
122BEGIN 122BEGIN
123 GROUPBOX "TFTP filesystem &root (download path)",IDC_STATIC,7,7, 123 GROUPBOX "TFTP filesystem &root (download path)",IDC_STATIC,7,7,
124 196,38 124 196,38
125 EDITTEXT IDC_TFTPROOT,13,16,170,13,ES_AUTOHSCROLL 125 EDITTEXT IDC_TFTPROOT,13,16,170,13,ES_AUTOHSCROLL
126 PUSHBUTTON "&B",IDC_BROWSE,186,16,13,13,BS_ICON 126 PUSHBUTTON "&B",IDC_BROWSE,186,16,13,13,BS_ICON
127 CONTROL "Allow access to &subdirectories",IDC_TFTPSUBDIRS, 127 CONTROL "Allow access to &subdirectories",IDC_TFTPSUBDIRS,
128 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,31,111,10 128 "Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,31,111,10
129 GROUPBOX "Read Request Behavior",IDC_STATIC,7,48,153,42 129 GROUPBOX "Read Request Behavior",IDC_STATIC,7,48,153,42
130 CONTROL "Give &all files",IDC_RRQ_GIVEALL,"Button", 130 CONTROL "Give &all files",IDC_RRQ_GIVEALL,"Button",
131 BS_AUTORADIOBUTTON | BS_NOTIFY | WS_GROUP,13,57,53,10 131 BS_AUTORADIOBUTTON | BS_NOTIFY | WS_GROUP,13,57,53,10
132 CONTROL "&Prompt before giving file",IDC_RRQ_ALWAYSCONFIRM, 132 CONTROL "&Prompt before giving file",IDC_RRQ_ALWAYSCONFIRM,
133 "Button",BS_AUTORADIOBUTTON | BS_NOTIFY,23,67,91,10 133 "Button",BS_AUTORADIOBUTTON | BS_NOTIFY,23,67,91,10
134 CONTROL "&Deny all requests",IDC_RRQ_DENYALL,"Button", 134 CONTROL "&Deny all requests",IDC_RRQ_DENYALL,"Button",
135 BS_AUTORADIOBUTTON | BS_NOTIFY,33,77,70,10 135 BS_AUTORADIOBUTTON | BS_NOTIFY,33,77,70,10
136 GROUPBOX "Write Request Behavior",IDC_STATIC,7,93,172,54,WS_GROUP 136 GROUPBOX "Write Request Behavior",IDC_STATIC,7,93,172,54,WS_GROUP
137 CONTROL "Take a&ll files",IDC_WRQ_TAKEALL,"Button", 137 CONTROL "Take a&ll files",IDC_WRQ_TAKEALL,"Button",
138 BS_AUTORADIOBUTTON | WS_GROUP,13,103,55,10 138 BS_AUTORADIOBUTTON | WS_GROUP,13,103,55,10
139 CONTROL "Prompt if file &exists",IDC_WRQ_PROMPTEXISTING,"Button", 139 CONTROL "Prompt if file &exists",IDC_WRQ_PROMPTEXISTING,"Button",
140 BS_AUTORADIOBUTTON,23,113,73,10 140 BS_AUTORADIOBUTTON,23,113,73,10
141 CONTROL "Always pro&mpt before accepting file", 141 CONTROL "Always pro&mpt before accepting file",
142 IDC_WRQ_ALWAYSCONFIRM,"Button",BS_AUTORADIOBUTTON,33,123, 142 IDC_WRQ_ALWAYSCONFIRM,"Button",BS_AUTORADIOBUTTON,33,123,
143 139,10 143 139,10
144 CONTROL "D&eny all requests",IDC_WRQ_DENYALL,"Button", 144 CONTROL "D&eny all requests",IDC_WRQ_DENYALL,"Button",
145 BS_AUTORADIOBUTTON,43,133,70,10 145 BS_AUTORADIOBUTTON,43,133,70,10
146 CTEXT "Confirmation &timeout",IDC_STATIC,163,52,40,19, 146 CTEXT "Confirmation &timeout",IDC_STATIC,163,52,40,19,
147 SS_NOTIFY 147 SS_NOTIFY
148 CONTROL "Slider1",IDC_PROMPTTIMEOUT,"msctls_trackbar32", 148 CONTROL "Slider1",IDC_PROMPTTIMEOUT,"msctls_trackbar32",
149 TBS_AUTOTICKS | TBS_VERT | TBS_TOP | WS_TABSTOP,182,73, 149 TBS_AUTOTICKS | TBS_VERT | TBS_TOP | WS_TABSTOP,182,73,
150 21,74 150 21,74
151END 151END
152 152
153IDD_PROPS_NETWORK DIALOG DISCARDABLE 0, 0, 210, 154 153IDD_PROPS_NETWORK DIALOG DISCARDABLE 0, 0, 210, 154
154STYLE WS_CHILD | WS_DISABLED | WS_CAPTION 154STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
155CAPTION "Network" 155CAPTION "Network"
156FONT 8, "MS Sans Serif" 156FONT 8, "MS Sans Serif"
157BEGIN 157BEGIN
158 GROUPBOX "UDP Ports",IDC_STATIC,7,7,196,40 158 GROUPBOX "UDP Ports",IDC_STATIC,7,7,196,40
159 RTEXT "Listen for &incoming requests on port:",IDC_STATIC,13, 159 RTEXT "Listen for &incoming requests on port:",IDC_STATIC,13,
160 18,135,8 160 18,135,8
161 EDITTEXT IDC_LISTENPORT,154,16,40,13,ES_AUTOHSCROLL 161 EDITTEXT IDC_LISTENPORT,154,16,40,13,ES_AUTOHSCROLL
162 CONTROL "Spin1",IDC_LISTENSPIN,"msctls_updown32",UDS_WRAP | 162 CONTROL "Spin1",IDC_LISTENSPIN,"msctls_updown32",UDS_WRAP |
163 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | 163 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
164 UDS_ARROWKEYS | UDS_NOTHOUSANDS,183,16,11,13 164 UDS_ARROWKEYS | UDS_NOTHOUSANDS,183,16,11,13
165 RTEXT "Send &outging requests to port:",IDC_STATIC,13,31,135,8 165 RTEXT "Send &outging requests to port:",IDC_STATIC,13,31,135,8
166 EDITTEXT IDC_SPEAKPORT,154,29,40,13,ES_AUTOHSCROLL 166 EDITTEXT IDC_SPEAKPORT,154,29,40,13,ES_AUTOHSCROLL
167 CONTROL "Spin1",IDC_SPEAKSPIN,"msctls_updown32",UDS_WRAP | 167 CONTROL "Spin1",IDC_SPEAKSPIN,"msctls_updown32",UDS_WRAP |
168 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | 168 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
169 UDS_ARROWKEYS | UDS_NOTHOUSANDS,183,29,11,13 169 UDS_ARROWKEYS | UDS_NOTHOUSANDS,183,29,11,13
170 LTEXT "Default connection timeout:",IDC_STATIC,7,52,88,8 170 LTEXT "Default connection timeout:",IDC_STATIC,7,52,88,8
171 EDITTEXT IDC_TIMEOUT,110,50,40,13,ES_AUTOHSCROLL | ES_NUMBER 171 EDITTEXT IDC_TIMEOUT,110,50,40,13,ES_AUTOHSCROLL | ES_NUMBER
172 CONTROL "Spin3",IDC_TIMESPIN,"msctls_updown32",UDS_WRAP | 172 CONTROL "Spin3",IDC_TIMESPIN,"msctls_updown32",UDS_WRAP |
173 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | 173 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
174 UDS_ARROWKEYS | UDS_NOTHOUSANDS,140,50,11,13 174 UDS_ARROWKEYS | UDS_NOTHOUSANDS,140,50,11,13
175 LTEXT "Default block size:",IDC_STATIC,7,66,59,8 175 LTEXT "Default block size:",IDC_STATIC,7,66,59,8
176 LTEXT "seconds",IDC_STATIC,154,52,28,8 176 LTEXT "seconds",IDC_STATIC,154,52,28,8
177 LTEXT "bytes",IDC_STATIC,154,66,18,8 177 LTEXT "bytes",IDC_STATIC,154,66,18,8
178 EDITTEXT IDC_BLOCKSIZE,110,64,40,13,ES_AUTOHSCROLL | ES_NUMBER 178 EDITTEXT IDC_BLOCKSIZE,110,64,40,13,ES_AUTOHSCROLL | ES_NUMBER
179 CONTROL "Spin3",IDC_BSIZESPIN,"msctls_updown32",UDS_WRAP | 179 CONTROL "Spin3",IDC_BSIZESPIN,"msctls_updown32",UDS_WRAP |
180 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | 180 UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
181 UDS_ARROWKEYS | UDS_NOTHOUSANDS,140,64,11,13 181 UDS_ARROWKEYS | UDS_NOTHOUSANDS,140,64,11,13
182END 182END
183 183
184IDD_CONFIRM_RRQ DIALOGEX 0, 0, 181, 79 184IDD_CONFIRM_RRQ DIALOGEX 0, 0, 181, 79
185STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | 185STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP |
186 WS_CAPTION 186 WS_CAPTION
187EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE 187EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
188CAPTION " PumpKIN - Confirm Read Request" 188CAPTION " PumpKIN - Confirm Read Request"
189FONT 8, "MS Sans Serif", 0, 0, 0x1 189FONT 8, "MS Sans Serif", 0, 0, 0x1
190BEGIN 190BEGIN
191 DEFPUSHBUTTON "&Grant Access",IDOK,27,58,54,14 191 DEFPUSHBUTTON "&Grant Access",IDOK,27,58,54,14
192 PUSHBUTTON "&Deny Access",IDCANCEL,97,58,54,14 192 PUSHBUTTON "&Deny Access",IDCANCEL,97,58,54,14
193 LTEXT "The host",IDC_STATIC,77,7,29,8 193 LTEXT "The host",IDC_STATIC,77,7,29,8
194 CTEXT "255.255.255.255",IDC_HOST,57,15,68,14,SS_NOTIFY | 194 CTEXT "255.255.255.255",IDC_HOST,57,15,68,14,SS_NOTIFY |
195 SS_SUNKEN | WS_BORDER,WS_EX_DLGMODALFRAME | 195 SS_SUNKEN | WS_BORDER,WS_EX_DLGMODALFRAME |
196 WS_EX_CLIENTEDGE 196 WS_EX_CLIENTEDGE
197 CTEXT "is requesting the file",IDC_STATIC,23,29,135,8 197 CTEXT "is requesting the file",IDC_STATIC,23,29,135,8
198 CTEXT "",IDC_FILE,23,37,135,14,SS_NOTIFY | SS_SUNKEN | 198 CTEXT "",IDC_FILE,23,37,135,14,SS_NOTIFY | SS_SUNKEN |
199 WS_BORDER,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE 199 WS_BORDER,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
200 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,54,167,1 200 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,54,167,1
201 ICON IDR_MAINFRAME,IDC_STATIC,7,7,18,20 201 ICON IDR_MAINFRAME,IDC_STATIC,7,7,18,20
202 ICON IDR_MAINFRAME,IDC_STATIC,153,7,18,20 202 ICON IDR_MAINFRAME,IDC_STATIC,153,7,18,20
203END 203END
204 204
205IDD_CONFIRM_WRQ DIALOGEX 0, 0, 201, 95 205IDD_CONFIRM_WRQ DIALOGEX 0, 0, 201, 95
206STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_CAPTION 206STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_CAPTION
207EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE 207EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
208CAPTION " PumpKIN - Confirm Write Request" 208CAPTION " PumpKIN - Confirm Write Request"
209FONT 8, "MS Sans Serif", 0, 0, 0x1 209FONT 8, "MS Sans Serif", 0, 0, 0x1
210BEGIN 210BEGIN
211 DEFPUSHBUTTON "&Accept",IDOK,7,58,59,14 211 DEFPUSHBUTTON "&Accept",IDOK,7,58,59,14
212 PUSHBUTTON "&Rename",IDC_RENAME,71,58,59,14 212 PUSHBUTTON "&Rename",IDC_RENAME,71,58,59,14
213 PUSHBUTTON "&Deny Access",IDCANCEL,135,58,59,14 213 PUSHBUTTON "&Deny Access",IDCANCEL,135,58,59,14
214 LTEXT "The host",IDC_STATIC,87,7,29,8 214 LTEXT "The host",IDC_STATIC,87,7,29,8
215 CTEXT "255.255.255.255",IDC_HOST,67,15,68,14,SS_NOTIFY | 215 CTEXT "255.255.255.255",IDC_HOST,67,15,68,14,SS_NOTIFY |
216 SS_SUNKEN | WS_BORDER,WS_EX_DLGMODALFRAME | 216 SS_SUNKEN | WS_BORDER,WS_EX_DLGMODALFRAME |
217 WS_EX_CLIENTEDGE 217 WS_EX_CLIENTEDGE
218 CTEXT "is attempting to send you a file",IDC_STATIC,33,29,135, 218 CTEXT "is attempting to send you a file",IDC_STATIC,33,29,135,
219 8 219 8
220 CTEXT "",IDC_FILE,33,37,135,14,SS_NOTIFY | SS_SUNKEN | 220 CTEXT "",IDC_FILE,33,37,135,14,SS_NOTIFY | SS_SUNKEN |
221 WS_BORDER,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE 221 WS_BORDER,WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE
222 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,54,187,1 222 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDHORZ,7,54,187,1
223 ICON IDR_MAINFRAME,IDC_STATIC,7,7,21,20 223 ICON IDR_MAINFRAME,IDC_STATIC,7,7,21,20
224 ICON IDR_MAINFRAME,IDC_STATIC,173,7,21,20 224 ICON IDR_MAINFRAME,IDC_STATIC,173,7,21,20
225 PUSHBUTTON "Res&ume",IDC_RESUME,71,74,59,14 225 PUSHBUTTON "Res&ume",IDC_RESUME,71,74,59,14
226END 226END
227 227
228IDD_REQUEST DIALOGEX 0, 0, 191, 161 228IDD_REQUEST DIALOGEX 0, 0, 191, 161
229STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_CAPTION | 229STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | WS_POPUP | WS_CAPTION |
230 WS_SYSMENU 230 WS_SYSMENU
231EXSTYLE WS_EX_CLIENTEDGE 231EXSTYLE WS_EX_CLIENTEDGE
232CAPTION "Request" 232CAPTION "Request"
233FONT 8, "MS Sans Serif", 0, 0, 0x1 233FONT 8, "MS Sans Serif", 0, 0, 0x1
234BEGIN 234BEGIN
235 LTEXT "&Local file:",IDC_STATIC,7,7,31,8,SS_NOTIFY 235 LTEXT "&Local file:",IDC_STATIC,7,7,31,8,SS_NOTIFY
236 EDITTEXT IDC_LOCALFILE,7,16,157,14,ES_AUTOHSCROLL, 236 EDITTEXT IDC_LOCALFILE,7,16,157,14,ES_AUTOHSCROLL,
237 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE 237 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
238 PUSHBUTTON "...",IDC_BROWSE,165,16,19,14,BS_ICON,WS_EX_STATICEDGE 238 PUSHBUTTON "...",IDC_BROWSE,165,16,19,14,BS_ICON,WS_EX_STATICEDGE
239 LTEXT "&Remote file:",IDC_STATIC,7,34,38,8,SS_NOTIFY 239 LTEXT "&Remote file:",IDC_STATIC,7,34,38,8,SS_NOTIFY
240 EDITTEXT IDC_REMOTEFILE,7,44,177,14,ES_AUTOHSCROLL, 240 EDITTEXT IDC_REMOTEFILE,7,44,177,14,ES_AUTOHSCROLL,
241 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE 241 WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
242 LTEXT "Remote &host:",IDC_STATIC,7,61,43,8,SS_NOTIFY 242 LTEXT "Remote &host:",IDC_STATIC,7,61,43,8,SS_NOTIFY
243 COMBOBOX IDC_TALKS,7,72,157,66,CBS_SIMPLE | CBS_AUTOHSCROLL | 243 COMBOBOX IDC_TALKS,7,72,157,66,CBS_SIMPLE | CBS_AUTOHSCROLL |
244 CBS_SORT | CBS_NOINTEGRALHEIGHT | WS_VSCROLL | 244 CBS_SORT | CBS_NOINTEGRALHEIGHT | WS_VSCROLL |
245 WS_TABSTOP,WS_EX_CLIENTEDGE | WS_EX_STATICEDGE 245 WS_TABSTOP,WS_EX_CLIENTEDGE | WS_EX_STATICEDGE
246 PUSHBUTTON "R\nE\n&F\nR\nE\nS\nH",IDC_REFRESH,165,72,19,66, 246 PUSHBUTTON "R\nE\n&F\nR\nE\nS\nH",IDC_REFRESH,165,72,19,66,
247 BS_CENTER | BS_VCENTER | BS_MULTILINE | BS_NOTIFY, 247 BS_CENTER | BS_VCENTER | BS_MULTILINE | BS_NOTIFY,
248 WS_EX_CLIENTEDGE 248 WS_EX_CLIENTEDGE
249 LTEXT "&Type:",IDC_STATIC,58,34,19,8 249 LTEXT "&Type:",IDC_STATIC,58,34,19,8
250 COMBOBOX IDC_TYPE,80,31,43,41,CBS_DROPDOWN | CBS_AUTOHSCROLL | 250 COMBOBOX IDC_TYPE,80,31,43,41,CBS_DROPDOWN | CBS_AUTOHSCROLL |
251 CBS_LOWERCASE | WS_VSCROLL | WS_TABSTOP 251 CBS_LOWERCASE | WS_VSCROLL | WS_TABSTOP
252 LTEXT "&Block:",IDC_STATIC,127,34,21,8 252 LTEXT "&Block:",IDC_STATIC,127,34,21,8
253 COMBOBOX IDC_BSIZE,149,31,35,53,CBS_DROPDOWN | WS_VSCROLL | 253 COMBOBOX IDC_BSIZE,149,31,35,53,CBS_DROPDOWN | WS_VSCROLL |
254 WS_TABSTOP 254 WS_TABSTOP
255 DEFPUSHBUTTON "OK",IDOK,35,140,50,14 255 DEFPUSHBUTTON "OK",IDOK,35,140,50,14
256 PUSHBUTTON "Cancel",IDCANCEL,101,140,50,14 256 PUSHBUTTON "Cancel",IDCANCEL,101,140,50,14
257 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,52,32,1,11 257 CONTROL "",IDC_STATIC,"Static",SS_ETCHEDVERT,52,32,1,11
258END 258END
259 259
260IDD_PROPS_SOUNDS DIALOG DISCARDABLE 0, 0, 210, 154 260IDD_PROPS_SOUNDS DIALOG DISCARDABLE 0, 0, 210, 154
261STYLE WS_CHILD | WS_DISABLED | WS_CAPTION 261STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
262CAPTION "Sounds" 262CAPTION "Sounds"
263FONT 8, "MS Sans Serif" 263FONT 8, "MS Sans Serif"
264BEGIN 264BEGIN
265 LTEXT "&Incoming request:",IDC_STATIC,7,9,57,8 265 LTEXT "&Incoming request:",IDC_STATIC,7,9,57,8
266 COMBOBOX IDC_RING,70,7,103,100,CBS_DROPDOWN | CBS_AUTOHSCROLL | 266 COMBOBOX IDC_RING,70,7,103,100,CBS_DROPDOWN | CBS_AUTOHSCROLL |
267 CBS_SORT | WS_VSCROLL | WS_TABSTOP 267 CBS_SORT | WS_VSCROLL | WS_TABSTOP
268 PUSHBUTTON "browse",IDC_RING_BROWSE,175,7,13,13,BS_ICON 268 PUSHBUTTON "browse",IDC_RING_BROWSE,175,7,13,13,BS_ICON
269 PUSHBUTTON "play",IDC_RING_PLAY,190,7,13,13,BS_ICON 269 PUSHBUTTON "play",IDC_RING_PLAY,190,7,13,13,BS_ICON
270 LTEXT "xfer &finished:",IDC_STATIC,7,25,57,8 270 LTEXT "xfer &finished:",IDC_STATIC,7,25,57,8
271 COMBOBOX IDC_FINISHED,70,22,103,100,CBS_DROPDOWN | 271 COMBOBOX IDC_FINISHED,70,22,103,100,CBS_DROPDOWN |
272 CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP 272 CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP
273 PUSHBUTTON "browse",IDC_FINISHED_BROWSE,175,22,13,13,BS_ICON 273 PUSHBUTTON "browse",IDC_FINISHED_BROWSE,175,22,13,13,BS_ICON
274 PUSHBUTTON "play",IDC_FINISHED_PLAY,190,22,13,13,BS_ICON 274 PUSHBUTTON "play",IDC_FINISHED_PLAY,190,22,13,13,BS_ICON
275 LTEXT "xfer &aborted:",IDC_STATIC,7,40,57,8 275 LTEXT "xfer &aborted:",IDC_STATIC,7,40,57,8
276 COMBOBOX IDC_ABORTED,70,37,103,100,CBS_DROPDOWN | CBS_AUTOHSCROLL | 276 COMBOBOX IDC_ABORTED,70,37,103,100,CBS_DROPDOWN | CBS_AUTOHSCROLL |
277 CBS_SORT | WS_VSCROLL | WS_TABSTOP 277 CBS_SORT | WS_VSCROLL | WS_TABSTOP
278 PUSHBUTTON "browse",IDC_ABORTED_BROWSE,175,37,13,13,BS_ICON 278 PUSHBUTTON "browse",IDC_ABORTED_BROWSE,175,37,13,13,BS_ICON
279 PUSHBUTTON "play",IDC_ABORTED_PLAY,190,37,13,13,BS_ICON 279 PUSHBUTTON "play",IDC_ABORTED_PLAY,190,37,13,13,BS_ICON
280END 280END
281 281
282 282
283#ifndef _MAC 283#ifndef _MAC
284///////////////////////////////////////////////////////////////////////////// 284/////////////////////////////////////////////////////////////////////////////
285// 285//
286// Version 286// Version
287// 287//
288 288
289VS_VERSION_INFO VERSIONINFO 289VS_VERSION_INFO VERSIONINFO
290 FILEVERSION 2,5,1,0 290 FILEVERSION 2,5,1,0
291 PRODUCTVERSION 2,5,1,0 291 PRODUCTVERSION 2,5,1,0
292 FILEFLAGSMASK 0x3fL 292 FILEFLAGSMASK 0x3fL
293#ifdef _DEBUG 293#ifdef _DEBUG
294 FILEFLAGS 0x1L 294 FILEFLAGS 0x1L
295#else 295#else
296 FILEFLAGS 0x0L 296 FILEFLAGS 0x0L
297#endif 297#endif
298 FILEOS 0x4L 298 FILEOS 0x4L
299 FILETYPE 0x1L 299 FILETYPE 0x1L
300 FILESUBTYPE 0x0L 300 FILESUBTYPE 0x0L
301BEGIN 301BEGIN
302 BLOCK "StringFileInfo" 302 BLOCK "StringFileInfo"
303 BEGIN 303 BEGIN
304 BLOCK "040904b0" 304 BLOCK "040904b0"
305 BEGIN 305 BEGIN
306 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0" 306 VALUE "CompanyName", "Klever Group (http://www.klever.net/)\0"
307 VALUE "FileDescription", "PumpKIN, tftp client/daemon\0" 307 VALUE "FileDescription", "PumpKIN, tftp client/daemon\0"
308 VALUE "FileVersion", "2, 5, 1, 0\0" 308 VALUE "FileVersion", "2, 5, 1, 0\0"
309 VALUE "InternalName", "PUMPKIN\0" 309 VALUE "InternalName", "PUMPKIN\0"
310 VALUE "LegalCopyright", "Copyright © 1997-2004 Klever Group (http://www.klever.net)\0" 310 VALUE "LegalCopyright", "Copyright © 1997-2004 Klever Group (http://www.klever.net)\0"
311 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0" 311 VALUE "LegalTrademarks", "Klever Group (http://www.klever.net/)\0"
312 VALUE "OriginalFilename", "PUMPKIN.EXE\0" 312 VALUE "OriginalFilename", "PUMPKIN.EXE\0"
313 VALUE "ProductName", "PumpKIN\0" 313 VALUE "ProductName", "PumpKIN\0"
314 VALUE "ProductVersion", "2, 5, 1, 0\0" 314 VALUE "ProductVersion", "2, 5, 1, 0\0"
315 END 315 END
316 END 316 END
317 BLOCK "VarFileInfo" 317 BLOCK "VarFileInfo"
318 BEGIN 318 BEGIN
319 VALUE "Translation", 0x409, 1200 319 VALUE "Translation", 0x409, 1200
320 END 320 END
321END 321END
322 322
323#endif // !_MAC 323#endif // !_MAC
324 324
325 325
326///////////////////////////////////////////////////////////////////////////// 326/////////////////////////////////////////////////////////////////////////////
327// 327//
328// DESIGNINFO 328// DESIGNINFO
329// 329//
330 330
331#ifdef APSTUDIO_INVOKED 331#ifdef APSTUDIO_INVOKED
332GUIDELINES DESIGNINFO DISCARDABLE 332GUIDELINES DESIGNINFO DISCARDABLE
333BEGIN 333BEGIN
334 IDD_ABOUTBOX, DIALOG 334 IDD_ABOUTBOX, DIALOG
335 BEGIN 335 BEGIN
336 LEFTMARGIN, 7 336 LEFTMARGIN, 7
337 RIGHTMARGIN, 210 337 RIGHTMARGIN, 210
338 TOPMARGIN, 7 338 TOPMARGIN, 7
339 BOTTOMMARGIN, 67 339 BOTTOMMARGIN, 67
340 END 340 END
341 341
342 IDD_PUMPKIN_DIALOG, DIALOG 342 IDD_PUMPKIN_DIALOG, DIALOG
343 BEGIN 343 BEGIN
344 LEFTMARGIN, 7 344 LEFTMARGIN, 7
345 RIGHTMARGIN, 355 345 RIGHTMARGIN, 355
346 TOPMARGIN, 7 346 TOPMARGIN, 7
347 BOTTOMMARGIN, 184 347 BOTTOMMARGIN, 184
348 HORZGUIDE, 115 348 HORZGUIDE, 115
349 END 349 END
350 350
351 IDD_PROPS_SERVER, DIALOG 351 IDD_PROPS_SERVER, DIALOG
352 BEGIN 352 BEGIN
353 LEFTMARGIN, 7 353 LEFTMARGIN, 7
354 RIGHTMARGIN, 203 354 RIGHTMARGIN, 203
355 TOPMARGIN, 7 355 TOPMARGIN, 7
356 BOTTOMMARGIN, 147 356 BOTTOMMARGIN, 147
357 END 357 END
358 358
359 IDD_PROPS_NETWORK, DIALOG 359 IDD_PROPS_NETWORK, DIALOG
360 BEGIN 360 BEGIN
361 LEFTMARGIN, 7 361 LEFTMARGIN, 7
362 RIGHTMARGIN, 203 362 RIGHTMARGIN, 203
363 TOPMARGIN, 7 363 TOPMARGIN, 7
364 BOTTOMMARGIN, 147 364 BOTTOMMARGIN, 147
365 END 365 END
366 366
367 IDD_CONFIRM_RRQ, DIALOG 367 IDD_CONFIRM_RRQ, DIALOG
368 BEGIN 368 BEGIN
369 LEFTMARGIN, 7 369 LEFTMARGIN, 7
370 RIGHTMARGIN, 174 370 RIGHTMARGIN, 174
371 TOPMARGIN, 7 371 TOPMARGIN, 7
372 BOTTOMMARGIN, 72 372 BOTTOMMARGIN, 72
373 END 373 END
374 374
375 IDD_CONFIRM_WRQ, DIALOG 375 IDD_CONFIRM_WRQ, DIALOG
376 BEGIN 376 BEGIN
377 LEFTMARGIN, 7 377 LEFTMARGIN, 7
378 RIGHTMARGIN, 194 378 RIGHTMARGIN, 194
379 TOPMARGIN, 7 379 TOPMARGIN, 7
380 BOTTOMMARGIN, 88 380 BOTTOMMARGIN, 88
381 END 381 END
382 382
383 IDD_REQUEST, DIALOG 383 IDD_REQUEST, DIALOG
384 BEGIN 384 BEGIN
385 LEFTMARGIN, 7 385 LEFTMARGIN, 7
386 RIGHTMARGIN, 184 386 RIGHTMARGIN, 184
387 TOPMARGIN, 7 387 TOPMARGIN, 7
388 BOTTOMMARGIN, 154 388 BOTTOMMARGIN, 154
389 END 389 END
390 390
391 IDD_PROPS_SOUNDS, DIALOG 391 IDD_PROPS_SOUNDS, DIALOG
392 BEGIN 392 BEGIN
393 LEFTMARGIN, 7 393 LEFTMARGIN, 7
394 RIGHTMARGIN, 203 394 RIGHTMARGIN, 203
395 TOPMARGIN, 7 395 TOPMARGIN, 7
396 BOTTOMMARGIN, 147 396 BOTTOMMARGIN, 147
397 END 397 END
398END 398END
399#endif // APSTUDIO_INVOKED 399#endif // APSTUDIO_INVOKED
400 400
401 401
402///////////////////////////////////////////////////////////////////////////// 402/////////////////////////////////////////////////////////////////////////////
403// 403//
404// Bitmap 404// Bitmap
405// 405//
406 406
407IDB_BACKGROUND BITMAP DISCARDABLE "shared-data/klever-background.bmp" 407IDB_BACKGROUND BITMAP DISCARDABLE "shared-data/klever-background.bmp"
408 408
409///////////////////////////////////////////////////////////////////////////// 409/////////////////////////////////////////////////////////////////////////////
410// 410//
411// WAVE 411// WAVE
412// 412//
413 413
414IDR_WAVE_RING WAVE DISCARDABLE "res\\ring.wav" 414IDR_WAVE_RING WAVE DISCARDABLE "res\\ring.wav"
415IDR_WAVE_FINISHED WAVE DISCARDABLE "res\\finished.wav" 415IDR_WAVE_FINISHED WAVE DISCARDABLE "res\\finished.wav"
416IDR_WAVE_ABORTED WAVE DISCARDABLE "res\\failed.wav" 416IDR_WAVE_ABORTED WAVE DISCARDABLE "res\\failed.wav"
417 417
418///////////////////////////////////////////////////////////////////////////// 418/////////////////////////////////////////////////////////////////////////////
419// 419//
420// Dialog Info 420// Dialog Info
421// 421//
422 422
423IDD_REQUEST DLGINIT 423IDD_REQUEST DLGINIT
424BEGIN 424BEGIN
425 IDC_TYPE, 0x403, 6, 0 425 IDC_TYPE, 0x403, 6, 0
4260x636f, 0x6574, 0x0074, 4260x636f, 0x6574, 0x0074,
427 IDC_TYPE, 0x403, 9, 0 427 IDC_TYPE, 0x403, 9, 0
4280x656e, 0x6174, 0x6373, 0x6969, "\000" 4280x656e, 0x6174, 0x6373, 0x6969, "\000"
429 IDC_BSIZE, 0x403, 4, 0 429 IDC_BSIZE, 0x403, 4, 0
4300x3135, 0x0032, 4300x3135, 0x0032,
431 IDC_BSIZE, 0x403, 5, 0 431 IDC_BSIZE, 0x403, 5, 0
4320x3031, 0x3432, "\000" 4320x3031, 0x3432, "\000"
433 IDC_BSIZE, 0x403, 5, 0 433 IDC_BSIZE, 0x403, 5, 0
4340x3032, 0x3834, "\000" 4340x3032, 0x3834, "\000"
435 IDC_BSIZE, 0x403, 5, 0 435 IDC_BSIZE, 0x403, 5, 0
4360x3034, 0x3639, "\000" 4360x3034, 0x3639, "\000"
437 IDC_BSIZE, 0x403, 5, 0 437 IDC_BSIZE, 0x403, 5, 0
4380x3138, 0x3239, "\000" 4380x3138, 0x3239, "\000"
439 0 439 0
440END 440END
441 441
442 442
443///////////////////////////////////////////////////////////////////////////// 443/////////////////////////////////////////////////////////////////////////////
444// 444//
445// Menu 445// Menu
446// 446//
447 447
448IDM_POPUPS MENU DISCARDABLE 448IDM_POPUPS MENU DISCARDABLE
449BEGIN 449BEGIN
450 POPUP "&Tray" 450 POPUP "&Tray"
451 BEGIN 451 BEGIN
452 MENUITEM "&Send File", ID_TRAY_SENDFILE 452 MENUITEM "&Send File", ID_TRAY_SENDFILE
453 MENUITEM "F&etch file", ID_TRAY_FETCHFILE 453 MENUITEM "F&etch file", ID_TRAY_FETCHFILE
454 MENUITEM "&Options", ID_TRAY_OPTIONS 454 MENUITEM "&Options", ID_TRAY_OPTIONS
455 MENUITEM "Show &PumpKIN Window", ID_TRAY_SHOWPUMPKINWINDOW 455 MENUITEM "Show &PumpKIN Window", ID_TRAY_SHOWPUMPKINWINDOW
456 MENUITEM "Open &Files Folder", ID_TRAY_OPENFILESFOLDER 456 MENUITEM "Open &Files Folder", ID_TRAY_OPENFILESFOLDER
457 MENUITEM SEPARATOR 457 MENUITEM SEPARATOR
458 MENUITEM "&Help Topics", ID_TRAY_HELP 458 MENUITEM "&Help Topics", ID_TRAY_HELP
459 MENUITEM "&About PumpKIN", ID_TRAY_ABOUTPUMPKIN 459 MENUITEM "&About PumpKIN", ID_TRAY_ABOUTPUMPKIN
460 MENUITEM SEPARATOR 460 MENUITEM SEPARATOR
461 MENUITEM "E&xit", ID_TRAY_EXIT 461 MENUITEM "E&xit", ID_TRAY_EXIT
462 END 462 END
463END 463END
464 464
465 465
466///////////////////////////////////////////////////////////////////////////// 466/////////////////////////////////////////////////////////////////////////////
467// 467//
468// String Table 468// String Table
469// 469//
470 470
471STRINGTABLE DISCARDABLE 471STRINGTABLE DISCARDABLE
472BEGIN 472BEGIN
473 IDS_ABOUTBOX "&About PumpKIN..." 473 IDS_ABOUTBOX "&About PumpKIN..."
474 IDS_FMT_BYTES "%lu" 474 IDS_FMT_BYTES "%lu"
475 IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed." 475 IDP_SOCKETS_INIT_FAILED "Windows sockets initialization failed."
476 IDS_TFTP_ERROR_ACCESS "Access violation" 476 IDS_TFTP_ERROR_ACCESS "Access violation"
477 IDS_TFTP_ERROR_NOTFOUND "File not found" 477 IDS_TFTP_ERROR_NOTFOUND "File not found"
478 IDS_TFTP_ERROR_DIRFULL "Directory is full" 478 IDS_TFTP_ERROR_DIRFULL "Directory is full"
479 IDS_TFTP_ERROR_SHARING "Sharing violation" 479 IDS_TFTP_ERROR_SHARING "Sharing violation"
480 IDS_TFTP_ERROR_DISKFULL "Disk full" 480 IDS_TFTP_ERROR_DISKFULL "Disk full"
481 IDS_TFTP_ERROR_UNDEFINED "Undefined error" 481 IDS_TFTP_ERROR_UNDEFINED "Undefined error"
482 IDS_LOG_START "PumpKIN started" 482 IDS_LOG_START "PumpKIN started"
483 IDS_LOG_LISTENRECEIVEERROR "Error listening for incoming connections" 483 IDS_LOG_LISTENRECEIVEERROR "Error listening for incoming connections"
484END 484END
485 485
486STRINGTABLE DISCARDABLE 486STRINGTABLE DISCARDABLE
487BEGIN 487BEGIN
488 IDS_LOG_LISTENACCEPTERROR "Error accepting incoming connection" 488 IDS_LOG_LISTENACCEPTERROR "Error accepting incoming connection"
489 IDS_LOG_RRQSERVE "'%s' of type '%s' is requested from %s" 489 IDS_LOG_RRQSERVE "'%s' of type '%s' is requested from %s"
490 IDS_LOG_LISTENOPCODE "Invalid opcode in initial connection request" 490 IDS_LOG_LISTENOPCODE "Invalid opcode in initial connection request"
491 IDS_LOG_XFERUDPSEND "UDP packet send failed" 491 IDS_LOG_XFERUDPSEND "UDP packet send failed"
492 IDS_LOG_XFERRECEIVE "Error on xfer socket" 492 IDS_LOG_XFERRECEIVE "Error on xfer socket"
493 IDS_LOG_XFERSEND "Error on xfer socket" 493 IDS_LOG_XFERSEND "Error on xfer socket"
494 IDS_LOG_XFERUDPRECEIVE "UDP packet receive failed" 494 IDS_LOG_XFERUDPRECEIVE "UDP packet receive failed"
495 IDS_LOG_XFERSOURCETID "Packet from unexpected source" 495 IDS_LOG_XFERSOURCETID "Packet from unexpected source"
496 IDS_LOG_SENTTFTPERROR ":%u: %s" 496 IDS_LOG_SENTTFTPERROR ":%u: %s"
497 IDS_LOG_GOTTFTPERROR "TFTP:%u: %s" 497 IDS_LOG_GOTTFTPERROR "TFTP:%u: %s"
498 IDS_LOG_XFEROPCODE "Invalid opcode during transfer received" 498 IDS_LOG_XFEROPCODE "Invalid opcode (%u) during transfer received"
499 IDS_LOG_XFERRRQFINISHED "Transfer of '%s' has successfully completed" 499 IDS_LOG_XFERRRQFINISHED "Transfer of '%s' has successfully completed"
500 IDS_TITLE_OPTIONS "Options" 500 IDS_TITLE_OPTIONS "Options"
501 IDS_LOG_WRQSERVE "Writing of '%s' of type '%s' is requested by %s" 501 IDS_LOG_WRQSERVE "Writing of '%s' of type '%s' is requested by %s"
502 IDS_TFTP_ERROR_FAILEDTORENAME "Too many clones of the file" 502 IDS_TFTP_ERROR_FAILEDTORENAME "Too many clones of the file"
503 IDS_RENAME_TITLE "Save As" 503 IDS_RENAME_TITLE "Save As"
504END 504END
505 505
506STRINGTABLE DISCARDABLE 506STRINGTABLE DISCARDABLE
507BEGIN 507BEGIN
508 IDS_LOG_TIMEDOUT "Transmission of '%s' is timed out" 508 IDS_LOG_TIMEDOUT "Transmission of '%s' is timed out"
509 IDS_CONFIRMEXIT_TITLE "Exit" 509 IDS_CONFIRMEXIT_TITLE "Exit"
510 IDS_CONFIRMEXIT_TEXT "File transmission is currently in progress. Are you sure you want to exit?" 510 IDS_CONFIRMEXIT_TEXT "File transmission is currently in progress. Are you sure you want to exit?"
511 IDS_LOG_XFERWRQFINISHED "Transfer of '%s' has successfully completed" 511 IDS_LOG_XFERWRQFINISHED "Transfer of '%s' has successfully completed"
512 IDS_LOG_XFERABORTED "Transfer of '%s' was aborted" 512 IDS_LOG_XFERABORTED "Transfer of '%s' was aborted"
513 IDS_TITLE_PUTREQUEST "Send file" 513 IDS_TITLE_PUTREQUEST "Send file"
514 IDS_TITLE_GETREQUEST "Fetch file" 514 IDS_TITLE_GETREQUEST "Fetch file"
515 IDS_WTALKHEADING "Talk with " 515 IDS_WTALKHEADING "Talk with "
516 IDS_TITLE_BROWSEFILE "Browse" 516 IDS_TITLE_BROWSEFILE "Browse"
517 IDS_LOG_RESOLVEFAILED "Failed to resolve host address for '%s'" 517 IDS_LOG_RESOLVEFAILED "Failed to resolve host address for '%s'"
518 IDS_LOG_FAILEDLOCALFILE "Failed to open local file '%s'" 518 IDS_LOG_FAILEDLOCALFILE "Failed to open local file '%s'"
519 IDS_LOG_FAILEDTOOPEN "Failed to open '%s'" 519 IDS_LOG_FAILEDTOOPEN "Failed to open '%s'"
520 IDS_OTALXHEADING "Open Talks: talking to " 520 IDS_OTALXHEADING "Open Talks: talking to "
521 IDS_REGISTRYKEY "Klever Group" 521 IDS_REGISTRYKEY "Klever Group"
522 IDS_KLEVERNET_URL "http://www.klever.net/" 522 IDS_KLEVERNET_URL "http://www.klever.net/"
523 IDS_LOGTIMEFORMAT "%H:%M:%S %B %d" 523 IDS_LOGTIMEFORMAT "%H:%M:%S %B %d"
524END 524END
525 525
526STRINGTABLE DISCARDABLE 526STRINGTABLE DISCARDABLE
527BEGIN 527BEGIN
528 ID_TRAY_HELP "Read the help on PumpKIN" 528 ID_TRAY_HELP "Read the help on PumpKIN"
529 ID_TRAY_ABOUTPUMPKIN "Learn about PumpKIN and it's creator" 529 ID_TRAY_ABOUTPUMPKIN "Learn about PumpKIN and it's creator"
530 ID_TRAY_EXIT "Close PumpKIN" 530 ID_TRAY_EXIT "Close PumpKIN"
531 ID_TRAY_SENDFILE "Send file over the network to your tete-a-tete" 531 ID_TRAY_SENDFILE "Send file over the network to your tete-a-tete"
532 ID_TRAY_FETCHFILE "Fetch file from remote computer" 532 ID_TRAY_FETCHFILE "Fetch file from remote computer"
533 ID_TRAY_OPTIONS "Set PumpKIN options" 533 ID_TRAY_OPTIONS "Set PumpKIN options"
534 ID_TRAY_SHOWPUMPKINWINDOW "Show main window" 534 ID_TRAY_SHOWPUMPKINWINDOW "Show main window"
535 ID_TRAY_OPENFILESFOLDER "Explore TFTP root folder" 535 ID_TRAY_OPENFILESFOLDER "Explore TFTP root folder"
536END 536END
537 537
538STRINGTABLE DISCARDABLE 538STRINGTABLE DISCARDABLE
539BEGIN 539BEGIN
540 IDC_CONNECTIONS "Active transfers" 540 IDC_CONNECTIONS "Active transfers"
541 IDC_LOG "PumpKIN Activity Log" 541 IDC_LOG "PumpKIN Activity Log"
542 IDC_GET "Fetch file from remote server" 542 IDC_GET "Fetch file from remote server"
543 IDC_PUT "Send file over the net" 543 IDC_PUT "Send file over the net"
544 IDC_ABORT "Abort transfer currently in progress" 544 IDC_ABORT "Abort transfer currently in progress"
545 IDC_EXIT "Close PumpKIN" 545 IDC_EXIT "Close PumpKIN"
546END 546END
547 547
548STRINGTABLE DISCARDABLE 548STRINGTABLE DISCARDABLE
549BEGIN 549BEGIN
550 IDC_OPTIONS "Set PumpKIN options" 550 IDC_OPTIONS "Set PumpKIN options"
551 IDC_REFRESH "Refresh talks list" 551 IDC_REFRESH "Refresh talks list"
552 IDC_BROWSE "Browse" 552 IDC_BROWSE "Browse"
553END 553END
554 554
555STRINGTABLE DISCARDABLE 555STRINGTABLE DISCARDABLE
556BEGIN 556BEGIN
557 ID_HELP "Read help on PumpKIN" 557 ID_HELP "Read help on PumpKIN"
558END 558END
559 559
560STRINGTABLE DISCARDABLE 560STRINGTABLE DISCARDABLE
561BEGIN 561BEGIN
562 IDS_DROPFILES_TITLE "Drop Files" 562 IDS_DROPFILES_TITLE "Drop Files"
563 IDS_NOMULTIPLEDROP_TEXT "You can't drop more than one file here. Only the first one will be accepted" 563 IDS_NOMULTIPLEDROP_TEXT "You can't drop more than one file here. Only the first one will be accepted"
564 IDS_LOG_REQUESTING "Requesting '%s' from '%s'" 564 IDS_LOG_REQUESTING "Requesting '%s' from '%s'"
565 IDS_LOG_SENDING "Sending '%s' to '%s'" 565 IDS_LOG_SENDING "Sending '%s' to '%s'"
566 IDS_WTALKAT "@" 566 IDS_WTALKAT "@"
567 IDS_OTALXAT " at " 567 IDS_OTALXAT " at "
568 IDS_TFTP_ERROR_TSIZE "Invalid transfer size" 568 IDS_TFTP_ERROR_TSIZE "Invalid transfer size"
569 IDS_TFTP_ERROR_BSIZE "Invalid block size" 569 IDS_TFTP_ERROR_BSIZE "Invalid block size"
570 IDS_TFTP_ERROR_TOUT "Invalid timeout" 570 IDS_TFTP_ERROR_TOUT "Invalid timeout"
571 IDS_SELECT_TFTPROOT "Select TFTP filesystem root.." 571 IDS_SELECT_TFTPROOT "Select TFTP filesystem root.."
572 IDS_FILTER_WAV "Sound Files (*.wav)|*.wav||" 572 IDS_FILTER_WAV "Sound Files (*.wav)|*.wav||"
573 IDS_TITLE_WAV "Select sound.." 573 IDS_TITLE_WAV "Select sound.."
574 IDS_BOX_CANTBIND "Failed to create listening socket. The port may be in use by another application." 574 IDS_BOX_CANTBIND "Failed to create listening socket. The port may be in use by another application."
575END 575END
576 576
577STRINGTABLE DISCARDABLE 577STRINGTABLE DISCARDABLE
578BEGIN 578BEGIN
579 AFX_IDS_APP_TITLE "PUMPKIN" 579 AFX_IDS_APP_TITLE "PUMPKIN"
580END 580END
581 581
582#endif // English (U.S.) resources 582#endif // English (U.S.) resources
583///////////////////////////////////////////////////////////////////////////// 583/////////////////////////////////////////////////////////////////////////////
584 584
585 585
586 586
587#ifndef APSTUDIO_INVOKED 587#ifndef APSTUDIO_INVOKED
588///////////////////////////////////////////////////////////////////////////// 588/////////////////////////////////////////////////////////////////////////////
589// 589//
590// Generated from the TEXTINCLUDE 3 resource. 590// Generated from the TEXTINCLUDE 3 resource.
591// 591//
592#define _AFX_NO_SPLITTER_RESOURCES 592#define _AFX_NO_SPLITTER_RESOURCES
593#define _AFX_NO_OLE_RESOURCES 593#define _AFX_NO_OLE_RESOURCES
594#define _AFX_NO_TRACKER_RESOURCES 594#define _AFX_NO_TRACKER_RESOURCES
595#define _AFX_NO_PROPERTY_RESOURCES 595#define _AFX_NO_PROPERTY_RESOURCES
596 596
597#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 597#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
598#ifdef _WIN32 598#ifdef _WIN32
599LANGUAGE 9, 1 599LANGUAGE 9, 1
600#pragma code_page(1252) 600#pragma code_page(1252)
601#endif 601#endif
602#include "res\PumpKIN.rc2" // non-Microsoft Visual C++ edited resources 602#include "res\PumpKIN.rc2" // non-Microsoft Visual C++ edited resources
603#include "afxres.rc" // Standard components 603#include "afxres.rc" // Standard components
604#endif 604#endif
605///////////////////////////////////////////////////////////////////////////// 605/////////////////////////////////////////////////////////////////////////////
606#endif // not APSTUDIO_INVOKED 606#endif // not APSTUDIO_INVOKED
607 607