From a5372d680f3ff71b84e23734f57507c86ca2de69 Mon Sep 17 00:00:00 2001
From: Ilya Shpigor <shpigor@etersoft.ru>
Date: Fri, 15 May 2009 11:31:37 +0400
Subject: [PATCH 1/2] etermsg: Specifying the path in the application not found message

---
 dlls/kernel32/process.c     |    2 +-
 programs/etermsg/En.rc      |    3 ++-
 programs/etermsg/Ru.rc      |    3 ++-
 programs/etermsg/etermsg.c  |   35 ++++++++++++++++++++++++++++++++---
 programs/etermsg/resource.h |    5 +++--
 5 files changed, 40 insertions(+), 8 deletions(-)

diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 7153df6..81d8a84 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -1133,7 +1133,7 @@ void CDECL __wine_kernel_init(void)
             if (!got_current_dir)
                 sprintf(cmdline, "etermsg -ed");
             else
-                sprintf(cmdline, "etermsg -ea");
+                sprintf(cmdline, "etermsg -ea %s", debugstr_w(main_exe_name));
 
             memset(&startup, 0, sizeof(startup));
             startup.cb = sizeof(startup);
diff --git a/programs/etermsg/En.rc b/programs/etermsg/En.rc
index 8a27c83..f4a7060 100644
--- a/programs/etermsg/En.rc
+++ b/programs/etermsg/En.rc
@@ -29,6 +29,7 @@ BEGIN
     IDS_FILE_CORRUPT    "The license file is corrupt"
     IDS_LICENSE_EXP     "The license has expired"
     IDS_ERROR_DIR       "Wine have been run in the unknown disk"
-    IDS_ERROR_APP       "The specified application doesn't exist"
+    IDS_ERROR_APP_BEG   "Module"
+    IDS_ERROR_APP_END   "not found"
     IDS_LICENSE_ACCORD  "The license file does not correspond with product type"
 END
diff --git a/programs/etermsg/Ru.rc b/programs/etermsg/Ru.rc
index a7ec99d..d0a649e 100644
--- a/programs/etermsg/Ru.rc
+++ b/programs/etermsg/Ru.rc
@@ -29,6 +29,7 @@ BEGIN
     IDS_FILE_CORRUPT    "Ôàéë ëèöåíçèè ïîâðåæäåí"
     IDS_LICENSE_EXP     "Ñðîê äåéñòâèÿ ëèöåíçèè èñòåê"
     IDS_ERROR_DIR       "Wine áûë çàïóùåí íà íåèçâåñòíîì äèñêå"
-    IDS_ERROR_APP       "Óêàçàííîãî ïðèëîæåíèÿ íå ñóùåñòâóåò"
+    IDS_ERROR_APP_BEG   "Ïðèëîæåíèå"
+    IDS_ERROR_APP_END   "íå íàéäåíî"
     IDS_LICENSE_ACCORD  "Ôàéë ëèöåíçèè íå ñîîòâåòñòâóåò óñòàíîâëåííîìó ïðîäóêòó"
 END
diff --git a/programs/etermsg/etermsg.c b/programs/etermsg/etermsg.c
index 754049e..68e0f29 100644
--- a/programs/etermsg/etermsg.c
+++ b/programs/etermsg/etermsg.c
@@ -111,10 +111,39 @@ int main(int argc, char** argv)
     }
     else if (argc && !strcmp(argv[0], "-ea"))
     {
-        ret = LoadStringW(GetModuleHandleW(NULL), IDS_ERROR_APP, Text, LOADSTRING_SIZE);
+        WCHAR path[ARG_SIZE];
+        WCHAR *path_ptr;
+        WCHAR buf[LOADSTRING_SIZE];
+        WCHAR appendix[LOADSTRING_SIZE];
+        WCHAR fmt_l[] = {'%','s','\n','\'','%','s','\'','\n','%','s','\0'};
+        WCHAR fmt_s[] = {'%','s',' ','%','s','\0'};
+
+        ret = LoadStringW(GetModuleHandleW(NULL), IDS_ERROR_APP_BEG, Text, LOADSTRING_SIZE);
         if (!ret) return 0;
 
-        MessageBoxW(NULL, Text, Msg, MB_ICONWARNING | MB_OK);
+        ret = LoadStringW(GetModuleHandleW(NULL), IDS_ERROR_APP_END, appendix, LOADSTRING_SIZE);
+        if (!ret) return 0;
+
+        if (argc == 2)
+        {
+            int i;
+            for(i = 0; i<ARG_SIZE; i++)
+            {
+                if (i == 0 && argv[1][i] == '\0') return 0;
+                path[i] = argv[1][i];
+            }
+
+            path_ptr = path;
+            path_ptr++;
+            sprintfW(buf, fmt_l, Text, path_ptr, appendix);
+            MessageBoxW(NULL, buf, Msg, MB_ICONWARNING | MB_OK);
+        }
+        else
+        {
+            sprintfW(buf, fmt_s, Text, appendix);
+            MessageBoxW(NULL, buf, Msg, MB_ICONWARNING | MB_OK);
+        }
+
         return 0;
     }
     else if ((argc == 2) && !strcmp(argv[0], "-a"))
@@ -133,7 +162,7 @@ int main(int argc, char** argv)
             MessageBoxW(NULL, Text, Msg, MB_ICONINFORMATION | MB_OK);
     }
     else
-        printf("Usage:\n\tetermsg [ -lf | -lc | -ld <date> | -a <prog-name> | -ed | -ea ]\n");
+        printf("Usage:\n\tetermsg [ -lf | -lc | -ld <date> | -a <prog-name> | -ed | -ea <path> ]\n");
 
     return 0;
 }
diff --git a/programs/etermsg/resource.h b/programs/etermsg/resource.h
index bb7c63c..32e411f 100644
--- a/programs/etermsg/resource.h
+++ b/programs/etermsg/resource.h
@@ -24,5 +24,6 @@
 #define IDS_FILE_CORRUPT    4
 #define IDS_LICENSE_EXP     5
 #define IDS_ERROR_DIR       6
-#define IDS_ERROR_APP       7
-#define IDS_LICENSE_ACCORD  8
+#define IDS_ERROR_APP_BEG   7
+#define IDS_ERROR_APP_END   8
+#define IDS_LICENSE_ACCORD  9
-- 
1.6.2.5

