ReactOS.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
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
List overview
Download
Ros-diffs
December 2008
----- 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
ros-diffs@reactos.org
31 participants
710 discussions
Start a n
N
ew thread
[tkreuzer] 37984: Implement KeFreezeExecution and KeThawExecution
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Dec 9 18:56:59 2008 New Revision: 37984 URL:
http://svn.reactos.org/svn/reactos?rev=37984&view=rev
Log: Implement KeFreezeExecution and KeThawExecution Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c Modified: branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c URL:
http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/ntosk…
============================================================================== --- branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] (original) +++ branches/ros-amd64-bringup/reactos/ntoskrnl/ke/amd64/cpu.c [iso-8859-1] Tue Dec 9 18:56:59 2008 @@ -42,6 +42,10 @@ BOOLEAN KiI386PentiumLockErrataPresent; BOOLEAN KiSMTProcessorsPresent; +/* Freeze data */ +KIRQL KiOldIrql; +ULONG KiFreezeFlag; + /* CPU Signatures */ static const CHAR CmpIntelID[] = "GenuineIntel"; static const CHAR CmpAmdID[] = "AuthenticAMD"; @@ -547,6 +551,39 @@ BOOLEAN NTAPI +KeFreezeExecution(IN PKTRAP_FRAME TrapFrame, + IN PKEXCEPTION_FRAME ExceptionFrame) +{ + ULONG64 Flags = 0; + + /* Disable interrupts and get previous state */ + Flags = __readeflags(); + //Flags = __getcallerseflags(); + _disable(); + + /* Save freeze flag */ + KiFreezeFlag = 4; + + /* Save the old IRQL */ + KiOldIrql = KeGetCurrentIrql(); + + /* Return whether interrupts were enabled */ + return (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE; +} + +VOID +NTAPI +KeThawExecution(IN BOOLEAN Enable) +{ + /* Cleanup CPU caches */ + KeFlushCurrentTb(); + + /* Re-enable interrupts */ + if (Enable) _enable(); +} + +BOOLEAN +NTAPI KeInvalidateAllCaches(VOID) { /* Only supported on Pentium Pro and higher */
16 years
1
0
0
0
[cwittich] 37955: SeUnsolicitedInputPrivilege is obsolete - the LUID is used by SE_MACHINE_ACCOUNT_PRIVILEGE now
by cwittich@svn.reactos.org
Author: cwittich Date: Tue Dec 9 02:33:26 2008 New Revision: 37955 URL:
http://svn.reactos.org/svn/reactos?rev=37955&view=rev
Log: SeUnsolicitedInputPrivilege is obsolete - the LUID is used by SE_MACHINE_ACCOUNT_PRIVILEGE now Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/mis…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] Tue Dec 9 02:33:26 2008 @@ -1424,7 +1424,6 @@ L"SeAssignPrimaryTokenPrivilege", L"SeLockMemoryPrivilege", L"SeIncreaseQuotaPrivilege", - L"SeUnsolicitedInputPrivilege", L"SeMachineAccountPrivilege", L"SeTcbPrivilege", L"SeSecurityPrivilege", @@ -1464,7 +1463,7 @@ { if (0 == wcsicmp(PrivName, DefaultPrivNames[Priv])) { - Luid->LowPart = Priv + 1; + Luid->LowPart = Priv + 2; Luid->HighPart = 0; return TRUE; }
16 years
2
1
0
0
[jimtabor] 37983: - Make sure SecurityDescriptor is not NULL.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Tue Dec 9 14:28:26 2008 New Revision: 37983 URL:
http://svn.reactos.org/svn/reactos?rev=37983&view=rev
Log: - Make sure SecurityDescriptor is not NULL. Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] Tue Dec 9 14:28:26 2008 @@ -1132,7 +1132,7 @@ PSECURITY_DESCRIPTOR sd = NULL; BOOL ret = FALSE; - if (!StringSecurityDescriptor) + if (!StringSecurityDescriptor || !SecurityDescriptor) SetLastError(ERROR_INVALID_PARAMETER); else if (StringSDRevision != SDDL_REVISION_1) SetLastError(ERROR_INVALID_PARAMETER);
16 years
1
0
0
0
[jimtabor] 37982: - Sync to date wine AdvApi32 cross tests.
by jimtabor@svn.reactos.org
Author: jimtabor Date: Tue Dec 9 13:26:45 2008 New Revision: 37982 URL:
http://svn.reactos.org/svn/reactos?rev=37982&view=rev
Log: - Sync to date wine AdvApi32 cross tests. Modified: trunk/rostests/winetests/advapi32/cred.c trunk/rostests/winetests/advapi32/crypt.c trunk/rostests/winetests/advapi32/registry.c trunk/rostests/winetests/advapi32/security.c trunk/rostests/winetests/advapi32/service.c Modified: trunk/rostests/winetests/advapi32/cred.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/cred.c…
============================================================================== --- trunk/rostests/winetests/advapi32/cred.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/cred.c [iso-8859-1] Tue Dec 9 13:26:45 2008 @@ -97,12 +97,19 @@ SetLastError(0xdeadbeef); ret = pCredWriteA(&new_cred, 0); - ok(!ret, "CredWrite with username without domain should have failed\n"); - ok(GetLastError() == ERROR_BAD_USERNAME || - GetLastError() == ERROR_NO_SUCH_LOGON_SESSION || /* Vista */ - broken(GetLastError() == ERROR_IO_PENDING), - "CredWrite with username without domain should return ERROR_BAD_USERNAME" - "or ERROR_NO_SUCH_LOGON_SESSION not %d\n", GetLastError()); + if (ret) + { + /* Vista */ + ok(GetLastError() == ERROR_IO_PENDING, + "Expected ERROR_IO_PENDING, got %d\n", GetLastError()); + } + else + { + ok(GetLastError() == ERROR_BAD_USERNAME || + GetLastError() == ERROR_NO_SUCH_LOGON_SESSION, /* Vista */ + "CredWrite with username without domain should return ERROR_BAD_USERNAME" + "or ERROR_NO_SUCH_LOGON_SESSION not %d\n", GetLastError()); + } new_cred.UserName = NULL; SetLastError(0xdeadbeef); Modified: trunk/rostests/winetests/advapi32/crypt.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/crypt.…
============================================================================== --- trunk/rostests/winetests/advapi32/crypt.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/crypt.c [iso-8859-1] Tue Dec 9 13:26:45 2008 @@ -274,11 +274,11 @@ ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); dwLen = 1; - result = pCryptDecrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen); + result = pCryptDecrypt(hKey, 0, TRUE, 0, &temp, &dwLen); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); dwLen = 1; - result = pCryptEncrypt(hKey, (HCRYPTHASH)NULL, TRUE, 0, &temp, &dwLen, 1); + result = pCryptEncrypt(hKey, 0, TRUE, 0, &temp, &dwLen, 1); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); result = pCryptDeriveKey(hProv, CALG_RC4, hHash, 0, &hKey2); @@ -293,7 +293,7 @@ #endif dwLen = 1; - result = pCryptExportKey(hKey, (HCRYPTPROV)NULL, 0, 0, &temp, &dwLen); + result = pCryptExportKey(hKey, 0, 0, 0, &temp, &dwLen); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); result = pCryptGenKey(hProv, CALG_RC4, 0, &hKey2); @@ -320,7 +320,7 @@ result = pCryptHashSessionKey(hHash, hKey, 0); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); - result = pCryptImportKey(hProv, &temp, 1, (HCRYPTKEY)NULL, 0, &hKey2); + result = pCryptImportKey(hProv, &temp, 1, 0, 0, &hKey2); ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError()); if (pCryptSignHashW) @@ -560,59 +560,77 @@ LocalFree(provider); } -static BOOL FindProvTypesRegVals(DWORD dwIndex, DWORD *pdwProvType, LPSTR *pszTypeName, +static BOOL FindProvTypesRegVals(DWORD *pdwIndex, DWORD *pdwProvType, LPSTR *pszTypeName, DWORD *pcbTypeName, DWORD *pdwTypeCount) { HKEY hKey; HKEY hSubKey; PSTR ch; - + LPSTR szName; + DWORD cbName; + BOOL ret = FALSE; + if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Cryptography\\Defaults\\Provider Types", &hKey)) return FALSE; - - if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, pcbTypeName, NULL, + + if (RegQueryInfoKey(hKey, NULL, NULL, NULL, pdwTypeCount, &cbName, NULL, NULL, NULL, NULL, NULL, NULL)) - return FALSE; - (*pcbTypeName)++; - - if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) - return FALSE; - - if (RegEnumKeyEx(hKey, dwIndex, *pszTypeName, pcbTypeName, NULL, NULL, NULL, NULL)) - return FALSE; - (*pcbTypeName)++; - ch = *pszTypeName + strlen(*pszTypeName); - /* Convert "Type 000" to 0, etc/ */ - *pdwProvType = *(--ch) - '0'; - *pdwProvType += (*(--ch) - '0') * 10; - *pdwProvType += (*(--ch) - '0') * 100; - - if (RegOpenKey(hKey, *pszTypeName, &hSubKey)) - return FALSE; - - if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName)) - return FALSE; - - if (!(*pszTypeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, *pcbTypeName)))) - return FALSE; - - if (RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, (LPBYTE)*pszTypeName, pcbTypeName)) - return FALSE; - + goto cleanup; + cbName++; + + if (!(szName = LocalAlloc(LMEM_ZEROINIT, cbName))) + goto cleanup; + + while (!RegEnumKeyEx(hKey, *pdwIndex, szName, &cbName, NULL, NULL, NULL, NULL)) + { + cbName++; + ch = szName + strlen(szName); + /* Convert "Type 000" to 0, etc/ */ + *pdwProvType = *(--ch) - '0'; + *pdwProvType += (*(--ch) - '0') * 10; + *pdwProvType += (*(--ch) - '0') * 100; + + if (RegOpenKey(hKey, szName, &hSubKey)) + break; + + if (!RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, NULL, pcbTypeName)) + { + if (!(*pszTypeName = LocalAlloc(LMEM_ZEROINIT, *pcbTypeName))) + break; + + if (!RegQueryValueEx(hSubKey, "TypeName", NULL, NULL, (LPBYTE)*pszTypeName, pcbTypeName)) + { + ret = TRUE; + break; + } + + LocalFree(*pszTypeName); + } + + RegCloseKey(hSubKey); + + (*pdwIndex)++; + } + + if (!ret) + LocalFree(*pszTypeName); RegCloseKey(hSubKey); + LocalFree(szName); + +cleanup: RegCloseKey(hKey); - - return TRUE; + + return ret; } static void test_enum_provider_types(void) { /* expected values */ - DWORD dwProvType; + DWORD dwProvType = 0; LPSTR pszTypeName = NULL; DWORD cbTypeName; DWORD dwTypeCount; - + /* actual values */ DWORD index = 0; DWORD provType; @@ -622,45 +640,47 @@ DWORD result; DWORD notNull = 5; DWORD notZeroFlags = 5; - + if(!pCryptEnumProviderTypesA) { - skip("CryptEnumProviderTypesA is not available\n"); - return; - } - - if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount)) - { - skip("Could not find provider types in registry\n"); - return; - } - + skip("CryptEnumProviderTypesA is not available\n"); + return; + } + + if (!FindProvTypesRegVals(&index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount)) + { + skip("Could not find provider types in registry\n"); + return; + } + /* check pdwReserved for NULL */ result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %d\n", - ERROR_INVALID_PARAMETER, GetLastError()); - + ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER, got %d\n", + GetLastError()); + /* check dwFlags == zero */ result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %d\n", - ERROR_INVALID_PARAMETER, GetLastError()); - - /* alloc provider type to half the size required - * cbTypeName holds the size required */ - typeNameSize = cbTypeName / 2; - if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) - return; + ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected ERROR_INVALID_PARAMETER, got %d\n", + GetLastError()); /* This test fails under Win2k SP4: - result = TRUE, GetLastError() == 0xdeadbeef - SetLastError(0xdeadbeef); - result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); - ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n", - result, GetLastError()); - */ - - LocalFree(typeName); - + * result = TRUE, GetLastError() == 0xdeadbeef */ + if (0) + { + /* alloc provider type to half the size required + * cbTypeName holds the size required */ + typeNameSize = cbTypeName / 2; + if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) + goto cleanup; + + SetLastError(0xdeadbeef); + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); + ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%d\n", + result, GetLastError()); + + LocalFree(typeName); + } + /* loop through the provider types to get the number of provider types * after loop ends, count should be dwTypeCount + 1 so subtract 1 * to get actual number of provider types */ @@ -669,30 +689,31 @@ ; typeCount--; ok(typeCount==dwTypeCount, "expected %d, got %d\n", dwTypeCount, typeCount); - + /* loop past the actual number of provider types to get the error * ERROR_NO_MORE_ITEMS */ for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++) result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize); - ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %d\n", - ERROR_NO_MORE_ITEMS, GetLastError()); - + ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected ERROR_NO_MORE_ITEMS, got %d\n", + GetLastError()); /* check expected versus actual values returned */ result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize); ok(result && typeNameSize==cbTypeName, "expected %d, got %d\n", cbTypeName, typeNameSize); if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) - return; - + goto cleanup; + typeNameSize = 0xdeadbeef; result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); ok(result, "expected TRUE, got %d\n", result); ok(provType==dwProvType, "expected %d, got %d\n", dwProvType, provType); if (pszTypeName) - ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName); + ok(!strcmp(pszTypeName, typeName), "expected %s, got %s\n", pszTypeName, typeName); ok(typeNameSize==cbTypeName, "expected %d, got %d\n", cbTypeName, typeNameSize); - + LocalFree(typeName); +cleanup: + LocalFree(pszTypeName); } static BOOL FindDfltProvRegVals(DWORD dwProvType, DWORD dwFlags, LPSTR *pszProvName, DWORD *pcbProvName) Modified: trunk/rostests/winetests/advapi32/registry.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/regist…
============================================================================== --- trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] Tue Dec 9 13:26:45 2008 @@ -199,13 +199,14 @@ assert (!RegCreateKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Test", &hkey_main )); } -static void test_hkey_main_Value_A(LPCSTR name, LPCSTR string, +#define lok ok_(__FILE__, line) +#define test_hkey_main_Value_A(name, string, full_byte_len) _test_hkey_main_Value_A(__LINE__, name, string, full_byte_len) +static void _test_hkey_main_Value_A(int line, LPCSTR name, LPCSTR string, DWORD full_byte_len) { DWORD ret, type, cbData; DWORD str_byte_len; - LPSTR value; - static const char nA[]={'N', 0}; + BYTE* value; type=0xdeadbeef; cbData=0xdeadbeef; @@ -215,43 +216,44 @@ SetLastError(0xdeadbeef); ret = RegQueryValueExA(hkey_main, name, NULL, &type, NULL, &cbData); GLE = GetLastError(); - ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d, GLE=%d\n", ret, GLE); + lok(ret == ERROR_SUCCESS, "RegQueryValueExA/1 failed: %d, GLE=%d\n", ret, GLE); /* It is wrong for the Ansi version to not be implemented */ ok(GLE == 0xdeadbeef, "RegQueryValueExA set GLE = %u\n", GLE); if(GLE == ERROR_CALL_NOT_IMPLEMENTED) return; str_byte_len = (string ? lstrlenA(string) : 0) + 1; - ok(type == REG_SZ, "RegQueryValueExA returned type %d\n", type); - ok(cbData == full_byte_len || cbData == str_byte_len /* Win9x */, + lok(type == REG_SZ, "RegQueryValueExA/1 returned type %d\n", type); + lok(cbData == full_byte_len || cbData == str_byte_len /* Win9x */, "cbData=%d instead of %d or %d\n", cbData, full_byte_len, str_byte_len); - value = HeapAlloc(GetProcessHeap(), 0, (cbData+2)*sizeof(*value)); - strcpy(value, nA); + value = HeapAlloc(GetProcessHeap(), 0, cbData+1); + memset(value, 0xbd, cbData+1); type=0xdeadbeef; - ret = RegQueryValueExA(hkey_main, name, NULL, &type, (BYTE*)value, &cbData); + ret = RegQueryValueExA(hkey_main, name, NULL, &type, value, &cbData); GLE = GetLastError(); - ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d, GLE=%d\n", ret, GLE); + lok(ret == ERROR_SUCCESS, "RegQueryValueExA/2 failed: %d, GLE=%d\n", ret, GLE); if (!string) { /* When cbData == 0, RegQueryValueExA() should not modify the buffer */ - ok(strcmp(value, nA) == 0 || (cbData == 1 && *value == '\0') /* Win9x */, - "RegQueryValueExA failed: '%s' != '%s'\n", value, string); + lok(*value == 0xbd || (cbData == 1 && *value == '\0') /* Win9x */, + "RegQueryValueExA overflowed: cbData=%u *value=%02x\n", cbData, *value); } else { - ok(memcmp(value, string, cbData) == 0, "RegQueryValueExA failed: %s/%d != %s/%d\n", - wine_debugstr_an(value, cbData), cbData, + lok(memcmp(value, string, cbData) == 0, "RegQueryValueExA/2 failed: %s/%d != %s/%d\n", + wine_debugstr_an((char*)value, cbData), cbData, wine_debugstr_an(string, full_byte_len), full_byte_len); + lok(*(value+cbData) == 0xbd, "RegQueryValueExA/2 overflowed at offset %u: %02x != bd\n", cbData, *(value+cbData)); } HeapFree(GetProcessHeap(), 0, value); } -static void test_hkey_main_Value_W(LPCWSTR name, LPCWSTR string, +#define test_hkey_main_Value_W(name, string, full_byte_len) _test_hkey_main_Value_W(__LINE__, name, string, full_byte_len) +static void _test_hkey_main_Value_W(int line, LPCWSTR name, LPCWSTR string, DWORD full_byte_len) { DWORD ret, type, cbData; - LPWSTR value; - static const WCHAR nW[]={'N', 0}; + BYTE* value; type=0xdeadbeef; cbData=0xdeadbeef; @@ -261,31 +263,33 @@ SetLastError(0xdeadbeef); ret = RegQueryValueExW(hkey_main, name, NULL, &type, NULL, &cbData); GLE = GetLastError(); - ok(ret == ERROR_SUCCESS, "RegQueryValueExW failed: %d, GLE=%d\n", ret, GLE); + lok(ret == ERROR_SUCCESS, "RegQueryValueExW/1 failed: %d, GLE=%d\n", ret, GLE); if(GLE == ERROR_CALL_NOT_IMPLEMENTED) { win_skip("RegQueryValueExW() is not implemented\n"); return; } - ok(type == REG_SZ, "RegQueryValueExW returned type %d\n", type); - ok(cbData == full_byte_len, + lok(type == REG_SZ, "RegQueryValueExW/1 returned type %d\n", type); + lok(cbData == full_byte_len, "cbData=%d instead of %d\n", cbData, full_byte_len); - value = HeapAlloc(GetProcessHeap(), 0, (cbData+2)*sizeof(*value)); - lstrcpyW(value, nW); + /* Give enough space to overflow by one WCHAR */ + value = HeapAlloc(GetProcessHeap(), 0, cbData+2); + memset(value, 0xbd, cbData+2); type=0xdeadbeef; - ret = RegQueryValueExW(hkey_main, name, NULL, &type, (BYTE*)value, &cbData); + ret = RegQueryValueExW(hkey_main, name, NULL, &type, value, &cbData); GLE = GetLastError(); - ok(ret == ERROR_SUCCESS, "RegQueryValueExW failed: %d, GLE=%d\n", ret, GLE); - if (!string) - { - /* When cbData == 0, RegQueryValueExW() should not modify the buffer */ - string=nW; - } - ok(memcmp(value, string, cbData) == 0, "RegQueryValueExW failed: %s/%d != %s/%d\n", - wine_debugstr_wn(value, cbData / sizeof(WCHAR)), cbData, - wine_debugstr_wn(string, full_byte_len / sizeof(WCHAR)), full_byte_len); + lok(ret == ERROR_SUCCESS, "RegQueryValueExW/2 failed: %d, GLE=%d\n", ret, GLE); + if (string) + { + lok(memcmp(value, string, cbData) == 0, "RegQueryValueExW failed: %s/%d != %s/%d\n", + wine_debugstr_wn((WCHAR*)value, cbData / sizeof(WCHAR)), cbData, + wine_debugstr_wn(string, full_byte_len / sizeof(WCHAR)), full_byte_len); + } + /* This implies that when cbData == 0, RegQueryValueExW() should not modify the buffer */ + lok(*(value+cbData) == 0xbd, "RegQueryValueExW/2 overflowed at %u: %02x != bd\n", cbData, *(value+cbData)); + lok(*(value+cbData+1) == 0xbd, "RegQueryValueExW/2 overflowed at %u+1: %02x != bd\n", cbData, *(value+cbData+1)); HeapFree(GetProcessHeap(), 0, value); } @@ -957,6 +961,14 @@ ret == ERROR_FILE_NOT_FOUND /* Win9x,ME */ , "expected ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d\n", ret); + hkResult = NULL; + ret = RegOpenKeyExA(HKEY_CLASSES_ROOT, "\\clsid", 0, KEY_QUERY_VALUE, &hkResult); + ok(ret == ERROR_SUCCESS || /* 2k/XP */ + ret == ERROR_BAD_PATHNAME || /* NT */ + ret == ERROR_FILE_NOT_FOUND /* Win9x,ME */ + , "expected ERROR_SUCCESS, ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d\n", ret); + RegCloseKey(hkResult); + /* WOW64 flags */ hkResult = NULL; ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "Software", 0, KEY_READ|KEY_WOW64_32KEY, &hkResult); @@ -1304,6 +1316,87 @@ ok(size == sizeof(expected), "Got wrong size: %d\n", size); cleanup: + RegDeleteKeyA(subkey, ""); + RegCloseKey(subkey); +} + +static void test_string_termination(void) +{ + HKEY subkey; + LSTATUS ret; + static const char string[] = "FullString"; + char name[11]; + BYTE buffer[11]; + DWORD insize, outsize, nsize; + + ret = RegCreateKeyA(hkey_main, "string_termination", &subkey); + ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret); + + /* Off-by-one RegSetValueExA -> adds a trailing '\0'! */ + insize=sizeof(string)-1; + ret = RegSetValueExA(subkey, "stringtest", 0, REG_SZ, (BYTE*)string, insize); + ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", ret); + outsize=insize; + ret = RegQueryValueExA(subkey, "stringtest", NULL, NULL, buffer, &outsize); + ok(ret == ERROR_MORE_DATA, "RegQueryValueExA returned: %d\n", ret); + + /* Off-by-two RegSetValueExA -> no trailing '\0', except on Win9x */ + insize=sizeof(string)-2; + ret = RegSetValueExA(subkey, "stringtest", 0, REG_SZ, (BYTE*)string, insize); + ok(ret == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", ret); + outsize=0; + ret = RegQueryValueExA(subkey, "stringtest", NULL, NULL, NULL, &outsize); + ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", ret); + ok(outsize == insize || broken(outsize == sizeof(string)) /* Win9x */, + "wrong size %u != %u\n", outsize, insize); + + if (outsize == insize) + { + /* RegQueryValueExA may return a string with no trailing '\0' */ + outsize=insize; + memset(buffer, 0xbd, sizeof(buffer)); + ret = RegQueryValueExA(subkey, "stringtest", NULL, NULL, buffer, &outsize); + ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", ret); + ok(outsize == insize, "wrong size: %u != %u\n", outsize, insize); + ok(memcmp(buffer, string, outsize) == 0, "bad string: %s/%u != %s\n", + wine_debugstr_an((char*)buffer, outsize), outsize, string); + ok(buffer[insize] == 0xbd, "buffer overflow at %u %02x\n", insize, buffer[insize]); + + /* RegQueryValueExA adds a trailing '\0' if there is room */ + outsize=insize+1; + memset(buffer, 0xbd, sizeof(buffer)); + ret = RegQueryValueExA(subkey, "stringtest", NULL, NULL, buffer, &outsize); + ok(ret == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", ret); + ok(outsize == insize, "wrong size: %u != %u\n", outsize, insize); + ok(memcmp(buffer, string, outsize) == 0, "bad string: %s/%u != %s\n", + wine_debugstr_an((char*)buffer, outsize), outsize, string); + ok(buffer[insize] == 0, "buffer overflow at %u %02x\n", insize, buffer[insize]); + + /* RegEnumValueA may return a string with no trailing '\0' */ + outsize=insize; + memset(buffer, 0xbd, sizeof(buffer)); + nsize=sizeof(name); + ret = RegEnumValueA(subkey, 0, name, &nsize, NULL, NULL, buffer, &outsize); + ok(ret == ERROR_SUCCESS, "RegEnumValueA failed: %d\n", ret); + ok(strcmp(name, "stringtest") == 0, "wrong name: %s\n", name); + ok(outsize == insize, "wrong size: %u != %u\n", outsize, insize); + ok(memcmp(buffer, string, outsize) == 0, "bad string: %s/%u != %s\n", + wine_debugstr_an((char*)buffer, outsize), outsize, string); + ok(buffer[insize] == 0xbd, "buffer overflow at %u %02x\n", insize, buffer[insize]); + + /* RegEnumValueA adds a trailing '\0' if there is room */ + outsize=insize+1; + memset(buffer, 0xbd, sizeof(buffer)); + nsize=sizeof(name); + ret = RegEnumValueA(subkey, 0, name, &nsize, NULL, NULL, buffer, &outsize); + ok(ret == ERROR_SUCCESS, "RegEnumValueA failed: %d\n", ret); + ok(strcmp(name, "stringtest") == 0, "wrong name: %s\n", name); + ok(outsize == insize, "wrong size: %u != %u\n", outsize, insize); + ok(memcmp(buffer, string, outsize) == 0, "bad string: %s/%u != %s\n", + wine_debugstr_an((char*)buffer, outsize), outsize, string); + ok(buffer[insize] == 0, "buffer overflow at %u %02x\n", insize, buffer[insize]); + } + RegDeleteKeyA(subkey, ""); RegCloseKey(subkey); } @@ -1398,6 +1491,7 @@ test_reg_close_key(); test_reg_delete_key(); test_reg_query_value(); + test_string_termination(); /* SaveKey/LoadKey require the SE_BACKUP_NAME privilege to be set */ if (set_privileges(SE_BACKUP_NAME, TRUE) && Modified: trunk/rostests/winetests/advapi32/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/securi…
============================================================================== --- trunk/rostests/winetests/advapi32/security.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/security.c [iso-8859-1] Tue Dec 9 13:26:45 2008 @@ -81,10 +81,14 @@ typedef BOOL (WINAPI *fnConvertStringSidToSidA)( LPCSTR str, PSID pSid ); static BOOL (WINAPI *pConvertStringSecurityDescriptorToSecurityDescriptorA)(LPCSTR, DWORD, PSECURITY_DESCRIPTOR*, PULONG ); +static BOOL (WINAPI *pConvertStringSecurityDescriptorToSecurityDescriptorW)(LPCWSTR, DWORD, + PSECURITY_DESCRIPTOR*, PULONG ); static BOOL (WINAPI *pConvertSecurityDescriptorToStringSecurityDescriptorA)(PSECURITY_DESCRIPTOR, DWORD, SECURITY_INFORMATION, LPSTR *, PULONG ); typedef BOOL (WINAPI *fnGetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, PSECURITY_DESCRIPTOR, DWORD, LPDWORD); +typedef BOOL (WINAPI *fnSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION, + PSECURITY_DESCRIPTOR); static DWORD (WINAPI *pGetNamedSecurityInfoA)(LPSTR, SE_OBJECT_TYPE, SECURITY_INFORMATION, PSID*, PSID*, PACL*, PACL*, PSECURITY_DESCRIPTOR*); @@ -117,6 +121,7 @@ fnConvertSidToStringSidA pConvertSidToStringSidA; fnConvertStringSidToSidA pConvertStringSidToSidA; fnGetFileSecurityA pGetFileSecurityA; +fnSetFileSecurityA pSetFileSecurityA; fnRtlAdjustPrivilege pRtlAdjustPrivilege; fnCreateWellKnownSid pCreateWellKnownSid; fnDuplicateTokenEx pDuplicateTokenEx; @@ -144,8 +149,12 @@ pAddAuditAccessAceEx = (void *)GetProcAddress(hmod, "AddAuditAccessAceEx"); pConvertStringSecurityDescriptorToSecurityDescriptorA = (void *)GetProcAddress(hmod, "ConvertStringSecurityDescriptorToSecurityDescriptorA" ); + pConvertStringSecurityDescriptorToSecurityDescriptorW = + (void *)GetProcAddress(hmod, "ConvertStringSecurityDescriptorToSecurityDescriptorW" ); pConvertSecurityDescriptorToStringSecurityDescriptorA = (void *)GetProcAddress(hmod, "ConvertSecurityDescriptorToStringSecurityDescriptorA" ); + pGetFileSecurityA = (fnGetFileSecurityA)GetProcAddress(hmod, "GetFileSecurityA" ); + pSetFileSecurityA = (fnSetFileSecurityA)GetProcAddress(hmod, "SetFileSecurityA" ); pCreateWellKnownSid = (fnCreateWellKnownSid)GetProcAddress( hmod, "CreateWellKnownSid" ); pGetNamedSecurityInfoA = (void *)GetProcAddress(hmod, "GetNamedSecurityInfoA"); pMakeSelfRelativeSD = (void *)GetProcAddress(hmod, "MakeSelfRelativeSD"); @@ -495,7 +504,7 @@ #define SE_DEBUG_PRIVILEGE 20L #define SE_AUDIT_PRIVILEGE 21L #define SE_SYSTEM_ENVIRONMENT_PRIVILEGE 22L -#define SE_CHANGE_NOTIFY_PRIVILLEGE 23L +#define SE_CHANGE_NOTIFY_PRIVILEGE 23L #define SE_REMOTE_SHUTDOWN_PRIVILEGE 24L #define SE_UNDOCK_PRIVILEGE 25L #define SE_SYNC_AGENT_PRIVILEGE 26L @@ -570,7 +579,7 @@ "SeCreateTokenPrivilege (got %d, expected %d)\n", cchName, (int)strlen("SeCreateTokenPrivilege")); /* check known values */ - for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i < SE_MAX_WELL_KNOWN_PRIVILEGE; i++) + for (i = SE_MIN_WELL_KNOWN_PRIVILEGE; i <= SE_MAX_WELL_KNOWN_PRIVILEGE; i++) { luid.LowPart = i; cchName = sizeof(buf); @@ -625,7 +634,7 @@ { "SeDebugPrivilege", SE_DEBUG_PRIVILEGE }, { "SeAuditPrivilege", SE_AUDIT_PRIVILEGE }, { "SeSystemEnvironmentPrivilege", SE_SYSTEM_ENVIRONMENT_PRIVILEGE }, - { "SeChangeNotifyPrivilege", SE_CHANGE_NOTIFY_PRIVILLEGE }, + { "SeChangeNotifyPrivilege", SE_CHANGE_NOTIFY_PRIVILEGE }, { "SeRemoteShutdownPrivilege", SE_REMOTE_SHUTDOWN_PRIVILEGE }, { "SeUndockPrivilege", SE_UNDOCK_PRIVILEGE }, { "SeSyncAgentPrivilege", SE_SYNC_AGENT_PRIVILEGE }, @@ -690,31 +699,128 @@ static void test_FileSecurity(void) { - char directory[MAX_PATH]; - DWORD retval, outSize; - BOOL result; - BYTE buffer[0x40]; - - pGetFileSecurityA = (fnGetFileSecurityA) - GetProcAddress( hmod, "GetFileSecurityA" ); - if( !pGetFileSecurityA ) - return; - - retval = GetTempPathA(sizeof(directory), directory); - if (!retval) { - trace("GetTempPathA failed\n"); - return; - } - - strcpy(directory, "\\Should not exist"); - - SetLastError(NO_ERROR); - result = pGetFileSecurityA( directory,OWNER_SECURITY_INFORMATION,buffer,0x40,&outSize); - ok(!result, "GetFileSecurityA should fail for not existing directories/files\n"); - ok( (GetLastError() == ERROR_FILE_NOT_FOUND ) || - (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) , - "last error ERROR_FILE_NOT_FOUND / ERROR_CALL_NOT_IMPLEMENTED (98) " - "expected, got %d\n", GetLastError()); + char wintmpdir [MAX_PATH]; + char path [MAX_PATH]; + char file [MAX_PATH]; + BOOL rc; + HANDLE fh; + DWORD sdSize; + DWORD retSize; + BYTE *sd; + SECURITY_INFORMATION const request = OWNER_SECURITY_INFORMATION + | GROUP_SECURITY_INFORMATION + | DACL_SECURITY_INFORMATION; + + if (!pGetFileSecurityA) { + win_skip ("GetFileSecurity is not available\n"); + return; + } + + if (!pSetFileSecurityA) { + win_skip ("SetFileSecurity is not available\n"); + return; + } + + if (!GetTempPathA (sizeof (wintmpdir), wintmpdir)) { + win_skip ("GetTempPathA failed\n"); + return; + } + + /* Create a temporary directory and in it a temporary file */ + strcat (strcpy (path, wintmpdir), "rary"); + SetLastError(0xdeadbeef); + rc = CreateDirectoryA (path, NULL); + ok (rc || GetLastError() == ERROR_ALREADY_EXISTS, "CreateDirectoryA " + "failed for '%s' with %d\n", path, GetLastError()); + + strcat (strcpy (file, path), "\\ess"); + SetLastError(0xdeadbeef); + fh = CreateFileA (file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); + ok (fh != INVALID_HANDLE_VALUE, "CreateFileA " + "failed for '%s' with %d\n", file, GetLastError()); + CloseHandle (fh); + + /* For the temporary file ... */ + + /* Get size needed */ + retSize = 0; + SetLastError(0xdeadbeef); + rc = pGetFileSecurityA (file, request, NULL, 0, &retSize); + if (!rc && (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)) { + win_skip("GetFileSecurityA is not implemented\n"); + goto cleanup; + } + ok (!rc, "GetFileSecurityA " + "was expected to fail for '%s'\n", file); + ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " + "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize); + + sdSize = retSize; + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + + /* Get security descriptor for real */ + retSize = -1; + SetLastError(0xdeadbeef); + rc = pGetFileSecurityA (file, request, sd, sdSize, &retSize); + ok (rc, "GetFileSecurityA " + "was not expected to fail '%s': %d\n", file, GetLastError()); + ok (retSize == sdSize || + broken(retSize == 0), /* NT4 */ + "GetFileSecurityA returned size %d; expected %d\n", retSize, sdSize); + + /* Use it to set security descriptor */ + SetLastError(0xdeadbeef); + rc = pSetFileSecurityA (file, request, sd); + ok (rc, "SetFileSecurityA " + "was not expected to fail '%s': %d\n", file, GetLastError()); + + HeapFree (GetProcessHeap (), 0, sd); + + /* Repeat for the temporary directory ... */ + + /* Get size needed */ + retSize = 0; + SetLastError(0xdeadbeef); + rc = pGetFileSecurityA (path, request, NULL, 0, &retSize); + ok (!rc, "GetFileSecurityA " + "was expected to fail for '%s'\n", path); + ok (GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetFileSecurityA " + "returned %d; expected ERROR_INSUFFICIENT_BUFFER\n", GetLastError()); + ok (retSize > sizeof (SECURITY_DESCRIPTOR), "GetFileSecurityA returned size %d\n", retSize); + + sdSize = retSize; + sd = HeapAlloc (GetProcessHeap (), 0, sdSize); + + /* Get security descriptor for real */ + retSize = -1; + SetLastError(0xdeadbeef); + rc = pGetFileSecurityA (path, request, sd, sdSize, &retSize); + ok (rc, "GetFileSecurityA " + "was not expected to fail '%s': %d\n", path, GetLastError()); + ok (retSize == sdSize || + broken(retSize == 0), /* NT4 */ + "GetFileSecurityA returned size %d; expected %d\n", retSize, sdSize); + + /* Use it to set security descriptor */ + SetLastError(0xdeadbeef); + rc = pSetFileSecurityA (path, request, sd); + ok (rc, "SetFileSecurityA " + "was not expected to fail '%s': %d\n", path, GetLastError()); + HeapFree (GetProcessHeap (), 0, sd); + + /* Old test */ + strcpy (wintmpdir, "\\Should not exist"); + SetLastError(0xdeadbeef); + rc = pGetFileSecurityA (wintmpdir, OWNER_SECURITY_INFORMATION, NULL, 0, &sdSize); + ok (!rc, "GetFileSecurityA should fail for not existing directories/files\n"); + ok (GetLastError() == ERROR_FILE_NOT_FOUND, + "last error ERROR_FILE_NOT_FOUND expected, got %d\n", GetLastError()); + +cleanup: + /* Remove temporary file and directory */ + DeleteFileA(file); + RemoveDirectoryA(path); } static void test_AccessCheck(void) @@ -1309,6 +1415,14 @@ real_dom_sizeW = MAX_PATH; ret = LookupAccountSidW(NULL, pUsersSid, accountW, &real_acc_sizeW, domainW, &real_dom_sizeW, &use); ok(ret, "LookupAccountSidW() Expected TRUE, got FALSE\n"); + + /* try an invalid system name */ + real_acc_sizeA = MAX_PATH; + real_dom_sizeA = MAX_PATH; + ret = LookupAccountSidA("deepthought", pUsersSid, accountA, &real_acc_sizeA, domainA, &real_dom_sizeA, &use); + ok(!ret, "LookupAccountSidA() Expected FALSE got TRUE\n"); + ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE || GetLastError() == RPC_S_INVALID_NET_ADDR /* Vista */, + "LookupAccountSidA() Expected RPC_S_SERVER_UNAVAILABLE or RPC_S_INVALID_NET_ADDR, got %u\n", GetLastError()); /* native windows crashes if domainW or accountW is NULL */ @@ -1550,10 +1664,10 @@ { ok(!lstrcmp(account, user_name), "Expected %s, got %s\n", user_name, account); ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain); - ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size); - ok(lstrlen(domain) == domain_size, "Expected %d\n", lstrlen(domain)); - ok(sid_use == SidTypeUser, "Expected SidTypeUser, got %d\n", sid_use); - } + } + ok(domain_size == domain_save - 1, "Expected %d, got %d\n", domain_save - 1, domain_size); + ok(lstrlen(domain) == domain_size, "Expected %d, got %d\n", lstrlen(domain), domain_size); + ok(sid_use == SidTypeUser, "Expected SidTypeUser (%d), got %d\n", SidTypeUser, sid_use); domain_size = domain_save; sid_size = sid_save; @@ -1568,12 +1682,10 @@ ok(ret, "Failed to lookup account name\n"); ok(sid_size != 0, "sid_size was zero\n"); ok(!lstrcmp(account, "Everyone"), "Expected Everyone, got %s\n", account); - todo_wine ok(!lstrcmp(domain, sid_dom), "Expected %s, got %s\n", sid_dom, domain); ok(domain_size == 0, "Expected 0, got %d\n", domain_size); - todo_wine ok(lstrlen(domain) == domain_size, "Expected %d, got %d\n", lstrlen(domain), domain_size); - ok(sid_use == SidTypeWellKnownGroup, "Expected SidTypeUser, got %d\n", sid_use); + ok(sid_use == SidTypeWellKnownGroup, "Expected SidTypeWellKnownGroup (%d), got %d\n", SidTypeWellKnownGroup, sid_use); domain_size = domain_save; } @@ -1616,28 +1728,33 @@ sid_use = 0xcafebabe; SetLastError(0xdeadbeef); ret = LookupAccountNameA(NULL, NULL, NULL, &sid_size, NULL, &domain_size, &sid_use); - ok(!ret, "Expected 0, got %d\n", ret); - ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, - "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); - ok(sid_size != 0, "Expected non-zero sid size\n"); - ok(domain_size != 0, "Expected non-zero domain size\n"); - ok(sid_use == 0xcafebabe, "Expected 0xcafebabe, got %d\n", sid_use); - - psid = HeapAlloc(GetProcessHeap(), 0, sid_size); - domain = HeapAlloc(GetProcessHeap(), 0, domain_size); - - /* try NULL account name */ - ret = LookupAccountNameA(NULL, NULL, psid, &sid_size, domain, &domain_size, &sid_use); - get_sid_info(psid, &account, &sid_dom); - ok(ret, "Failed to lookup account name\n"); - todo_wine - { + if (!ret && GetLastError() != ERROR_NONE_MAPPED) + { + ok(!ret, "Expected 0, got %d\n", ret); + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); + ok(sid_size != 0, "Expected non-zero sid size\n"); + ok(domain_size != 0, "Expected non-zero domain size\n"); + ok(sid_use == 0xcafebabe, "Expected 0xcafebabe, got %d\n", sid_use); + + psid = HeapAlloc(GetProcessHeap(), 0, sid_size); + domain = HeapAlloc(GetProcessHeap(), 0, domain_size); + + /* try NULL account name */ + ret = LookupAccountNameA(NULL, NULL, psid, &sid_size, domain, &domain_size, &sid_use); + get_sid_info(psid, &account, &sid_dom); + ok(ret, "Failed to lookup account name\n"); /* Using a fixed string will not work on different locales */ ok(!lstrcmp(account, domain), "Got %s for account and %s for domain, these should be the same\n", account, domain); - ok(sid_use == SidTypeDomain, "Expected SidTypeDomain, got %d\n", SidTypeDomain); - } + ok(sid_use == SidTypeDomain, "Expected SidTypeDomain (%d), got %d\n", SidTypeDomain, sid_use); + + HeapFree(GetProcessHeap(), 0, psid); + HeapFree(GetProcessHeap(), 0, domain); + } + else + win_skip("NULL account name doesn't work on NT4\n"); /* try an invalid account name */ SetLastError(0xdeadbeef); @@ -1645,17 +1762,22 @@ domain_size = 0; ret = LookupAccountNameA(NULL, "oogabooga", NULL, &sid_size, NULL, &domain_size, &sid_use); ok(!ret, "Expected 0, got %d\n", ret); - todo_wine - { - ok(GetLastError() == ERROR_NONE_MAPPED || - broken(GetLastError() == ERROR_TRUSTED_RELATIONSHIP_FAILURE), - "Expected ERROR_NONE_MAPPED, got %d\n", GetLastError()); - ok(sid_size == 0, "Expected 0, got %d\n", sid_size); - ok(domain_size == 0, "Expected 0, got %d\n", domain_size); - } - - HeapFree(GetProcessHeap(), 0, psid); - HeapFree(GetProcessHeap(), 0, domain); + ok(GetLastError() == ERROR_NONE_MAPPED || + broken(GetLastError() == ERROR_TRUSTED_RELATIONSHIP_FAILURE), + "Expected ERROR_NONE_MAPPED, got %d\n", GetLastError()); + ok(sid_size == 0, "Expected 0, got %d\n", sid_size); + ok(domain_size == 0, "Expected 0, got %d\n", domain_size); + + /* try an invalid system name */ + SetLastError(0xdeadbeef); + sid_size = 0; + domain_size = 0; + ret = LookupAccountNameA("deepthought", NULL, NULL, &sid_size, NULL, &domain_size, &sid_use); + ok(!ret, "Expected 0, got %d\n", ret); + ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE || GetLastError() == RPC_S_INVALID_NET_ADDR /* Vista */, + "Expected RPC_S_SERVER_UNAVAILABLE or RPC_S_INVALID_NET_ADDR, got %d\n", GetLastError()); + ok(sid_size == 0, "Expected 0, got %d\n", sid_size); + ok(domain_size == 0, "Expected 0, got %d\n", domain_size); } static void test_security_descriptor(void) @@ -1962,7 +2084,7 @@ ret = GetTokenInformation(Token, TokenUser, NULL, 0, &Size); error = GetLastError(); ok(!ret && error == ERROR_INSUFFICIENT_BUFFER, "GetTokenInformation(TokenUser) should have failed with ERROR_INSUFFICIENT_BUFFER instead of %d\n", error); - User = (TOKEN_USER *)HeapAlloc(GetProcessHeap(), 0, Size); + User = HeapAlloc(GetProcessHeap(), 0, Size); ret = GetTokenInformation(Token, TokenUser, User, Size, &Size); ok(ret, "GetTokenInformation(TokenUser) failed with error %d\n", GetLastError()); HeapFree(GetProcessHeap(), 0, User); @@ -1971,11 +2093,11 @@ ret = GetTokenInformation(Token, TokenPrivileges, NULL, 0, &Size); error = GetLastError(); ok(!ret && error == ERROR_INSUFFICIENT_BUFFER, "GetTokenInformation(TokenPrivileges) should have failed with ERROR_INSUFFICIENT_BUFFER instead of %d\n", error); - Privileges = (TOKEN_PRIVILEGES *)HeapAlloc(GetProcessHeap(), 0, Size); + Privileges = HeapAlloc(GetProcessHeap(), 0, Size); ret = GetTokenInformation(Token, TokenPrivileges, Privileges, Size, &Size); ok(ret, "GetTokenInformation(TokenPrivileges) failed with error %d\n", GetLastError()); - PrivilegeSet = (PRIVILEGE_SET *)HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(PRIVILEGE_SET, Privilege[Privileges->PrivilegeCount])); + PrivilegeSet = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(PRIVILEGE_SET, Privilege[Privileges->PrivilegeCount])); PrivilegeSet->PrivilegeCount = Privileges->PrivilegeCount; memcpy(PrivilegeSet->Privilege, Privileges->Privileges, PrivilegeSet->PrivilegeCount * sizeof(PrivilegeSet->Privilege[0])); PrivilegeSet->Control = PRIVILEGE_SET_ALL_NECESSARY; @@ -2031,7 +2153,7 @@ if (!pSetEntriesInAclW) { - skip("SetEntriesInAclW is not available\n"); + win_skip("SetEntriesInAclW is not available\n"); return; } @@ -2039,17 +2161,20 @@ res = pSetEntriesInAclW(0, NULL, NULL, &NewAcl); if(res == ERROR_CALL_NOT_IMPLEMENTED) { - skip("SetEntriesInAclW is not implemented\n"); + win_skip("SetEntriesInAclW is not implemented\n"); return; } ok(res == ERROR_SUCCESS, "SetEntriesInAclW failed: %u\n", res); - ok(NewAcl == NULL, "NewAcl=%p, expected NULL\n", NewAcl); + ok(NewAcl == NULL || + broken(NewAcl != NULL), /* NT4 */ + "NewAcl=%p, expected NULL\n", NewAcl); + LocalFree(NewAcl); OldAcl = HeapAlloc(GetProcessHeap(), 0, 256); res = InitializeAcl(OldAcl, 256, ACL_REVISION); if(!res && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { - skip("ACLs not implemented - skipping tests\n"); + win_skip("ACLs not implemented - skipping tests\n"); HeapFree(GetProcessHeap(), 0, OldAcl); return; } @@ -2093,16 +2218,22 @@ ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_BAD_FORM; res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); - ok(res == ERROR_INVALID_PARAMETER, "SetEntriesInAclW failed: %u\n", res); - ok(NewAcl == NULL, "returned acl wasn't NULL: %p\n", NewAcl); - LocalFree(NewAcl); + ok(res == ERROR_INVALID_PARAMETER || + broken(res == ERROR_NOT_SUPPORTED), /* NT4 */ + "SetEntriesInAclW failed: %u\n", res); + ok(NewAcl == NULL || + broken(NewAcl != NULL), /* NT4 */ + "returned acl wasn't NULL: %p\n", NewAcl); ExplicitAccess.Trustee.TrusteeForm = TRUSTEE_IS_USER; ExplicitAccess.Trustee.MultipleTrusteeOperation = TRUSTEE_IS_IMPERSONATE; res = pSetEntriesInAclW(1, &ExplicitAccess, OldAcl, &NewAcl); - ok(res == ERROR_INVALID_PARAMETER, "SetEntriesInAclW failed: %u\n", res); - ok(NewAcl == NULL, "returned acl wasn't NULL: %p\n", NewAcl); - LocalFree(NewAcl); + ok(res == ERROR_INVALID_PARAMETER || + broken(res == ERROR_NOT_SUPPORTED), /* NT4 */ + "SetEntriesInAclW failed: %u\n", res); + ok(NewAcl == NULL || + broken(NewAcl != NULL), /* NT4 */ + "returned acl wasn't NULL: %p\n", NewAcl); ExplicitAccess.Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ExplicitAccess.grfAccessMode = SET_ACCESS; @@ -2175,6 +2306,7 @@ { BOOL ret; PSECURITY_DESCRIPTOR pSD; + static const WCHAR Blank[] = { 0 }; if (!pConvertStringSecurityDescriptorToSecurityDescriptorA) { @@ -2255,10 +2387,50 @@ SetLastError(0xdeadbeef); ret = pConvertStringSecurityDescriptorToSecurityDescriptorA( "D:(A;;ROB;;;WD)", SDDL_REVISION_1, &pSD, NULL); - todo_wine ok(!ret && GetLastError() == ERROR_INVALID_ACL, "ConvertStringSecurityDescriptorToSecurityDescriptor should have failed with ERROR_INVALID_ACL instead of %d\n", GetLastError()); + + /* test behaviour with NULL parameters */ + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorA( + NULL, 0xdeadbeef, &pSD, NULL); + todo_wine + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "ConvertStringSecurityDescriptorToSecurityDescriptor should have failed with ERROR_INVALID_PARAMETER instead of %d\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorW( + NULL, 0xdeadbeef, &pSD, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "ConvertStringSecurityDescriptorToSecurityDescriptor should have failed with ERROR_INVALID_PARAMETER instead of %d\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorA( + "D:(A;;ROB;;;WD)", 0xdeadbeef, NULL, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "ConvertStringSecurityDescriptorToSecurityDescriptor should have failed with ERROR_INVALID_PARAMETER instead of %d\n", + GetLastError()); + + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorA( + "D:(A;;ROB;;;WD)", SDDL_REVISION_1, NULL, NULL); + ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, + "ConvertStringSecurityDescriptorToSecurityDescriptor should have failed with ERROR_INVALID_PARAMETER instead of %d\n", + GetLastError()); + + /* test behaviour with empty strings */ + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorA( + "", SDDL_REVISION_1, &pSD, NULL); + ok(ret, "ConvertStringSecurityDescriptorToSecurityDescriptor failed with error %d\n", GetLastError()); + + SetLastError(0xdeadbeef); + ret = pConvertStringSecurityDescriptorToSecurityDescriptorW( + Blank, SDDL_REVISION_1, &pSD, NULL); + ok(ret, "ConvertStringSecurityDescriptorToSecurityDescriptor failed with error %d\n", GetLastError()); /* test ACE string SID */ SetLastError(0xdeadbeef); @@ -2386,11 +2558,100 @@ } } +static void test_SetSecurityDescriptorControl (PSECURITY_DESCRIPTOR sec) +{ + SECURITY_DESCRIPTOR_CONTROL ref; + SECURITY_DESCRIPTOR_CONTROL test; + + SECURITY_DESCRIPTOR_CONTROL const mutable + = SE_DACL_AUTO_INHERIT_REQ | SE_SACL_AUTO_INHERIT_REQ + | SE_DACL_AUTO_INHERITED | SE_SACL_AUTO_INHERITED + | SE_DACL_PROTECTED | SE_SACL_PROTECTED + | 0x00000040 | 0x00000080 /* not defined in winnt.h */ + ; + SECURITY_DESCRIPTOR_CONTROL const immutable + = SE_OWNER_DEFAULTED | SE_GROUP_DEFAULTED + | SE_DACL_PRESENT | SE_DACL_DEFAULTED + | SE_SACL_PRESENT | SE_SACL_DEFAULTED + | SE_RM_CONTROL_VALID | SE_SELF_RELATIVE + ; + + int bit; + DWORD dwRevision; + LPCSTR fmt = "Expected error %s, got %u\n"; + + GetSecurityDescriptorControl (sec, &ref, &dwRevision); + + /* The mutable bits are mutable regardless of the truth of + SE_DACL_PRESENT and/or SE_SACL_PRESENT */ + + /* Check call barfs if any bit-of-interest is immutable */ + for (bit = 0; bit < 16; ++bit) + { + SECURITY_DESCRIPTOR_CONTROL const bitOfInterest = 1 << bit; + SECURITY_DESCRIPTOR_CONTROL setOrClear = ref & bitOfInterest; + + SECURITY_DESCRIPTOR_CONTROL ctrl; + + DWORD dwExpect = (bitOfInterest & immutable) + ? ERROR_INVALID_PARAMETER : 0xbebecaca; + LPCSTR strExpect = (bitOfInterest & immutable) + ? "ERROR_INVALID_PARAMETER" : "0xbebecaca"; + + ctrl = (bitOfInterest & mutable) ? ref + bitOfInterest : ref; + setOrClear ^= bitOfInterest; + SetLastError (0xbebecaca); + pSetSecurityDescriptorControl (sec, bitOfInterest, setOrClear); + ok (GetLastError () == dwExpect, fmt, strExpect, GetLastError ()); + GetSecurityDescriptorControl(sec, &test, &dwRevision); + expect_eq(test, ctrl, int, "%x"); + + ctrl = ref; + setOrClear ^= bitOfInterest; + SetLastError (0xbebecaca); + pSetSecurityDescriptorControl (sec, bitOfInterest, setOrClear); + ok (GetLastError () == dwExpect, fmt, strExpect, GetLastError ()); + GetSecurityDescriptorControl (sec, &test, &dwRevision); + expect_eq(test, ref, int, "%x"); + } + + /* Check call barfs if any bit-to-set is immutable + even when not a bit-of-interest */ + for (bit = 0; bit < 16; ++bit) + { + SECURITY_DESCRIPTOR_CONTROL const bitsOfInterest = mutable; + SECURITY_DESCRIPTOR_CONTROL setOrClear = ref & bitsOfInterest; + + SECURITY_DESCRIPTOR_CONTROL ctrl; + + DWORD dwExpect = ((1 << bit) & immutable) + ? ERROR_INVALID_PARAMETER : 0xbebecaca; + LPCSTR strExpect = ((1 << bit) & immutable) + ? "ERROR_INVALID_PARAMETER" : "0xbebecaca"; + + ctrl = ((1 << bit) & immutable) ? test : ref | mutable; + setOrClear ^= bitsOfInterest; + SetLastError (0xbebecaca); + pSetSecurityDescriptorControl (sec, bitsOfInterest, setOrClear | (1 << bit)); + ok (GetLastError () == dwExpect, fmt, strExpect, GetLastError ()); + GetSecurityDescriptorControl(sec, &test, &dwRevision); + expect_eq(test, ctrl, int, "%x"); + + ctrl = ((1 << bit) & immutable) ? test : ref | (1 << bit); + setOrClear ^= bitsOfInterest; + SetLastError (0xbebecaca); + pSetSecurityDescriptorControl (sec, bitsOfInterest, setOrClear | (1 << bit)); + ok (GetLastError () == dwExpect, fmt, strExpect, GetLastError ()); + GetSecurityDescriptorControl(sec, &test, &dwRevision); + expect_eq(test, ctrl, int, "%x"); + } +} + static void test_PrivateObjectSecurity(void) { SECURITY_INFORMATION sec_info = OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION; SECURITY_DESCRIPTOR_CONTROL ctrl; - PSECURITY_DESCRIPTOR sec = NULL; + PSECURITY_DESCRIPTOR sec; DWORD dwDescSize; DWORD dwRevision; DWORD retSize; @@ -2407,13 +2668,33 @@ ok(pConvertStringSecurityDescriptorToSecurityDescriptorA( "O:SY" "G:S-1-5-21-93476-23408-4576" + "D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)" + "(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)" + "S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)", + SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n"); + + test_SetSecurityDescriptorControl(sec); + + LocalFree(sec); + + ok(pConvertStringSecurityDescriptorToSecurityDescriptorA( + "O:SY" + "G:S-1-5-21-93476-23408-4576", + SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n"); + + test_SetSecurityDescriptorControl(sec); + + LocalFree(sec); + + ok(pConvertStringSecurityDescriptorToSecurityDescriptorA( + "O:SY" + "G:S-1-5-21-93476-23408-4576" "D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)" "S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)", SDDL_REVISION_1, &sec, &dwDescSize), "Creating descriptor failed\n"); buf = HeapAlloc(GetProcessHeap(), 0, dwDescSize); - DbgPrint("Received %p\n", sec); pSetSecurityDescriptorControl(sec, SE_DACL_PROTECTED, SE_DACL_PROTECTED); GetSecurityDescriptorControl(sec, &ctrl, &dwRevision); - todo_wine expect_eq(ctrl, 0x9014, int, "%x"); + expect_eq(ctrl, 0x9014, int, "%x"); ok(GetPrivateObjectSecurity(sec, GROUP_SECURITY_INFORMATION, buf, dwDescSize, &retSize), "GetPrivateObjectSecurity failed (err=%u)\n", GetLastError()); @@ -2488,11 +2769,17 @@ ret = IsValidAcl(pAcl); ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + SetLastError(0xdeadbeef); ret = InitializeAcl(pAcl, sizeof(buffer), ACL_REVISION4); - ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError()); - - ret = IsValidAcl(pAcl); - ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + if (GetLastError() != ERROR_INVALID_PARAMETER) + { + ok(ret, "InitializeAcl(ACL_REVISION4) failed with error %d\n", GetLastError()); + + ret = IsValidAcl(pAcl); + ok(ret, "IsValidAcl failed with error %d\n", GetLastError()); + } + else + win_skip("ACL_REVISION4 is not implemented on NT4\n"); SetLastError(0xdeadbeef); ret = InitializeAcl(pAcl, sizeof(buffer), -1); @@ -2539,6 +2826,13 @@ ok(IsValidAcl(dacl), "GetSecurityInfo\n"); LocalFree(sd); + + if (!pCreateWellKnownSid) + { + win_skip("NULL parameter test would crash on NT4\n"); + CloseHandle(obj); + return; + } /* If we don't ask for the security descriptor, Windows will still give us the other stuff, leaving us no way to free it. */ Modified: trunk/rostests/winetests/advapi32/service.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/servic…
============================================================================== --- trunk/rostests/winetests/advapi32/service.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/service.c [iso-8859-1] Tue Dec 9 13:26:45 2008 @@ -564,7 +564,7 @@ displaysize = tempsizeW / 2; ret = GetServiceDisplayNameW(scm_handle, spoolerW, displaynameW, &displaysize); ok(!ret, "Expected failure\n"); - ok(displaysize = tempsizeW, "Expected the needed buffersize\n"); + ok(displaysize == tempsizeW, "Expected the needed buffersize\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); @@ -573,7 +573,7 @@ displaysize = tempsizeW; ret = GetServiceDisplayNameW(scm_handle, spoolerW, displaynameW, &displaysize); ok(!ret, "Expected failure\n"); - ok(displaysize = tempsizeW, "Expected the needed buffersize\n"); + ok(displaysize == tempsizeW, "Expected the needed buffersize\n"); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); @@ -649,7 +649,7 @@ /* Delete the service */ ret = DeleteService(svc_handle); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); CloseServiceHandle(svc_handle); CloseServiceHandle(scm_handle); @@ -882,7 +882,7 @@ /* Only info level is correct. It looks like the buffer/size is checked second */ SetLastError(0xdeadbeef); ret = pQueryServiceStatusEx(NULL, 0, NULL, 0, &needed); - /* NT4 checks the handle first */ + /* NT4 and Wine check the handle first */ if (GetLastError() != ERROR_INVALID_HANDLE) { ok(!ret, "Expected failure\n"); @@ -893,7 +893,7 @@ } /* Pass a correct buffer and buffersize but a NULL handle */ - statusproc = HeapAlloc(GetProcessHeap(), 0, needed); + statusproc = HeapAlloc(GetProcessHeap(), 0, sizeof(SERVICE_STATUS_PROCESS)); bufsize = needed; SetLastError(0xdeadbeef); ret = pQueryServiceStatusEx(NULL, 0, (BYTE*)statusproc, bufsize, &needed); @@ -1985,7 +1985,7 @@ /* Check if we can close the handle to the Service Control Manager */ ret = CloseServiceHandle(scm_handle); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); /* Get a new handle to the Service Control Manager */ scm_handle = OpenSCManagerA(NULL, NULL, GENERIC_ALL); @@ -1997,7 +1997,7 @@ /* Delete the service */ ret = DeleteService(svc_handle4); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); /* We cannot create the same service again as it's still marked as 'being deleted'. * The reason is that we still have 4 open handles to this service even though we @@ -2023,13 +2023,13 @@ /* Close all the handles to the service and try again */ ret = CloseServiceHandle(svc_handle4); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); ret = CloseServiceHandle(svc_handle3); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); ret = CloseServiceHandle(svc_handle2); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); ret = CloseServiceHandle(svc_handle1); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); /* Wait a while. Doing a CreateService too soon will result again * in an ERROR_SERVICE_MARKED_FOR_DELETE error. @@ -2044,7 +2044,7 @@ /* Delete the service */ ret = DeleteService(svc_handle5); - ok(ret, "Expected success\n"); + ok(ret, "Expected success (err=%d)\n", GetLastError()); /* Wait a while. Just in case one of the following tests does a CreateService again */ Sleep(1000);
16 years
1
0
0
0
[pschweitzer] 37981: Added a FIXME that I'll fix it later, when allocation will have been done in the good way
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Dec 9 13:22:20 2008 New Revision: 37981 URL:
http://svn.reactos.org/svn/reactos?rev=37981&view=rev
Log: Added a FIXME that I'll fix it later, when allocation will have been done in the good way Modified: branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c Modified: branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
============================================================================== --- branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Tue Dec 9 13:22:20 2008 @@ -812,6 +812,11 @@ return STATUS_OBJECT_NAME_COLLISION; } + /* FIXME + * Free memory allocated for upcased strings! + * FIXME + */ + return STATUS_NOT_IMPLEMENTED; }
16 years
1
0
0
0
[pschweitzer] 37980: Continue basic implementation of VfatSetRenameInformation Have a look to bug #3900
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Dec 9 13:16:23 2008 New Revision: 37980 URL:
http://svn.reactos.org/svn/reactos?rev=37980&view=rev
Log: Continue basic implementation of VfatSetRenameInformation Have a look to bug #3900 Modified: branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c Modified: branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c URL:
http://svn.reactos.org/svn/reactos/branches/pierre-fsd/drivers/filesystems/…
============================================================================== --- branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c [iso-8859-1] (original) +++ branches/pierre-fsd/drivers/filesystems/fastfat/finfo.c [iso-8859-1] Tue Dec 9 13:16:23 2008 @@ -752,24 +752,64 @@ VfatSetRenameInformation(PVFAT_IRP_CONTEXT IrpContext) { PIRP Irp; + NTSTATUS Status; PVFATFCB FCB, NewFCB; PIO_STACK_LOCATION Stack; + PDEVICE_EXTENSION DeviceExt; PFILE_OBJECT FileObject, NewFileObject; + BOOLEAN ReplaceIfExists, ChangeCaseOnly = FALSE; + UNICODE_STRING UpcasedPathName, UpcasedNewPathName; DPRINT1("VfatSetRenameInformation is stubplemented!\n"); Irp = IrpContext->Irp; Stack = IoGetCurrentIrpStackLocation(Irp); + DeviceExt = IrpContext->DeviceExt; + FileObject = IrpContext->FileObject; FCB = FileObject->FsContext; NewFileObject = Stack->Parameters.SetFile.FileObject; + ReplaceIfExists = Stack->Parameters.SetFile.ReplaceIfExists; NewFCB = NewFileObject->FsContext; - if (FsRtlAreNamesEqual(&(FCB->LongNameU), &(NewFCB->LongNameU), FALSE, NULL)) - { - return STATUS_SUCCESS; + /* Don't allow root directory rename */ + if (vfatFCBIsRoot(FCB)) + { + return STATUS_INVALID_PARAMETER; + } + + /* FIXME: Don't let RTL lib allocate memory, do it from kernel ! */ + Status = RtlUpcaseUnicodeString(&UpcasedPathName, &(FCB->PathNameU), TRUE); + if (!NT_SUCCESS(Status)) + { + return Status; + } + Status = RtlUpcaseUnicodeString(&UpcasedNewPathName, &(NewFCB->PathNameU), TRUE); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + if ((FCB->parentFcb) == (NewFCB->parentFcb)) + { + /* Run a quick test to know if new and old filenames are the same */ + if (FsRtlAreNamesEqual(&(FCB->LongNameU), &(NewFCB->LongNameU), FALSE, NULL)) + { + return STATUS_SUCCESS; + } + + /* Check both filenames to see if it's only a change case rename */ + if (FsRtlAreNamesEqual(&(FCB->LongNameU), &(NewFCB->LongNameU), TRUE, NULL)) + { + ChangeCaseOnly = TRUE; + } + } + + if (vfatGrabFCBFromTable(DeviceExt, &(NewFCB->PathNameU)) && !ReplaceIfExists) + { + return STATUS_OBJECT_NAME_COLLISION; } return STATUS_NOT_IMPLEMENTED;
16 years
1
0
0
0
[sginsberg] 37979: - Remove traces
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Dec 9 13:00:46 2008 New Revision: 37979 URL:
http://svn.reactos.org/svn/reactos?rev=37979&view=rev
Log: - Remove traces Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c trunk/reactos/dll/win32/kernel32/mem/local.c Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] Tue Dec 9 13:00:46 2008 @@ -1288,7 +1288,6 @@ if (SecurityDescriptorSize) *SecurityDescriptorSize = relativeSdSize; *SecurityDescriptor = relativeSd; - DbgPrint("ConvertStringSecurityDescriptorToSecurityDescriptorW: relativeSd: %p\n", relativeSd); cleanup: if (GetSecurityDescriptorOwner(sd, &pSid, &dummy)) Modified: trunk/reactos/dll/win32/kernel32/mem/local.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/mem/loc…
============================================================================== --- trunk/reactos/dll/win32/kernel32/mem/local.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/mem/local.c [iso-8859-1] Tue Dec 9 13:00:46 2008 @@ -52,7 +52,6 @@ /* Allocate heap for it */ Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); BASE_TRACE_ALLOC2(Ptr); - if ((ULONG_PTR)Ptr == 0xC) DbgPrint("LocalAlloc: Ptr is 0xC\n"); return Ptr; } @@ -132,12 +131,10 @@ } /* Set the pointer */ - if ((ULONG_PTR)hMemory == 0xC) DbgPrint("LocalAlloc: hMemory is 0xC\n"); Ptr = hMemory; } /* Return the pointer */ - if ((ULONG_PTR)Ptr == 0xC) DbgPrint("LocalAlloc: Ptr is 0xC\n"); return Ptr; }
16 years
1
0
0
0
[sginsberg] 37978: - Initialize pointer to null
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Dec 9 12:48:28 2008 New Revision: 37978 URL:
http://svn.reactos.org/svn/reactos?rev=37978&view=rev
Log: - Initialize pointer to null Modified: trunk/rostests/winetests/advapi32/security.c Modified: trunk/rostests/winetests/advapi32/security.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/securi…
============================================================================== --- trunk/rostests/winetests/advapi32/security.c [iso-8859-1] (original) +++ trunk/rostests/winetests/advapi32/security.c [iso-8859-1] Tue Dec 9 12:48:28 2008 @@ -2390,7 +2390,7 @@ { SECURITY_INFORMATION sec_info = OWNER_SECURITY_INFORMATION|GROUP_SECURITY_INFORMATION|DACL_SECURITY_INFORMATION|SACL_SECURITY_INFORMATION; SECURITY_DESCRIPTOR_CONTROL ctrl; - PSECURITY_DESCRIPTOR sec; + PSECURITY_DESCRIPTOR sec = NULL; DWORD dwDescSize; DWORD dwRevision; DWORD retSize;
16 years
1
0
0
0
[sginsberg] 37977: - Remove trace, change trace
by sginsberg@svn.reactos.org
Author: sginsberg Date: Tue Dec 9 12:35:06 2008 New Revision: 37977 URL:
http://svn.reactos.org/svn/reactos?rev=37977&view=rev
Log: - Remove trace, change trace Modified: trunk/reactos/dll/win32/advapi32/sec/sec.c trunk/reactos/dll/win32/advapi32/sec/sid.c Modified: trunk/reactos/dll/win32/advapi32/sec/sec.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sec…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/sec.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/sec.c [iso-8859-1] Tue Dec 9 12:35:06 2008 @@ -308,8 +308,6 @@ { NTSTATUS Status; - DbgPrint("SetSecurityDescriptorControl: Received %p\n", pSecurityDescriptor); - Status = RtlSetControlSecurityDescriptor(pSecurityDescriptor, ControlBitsOfInterest, ControlBitsToSet); Modified: trunk/reactos/dll/win32/advapi32/sec/sid.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/sid…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/sid.c [iso-8859-1] Tue Dec 9 12:35:06 2008 @@ -1288,7 +1288,7 @@ if (SecurityDescriptorSize) *SecurityDescriptorSize = relativeSdSize; *SecurityDescriptor = relativeSd; - if ((ULONG_PTR)relativeSd == 0xC) DbgPrint("ConvertStringSecurityDescriptorToSecurityDescriptorW: relativeSd is 0xC\n"); + DbgPrint("ConvertStringSecurityDescriptorToSecurityDescriptorW: relativeSd: %p\n", relativeSd); cleanup: if (GetSecurityDescriptorOwner(sd, &pSid, &dummy))
16 years
1
0
0
0
[khornicek] 37976: - basic implementation of GdiEntry7 and GdiEntry8
by khornicek@svn.reactos.org
Author: khornicek Date: Tue Dec 9 12:33:34 2008 New Revision: 37976 URL:
http://svn.reactos.org/svn/reactos?rev=37976&view=rev
Log: - basic implementation of GdiEntry7 and GdiEntry8 Modified: branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c Modified: branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c URL:
http://svn.reactos.org/svn/reactos/branches/reactx/reactos/dll/win32/gdi32/…
============================================================================== --- branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c [iso-8859-1] (original) +++ branches/reactx/reactos/dll/win32/gdi32/misc/gdientryhelgl.c [iso-8859-1] Tue Dec 9 12:33:34 2008 @@ -2378,12 +2378,13 @@ DdGetDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal, LPPALETTEENTRY pColorTable) { - /* Fixme for opengl hel emulations */ - HEL_OGL_STUB; -#if 0 - /* Call win32k directly */ - return NtGdiDdGetDC(pColorTable, (HANDLE) pSurfaceLocal->hDDSurface); -#endif + IWineD3DSurface * pWineD3DSurface = (IWineD3DSurface*) pSurfaceLocal->hDDSurface; + HDC hDC; + + IWineD3DSurface_GetDC( pWineD3DSurface, &hDC); + pSurfaceLocal->hDC = (ULONG_PTR)hDC; + + return hDC; } /* @@ -2395,12 +2396,12 @@ WINAPI DdReleaseDC(LPDDRAWI_DDRAWSURFACE_LCL pSurfaceLocal) { - /* Fixme for opengl hel emulations */ - HEL_OGL_STUB; -#if 0 - /* Call win32k directly */ - return NtGdiDdReleaseDC((HANDLE) pSurfaceLocal->hDDSurface); -#endif + IWineD3DSurface * pWineD3DSurface = (IWineD3DSurface*) pSurfaceLocal->hDDSurface; + + if (IWineD3DSurface_ReleaseDC( pWineD3DSurface, (HDC)pSurfaceLocal->hDC) == DD_OK) + return TRUE; + + return FALSE; } /*
16 years
1
0
0
0
← Newer
1
...
49
50
51
52
53
54
55
...
71
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
Results per page:
10
25
50
100
200