ReactOS  0.4.15-dev-4872-g8a3db97
rpcserver.c File Reference
#include "precomp.h"
#include <seclogon_s.h>
Include dependency graph for rpcserver.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (seclogon)
 
void __RPC_FAR *__RPC_USER midl_user_allocate (SIZE_T len)
 
void __RPC_USER midl_user_free (void __RPC_FAR *ptr)
 
DWORD StartRpcServer (VOID)
 
DWORD StopRpcServer (VOID)
 
VOID __stdcall SeclCreateProcessWithLogonW (_In_ handle_t hBinding, _In_ SECL_REQUEST *pRequest, _Out_ SECL_RESPONSE *pResponse)
 

Function Documentation

◆ midl_user_allocate()

void __RPC_FAR* __RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 19 of file rpcserver.c.

20 {
22 }
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
#define HEAP_ZERO_MEMORY
Definition: compat.h:134

◆ midl_user_free()

void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 25 of file rpcserver.c.

26 {
28 }
static PVOID ptr
Definition: dispmode.c:27
#define GetProcessHeap()
Definition: compat.h:595
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ SeclCreateProcessWithLogonW()

VOID __stdcall SeclCreateProcessWithLogonW ( _In_ handle_t  hBinding,
_In_ SECL_REQUEST pRequest,
_Out_ SECL_RESPONSE pResponse 
)

Definition at line 57 of file rpcserver.c.

61 {
62  STARTUPINFOW StartupInfo;
63  PROCESS_INFORMATION ProcessInfo;
64 
65  PROFILEINFOW ProfileInfo;
66  HANDLE hToken = NULL;
67 
68  ULONG dwError = ERROR_SUCCESS;
69  BOOL rc;
70 
71  TRACE("SeclCreateProcessWithLogonW(%p %p %p)\n", hBinding, pRequest, pResponse);
72 
73  if (pRequest != NULL)
74  {
75  TRACE("Username: '%S'\n", pRequest->Username);
76  TRACE("Domain: '%S'\n", pRequest->Domain);
77  TRACE("Password: '%S'\n", pRequest->Password);
78  TRACE("ApplicationName: '%S'\n", pRequest->ApplicationName);
79  TRACE("CommandLine: '%S'\n", pRequest->CommandLine);
80  TRACE("CurrentDirectory: '%S'\n", pRequest->CurrentDirectory);
81  TRACE("LogonFlags: 0x%lx\n", pRequest->dwLogonFlags);
82  TRACE("CreationFlags: 0x%lx\n", pRequest->dwCreationFlags);
83  }
84 
85  ZeroMemory(&ProfileInfo, sizeof(ProfileInfo));
86 
87  /* Logon */
88  rc = LogonUser(pRequest->Username,
89  pRequest->Domain,
90  pRequest->Password,
93  &hToken);
94  if (rc == FALSE)
95  {
96  dwError = GetLastError();
97  WARN("LogonUser() failed with Error %lu\n", dwError);
98  goto done;
99  }
100 
101  /* Load the user profile */
102  if (pRequest->dwLogonFlags & LOGON_WITH_PROFILE)
103  {
104  ProfileInfo.dwSize = sizeof(ProfileInfo);
105  ProfileInfo.lpUserName = pRequest->Username;
106 
107  rc = LoadUserProfileW(hToken,
108  &ProfileInfo);
109  if (rc == FALSE)
110  {
111  dwError = GetLastError();
112  WARN("LoadUserProfile() failed with Error %lu\n", dwError);
113  goto done;
114  }
115  }
116 
117  ZeroMemory(&StartupInfo, sizeof(StartupInfo));
118  StartupInfo.cb = sizeof(StartupInfo);
119 
120  /* FIXME: Get startup info from the caller */
121 
122  ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
123 
124  /* Create Process */
125  rc = CreateProcessAsUserW(hToken,
126  pRequest->ApplicationName,
127  pRequest->CommandLine,
128  NULL, // lpProcessAttributes,
129  NULL, // lpThreadAttributes,
130  FALSE, // bInheritHandles,
131  pRequest->dwCreationFlags,
132  NULL, // lpEnvironment,
133  pRequest->CurrentDirectory,
134  &StartupInfo,
135  &ProcessInfo);
136  if (rc == FALSE)
137  {
138  dwError = GetLastError();
139  WARN("CreateProcessAsUser() failed with Error %lu\n", dwError);
140  goto done;
141  }
142 
143  /* FIXME: Pass process info to the caller */
144 
145 done:
146  if (ProcessInfo.hThread)
147  CloseHandle(ProcessInfo.hThread);
148 
149  if (ProcessInfo.hProcess)
150  CloseHandle(ProcessInfo.hProcess);
151 
152  if (ProfileInfo.hProfile != NULL)
153  UnloadUserProfile(hToken, ProfileInfo.hProfile);
154 
155  if (hToken != NULL)
156  CloseHandle(hToken);
157 
158  if (pResponse != NULL)
159  pResponse->ulError = dwError;
160 }
#define CloseHandle
Definition: compat.h:598
HANDLE hProfile
Definition: userenv.h:43
#define ERROR_SUCCESS
Definition: deptool.c:10
handle_t hBinding
Definition: ctx_c.c:54
#define WARN(fmt,...)
Definition: debug.h:112
FxRequest * pRequest
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
BOOL WINAPI UnloadUserProfile(_In_ HANDLE hToken, _In_ HANDLE hProfile)
Definition: profile.c:2184
LPWSTR lpUserName
Definition: userenv.h:38
#define LogonUser
Definition: winbase.h:3725
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
DWORD cb
Definition: winbase.h:849
#define LOGON_WITH_PROFILE
Definition: winbase.h:616
DWORD dwSize
Definition: userenv.h:36
#define LOGON32_LOGON_INTERACTIVE
Definition: winbase.h:388
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessAsUserW(_In_opt_ HANDLE hToken, _In_opt_ LPCWSTR lpApplicationName, _Inout_opt_ LPWSTR lpCommandLine, _In_opt_ LPSECURITY_ATTRIBUTES lpProcessAttributes, _In_opt_ LPSECURITY_ATTRIBUTES lpThreadAttributes, _In_ BOOL bInheritHandles, _In_ DWORD dwCreationFlags, _In_opt_ LPVOID lpEnvironment, _In_opt_ LPCWSTR lpCurrentDirectory, _In_ LPSTARTUPINFOW lpStartupInfo, _Out_ LPPROCESS_INFORMATION lpProcessInformation)
Definition: logon.c:993
#define NULL
Definition: types.h:112
BOOL WINAPI LoadUserProfileW(_In_ HANDLE hToken, _Inout_ LPPROFILEINFOW lpProfileInfo)
Definition: profile.c:2005
unsigned int ULONG
Definition: retypes.h:1
#define LOGON32_PROVIDER_DEFAULT
Definition: winbase.h:384

Referenced by CreateProcessWithLogonW().

◆ StartRpcServer()

DWORD StartRpcServer ( VOID  )

Definition at line 32 of file rpcserver.c.

33 {
35 
36  Status = lpServiceGlobals->StartRpcServer(L"seclogon", ISeclogon_v1_0_s_ifspec);
37  TRACE("StartRpcServer returned 0x%08lx\n", Status);
38 
40 }
PSVCHOST_GLOBAL_DATA lpServiceGlobals
Definition: seclogon.c:18
LONG NTSTATUS
Definition: precomp.h:26
#define L(x)
Definition: ntvdm.h:50
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
PSTART_RPC_SERVER StartRpcServer
Definition: svc.h:114

◆ StopRpcServer()

DWORD StopRpcServer ( VOID  )

Definition at line 44 of file rpcserver.c.

45 {
47 
48  Status = lpServiceGlobals->StopRpcServer(ISeclogon_v1_0_s_ifspec);
49  TRACE("StopRpcServer returned 0x%08lx\n", Status);
50 
52 }
PSVCHOST_GLOBAL_DATA lpServiceGlobals
Definition: seclogon.c:18
LONG NTSTATUS
Definition: precomp.h:26
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
Status
Definition: gdiplustypes.h:24
#define TRACE(s)
Definition: solgame.cpp:4
PSTOP_RPC_SERVER StopRpcServer
Definition: svc.h:115

Referenced by ServiceControlHandlerEx().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( seclogon  )