Re: [PATCH 1/2] advapi32/tests: Add invalid paramater tests for AccessCheck.
On 15.02.2016 21:52, Qian Hong wrote:
Signed-off-by: Qian Hong <qhong(a)codeweavers.com> --- dlls/advapi32/tests/security.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
0001-advapi32-tests-Add-invalid-paramater-tests-for-AccessC.txt
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 742ede1..69c0f77 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -1411,6 +1411,59 @@ static void test_AccessCheck(void) GetLastError()); trace("AccessCheck with MAXIMUM_ALLOWED got Access 0x%08x\n", Access);
+ /* Null PrivSet with null PrivSetLen pointer */ + SetLastError(0xdeadbeef); + Access = AccessStatus = 0x1abe11ed; + ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, + NULL, NULL, &Access, &AccessStatus); + err = GetLastError(); + ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have " + "failed with ERROR_NOACCESS, instead of %d\n", err); + ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, + "Access and/or AccessStatus were changed!\n"); + + /* Null PrivSet with zero PrivSetLen */ + SetLastError(0xdeadbeef); + Access = AccessStatus = 0x1abe11ed; + PrivSetLen = 0; + ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, + 0, &PrivSetLen, &Access, &AccessStatus); + err = GetLastError(); +todo_wine + ok(!ret && err == ERROR_INSUFFICIENT_BUFFER, "AccessCheck should have " + "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); +todo_wine + ok(PrivSetLen == sizeof(PRIVILEGE_SET), "PrivSetLen returns %d, expects %d\n", PrivSetLen, sizeof(PRIVILEGE_SET));
This will lead to compile warnings on 64-bit.
+ ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, + "Access and/or AccessStatus were changed!\n"); + + /* Valid PrivSet with zero PrivSetLen */ + SetLastError(0xdeadbeef); + Access = AccessStatus = 0x1abe11ed; + PrivSetLen = 0; + ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, + PrivSet, &PrivSetLen, &Access, &AccessStatus); + err = GetLastError(); +todo_wine + ok(!ret && err == ERROR_INSUFFICIENT_BUFFER, "AccessCheck should have " + "failed with ERROR_INSUFFICIENT_BUFFER, instead of %d\n", err); +todo_wine + ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, + "Access and/or AccessStatus were changed!\n"); + + PrivSetLen = FIELD_OFFSET(PRIVILEGE_SET, Privilege[16]); + + /* Null PrivSet with valid PrivSetLen */ + SetLastError(0xdeadbeef); + Access = AccessStatus = 0x1abe11ed; + ret = AccessCheck(SecurityDescriptor, Token, KEY_READ, &Mapping, + 0, &PrivSetLen, &Access, &AccessStatus); + err = GetLastError(); + ok(!ret && err == ERROR_NOACCESS, "AccessCheck should have " + "failed with ERROR_NOACCESS, instead of %d\n", err); + ok(Access == 0x1abe11ed && AccessStatus == 0x1abe11ed, + "Access and/or AccessStatus were changed!\n"); + /* Access denied by SD */ SetLastError(0xdeadbeef); Access = AccessStatus = 0x1abe11ed;
On Tue, Feb 16, 2016 at 4:59 AM, Sebastian Lackner <sebastian(a)fds-team.de> wrote:
This will lead to compile warnings on 64-bit.
Thanks, I forgot to change this bit, will resent an updated version soon... -- Regards, Qian Hong - http://www.codeweavers.com
On Wed, Feb 17, 2016 at 5:31 PM, Qian Hong <qhong(a)codeweavers.com> wrote:
Thanks, I forgot to change this bit, will resent an updated version soon...
Update: Alexandre removed the sizeof() part of the patch, so the current code and following patch does not lead to compile warnings on 64-bit anymore. Thanks as well for pointing out that, sorry for delay reply. -- Regards, Qian Hong - http://www.codeweavers.com
participants (2)
-
Qian Hong -
Sebastian Lackner