launcher: add %P variable (user profile directory)

This commit is contained in:
Bill Zissimopoulos 2020-04-25 11:36:30 -07:00
parent 26630ad7aa
commit 768b596a76
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3

View File

@ -910,7 +910,7 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
DWORD ClientTokenInformation = -1;
SECURITY_ATTRIBUTES StderrSecurityAttributes = { sizeof(SECURITY_ATTRIBUTES), 0, TRUE };
FSP_LAUNCH_REG_RECORD *Record = 0;
WCHAR CurrentTime[32], CommandLine[512], Security[512];
WCHAR CurrentTime[32], UserProfileDir[MAX_PATH], CommandLine[512], Security[512];
DWORD Length, ClassNameSize, InstanceNameSize;
PSECURITY_DESCRIPTOR SecurityDescriptor = 0, NewSecurityDescriptor;
PROCESS_INFORMATION ProcessInfo;
@ -948,6 +948,12 @@ NTSTATUS SvcInstanceCreate(HANDLE ClientToken,
goto exit;
Varv[L'U' - L'A'] = ClientUserName;
Length = MAX_PATH;
if (!GetUserProfileDirectoryW(ClientToken, UserProfileDir, &Length))
/* store an invalid filename; any attempt to use it will fail */
lstrcpyW(UserProfileDir, L":INVALID:");
Varv[L'P' - L'A'] = UserProfileDir;
Result = FspLaunchRegGetRecord(ClassName, 0, &Record);
if (!NT_SUCCESS(Result))
goto exit;