[ADVAPI32][SECLOGON] Start the implementation of CreateProcessWithLogonW

This commit is contained in:
Eric Kohl 2022-02-21 16:38:29 +01:00
parent eb0830a1d6
commit f4982e547d
7 changed files with 151 additions and 18 deletions

View file

@ -17,6 +17,6 @@ add_library(seclogon MODULE
set_module_type(seclogon win32dll UNICODE)
target_link_libraries(seclogon wine ${PSEH_LIB})
add_importlibs(seclogon advapi32 rpcrt4 msvcrt kernel32 ntdll)
add_importlibs(seclogon userenv advapi32 rpcrt4 msvcrt kernel32 ntdll)
add_pch(seclogon precomp.h SOURCE)
add_cd_file(TARGET seclogon DESTINATION reactos/system32 FOR all)

View file

@ -20,6 +20,7 @@
#include <winreg.h>
#include <winsvc.h>
#include <svc.h>
#include <userenv.h>
#define NTOS_MODE_USER
#include <ndk/rtlfuncs.h>

View file

@ -59,6 +59,12 @@ SeclCreateProcessWithLogonW(
_In_ SECL_REQUEST *pRequest,
_Out_ SECL_RESPONSE *pResponse)
{
PROFILEINFOW ProfileInfo;
HANDLE hToken = NULL;
ULONG dwError = ERROR_SUCCESS;
BOOL rc;
TRACE("SeclCreateProcessWithLogonW(%p %p %p)\n", hBinding, pRequest, pResponse);
if (pRequest != NULL)
@ -69,12 +75,51 @@ SeclCreateProcessWithLogonW(
TRACE("ApplicationName: '%S'\n", pRequest->ApplicationName);
TRACE("CommandLine: '%S'\n", pRequest->CommandLine);
TRACE("CurrentDirectory: '%S'\n", pRequest->CurrentDirectory);
TRACE("LogonFlags: 0x%lx\n", pRequest->dwLogonFlags);
TRACE("CreationFlags: 0x%lx\n", pRequest->dwCreationFlags);
}
/* FIXME: Logon */
ZeroMemory(&ProfileInfo, sizeof(ProfileInfo));
/* Logon */
rc = LogonUser(pRequest->Username,
pRequest->Domain,
pRequest->Password,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&hToken);
if (rc == FALSE)
{
dwError = GetLastError();
WARN("LogonUser() failed with Error %lu\n", dwError);
goto done;
}
/* Load the user profile */
if (pRequest->dwLogonFlags & LOGON_WITH_PROFILE)
{
ProfileInfo.dwSize = sizeof(ProfileInfo);
ProfileInfo.lpUserName = pRequest->Username;
rc = LoadUserProfileW(hToken,
&ProfileInfo);
if (rc == FALSE)
{
dwError = GetLastError();
WARN("LoadUserProfile() failed with Error %lu\n", dwError);
goto done;
}
}
/* FIXME: Create Process */
done:
if (ProfileInfo.hProfile != NULL)
UnloadUserProfile(hToken, ProfileInfo.hProfile);
if (hToken != NULL)
CloseHandle(hToken);
if (pResponse != NULL)
pResponse->ulError = 4;
pResponse->ulError = dwError;
}