mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[SECLOGON][ADVAPI] CreateProcessWithLogonW: Return process information to the caller
This commit is contained in:
parent
bfe959e62c
commit
23ecbb3ed5
3 changed files with 60 additions and 8 deletions
|
@ -64,6 +64,7 @@ SeclCreateProcessWithLogonW(
|
||||||
|
|
||||||
PROFILEINFOW ProfileInfo;
|
PROFILEINFOW ProfileInfo;
|
||||||
HANDLE hToken = NULL;
|
HANDLE hToken = NULL;
|
||||||
|
HANDLE hTargetProcessHandle = NULL;
|
||||||
|
|
||||||
ULONG dwError = ERROR_SUCCESS;
|
ULONG dwError = ERROR_SUCCESS;
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
|
@ -80,6 +81,17 @@ SeclCreateProcessWithLogonW(
|
||||||
TRACE("CurrentDirectory: '%S'\n", pRequest->CurrentDirectory);
|
TRACE("CurrentDirectory: '%S'\n", pRequest->CurrentDirectory);
|
||||||
TRACE("LogonFlags: 0x%lx\n", pRequest->dwLogonFlags);
|
TRACE("LogonFlags: 0x%lx\n", pRequest->dwLogonFlags);
|
||||||
TRACE("CreationFlags: 0x%lx\n", pRequest->dwCreationFlags);
|
TRACE("CreationFlags: 0x%lx\n", pRequest->dwCreationFlags);
|
||||||
|
TRACE("ProcessId: %lu\n", pRequest->dwProcessId);
|
||||||
|
}
|
||||||
|
|
||||||
|
hTargetProcessHandle = OpenProcess(PROCESS_DUP_HANDLE,
|
||||||
|
FALSE,
|
||||||
|
pRequest->dwProcessId);
|
||||||
|
if (hTargetProcessHandle == NULL)
|
||||||
|
{
|
||||||
|
dwError = GetLastError();
|
||||||
|
WARN("OpenProcess() failed with Error %lu\n", dwError);
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&ProfileInfo, sizeof(ProfileInfo));
|
ZeroMemory(&ProfileInfo, sizeof(ProfileInfo));
|
||||||
|
@ -140,9 +152,33 @@ SeclCreateProcessWithLogonW(
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Pass process info to the caller */
|
/* Return process info to the caller */
|
||||||
|
if (pResponse != NULL)
|
||||||
|
{
|
||||||
|
DuplicateHandle(GetCurrentProcess(),
|
||||||
|
ProcessInfo.hProcess,
|
||||||
|
hTargetProcessHandle,
|
||||||
|
(PHANDLE)&pResponse->hProcess,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
|
||||||
|
DuplicateHandle(GetCurrentProcess(),
|
||||||
|
ProcessInfo.hThread,
|
||||||
|
hTargetProcessHandle,
|
||||||
|
(PHANDLE)&pResponse->hThread,
|
||||||
|
0,
|
||||||
|
FALSE,
|
||||||
|
DUPLICATE_SAME_ACCESS);
|
||||||
|
|
||||||
|
pResponse->dwProcessId = ProcessInfo.dwProcessId;
|
||||||
|
pResponse->dwThreadId = ProcessInfo.dwThreadId;
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (hTargetProcessHandle)
|
||||||
|
CloseHandle(hTargetProcessHandle);
|
||||||
|
|
||||||
if (ProcessInfo.hThread)
|
if (ProcessInfo.hThread)
|
||||||
CloseHandle(ProcessInfo.hThread);
|
CloseHandle(ProcessInfo.hThread);
|
||||||
|
|
||||||
|
@ -156,5 +192,5 @@ done:
|
||||||
CloseHandle(hToken);
|
CloseHandle(hToken);
|
||||||
|
|
||||||
if (pResponse != NULL)
|
if (pResponse != NULL)
|
||||||
pResponse->ulError = dwError;
|
pResponse->dwError = dwError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3538,7 +3538,14 @@ CreateProcessWithLogonW(
|
||||||
Request.dwLogonFlags = dwLogonFlags;
|
Request.dwLogonFlags = dwLogonFlags;
|
||||||
Request.dwCreationFlags = dwCreationFlags;
|
Request.dwCreationFlags = dwCreationFlags;
|
||||||
|
|
||||||
Response.ulError = ERROR_SUCCESS;
|
Request.dwProcessId = GetCurrentProcessId();
|
||||||
|
TRACE("Request.dwProcessId %lu\n", Request.dwProcessId);
|
||||||
|
|
||||||
|
Response.hProcess = 0;
|
||||||
|
Response.hThread = 0;
|
||||||
|
Response.dwProcessId = 0;
|
||||||
|
Response.dwThreadId = 0;
|
||||||
|
Response.dwError = ERROR_SUCCESS;
|
||||||
|
|
||||||
RpcTryExcept
|
RpcTryExcept
|
||||||
{
|
{
|
||||||
|
@ -3561,13 +3568,17 @@ CreateProcessWithLogonW(
|
||||||
hBinding = NULL;
|
hBinding = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Response.ulError %lu\n", Response.ulError);
|
TRACE("Response.hProcess %p\n", Response.hProcess);
|
||||||
if (Response.ulError != ERROR_SUCCESS)
|
TRACE("Response.hThread %p\n", Response.hThread);
|
||||||
SetLastError(Response.ulError);
|
TRACE("Response.dwProcessId %lu\n", Response.dwProcessId);
|
||||||
|
TRACE("Response.dwThreadId %lu\n", Response.dwThreadId);
|
||||||
|
TRACE("Response.dwError %lu\n", Response.dwError);
|
||||||
|
if (Response.dwError != ERROR_SUCCESS)
|
||||||
|
SetLastError(Response.dwError);
|
||||||
|
|
||||||
TRACE("CreateProcessWithLogonW() done\n");
|
TRACE("CreateProcessWithLogonW() done\n");
|
||||||
|
|
||||||
return (Response.ulError == ERROR_SUCCESS);
|
return (Response.dwError == ERROR_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI CreateProcessWithTokenW(HANDLE token, DWORD logon_flags, LPCWSTR application_name, LPWSTR command_line,
|
BOOL WINAPI CreateProcessWithTokenW(HANDLE token, DWORD logon_flags, LPCWSTR application_name, LPWSTR command_line,
|
||||||
|
|
|
@ -14,11 +14,16 @@ typedef struct _SECL_REQUEST
|
||||||
[string] WCHAR *CurrentDirectory;
|
[string] WCHAR *CurrentDirectory;
|
||||||
DWORD dwLogonFlags;
|
DWORD dwLogonFlags;
|
||||||
DWORD dwCreationFlags;
|
DWORD dwCreationFlags;
|
||||||
|
DWORD dwProcessId;
|
||||||
} SECL_REQUEST, *PSECL_REQUEST;
|
} SECL_REQUEST, *PSECL_REQUEST;
|
||||||
|
|
||||||
typedef struct _SECL_RESPONSE
|
typedef struct _SECL_RESPONSE
|
||||||
{
|
{
|
||||||
ULONG ulError;
|
DWORD_PTR hProcess;
|
||||||
|
DWORD_PTR hThread;
|
||||||
|
DWORD dwProcessId;
|
||||||
|
DWORD dwThreadId;
|
||||||
|
DWORD dwError;
|
||||||
} SECL_RESPONSE, *PSECL_RESPONSE;
|
} SECL_RESPONSE, *PSECL_RESPONSE;
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue