Now that we have `appname', make much wider use of it. In
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 6 Apr 2003 14:11:33 +0000 (14:11 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Sun, 6 Apr 2003 14:11:33 +0000 (14:11 +0000)
particular, the config box uses it in place of the word `PuTTY',
which means mid-session reconfig in pterm will look less strange
once I implement it. Also, while I'm at it, I've personalised all
the dialog boxes and menu items and suchlike so that PuTTYtel
actually claims to be PuTTYtel rather than PuTTY.

git-svn-id: svn://svn.tartarus.org/sgt/putty@3074 cda61777-01e9-0310-a592-d414129be87e

be_all.c
be_nossh.c
config.c
unix/uxputty.c
wincfg.c
winctrls.c
windlg.c
window.c
winstuff.h

index a48cc70..024a39e 100644 (file)
--- a/be_all.c
+++ b/be_all.c
@@ -6,6 +6,16 @@
 #include <stdio.h>
 #include "putty.h"
 
+/*
+ * This appname is not strictly in the right place, since Plink
+ * also uses this module. However, Plink doesn't currently use any
+ * of the dialog-box sorts of things that make use of appname, so
+ * it shouldn't do any harm here. I'm trying to avoid having to
+ * have tiny little source modules containing nothing but
+ * declarations of appname, for as long as I can...
+ */
+const char *const appname = "PuTTY";
+
 #ifdef TELNET_DEFAULT
 const int be_default_protocol = PROT_TELNET;
 #else
index ceef3cf..9e3b246 100644 (file)
@@ -9,6 +9,8 @@
 
 const int be_default_protocol = PROT_TELNET;
 
