Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
79aa1a00
Commit
79aa1a00
authored
Mar 04, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Mar 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Add ASSOC command.
parent
8049ae1a
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
183 additions
and
3 deletions
+183
-3
Cs.rc
programs/cmd/Cs.rc
+1
-0
De.rc
programs/cmd/De.rc
+1
-0
En.rc
programs/cmd/En.rc
+1
-0
Es.rc
programs/cmd/Es.rc
+1
-0
Fr.rc
programs/cmd/Fr.rc
+1
-0
Ja.rc
programs/cmd/Ja.rc
+1
-0
Ko.rc
programs/cmd/Ko.rc
+1
-0
Makefile.in
programs/cmd/Makefile.in
+1
-1
Nl.rc
programs/cmd/Nl.rc
+1
-0
No.rc
programs/cmd/No.rc
+1
-0
Pl.rc
programs/cmd/Pl.rc
+1
-0
Pt.rc
programs/cmd/Pt.rc
+1
-0
Ru.rc
programs/cmd/Ru.rc
+1
-0
Si.rc
programs/cmd/Si.rc
+1
-0
Tr.rc
programs/cmd/Tr.rc
+1
-0
builtins.c
programs/cmd/builtins.c
+156
-0
wcmd.h
programs/cmd/wcmd.h
+4
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+8
-1
No files found.
programs/cmd/Cs.rc
View file @
79aa1a00
...
...
@@ -234,4 +234,5 @@ Zadejte HELP <pkaz> pro podrobnj informace o nkterm z ve uvedench pk
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/De.rc
View file @
79aa1a00
...
...
@@ -251,4 +251,5 @@ obigen Befehle erhalten.\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/En.rc
View file @
79aa1a00
...
...
@@ -238,4 +238,5 @@ Enter HELP <command> for further information on any of the above commands\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Es.rc
View file @
79aa1a00
...
...
@@ -246,4 +246,5 @@ Introduzca HELP <comando> para ms informacin sobre cualquiera de los comandos\
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Fr.rc
View file @
79aa1a00
...
...
@@ -228,4 +228,5 @@ Entrez HELP <commande> pour plus d'informations sur les commandes ci-dessus\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Ja.rc
View file @
79aa1a00
...
...
@@ -232,4 +232,5 @@ EXIT\t\tCMDI\n\n\
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Ko.rc
View file @
79aa1a00
...
...
@@ -223,4 +223,5 @@ HELP <명령>을 치면 그 명령의 상세한 정보를 보여줌\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Makefile.in
View file @
79aa1a00
...
...
@@ -4,7 +4,7 @@ SRCDIR = @srcdir@
VPATH
=
@srcdir@
MODULE
=
cmd.exe
APPMODE
=
-mconsole
IMPORTS
=
shell32 user32 kernel32
IMPORTS
=
shell32 user32
advapi32
kernel32
C_SRCS
=
\
batch.c
\
...
...
programs/cmd/Nl.rc
View file @
79aa1a00
...
...
@@ -231,4 +231,5 @@ type HELP <opdracht> voor meer informatie over bovengenoemde opdrachten\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/No.rc
View file @
79aa1a00
...
...
@@ -229,4 +229,5 @@ Skriv HELP <kommando> for mer informasjon om kommandoene ovenfor\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Pl.rc
View file @
79aa1a00
...
...
@@ -225,4 +225,5 @@ Wpisz HELP <komenda> dla dokadniejszych informacji o komendzie\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Pt.rc
View file @
79aa1a00
...
...
@@ -438,4 +438,5 @@ Digite HELP <comando> para mais informaes sobre alguns dos comandos acima\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Ru.rc
View file @
79aa1a00
...
...
@@ -229,4 +229,5 @@ EXIT\t\t WCMD\n\n\
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Si.rc
View file @
79aa1a00
...
...
@@ -230,4 +230,5 @@ Enter HELP <command> for further information on any of the above commands\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/Tr.rc
View file @
79aa1a00
...
...
@@ -232,4 +232,5 @@ Yukardaki komutlar hakknda daha fazla bilgi iin HELP <komut> girin\n"
WCMD_CONFIRM, "Are you sure"
WCMD_YES, "Y"
WCMD_NO, "N"
WCMD_NOASSOC, "File association missing for extension %s\n"
}
programs/cmd/builtins.c
View file @
79aa1a00
...
...
@@ -1457,3 +1457,159 @@ BOOL WCMD_ask_confirm (char *message, BOOL showSureText) {
/* Return the answer */
return
(
answer
[
0
]
==
Ybuffer
[
0
]);
}
/*****************************************************************************
* WCMD_assoc
*
* Lists or sets file associations
*/
void
WCMD_assoc
(
char
*
command
)
{
HKEY
key
;
DWORD
accessOptions
=
KEY_READ
;
char
*
newValue
;
LONG
rc
=
ERROR_SUCCESS
;
char
keyValue
[
MAXSTRING
];
DWORD
valueLen
=
MAXSTRING
;
HKEY
readKey
;
/* See if parameter includes '=' */
errorlevel
=
0
;
newValue
=
strchr
(
command
,
'='
);
if
(
newValue
)
accessOptions
|=
KEY_WRITE
;
/* Open a key to HKEY_CLASSES_ROOT for enumerating */
if
(
RegOpenKeyEx
(
HKEY_CLASSES_ROOT
,
""
,
0
,
accessOptions
,
&
key
)
!=
ERROR_SUCCESS
)
{
WINE_FIXME
(
"Unexpected failure opening HKCR key: %d
\n
"
,
GetLastError
());
return
;
}
/* If no paramaters then list all associations */
if
(
*
command
==
0x00
)
{
int
index
=
0
;
/* Enumerate all the keys */
while
(
rc
!=
ERROR_NO_MORE_ITEMS
)
{
char
keyName
[
MAXSTRING
];
DWORD
nameLen
;
/* Find the next value */
nameLen
=
MAXSTRING
;
rc
=
RegEnumKeyEx
(
key
,
index
++
,
keyName
,
&
nameLen
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
/* Only interested in extension ones */
if
(
keyName
[
0
]
==
'.'
)
{
if
(
RegOpenKeyEx
(
key
,
keyName
,
0
,
accessOptions
,
&
readKey
)
==
ERROR_SUCCESS
)
{
rc
=
RegQueryValueEx
(
readKey
,
NULL
,
NULL
,
NULL
,
(
LPBYTE
)
keyValue
,
&
valueLen
);
WCMD_output_asis
(
keyName
);
WCMD_output_asis
(
"="
);
/* If no default value found, leave line empty after '=' */
if
(
rc
==
ERROR_SUCCESS
)
{
WCMD_output_asis
(
keyValue
);
}
WCMD_output_asis
(
"
\n
"
);
}
}
}
}
RegCloseKey
(
readKey
);
}
else
{
/* Parameter supplied - if no '=' on command line, its a query */
if
(
newValue
==
NULL
)
{
char
*
space
;
/* Query terminates the parameter at the first space */
strcpy
(
keyValue
,
command
);
space
=
strchr
(
keyValue
,
' '
);
if
(
space
)
*
space
=
0x00
;
if
(
RegOpenKeyEx
(
key
,
keyValue
,
0
,
accessOptions
,
&
readKey
)
==
ERROR_SUCCESS
)
{
rc
=
RegQueryValueEx
(
readKey
,
NULL
,
NULL
,
NULL
,
(
LPBYTE
)
keyValue
,
&
valueLen
);
WCMD_output_asis
(
command
);
WCMD_output_asis
(
"="
);
/* If no default value found, leave line empty after '=' */
if
(
rc
==
ERROR_SUCCESS
)
WCMD_output_asis
(
keyValue
);
WCMD_output_asis
(
"
\n
"
);
RegCloseKey
(
readKey
);
}
else
{
char
msgbuffer
[
MAXSTRING
];
char
outbuffer
[
MAXSTRING
];
/* Load the translated 'File association not found' */
LoadString
(
hinst
,
WCMD_NOASSOC
,
msgbuffer
,
sizeof
(
msgbuffer
));
sprintf
(
outbuffer
,
msgbuffer
,
keyValue
);
WCMD_output_asis
(
outbuffer
);
errorlevel
=
2
;
}
/* Not a query - its a set or clear of a value */
}
else
{
/* Get pointer to new value */
*
newValue
=
0x00
;
newValue
++
;
/* If nothing after '=' then clear value */
if
(
*
newValue
==
0x00
)
{
rc
=
RegDeleteKey
(
key
,
command
);
if
(
rc
==
ERROR_SUCCESS
)
{
WINE_TRACE
(
"HKCR Key '%s' deleted
\n
"
,
command
);
}
else
if
(
rc
!=
ERROR_FILE_NOT_FOUND
)
{
WCMD_print_error
();
errorlevel
=
2
;
}
else
{
char
msgbuffer
[
MAXSTRING
];
char
outbuffer
[
MAXSTRING
];
/* Load the translated 'File association not found' */
LoadString
(
hinst
,
WCMD_NOASSOC
,
msgbuffer
,
sizeof
(
msgbuffer
));
sprintf
(
outbuffer
,
msgbuffer
,
keyValue
);
WCMD_output_asis
(
outbuffer
);
errorlevel
=
2
;
}
/* It really is a set value = contents */
}
else
{
rc
=
RegCreateKeyEx
(
key
,
command
,
0
,
NULL
,
REG_OPTION_NON_VOLATILE
,
accessOptions
,
NULL
,
&
readKey
,
NULL
);
if
(
rc
==
ERROR_SUCCESS
)
{
rc
=
RegSetValueEx
(
readKey
,
NULL
,
0
,
REG_SZ
,
(
LPBYTE
)
newValue
,
strlen
(
newValue
));
RegCloseKey
(
readKey
);
}
if
(
rc
!=
ERROR_SUCCESS
)
{
WCMD_print_error
();
errorlevel
=
2
;
}
else
{
WCMD_output_asis
(
command
);
WCMD_output_asis
(
"="
);
WCMD_output_asis
(
newValue
);
WCMD_output_asis
(
"
\n
"
);
}
}
}
}
/* Clean up */
RegCloseKey
(
key
);
}
programs/cmd/wcmd.h
View file @
79aa1a00
...
...
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <ctype.h>
void
WCMD_assoc
(
char
*
);
void
WCMD_batch
(
char
*
,
char
*
,
int
,
char
*
,
HANDLE
);
void
WCMD_call
(
char
*
command
);
void
WCMD_change_tty
(
void
);
...
...
@@ -155,9 +156,10 @@ struct env_stack
#define WCMD_SETLOCAL 37
#define WCMD_PUSHD 38
#define WCMD_POPD 39
#define WCMD_ASSOC 40
/* Must be last in list */
#define WCMD_EXIT 4
0
#define WCMD_EXIT 4
1
/* Some standard messages */
extern
const
char
nyi
[];
...
...
@@ -169,6 +171,7 @@ extern const char anykey[];
#define WCMD_CONFIRM 1001
#define WCMD_YES 1002
#define WCMD_NO 1003
#define WCMD_NOASSOC 1004
/* msdn specified max for Win XP */
#define MAXSTRING 8192
programs/cmd/wcmdmain.c
View file @
79aa1a00
...
...
@@ -26,13 +26,16 @@
#include "config.h"
#include "wcmd.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
cmd
);
const
char
*
const
inbuilt
[]
=
{
"ATTRIB"
,
"CALL"
,
"CD"
,
"CHDIR"
,
"CLS"
,
"COPY"
,
"CTTY"
,
"DATE"
,
"DEL"
,
"DIR"
,
"ECHO"
,
"ERASE"
,
"FOR"
,
"GOTO"
,
"HELP"
,
"IF"
,
"LABEL"
,
"MD"
,
"MKDIR"
,
"MOVE"
,
"PATH"
,
"PAUSE"
,
"PROMPT"
,
"REM"
,
"REN"
,
"RENAME"
,
"RD"
,
"RMDIR"
,
"SET"
,
"SHIFT"
,
"TIME"
,
"TITLE"
,
"TYPE"
,
"VERIFY"
,
"VER"
,
"VOL"
,
"ENDLOCAL"
,
"SETLOCAL"
,
"PUSHD"
,
"POPD"
,
"EXIT"
};
"ENDLOCAL"
,
"SETLOCAL"
,
"PUSHD"
,
"POPD"
,
"
ASSOC"
,
"
EXIT"
};
HINSTANCE
hinst
;
DWORD
errorlevel
;
...
...
@@ -441,6 +444,7 @@ void WCMD_process_command (char *command)
* Strip leading whitespaces, and a '@' if supplied
*/
whichcmd
=
WCMD_strtrim_leading_spaces
(
cmd
);
WINE_TRACE
(
"Command: '%s'
\n
"
,
cmd
);
if
(
whichcmd
[
0
]
==
'@'
)
whichcmd
++
;
/*
...
...
@@ -570,6 +574,9 @@ void WCMD_process_command (char *command)
case
WCMD_POPD
:
WCMD_popd
();
break
;
case
WCMD_ASSOC
:
WCMD_assoc
(
p
);
break
;
case
WCMD_EXIT
:
WCMD_exit
();
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment