[PATCH 1/2] advapi32/tests: Add invalid paramater tests for AccessCheck.

Sebastian Lackner sebastian at fds-team.de
Mon Feb 15 14:59:42 CST 2016


On 15.02.2016 21:52, Qian Hong wrote:
> 
> Signed-off-by: Qian Hong <qhong at 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;
> 
> 
> 




More information about the wine-devel mailing list