Guest User

PuTTY Patch - GNS3 Build

a guest
Jun 21st, 2012
69
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 Thu Jun 21 21: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 dead 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 Jun 21 21:26:39 2012
  104. @@ -2385,4 +2385,34 @@ 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 dead session after:", 'r', 15,
  134. +             HELPCTX(no_help),
  135. +             dlg_stdeditbox_handler, I(offsetof(Config,reconnect_after_error)),
  136. +            I(-1));
  137. +   /***************************************************/
  138.  }
  139. diff -rup putty-src-orig\PUTTY.H putty-src\PUTTY.H
  140. --- putty-src-orig\PUTTY.H  Sat Jun 25 18:37:32 2011
  141. +++ putty-src\PUTTY.H   Tue Jun 19 23:56:46 2012
  142. @@ -1,5 +1,6 @@
  143.  #ifndef PUTTY_PUTTY_H
  144.  #define PUTTY_PUTTY_H
  145. +#define SECURITY_WIN32
  146.  
  147.  #include <stddef.h>               /* for wchar_t */
  148.  
  149. @@ -523,6 +524,11 @@ struct config_tag {
  150.      char ssh_nc_host[512];        /* host to connect to in `nc' mode */
  151.      int ssh_nc_port;              /* port to connect to in `nc' mode */
  152.      /* Telnet options */
  153. +   /***************Patch GNS3 PuTTY *******************/
  154. +   int push_one_enter;            /* used to pust a '\r' inside the socket */
  155. +   int no_annoying_msgbox;        /* used to replace msgbox errors with messages in title window */
  156. +   int reconnect_after_error;     /* used to automatically reconnect a telnet/serial session on error after x seconds */
  157. +   /***************************************************/
  158.      char termtype[32];
  159.      char termspeed[32];
  160.      char ttymodes[768];               /* MODE\tVvalue\0MODE\tA\0\0 */
  161. @@ -773,6 +779,9 @@ int char_width(Context ctx, int uc);
  162.  void do_scroll(Context, int, int, int);
  163.  #endif
  164.  void set_title(void *frontend, char *);
  165. +/***************Patch GNS3 PuTTY *******************/
  166. +void set_title_plus_error(void *frontend, char *error);
  167. +/***************************************************/
  168.  void set_icon(void *frontend, char *);
  169.  void set_sbar(void *frontend, int, int, int);
  170.  Context get_ctx(void *frontend);
  171. diff -rup putty-src-orig\SETTINGS.C putty-src\SETTINGS.C
  172. --- putty-src-orig\SETTINGS.C   Tue Sep 13 08:35:56 2011
  173. +++ putty-src\SETTINGS.C    Thu Jun 21 21:31:11 2012
  174. @@ -475,6 +475,11 @@ void save_open_settings(void *sesskey, C
  175.      write_setting_s(sesskey, "WinTitle", cfg->wintitle);
  176.      write_setting_i(sesskey, "TermWidth", cfg->width);
  177.      write_setting_i(sesskey, "TermHeight", cfg->height);
  178. +   /***************Patch GNS3 PuTTY *******************/
  179. +    write_setting_i(sesskey, "GNS3PushOneEnter", cfg->push_one_enter); //Save the values in regs :D
  180. +    write_setting_i(sesskey, "GNS3NoMsgBoxError", cfg->no_annoying_msgbox);
  181. +    write_setting_i(sesskey, "GNS3AutoReconnect", cfg->reconnect_after_error);
  182. +   /***************************************************/
  183.      write_setting_fontspec(sesskey, "Font", cfg->font);
  184.      write_setting_i(sesskey, "FontQuality", cfg->font_quality);
  185.      write_setting_i(sesskey, "FontVTMode", cfg->vtmode);
  186. @@ -792,8 +797,13 @@ void load_open_settings(void *sesskey, C
  187.      gppi(sesskey, "DisableBidi", 0, &cfg->bidi);
  188.      gppi(sesskey, "WinNameAlways", 1, &cfg->win_name_always);
  189.      gpps(sesskey, "WinTitle", "", cfg->wintitle, sizeof(cfg->wintitle));
  190. -    gppi(sesskey, "TermWidth", 80, &cfg->width);
  191. -    gppi(sesskey, "TermHeight", 24, &cfg->height);
  192. +   /***************Patch GNS3 PuTTY *******************/
  193. +    gppi(sesskey, "TermWidth", 110, &cfg->width); //default was 80
  194. +    gppi(sesskey, "TermHeight", 29, &cfg->height); //default was 24
  195. +    gppi(sesskey, "GNS3PushOneEnter", 0, &cfg->push_one_enter); //default is unused
  196. +    gppi(sesskey, "GNS3NoMsgBoxError", 0, &cfg->no_annoying_msgbox); //default is unused
  197. +    gppi(sesskey, "GNS3AutoReconnect", 0, &cfg->reconnect_after_error); //default is unused
  198. +   /***************************************************/
  199.      gppfont(sesskey, "Font", &cfg->font);
  200.      gppi(sesskey, "FontQuality", FQ_DEFAULT, &cfg->font_quality);
  201.      gppi(sesskey, "FontVTMode", VT_UNICODE, (int *) &cfg->vtmode);
  202. diff -rup putty-src-orig\TELNET.C putty-src\TELNET.C
  203. --- putty-src-orig\TELNET.C Mon Nov 24 17:51:42 2008
  204. +++ putty-src\TELNET.C  Mon Jun 18 20:10:54 2012
  205. @@ -765,6 +765,16 @@ static const char *telnet_init(void *fro
  206.       */
  207.      update_specials_menu(telnet->frontend);
  208.  
  209. +   /***************Patch GNS3 PuTTY *******************/
  210. +   /*
  211. +    * Push a enter key inside the telnet socket
  212. +    */
  213. +    if (telnet->cfg.push_one_enter) {
  214. +    logevent(telnet->frontend, "client:\t *** Press a '\\r' inside the Telnet socket ***");
  215. +   telnet->bufsize = sk_write(telnet->s, "\r", 1);
  216. +   }
  217. +   /***************************************************/
  218. +
  219.      /*
  220.       * loghost overrides realhost, if specified.
  221.       */
  222. diff -rup putty-src-orig\VERSION.C putty-src\VERSION.C
  223. --- putty-src-orig\VERSION.C    Sat Nov 26 17:45:52 2011
  224. +++ putty-src\VERSION.C Thu Jun 21 22:04:46 2012
  225. @@ -34,9 +34,11 @@ char ver[] = "Custom build r" STR(SVN_RE
  226.  char sshver[] = "PuTTY-Custom-r" STR(SVN_REV);
  227.  
  228.  #else
  229. -
  230. -char ver[] = "Unidentified build, " __DATE__ " " __TIME__;
  231. -char sshver[] = "PuTTY-Local: " __DATE__ " " __TIME__;
  232. +/***************Patch GNS3 PuTTY *******************/
  233. +char ver[] = "GNS3 build 0.6.2, " __DATE__ " " __TIME__;
  234. +//char ver[] = "GNS3 build 0.6.2 [Standalone] , " __DATE__ " " __TIME__;
  235. +char sshver[] = "PuTTY-GNS3-0.6.2";
  236. +/***************************************************/
  237.  
  238.  #endif
  239.  
  240. diff -rup putty-src-orig\WINDOWS\PUTTY.RC putty-src\WINDOWS\Putty.rc
  241. --- putty-src-orig\WINDOWS\PUTTY.RC Tue Oct 04 15:13:28 2005
  242. +++ putty-src\WINDOWS\Putty.rc  Thu Jun 21 21:47:13 2012
  243. @@ -1,10 +1,245 @@
  244. +// Microsoft Visual C++ generated resource script.
  245. +//
  246. +#include "resource.h"
  247. +
  248. +#define APSTUDIO_READONLY_SYMBOLS
  249. +/////////////////////////////////////////////////////////////////////////////
  250. +//
  251. +// Generated from the TEXTINCLUDE 2 resource.
  252. +//
  253.  #include "rcstuff.h"
  254. +#include "win_res.h"
  255. +
  256. +/////////////////////////////////////////////////////////////////////////////
  257. +#undef APSTUDIO_READONLY_SYMBOLS
  258. +
  259. +/////////////////////////////////////////////////////////////////////////////
  260. +// English (U.S.) resources
  261. +
  262. +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
  263. +#ifdef _WIN32
  264. +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
  265. +#pragma code_page(1252)
  266. +#endif //_WIN32
  267. +
  268. +/////////////////////////////////////////////////////////////////////////////
  269. +//
  270. +// Icon
  271. +//
  272. +
  273. +// Icon with lowest ID value placed first to ensure application icon
  274. +// remains consistent on all systems.
  275. +IDI_MAINICON            ICON                    "putty.ico"
  276. +IDI_CFGICON             ICON                    "puttycfg.ico"
  277. +
  278. +/////////////////////////////////////////////////////////////////////////////
  279. +//
  280. +// Dialog
  281. +//
  282. +
  283. +IDD_ABOUTBOX DIALOGEX 140, 40, 309, 321
  284. +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
  285. +    WS_SYSMENU
  286. +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  287. +BEGIN
  288. +    DEFPUSHBUTTON   "&Close",IDOK,243,303,48,14
  289. +    PUSHBUTTON      "View &Licence",IDA_LICENCE,11,303,70,14
  290. +    PUSHBUTTON      "Visit &Web Site",IDA_WEB,123,303,70,14
  291. +    CTEXT           "PuTTY",IDA_TEXT1,33,2,244,9
  292. +    CTEXT           "© 1997-2011 Simon Tatham. All rights reserved.\nModified by Piroi Ninel for the GNS3 project",
  293. +                    IDA_TEXT2,49,278,197,19
  294. +    CTEXT           " Version Number",IDA_VERSION,16,13,283,10
  295. +    LTEXT           "Usage [new options]:\nex: putty -wt R1 -gns3 5 -skin 3 -log ""C:\\Logs_Dir""\n\n-wt ""Title Bar""  #Change the title bar from command line\n*Disable remote title",
  296. +                    IDA_TEXT3,4,24,283,42
  297. +    LTEXT           " -gns3 <NR>     #Advance Putty options tunned for GNS3 usage\n *Don't close the window when the connection is closed\n *Disable warning message before closing the window\n *Disable beeps (Irritating!)\n *Allow Alt+F4 to close the window",
  298. +                    IDA_TEXT4,1,67,283,41
  299. +    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!)",
  300. +                    IDA_TEXT6,1,107,283,41
  301. +    LTEXT           " *Automatically reconnect a telnet/serial session on error after <NR> seconds (NEW!)\n    NR = Number of seconds to wait before restarting a dead telnet/serial session\n    NR = 0 means no automatically restart!",
  302. +                    IDA_TEXT9,2,139,283,26
  303. +    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!",
  304. +                    IDA_TEXT10,3,221,284,33
  305. +    LTEXT           " * Toggle ""Always on top"" mode from menu (Right click on title bar)",
  306. +                    IDA_TEXT11,2,260,283,11
  307. +    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",
  308. +                    IDA_TEXT5,3,167,283,48
  309. +END
  310. +
  311. +IDD_MAINBOX DIALOG  0, 0, 300, 252
  312. +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  313. +CAPTION "PuTTY Configuration"
  314. +CLASS "PuTTYConfigBox"
  315. +FONT 8, "MS Shell Dlg"
  316. +BEGIN
  317. +END
  318. +
  319. +IDD_LOGBOX DIALOGEX 100, 20, 300, 118
  320. +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
  321. +    WS_SYSMENU
  322. +CAPTION "PuTTY Event Log"
  323. +FONT 8, "MS Shell Dlg", 0, 0, 0x0
  324. +BEGIN
  325. +    DEFPUSHBUTTON   "&Close",IDOK,135,102,44,14
  326. +    PUSHBUTTON      "C&opy",IDN_COPY,81,102,44,14
  327. +    LISTBOX         IDN_LIST,3,3,294,95,LBS_HASSTRINGS | LBS_USETABSTOPS |
  328. +                    LBS_EXTENDEDSEL | WS_VSCROLL
  329. +END
  330. +
  331. +IDD_LICENCEBOX DIALOG  50, 50, 226, 263
  332. +STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
  333. +CAPTION "PuTTY Licence"
  334. +FONT 8, "MS Shell Dlg"
  335. +BEGIN
  336. +    DEFPUSHBUTTON   "OK",IDOK,98,243,44,14
  337. +    LTEXT           "Copyright © 1997-2011 Simon Tatham",1000,10,10,206,8
  338. +    LTEXT           "Portions copyright Robert de Bath, Joris van Rantwijk, Delian",
  339. +                    1001,10,26,206,8
  340. +    LTEXT           "Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas",
  341. +                    1002,10,34,206,8
  342. +    LTEXT           "Barry, Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa,",
  343. +                    1003,10,42,206,8
  344. +    LTEXT           "Markus Kuhn, Colin Watson, and CORE SDI S.A.",1004,10,
  345. +                    50,206,8
  346. +    LTEXT           "Permission is hereby granted, free of charge, to any person",
  347. +                    1005,10,66,206,8
  348. +    LTEXT           "obtaining a copy of this software and associated documentation",
  349. +                    1006,10,74,206,8
  350. +    LTEXT           "files (the ""Software""), to deal in the Software without restriction,",
  351. +                    1007,10,82,206,8
  352. +    LTEXT           "including without limitation the rights to use, copy, modify, merge,",
  353. +                    1008,10,90,206,8
  354. +    LTEXT           "publish, distribute, sublicense, and/or sell copies of the Software,",
  355. +                    1009,10,98,206,8
  356. +    LTEXT           "and to permit persons to whom the Software is furnished to do so,",
  357. +                    1010,10,106,206,8
  358. +    LTEXT           "subject to the following conditions:",1011,10,114,206,8
  359. +    LTEXT           "The above copyright notice and this permission notice shall be",
  360. +                    1012,10,130,206,8
  361. +    LTEXT           "included in all copies or substantial portions of the Software.",
  362. +                    1013,10,138,206,8
  363. +    LTEXT           "THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT",1014,10,
  364. +                    154,206,8
  365. +    LTEXT           "WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,",1015,10,162,
  366. +                    206,8
  367. +    LTEXT           "INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF",1016,10,
  368. +                    170,206,8
  369. +    LTEXT           "MERCHANTABILITY, FITNESS FOR A PARTICULAR",1017,10,178,
  370. +                    206,8
  371. +    LTEXT           "PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE",
  372. +                    1018,10,186,206,8
  373. +    LTEXT           "COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES",
  374. +                    1019,10,194,206,8
  375. +    LTEXT           "OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,",
  376. +                    1020,10,202,206,8
  377. +    LTEXT           "TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN",1021,10,
  378. +                    210,206,8
  379. +    LTEXT           "CONNECTION WITH THE SOFTWARE OR THE USE OR",1022,10,218,
  380. +                    206,8
  381. +    LTEXT           "OTHER DEALINGS IN THE SOFTWARE.",1023,10,226,206,8
  382. +END
  383. +
  384. +
  385. +/////////////////////////////////////////////////////////////////////////////
  386. +//
  387. +// Version
  388. +//
  389. +
  390. +VS_VERSION_INFO VERSIONINFO
  391. + FILEVERSION 0,6,2,1
  392. + PRODUCTVERSION 0,6,2,1
  393. + FILEFLAGSMASK 0xbL
  394. +#ifdef _DEBUG
  395. + FILEFLAGS 0x9L
  396. +#else
  397. + FILEFLAGS 0x8L
  398. +#endif
  399. + FILEOS 0x4L
  400. + FILETYPE 0x1L
  401. + FILESUBTYPE 0x0L
  402. +BEGIN
  403. +    BLOCK "StringFileInfo"
  404. +    BEGIN
  405. +        BLOCK "080904b0"
  406. +        BEGIN
  407. +            VALUE "CompanyName", "Simon Tatham"
  408. +            VALUE "FileDescription", "SSH, Telnet and Rlogin client - GNS3 Build"
  409. +            VALUE "FileVersion", "0.62.1 GNS3 Build"
  410. +            VALUE "InternalName", "PuTTY"
  411. +            VALUE "LegalCopyright", "Copyright © 1997-2011 Simon Tatham."
  412. +            VALUE "OriginalFilename", "PuTTY"
  413. +            VALUE "PrivateBuild", "0.62.1 GNS3 Build"
  414. +            VALUE "ProductName", "PuTTY suite"
  415. +            VALUE "ProductVersion", "0.62.1"
  416. +        END
  417. +    END
  418. +    BLOCK "VarFileInfo"
  419. +    BEGIN
  420. +        VALUE "Translation", 0x809, 1200
  421. +    END
  422. +END
  423. +
  424. +
  425. +/////////////////////////////////////////////////////////////////////////////
  426. +//
  427. +// RT_MANIFEST
  428. +//
  429. +
  430. +1                       RT_MANIFEST             "putty.mft"
  431. +
  432. +#ifdef APSTUDIO_INVOKED
  433. +/////////////////////////////////////////////////////////////////////////////
  434. +//
  435. +// TEXTINCLUDE
  436. +//
  437. +
  438. +1 TEXTINCLUDE
  439. +BEGIN
  440. +    "resource.h\0"
  441. +END
  442. +
  443. +2 TEXTINCLUDE
  444. +BEGIN
  445. +    "#include ""rcstuff.h""\r\n"
  446. +    "#include ""win_res.h""\r\n"
  447. +    "\0"
  448. +END
  449. +
  450. +3 TEXTINCLUDE
  451. +BEGIN
  452. +    "\r\n"
  453. +    "\0"
  454. +END
  455. +
  456. +#endif    // APSTUDIO_INVOKED
  457. +
  458. +
  459. +/////////////////////////////////////////////////////////////////////////////
  460. +//
  461. +// DESIGNINFO
  462. +//
  463. +
  464. +#ifdef APSTUDIO_INVOKED
  465. +GUIDELINES DESIGNINFO
  466. +BEGIN
  467. +    IDD_ABOUTBOX, DIALOG
  468. +    BEGIN
  469. +        BOTTOMMARGIN, 317
  470. +    END
  471. +END
  472. +#endif    // APSTUDIO_INVOKED
  473. +
  474. +#endif    // English (U.S.) resources
  475. +/////////////////////////////////////////////////////////////////////////////
  476. +
  477. +
  478. +
  479. +#ifndef APSTUDIO_INVOKED
  480. +/////////////////////////////////////////////////////////////////////////////
  481. +//
  482. +// Generated from the TEXTINCLUDE 3 resource.
  483. +//
  484.  
  485. -#define APPNAME "PuTTY"
  486. -#define APPDESC "SSH, Telnet and Rlogin client"
  487.  
  488. -#include "win_res.rc2"
  489. +/////////////////////////////////////////////////////////////////////////////
  490. +#endif    // not APSTUDIO_INVOKED
  491.  
  492. -#ifndef NO_MANIFESTS
  493. -1 RT_MANIFEST "putty.mft"
  494. -#endif /* NO_MANIFESTS */
  495. diff -rup putty-src-orig\WINDOWS\VERSION.RC2 putty-src\WINDOWS\VERSION.RC2
  496. --- putty-src-orig\WINDOWS\VERSION.RC2  Sat Dec 10 12:08:10 2011
  497. +++ putty-src\WINDOWS\VERSION.RC2   Mon Jun 18 22:10:39 2012
  498. @@ -79,7 +79,7 @@
  499.  
  500.  /* We can't reliably get the same date and time as version.c, so
  501.   * we won't bother trying. */
  502. -#define VERSION_TEXT "Unidentified build"
  503. +#define VERSION_TEXT "0.62.1 GNS3 Build"
  504.  #define BINARY_VERSION 0,0,0,0
  505.  
  506.  #endif
  507. diff -rup putty-src-orig\WINDOWS\WIN_RES.RC2 putty-src\WINDOWS\WIN_RES.RC2
  508. --- putty-src-orig\WINDOWS\WIN_RES.RC2  Wed Jan 05 12:01:00 2011
  509. +++ putty-src\WINDOWS\WIN_RES.RC2   Mon May 07 22:28:03 2012
  510. @@ -25,7 +25,7 @@ BEGIN
  511.      PUSHBUTTON "View &Licence", IDA_LICENCE, 6, 52, 70, 14
  512.      PUSHBUTTON "Visit &Web Site", IDA_WEB, 84, 52, 70, 14
  513.      CTEXT "PuTTY", IDA_TEXT1, 10, 6, 194, 8
  514. -    CTEXT "", IDA_VERSION, 10, 16, 194, 16
  515. +    CTEXT "0.62.1 GNS3 Build", IDA_VERSION, 10, 16, 194, 16
  516.      CTEXT "\251 1997-2011 Simon Tatham. All rights reserved.",
  517.            IDA_TEXT2, 10, 34, 194, 16
  518.  END
  519. diff -rup putty-src-orig\WINDOWS\WINDOW.C putty-src\WINDOWS\WINDOW.C
  520. --- putty-src-orig\WINDOWS\WINDOW.C Sat Jul 16 12:26:20 2011
  521. +++ putty-src\WINDOWS\WINDOW.C  Thu Jun 21 01:21:25 2012
  522. @@ -34,6 +34,9 @@
  523.   * attempt to store information in them. Hence all these identifiers have
  524.   * the low 4 bits clear. Also, identifiers should < 0xF000. */
  525.  
  526. +/***************Patch GNS3 PuTTY *******************/
  527. +#define IDM_TOPMOST   0x0210
  528. +/***************************************************/
  529.  #define IDM_SHOWLOG   0x0010
  530.  #define IDM_NEWSESS   0x0020
  531.  #define IDM_DUPSESS   0x0030
  532. @@ -76,6 +79,10 @@
  533.  #define WHEEL_DELTA 120
  534.  #endif
  535.  
  536. +/***************Patch GNS3 PuTTY *******************/
  537. +HANDLE hThread1;
  538. +/***************************************************/
  539. +
  540.  static Mouse_Button translate_button(Mouse_Button button);
  541.  static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
  542.  static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
  543. @@ -94,6 +101,9 @@ static int is_full_screen(void);
  544.  static void make_full_screen(void);
  545.  static void clear_full_screen(void);
  546.  static void flip_full_screen(void);
  547. +/***************Patch GNS3 PuTTY *******************/
  548. +static void flip_top_most(void);
  549. +/***************************************************/
  550.  static int process_clipdata(HGLOBAL clipdata, int unicode);
  551.  
  552.  /* Window layout information */
  553. @@ -236,60 +246,100 @@ static void start_backend(void)
  554.                cfg.host, cfg.port, &realhost, cfg.tcp_nodelay,
  555.                cfg.tcp_keepalives);
  556.      back->provide_logctx(backhandle, logctx);
  557. +   /***************Patch GNS3 PuTTY *******************/
  558.      if (error) {
  559. -   char *str = dupprintf("%s Error", appname);
  560. -   sprintf(msg, "Unable to open connection to\n"
  561. -       "%.800s\n" "%s", cfg_dest(&cfg), error);
  562. -   MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
  563. -   sfree(str);
  564. -   exit(0);
  565. -    }
  566. -    window_name = icon_name = NULL;
  567. -    if (*cfg.wintitle) {
  568. -   title = cfg.wintitle;
  569. -    } else {
  570. -   sprintf(msg, "%s - %s", realhost, appname);
  571. -   title = msg;
  572. -    }
  573. -    sfree(realhost);
  574. -    set_title(NULL, title);
  575. -    set_icon(NULL, title);
  576. +       char *str = dupprintf("%s Error", appname);
  577. +  
  578. +       if(cfg.no_annoying_msgbox) {
  579. +           sprintf(msg, "Unable to open: %.800s", cfg_dest(&cfg));
  580. +           set_title_plus_error(NULL, msg);
  581. +       }else{
  582. +           sprintf(msg, "Unable to open connection to\n%.800s\n%s", cfg_dest(&cfg), error);
  583. +           MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
  584. +           exit(0);
  585. +       }
  586.  
  587. -    /*
  588. -     * Connect the terminal to the backend for resize purposes.
  589. -     */
  590. -    term_provide_resize_fn(term, back->size, backhandle);
  591. +       sfree(str);
  592. +       must_close_session = TRUE;
  593. +       session_closed = TRUE;
  594.  
  595. -    /*
  596. -     * Set up a line discipline.
  597. -     */
  598. -    ldisc = ldisc_create(&cfg, term, back, backhandle, NULL);
  599. +   } else {
  600. +  
  601. +       window_name = icon_name = NULL;
  602. +       if (*cfg.wintitle) {
  603. +       title = cfg.wintitle;
  604. +       } else {
  605. +       sprintf(msg, "%s - %s", realhost, appname);
  606. +       title = msg;
  607. +       }
  608. +       sfree(realhost);
  609. +       set_title(NULL, title);
  610. +       set_icon(NULL, title);
  611.  
  612. -    /*
  613. -     * Destroy the Restart Session menu item. (This will return
  614. -     * failure if it's already absent, as it will be the very first
  615. -     * time we call this function. We ignore that, because as long
  616. -     * as the menu item ends up not being there, we don't care
  617. -     * whether it was us who removed it or not!)
  618. -     */
  619. -    for (i = 0; i < lenof(popup_menus); i++) {
  620. -   DeleteMenu(popup_menus[i].menu, IDM_RESTART, MF_BYCOMMAND);
  621. -    }
  622. +       /*
  623. +        * Connect the terminal to the backend for resize purposes.
  624. +        */
  625. +       term_provide_resize_fn(term, back->size, backhandle);
  626.  
  627. -    must_close_session = FALSE;
  628. -    session_closed = FALSE;
  629. +       /*
  630. +        * Set up a line discipline.
  631. +        */
  632. +       ldisc = ldisc_create(&cfg, term, back, backhandle, NULL);
  633. +
  634. +       /*
  635. +        * Destroy the Restart Session menu item. (This will return
  636. +        * failure if it's already absent, as it will be the very first
  637. +        * time we call this function. We ignore that, because as long
  638. +        * as the menu item ends up not being there, we don't care
  639. +        * whether it was us who removed it or not!)
  640. +        */
  641. +       for (i = 0; i < lenof(popup_menus); i++) {
  642. +       DeleteMenu(popup_menus[i].menu, IDM_RESTART, MF_BYCOMMAND);
  643. +       }
  644. +
  645. +       must_close_session = FALSE;
  646. +       session_closed = FALSE;
  647. +   }
  648. +   /**************************************************/
  649. +}
  650. +
  651. +/***************Patch GNS3 PuTTY *******************/
  652. +void WINAPI TimerRoutine(void)
  653. +{
  654. +   int i;
  655. +   char morestuff[255], title[155];
  656. +   GetWindowText(hwnd, title, sizeof(title));
  657. +   for (i = cfg.reconnect_after_error; i >= 1; i--) {
  658. +       sprintf(morestuff, "%s - [Restart in %ds]", title, i);
  659. +       set_title(NULL, morestuff);
  660. +       set_icon(NULL, morestuff);
  661. +       Sleep(1000);
  662. +       }
  663. +
  664. +   sprintf(morestuff, "%s - [Restarting...]", title, i);
  665. +   set_title(NULL, morestuff);
  666. +   set_icon(NULL, morestuff);
  667. +   Sleep(250);
  668. +
  669. +   PostMessage(hwnd, IDM_RESTART, 0, 0);
  670.  }
  671. +/**************************************************/
  672.  
  673.  static void close_session(void)
  674.  {
  675. -    char morestuff[100];
  676.      int i;
  677. +   /***************Patch GNS3 PuTTY *******************/
  678. +    char morestuff[255], title[155];
  679.  
  680. -    session_closed = TRUE;
  681. -    sprintf(morestuff, "%.70s (inactive)", appname);
  682. -    set_icon(NULL, morestuff);
  683. -    set_title(NULL, morestuff);
  684. +   session_closed = TRUE;
  685. +   GetWindowText(hwnd, title, sizeof(title));
  686. +    sprintf(morestuff, "%s - (inactive)", title);
  687.  
  688. +    set_icon(NULL, morestuff);
  689. +   set_title(NULL, morestuff);
  690. +   //SetSysColors(2, COLOR_WINDOW, RGB(0x255, 0x0, 0x0));
  691. +   /***************************************************/
  692. +  
  693.      if (ldisc) {
  694.     ldisc_free(ldisc);
  695.     ldisc = NULL;
  696. @@ -320,6 +370,11 @@ static void close_session(void)
  697.       * window title change above.
  698.       */
  699.      must_close_session = FALSE;
  700. +   /***************Patch GNS3 PuTTY *******************/  
  701. +   if(cfg.reconnect_after_error) {
  702. +       hThread1 = CreateThread (NULL, 0, (LPTHREAD_START_ROUTINE)TimerRoutine, NULL, 0, NULL);
  703. +   }
  704. +   /***************************************************/
  705.  }
  706.  
  707.  int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
  708. @@ -795,6 +850,9 @@ int WINAPI WinMain(HINSTANCE inst, HINST
  709.         AppendMenu(m, MF_SEPARATOR, 0, 0);
  710.         AppendMenu(m, (cfg.resize_action == RESIZE_DISABLED) ?
  711.                MF_GRAYED : MF_ENABLED, IDM_FULLSCREEN, "&Full Screen");
  712. +       /***************Patch GNS3 PuTTY *******************/
  713. +       AppendMenu(m, MF_ENABLED, IDM_TOPMOST, "Always on &Top");
  714. +       /***************************************************/
  715.         AppendMenu(m, MF_SEPARATOR, 0, 0);
  716.         if (has_help())
  717.         AppendMenu(m, MF_ENABLED, IDM_HELP, "&Help");
  718. @@ -1082,8 +1140,16 @@ void connection_fatal(void *frontend, ch
  719.      va_start(ap, fmt);
  720.      stuff = dupvprintf(fmt, ap);
  721.      va_end(ap);
  722. -    sprintf(morestuff, "%.70s Fatal Error", appname);
  723. -    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
  724. +
  725. +   /***************Patch GNS3 PuTTY *******************/
  726. +   if(cfg.no_annoying_msgbox) {
  727. +       set_title_plus_error(NULL, stuff);
  728. +   }else{
  729. +       sprintf(morestuff, "%.70s Fatal Error", appname);
  730. +       MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
  731. +   }
  732. +   /***************************************************/
  733. +
  734.      sfree(stuff);
  735.  
  736.      if (cfg.close_on_exit == FORCE_ON)
  737. @@ -1969,9 +2035,15 @@ void notify_remote_exit(void *fe)
  738.         /* exitcode == INT_MAX indicates that the connection was closed
  739.          * by a fatal error, so an error box will be coming our way and
  740.          * we should not generate this informational one. */
  741. -       if (exitcode != INT_MAX)
  742. -       MessageBox(hwnd, "Connection closed by remote host",
  743. -              appname, MB_OK | MB_ICONINFORMATION);
  744. +       /***************Patch GNS3 PuTTY *******************/
  745. +       if (exitcode != INT_MAX) {
  746. +           if(cfg.no_annoying_msgbox) {
  747. +               set_title_plus_error(NULL, "Connection closed by remote host");
  748. +           }else{
  749. +               MessageBox(hwnd, "Connection closed by remote host", appname, MB_OK | MB_ICONINFORMATION);
  750. +           }
  751. +       }
  752. +       /***************************************************/
  753.     }
  754.      }
  755.  }
  756. @@ -2027,6 +2099,18 @@ static LRESULT CALLBACK WndProc(HWND hwn
  757.     show_mouseptr(1);
  758.     PostQuitMessage(0);
  759.     return 0;
  760. +   /***************Patch GNS3 PuTTY *******************/
  761. +     case IDM_RESTART:
  762. +       if (!back) {
  763. +           char morestuff[200];
  764. +           sprintf(morestuff, "----- Session auto-restarted on error (every %ds) -----", cfg.reconnect_after_error);
  765. +           logevent(NULL, morestuff);
  766. +
  767. +           if (cfg.protocol != PROT_SERIAL) { term_pwron(term, FALSE); }
  768. +           start_backend();
  769. +       }
  770. +       break;
  771. +   /***************************************************/
  772.        case WM_INITMENUPOPUP:
  773.     if ((HMENU)wParam == savedsess_menu) {
  774.         /* About to pop up Saved Sessions sub-menu.
  775. @@ -2116,11 +2200,13 @@ static LRESULT CALLBACK WndProc(HWND hwn
  776.         break;
  777.       case IDM_RESTART:
  778.         if (!back) {
  779. -       logevent(NULL, "----- Session restarted -----");
  780. -       term_pwron(term, FALSE);
  781. +       /***************Patch GNS3 PuTTY *******************/
  782. +       logevent(NULL, "----- Session restarted manually -----");
  783. +       if (hThread1 != NULL) TerminateThread(hThread1, 0);
  784. +       if (cfg.protocol != PROT_SERIAL) { term_pwron(term, FALSE); }
  785. +       /***************************************************/
  786.         start_backend();
  787.         }
  788. -
  789.         break;
  790.       case IDM_RECONF:
  791.         {
  792. @@ -2320,6 +2406,11 @@ static LRESULT CALLBACK WndProc(HWND hwn
  793.       case IDM_FULLSCREEN:
  794.         flip_full_screen();
  795.         break;
  796. +   /***************Patch GNS3 PuTTY *******************/
  797. +     case IDM_TOPMOST:
  798. +       flip_top_most();
  799. +       break;
  800. +   /***************************************************/
  801.       default:
  802.         if (wParam >= IDM_SAVED_MIN && wParam < IDM_SAVED_MAX) {
  803.         SendMessage(hwnd, WM_SYSCOMMAND, IDM_SAVEDSESS, wParam);
  804. @@ -4527,6 +4618,31 @@ void set_title(void *frontend, char *tit
  805.     SetWindowText(hwnd, title);
  806.  }
  807.  
  808. +/***************Patch GNS3 PuTTY *******************/
  809. +void set_title_plus_error(void *frontend, char *error)
  810. +{
  811. +    char title[512];
  812. +  
  813. +   if (strlen(cfg.wintitle) >= 1) {
  814. +       if (cfg.protocol == PROT_SERIAL) {
  815. +           sprintf(title, "Serial Error (%s) - %s!\0", cfg.wintitle, error); //serial with title
  816. +       } else {
  817. +           sprintf(title, "%s:%d (%s) - %s!\0", cfg.host, cfg.port, cfg.wintitle, error); //telnet with title
  818. +       }
  819. +   } else {
  820. +       if (cfg.protocol == PROT_SERIAL) {
  821. +           sprintf(title, "Serial Error - %s!\0", error); //serial without title
  822. +       } else {
  823. +           sprintf(title, "%s:%d - %s!\0",      cfg.host, cfg.port, error); //telnet without title
  824. +       }
  825. +   }
  826. + sfree(window_name);
  827. + window_name = snewn(1 + strlen(title), char);
  828. + strcpy(window_name, title);
  829. + SetWindowText(hwnd, title);
  830. +}
  831. +/***************************************************/
  832. +
  833.  void set_icon(void *frontend, char *title)
  834.  {
  835.      sfree(icon_name);
  836. @@ -5504,6 +5620,21 @@ static void flip_full_screen()
  837.     ShowWindow(hwnd, SW_MAXIMIZE);
  838.      }
  839.  }
  840. +
  841. +/***************Patch GNS3 PuTTY *******************/
  842. +/*
  843. + * Toggle always on top mode.
  844. + */
  845. +static void flip_top_most()
  846. +{
  847. +   if (!(GetWindowLong(hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST)){
  848. +       SetWindowPos(hwnd, HWND_TOPMOST,   0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  849. +    }
  850. +   else{
  851. +       SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
  852. +   }
  853. +}
  854. +/***************************************************/
  855.  
  856.  void frontend_keypress(void *handle)
  857.  {
  858. diff -rup putty-src-orig\WINDOWS\WINPGNTC.C putty-src\WINDOWS\WINPGNTC.C
  859. --- putty-src-orig\WINDOWS\WINPGNTC.C   Wed Jun 08 21:47:08 2011
  860. +++ putty-src\WINDOWS\WINPGNTC.C    Wed Jun 13 22:16:15 2012
  861. @@ -86,10 +86,13 @@ DECL_WINDOWS_FUNCTION(static, BOOL, Init
  862.               (PSECURITY_DESCRIPTOR, DWORD));
  863.  DECL_WINDOWS_FUNCTION(static, BOOL, SetSecurityDescriptorOwner,
  864.               (PSECURITY_DESCRIPTOR, PSID, BOOL));
  865. -DECL_WINDOWS_FUNCTION(, DWORD, GetSecurityInfo,
  866. +/***************Patch GNS3 PuTTY *******************/
  867. +// the word "static" was missing!
  868. +DECL_WINDOWS_FUNCTION(static, DWORD, GetSecurityInfo,
  869.               (HANDLE, SE_OBJECT_TYPE, SECURITY_INFORMATION,
  870.                PSID *, PSID *, PACL *, PACL *,
  871.                PSECURITY_DESCRIPTOR *));
  872. +/***************************************************/
  873.  int init_advapi(void)
  874.  {
  875.      advapi = load_system32_dll("advapi32.dll");
  876. @@ -100,6 +103,7 @@ int init_advapi(void)
  877.     GET_WINDOWS_FUNCTION(advapi, InitializeSecurityDescriptor) &&
  878.     GET_WINDOWS_FUNCTION(advapi, SetSecurityDescriptorOwner);
  879.  }
  880. +
  881.  
  882.  PSID get_user_sid(void)
  883.  {
  884. diff -rup putty-src-orig\WINDOWS\WINSER.C putty-src\WINDOWS\WINSER.C
  885. --- putty-src-orig\WINDOWS\WINSER.C Tue Aug 10 18:21:26 2010
  886. +++ putty-src\WINDOWS\WINSER.C  Tue Jun 19 23:54:04 2012
  887. @@ -276,6 +276,14 @@ static const char *serial_init(void *fro
  888.       */
  889.      update_specials_menu(serial->frontend);
  890.  
  891. +  
  892. +   /***************Patch GNS3 PuTTY *******************/
  893. +   if (cfg->push_one_enter) { 
  894. +       logevent(serial->frontend, "*** Press a '\\r' inside the serial port/pipe ***");
  895. +       serial->bufsize = handle_write(serial->out, "\r", 1); //press a enter on the serial
  896. +   }
  897. +   /***************************************************/
  898. +
  899.      return NULL;
  900.  }
Advertisement
Add Comment
Please, Sign In to add comment