mirror of
https://github.com/reactos/wine.git
synced 2025-04-02 16:12:04 +00:00
Let wcmd handle .cmd files like .bat files.
This commit is contained in:
parent
c9fda6faeb
commit
a127ad1cd1
@ -264,7 +264,7 @@ static UINT SHELL_FindExecutable(LPCSTR lpPath, LPCSTR lpFile, LPCSTR lpOperatio
|
|||||||
/* See if it's a program - if GetProfileString fails, we skip this
|
/* See if it's a program - if GetProfileString fails, we skip this
|
||||||
* section. Actually, if GetProfileString fails, we've probably
|
* section. Actually, if GetProfileString fails, we've probably
|
||||||
* got a lot more to worry about than running a program... */
|
* 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)
|
buffer, sizeof(buffer)) > 0)
|
||||||
{
|
{
|
||||||
UINT i;
|
UINT i;
|
||||||
|
@ -47,15 +47,22 @@ extern DWORD errorlevel;
|
|||||||
|
|
||||||
void WCMD_batch (char *file, char *command, int called) {
|
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 string[MAXSTRING];
|
||||||
|
char extension[][WCMD_BATCH_EXT_SIZE] = {".bat",".cmd"};
|
||||||
|
int i;
|
||||||
BATCH_CONTEXT *prev_context;
|
BATCH_CONTEXT *prev_context;
|
||||||
|
|
||||||
|
for(i=0; (i<(sizeof(extension)/WCMD_BATCH_EXT_SIZE)) &&
|
||||||
|
(h == INVALID_HANDLE_VALUE); i++) {
|
||||||
strcpy (string, file);
|
strcpy (string, file);
|
||||||
CharLower (string);
|
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,
|
h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ,
|
||||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
|
}
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
SetLastError (ERROR_FILE_NOT_FOUND);
|
SetLastError (ERROR_FILE_NOT_FOUND);
|
||||||
WCMD_print_error ();
|
WCMD_print_error ();
|
||||||
|
@ -366,9 +366,16 @@ char filetorun[MAX_PATH];
|
|||||||
return;
|
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 */
|
else { /* Explicit path given */
|
||||||
if (strstr (param1, ".bat") != NULL) {
|
if ((strstr (param1, ".bat") != NULL) ||
|
||||||
|
(strstr (param1, ".cmd") != NULL)) {
|
||||||
WCMD_batch (param1, command, 0);
|
WCMD_batch (param1, command, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user