Advertisement
Guest User

PuTTY Patch - GNS3 Build

a guest
Jul 11th, 2012
704
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff -rup putty-src-orig\CMDLINE.C putty-src\CMDLINE.C
  2. --- putty-src-orig\CMDLINE.C    Thu Dec 23 17:32:28 2010
  3. +++ putty-src\CMDLINE.C Fri Jun 22 20:23:55 2012
  4. @@ -6,6 +6,9 @@
  5.  #include <stdio.h>
  6.  #include <assert.h>
  7.  #include <stdlib.h>
  8. +/***************Patch GNS3 PuTTY *******************/
  9. +#include <time.h>
  10. +/***************************************************/
  11.  #include "putty.h"
  12.  
  13.  /*
  14. @@ -165,6 +168,12 @@ static int cmdline_check_unavailable(int
  15.  int cmdline_process_param(char *p, char *value, int need_save, Config *cfg)
  16.  {
  17.      int ret = 0;
  18. +   /***************Patch GNS3 PuTTY *******************/
  19. +    char       buf[80];
  20. +    time_t     now = time(0);
  21. +    struct tm  tstruct;
  22. +    tstruct = *localtime(&now);
  23. +   /***************************************************/
  24.  
  25.      if (!strcmp(p, "-load")) {
  26.     RETURN(2);
  27. @@ -226,6 +235,73 @@ int cmdline_process_param(char *p, char
  28.     strncpy(cfg->username, value, sizeof(cfg->username));
  29.     cfg->username[sizeof(cfg->username) - 1] = '\0';
  30.      }
  31. +   /***************Patch GNS3 PuTTY *******************/
  32. +    if (!strcmp(p, "-wt")) {
  33. +    RETURN(2);
  34. +    SAVEABLE(0);
  35. +    strncpy(cfg->wintitle, value, sizeof(cfg->wintitle));
  36. +    cfg->wintitle[sizeof(cfg->wintitle) - 1] = '\0';
  37. +    cfg->no_remote_wintitle = 1; //No remote title
  38. +   cfg->win_name_always    = 1; //Don't change the title when is minimized
  39. +    }
  40. +   if (!strcmp(p, "-gns3")) {
  41. +   RETURN(2);
  42. +   SAVEABLE(0);
  43. +   cfg->close_on_exit      = 1; //Never, Don't close the window
  44. +   cfg->warn_on_close      = 0; //No warn before closing the window
  45. +   cfg->beep               = 0; //No beeps (Iritating!)
  46. +   cfg->alt_f4             = 1; //Allow Alt+F4 to close the window
  47. +   cfg->alt_space          = 1; //Allow Alt+Space to display the system menu
  48. +   cfg->blinktext          = 1; //Allow text blinking effect
  49. +   cfg->no_remote_resize   = 1; //No remote resize
  50. +   cfg->savelines          = 2500; //Scroll Lines Buffer
  51. +   cfg->push_one_enter     = 1; //Push a enter key on telnet/serial console
  52. +   cfg->no_annoying_msgbox = 1; //Replace MsgBox errors with a message in the title
  53. +   cfg->reconnect_after_error = atoi(value); //Automatically reconnect a inactive session on error after x seconds
  54. +   }
  55. +    if (!strcmp(p, "-skin")) {
  56. +    RETURN(2);
  57. +    SAVEABLE(0);
  58. +   switch(atoi(value))
  59. +       {
  60. +       case 1: //night theme
  61. +           cfg->colours[0][0] = 15;  cfg->colours[0][1] = 15;  cfg->colours[0][2] = 15;  //Defauld Foreground
  62. +           cfg->colours[2][0] = 255; cfg->colours[2][1] = 255; cfg->colours[2][2] = 255; //Defauld Background
  63. +           break;
  64. +       case 2: //desert theme
  65. +           cfg->colours[0][0] = 255; cfg->colours[0][1] = 255; cfg->colours[0][2] = 255; //Defauld Foreground
  66. +           cfg->colours[2][0] = 51;  cfg->colours[2][1] = 51;  cfg->colours[2][2] = 51;  //Defauld Background
  67. +           break;
  68. +       case 3: //matrix theme
  69. +           cfg->colours[0][0] = 27;  cfg->colours[0][1] = 255; cfg->colours[0][2] = 27;  //Defauld Foreground
  70. +           cfg->colours[2][0] = 30;  cfg->colours[2][1] = 30;  cfg->colours[2][2] = 30;  //Defauld Background
  71. +           break;
  72. +       case 4: //Gold theme
  73. +           cfg->colours[0][0] = 255; cfg->colours[0][1] = 190; cfg->colours[0][2] = 27;  //Defauld Foreground
  74. +           cfg->colours[2][0] = 51;  cfg->colours[2][1] = 51;  cfg->colours[2][2] = 51;  //Defauld Background
  75. +           break;
  76. +       default: //default theme
  77. +           cfg->colours[0][0] = 187; cfg->colours[0][1] = 187; cfg->colours[0][2] = 187; //Defauld Foreground
  78. +           cfg->colours[2][0] = 0;   cfg->colours[2][1] = 0;   cfg->colours[2][2] = 0;   //Defauld Background
  79. +           break;
  80. +       }
  81. +   }
  82. +   if (!strcmp(p, "-log")) { //don't use "/, \, |, *, ?, <, >, :" in -wt variable! :D
  83. +    RETURN(2);
  84. +    SAVEABLE(0);
  85. +    strftime(buf, sizeof(buf), "%d.%b.%y_%H.%M.%S", &tstruct);
  86. +   if(!strlen(cfg->wintitle)){
  87. +       sprintf(cfg->logfilename.path, "%s\\%s_%s.log\0", value, buf, cfg->host);     // ex: C:\dir4.Jun.12_21.40.29_127.0.0.1.log
  88. +       }
  89. +   else{
  90. +       sprintf(cfg->logfilename.path, "%s\\%s_%s.log\0", value, buf, cfg->wintitle); // ex: C:\dir4.Jun.12_21.40.29_R1.log
  91. +   }
  92. +   cfg->logtype  = 1; //printable output
  93. +    cfg->logflush = 1; //flush log file
  94. +    cfg->logxfovr = 0; //append (anyway the log is created with the current date/time and will be imposible to have a append event)
  95. +    }
  96. +   /***************************************************/
  97. +
  98.      if (!strcmp(p, "-loghost")) {
  99.     RETURN(2);
  100.     UNAVAILABLE_IN(TOOLTYPE_NONNETWORK);
  101. diff -rup putty-src-orig\CONFIG.C putty-src\CONFIG.C
  102. --- putty-src-orig\CONFIG.C Fri Jan 14 19:57:00 2011
  103. +++ putty-src\CONFIG.C  Thu Jul 12 00:52:53 2012
  104. @@ -2385,4 +2385,39 @@ void setup_config_box(struct controlbox
  105.               sshbug_handler, I(offsetof(Config,sshbug_maxpkt2)));
  106.     }
  107.      }
  108. +   /***************Patch GNS3 PuTTY *******************/
  109. +    /*
  110. +     * The GNS3 panel.
  111. +     */
  112. +    str = dupprintf("Advanced options for GNS3 usage", appname);
  113. +    ctrl_settitle(b, "GNS3", str);
  114. +    sfree(str);
  115. +  
  116. +   s = ctrl_getset(b, "GNS3", "adv-options1", NULL);
  117. +    ctrl_radiobuttons(s, "Push a enter key inside a telnet/serial console:", 'p', 2,
  118. +             HELPCTX(no_help),
  119. +             dlg_stdradiobutton_handler,
  120. +             I(offsetof(Config, push_one_enter)),
  121. +             "Yes", I(1),
  122. +             "No", I(0),
  123. +             NULL);
  124. +   s = ctrl_getset(b, "GNS3", "adv-options2", NULL);
  125. +    ctrl_radiobuttons(s, "Replace all MsgBox errors with a message in title bar:", 'm', 2,
  126. +             HELPCTX(no_help),
  127. +             dlg_stdradiobutton_handler,
  128. +             I(offsetof(Config, no_annoying_msgbox)),
  129. +             "Yes", I(1),
  130. +             "No", I(0),
  131. +             NULL);
  132. +   s = ctrl_getset(b, "GNS3", "adv-options3", "Seconds between auto-restarts ('0' to turn off)");
  133. +    ctrl_editbox(s, "Automatically reconnect a inactive session after:", 'r', 11,
  134. +             HELPCTX(no_help),
  135. +             dlg_stdeditbox_handler, I(offsetof(Config,reconnect_after_error)),
  136. +            I(-1));
  137. +   s = ctrl_getset(b, "GNS3", "adv-options4", "'0' is completely transparent, '255' is completely opaque");
  138. +    ctrl_editbox(s, "Set the factor value for transparent window:", 't', 11,
  139. +             HELPCTX(no_help),
  140. +             dlg_stdeditbox_handler, I(offsetof(Config,transparent_factor)),
  141. +            I(-1));
  142. +   /***************************************************/
  143.  }
  144. diff -rup putty-src-orig\PUTTY.H putty-src\PUTTY.H
  145. --- putty-src-orig\PUTTY.H  Sat Jun 25 18:37:32 2011
  146. +++ putty-src\PUTTY.H   Wed Jul 11 21:23:42 2012
  147. @@ -1,5 +1,6 @@
  148.  #ifndef PUTTY_PUTTY_H
  149.  #define PUTTY_PUTTY_H
  150. +#define SECURITY_WIN32
  151.  
  152.  #include <stddef.h>               /* for wchar_t */
  153.  
  154. @@ -523,6 +524,12 @@ struct config_tag {
  155.      char ssh_nc_host[512];        /* host to connect to in `nc' mode */
  156.      int ssh_nc_port;              /* port to connect to in `nc' mode */
  157.      /* Telnet options */
  158. +   /***************Patch GNS3 PuTTY *******************/
  159. +   int push_one_enter;            /* used to pust a '\r' inside the socket */
  160. +   int no_annoying_msgbox;        /* used to replace msgbox errors with messages in title window */
  161. +   int reconnect_after_error;     /* used to automatically reconnect a telnet/serial session on error after x seconds */
  162. +   int transparent_factor;        /* used to set the window transparent */
  163. +   /***************************************************/
  164.      char termtype[32];
  165.      char termspeed[32];
  166.      char ttymodes[768];               /* MODE\tVvalue\0MODE\tA\0\0 */
  167. @@ -773,6 +780,9 @@ int char_width(Context ctx, int uc);
  168.  void do_scroll(Context, int, int, int);
  169.  #endif
  170.  void set_title(void *frontend, char *);
  171. +/***************Patch GNS3 PuTTY *******************/
  172. +void set_title_plus_error(void *frontend, char *error);
  173. +/***************************************************/
  174.  void set_icon(void *frontend, char *);
  175.  void set_sbar(void *frontend, int, int, int);
  176.  Context get_ctx(void *frontend);
  177. diff -rup putty-src-orig\SETTINGS.C putty-src\SETTINGS.C
  178. --- putty-src-orig\SETTINGS.C   Tue Sep 13 08:35:56 2011
  179. +++ putty-src\SETTINGS.C    Wed Jul 11 21:28:20 2012
  180. @@ -475,6 +475,12 @@ void save_open_settings(void *sesskey, C
  181.      write_setting_s(sesskey, "WinTitle", cfg->wintitle);
  182.      write_setting_i(sesskey, "TermWidth", cfg->width);
  183.      write_setting_i(sesskey, "TermHeight", cfg->height);
  184. +   /***************Patch GNS3 PuTTY *******************/
  185. +    write_setting_i(sesskey, "GNS3PushOneEnter", cfg->push_one_enter); //Save the values in regs :D
  186. +    write_setting_i(sesskey, "GNS3NoMsgBoxError", cfg->no_annoying_msgbox);
  187. +    write_setting_i(sesskey, "GNS3AutoReconnect", cfg->reconnect_after_error);
  188. +    write_setting_i(sesskey, "WinTransparent", cfg->transparent_factor);
  189. +   /***************************************************/
  190.      write_setting_fontspec(sesskey, "Font", cfg->font);
  191.      write_setting_i(sesskey, "FontQuality", cfg->font_quality);
  192.      write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
  193. @@ -792,8 +798,14 @@ void load_open_settings(void *sesskey, C
  194.      gppi(sesskey, "DisableBidi", 0, &cfg->bidi);
  195.      gppi(sesskey, "WinNameAlways", 1, &cfg->win_name_always);
  196.      gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
  197. -    gppi(sesskey, "TermWidth", 80, &cfg->width);
  198. +   /***************Patch GNS3 PuTTY *******************/
  199. +    gppi(sesskey, "TermWidth", 110, &cfg->width); //default was 80
  200.      gppi(sesskey, "TermHeight", 24, &cfg->height);
  201. +   gppi(sesskey, "WinTransparent", 255, &cfg->transparent_factor); //default is normal window (opaque)
  202. +    gppi(sesskey, "GNS3PushOneEnter", 0, &cfg->push_one_enter); //default is unused
  203. +    gppi(sesskey, "GNS3NoMsgBoxError", 0, &cfg->no_annoying_msgbox); //default is unused
  204. +    gppi(sesskey, "GNS3AutoReconnect", 0, &cfg->reconnect_after_error); //default is unused
  205. +   /***************************************************/
  206.      gppfont(sesskey, "Font", &cfg->font);
  207.      gppi(sesskey, "FontQuality", FQ_DEFAULT, &cfg->font_quality);
  208.      gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
  209. diff -rup putty-src-orig\TELNET.C putty-src\TELNET.C
  210. --- putty-src-orig\TELNET.C Mon Nov 24 17:51:42 2008
  211. +++ putty-src\TELNET.C  Mon Jun 18 20:10:54 2012
  212. @@ -765,6 +765,16 @@ static const char *telnet_init(void *fro
  213.       */
  214.      update_specials_menu(telnet->frontend);
  215.  
  216. +   /***************Patch GNS3 PuTTY *******************/
  217. +   /*
  218. +    * Push a enter key inside the telnet socket
  219. +    */
  220. +    if (telnet->cfg.push_one_enter) {
  221. +    logevent(telnet->frontend, "client:\t *** Press a '\\r' inside the Telnet socket ***");
  222. +   telnet->bufsize = sk_write(telnet->s, "\r", 1);
  223. +   }
  224. +   /***************************************************/
  225. +
  226.      /*
  227.       * loghost overrides realhost, if specified.
  228.       */
  229. diff -rup putty-src-orig\VERSION.C putty-src\VERSION.C
  230. --- putty-src-orig\VERSION.C    Sat Nov 26 17:45:52 2011
  231. +++ putty-src\VERSION.C Thu Jul 12 00:56:12 2012
  232. @@ -34,9 +34,11 @@ char ver[] = "Custom build r" STR(SVN_RE
  233.  char sshver[] = "PuTTY-Custom-r" STR(SVN_REV);
  234.  
  235.  #else
  236. -
  237. -char ver[] = "Unidentified build, " __DATE__ " " __TIME__;
  238. -char sshver[] = "PuTTY-Local: " __DATE__ " " __TIME__;
  239. +/***************Patch GNS3 PuTTY *******************/
  240. +char ver[] = "GNS3 build 0.62.1, " __DATE__ " " __TIME__;
  241. +//char ver[] = "GNS3 build 0.62.1 [Standalone] , " __DATE__ " " __TIME__;
  242. +char sshver[] = "PuTTY-GNS3-0.62.1";
  243. +/***************************************************/
  244.  
  245.  #endif
  246.  
  247. diff -rup putty-src-orig\WINDOWS\PUTTY.RC putty-src\WINDOWS\Putty.rc
  248. --- putty-src-orig\WINDOWS\PUTTY.RC Tue Oct 04 15:13:28 2005
  249. +++ putty-src\WINDOWS\Putty.rc  Wed Jul 11 00:48:50 2012
  250. @@ -1,10 +1,247 @@
  251. +// Microsoft Visual C++ generated resource script.
  252. +//
  253. +#include "resource.h"
  254. +
  255. +#define APSTUDIO_READONLY_SYMBOLS
  256. +/////////////////////////////////////////////////////////////////////////////
  257. +//
  258. +// Generated from the TEXTINCLUDE 2 resource.
  259. +//
  260.  #include "rcstuff.h"
  261. +#include "win_res.h"
  262. +
  263. +/////////////////////////////////////////////////////////////////////////////
  264. +#undef APSTUDIO_READONLY_SYMBOLS
  265. +
  266. +/////////////////////////////////////////////////////////////////////////////
  267. +// English (U.S.) resources
  268. +
  269. +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
  270. +#ifdef _WIN32
  271. +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
  272. +#pragma code_page(1252)
  273. +#endif //_WIN32
  274. +
  275. +/////////////////////////////////////////////////////////////////////////////
  276. +//
  277. +// Icon
  278. +//
  279. +
  280. +// Icon with lowest ID value placed first to ensure application icon
  281. +// remains consistent on all systems.
  282. +IDI_MAINICON            ICON                    "putty.ico"
  283. +IDI_CFGICON             ICON                    "puttycfg.ico"
  284. +
  285. +/////////////////////////////////////////////////////////////////////////////
  286. +//
  287. +// Dialog
  288. +//
  289. +
  290. +IDD_ABOUTBOX DIALOGEX 140, 40, 309, 321
  291. +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
  292. +    WS_SYSMENU
  293. +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  294. +BEGIN
  295. +    DEFPUSHBUTTON   "&Close",IDOK,253,303,48,14
  296. +    PUSHBUTTON      "View &Licence",IDA_LICENCE,6,303,70,14
  297. +    PUSHBUTTON      "Visit &PuTTY Site",IDA_WEB,89,303,70,14
  298. +    PUSHBUTTON      "Visit &GNS3 Site",IDA_GNS3_WEB,171,303,70,14
  299. +    CTEXT           "PuTTY",IDA_TEXT1,33,1,244,9
  300. +    CTEXT           "© 1997-2012 Simon Tatham. All rights reserved.\nModified by Piroi Ninel for the GNS3 project",
  301. +                    IDA_TEXT2,49,280,197,19
  302. +    CTEXT           " Version Number",IDA_VERSION,16,13,283,10
  303. +    LTEXT           "Usage [new options]:\nCLI:    putty -wt   R1   -gns3 5 -skin 3 -log ""C:\\Logs_Dir""\nGNS3: putty -wt ""%d"" -gns3 5 -skin 4 -telnet %h %p\n\n-wt ""New Title""  #Change the window title from command line\n*Will disable remote title",
  304. +                    IDA_TEXT3,4,23,283,47
  305. +    LTEXT           " -gns3 <NR>     #Advanced PuTTY options tunned for GNS3 usage\n *Don't close the window when the connection is down\n *Disable warning message before closing the window\n *Disable beeps (Irritating!)\n *Allow Alt+F4 to close the window",
  306. +                    IDA_TEXT4,1,74,283,41
  307. +    LTEXT           " *Disable remote resize\n *Configure scroll lines to 2500 (default was 200)\n *Push a enter key on telnet/serial console (NEW!)\n *Replace all MessageBox errors with a message in the title bar (NEW!)",
  308. +                    IDA_TEXT6,1,114,283,41
  309. +    LTEXT           " *Automatically reconnect a inactive session on error after <NR> seconds (NEW!)\n    NR = Number of seconds to wait before restarting a inactive session\n    NR = 0 means no automatically restart!",
  310. +                    IDA_TEXT9,2,147,283,26
  311. +    LTEXT           "-log ""<DIR_PATH>"" #Enable logging to files (.log). Use it after the ""-wt"" option in CLI.\n*Will log all printable output\n*Ex: <DIR_PATH>\4.Jun.12_21.48.17_R1.log\n*Warning: Do not use '/, \\, |, *, ?, <, >, "", :' in -wt variable!",
  312. +                    IDA_TEXT10,3,228,284,33
  313. +    LTEXT           " * Toggle ""Always on top / Transparent Window"" from menu (Right click on title bar)",
  314. +                    IDA_TEXT11,2,265,288,11
  315. +    LTEXT           "-skin <NR>      #Apply a color theme from 4 hard-coded options\n 1 - Night mode\n 2 - Desert theme\n 3 - Matrix theme :)\n 4 - Gold theme\n X - Default theme",
  316. +                    IDA_TEXT5,3,176,283,48
  317. +END
  318. +
  319. +IDD_MAINBOX DIALOG  0, 0, 300, 252
  320. +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  321. +CAPTION "PuTTY Configuration"
  322. +CLASS "PuTTYConfigBox"
  323. +FONT 8, "MS Shell Dlg"
  324. +BEGIN
  325. +END
  326. +
  327. +IDD_LOGBOX DIALOGEX 100, 20, 300, 118
  328. +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
  329. +    WS_SYSMENU
  330. +CAPTION "PuTTY Event Log"
  331. +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  332. +BEGIN
  333. +    DEFPUSHBUTTON   "&Close",IDOK,135,102,44,14
  334. +    PUSHBUTTON      "C&opy",IDN_COPY,81,102,44,14
  335. +    LISTBOX         IDN_LIST,3,3,294,95,LBS_HASSTRINGS | LBS_USETABSTOPS |
  336. +                    LBS_EXTENDEDSEL | WS_VSCROLL
  337. +END
  338. +
  339. +IDD_LICENCEBOX DIALOGEX 50, 50, 226, 263
  340. +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
  341. +    WS_SYSMENU
  342. +CAPTION "PuTTY Licence"
  343. +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  344. +BEGIN
  345. +    DEFPUSHBUTTON   "OK",IDOK,98,243,44,14
  346. +    LTEXT           "Copyright © 1997-2012 Simon Tatham",1000,10,10,206,8
  347. +    LTEXT           "Portions copyright Robert de Bath, Joris van Rantwijk, Delian",
  348. +                    1001,10,26,206,8
  349. +    LTEXT           "Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas",
  350. +                    1002,10,34,206,8
  351. +    LTEXT           "Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa,",
  352. +                    1003,10,42,206,8
  353. +    LTEXT           "Markus Kuhn, Colin Watson, and CORE SDI S.A.",1004,10,
  354. +                    50,206,8
  355. +    LTEXT           "Permission is hereby granted, free of charge, to any person",
  356. +                    1005,10,66,206,8
  357. +    LTEXT           "obtaining a copy of this software and associated documentation",
  358. +                    1006,10,74,206,8
  359. +    LTEXT           "files (the ""Software""), to deal in the Software without restriction,",
  360. +                    1007,10,82,206,8
  361. +    LTEXT           "including without limitation the rights to use, copy, modify, merge,",
  362. +                    1008,10,90,206,8
  363. +    LTEXT           "publish, distribute, sublicense, and/or sell copies of the Software,",
  364. +                    1009,10,98,206,8
  365. +    LTEXT           "and to permit persons to whom the Software is furnished to do so,",
  366. +                    1010,10,106,206,8
  367. +    LTEXT           "subject to the following conditions:",1011,10,114,206,8
  368. +    LTEXT           "The above copyright notice and this permission notice shall be",
  369. +                    1012,10,130,206,8
  370. +    LTEXT           "included in all copies or substantial portions of the Software.",
  371. +                    1013,10,138,206,8
  372. +    LTEXT           "THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT",1014,10,
  373. +                    154,206,8
  374. +    LTEXT           "WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,",1015,10,162,
  375. +                    206,8
  376. +    LTEXT           "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",1016,10,
  377. +                    170,206,8
  378. +    LTEXT           "MERCHANTABILITY, FITNESS FOR A PARTICULAR",1017,10,178,
  379. +                    206,8
  380. +    LTEXT           "PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE",
  381. +                    1018,10,186,206,8
  382. +    LTEXT           "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES",
  383. +                    1019,10,194,206,8
  384. +    LTEXT           "OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,",
  385. +                    1020,10,202,206,8
  386. +    LTEXT           "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN",1021,10,
  387. +                    210,206,8
  388. +    LTEXT           "CONNECTION WITH THE SOFTWARE OR THE USE OR",1022,10,218,
  389. +                    206,8
  390. +    LTEXT           "OTHER DEALINGS IN THE SOFTWARE.",1023,10,226,206,8
  391. +END
  392. +
  393. +
  394. +/////////////////////////////////////////////////////////////////////////////
  395. +//
  396. +// Version
  397. +//
  398. +
  399. +VS_VERSION_INFO VERSIONINFO
  400. + FILEVERSION 0,62,1,0
  401. + PRODUCTVERSION 0,62,1,0
  402. + FILEFLAGSMASK 0x3L
  403. +#ifdef _DEBUG
  404. + FILEFLAGS 0x1L
  405. +#else
  406. + FILEFLAGS 0x0L
  407. +#endif
  408. + FILEOS 0x4L
  409. + FILETYPE 0x1L
  410. + FILESUBTYPE 0x0L
  411. +BEGIN
  412. +    BLOCK "StringFileInfo"
  413. +    BEGIN
  414. +        BLOCK "080904b0"
  415. +        BEGIN
  416. +            VALUE "Comments", "Modified by Piroi Ninel for the GNS3 project."
  417. +            VALUE "CompanyName", "Simon Tatham"
  418. +            VALUE "FileDescription", "SSH, Telnet and Rlogin client, GNS3 Build"
  419. +            VALUE "FileVersion", "Release 0.62.1, GNS3 Build"
  420. +            VALUE "InternalName", "PuTTY"
  421. +            VALUE "LegalCopyright", "Copyright © 1997-2012 Simon Tatham."
  422. +            VALUE "OriginalFilename", "PuTTY"
  423. +            VALUE "ProductName", "PuTTY suite"
  424. +            VALUE "ProductVersion", "Release 0.62.1, GNS3 Build"
  425. +        END
  426. +    END
  427. +    BLOCK "VarFileInfo"
  428. +    BEGIN
  429. +        VALUE "Translation", 0x809, 1200
  430. +    END
  431. +END
  432. +
  433. +
  434. +/////////////////////////////////////////////////////////////////////////////
  435. +//
  436. +// RT_MANIFEST
  437. +//
  438. +
  439. +1                       RT_MANIFEST             "putty.mft"
  440. +
  441. +#ifdef APSTUDIO_INVOKED
  442. +/////////////////////////////////////////////////////////////////////////////
  443. +//
  444. +// TEXTINCLUDE
  445. +//
  446. +
  447. +1 TEXTINCLUDE
  448. +BEGIN
  449. +    "resource.h\0"
  450. +END
  451. +
  452. +2 TEXTINCLUDE
  453. +BEGIN
  454. +    "#include ""rcstuff.h""\r\n"
  455. +    "#include ""win_res.h""\r\n"
  456. +    "\0"
  457. +END
  458. +
  459. +3 TEXTINCLUDE
  460. +BEGIN
  461. +    "\r\n"
  462. +    "\0"
  463. +END
  464. +
  465. +#endif    // APSTUDIO_INVOKED
  466. +
  467. +
  468. +/////////////////////////////////////////////////////////////////////////////
  469. +//
  470. +// DESIGNINFO
  471. +//
  472. +
  473. +#ifdef APSTUDIO_INVOKED
  474. +GUIDELINES DESIGNINFO
  475. +BEGIN
  476. +    IDD_ABOUTBOX, DIALOG
  477. +    BEGIN
  478. +        BOTTOMMARGIN, 317
  479. +    END
  480. +END
  481. +#endif    // APSTUDIO_INVOKED
  482. +
  483. +#endif    // English (U.S.) resources
  484. +/////////////////////////////////////////////////////////////////////////////
  485. +
  486. +
  487. +
  488. +#ifndef APSTUDIO_INVOKED
  489. +/////////////////////////////////////////////////////////////////////////////
  490. +//
  491. +// Generated from the TEXTINCLUDE 3 resource.
  492. +//
  493.  
  494. -#define APPNAME "PuTTY"
  495. -#define APPDESC "SSH, Telnet and Rlogin client"
  496.  
  497. -#include "win_res.rc2"
  498. +/////////////////////////////////////////////////////////////////////////////
  499. +#endif    // not APSTUDIO_INVOKED
  500.  
  501. -#ifndef NO_MANIFESTS
  502. -1 RT_MANIFEST "putty.mft"
  503. -#endif /* NO_MANIFESTS */
  504. diff -rup putty-src-orig\WINDOWS\VERSION.RC2 putty-src\WINDOWS\VERSION.RC2
  505. --- putty-src-orig\WINDOWS\VERSION.RC2  Sat Dec 10 12:08:10 2011
  506. +++ putty-src\WINDOWS\VERSION.RC2   Mon Jun 18 22:10:39 2012
  507. @@ -79,7 +79,7 @@
  508.  
  509.  /* We can't reliably get the same date and time as version.c, so
  510.   * we won't bother trying. */
  511. -#define VERSION_TEXT "Unidentified build"
  512. +#define VERSION_TEXT "0.62.1 GNS3 Build"
  513.  #define BINARY_VERSION 0,0,0,0
  514.  
  515.  #endif
  516. diff -rup putty-src-orig\WINDOWS\WIN_RES.H putty-src\WINDOWS\WIN_RES.H
  517. --- putty-src-orig\WINDOWS\WIN_RES.H    Sun Apr 23 19:26:04 2006
  518. +++ putty-src\WINDOWS\WIN_RES.H Fri Jun 22 20:10:56 2012
  519. @@ -23,6 +23,7 @@
  520.  #define IDA_TEXT2       1004
  521.  #define IDA_LICENCE     1005
  522.  #define IDA_WEB         1006
  523. +#define IDA_GNS3_WEB    1007
  524.  
  525.  #define IDC_TAB         1001
  526.  #define IDC_TABSTATIC1  1002
  527. diff -rup putty-src-orig\WINDOWS\WIN_RES.RC2 putty-src\WINDOWS\WIN_RES.RC2
  528. --- putty-src-orig\WINDOWS\WIN_RES.RC2  Wed Jan 05 12:01:00 2011
  529. +++ putty-src\WINDOWS\WIN_RES.RC2   Mon May 07 22:28:03 2012
  530. @@ -25,7 +25,7 @@ BEGIN
  531.      PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 52, 70, 14
  532.      PUSHBUTTON "Visit &Web Site", IDA_WEB, 84, 52, 70, 14
  533.      CTEXT "PuTTY", IDA_TEXT1, 10, 6, 194, 8
  534. -    CTEXT "", IDA_VERSION, 10, 16, 194, 16
  535. +    CTEXT "0.62.1 GNS3 Build", IDA_VERSION, 10, 16, 194, 16
  536.      CTEXT "\251 1997-2011 Simon Tatham. All rights reserved.",
  537.            IDA_TEXT2, 10, 34, 194, 16
  538.  END
  539. diff -rup putty-src-orig\WINDOWS\WINDLG.C putty-src\WINDOWS\WINDLG.C
  540. --- putty-src-orig\WINDOWS\WINDLG.C Wed Dec 29 14:11:26 2010
  541. +++ putty-src\WINDOWS\WINDLG.C  Fri Jun 22 21:33:07 2012
  542. @@ -220,6 +220,14 @@ static int CALLBACK AboutProc(HWND hwnd,
  543.              "http://www.chiark.greenend.org.uk/~sgtatham/putty/",
  544.              0, 0, SW_SHOWDEFAULT);
  545.         return 0;
  546. +   /***************Patch GNS3 PuTTY *******************/
  547. +     case IDA_GNS3_WEB:
  548. +       /* Load web browser */
  549. +       ShellExecute(hwnd, "open",
  550. +            "http://www.gns3.net/putty/",
  551. +            0, 0, SW_SHOWDEFAULT);
  552. +       return 0;
  553. +   /***************************************************/
  554.     }
  555.     return 0;
  556.        case WM_CLOSE:
  557. diff -rup putty-src-orig\WINDOWS\WINDOW.C putty-src\WINDOWS\WINDOW.C
  558. --- putty-src-orig\WINDOWS\WINDOW.C Sat Jul 16 12:26:20 2011
  559. +++ putty-src\WINDOWS\WINDOW.C  Thu Jul 12 00:43:26 2012
  560. @@ -34,6 +34,16 @@
  561.   * attempt to store information in them. Hence all these identifiers have
  562.   * the low 4 bits clear. Also, identifiers should < 0xF000. */
  563.  
  564. +/***************Patch GNS3 PuTTY *******************/
  565. +#define IDM_TOPMOST   0x0210
  566. +#define IDM_TRANSPARENT_1 0x0220
  567. +#define IDM_TRANSPARENT_2 0x0230
  568. +#define IDM_TRANSPARENT_3 0x0240
  569. +#define IDM_TRANSPARENT_4 0x0250
  570. +#define IDM_TRANSPARENT_5 0x0260
  571. +#define LWA_ALPHA 2 //for transparent
  572. +#define WS_EX_LAYERED 0x00080000L //for transparent
  573. +/***************************************************/
  574.  #define IDM_SHOWLOG   0x0010
  575.  #define IDM_NEWSESS   0x0020
  576.  #define IDM_DUPSESS   0x0030
  577. @@ -76,6 +86,11 @@
  578.  #define WHEEL_DELTA 120
  579.  #endif
  580.  
  581. +/***************Patch GNS3 PuTTY *******************/
  582. +HANDLE hThread1;
  583. +static BOOL init_transparent = 0;
  584. +/***************************************************/
  585. +
  586.  static Mouse_Button translate_button(Mouse_Button button);
  587.  static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  588.  static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
  589. @@ -94,6 +109,10 @@ static int is_full_screen(void);
  590.  static void make_full_screen(void);
  591.  static void clear_full_screen(void);
  592.  static void flip_full_screen(void);
  593. +/***************Patch GNS3 PuTTY *******************/
  594. +static void flip_top_most(void);
  595. +static void flip_transparent(int factor);
  596. +/***************************************************/
  597.  static int process_clipdata(HGLOBAL clipdata, int unicode);
  598.  
  599.  /* Window layout information */
  600. @@ -139,6 +158,9 @@ static struct {
  601.  } popup_menus[2];
  602.  enum { SYSMENU, CTXMENU };
  603.  static HMENU savedsess_menu;
  604. +/***************Patch GNS3 PuTTY *******************/
  605. +static HMENU transparent_menu;
  606. +/***************************************************/
  607.  
  608.  Config cfg;                   /* exported to windlg.c */
  609.  
  610. @@ -236,60 +258,101 @@ static void start_backend(void)
  611.                cfg.host, cfg.port, &realhost, cfg.tcp_nodelay,
  612.                cfg.tcp_keepalives);
  613.      back->provide_logctx(backhandle, logctx);
  614. +   /***************Patch GNS3 PuTTY *******************/
  615.      if (error) {
  616. -   char *str = dupprintf("%s Error", appname);
  617. -   sprintf(msg, "Unable to open connection to\n"
  618. -       "%.800s\n" "%s", cfg_dest(&cfg), error);
  619. -   MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
  620. -   sfree(str);
  621. -   exit(0);
  622. -    }
  623. -    window_name = icon_name = NULL;
  624. -    if (*cfg.wintitle) {
  625. -   title = cfg.wintitle;
  626. -    } else {
  627. -   sprintf(msg, "%s - %s", realhost, appname);
  628. -   title = msg;
  629. -    }
  630. -    sfree(realhost);
  631. -    set_title(NULL, title);
  632. -    set_icon(NULL, title);
  633. +       char *str = dupprintf("%s Error", appname);
  634. +  
  635. +       if(cfg.no_annoying_msgbox) {
  636. +           sprintf(msg, "Unable to open: %.800s", cfg_dest(&cfg));
  637. +           set_title_plus_error(NULL, msg);
  638. +           logevent(NULL, msg);
  639. +       }else{
  640. +           sprintf(msg, "Unable to open connection to\n%.800s\n%s", cfg_dest(&cfg), error);
  641. +           MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
  642. +           exit(0);
  643. +       }
  644.  
  645. -    /*
  646. -     * Connect the terminal to the backend for resize purposes.
  647. -     */
  648. -    term_provide_resize_fn(term, back->size, backhandle);
  649. +       sfree(str);
  650. +       must_close_session = TRUE;
  651. +       session_closed = TRUE;
  652.  
  653. -    /*
  654. -     * Set up a line discipline.
  655. -     */
  656. -    ldisc = ldisc_create(&cfg, term, back, backhandle, NULL);
  657. +   } else {
  658. +  
  659. +       window_name = icon_name = NULL;
  660. +       if (*cfg.wintitle) {
  661. +       title = cfg.wintitle;
  662. +       } else {
  663. +       sprintf(msg, "%s - %s", realhost, appname);
  664. +       title = msg;
  665. +       }
  666. +       sfree(realhost);
  667. +       set_title(NULL, title);
  668. +       set_icon(NULL, title);
  669.  
  670. -    /*
  671. -     * Destroy the Restart Session menu item. (This will return
  672. -     * failure if it's already absent, as it will be the very first
  673. -     * time we call this function. We ignore that, because as long
  674. -     * as the menu item ends up not being there, we don't care
  675. -     * whether it was us who removed it or not!)
  676. -     */
  677. -    for (i = 0; i < lenof(popup_menus); i++) {
  678. -   DeleteMenu(popup_menus[i].menu, IDM_RESTART, MF_BYCOMMAND);
  679. -    }
  680. +       /*
  681. +        * Connect the terminal to the backend for resize purposes.
  682. +        */
  683. +       term_provide_resize_fn(term, back->size, backhandle);
  684.  
  685. -    must_close_session = FALSE;
  686. -    session_closed = FALSE;
  687. +       /*
  688. +        * Set up a line discipline.
  689. +        */
  690. +       ldisc = ldisc_create(&cfg, term, back, backhandle, NULL);
  691. +
  692. +       /*
  693. +        * Destroy the Restart Session menu item. (This will return
  694. +        * failure if it's already absent, as it will be the very first
  695. +        * time we call this function. We ignore that, because as long
  696. +        * as the menu item ends up not being there, we don't care
  697. +        * whether it was us who removed it or not!)
  698. +        */
  699. +       for (i = 0; i < lenof(popup_menus); i++) {
  700. +       DeleteMenu(popup_menus[i].menu, IDM_RESTART, MF_BYCOMMAND);
  701. +       }
  702. +
  703. +       must_close_session = FALSE;
  704. +       session_closed = FALSE;
  705. +   }
  706. +   /**************************************************/
  707. +}
  708. +
  709. +/***************Patch GNS3 PuTTY *******************/
  710. +void WINAPI TimerRoutine(void)
  711. +{
  712. +   int i;
  713. +   char morestuff[255], title[155];
  714. +   GetWindowText(hwnd, title, sizeof(title));
  715. +   for (i = cfg.reconnect_after_error; i >= 1; i--) {
  716. +       sprintf(morestuff, "%s - [Restart in %ds]", title, i);
  717. +       set_title(NULL, morestuff);
  718. +       set_icon(NULL, morestuff);
  719. +       Sleep(1000);
  720. +       }
  721. +
  722. +   sprintf(morestuff, "%s - [Restarting...]", title, i);
  723. +   set_title(NULL, morestuff);
  724. +   set_icon(NULL, morestuff);
  725. +   Sleep(250);
  726. +
  727. +   PostMessage(hwnd, IDM_RESTART, 0, 0);
  728.  }
  729. +/**************************************************/
  730.  
  731.  static void close_session(void)
  732.  {
  733. -    char morestuff[100];
  734.      int i;
  735. +   /***************Patch GNS3 PuTTY *******************/
  736. +    char morestuff[255], title[155];
  737.  
  738. -    session_closed = TRUE;
  739. -    sprintf(morestuff, "%.70s (inactive)", appname);
  740. -    set_icon(NULL, morestuff);
  741. -    set_title(NULL, morestuff);
  742. +   session_closed = TRUE;
  743. +   GetWindowText(hwnd, title, sizeof(title));
  744. +    sprintf(morestuff, "%s - (inactive)", title);
  745.  
  746. +    set_icon(NULL, morestuff);
  747. +   set_title(NULL, morestuff);
  748. +   //SetSysColors(2, COLOR_WINDOW, RGB(0x255, 0x0, 0x0));
  749. +   /***************************************************/
  750. +  
  751.      if (ldisc) {
  752.     ldisc_free(ldisc);
  753.     ldisc = NULL;
  754. @@ -320,6 +383,11 @@ static void close_session(void)
  755.       * window title change above.
  756.       */
  757.      must_close_session = FALSE;
  758. +   /***************Patch GNS3 PuTTY *******************/  
  759. +   if(cfg.reconnect_after_error) {
  760. +       hThread1 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)TimerRoutine, NULL, 0, NULL);
  761. +   }
  762. +   /***************************************************/
  763.  }
  764.  
  765.  int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
  766. @@ -777,6 +845,15 @@ int WINAPI WinMain(HINSTANCE inst, HINST
  767.     get_sesslist(&sesslist, TRUE);
  768.     update_savedsess_menu();
  769.  
  770. +   /***************Patch GNS3 PuTTY *******************/
  771. +   transparent_menu = CreateMenu();
  772. +   AppendMenu(transparent_menu, MF_ENABLED, IDM_TRANSPARENT_5, "Off");
  773. +   AppendMenu(transparent_menu, MF_ENABLED, IDM_TRANSPARENT_4, "20%");
  774. +   AppendMenu(transparent_menu, MF_ENABLED, IDM_TRANSPARENT_3, "40%");
  775. +   AppendMenu(transparent_menu, MF_ENABLED, IDM_TRANSPARENT_2, "60%");
  776. +   AppendMenu(transparent_menu, MF_ENABLED, IDM_TRANSPARENT_1, "80%");
  777. +   /***************************************************/
  778. +  
  779.     for (j = 0; j < lenof(popup_menus); j++) {
  780.         m = popup_menus[j].menu;
  781.  
  782. @@ -795,6 +872,10 @@ int WINAPI WinMain(HINSTANCE inst, HINST
  783.         AppendMenu(m, MF_SEPARATOR, 0, 0);
  784.         AppendMenu(m, (cfg.resize_action == RESIZE_DISABLED) ?
  785.                MF_GRAYED : MF_ENABLED, IDM_FULLSCREEN, "&Full Screen");
  786. +       /***************Patch GNS3 PuTTY *******************/
  787. +       AppendMenu(m, MF_ENABLED, IDM_TOPMOST, "Alwa&ys on Top");
  788. +       AppendMenu(m, MF_POPUP | MF_ENABLED, (UINT) transparent_menu, "Transparent W&indow");
  789. +       /***************************************************/
  790.         AppendMenu(m, MF_SEPARATOR, 0, 0);
  791.         if (has_help())
  792.         AppendMenu(m, MF_ENABLED, IDM_HELP, "&Help");
  793. @@ -811,6 +892,10 @@ int WINAPI WinMain(HINSTANCE inst, HINST
  794.       */
  795.      set_input_locale(GetKeyboardLayout(0));
  796.  
  797. +   /***************Patch GNS3 PuTTY *******************/
  798. +   flip_transparent(cfg.transparent_factor); //init transparent window
  799. +   /***************************************************/
  800. +
  801.      /*
  802.       * Finally show the window!
  803.       */
  804. @@ -1082,8 +1167,16 @@ void connection_fatal(void *frontend, ch
  805.      va_start(ap, fmt);
  806.      stuff = dupvprintf(fmt, ap);
  807.      va_end(ap);
  808. -    sprintf(morestuff, "%.70s Fatal Error", appname);
  809. -    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
  810. +
  811. +   /***************Patch GNS3 PuTTY *******************/
  812. +   if(cfg.no_annoying_msgbox) {
  813. +       set_title_plus_error(NULL, stuff);
  814. +   }else{
  815. +       sprintf(morestuff, "%.70s Fatal Error", appname);
  816. +       MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
  817. +   }
  818. +   /***************************************************/
  819. +
  820.      sfree(stuff);
  821.  
  822.      if (cfg.close_on_exit == FORCE_ON)
  823. @@ -1969,9 +2062,16 @@ void notify_remote_exit(void *fe)
  824.         /* exitcode == INT_MAX indicates that the connection was closed
  825.          * by a fatal error, so an error box will be coming our way and
  826.          * we should not generate this informational one. */
  827. -       if (exitcode != INT_MAX)
  828. -       MessageBox(hwnd, "Connection closed by remote host",
  829. -              appname, MB_OK | MB_ICONINFORMATION);
  830. +       /***************Patch GNS3 PuTTY *******************/
  831. +       if (exitcode != INT_MAX) {
  832. +           if(cfg.no_annoying_msgbox) {
  833. +               set_title_plus_error(NULL, "Connection closed by remote host");
  834. +               logevent(NULL, "Connection closed by remote host");
  835. +           }else{
  836. +               MessageBox(hwnd, "Connection closed by remote host", appname, MB_OK | MB_ICONINFORMATION);
  837. +           }
  838. +       }
  839. +       /***************************************************/
  840.     }
  841.      }
  842.  }
  843. @@ -2027,6 +2127,18 @@ static LRESULT CALLBACK WndProc(HWND hwn
  844.     show_mouseptr(1);
  845.     PostQuitMessage(0);
  846.     return 0;
  847. +   /***************Patch GNS3 PuTTY *******************/
  848. +     case IDM_RESTART:
  849. +       if (!back) {
  850. +           char morestuff[200];
  851. +           sprintf(morestuff, "----- Session auto-restarted on error (every %ds) -----", cfg.reconnect_after_error);
  852. +           logevent(NULL, morestuff);
  853. +
  854. +           if (cfg.protocol != PROT_SERIAL) { term_pwron(term, FALSE); }
  855. +           start_backend();
  856. +       }
  857. +       break;
  858. +   /***************************************************/
  859.        case WM_INITMENUPOPUP:
  860.     if ((HMENU)wParam == savedsess_menu) {
  861.         /* About to pop up Saved Sessions sub-menu.
  862. @@ -2116,11 +2228,13 @@ static LRESULT CALLBACK WndProc(HWND hwn
  863.         break;
  864.       case IDM_RESTART:
  865.         if (!back) {
  866. -       logevent(NULL, "----- Session restarted -----");
  867. -       term_pwron(term, FALSE);
  868. +       /***************Patch GNS3 PuTTY *******************/
  869. +       logevent(NULL, "----- Session restarted manually -----");
  870. +       if (hThread1 != NULL) TerminateThread(hThread1, 0);
  871. +       if (cfg.protocol != PROT_SERIAL) { term_pwron(term, FALSE); }
  872. +       /***************************************************/
  873.         start_backend();
  874.         }
  875. -
  876.         break;
  877.       case IDM_RECONF:
  878.         {
  879. @@ -2181,6 +2295,11 @@ static LRESULT CALLBACK WndProc(HWND hwn
  880.         if (back)
  881.             back->reconfig(backhandle, &cfg);
  882.  
  883. +       /***************Patch GNS3 PuTTY *******************/
  884. +       /* Change transparent settings if modified */
  885. +       if (cfg.transparent_factor != prev_cfg.transparent_factor) flip_transparent(cfg.transparent_factor);
  886. +       /***************************************************/
  887. +
  888.         /* Screen size changed ? */
  889.         if (cfg.height != prev_cfg.height ||
  890.             cfg.width != prev_cfg.width ||
  891. @@ -2320,6 +2439,26 @@ static LRESULT CALLBACK WndProc(HWND hwn
  892.       case IDM_FULLSCREEN:
  893.         flip_full_screen();
  894.         break;
  895. +   /***************Patch GNS3 PuTTY *******************/
  896. +     case IDM_TOPMOST:
  897. +       flip_top_most();
  898. +       break;
  899. +     case IDM_TRANSPARENT_1:
  900. +       flip_transparent(50);
  901. +       break;
  902. +     case IDM_TRANSPARENT_2:
  903. +       flip_transparent(100);
  904. +       break;
  905. +     case IDM_TRANSPARENT_3:
  906. +       flip_transparent(150);
  907. +       break;
  908. +     case IDM_TRANSPARENT_4:
  909. +       flip_transparent(200);
  910. +       break;
  911. +     case IDM_TRANSPARENT_5:
  912. +       flip_transparent(255);
  913. +       break;
  914. +   /***************************************************/
  915.       default:
  916.         if (wParam >= IDM_SAVED_MIN && wParam < IDM_SAVED_MAX) {
  917.         SendMessage(hwnd, WM_SYSCOMMAND, IDM_SAVEDSESS, wParam);
  918. @@ -4527,6 +4666,31 @@ void set_title(void *frontend, char *tit
  919.     SetWindowText(hwnd, title);
  920.  }
  921.  
  922. +/***************Patch GNS3 PuTTY *******************/
  923. +void set_title_plus_error(void *frontend, char *error)
  924. +{
  925. +    char title[512];
  926. +  
  927. +   if (strlen(cfg.wintitle) >= 1) {
  928. +       if (cfg.protocol == PROT_SERIAL) {
  929. +           sprintf(title, "Serial Error (%s) - %s!\0", cfg.wintitle, error); //serial with title
  930. +       } else {
  931. +           sprintf(title, "%s:%d (%s) - %s!\0", cfg.host, cfg.port, cfg.wintitle, error); //telnet with title
  932. +       }
  933. +   } else {
  934. +       if (cfg.protocol == PROT_SERIAL) {
  935. +           sprintf(title, "Serial Error - %s!\0", error); //serial without title
  936. +       } else {
  937. +           sprintf(title, "%s:%d - %s!\0",      cfg.host, cfg.port, error); //telnet without title
  938. +       }
  939. +   }
  940. + sfree(window_name);
  941. + window_name = snewn(1 + strlen(title), char);
  942. + strcpy(window_name, title);
  943. + SetWindowText(hwnd, title);
  944. +}
  945. +/***************************************************/
  946. +
  947.  void set_icon(void *frontend, char *title)
  948.  {
  949.      sfree(icon_name);
  950. @@ -5504,6 +5668,62 @@ static void flip_full_screen()
  951.     ShowWindow(hwnd, SW_MAXIMIZE);
  952.      }
  953.  }
  954. +
  955. +/***************Patch GNS3 PuTTY *******************/
  956. +/*
  957. + * Toggle always on top mode.
  958. + */
  959. +static void flip_top_most()
  960. +{
  961. +   int i;
  962. +   if (!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)){
  963. +       SetWindowPos(hwnd, HWND_TOPMOST,   0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  964. +       for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TOPMOST, MF_CHECKED); //Tick the menu item in the System and context menus.
  965. +    }
  966. +   else{
  967. +       SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  968. +       for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TOPMOST, MF_UNCHECKED); //Untick the menu item in the System and context menus.
  969. +   }
  970. +}
  971. +
  972. +DECL_WINDOWS_FUNCTION(static, BOOL, SetLayeredWindowAttributes, (HWND, COLORREF, BYTE, DWORD));
  973. +
  974. +static void flip_transparent(int factor)
  975. +{
  976. +   int i;
  977. +
  978. +   if(!init_transparent) // do this once
  979. +       {
  980. +       HMODULE user32_module = load_system32_dll("user32.dll");
  981. +       GET_WINDOWS_FUNCTION (user32_module, SetLayeredWindowAttributes);
  982. +       init_transparent = 1;
  983. +       }
  984. +
  985. +   factor = factor % 256;
  986. +   cfg.transparent_factor = factor;
  987. +  
  988. +   for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_1, MF_UNCHECKED); //Untick all
  989. +   for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_2, MF_UNCHECKED);
  990. +   for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_3, MF_UNCHECKED);
  991. +   for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_4, MF_UNCHECKED);
  992. +   for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_5, MF_UNCHECKED);
  993. +  
  994. +        if((factor >=   0) && (factor <=  50)) for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_1, MF_CHECKED); //Tick one of them
  995. +   else if((factor >   50) && (factor <= 100)) for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_2, MF_CHECKED);
  996. +   else if((factor >  100) && (factor <= 150)) for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_3, MF_CHECKED);
  997. +   else if((factor >  150) && (factor <= 254)) for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_4, MF_CHECKED);
  998. +   else if(factor ==  255)                     for (i = 0; i < lenof(popup_menus); i++) CheckMenuItem(popup_menus[i].menu, IDM_TRANSPARENT_5, MF_CHECKED);
  999. +  
  1000. +   if(factor != 255)
  1001. +       {
  1002. +       SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); //enable layers for transparent (do this once per window that shall become transparent)
  1003. +       p_SetLayeredWindowAttributes(hwnd, 0, factor, LWA_ALPHA);                           // do this everytime you want to change the transparency value
  1004. +   }
  1005. +   else{
  1006. +       SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) & ~WS_EX_LAYERED); //disable transparent
  1007. +   }
  1008. +}
  1009. +/***************************************************/
  1010.  
  1011.  void frontend_keypress(void *handle)
  1012.  {
  1013. diff -rup putty-src-orig\WINDOWS\WINPGNTC.C putty-src\WINDOWS\WINPGNTC.C
  1014. --- putty-src-orig\WINDOWS\WINPGNTC.C   Wed Jun 08 21:47:08 2011
  1015. +++ putty-src\WINDOWS\WINPGNTC.C    Wed Jun 13 22:16:15 2012
  1016. @@ -86,10 +86,13 @@ DECL_WINDOWS_FUNCTION(static, BOOL, Init
  1017.               (PSECURITY_DESCRIPTOR, DWORD));
  1018.  DECL_WINDOWS_FUNCTION(static, BOOL, SetSecurityDescriptorOwner,
  1019.               (PSECURITY_DESCRIPTOR, PSID, BOOL));
  1020. -DECL_WINDOWS_FUNCTION(, DWORD, GetSecurityInfo,
  1021. +/***************Patch GNS3 PuTTY *******************/
  1022. +// the word "static" was missing!
  1023. +DECL_WINDOWS_FUNCTION(static, DWORD, GetSecurityInfo,
  1024.               (HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
  1025.                PSID *, PSID *, PACL *, PACL *,
  1026.                PSECURITY_DESCRIPTOR *));
  1027. +/***************************************************/
  1028.  int init_advapi(void)
  1029.  {
  1030.      advapi = load_system32_dll("advapi32.dll");
  1031. @@ -100,6 +103,7 @@ int init_advapi(void)
  1032.     GET_WINDOWS_FUNCTION(advapi, InitializeSecurityDescriptor) &&
  1033.     GET_WINDOWS_FUNCTION(advapi, SetSecurityDescriptorOwner);
  1034.  }
  1035. +
  1036.  
  1037.  PSID get_user_sid(void)
  1038.  {
  1039. diff -rup putty-src-orig\WINDOWS\WINSER.C putty-src\WINDOWS\WINSER.C
  1040. --- putty-src-orig\WINDOWS\WINSER.C Tue Aug 10 18:21:26 2010
  1041. +++ putty-src\WINDOWS\WINSER.C  Tue Jun 19 23:54:04 2012
  1042. @@ -276,6 +276,14 @@ static const char *serial_init(void *fro
  1043.       */
  1044.      update_specials_menu(serial->frontend);
  1045.  
  1046. +  
  1047. +   /***************Patch GNS3 PuTTY *******************/
  1048. +   if (cfg->push_one_enter) { 
  1049. +       logevent(serial->frontend, "*** Press a '\\r' inside the serial port/pipe ***");
  1050. +       serial->bufsize = handle_write(serial->out, "\r", 1); //press a enter on the serial
  1051. +   }
  1052. +   /***************************************************/
  1053. +
  1054.      return NULL;
  1055.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement