(no subject)

Stefan Leichter sle at camline.com
Sun Mar 23 01:24:08 CST 2003


Hello Alexandre,

i hope you react on this patch somehow (either by applying it or by writing a 
comment on wine-devel). I don't like to send this patch a second time like the 
most patches i have send the last half year. :-(

Bye Stefan


ChangeLog
------------
	let wcmd handle .cmd files like .bat files
-------------- next part --------------
--- ../wine/dlls/shell32/shlexec.c	Wed Jan 15 23:14:15 2003
+++ dlls/shell32/shlexec.c	Fri Mar 21 22:47:39 2003
@@ -264,7 +264,7 @@
     /* See if it's a program - if GetProfileString fails, we skip this
      * section. Actually, if GetProfileString fails, we've probably
      * got a lot more to worry about than running a program... */
-    if (GetProfileStringA("windows", "programs", "exe pif bat com",
+    if (GetProfileStringA("windows", "programs", "exe pif bat cmd com",
                           buffer, sizeof(buffer)) > 0)
     {
         UINT i;
--- ../wine/programs/wcmd/wcmdmain.c	Wed Mar  5 18:06:36 2003
+++ programs/wcmd/wcmdmain.c	Fri Mar 21 22:37:34 2003
@@ -366,9 +366,16 @@
         return;
       }
     }
+    if ((strchr (param1, '.') == NULL) || (strstr (param1, ".cmd") != NULL)) {
+      if (SearchPath (NULL, param1, ".cmd", sizeof(filetorun), filetorun, NULL)) {
+        WCMD_batch (filetorun, command, 0);
+        return;
+      }
+    }
   }
   else {                                        /* Explicit path given */
-    if (strstr (param1, ".bat") != NULL) {
+    if ((strstr (param1, ".bat") != NULL) || 
+        (strstr (param1, ".cmd") != NULL)) {
       WCMD_batch (param1, command, 0);
       return;
     }
--- ../wine/programs/wcmd/batch.c	Wed Jan 15 23:14:17 2003
+++ programs/wcmd/batch.c	Fri Mar 21 22:37:34 2003
@@ -47,15 +47,22 @@
 
 void WCMD_batch (char *file, char *command, int called) {
 
-HANDLE h;
+#define WCMD_BATCH_EXT_SIZE 5
+
+HANDLE h = INVALID_HANDLE_VALUE;
 char string[MAXSTRING];
+char extension[][WCMD_BATCH_EXT_SIZE] = {".bat",".cmd"};
+int  i;
 BATCH_CONTEXT *prev_context;
 
+  for(i=0; (i<(sizeof(extension)/WCMD_BATCH_EXT_SIZE)) && 
+           (h == INVALID_HANDLE_VALUE); i++) {
   strcpy (string, file);
   CharLower (string);
-  if (strstr (string, ".bat") == NULL) strcat (string, ".bat");
+    if (strstr (string, extension[i]) == NULL) strcat (string, extension[i]);
   h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ,
                   NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+  }
   if (h == INVALID_HANDLE_VALUE) {
     SetLastError (ERROR_FILE_NOT_FOUND);
     WCMD_print_error ();


More information about the wine-patches mailing list