winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2007
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
839 discussions
Start a n
N
ew thread
James Hawkins : msi: Add tests for using markers in SELECT clauses.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: a40d687133b962128ed61ef0264dc3e14f861491 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a40d687133b962128ed61ef02…
Author: James Hawkins <truiken(a)gmail.com> Date: Sun Feb 25 01:31:07 2007 -0600 msi: Add tests for using markers in SELECT clauses. --- dlls/msi/tests/db.c | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 117 insertions(+), 0 deletions(-) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 9d6a97b..8a7585f 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -3188,6 +3188,122 @@ static void test_special_tables(void) ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); } +static void test_select_markers(void) +{ + MSIHANDLE hdb = 0, rec, view, res; + LPCSTR query; + UINT r; + DWORD size; + CHAR buf[MAX_PATH]; + + hdb = create_db(); + ok( hdb, "failed to create db\n"); + + r = run_query(hdb, 0, + "CREATE TABLE `Table` (`One` CHAR(72), `Two` CHAR(72), `Three` SHORT PRIMARY KEY `One`, `Two`, `Three`)"); + ok(r == S_OK, "cannot create table: %d\n", r); + + r = run_query(hdb, 0, "INSERT INTO `Table` " + "( `One`, `Two`, `Three` ) VALUES ( 'apple', 'one', 1 )"); + ok(r == S_OK, "cannot add file to the Media table: %d\n", r); + + r = run_query(hdb, 0, "INSERT INTO `Table` " + "( `One`, `Two`, `Three` ) VALUES ( 'apple', 'two', 1 )"); + ok(r == S_OK, "cannot add file to the Media table: %d\n", r); + + r = run_query(hdb, 0, "INSERT INTO `Table` " + "( `One`, `Two`, `Three` ) VALUES ( 'apple', 'two', 2 )"); + ok(r == S_OK, "cannot add file to the Media table: %d\n", r); + + r = run_query(hdb, 0, "INSERT INTO `Table` " + "( `One`, `Two`, `Three` ) VALUES ( 'banana', 'three', 3 )"); + ok(r == S_OK, "cannot add file to the Media table: %d\n", r); + + rec = MsiCreateRecord(2); + MsiRecordSetString(rec, 1, "apple"); + MsiRecordSetString(rec, 2, "two"); + + query = "SELECT * FROM `Table` WHERE `One`=? AND `Two`=? ORDER BY `Three`"; + r = MsiDatabaseOpenView(hdb, query, &view); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewExecute(view, rec); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + } + + r = MsiViewFetch(view, &res); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + } + + size = MAX_PATH; + r = MsiRecordGetString(res, 1, buf, &size); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buf, "apple"), "Expected apple, got %s\n", buf); + } + + size = MAX_PATH; + r = MsiRecordGetString(res, 2, buf, &size); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buf, "two"), "Expected two, got %s\n", buf); + } + + r = MsiRecordGetInteger(res, 3); + todo_wine + { + ok(r == 1, "Expected 1, got %d\n", r); + } + + MsiCloseHandle(res); + + r = MsiViewFetch(view, &res); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + } + + size = MAX_PATH; + r = MsiRecordGetString(res, 1, buf, &size); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buf, "apple"), "Expected apple, got %s\n", buf); + } + + size = MAX_PATH; + r = MsiRecordGetString(res, 2, buf, &size); + todo_wine + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buf, "two"), "Expected two, got %s\n", buf); + } + + r = MsiRecordGetInteger(res, 3); + todo_wine + { + ok(r == 2, "Expected 2, got %d\n", r); + } + + MsiCloseHandle(res); + + r = MsiViewFetch(view, &res); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + + r = MsiViewClose(view); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(view); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + r = MsiCloseHandle(hdb); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); +} + START_TEST(db) { test_msidatabase(); @@ -3211,4 +3327,5 @@ START_TEST(db) test_integers(); test_update(); test_special_tables(); + test_select_markers(); }
1
0
0
0
James Hawkins : msi: Check for a NULL text entry, as it can be blank in the VolumeCostList control.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: d4a324940b3b92595dd26a92561cc80b01b0a3bd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=d4a324940b3b92595dd26a925…
Author: James Hawkins <truiken(a)gmail.com> Date: Sat Feb 24 23:08:12 2007 -0600 msi: Check for a NULL text entry, as it can be blank in the VolumeCostList control. --- dlls/msi/dialog.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 28fb2e9..35a192c 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -2448,6 +2448,8 @@ static void msi_dialog_vcl_add_columns( msi_dialog *dialog, msi_control *control static const WCHAR zero[] = {'0',0}; static const WCHAR negative[] = {'-',0}; + if (!text) return; + while ((begin = strchrW( begin, '{' )) && count < 5) { if (!(end = strchrW( begin, '}' )))
1
0
0
0
James Hawkins : msi: Free the custom action data after the thread function executes.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 747f19f01196cba5a24a1f60a306f815ef4763b0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=747f19f01196cba5a24a1f60a…
Author: James Hawkins <truiken(a)gmail.com> Date: Sat Feb 24 23:06:54 2007 -0600 msi: Free the custom action data after the thread function executes. --- dlls/msi/custom.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index ba5c825..c6c07cf 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -452,9 +452,6 @@ static UINT wait_thread_handle( msi_custom_action_info *info ) else { TRACE("%s running in background\n", debugstr_w( info->action )); - - if (info->type & msidbCustomActionTypeContinue) - free_custom_action_data( info ); } return rc; @@ -529,6 +526,10 @@ static DWORD WINAPI ACTION_CallDllFunction( const LPGUID guid ) FreeLibrary(hModule); + if (info->type & msidbCustomActionTypeAsync && + info->type & msidbCustomActionTypeContinue) + free_custom_action_data( info ); + return r; }
1
0
0
0
Vitaliy Margolen : wineshelllink: Fix menu entries with double spaces in their names.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 5f960781fcb9912cac22602c18be5c15b21bd1eb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5f960781fcb9912cac22602c1…
Author: Vitaliy Margolen <wine-patches(a)kievinfo.com> Date: Sat Feb 24 20:34:21 2007 -0700 wineshelllink: Fix menu entries with double spaces in their names. --- tools/wineshelllink | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/wineshelllink b/tools/wineshelllink index 55a1942..e4c0fb2 100755 --- a/tools/wineshelllink +++ b/tools/wineshelllink @@ -153,8 +153,8 @@ BEGIN { RS="<" } # new item write_menu_file() { - menu=`echo $1 | sed 's!/!-!g'` - filename=`echo $2 | sed 's!/!-!g'` + menu=`echo "$1" | sed 's!/!-!g'` + filename=`echo "$2" | sed 's!/!-!g'` tmpfile=`mktemp /tmp/wine.XXXXXX` (
1
0
0
0
Jason Edmeades : cmd.exe: Add special SET modifiers.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 3ab449c96a281ec47ea9173b1a38687390311eb4 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3ab449c96a281ec47ea9173b1…
Author: Jason Edmeades <us(a)edmeades.me.uk> Date: Fri Feb 23 22:22:57 2007 +0000 cmd.exe: Add special SET modifiers. --- programs/cmd/wcmdmain.c | 225 +++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 207 insertions(+), 18 deletions(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 2d5f805..b7845c7 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -46,6 +46,8 @@ char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH]; BATCH_CONTEXT *context = NULL; static HANDLE old_stdin = INVALID_HANDLE_VALUE, old_stdout = INVALID_HANDLE_VALUE; +static char *WCMD_expand_envvar(char *start); + /***************************************************************************** * Main entry point. This is a console application so we have a main() not a * winmain(). @@ -303,7 +305,7 @@ void WCMD_process_command (char *command) { char *cmd, *p, *s, *t; char temp[MAXSTRING]; - int status, i, len; + int status, i; DWORD count, creationDisposition; HANDLE h; char *whichcmd; @@ -410,25 +412,10 @@ void WCMD_process_command (char *command) strcat (p, s); } else { - p++; + p = WCMD_expand_envvar(p); } } - -/* - * Expand up environment variables. - * FIXME: Move this to above, without reallocating - */ - len = ExpandEnvironmentStrings (new_cmd, NULL, 0); - cmd = HeapAlloc( GetProcessHeap(), 0, len ); - status = ExpandEnvironmentStrings (new_cmd, cmd, len); - if (!status) { - WCMD_print_error (); - HeapFree( GetProcessHeap(), 0, cmd ); - HeapFree( GetProcessHeap(), 0, new_cmd ); - return; - } else { - HeapFree( GetProcessHeap(), 0, new_cmd ); - } + cmd = new_cmd; /* In a batch program, unknown variables are replace by nothing */ /* so remove any remaining %var% */ @@ -1135,3 +1122,205 @@ char temp_path[MAX_PATH], temp_file[MAX_PATH], temp_file2[MAX_PATH], temp_cmd[10 WCMD_process_command (temp_cmd); DeleteFile (temp_file); } + +/************************************************************************* + * WCMD_expand_envvar + * + * Expands environment variables, allowing for character substitution + */ +static char *WCMD_expand_envvar(char *start) { + char *endOfVar = NULL, *s; + char *colonpos = NULL; + char thisVar[MAXSTRING]; + char thisVarContents[MAXSTRING]; + char savedchar = 0x00; + int len; + + /* Find the end of the environment variable, and extract name */ + endOfVar = strchr(start+1, '%'); + if (endOfVar == NULL) { + /* FIXME: Some special conditions here depending opn whether + in batch, complex or not, and whether env var exists or not! */ + return start+1; + } + strncpy(thisVar, start, (endOfVar - start)+1); + thisVar[(endOfVar - start)+1] = 0x00; + colonpos = strchr(thisVar+1, ':'); + + /* If there's complex substitution, just need %var% for now + to get the expanded data to play with */ + if (colonpos) { + *colonpos = '%'; + savedchar = *(colonpos+1); + *(colonpos+1) = 0x00; + } + + /* Expand to contents, if unchanged, return */ + len = ExpandEnvironmentStrings(thisVar, thisVarContents, + sizeof(thisVarContents)); + if (len == 0) + return endOfVar+1; + + /* In a batch program, unknown env vars are replaced with nothing, + note syntax %garbage:1,3% results in anything after the ':' + except the % + From the command line, you just get back what you entered */ + if (lstrcmpi(thisVar, thisVarContents) == 0) { + + /* Restore the complex part after the compare */ + if (colonpos) { + *colonpos = ':'; + *(colonpos+1) = savedchar; + } + + s = strdup (endOfVar + 1); + + /* Command line - just ignore this */ + if (context == NULL) return endOfVar+1; + + /* Batch - replace unknown env var with nothing */ + if (colonpos == NULL) { + strcpy (start, s); + + } else { + len = strlen(thisVar); + thisVar[len-1] = 0x00; + /* If %:...% supplied, : is retained */ + if (colonpos == thisVar+1) { + strcpy (start, colonpos); + } else { + strcpy (start, colonpos+1); + } + strcat (start, s); + } + free (s); + return start; + + } + + /* See if we need to do complex substitution (any ':'s), if not + then our work here is done */ + if (colonpos == NULL) { + s = strdup (endOfVar + 1); + strcpy (start, thisVarContents); + strcat (start, s); + free(s); + return start; + } + + /* Restore complex bit */ + *colonpos = ':'; + *(colonpos+1) = savedchar; + + /* + Handle complex substitutions: + xxx=yyy (replace xxx with yyy) + *xxx=yyy (replace up to and including xxx with yyy) + ~x (from x chars in) + ~-x (from x chars from the end) + ~x,y (from x chars in for y characters) + ~x,-y (from x chars in until y characters from the end) + */ + + /* ~ is substring manipulation */ + if (savedchar == '~') { + + int substrposition, substrlength; + char *commapos = strchr(colonpos+2, ','); + char *startCopy; + + substrposition = atol(colonpos+2); + if (commapos) substrlength = atol(commapos+1); + + s = strdup (endOfVar + 1); + + /* Check bounds */ + if (substrposition >= 0) { + startCopy = &thisVarContents[min(substrposition, len)]; + } else { + startCopy = &thisVarContents[max(0, len+substrposition-1)]; + } + + if (commapos == NULL) { + strcpy (start, startCopy); /* Copy the lot */ + } else if (substrlength < 0) { + + int copybytes = (len+substrlength-1)-(startCopy-thisVarContents); + if (copybytes > len) copybytes = len; + else if (copybytes < 0) copybytes = 0; + strncpy (start, startCopy, copybytes); /* Copy the lot */ + start[copybytes] = 0x00; + } else { + strncpy (start, startCopy, substrlength); /* Copy the lot */ + start[substrlength] = 0x00; + } + + strcat (start, s); + free(s); + return start; + + /* search and replace manipulation */ + } else { + char *equalspos = strstr(colonpos, "="); + char *replacewith = equalspos+1; + char *found = NULL; + char *searchIn; + char *searchFor; + + s = strdup (endOfVar + 1); + if (equalspos == NULL) return start+1; + + /* Null terminate both strings */ + thisVar[strlen(thisVar)-1] = 0x00; + *equalspos = 0x00; + + /* Since we need to be case insensitive, copy the 2 buffers */ + searchIn = strdup(thisVarContents); + CharUpperBuff(searchIn, strlen(thisVarContents)); + searchFor = strdup(colonpos+1); + CharUpperBuff(searchFor, strlen(colonpos+1)); + + + /* Handle wildcard case */ + if (*(colonpos+1) == '*') { + /* Search for string to replace */ + found = strstr(searchIn, searchFor+1); + + if (found) { + /* Do replacement */ + strcpy(start, replacewith); + strcat(start, thisVarContents + (found-searchIn) + strlen(searchFor+1)); + strcat(start, s); + free(s); + } else { + /* Copy as it */ + strcpy(start, thisVarContents); + strcat(start, s); + } + + } else { + /* Loop replacing all instances */ + char *lastFound = searchIn; + char *outputposn = start; + + *start = 0x00; + while ((found = strstr(lastFound, searchFor))) { + strncpy(outputposn, + thisVarContents + (lastFound-searchIn), + (found - lastFound)); + outputposn = outputposn + (found - lastFound); + *outputposn = 0x00; + strcat(outputposn, replacewith); + outputposn = outputposn + strlen(replacewith); + lastFound = found + strlen(searchFor); + } + strcat(outputposn, + thisVarContents + (lastFound-searchIn)); + strcat(outputposn, s); + } + free(searchIn); + free(searchFor); + return start; + } + return start+1; +}
1
0
0
0
Jason Edmeades : cmd.exe: Add %random% special name support.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: e8fa5df394c70214a0c2a53b0ddd360b8dec2c2f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=e8fa5df394c70214a0c2a53b0…
Author: Jason Edmeades <us(a)edmeades.me.uk> Date: Fri Feb 23 22:22:03 2007 +0000 cmd.exe: Add %random% special name support. --- programs/cmd/wcmdmain.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 8380d18..2d5f805 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -318,8 +318,8 @@ void WCMD_process_command (char *command) /* Expand environment variables in a batch file %{0-9} first */ /* including support for any ~ modifiers */ /* Additionally: */ - /* Expand the DATE, TIME, CD and ERRORLEVEL special names */ - /* allowing environment variable overrides */ + /* Expand the DATE, TIME, CD, RANDOM and ERRORLEVEL special */ + /* names allowing environment variable overrides */ /* FIXME: Winnt would replace %1%fred%1 with first parm, then */ /* contents of fred, then the digit 1. Would need to remove */ @@ -399,6 +399,16 @@ void WCMD_process_command (char *command) strcpy (p, temp); strcat (p, s); + } else if ((CompareString (LOCALE_USER_DEFAULT, + NORM_IGNORECASE | SORT_STRINGSORT, + (p+1), 7, "RANDOM%", -1) == 2) && + (GetEnvironmentVariable("RANDOM", temp, 1) == 0) && + (GetLastError() == ERROR_ENVVAR_NOT_FOUND)) { + sprintf(temp, "%d", rand() % 32768); + s = strdup (p+8); + strcpy (p, temp); + strcat (p, s); + } else { p++; }
1
0
0
0
Jason Edmeades : cmd.exe: Unify parsing and expansion.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 98ae8a69412f573930e1679fafe3d84e7aa0a74c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=98ae8a69412f573930e1679fa…
Author: Jason Edmeades <us(a)edmeades.me.uk> Date: Fri Feb 23 22:21:27 2007 +0000 cmd.exe: Unify parsing and expansion. --- programs/cmd/batch.c | 135 +---------------------------------------------- programs/cmd/wcmd.h | 5 ++ programs/cmd/wcmdmain.c | 134 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 125 insertions(+), 149 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=98ae8a69412f573930e16…
1
0
0
0
Jason Edmeades : cmd.exe: Add support for call :label and goto :label.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 327d7ef9e60446e7c421cab15baabee610421c9d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=327d7ef9e60446e7c421cab15…
Author: Jason Edmeades <us(a)edmeades.me.uk> Date: Fri Feb 23 22:19:25 2007 +0000 cmd.exe: Add support for call :label and goto :label. --- programs/cmd/batch.c | 86 +++++++++++++++++++++++++++++++++++++--------- programs/cmd/builtins.c | 6 +++- programs/cmd/wcmd.h | 3 +- programs/cmd/wcmdmain.c | 12 +++--- 4 files changed, 82 insertions(+), 25 deletions(-) diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c index 1a9d9e1..045046c 100644 --- a/programs/cmd/batch.c +++ b/programs/cmd/batch.c @@ -42,9 +42,12 @@ extern DWORD errorlevel; * * We need to handle recursion correctly, since one batch program might call another. * So parameters for this batch file are held in a BATCH_CONTEXT structure. + * + * To support call within the same batch program, another input parameter is + * a label to goto once opened. */ -void WCMD_batch (char *file, char *command, int called) { +void WCMD_batch (char *file, char *command, int called, char *startLabel, HANDLE pgmHandle) { #define WCMD_BATCH_EXT_SIZE 5 @@ -55,27 +58,33 @@ char extension_exe[WCMD_BATCH_EXT_SIZE] = ".exe"; unsigned int i; BATCH_CONTEXT *prev_context; - for(i=0; (i<(sizeof(extension_batch)/WCMD_BATCH_EXT_SIZE)) && - (h == INVALID_HANDLE_VALUE); i++) { - strcpy (string, file); - CharLower (string); - if (strstr (string, extension_batch[i]) == NULL) strcat (string, extension_batch[i]); - h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - } - if (h == INVALID_HANDLE_VALUE) { + if (startLabel == NULL) { + for(i=0; (i<(sizeof(extension_batch)/WCMD_BATCH_EXT_SIZE)) && + (h == INVALID_HANDLE_VALUE); i++) { strcpy (string, file); CharLower (string); - if (strstr (string, extension_exe) == NULL) strcat (string, extension_exe); + if (strstr (string, extension_batch[i]) == NULL) strcat (string, extension_batch[i]); h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (h != INVALID_HANDLE_VALUE) { - WCMD_run_program (command, 0); - } else { - SetLastError (ERROR_FILE_NOT_FOUND); - WCMD_print_error (); } - return; + if (h == INVALID_HANDLE_VALUE) { + strcpy (string, file); + CharLower (string); + if (strstr (string, extension_exe) == NULL) strcat (string, extension_exe); + h = CreateFile (string, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h != INVALID_HANDLE_VALUE) { + WCMD_run_program (command, 0); + } else { + SetLastError (ERROR_FILE_NOT_FOUND); + WCMD_print_error (); + } + return; + } + } else { + DuplicateHandle(GetCurrentProcess(), pgmHandle, + GetCurrentProcess(), &h, + 0, FALSE, DUPLICATE_SAME_ACCESS); } /* @@ -90,6 +99,12 @@ BATCH_CONTEXT *prev_context; context -> prev_context = prev_context; context -> skip_rest = FALSE; + /* If processing a call :label, 'goto' the label in question */ + if (startLabel) { + strcpy(param1, startLabel); + WCMD_goto(); + } + /* * Work through the file line by line. Specific batch commands are processed here, * the rest are handled by the main command processor. @@ -695,3 +710,40 @@ void WCMD_HandleTildaModifiers(char **start, char *forVariable) { strcat(*start, pos); free(pos); } + +/******************************************************************* + * WCMD_call - processes a batch call statement + * + * If there is a leading ':', calls within this batch program + * otherwise launches another program. + */ +void WCMD_call (char *command) { + + /* Run other program if no leading ':' */ + if (*command != ':') { + WCMD_run_program(command, 1); + } else { + + char gotoLabel[MAX_PATH]; + + strcpy(gotoLabel, param1); + + if (context) { + + LARGE_INTEGER li; + + /* Save the current file position, call the same file, + restore position */ + li.QuadPart = 0; + li.LowPart = SetFilePointer(context -> h, li.LowPart, + &li.HighPart, FILE_CURRENT); + + WCMD_batch (param1, command, 1, gotoLabel, context->h); + + SetFilePointer(context -> h, li.LowPart, + &li.HighPart, FILE_BEGIN); + } else { + printf("Cannot call batch label outside of a batch script\n"); + } + } +} diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 346591a..9a8b513 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -434,6 +434,7 @@ char string[MAX_PATH]; return; } if (context != NULL) { + char *paramStart = param1; /* Handle special :EOF label */ if (lstrcmpi (":eof", param1) == 0) { @@ -441,9 +442,12 @@ char string[MAX_PATH]; return; } + /* Support goto :label as well as goto label */ + if (*paramStart == ':') paramStart++; + SetFilePointer (context -> h, 0, NULL, FILE_BEGIN); while (WCMD_fgets (string, sizeof(string), context -> h)) { - if ((string[0] == ':') && (lstrcmpi (&string[1], param1) == 0)) return; + if ((string[0] == ':') && (lstrcmpi (&string[1], paramStart) == 0)) return; } WCMD_output ("Target to GOTO not found\n"); } diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 07d1649..4391d7c 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -27,7 +27,8 @@ #include <stdio.h> #include <ctype.h> -void WCMD_batch (char *, char *, int); +void WCMD_batch (char *, char *, int, char *, HANDLE); +void WCMD_call (char *command); void WCMD_change_tty (void); void WCMD_clear_screen (void); void WCMD_copy (void); diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 84d1c04..17b75f3 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -265,7 +265,7 @@ int main (int argc, char *argv[]) if (h != INVALID_HANDLE_VALUE) { CloseHandle (h); #if 0 - WCMD_batch_command (string); + WCMD_batch ((char *)"\\autoexec.bat", (char *)"\\autoexec.bat", 0, NULL, INVALID_HANDLE_VALUE); #endif } @@ -422,7 +422,7 @@ void WCMD_process_command (char *command) WCMD_setshow_attrib (); break; case WCMD_CALL: - WCMD_run_program (p, 1); + WCMD_call (p); break; case WCMD_CD: case WCMD_CHDIR: @@ -628,14 +628,14 @@ char filetorun[MAX_PATH]; if (!ext || !strcasecmp( ext, ".bat")) { if (SearchPath (NULL, param1, ".bat", sizeof(filetorun), filetorun, NULL)) { - WCMD_batch (filetorun, command, called); + WCMD_batch (filetorun, command, called, NULL, INVALID_HANDLE_VALUE); return; } } if (!ext || !strcasecmp( ext, ".cmd")) { if (SearchPath (NULL, param1, ".cmd", sizeof(filetorun), filetorun, NULL)) { - WCMD_batch (filetorun, command, called); + WCMD_batch (filetorun, command, called, NULL, INVALID_HANDLE_VALUE); return; } } @@ -644,7 +644,7 @@ char filetorun[MAX_PATH]; char *ext = strrchr( param1, '.' ); if (ext && (!strcasecmp( ext, ".bat" ) || !strcasecmp( ext, ".cmd" ))) { - WCMD_batch (param1, command, called); + WCMD_batch (param1, command, called, NULL, INVALID_HANDLE_VALUE); return; } @@ -657,7 +657,7 @@ char filetorun[MAX_PATH]; NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (h != INVALID_HANDLE_VALUE) { CloseHandle (h); - WCMD_batch (param1, command, called); + WCMD_batch (param1, command, called, NULL, INVALID_HANDLE_VALUE); return; } }
1
0
0
0
Jason Edmeades : cmd.exe: Add pushd and popd.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 365f86fd7ec3013149d6167b4710656cea2c0f2e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=365f86fd7ec3013149d6167b4…
Author: Jason Edmeades <us(a)edmeades.me.uk> Date: Fri Feb 23 22:17:28 2007 +0000 cmd.exe: Add pushd and popd. --- programs/cmd/En.rc | 8 +++++++ programs/cmd/builtins.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++ programs/cmd/wcmd.h | 6 ++++- programs/cmd/wcmdmain.c | 8 ++++++- 4 files changed, 74 insertions(+), 2 deletions(-) diff --git a/programs/cmd/En.rc b/programs/cmd/En.rc index fda556e..1a8877d 100644 --- a/programs/cmd/En.rc +++ b/programs/cmd/En.rc @@ -196,6 +196,12 @@ The verify flag has no function in Wine.\n" WCMD_VOL, "Help about VOL\n" + WCMD_PUSHD, "PUSHD <directoryname> saves the current directory onto a\n\ +stack, and then changes the current directory to the supplied one.\n" + + WCMD_POPD, "POPD changes current directory to the last one saved with\n\ +PUSHD.\n" + WCMD_EXIT, "EXIT terminates the current command session and returns\n\ to the operating system or shell from which you invoked cmd.\n" @@ -215,7 +221,9 @@ HELP\t\tShow brief help details on a topic\n\ MD (MKDIR)\tCreate a subdirectory\n\ MOVE\t\tMove a file, set of files or directory tree\n\ PATH\t\tSet or show the search path\n\ +POPD\t\tRestores the directory to the last one saved with PUSHD\n\ PROMPT\t\tChange the command prompt\n\ +PUSHD\t\tChanges to a new directory, saving the current one\n\ REN (RENAME)\tRename a file\n\ RD (RMDIR)\tDelete a subdirectory\n\ SET\t\tSet or show environment variables\n\ diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index a81c90c..346591a 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -45,6 +45,7 @@ struct env_stack }; struct env_stack *saved_environment; +struct env_stack *pushd_directories; extern HINSTANCE hinst; extern char *inbuilt[]; @@ -449,6 +450,59 @@ char string[MAX_PATH]; return; } +/***************************************************************************** + * WCMD_pushd + * + * Push a directory onto the stack + */ + +void WCMD_pushd (void) { + struct env_stack *curdir; + BOOL status; + WCHAR *thisdir; + + curdir = LocalAlloc (LMEM_FIXED, sizeof (struct env_stack)); + thisdir = LocalAlloc (LMEM_FIXED, 1024 * sizeof(WCHAR)); + if( !curdir || !thisdir ) { + LocalFree(curdir); + LocalFree(thisdir); + WCMD_output ("out of memory\n"); + return; + } + + GetCurrentDirectoryW (1024, thisdir); + status = SetCurrentDirectoryA (param1); + if (!status) { + WCMD_print_error (); + LocalFree(curdir); + LocalFree(thisdir); + return; + } else { + curdir -> next = pushd_directories; + curdir -> strings = thisdir; + pushd_directories = curdir; + } +} + + +/***************************************************************************** + * WCMD_popd + * + * Pop a directory from the stack + */ + +void WCMD_popd (void) { + struct env_stack *temp = pushd_directories; + + if (!pushd_directories) + return; + + /* pop the old environment from the stack, and make it the current dir */ + pushd_directories = temp->next; + SetCurrentDirectoryW(temp->strings); + LocalFree (temp->strings); + LocalFree (temp); +} /**************************************************************************** * WCMD_if diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h index 263412e..07d1649 100644 --- a/programs/cmd/wcmd.h +++ b/programs/cmd/wcmd.h @@ -49,8 +49,10 @@ void WCMD_output_asis (const char *message); void WCMD_parse (char *s, char *q, char *p1, char *p2); void WCMD_pause (void); void WCMD_pipe (char *command); +void WCMD_popd (void); void WCMD_print_error (void); void WCMD_process_command (char *command); +void WCMD_pushd (void); int WCMD_read_console (char *string, int str_len); void WCMD_remove_dir (void); void WCMD_rename (void); @@ -137,9 +139,11 @@ typedef struct { #define WCMD_ENDLOCAL 36 #define WCMD_SETLOCAL 37 +#define WCMD_PUSHD 38 +#define WCMD_POPD 39 /* Must be last in list */ -#define WCMD_EXIT 38 +#define WCMD_EXIT 40 /* Some standard messages */ extern const char nyi[]; diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 0e58197..84d1c04 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -32,7 +32,7 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY", "HELP", "IF", "LABEL", "MD", "MKDIR", "MOVE", "PATH", "PAUSE", "PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT", "TIME", "TITLE", "TYPE", "VERIFY", "VER", "VOL", - "ENDLOCAL", "SETLOCAL", "EXIT" }; + "ENDLOCAL", "SETLOCAL", "PUSHD", "POPD", "EXIT" }; HINSTANCE hinst; DWORD errorlevel; @@ -522,6 +522,12 @@ void WCMD_process_command (char *command) case WCMD_VOL: WCMD_volume (0, p); break; + case WCMD_PUSHD: + WCMD_pushd(); + break; + case WCMD_POPD: + WCMD_popd(); + break; case WCMD_EXIT: WCMD_exit (); break;
1
0
0
0
Alexander Nicolaysen Sørnes : wordpad: Add open file dialogue.
by Alexandre Julliard
26 Feb '07
26 Feb '07
Module: wine Branch: master Commit: 7aa2e616f0c252a0fab5965abed43f38a21ed402 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7aa2e616f0c252a0fab5965ab…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com> Date: Sun Feb 25 14:40:27 2007 +0100 wordpad: Add open file dialogue. --- programs/wordpad/En.rc | 7 ++++ programs/wordpad/No.rc | 7 ++++ programs/wordpad/resource.h | 4 ++ programs/wordpad/wordpad.c | 76 ++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 93 insertions(+), 1 deletions(-) diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index a78ab0e..bab4178 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -66,3 +66,10 @@ BEGIN END END END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rich text format (*.rtf)" + STRING_TEXT_FILES_TXT, "Text files (*.txt)" + STRING_ALL_FILES, "All documents (*.*)" +END diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index 7021490..b13fb67 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -66,3 +66,10 @@ BEGIN END END END + +STRINGTABLE DISCARDABLE +BEGIN + STRING_RICHTEXT_FILES_RTF, "Rikt tekstformat (*.rtf)" + STRING_TEXT_FILES_TXT, "Tekstfiler (*.txt)" + STRING_ALL_FILES, "Alle filer (*.*)" +END diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index 72976f7..5e996d5 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -59,3 +59,7 @@ #define IDC_COMBO 2004 #define IDB_TOOLBAR 100 + +#define STRING_ALL_FILES 1400 +#define STRING_TEXT_FILES_TXT 1401 +#define STRING_RICHTEXT_FILES_RTF 1402 diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 455f73f..0d45cb7 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -21,6 +21,8 @@ #define WIN32_LEAN_AND_MEAN #define _WIN32_IE 0x0400 +#define MAX_STRING_LEN 255 + #include <stdarg.h> #include <ctype.h> #include <stdio.h> @@ -29,10 +31,10 @@ #include <windows.h> #include <richedit.h> #include <commctrl.h> +#include <commdlg.h> #include "resource.h" - /* use LoadString */ static const WCHAR xszAppTitle[] = {'W','i','n','e',' ','W','o','r','d','p','a','d',0}; static const WCHAR xszMainMenu[] = {'M','A','I','N','M','E','N','U',0}; @@ -44,6 +46,32 @@ static const WCHAR wszAppTitle[] = {'W','i','n','e',' ','W','o','r','d','p','a', static HWND hMainWnd; static HWND hEditorWnd; +static char szFilter[MAX_STRING_LEN]; + +/* Load string resources */ +static void DoLoadStrings() +{ + LPSTR p = szFilter; + char files_rtf[] = "*.rtf"; + char files_txt[] = "*.txt"; + char files_all[] = "*.*"; + HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hMainWnd, GWLP_HINSTANCE); + + LoadString(hInstance, STRING_RICHTEXT_FILES_RTF, p, MAX_STRING_LEN); + p += strlen(p) + 1; + lstrcpy(p, files_rtf); + p += strlen(p) + 1; + LoadString(hInstance, STRING_TEXT_FILES_TXT, p, MAX_STRING_LEN); + p += strlen(p) + 1; + lstrcpy(p, files_txt); + p += strlen(p) + 1; + LoadString(hInstance, STRING_ALL_FILES, p, MAX_STRING_LEN); + p += strlen(p) + 1; + lstrcpy(p, files_all); + p += strlen(p) + 1; + *p = '\0'; +} + static void AddButton(HWND hwndToolBar, int nImage, int nCommand) { TBBUTTON button; @@ -94,6 +122,10 @@ static void DoOpenFile(LPCWSTR szFileName) DWORD dwNumRead; EDITSTREAM es; + char szCaption[MAX_PATH]; + char szAppTitle[sizeof(wszAppTitle)]; + char szSeparator[] = " - "; + hFile = CreateFileW(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -133,6 +165,42 @@ static void DoOpenFile(LPCWSTR szFileName) HeapFree(GetProcessHeap(), 0, pTemp); SetFocus(hEditorWnd); + + WideCharToMultiByte(CP_ACP, 0, wszAppTitle, -1, szAppTitle, sizeof(wszAppTitle), NULL, NULL); + + WideCharToMultiByte(CP_ACP, 0, szFileName, -1, szCaption, MAX_PATH, NULL, NULL); + + lstrcat(szCaption, szSeparator); + lstrcat(szCaption, szAppTitle); + + SetWindowText(hMainWnd, szCaption); +} + +static void DialogOpenFile() +{ + OPENFILENAME ofn; + + char szFile[MAX_PATH] = ""; + char szDefExt[] = "rtf"; + + ZeroMemory(&ofn, sizeof(ofn)); + + ofn.lStructSize = sizeof(ofn); + ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; + ofn.hwndOwner = hMainWnd; + ofn.lpstrFilter = szFilter; + ofn.lpstrFile = szFile; + ofn.nMaxFile = MAX_PATH; + ofn.lpstrDefExt = szDefExt; + + if(GetOpenFileName(&ofn)) + { + WCHAR szOpenFile[MAX_PATH]; + + MultiByteToWideChar(CP_ACP, 0, ofn.lpstrFile, MAX_PATH, szOpenFile, sizeof(szOpenFile)/sizeof(szOpenFile[0])); + + DoOpenFile(szOpenFile); + } } static void HandleCommandLine(LPWSTR cmdline) @@ -263,6 +331,9 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) SetFocus(hEditorWnd); SendMessage(hEditorWnd, EM_SETEVENTMASK, 0, ENM_SELCHANGE); + + DoLoadStrings(); + return 0; } @@ -337,6 +408,9 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) break; case ID_FILE_OPEN: + DialogOpenFile(); + break; + case ID_FILE_SAVE: case ID_PRINT: case ID_PREVIEW:
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
84
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Results per page:
10
25
50
100
200