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 2006
----- 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
696 discussions
Start a n
N
ew thread
Lei Zhang : riched20: Fix for EM_FINDTEXT input validation.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: 0014e50465ee40861ccbdc0dcc054dceafdb2790 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=0014e50465ee40861ccbdc0…
Author: Lei Zhang <leiz(a)ucla.edu> Date: Mon Feb 20 10:35:14 2006 -0800 riched20: Fix for EM_FINDTEXT input validation. Fixed the cpMin/cpMax validation code for EM_FINDTEXT. Removed todo flag from affected EM_FINDTEXT tests. --- dlls/riched20/editor.c | 26 ++++++++++++++++++-------- dlls/riched20/tests/editor.c | 10 +++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 4028468..e7b7fec 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -778,18 +778,28 @@ ME_FindText(ME_TextEditor *editor, DWORD if (flags & ~(FR_DOWN | FR_MATCHCASE)) FIXME("Flags 0x%08lx not implemented\n", flags & ~(FR_DOWN | FR_MATCHCASE)); + nMin = chrg->cpMin; if (chrg->cpMax == -1) - { - nMin = chrg->cpMin; nMax = ME_GetTextLength(editor); - } else - { - nMin = min(chrg->cpMin, chrg->cpMax); - nMax = max(chrg->cpMin, chrg->cpMax); - } + nMax = chrg->cpMax; - if (!nLen || nMin < 0 || nMax < 0) + /* when searching up, if cpMin < cpMax, then instead of searching + * on [cpMin,cpMax], we search on [0,cpMin], otherwise, search on + * [cpMax, cpMin] + */ + if (!(flags & FR_DOWN)) + { + int nSwap = nMax; + + nMax = nMin; + if (nMin < nSwap) + nMin = 0; + else + nMin = nSwap; + } + + if (!nLen || nMin < 0 || nMax < 0 || nMax < nMin) { if (chrgText) chrgText->cpMin = chrgText->cpMax = -1; diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index aa4d1d4..874aee9 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -71,8 +71,8 @@ struct find_s find_tests2[] = { {24, 31, "Wine", FR_DOWN | FR_MATCHCASE, 27, 0}, /* Find backwards */ - {19, 20, "Wine", FR_MATCHCASE, 13, 1}, - {10, 20, "Wine", FR_MATCHCASE, 4, 1}, + {19, 20, "Wine", FR_MATCHCASE, 13, 0}, + {10, 20, "Wine", FR_MATCHCASE, 4, 0}, {20, 10, "Wine", FR_MATCHCASE, 13, 0}, /* Case-insensitive */ @@ -80,7 +80,7 @@ struct find_s find_tests2[] = { {1, 31, "Wine", FR_DOWN, 4, 0}, /* High-to-low ranges */ - {20, 5, "Wine", FR_DOWN, -1, 1}, + {20, 5, "Wine", FR_DOWN, -1, 0}, {2, 1, "Wine", FR_DOWN, -1, 0}, {30, 29, "Wine", FR_DOWN, -1, 0}, {20, 5, "Wine", 0, 13, 0}, @@ -110,8 +110,8 @@ struct find_s find_tests2[] = { /* The backwards case of bug 4479; bounds look right * Fails because backward find is wrong */ - {19, 20, "WINE", FR_MATCHCASE, 0, 1}, - {0, 20, "WINE", FR_MATCHCASE, -1, 1} + {19, 20, "WINE", FR_MATCHCASE, 0, 0}, + {0, 20, "WINE", FR_MATCHCASE, -1, 0} }; static void check_EM_FINDTEXT(HWND hwnd, char *name, struct find_s *f, int id) {
1
0
0
0
James Hawkins : advpack: Implement AddDelBackupEntry.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: 2aa6e2ebd96a34575292a3b02ff8c0cc4d9f059c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=2aa6e2ebd96a34575292a3b…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:49:27 2006 -0600 advpack: Implement AddDelBackupEntry. --- dlls/advpack/files.c | 39 +++++++++++++++++++++++++++++++++++---- dlls/advpack/tests/files.c | 30 +++++++++--------------------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c index fc37839..cd13c6a 100644 --- a/dlls/advpack/files.c +++ b/dlls/advpack/files.c @@ -55,16 +55,47 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); * * If lpcszBackupDir is NULL, the INI file is assumed to exist in * c:\windows or created there if it does not exist. - * - * BUGS - * Unimplemented. */ HRESULT WINAPI AddDelBackupEntry(LPCSTR lpcszFileList, LPCSTR lpcszBackupDir, LPCSTR lpcszBaseName, DWORD dwFlags) { - FIXME("(%p, %p, %p, %ld) stub\n", lpcszFileList, lpcszBackupDir, + CHAR szIniPath[MAX_PATH]; + LPSTR szString = NULL; + + const char szBackupEntry[] = "-1,0,0,0,0,0,-1"; + + TRACE("(%p, %p, %p, %ld)\n", lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags); + if (!lpcszFileList || !*lpcszFileList) + return S_OK; + + if (lpcszBackupDir) + lstrcpyA(szIniPath, lpcszBackupDir); + else + GetWindowsDirectoryA(szIniPath, MAX_PATH); + + lstrcatA(szIniPath, "\\"); + lstrcatA(szIniPath, lpcszBaseName); + lstrcatA(szIniPath, ".ini"); + + SetFileAttributesA(szIniPath, FILE_ATTRIBUTE_NORMAL); + + if (dwFlags & AADBE_ADD_ENTRY) + szString = (LPSTR)szBackupEntry; + else if (dwFlags & AADBE_DEL_ENTRY) + szString = NULL; + + /* add or delete the INI entries */ + while (*lpcszFileList) + { + WritePrivateProfileStringA("backup", lpcszFileList, szString, szIniPath); + lpcszFileList += lstrlenA(lpcszFileList) + 1; + } + + /* hide the INI file */ + SetFileAttributesA(szIniPath, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN); + return S_OK; } diff --git a/dlls/advpack/tests/files.c b/dlls/advpack/tests/files.c index d113877..8a62b4c 100644 --- a/dlls/advpack/tests/files.c +++ b/dlls/advpack/tests/files.c @@ -163,12 +163,9 @@ static void test_AddDelBackupEntry() /* create the INF file */ res = pAddDelBackupEntry("one\0two\0three", "c:\\", "basename", AADBE_ADD_ENTRY); ok(res == S_OK, "Expected S_OK, got %ld\n", res); - todo_wine - { - ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); - ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); - ok(DeleteFileA(path), "Expected path to exist\n"); - } + ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); lstrcpyA(path, CURR_DIR); lstrcatA(path, "\\backup\\basename.INI"); @@ -185,12 +182,9 @@ static void test_AddDelBackupEntry() CreateDirectoryA("backup", NULL); res = pAddDelBackupEntry("one\0two\0three", "backup", "basename", AADBE_ADD_ENTRY); ok(res == S_OK, "Expected S_OK, got %ld\n", res); - todo_wine - { - ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); - ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); - ok(DeleteFileA(path), "Expected path to exist\n"); - } + ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); RemoveDirectoryA("backup"); lstrcpyA(path, "c:\\windows\\basename.INI"); @@ -198,21 +192,15 @@ static void test_AddDelBackupEntry() /* try a NULL backup dir, INI is created in c:\windows */ res = pAddDelBackupEntry("one\0two\0three", NULL, "basename", AADBE_ADD_ENTRY); ok(res == S_OK, "Expected S_OK, got %ld\n", res); - todo_wine - { - ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); - } + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); /* remove the entries with AADBE_DEL_ENTRY */ SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL); res = pAddDelBackupEntry("one\0three", NULL, "basename", AADBE_DEL_ENTRY); SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL); ok(res == S_OK, "Expected S_OK, got %ld\n", res); - todo_wine - { - ok(check_ini_contents(path, FALSE), "Expected ini contents to match\n"); - ok(DeleteFileA(path), "Expected path to exist\n"); - } + ok(check_ini_contents(path, FALSE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); } /* the FCI callbacks */
1
0
0
0
James Hawkins : advpack: Add tests for AddDelBackupEntry.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: bc7cb836f2c6965362a0789098a9b126e200c002 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=bc7cb836f2c6965362a0789…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:48:17 2006 -0600 advpack: Add tests for AddDelBackupEntry. --- dlls/advpack/tests/files.c | 127 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 127 insertions(+), 0 deletions(-) diff --git a/dlls/advpack/tests/files.c b/dlls/advpack/tests/files.c index 5711718..d113877 100644 --- a/dlls/advpack/tests/files.c +++ b/dlls/advpack/tests/files.c @@ -30,6 +30,7 @@ /* function pointers */ HMODULE hAdvPack; +static HRESULT (WINAPI *pAddDelBackupEntry)(LPCSTR, LPCSTR, LPCSTR, DWORD); static HRESULT (WINAPI *pExtractFiles)(LPCSTR, LPCSTR, DWORD, LPCSTR, LPVOID, DWORD); static HRESULT (WINAPI *pAdvInstallFile)(HWND,LPCSTR,LPCSTR,LPCSTR,LPCSTR,DWORD,DWORD); @@ -41,6 +42,7 @@ static void init_function_pointers(void) if (hAdvPack) { + pAddDelBackupEntry = (void *)GetProcAddress(hAdvPack, "AddDelBackupEntry"); pExtractFiles = (void *)GetProcAddress(hAdvPack, "ExtractFiles"); pAdvInstallFile = (void*)GetProcAddress(hAdvPack, "AdvInstallFile"); } @@ -89,6 +91,130 @@ static void delete_test_files(void) DeleteFileA("extract.cab"); } +static BOOL check_ini_file_attr(LPSTR filename) +{ + BOOL ret; + DWORD expected = FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY; + DWORD attr = GetFileAttributesA(filename); + + ret = (attr & expected) && (attr != INVALID_FILE_ATTRIBUTES); + SetFileAttributesA(filename, FILE_ATTRIBUTE_NORMAL); + + return ret; +} + +#define FIELD_LEN 16 + +static BOOL check_ini_contents(LPSTR filename, BOOL add) +{ + CHAR field[FIELD_LEN]; + BOOL ret = TRUE, match; + + GetPrivateProfileStringA("backup", "one", NULL, field, FIELD_LEN, filename); + match = !lstrcmpA(field, "-1,0,0,0,0,0,-1"); + if ((add && !match) || (!add && match)) + ret = FALSE; + + GetPrivateProfileStringA("backup", "two", NULL, field, FIELD_LEN, filename); + if (lstrcmpA(field, "-1,0,0,0,0,0,-1")) + ret = FALSE; + + GetPrivateProfileStringA("backup", "three", NULL, field, FIELD_LEN, filename); + match = !lstrcmpA(field, "-1,0,0,0,0,0,-1"); + if ((add && !match) || (!add && match)) + ret = FALSE; + + return ret; +} + +static void test_AddDelBackupEntry() +{ + HRESULT res; + CHAR path[MAX_PATH]; + + lstrcpyA(path, CURR_DIR); + lstrcatA(path, "\\backup\\basename.INI"); + + /* native AddDelBackupEntry crashes if lpcszBaseName is NULL */ + + /* try a NULL file list */ + res = pAddDelBackupEntry(NULL, "backup", "basename", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + ok(!DeleteFileA(path), "Expected path to not exist\n"); + + lstrcpyA(path, CURR_DIR); + lstrcatA(path, "\\backup\\.INI"); + + /* try an empty base name */ + res = pAddDelBackupEntry("one\0two\0three", "backup", "", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + ok(!DeleteFileA(path), "Expected path to not exist\n"); + + lstrcpyA(path, CURR_DIR); + lstrcatA(path, "\\basename.INI"); + + /* try an invalid flag */ + res = pAddDelBackupEntry("one\0two\0three", NULL, "basename", 0); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + ok(!DeleteFileA(path), "Expected path to not exist\n"); + + lstrcpyA(path, "c:\\basename.INI"); + + /* create the INF file */ + res = pAddDelBackupEntry("one\0two\0three", "c:\\", "basename", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + todo_wine + { + ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); + } + + lstrcpyA(path, CURR_DIR); + lstrcatA(path, "\\backup\\basename.INI"); + + /* try to create the INI file in a nonexistent directory */ + RemoveDirectoryA("backup"); + res = pAddDelBackupEntry("one\0two\0three", "backup", "basename", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + ok(!check_ini_file_attr(path), "Expected ini file to not be hidden\n"); + ok(!check_ini_contents(path, TRUE), "Expected ini contents to not match\n"); + ok(!DeleteFileA(path), "Expected path to not exist\n"); + + /* try an existent, relative backup directory */ + CreateDirectoryA("backup", NULL); + res = pAddDelBackupEntry("one\0two\0three", "backup", "basename", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + todo_wine + { + ok(check_ini_file_attr(path), "Expected ini file to be hidden\n"); + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); + } + RemoveDirectoryA("backup"); + + lstrcpyA(path, "c:\\windows\\basename.INI"); + + /* try a NULL backup dir, INI is created in c:\windows */ + res = pAddDelBackupEntry("one\0two\0three", NULL, "basename", AADBE_ADD_ENTRY); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + todo_wine + { + ok(check_ini_contents(path, TRUE), "Expected ini contents to match\n"); + } + + /* remove the entries with AADBE_DEL_ENTRY */ + SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL); + res = pAddDelBackupEntry("one\0three", NULL, "basename", AADBE_DEL_ENTRY); + SetFileAttributesA(path, FILE_ATTRIBUTE_NORMAL); + ok(res == S_OK, "Expected S_OK, got %ld\n", res); + todo_wine + { + ok(check_ini_contents(path, FALSE), "Expected ini contents to match\n"); + ok(DeleteFileA(path), "Expected path to exist\n"); + } +} + /* the FCI callbacks */ static void *mem_alloc(ULONG cb) @@ -428,6 +554,7 @@ START_TEST(files) create_test_files(); create_cab_file(); + test_AddDelBackupEntry(); test_ExtractFiles(); test_AdvInstallFile();
1
0
0
0
James Hawkins : advpack: Make AddDelBackupEntry always return S_OK.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: 7d8f9de83752a5e59bc32f93b9476322a5186b4c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=7d8f9de83752a5e59bc32f9…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:46:19 2006 -0600 advpack: Make AddDelBackupEntry always return S_OK. --- dlls/advpack/files.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c index 28c6108..fc37839 100644 --- a/dlls/advpack/files.c +++ b/dlls/advpack/files.c @@ -47,8 +47,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); * the entries from the INI file. * * RETURNS - * Success: S_OK. - * Failure: E_FAIL. + * S_OK in all cases. * * NOTES * If the INI file does not exist before adding entries to it, the file @@ -66,7 +65,7 @@ HRESULT WINAPI AddDelBackupEntry(LPCSTR FIXME("(%p, %p, %p, %ld) stub\n", lpcszFileList, lpcszBackupDir, lpcszBaseName, dwFlags); - return E_FAIL; + return S_OK; } /* FIXME: this is only for the local case, X:\ */
1
0
0
0
James Hawkins : advpack: Branch off the advpack install functions into install.c.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: 60de11c084455ce892fcbda0e12f8f6dd8c4349c URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=60de11c084455ce892fcbda…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:44:03 2006 -0600 advpack: Branch off the advpack install functions into install.c. --- dlls/advpack/Makefile.in | 1 dlls/advpack/advpack.c | 163 -------------------------------------- dlls/advpack/install.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 197 insertions(+), 163 deletions(-) create mode 100644 dlls/advpack/install.c Diff:
http://source.winehq.org/git/?p=wine.git;a=commitdiff;h=60de11c084455ce892f…
1
0
0
0
James Hawkins : advpack: Implement the Open/ CloseINFEngine and TranslateINFStringEx
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: b88b48085151bfdee25a4f4ec64fae1af8b8bef3 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=b88b48085151bfdee25a4f4…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:42:25 2006 -0600 advpack: Implement the Open/CloseINFEngine and TranslateINFStringEx trio of functions. --- dlls/advpack/advpack.c | 38 ++++++++++++++++++++++++-------------- 1 files changed, 24 insertions(+), 14 deletions(-) diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c index f6cdaa1..0e8c7e5 100644 --- a/dlls/advpack/advpack.c +++ b/dlls/advpack/advpack.c @@ -118,15 +118,13 @@ static void set_ldids(HINF hInf, PCSTR p * RETURNS * Success: S_OK. * Failure: E_FAIL. - * - * BUGS - * Unimplemented. */ HRESULT WINAPI CloseINFEngine(HINF hInf) { - FIXME("(%p) stub\n", hInf); + TRACE("(%p)\n", hInf); - return E_FAIL; + SetupCloseInfFile(hInf); + return S_OK; } /*********************************************************************** @@ -405,17 +403,23 @@ BOOL WINAPI NeedReboot(DWORD dwRebootChe * RETURNS * Success: S_OK. * Failure: E_FAIL. - * - * BUGS - * Unimplemented. */ HRESULT WINAPI OpenINFEngine(PCSTR pszInfFilename, PCSTR pszInstallSection, DWORD dwFlags, HINF *phInf, PVOID pvReserved) { - FIXME("(%p, %p, %ld, %p, %p) stub\n", pszInfFilename, pszInstallSection, + TRACE("(%p, %p, %ld, %p, %p)\n", pszInfFilename, pszInstallSection, dwFlags, phInf, pvReserved); - return E_FAIL; + if (!phInf) + return E_INVALIDARG; + + *phInf = SetupOpenInfFileA(pszInfFilename, NULL, INF_STYLE_WIN4, NULL); + if (*phInf == INVALID_HANDLE_VALUE) + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + + set_ldids(*phInf, pszInstallSection); + + return S_OK; } /*********************************************************************** @@ -621,19 +625,25 @@ HRESULT WINAPI TranslateInfString(PCSTR * When translating more than one keys, this method is more efficient * than calling TranslateInfString, because the INF file is only * opened once. - * - * BUGS - * Unimplemented. */ HRESULT WINAPI TranslateInfStringEx(HINF hInf, PCSTR pszInfFilename, PCSTR pszTranslateSection, PCSTR pszTranslateKey, PSTR pszBuffer, DWORD dwBufferSize, PDWORD pdwRequiredSize, PVOID pvReserved) { - FIXME("(%p, %p, %p, %p, %p, %ld, %p, %p) stub\n", hInf, pszInfFilename, + TRACE("(%p, %p, %p, %p, %p, %ld, %p, %p)\n", hInf, pszInfFilename, pszTranslateSection, pszTranslateKey, pszBuffer, dwBufferSize, pdwRequiredSize, pvReserved); + if (!SetupGetLineTextA(NULL, hInf, pszTranslateSection, pszTranslateKey, + pszBuffer, dwBufferSize, pdwRequiredSize)) + { + if (dwBufferSize < *pdwRequiredSize) + return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + + return SPAPI_E_LINE_NOT_FOUND; + } + return E_FAIL; }
1
0
0
0
James Hawkins : advpack: Load the LDIDs of an install section in TranslateInfString.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: dd5ae20dc10bb910b9c8427d1fcf5a10f798de3d URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=dd5ae20dc10bb910b9c8427…
Author: James Hawkins <truiken(a)gmail.com> Date: Mon Feb 20 21:40:59 2006 -0600 advpack: Load the LDIDs of an install section in TranslateInfString. --- dlls/advpack/advpack.c | 74 ++++++++++++++++++++++++++++++++++++++++++ dlls/advpack/tests/advpack.c | 8 +++-- 2 files changed, 79 insertions(+), 3 deletions(-) diff --git a/dlls/advpack/advpack.c b/dlls/advpack/advpack.c index ed370fa..f6cdaa1 100644 --- a/dlls/advpack/advpack.c +++ b/dlls/advpack/advpack.c @@ -36,6 +36,77 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); typedef HRESULT (WINAPI *DLLREGISTER) (void); +#define MAX_FIELD_LENGTH 512 +#define PREFIX_LEN 5 + +/* parses the destination directory parameters from pszSection + * the parameters are of the form: root,key,value,unknown,fallback + * we first read the reg value root\\key\\value and if that fails, + * use fallback as the destination directory + */ +static void get_dest_dir(HINF hInf, PCSTR pszSection, PSTR pszBuffer, DWORD dwSize) +{ + INFCONTEXT context; + CHAR key[MAX_PATH], value[MAX_PATH]; + CHAR prefix[PREFIX_LEN]; + HKEY root, subkey; + DWORD size; + + /* load the destination parameters */ + SetupFindFirstLineA(hInf, pszSection, NULL, &context); + SetupGetStringFieldA(&context, 1, prefix, PREFIX_LEN, &size); + SetupGetStringFieldA(&context, 2, key, MAX_PATH, &size); + SetupGetStringFieldA(&context, 3, value, MAX_PATH, &size); + + if (!lstrcmpA(prefix, "HKLM")) + root = HKEY_LOCAL_MACHINE; + else if (!lstrcmpA(prefix, "HKCU")) + root = HKEY_CURRENT_USER; + else + root = NULL; + + /* preserve the buffer size */ + size = dwSize; + + /* fallback to the default destination dir if reg fails */ + if (RegOpenKeyA(root, key, &subkey) || + RegQueryValueExA(subkey, value, NULL, NULL, (LPBYTE)pszBuffer, &size)) + { + SetupGetStringFieldA(&context, 6, pszBuffer, dwSize, &size); + } + + RegCloseKey(subkey); +} + +/* loads the LDIDs specified in the install section of an INF */ +static void set_ldids(HINF hInf, PCSTR pszInstallSection) +{ + CHAR field[MAX_FIELD_LENGTH]; + CHAR key[MAX_FIELD_LENGTH]; + CHAR dest[MAX_PATH]; + INFCONTEXT context; + DWORD size; + int ldid; + + if (!SetupGetLineTextA(NULL, hInf, pszInstallSection, "CustomDestination", + field, MAX_FIELD_LENGTH, &size)) + return; + + if (!SetupFindFirstLineA(hInf, field, NULL, &context)) + return; + + do + { + SetupGetIntField(&context, 0, &ldid); + SetupGetLineTextA(&context, NULL, NULL, NULL, + key, MAX_FIELD_LENGTH, &size); + + get_dest_dir(hInf, key, dest, MAX_PATH); + + SetupSetDirectoryIdA(hInf, ldid, dest); + } while (SetupFindNextLine(&context, &context)); +} + /*********************************************************************** * CloseINFEngine (ADVPACK.@) * @@ -507,6 +578,8 @@ HRESULT WINAPI TranslateInfString(PCSTR if (hInf == INVALID_HANDLE_VALUE) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + set_ldids(hInf, pszInstallSection); + if (!SetupGetLineTextA(NULL, hInf, pszTranslateSection, pszTranslateKey, pszBuffer, dwBufferSize, pdwRequiredSize)) { @@ -516,6 +589,7 @@ HRESULT WINAPI TranslateInfString(PCSTR return SPAPI_E_LINE_NOT_FOUND; } + SetupCloseInfFile(hInf); return S_OK; } diff --git a/dlls/advpack/tests/advpack.c b/dlls/advpack/tests/advpack.c index 2d82964..b678797 100644 --- a/dlls/advpack/tests/advpack.c +++ b/dlls/advpack/tests/advpack.c @@ -222,7 +222,6 @@ static void translateinfstring_test() "Expected ERROR_SUCCESS or E_FAIL, got 0x%08x\n", (UINT)hr); if(hr == ERROR_SUCCESS) - todo_wine { HKEY key; DWORD len = MAX_PATH; @@ -245,8 +244,11 @@ static void translateinfstring_test() hr = pTranslateInfString("c:\\test.inf", NULL, "Options.NTx86", "InstallDir", buffer, MAX_PATH, &dwSize, NULL); ok(hr == S_OK, "Expected S_OK, got 0x%08x\n", (UINT)hr); - ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer); - ok(dwSize == 25, "Expected size 25, got %ld\n", dwSize); + todo_wine + { + ok(!strcmp(buffer, TEST_STRING2), "Expected %s, got %s\n", TEST_STRING2, buffer); + ok(dwSize == 25, "Expected size 25, got %ld\n", dwSize); + } DeleteFile("c:\\a.inf"); DeleteFile("c:\\test.inf");
1
0
0
0
Dr J A Gow : ole32: Fix stream ref counting.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: e3af1227c9debfaf2290be75201ccfc47de61270 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=e3af1227c9debfaf2290be7…
Author: Dr J A Gow <J.A.Gow(a)furrybubble.co.uk> Date: Tue Feb 21 17:03:36 2006 +0900 ole32: Fix stream ref counting. Stream methods called after parent object has been closed correctly return STG_E_REVERTED. Stream refcounting fixed. Now can safely call IStorage destructor before IStream destructor and guarantee file will be closed. --- dlls/ole32/stg_stream.c | 74 ++++++++++++++++++++++++++++++++++++++++-- dlls/ole32/storage32.c | 53 ++++++++++++++++++++++++++++++ dlls/ole32/storage32.h | 20 +++++++++++ dlls/ole32/tests/storage32.c | 4 -- 4 files changed, 144 insertions(+), 7 deletions(-) diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c index 19b8bda..fd75ee2 100644 --- a/dlls/ole32/stg_stream.c +++ b/dlls/ole32/stg_stream.c @@ -58,8 +58,21 @@ static void StgStreamImpl_Destroy(StgStr /* * Release the reference we are holding on the parent storage. + * IStorage_Release((IStorage*)This->parentStorage); + * + * No, don't do this. Some apps call IStorage_Release without + * calling IStream_Release first. If we grab a reference the + * file is not closed, and the app fails when it tries to + * reopen the file (Easy-PC, for example). Just inform the + * storage that we have closed the stream */ - IStorage_Release((IStorage*)This->parentStorage); + + if(This->parentStorage) { + + StorageBaseImpl_RemoveStream(This->parentStorage, This); + + } + This->parentStorage = 0; /* @@ -447,6 +460,14 @@ static HRESULT WINAPI StgStreamImpl_Seek iface, dlibMove.u.LowPart, dwOrigin, plibNewPosition); /* + * fail if the stream has no parent (as does windows) + */ + + if(!(This->parentStorage)) { + return STG_E_REVERTED; + } + + /* * The caller is allowed to pass in NULL as the new position return value. * If it happens, we assign it to a dynamic variable to avoid special cases * in the code below. @@ -506,6 +527,10 @@ static HRESULT WINAPI StgStreamImpl_SetS TRACE("(%p, %ld)\n", iface, libNewSize.u.LowPart); + if(!This->parentStorage) { + return STG_E_REVERTED; + } + /* * As documented. */ @@ -609,6 +634,7 @@ static HRESULT WINAPI StgStreamImpl_Copy ULARGE_INTEGER* pcbRead, /* [out] */ ULARGE_INTEGER* pcbWritten) /* [out] */ { + StgStreamImpl* const This=(StgStreamImpl*)iface; HRESULT hr = S_OK; BYTE tmpBuffer[128]; ULONG bytesRead, bytesWritten, copySize; @@ -621,6 +647,11 @@ static HRESULT WINAPI StgStreamImpl_Copy /* * Sanity check */ + + if(!This->parentStorage) { + return STG_E_REVERTED; + } + if ( pstm == 0 ) return STG_E_INVALIDPOINTER; @@ -691,6 +722,11 @@ static HRESULT WINAPI StgStreamImpl_Comm IStream* iface, DWORD grfCommitFlags) /* [in] */ { + StgStreamImpl* const This=(StgStreamImpl*)iface; + + if(!This->parentStorage) { + return STG_E_REVERTED; + } return S_OK; } @@ -714,6 +750,12 @@ static HRESULT WINAPI StgStreamImpl_Lock ULARGE_INTEGER cb, /* [in] */ DWORD dwLockType) /* [in] */ { + StgStreamImpl* const This=(StgStreamImpl*)iface; + + if(!This->parentStorage) { + return STG_E_REVERTED; + } + FIXME("not implemented!\n"); return E_NOTIMPL; } @@ -724,6 +766,12 @@ static HRESULT WINAPI StgStreamImpl_Unlo ULARGE_INTEGER cb, /* [in] */ DWORD dwLockType) /* [in] */ { + StgStreamImpl* const This=(StgStreamImpl*)iface; + + if(!This->parentStorage) { + return STG_E_REVERTED; + } + FIXME("not implemented!\n"); return E_NOTIMPL; } @@ -747,6 +795,14 @@ static HRESULT WINAPI StgStreamImpl_Stat BOOL readSucessful; /* + * if stream has no parent, return STG_E_REVERTED + */ + + if(!This->parentStorage) { + return STG_E_REVERTED; + } + + /* * Read the information from the property. */ readSucessful = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, @@ -791,6 +847,11 @@ static HRESULT WINAPI StgStreamImpl_Clon /* * Sanity check */ + + if(!This->parentStorage) { + return STG_E_REVERTED; + } + if ( ppstm == 0 ) return STG_E_INVALIDPOINTER; @@ -858,12 +919,19 @@ StgStreamImpl* StgStreamImpl_Construct( newStream->lpVtbl = &StgStreamImpl_Vtbl; newStream->ref = 0; + newStream->parentStorage = parentStorage; + /* * We want to nail-down the reference to the storage in case the * stream out-lives the storage in the client application. + * + * -- IStorage_AddRef((IStorage*)newStream->parentStorage); + * + * No, don't do this. Some apps call IStorage_Release without + * calling IStream_Release first. If we grab a reference the + * file is not closed, and the app fails when it tries to + * reopen the file (Easy-PC, for example) */ - newStream->parentStorage = parentStorage; - IStorage_AddRef((IStorage*)newStream->parentStorage); newStream->grfMode = grfMode; newStream->ownerProperty = ownerProperty; diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 08084e4..ae01174 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -393,6 +393,12 @@ HRESULT WINAPI StorageBaseImpl_OpenStrea */ IStream_AddRef(*ppstm); + /* + * add us to the storage's list of active streams + */ + + StorageBaseImpl_AddStream(This,newStream); + res = S_OK; goto end; } @@ -979,6 +985,11 @@ HRESULT WINAPI StorageBaseImpl_CreateStr * the reference. */ IStream_AddRef(*ppstm); + + /* add us to the storage's list of active streams + */ + StorageBaseImpl_AddStream(This,newStream); + } else { @@ -1797,6 +1808,34 @@ HRESULT WINAPI StorageImpl_Stat( IStorag return result; } +/****************************************************************************** + * Internal stream list handlers + */ + +void StorageBaseImpl_AddStream(StorageBaseImpl * stg, StgStreamImpl * strm) +{ + TRACE("Stream added (stg=%p strm=%p)\n", stg, strm); + list_add_tail(&stg->strmHead,&strm->StrmListEntry); +} + +void StorageBaseImpl_RemoveStream(StorageBaseImpl * stg, StgStreamImpl * strm) +{ + TRACE("Stream removed (stg=%p strm=%p)\n", stg,strm); + list_remove(&(strm->StrmListEntry)); +} + +void StorageBaseImpl_DeleteAll(StorageBaseImpl * stg) +{ + struct list *cur, *cur2; + StgStreamImpl *strm=NULL; + + LIST_FOR_EACH_SAFE(cur, cur2, &stg->strmHead) { + strm = LIST_ENTRY(cur,StgStreamImpl,StrmListEntry); + TRACE("Streams deleted (stg=%p strm=%p next=%p prev=%p)\n", stg,strm,cur->next,cur->prev); + strm->parentStorage = NULL; + list_remove(cur); + } +} /********************************************************************* @@ -2256,6 +2295,12 @@ HRESULT StorageImpl_Construct( memset(This, 0, sizeof(StorageImpl)); /* + * Initialize stream list + */ + + list_init(&This->base.strmHead); + + /* * Initialize the virtual function table. */ This->base.lpVtbl = &Storage32Impl_Vtbl; @@ -2448,6 +2493,8 @@ void StorageImpl_Destroy(StorageBaseImpl StorageImpl *This = (StorageImpl*) iface; TRACE("(%p)\n", This); + StorageBaseImpl_DeleteAll(&This->base); + HeapFree(GetProcessHeap(), 0, This->pwcsName); BlockChainStream_Destroy(This->smallBlockRootChain); @@ -4113,6 +4160,12 @@ StorageInternalImpl* StorageInternalImpl memset(newStorage, 0, sizeof(StorageInternalImpl)); /* + * Initialize the stream list + */ + + list_init(&newStorage->base.strmHead); + + /* * Initialize the virtual function table. */ newStorage->base.lpVtbl = &Storage32InternalImpl_Vtbl; diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h index 0472524..f153021 100644 --- a/dlls/ole32/storage32.h +++ b/dlls/ole32/storage32.h @@ -37,6 +37,7 @@ #include "objbase.h" #include "winreg.h" #include "winternl.h" +#include "wine/list.h" /* * Definitions for the file format offsets. @@ -220,6 +221,12 @@ struct StorageBaseImpl const IPropertySetStorageVtbl *pssVtbl; /* interface for adding a properties stream */ /* + * Stream tracking list + */ + + struct list strmHead; + + /* * Reference count of this object */ LONG ref; @@ -246,6 +253,13 @@ struct StorageBaseImpl DWORD openFlags; }; +/**************************************************************************** + * StorageBaseImpl stream list handlers + */ + +void StorageBaseImpl_AddStream(StorageBaseImpl * stg, StgStreamImpl * strm); +void StorageBaseImpl_RemoveStream(StorageBaseImpl * stg, StgStreamImpl * strm); +void StorageBaseImpl_DeleteAll(StorageBaseImpl * stg); /**************************************************************************** * Storage32Impl definitions. @@ -485,6 +499,12 @@ struct StgStreamImpl * since we want to cast this to an IStream pointer */ /* + * We are an entry in the storage object's stream handler list + */ + + struct list StrmListEntry; + + /* * Reference count */ LONG ref; diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index b4edf13..235ca63 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -593,7 +593,6 @@ static void test_storage_refcount(void) r = IStorage_CreateStream(stg, stmname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==S_OK, "IStorage->CreateStream failed\n"); - todo_wine { r = IStorage_Release( stg ); ok (r == 0, "storage not released\n"); @@ -603,7 +602,6 @@ static void test_storage_refcount(void) r = IStream_Stat( stm, &stat, STATFLAG_DEFAULT ); ok (r == STG_E_REVERTED, "stat should fail\n"); - } r = IStream_Release(stm); ok (r == 0, "stream not released\n"); @@ -617,10 +615,8 @@ static void test_storage_refcount(void) r = IStorage_OpenStream( stg, stmname, 0, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); ok(r == S_OK, "OpenStream should succeed\n"); - todo_wine { r = IStorage_Release(stg); ok(r == 0, "wrong ref count\n"); - } } DeleteFileW(filename);
1
0
0
0
Dr J A Gow : ole32: Fix up permissions when opening streams.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: c74e5a784d9fcda57c428f325e61688c1d7ffee5 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=c74e5a784d9fcda57c428f3…
Author: Dr J A Gow <J.A.Gow(a)furrybubble.co.uk> Date: Tue Feb 21 17:02:04 2006 +0900 ole32: Fix up permissions when opening streams. Fix up permissions when opening streams in storage objects when storage object has been opened in transacted mode. --- dlls/ole32/storage32.c | 33 +++++++++++++++++++++------------ dlls/ole32/tests/storage32.c | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 8512667..08084e4 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -342,13 +342,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStrea } /* - * Check that we're compatible with the parent's storage mode + * Check that we're compatible with the parent's storage mode, but + * only if we are not in transacted mode */ parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags ); - if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) - { - res = STG_E_ACCESSDENIED; - goto end; + if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) { + if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) + { + res = STG_E_ACCESSDENIED; + goto end; + } } /* @@ -472,13 +475,16 @@ HRESULT WINAPI StorageBaseImpl_OpenStora } /* - * Check that we're compatible with the parent's storage mode + * Check that we're compatible with the parent's storage mode, + * but only if we are not transacted */ parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags ); - if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) - { - res = STG_E_ACCESSDENIED; - goto end; + if(!(This->ancestorStorage->base.openFlags & STGM_TRANSACTED)) { + if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) + { + res = STG_E_ACCESSDENIED; + goto end; + } } /* @@ -869,10 +875,13 @@ HRESULT WINAPI StorageBaseImpl_CreateStr /* * Check that we're compatible with the parent's storage mode + * if not in transacted mode */ parent_grfMode = STGM_ACCESS_MODE( This->ancestorStorage->base.openFlags ); - if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) - return STG_E_ACCESSDENIED; + if(!(parent_grfMode & STGM_TRANSACTED)) { + if ( STGM_ACCESS_MODE( grfMode ) > STGM_ACCESS_MODE( parent_grfMode ) ) + return STG_E_ACCESSDENIED; + } /* * Initialize the out parameter diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index 07aaf11..b4edf13 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -608,6 +608,21 @@ static void test_storage_refcount(void) r = IStream_Release(stm); ok (r == 0, "stream not released\n"); + /* test for grfMode open issue */ + + r = StgOpenStorage( filename, NULL, 0x00010020, NULL, 0, &stg); + ok(r==S_OK, "StgOpenStorage failed\n"); + if(stg) + { + r = IStorage_OpenStream( stg, stmname, 0, STGM_SHARE_EXCLUSIVE|STGM_READWRITE, 0, &stm ); + ok(r == S_OK, "OpenStream should succeed\n"); + + todo_wine { + r = IStorage_Release(stg); + ok(r == 0, "wrong ref count\n"); + } + } + DeleteFileW(filename); }
1
0
0
0
Mike McCormack : kernel32: Add a simple test for recursive notification.
by Alexandre Julliard
21 Feb '06
21 Feb '06
Module: wine Branch: refs/heads/master Commit: 54dfdb9b006fcd310a73d1e6bdf388cecd6c13d1 URL:
http://source.winehq.org/git/?p=wine.git;a=commit;h=54dfdb9b006fcd310a73d1e…
Author: Mike McCormack <mike(a)codeweavers.com> Date: Tue Feb 21 16:59:05 2006 +0900 kernel32: Add a simple test for recursive notification. --- dlls/kernel/tests/change.c | 64 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 62 insertions(+), 2 deletions(-) diff --git a/dlls/kernel/tests/change.c b/dlls/kernel/tests/change.c index dfdaa9e..8bce2ce 100644 --- a/dlls/kernel/tests/change.c +++ b/dlls/kernel/tests/change.c @@ -327,9 +327,10 @@ static void test_readdirectorychanges(vo char buffer[0x1000]; DWORD fflags, filter = 0, r, dwCount; OVERLAPPED ov; - WCHAR path[MAX_PATH], subdir[MAX_PATH]; + WCHAR path[MAX_PATH], subdir[MAX_PATH], subsubdir[MAX_PATH]; static const WCHAR szBoo[] = { '\\','b','o','o',0 }; static const WCHAR szHoo[] = { '\\','h','o','o',0 }; + static const WCHAR szGa[] = { '\\','h','o','o','\\','g','a',0 }; PFILE_NOTIFY_INFORMATION pfni; if (!pReadDirectoryChangesW) @@ -344,6 +345,10 @@ static void test_readdirectorychanges(vo lstrcpyW( subdir, path ); lstrcatW( subdir, szHoo ); + lstrcpyW( subsubdir, path ); + lstrcatW( subsubdir, szGa ); + + RemoveDirectoryW( subsubdir ); RemoveDirectoryW( subdir ); RemoveDirectoryW( path ); @@ -395,7 +400,7 @@ static void test_readdirectorychanges(vo ok(GetLastError()==ERROR_INVALID_PARAMETER,"last error wrong\n"); ok(r==FALSE, "should return false\n"); - r = pReadDirectoryChangesW(hdir,buffer,sizeof buffer,FALSE,filter,NULL,&ov,NULL); + r = pReadDirectoryChangesW(hdir,buffer,sizeof buffer,TRUE,filter,NULL,&ov,NULL); ok(r==TRUE, "should return true\n"); r = WaitForSingleObject( ov.hEvent, 10 ); @@ -462,6 +467,61 @@ static void test_readdirectorychanges(vo ok( pfni->FileNameLength == 6, "len wrong\n" ); ok( !memcmp(pfni->FileName,&szHoo[1],6), "name wrong\n" ); + /* what happens if the buffer is too small? */ + r = pReadDirectoryChangesW(hdir,buffer,0x10,FALSE,filter,NULL,&ov,NULL); + ok(r==TRUE, "should return true\n"); + + r = CreateDirectoryW( subdir, NULL ); + ok( r == TRUE, "failed to create directory\n"); + + r = WaitForSingleObject( ov.hEvent, INFINITE ); + ok( r == WAIT_OBJECT_0, "should be ready\n" ); + + ok( ov.Internal == STATUS_NOTIFY_ENUM_DIR, "ov.Internal wrong\n"); + ok( ov.InternalHigh == 0, "ov.InternalHigh wrong\n"); + + /* test the recursive watch */ + r = pReadDirectoryChangesW(hdir,buffer,sizeof buffer,FALSE,filter,NULL,&ov,NULL); + ok(r==TRUE, "should return true\n"); + + r = CreateDirectoryW( subsubdir, NULL ); + ok( r == TRUE, "failed to create directory\n"); + + r = WaitForSingleObject( ov.hEvent, INFINITE ); + ok( r == WAIT_OBJECT_0, "should be ready\n" ); + + ok( ov.Internal == STATUS_SUCCESS, "ov.Internal wrong\n"); + ok( ov.InternalHigh == 0x18, "ov.InternalHigh wrong\n"); + + pfni = (PFILE_NOTIFY_INFORMATION) buffer; + ok( pfni->NextEntryOffset == 0, "offset wrong\n" ); + ok( pfni->Action == FILE_ACTION_ADDED, "action wrong\n" ); + ok( pfni->FileNameLength == 0x0c, "len wrong\n" ); + ok( !memcmp(pfni->FileName,&szGa[1],6), "name wrong\n" ); + + r = RemoveDirectoryW( subsubdir ); + ok( r == TRUE, "failed to remove directory\n"); + + ov.Internal = 1; + ov.InternalHigh = 1; + r = pReadDirectoryChangesW(hdir,buffer,sizeof buffer,FALSE,filter,NULL,&ov,NULL); + ok(r==TRUE, "should return true\n"); + + r = RemoveDirectoryW( subdir ); + ok( r == TRUE, "failed to remove directory\n"); + + r = WaitForSingleObject( ov.hEvent, INFINITE ); + ok( r == WAIT_OBJECT_0, "should be ready\n" ); + + pfni = (PFILE_NOTIFY_INFORMATION) buffer; + ok( pfni->NextEntryOffset == 0, "offset wrong\n" ); + ok( pfni->Action == FILE_ACTION_REMOVED, "action wrong\n" ); + ok( pfni->FileNameLength == 0x0c, "len wrong\n" ); + ok( !memcmp(pfni->FileName,&szGa[1],6), "name wrong\n" ); + + ok( ov.Internal == STATUS_SUCCESS, "ov.Internal wrong\n"); + ok( ov.InternalHigh == 0x18, "ov.InternalHigh wrong\n"); + CloseHandle(hdir); r = RemoveDirectoryW( path );
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
70
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
Results per page:
10
25
50
100
200