Commit 4365b348 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Allocate token information buffer dynamically.

parent f0d1d61d
......@@ -516,15 +516,19 @@ static void create_test_guid(LPSTR prodcode, LPSTR squashed)
static void get_user_sid(LPSTR *usersid)
{
HANDLE token;
BYTE buf[1024];
DWORD size;
PTOKEN_USER user;
OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token);
size = sizeof(buf);
GetTokenInformation(token, TokenUser, buf, size, &size);
user = (PTOKEN_USER)buf;
size = 0;
GetTokenInformation(token, TokenUser, NULL, size, &size);
user = HeapAlloc(GetProcessHeap(), 0, size);
GetTokenInformation(token, TokenUser, user, size, &size);
pConvertSidToStringSidA(user->User.Sid, usersid);
HeapFree(GetProcessHeap(), 0, user);
CloseHandle(token);
}
......
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