LookupAccountNameW() any account but first user rejected

Rob Shearman robertshearman at gmail.com
Fri Sep 26 11:20:49 CDT 2008


2008/9/26 Paul Bryan Roberts <pbronline-wine at yahoo.co.uk>:
> +    if (!ADVAPI_IsLocalComputer(lpSystemName))
> +    {
> +        /*FIXME("Only local computer supported!\n");*/
> +        SetLastError(ERROR_NONE_MAPPED);
> +        return FALSE;
> +    }

There's no need to comment this FIXME out.

> @@ -2546,7 +2553,6 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName,
> LPCWSTR lpAccountName, PSI
>         if (!strcmpW(lpAccountName, ACCOUNT_SIDS[i].account))
>         {
>             char sidBuffer [SECURITY_MAX_SID_SIZE];
> -
>             size_t sidLen = SECURITY_MAX_SID_SIZE;

You should combine this whitespace change into the patch that
introduces the whitespace.

>
>             ret = CreateWellKnownSid(ACCOUNT_SIDS[i].type, NULL, sidBuffer,
> &sidLen);
> @@ -2583,6 +2589,26 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName,
> LPCWSTR lpAccountName, PSI
>         }
>     }
>
> +
> +    {
> +        WCHAR  userName [UNLEN + 1];
> +        size_t nameLen = UNLEN + 1;

Don't create a block for no reason.

Please make sure you're not using excessive stack space in this
function with all of these buffers on the stack.

Also, nameLen should be of type DWORD instead of size_t, which is
platform dependent and might not match the type of DWORD and cause
warnings when passing the address of the parameter to the function
below.

> +
> +        ret = GetUserNameW(userName, &nameLen);
> +
> +        if (ret && strcmpW(lpAccountName, userName) != 0)
> +        {
> +            /* FIXME("Only first user account supported!\n"); */
> +            SetLastError(ERROR_NONE_MAPPED);
> +            ret = FALSE;
> +        }
> +
> +        if (!ret)
> +        {
> +            return ret;
> +        }
> +    }
> +

-- 
Rob Shearman



More information about the wine-devel mailing list