+const char *const appname = "PuTTYtel";
+
 struct backend_list backends[] = {
     {PROT_TELNET, "telnet", &telnet_backend},
     {PROT_RLOGIN, "rlogin", &rlogin_backend},
index 239247d..184023d 100644 (file)
--- a/config.c
+++ b/config.c
@@ -726,6 +726,7 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     struct environ_data *ed;
     struct portfwd_data *pfd;
     union control *c;
+    char *str;
 
     ssd = (struct sessionsaver_data *)
        ctrl_alloc(b, sizeof(struct sessionsaver_data));
@@ -754,7 +755,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     /*
      * The Session panel.
      */
-    ctrl_settitle(b, "Session", "Basic options for your PuTTY session");
+    str = dupprintf("Basic options for your %s session", appname);
+    ctrl_settitle(b, "Session", str);
+    sfree(str);
 
     if (!midsession) {
        s = ctrl_getset(b, "Session", "hostport",
@@ -1011,7 +1014,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     /*
      * The Window panel.
      */
-    ctrl_settitle(b, "Window", "Options controlling PuTTY's window");
+    str = dupprintf("Options controlling %s's window", appname);
+    ctrl_settitle(b, "Window", str);
+    sfree(str);
 
     s = ctrl_getset(b, "Window", "size", "Set the size of the window");
     ctrl_columns(s, 2, 50, 50);
@@ -1047,8 +1052,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     /*
      * The Window/Appearance panel.
      */
-    ctrl_settitle(b, "Window/Appearance",
-                 "Configure the appearance of PuTTY's window");
+    str = dupprintf("Configure the appearance of %s's window", appname);
+    ctrl_settitle(b, "Window/Appearance", str);
+    sfree(str);
 
     s = ctrl_getset(b, "Window/Appearance", "cursor",
                    "Adjust the use of the cursor");
@@ -1085,8 +1091,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
     /*
      * The Window/Behaviour panel.
      */
-    ctrl_settitle(b, "Window/Behaviour",
-                 "Configure the behaviour of PuTTY's window");
+    str = dupprintf("Configure the behaviour of %s's window", appname);
+    ctrl_settitle(b, "Window/Behaviour", str);
+    sfree(str);
 
     s = ctrl_getset(b, "Window/Behaviour", "title",
                    "Adjust the behaviour of the window title");
@@ -1116,8 +1123,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                  'r', 100, HELPCTX(translation_codepage),
                  codepage_handler, P(NULL), P(NULL));
 
-    s = ctrl_getset(b, "Window/Translation", "linedraw",
-                   "Adjust how PuTTY displays line drawing characters");
+    str = dupprintf("Adjust how %s displays line drawing characters", appname);
+    s = ctrl_getset(b, "Window/Translation", "linedraw", str);
+    sfree(str);
     ctrl_radiobuttons(s, "Handling of line drawing characters:", NO_SHORTCUT,1,
                      HELPCTX(translation_linedraw),
                      dlg_stdradiobutton_handler,
@@ -1187,8 +1195,9 @@ void setup_config_box(struct controlbox *b, struct sesslist *sesslist,
                  HELPCTX(colours_bold),
                  dlg_stdcheckbox_handler, I(offsetof(Config,bold_colour)));
 
-    s = ctrl_getset(b, "Window/Colours", "adjust",
-                   "Adjust the precise colours PuTTY displays");
+    str = dupprintf("Adjust the precise colours %s displays", appname);
+    s = ctrl_getset(b, "Window/Colours", "adjust", str);
+    sfree(str);
     ctrl_text(s, "Select a colour from the list, and then click the"
              " Modify button to change its appearance.",
              HELPCTX(colours_config));
index 53ee0d8..67364e5 100644 (file)
@@ -67,8 +67,6 @@ void cleanup_exit(int code)
     exit(code);
 }
 
-const char *const appname = "PuTTY";
-
 Backend *select_backend(Config *cfg)
 {
     int i;
index 896c1bc..20eccfe 100644 (file)
--- a/wincfg.c
+++ b/wincfg.c
@@ -37,6 +37,7 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
 {
     struct controlset *s;
     union control *c;
+    char *str;
 
     if (!midsession) {
        /*
@@ -186,8 +187,9 @@ void win_setup_config_box(struct controlbox *b, HWND *hwndp, int has_help,
      * additional options when working with line-drawing
      * characters.
      */
-    s = ctrl_getset(b, "Window/Translation", "linedraw",
-                   "Adjust how PuTTY displays line drawing characters");
+    str = dupprintf("Adjust how %s displays line drawing characters", appname);
+    s = ctrl_getset(b, "Window/Translation", "linedraw", str);
+    sfree(str);
     {
        int i;
        for (i = 0; i < s->ncontrols; i++) {
index 204bc4a..7f503c9 100644 (file)
@@ -2458,7 +2458,7 @@ void dp_init(struct dlgparam *dp)
     dp->focused = dp->lastfocused = NULL;
     memset(dp->shortcuts, 0, sizeof(dp->shortcuts));
     dp->hwnd = NULL;
-    dp->errtitle = NULL;
+    dp->wintitle = dp->errtitle = NULL;
     dp->privdata = newtree234(perctrl_privdata_cmp);
 }
 
@@ -2482,6 +2482,8 @@ void dp_cleanup(struct dlgparam *dp)
        freetree234(dp->privdata);
        dp->privdata = NULL;
     }
+    sfree(dp->wintitle);
+    sfree(dp->errtitle);
 }
 
 void *dlg_get_privdata(union control *ctrl, void *dlg)
index 6656c96..a045daf 100644 (file)
--- a/windlg.c
+++ b/windlg.c
@@ -74,6 +74,11 @@ static int CALLBACK LogProc(HWND hwnd, UINT msg,
     switch (msg) {
       case WM_INITDIALOG:
        {
+           char *str = dupprintf("%s Event Log", appname);
+           SetWindowText(hwnd, str);
+           sfree(str);
+       }
+       {
            static int tabs[4] = { 78, 108 };
            SendDlgItemMessage(hwnd, IDN_LIST, LB_SETTABSTOPS, 2,
                               (LPARAM) tabs);
@@ -161,6 +166,11 @@ static int CALLBACK LicenceProc(HWND hwnd, UINT msg,
 {
     switch (msg) {
       case WM_INITDIALOG:
+       {
+           char *str = dupprintf("%s Licence", appname);
+           SetWindowText(hwnd, str);
+           sfree(str);
+       }
        return 1;
       case WM_COMMAND:
        switch (LOWORD(wParam)) {
@@ -179,8 +189,14 @@ static int CALLBACK LicenceProc(HWND hwnd, UINT msg,
 static int CALLBACK AboutProc(HWND hwnd, UINT msg,
                              WPARAM wParam, LPARAM lParam)
 {
+    char *str;
+
     switch (msg) {
       case WM_INITDIALOG:
+       str = dupprintf("About %s", appname);
+       SetWindowText(hwnd, str);
+       sfree(str);
+       SetDlgItemText(hwnd, IDA_TEXT1, appname);
        SetDlgItemText(hwnd, IDA_VERSION, ver);
        return 1;
       case WM_COMMAND:
@@ -308,6 +324,7 @@ static int CALLBACK GenericMainDlgProc(HWND hwnd, UINT msg,
       case WM_INITDIALOG:
        dp.hwnd = hwnd;
        create_controls(hwnd, "");     /* Open and Cancel buttons etc */
+       SetWindowText(hwnd, dp.wintitle);
        SetWindowLong(hwnd, GWL_USERDATA, 0);
         if (help_path)
             SetWindowLong(hwnd, GWL_EXSTYLE,
@@ -587,7 +604,8 @@ int do_config(void)
     winctrl_init(&ctrls_panel);
     dp_add_tree(&dp, &ctrls_base);
     dp_add_tree(&dp, &ctrls_panel);
-    dp.errtitle = "PuTTY Error";
+    dp.wintitle = dupprintf("%s Configuration", appname);
+    dp.errtitle = dupprintf("%s Error", appname);
     dp.data = &cfg;
     dp.shortcuts['g'] = TRUE;         /* the treeview: `Cate&gory' */
 
@@ -620,7 +638,8 @@ int do_reconfig(HWND hwnd)
     winctrl_init(&ctrls_panel);
     dp_add_tree(&dp, &ctrls_base);
     dp_add_tree(&dp, &ctrls_panel);
-    dp.errtitle = "PuTTY Error";
+    dp.wintitle = dupprintf("%s Reconfiguration", appname);
+    dp.errtitle = dupprintf("%s Error", appname);
     dp.data = &cfg;
     dp.shortcuts['g'] = TRUE;         /* the treeview: `Cate&gory' */
 
@@ -631,6 +650,7 @@ int do_reconfig(HWND hwnd)
     ctrl_free_box(ctrlbox);
     winctrl_cleanup(&ctrls_base);
     winctrl_cleanup(&ctrls_panel);
+    sfree(dp.errtitle);
     dp_cleanup(&dp);
 
     if (!ret)
@@ -695,7 +715,7 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
        "The server's key fingerprint is:\n"
        "%s\n"
        "If you trust this host, hit Yes to add the key to\n"
-       "PuTTY's cache and carry on connecting.\n"
+       "%s's cache and carry on connecting.\n"
        "If you want to carry on connecting just once, without\n"
        "adding the key to the cache, hit No.\n"
        "If you do not trust this host, hit Cancel to abandon the\n"
@@ -704,7 +724,7 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
     static const char wrongmsg[] =
        "WARNING - POTENTIAL SECURITY BREACH!\n"
        "\n"
-       "The server's host key does not match the one PuTTY has\n"
+       "The server's host key does not match the one %s has\n"
        "cached in the registry. This means that either the\n"
        "server administrator has changed the host key, or you\n"
        "have actually connected to another computer pretending\n"
@@ -712,18 +732,13 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
        "The new key fingerprint is:\n"
        "%s\n"
        "If you were expecting this change and trust the new key,\n"
-       "hit Yes to update PuTTY's cache and continue connecting.\n"
+       "hit Yes to update %s's cache and continue connecting.\n"
        "If you want to carry on connecting but without updating\n"
        "the cache, hit No.\n"
        "If you want to abandon the connection completely, hit\n"
        "Cancel. Hitting Cancel is the ONLY guaranteed safe\n" "choice.\n";
 
-    static const char mbtitle[] = "PuTTY Security Alert";
-
-    char message[160 +
-       /* sensible fingerprint max size */
-       (sizeof(absentmsg) > sizeof(wrongmsg) ?
-        sizeof(absentmsg) : sizeof(wrongmsg))];
+    static const char mbtitle[] = "%s Security Alert";
 
     /*
      * Verify the key against the registry.
@@ -734,9 +749,13 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
        return;
     if (ret == 2) {                   /* key was different */
        int mbret;
-       sprintf(message, wrongmsg, fingerprint);
-       mbret = MessageBox(NULL, message, mbtitle,
+       char *message, *title;
+       message = dupprintf(wrongmsg, appname, fingerprint, appname);
+       title = dupprintf(mbtitle, appname);
+       mbret = MessageBox(NULL, message, title,
                           MB_ICONWARNING | MB_YESNOCANCEL);
+       sfree(message);
+       sfree(title);
        if (mbret == IDYES)
            store_host_key(host, port, keytype, keystr);
        if (mbret == IDCANCEL)
@@ -744,9 +763,13 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
     }
     if (ret == 1) {                   /* key was absent */
        int mbret;
-       sprintf(message, absentmsg, fingerprint);
-       mbret = MessageBox(NULL, message, mbtitle,
+       char *message, *title;
+       message = dupprintf(absentmsg, fingerprint, appname);
+       title = dupprintf(mbtitle, appname);
+       mbret = MessageBox(NULL, message, title,
                           MB_ICONWARNING | MB_YESNOCANCEL);
+       sfree(message);
+       sfree(title);
        if (mbret == IDYES)
            store_host_key(host, port, keytype, keystr);
        if (mbret == IDCANCEL)
@@ -761,23 +784,23 @@ void verify_ssh_host_key(void *frontend, char *host, int port, char *keytype,
  */
 void askcipher(void *frontend, char *ciphername, int cs)
 {
-    static const char mbtitle[] = "PuTTY Security Alert";
+    static const char mbtitle[] = "%s Security Alert";
     static const char msg[] =
        "The first %.35scipher supported by the server\n"
        "is %.64s, which is below the configured\n"
        "warning threshold.\n"
        "Do you want to continue with this connection?\n";
-    /* guessed cipher name + type max length */
-    char message[100 + sizeof(msg)];
+    char *message, *title;
     int mbret;
 
-    sprintf(message, msg,
-           (cs == 0) ? "" :
-           (cs == 1) ? "client-to-server " :
-                       "server-to-client ",
-           ciphername);
-    mbret = MessageBox(NULL, message, mbtitle,
+    message = dupprintf(msg, ((cs == 0) ? "" :
+                             (cs == 1) ? "client-to-server " :
+                             "server-to-client "), ciphername);
+    title = dupprintf(mbtitle, appname);
+    mbret = MessageBox(NULL, message, title,
                       MB_ICONWARNING | MB_YESNO);
+    sfree(message);
+    sfree(title);
     if (mbret == IDYES)
        return;
     else
@@ -790,7 +813,6 @@ void askcipher(void *frontend, char *ciphername, int cs)
  */
 int askappend(void *frontend, Filename filename)
 {
-    static const char mbtitle[] = "PuTTY Log to File";
     static const char msgtemplate[] =
        "The session log file \"%.*s\" already exists.\n"
        "You can overwrite it with a new session log,\n"
@@ -798,13 +820,19 @@ int askappend(void *frontend, Filename filename)
        "or disable session logging for this session.\n"
        "Hit Yes to wipe the file, No to append to it,\n"
        "or Cancel to disable logging.";
-    char message[sizeof(msgtemplate) + FILENAME_MAX];
+    char *message;
+    char *mbtitle;
     int mbret;
 
-    sprintf(message, msgtemplate, FILENAME_MAX, filename.path);
+    message = dupprintf(msgtemplate, FILENAME_MAX, filename.path);
+    mbtitle = dupprintf("%s Log to File", appname);
 
     mbret = MessageBox(NULL, message, mbtitle,
                       MB_ICONQUESTION | MB_YESNOCANCEL);
+
+    sfree(message);
+    sfree(mbtitle);
+
     if (mbret == IDYES)
        return 2;
     else if (mbret == IDNO)
@@ -825,17 +853,24 @@ int askappend(void *frontend, Filename filename)
  */
 void old_keyfile_warning(void)
 {
-    static const char mbtitle[] = "PuTTY Key File Warning";
+    static const char mbtitle[] = "%s Key File Warning";
     static const char message[] =
        "You are loading an SSH 2 private key which has an\n"
        "old version of the file format. This means your key\n"
        "file is not fully tamperproof. Future versions of\n"
-       "PuTTY may stop supporting this private key format,\n"
+       "%s may stop supporting this private key format,\n"
        "so we recommend you convert your key to the new\n"
        "format.\n"
        "\n"
        "You can perform this conversion by loading the key\n"
        "into PuTTYgen and then saving it again.";
 
-    MessageBox(NULL, message, mbtitle, MB_OK);
+    char *msg, *title;
+    msg = dupprintf(message, appname);
+    title = dupprintf(mbtitle, appname);
+
+    MessageBox(NULL, msg, title, MB_OK);
+
+    sfree(msg);
+    sfree(title);
 }
index 96ce4ad..40d9ae1 100644 (file)
--- a/window.c
+++ b/window.c
@@ -182,7 +182,6 @@ void ldisc_update(void *frontend, int echo, int edit)
 
 int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
 {
-    static char appname[] = "PuTTY";
     WORD winsock_ver;
     WSADATA wsadata;
     WNDCLASS wndclass;
@@ -218,8 +217,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
        ZeroMemory(&osVersion, sizeof(osVersion));
        osVersion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
        if (!GetVersionEx ( (OSVERSIONINFO *) &osVersion)) {
+           char *str = dupprintf("%s Fatal Error", appname);
             MessageBox(NULL, "Windows refuses to report a version",
-                       "PuTTY Fatal Error", MB_OK | MB_ICONEXCLAMATION);
+                       str, MB_OK | MB_ICONEXCLAMATION);
+           sfree(str);
            return 1;
         }
     }
@@ -350,18 +351,21 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
                     * entries associated with PuTTY, and also find
                     * and delete the random seed file.
                     */
-                   if (MessageBox(NULL,
-                                  "This procedure will remove ALL Registry\n"
-                                  "entries associated with PuTTY, and will\n"
-                                  "also remove the PuTTY random seed file.\n"
+                   char *s1, *s2;
+                   s1 = dupprintf("This procedure will remove ALL Registry\n"
+                                  "entries associated with %s, and will\n"
+                                  "also remove the random seed file.\n"
                                   "\n"
                                   "THIS PROCESS WILL DESTROY YOUR SAVED\n"
                                   "SESSIONS. Are you really sure you want\n"
-                                  "to continue?",
-                                  "PuTTY Warning",
+                                  "to continue?", appname);
+                   s2 = dupprintf("%s Warning", appname);
+                   if (MessageBox(NULL, s1, s2,
                                   MB_YESNO | MB_ICONWARNING) == IDYES) {
                        cleanup_all();
                    }
+                   sfree(s1);
+                   sfree(s2);
                    exit(0);
                } else if (*p != '-') {
                    char *q = p;
@@ -481,8 +485,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
                break;
            }
        if (back == NULL) {
+           char *str = dupprintf("%s Internal Error", appname);
            MessageBox(NULL, "Unsupported protocol number found",
-                      "PuTTY Internal Error", MB_OK | MB_ICONEXCLAMATION);
+                      str, MB_OK | MB_ICONEXCLAMATION);
+           sfree(str);
            WSACleanup();
            return 1;
        }
@@ -490,8 +496,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
 
     /* Check for invalid Port number (i.e. zero) */
     if (cfg.port == 0) {
+       char *str = dupprintf("%s Internal Error", appname);
        MessageBox(NULL, "Invalid Port Number",
-                  "PuTTY Internal Error", MB_OK | MB_ICONEXCLAMATION);
+                  str, MB_OK | MB_ICONEXCLAMATION);
+       sfree(str);
        WSACleanup();
        return 1;
     }
@@ -628,16 +636,18 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
                           cfg.host, cfg.port, &realhost, cfg.tcp_nodelay);
        back->provide_logctx(backhandle, logctx);
        if (error) {
+           char *str = dupprintf("%s Error", appname);
            sprintf(msg, "Unable to open connection to\n"
                    "%.800s\n" "%s", cfg.host, error);
-           MessageBox(NULL, msg, "PuTTY Error", MB_ICONERROR | MB_OK);
+           MessageBox(NULL, msg, str, MB_ICONERROR | MB_OK);
+           sfree(str);
            return 0;
        }
        window_name = icon_name = NULL;
        if (*cfg.wintitle) {
            title = cfg.wintitle;
        } else {
-           sprintf(msg, "%s - PuTTY", realhost);
+           sprintf(msg, "%s - %s", realhost, appname);
            title = msg;
        }
        sfree(realhost);
@@ -671,10 +681,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
        HMENU m = GetSystemMenu(hwnd, FALSE);
        HMENU s;
        int i;
+       char *str;
 
        AppendMenu(m, MF_SEPARATOR, 0, 0);
        specials_menu_position = GetMenuItemCount(m);
-       debug(("specials_menu_position = %d\n", specials_menu_position));
        AppendMenu(m, MF_ENABLED, IDM_SHOWLOG, "&Event Log");
        AppendMenu(m, MF_SEPARATOR, 0, 0);
        AppendMenu(m, MF_ENABLED, IDM_NEWSESS, "Ne&w Session...");
@@ -698,7 +708,9 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
        AppendMenu(m, MF_SEPARATOR, 0, 0);
         if (help_path)
             AppendMenu(m, MF_ENABLED, IDM_HELP, "&Help");
-       AppendMenu(m, MF_ENABLED, IDM_ABOUT, "&About PuTTY");
+       str = dupprintf("&About %s", appname);
+       AppendMenu(m, MF_ENABLED, IDM_ABOUT, str);
+       sfree(str);
     }
 
     update_specials_menu(NULL);
@@ -910,18 +922,20 @@ void set_raw_mouse_mode(void *frontend, int activate)
 void connection_fatal(void *frontend, char *fmt, ...)
 {
     va_list ap;
-    char stuff[200];
+    char stuff[200], morestuff[100];
 
     va_start(ap, fmt);
     vsprintf(stuff, fmt, ap);
     va_end(ap);
-    MessageBox(hwnd, stuff, "PuTTY Fatal Error", MB_ICONERROR | MB_OK);
+    sprintf(morestuff, "%.70s Fatal Error", appname);
+    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
     if (cfg.close_on_exit == FORCE_ON)
        PostQuitMessage(1);
     else {
        session_closed = TRUE;
-       set_icon(NULL, "PuTTY (inactive)");
-       set_title(NULL, "PuTTY (inactive)");
+       sprintf(morestuff, "%.70s (inactive)", appname);
+       set_icon(NULL, morestuff);
+       set_title(NULL, morestuff);
     }
 }
 
@@ -931,12 +945,13 @@ void connection_fatal(void *frontend, char *fmt, ...)
 void cmdline_error(char *fmt, ...)
 {
     va_list ap;
-    char stuff[200];
+    char stuff[200], morestuff[100];
 
     va_start(ap, fmt);
     vsprintf(stuff, fmt, ap);
     va_end(ap);
-    MessageBox(hwnd, stuff, "PuTTY Command Line Error", MB_ICONERROR | MB_OK);
+    sprintf(morestuff, "%.70s Command Line Error", appname);
+    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
     exit(1);
 }
 
@@ -964,11 +979,13 @@ static void enact_pending_netevent(void)
        if (cfg.close_on_exit == FORCE_ON ||
            cfg.close_on_exit == AUTO) PostQuitMessage(0);
        else {
+           char morestuff[100];
            session_closed = TRUE;
-           set_icon(NULL, "PuTTY (inactive)");
-           set_title(NULL, "PuTTY (inactive)");
+           sprintf(morestuff, "%.70s (inactive)", appname);
+           set_icon(NULL, morestuff);
+           set_title(NULL, morestuff);
            MessageBox(hwnd, "Connection closed by remote host",
-                      "PuTTY", MB_OK | MB_ICONINFORMATION);
+                      appname, MB_OK | MB_ICONINFORMATION);
        }
     }
 }
@@ -1673,13 +1690,17 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
       case WM_CREATE:
        break;
       case WM_CLOSE:
-       show_mouseptr(1);
-       if (!cfg.warn_on_close || session_closed ||
-           MessageBox(hwnd,
-                      "Are you sure you want to close this session?",
-                      "PuTTY Exit Confirmation",
-                      MB_ICONWARNING | MB_OKCANCEL) == IDOK)
-           DestroyWindow(hwnd);
+       {
+           char *str;
+           show_mouseptr(1);
+           str = dupprintf("%s Exit Confirmation", appname);
+           if (!cfg.warn_on_close || session_closed ||
+               MessageBox(hwnd,
+                          "Are you sure you want to close this session?",
+                          str, MB_ICONWARNING | MB_OKCANCEL) == IDOK)
+               DestroyWindow(hwnd);
+           sfree(str);
+       }
        return 0;
       case WM_DESTROY:
        show_mouseptr(1);
@@ -4265,12 +4286,13 @@ void optimised_move(void *frontend, int to, int from, int lines)
 void fatalbox(char *fmt, ...)
 {
     va_list ap;
-    char stuff[200];
+    char stuff[200], morestuff[100];
 
     va_start(ap, fmt);
     vsprintf(stuff, fmt, ap);
     va_end(ap);
-    MessageBox(hwnd, stuff, "PuTTY Fatal Error", MB_ICONERROR | MB_OK);
+    sprintf(morestuff, "%.70s Fatal Error", appname);
+    MessageBox(hwnd, stuff, morestuff, MB_ICONERROR | MB_OK);
     cleanup_exit(1);
 }
 
@@ -4280,12 +4302,13 @@ void fatalbox(char *fmt, ...)
 void modalfatalbox(char *fmt, ...)
 {
     va_list ap;
-    char stuff[200];
+    char stuff[200], morestuff[100];
 
     va_start(ap, fmt);
     vsprintf(stuff, fmt, ap);
     va_end(ap);
-    MessageBox(hwnd, stuff, "PuTTY Fatal Error",
+    sprintf(morestuff, "%.70s Fatal Error", appname);
+    MessageBox(hwnd, stuff, morestuff,
               MB_SYSTEMMODAL | MB_ICONERROR | MB_OK);
     cleanup_exit(1);
 }
@@ -4354,9 +4377,11 @@ void beep(void *frontend, int mode)
        if (!PlaySound(cfg.bell_wavefile.path, NULL,
                       SND_ASYNC | SND_FILENAME)) {
            char buf[sizeof(cfg.bell_wavefile) + 80];
+           char otherbuf[100];
            sprintf(buf, "Unable to play sound file\n%s\n"
                    "Using default sound instead", cfg.bell_wavefile);
-           MessageBox(hwnd, buf, "PuTTY Sound Error",
+           sprintf(otherbuf, "%.70s Sound Error", appname);
+           MessageBox(hwnd, buf, otherbuf,
                       MB_OK | MB_ICONEXCLAMATION);
            cfg.beep = BELL_DEFAULT;
        }
index fed920b..b94f25d 100644 (file)
@@ -163,6 +163,7 @@ struct dlgparam {
     HWND hwnd;                        /* the hwnd of the dialog box */
     struct winctrls *controltrees[8];  /* can have several of these */
     int nctrltrees;
+    char *wintitle;                   /* title of actual window */
     char *errtitle;                   /* title of error sub-messageboxes */
     void *data;                               /* data to pass in refresh events */
     union control *focused, *lastfocused; /* which ctrl has focus now/before */