Commit 8ae81d06 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Set the UserSID property.

parent 19a49eb5
......@@ -41,6 +41,7 @@
#include "wine/unicode.h"
#include "objbase.h"
#include "msidefs.h"
#include "sddl.h"
#include "msipriv.h"
......@@ -113,6 +114,56 @@ static UINT set_installed_prop( MSIPACKAGE *package )
return r;
}
static UINT set_user_sid_prop( MSIPACKAGE *package )
{
SID_NAME_USE use;
LPWSTR user_name;
LPWSTR sid_str, dom = NULL;
DWORD size, dom_size;
PSID psid = NULL;
UINT r = ERROR_FUNCTION_FAILED;
static const WCHAR user_sid[] = {'U','s','e','r','S','I','D',0};
size = 0;
GetUserNameW( NULL, &size );
user_name = msi_alloc( (size + 1) * sizeof(WCHAR) );
if (!user_name)
return ERROR_OUTOFMEMORY;
if (!GetUserNameW( user_name, &size ))
goto done;
size = 0;
dom_size = 0;
LookupAccountNameW( NULL, user_name, NULL, &size, NULL, &dom_size, &use );
psid = msi_alloc( size );
dom = msi_alloc( dom_size );
if (!psid || !dom)
{
r = ERROR_OUTOFMEMORY;
goto done;
}
if (!LookupAccountNameW( NULL, user_name, psid, &size, dom, &dom_size, &use ))
goto done;
if (!ConvertSidToStringSidW( psid, &sid_str ))
goto done;
r = MSI_SetPropertyW( package, user_sid, sid_str );
done:
LocalFree( sid_str );
msi_free( dom );
msi_free( psid );
msi_free( user_name );
return r;
}
/*
* There are a whole slew of these we need to set
*
......@@ -379,6 +430,9 @@ static VOID set_installer_properties(MSIPACKAGE *package)
msi_free( company );
}
if ( set_user_sid_prop( package ) != ERROR_SUCCESS)
ERR("Failed to set the UserSID property\n");
msi_free( check );
CloseHandle( hkey );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment