shlwapi/tests: Don't test function directly when reporting GetLastError() (try 2)
André Hentschel
nerv at dawncrow.de
Wed Dec 29 13:23:27 CST 2010
---
dlls/shlwapi/tests/istream.c | 31 ++++++++++++++++++-------------
dlls/shlwapi/tests/ordinal.c | 23 +++++++++++++----------
2 files changed, 31 insertions(+), 23 deletions(-)
diff --git a/dlls/shlwapi/tests/istream.c b/dlls/shlwapi/tests/istream.c
index 4a36b3a..f525d7c 100644
--- a/dlls/shlwapi/tests/istream.c
+++ b/dlls/shlwapi/tests/istream.c
@@ -281,12 +281,15 @@ static void test_SHCreateStreamOnFileA(DWORD mode, DWORD stgm)
ok(stream != NULL, "SHCreateStreamOnFileA: expected a valid IStream object, got NULL\n");
if (stream) {
+ BOOL delret;
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileA: expected 0, got %d\n", refcount);
- ok(DeleteFileA(test_file), "SHCreateStreamOnFileA: could not delete file '%s', got error %d\n", test_file, GetLastError());
+ delret = DeleteFileA(test_file);
+ ok(delret, "SHCreateStreamOnFileA: could not delete file '%s', got error %d\n",
+ test_file, GetLastError());
}
}
@@ -388,14 +391,15 @@ static void test_SHCreateStreamOnFileW(DWORD mode, DWORD stgm)
ok(stream != NULL, "SHCreateStreamOnFileW: expected a valid IStream object, got NULL\n");
if (stream) {
+ BOOL delret;
test_IStream_invalid_operations(stream, mode);
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileW: expected 0, got %d\n", refcount);
- ok(DeleteFileA(test_fileA),
- "SHCreateStreamOnFileW: could not delete the test file, got error %d\n",
- GetLastError());
+ delret = DeleteFileA(test_fileA);
+ ok(delret, "SHCreateStreamOnFileW: could not delete the test file, got error %d\n",
+ GetLastError());
}
}
@@ -409,6 +413,7 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
WCHAR test_file[MAX_PATH];
CHAR test_fileA[MAX_PATH];
static const CHAR testEx_txt[] = "\\testEx.txt";
+ BOOL delret;
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm);
@@ -489,9 +494,9 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
- ok(DeleteFileA(test_fileA),
- "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
- GetLastError());
+ delret = DeleteFileA(test_fileA);
+ ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+ GetLastError());
}
stream = NULL;
@@ -510,9 +515,9 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
refcount = IStream_Release(stream);
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
- ok(DeleteFileA(test_fileA),
- "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
- GetLastError());
+ delret = DeleteFileA(test_fileA);
+ ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+ GetLastError());
}
stream = NULL;
@@ -577,9 +582,9 @@ static void test_SHCreateStreamOnFileEx(DWORD mode, DWORD stgm)
ok(refcount == 0, "SHCreateStreamOnFileEx: expected 0, got %d\n", refcount);
}
- ok(DeleteFileA(test_fileA),
- "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
- GetLastError());
+ delret = DeleteFileA(test_fileA);
+ ok(delret, "SHCreateStreamOnFileEx: could not delete the test file, got error %d\n",
+ GetLastError());
}
diff --git a/dlls/shlwapi/tests/ordinal.c b/dlls/shlwapi/tests/ordinal.c
index 97c844b..fc4bcf4 100644
--- a/dlls/shlwapi/tests/ordinal.c
+++ b/dlls/shlwapi/tests/ordinal.c
@@ -636,19 +636,19 @@ static void test_GetShellSecurityDescriptor(void)
ok(psd!=NULL, "GetShellSecurityDescriptor failed\n");
if (psd!=NULL)
{
- BOOL bHasDacl = FALSE, bDefaulted;
+ BOOL bHasDacl = FALSE, bDefaulted, ret;
PACL pAcl;
DWORD dwRev;
SECURITY_DESCRIPTOR_CONTROL control;
ok(IsValidSecurityDescriptor(psd), "returned value is not valid SD\n");
- ok(GetSecurityDescriptorControl(psd, &control, &dwRev),
- "GetSecurityDescriptorControl failed with error %u\n", GetLastError());
+ ret = GetSecurityDescriptorControl(psd, &control, &dwRev);
+ ok(ret, "GetSecurityDescriptorControl failed with error %u\n", GetLastError());
ok(0 == (control & SE_SELF_RELATIVE), "SD should be absolute\n");
- ok(GetSecurityDescriptorDacl(psd, &bHasDacl, &pAcl, &bDefaulted),
- "GetSecurityDescriptorDacl failed with error %u\n", GetLastError());
+ ret = GetSecurityDescriptorDacl(psd, &bHasDacl, &pAcl, &bDefaulted);
+ ok(ret, "GetSecurityDescriptorDacl failed with error %u\n", GetLastError());
ok(bHasDacl, "SD has no DACL\n");
if (bHasDacl)
@@ -662,28 +662,31 @@ static void test_GetShellSecurityDescriptor(void)
ok(IsValidAcl(pAcl), "DACL is not valid\n");
- ok(GetAclInformation(pAcl, &asiSize, sizeof(asiSize), AclSizeInformation),
- "GetAclInformation failed with error %u\n", GetLastError());
+ ret = GetAclInformation(pAcl, &asiSize, sizeof(asiSize), AclSizeInformation);
+ ok(ret, "GetAclInformation failed with error %u\n", GetLastError());
ok(asiSize.AceCount == 3, "Incorrect number of ACEs: %d entries\n", asiSize.AceCount);
if (asiSize.AceCount == 3)
{
ACCESS_ALLOWED_ACE *paaa; /* will use for DENIED too */
- ok(GetAce(pAcl, 0, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
+ ret = GetAce(pAcl, 0, (LPVOID*)&paaa);
+ ok(ret, "GetAce failed with error %u\n", GetLastError());
ok(paaa->Header.AceType == ACCESS_ALLOWED_ACE_TYPE,
"Invalid ACE type %d\n", paaa->Header.AceType);
ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
ok(paaa->Mask == GENERIC_ALL, "Invalid ACE mask %x\n", paaa->Mask);
- ok(GetAce(pAcl, 1, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
+ ret = GetAce(pAcl, 1, (LPVOID*)&paaa);
+ ok(ret, "GetAce failed with error %u\n", GetLastError());
ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE,
"Invalid ACE type %d\n", paaa->Header.AceType);
/* first one of two ACEs generated from inheritable entry - without inheritance */
ok(paaa->Header.AceFlags == 0, "Invalid ACE flags %x\n", paaa->Header.AceFlags);
ok(paaa->Mask == GENERIC_WRITE, "Invalid ACE mask %x\n", paaa->Mask);
- ok(GetAce(pAcl, 2, (LPVOID*)&paaa), "GetAce failed with error %u\n", GetLastError());
+ ret = GetAce(pAcl, 2, (LPVOID*)&paaa);
+ ok(ret, "GetAce failed with error %u\n", GetLastError());
ok(paaa->Header.AceType == ACCESS_DENIED_ACE_TYPE,
"Invalid ACE type %d\n", paaa->Header.AceType);
/* second ACE - with inheritance */
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list