xref: /reactos/base/system/winlogon/rpcserver.c (revision 878db263)
1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS Winlogon
4  * FILE:            base/system/winlogon/rpcserver.c
5  * PURPOSE:         RPC server interface for the remote registry calls
6  * PROGRAMMERS:     Eric Kohl
7  */
8 
9 /* INCLUDES ******************************************************************/
10 
11 #include "winlogon.h"
12 
13 #include <rpc.h>
14 #include <winreg_s.h>
15 
16 /* FUNCTIONS *****************************************************************/
17 
18 BOOL
StartRpcServer(VOID)19 StartRpcServer(VOID)
20 {
21     RPC_STATUS Status;
22 
23     TRACE("StartRpcServer() called\n");
24 
25     Status = RpcServerUseProtseqEpW(L"ncacn_np",
26                                     RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
27                                     L"\\pipe\\winreg",
28                                     NULL);
29     if (Status != RPC_S_OK)
30     {
31         ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
32         return FALSE;
33     }
34 
35     Status = RpcServerRegisterIf(winreg_v1_0_s_ifspec,
36                                  NULL,
37                                  NULL);
38     if (Status != RPC_S_OK)
39     {
40         ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status);
41         return FALSE;
42     }
43 
44     Status = RpcServerListen(1, 20, TRUE);
45     if (Status != RPC_S_OK)
46     {
47         ERR("RpcServerListen() failed (Status %lx)\n", Status);
48         return FALSE;
49     }
50 
51     TRACE("StartRpcServer() done\n");
52     return TRUE;
53 }
54 
55 
MIDL_user_allocate(SIZE_T len)56 void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len)
57 {
58     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
59 }
60 
61 
MIDL_user_free(void __RPC_FAR * ptr)62 void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr)
63 {
64     HeapFree(GetProcessHeap(), 0, ptr);
65 }
66 
67 
RPC_HKEY_rundown(RPC_HKEY hSCObject)68 void __RPC_USER RPC_HKEY_rundown(RPC_HKEY hSCObject)
69 {
70 }
71 
72 
73 /* Function 0 */
74 error_status_t
75 WINAPI
OpenClassesRoot(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)76 OpenClassesRoot(
77     PREGISTRY_SERVER_NAME ServerName,
78     REGSAM samDesired,
79     PRPC_HKEY phKey)
80 {
81     TRACE("\n");
82     return ERROR_SUCCESS;
83 }
84 
85 
86 /* Function 1 */
87 error_status_t
88 WINAPI
OpenCurrentUser(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)89 OpenCurrentUser(
90     PREGISTRY_SERVER_NAME ServerName,
91     REGSAM samDesired,
92     PRPC_HKEY phKey)
93 {
94     TRACE("\n");
95     return ERROR_SUCCESS;
96 }
97 
98 
99 /* Function 2 */
100 error_status_t
101 WINAPI
OpenLocalMachine(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)102 OpenLocalMachine(
103     PREGISTRY_SERVER_NAME ServerName,
104     REGSAM samDesired,
105     PRPC_HKEY phKey)
106 {
107     TRACE("\n");
108     return ERROR_SUCCESS;
109 }
110 
111 
112 /* Function 3 */
113 error_status_t
114 WINAPI
OpenPerformanceData(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)115 OpenPerformanceData(
116     PREGISTRY_SERVER_NAME ServerName,
117     REGSAM samDesired,
118     PRPC_HKEY phKey)
119 {
120     TRACE("\n");
121     return ERROR_SUCCESS;
122 }
123 
124 
125 /* Function 4 */
126 error_status_t
127 WINAPI
OpenUsers(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)128 OpenUsers(
129     PREGISTRY_SERVER_NAME ServerName,
130     REGSAM samDesired,
131     PRPC_HKEY phKey)
132 {
133     TRACE("\n");
134     return ERROR_SUCCESS;
135 }
136 
137 
138 /* Function 5 */
139 error_status_t
140 WINAPI
BaseRegCloseKey(PRPC_HKEY hKey)141 BaseRegCloseKey(
142     PRPC_HKEY hKey)
143 {
144     TRACE("\n");
145     return ERROR_SUCCESS;
146 }
147 
148 
149 /* Function 6 */
150 error_status_t
151 WINAPI
BaseRegCreateKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey,PRPC_UNICODE_STRING lpClass,DWORD dwOptions,REGSAM samDesired,PRPC_SECURITY_ATTRIBUTES lpSecurityAttributes,PRPC_HKEY phkResult,LPDWORD lpdwDisposition)152 BaseRegCreateKey(
153     RPC_HKEY hKey,
154     PRPC_UNICODE_STRING lpSubKey,
155     PRPC_UNICODE_STRING lpClass,
156     DWORD dwOptions,
157     REGSAM samDesired,
158     PRPC_SECURITY_ATTRIBUTES lpSecurityAttributes,
159     PRPC_HKEY phkResult,
160     LPDWORD lpdwDisposition)
161 {
162     TRACE("\n");
163     return ERROR_SUCCESS;
164 }
165 
166 
167 /* Function 7 */
168 error_status_t
169 WINAPI
BaseRegDeleteKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey)170 BaseRegDeleteKey(
171     RPC_HKEY hKey,
172     PRPC_UNICODE_STRING lpSubKey)
173 {
174     TRACE("\n");
175     return ERROR_SUCCESS;
176 }
177 
178 
179 /* Function 8 */
180 error_status_t
181 WINAPI
BaseRegDeleteValue(RPC_HKEY hKey,PRPC_UNICODE_STRING lpValueName)182 BaseRegDeleteValue(
183     RPC_HKEY hKey,
184     PRPC_UNICODE_STRING lpValueName)
185 {
186     TRACE("\n");
187     return ERROR_SUCCESS;
188 }
189 
190 
191 /* Function 9 */
192 error_status_t
193 WINAPI
BaseRegEnumKey(RPC_HKEY hKey,DWORD dwIndex,PRPC_UNICODE_STRING lpNameIn,PRPC_UNICODE_STRING lpNameOut,PRPC_UNICODE_STRING lpClassIn,PRPC_UNICODE_STRING * lplpClassOut,PFILETIME lpftLastWriteTime)194 BaseRegEnumKey(
195     RPC_HKEY hKey,
196     DWORD dwIndex,
197     PRPC_UNICODE_STRING lpNameIn,
198     PRPC_UNICODE_STRING lpNameOut,
199     PRPC_UNICODE_STRING lpClassIn,
200     PRPC_UNICODE_STRING *lplpClassOut,
201     PFILETIME lpftLastWriteTime)
202 {
203     TRACE("\n");
204     return ERROR_SUCCESS;
205 }
206 
207 
208 /* Function 10 */
209 error_status_t
210 WINAPI
BaseRegEnumValue(RPC_HKEY hKey,DWORD dwIndex,PRPC_UNICODE_STRING lpValueNameIn,PRPC_UNICODE_STRING lpValueNameOut,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData,LPDWORD lpcbLen)211 BaseRegEnumValue(
212     RPC_HKEY hKey,
213     DWORD dwIndex,
214     PRPC_UNICODE_STRING lpValueNameIn,
215     PRPC_UNICODE_STRING lpValueNameOut,
216     LPDWORD lpType,
217     LPBYTE lpData,
218     LPDWORD lpcbData,
219     LPDWORD lpcbLen)
220 {
221     TRACE("\n");
222     return ERROR_SUCCESS;
223 }
224 
225 
226 /* Function 11 */
227 error_status_t
228 __stdcall
BaseRegFlushKey(RPC_HKEY hKey)229 BaseRegFlushKey(
230     RPC_HKEY hKey)
231 {
232     TRACE("\n");
233     return ERROR_SUCCESS;
234 }
235 
236 
237 /* Function 12 */
238 error_status_t
239 __stdcall
BaseRegGetKeySecurity(RPC_HKEY hKey,SECURITY_INFORMATION SecurityInformation,PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptorIn,PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptorOut)240 BaseRegGetKeySecurity(
241     RPC_HKEY hKey,
242     SECURITY_INFORMATION SecurityInformation,
243     PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptorIn,
244     PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptorOut)
245 {
246     TRACE("\n");
247     return ERROR_SUCCESS;
248 }
249 
250 
251 /* Function 13 */
252 error_status_t
253 __stdcall
BaseRegLoadKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey,PRPC_UNICODE_STRING lpFile)254 BaseRegLoadKey(
255     RPC_HKEY hKey,
256     PRPC_UNICODE_STRING lpSubKey,
257     PRPC_UNICODE_STRING lpFile)
258 {
259     TRACE("\n");
260     return ERROR_SUCCESS;
261 }
262 
263 
264 /* Function 14 - Not used on wire */
265 void
266 __stdcall
BaseRegNotifyChangeKeyValue(handle_t IDL_handle)267 BaseRegNotifyChangeKeyValue(
268     handle_t IDL_handle)
269 {
270     TRACE("\n");
271 }
272 
273 
274 /* Function 15 */
275 error_status_t
276 __stdcall
BaseRegOpenKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey,DWORD dwOptions,REGSAM samDesired,PRPC_HKEY phkResult)277 BaseRegOpenKey(
278     RPC_HKEY hKey,
279     PRPC_UNICODE_STRING lpSubKey,
280     DWORD dwOptions,
281     REGSAM samDesired,
282     PRPC_HKEY phkResult)
283 {
284     TRACE("\n");
285     return ERROR_SUCCESS;
286 }
287 
288 
289 /* Function 16 */
290 error_status_t
291 __stdcall
BaseRegQueryInfoKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpClassIn,PRPC_UNICODE_STRING lpClassOut,LPDWORD lpcSubKeys,LPDWORD lpcbMaxSubKeyLen,LPDWORD lpcbMaxClassLen,LPDWORD lpcValues,LPDWORD lpcbMaxValueNameLen,LPDWORD lpcbMaxValueLen,LPDWORD lpcbSecurityDescriptor,PFILETIME lpftLastWriteTime)292 BaseRegQueryInfoKey(
293     RPC_HKEY hKey,
294     PRPC_UNICODE_STRING lpClassIn,
295     PRPC_UNICODE_STRING lpClassOut,
296     LPDWORD lpcSubKeys,
297     LPDWORD lpcbMaxSubKeyLen,
298     LPDWORD lpcbMaxClassLen,
299     LPDWORD lpcValues,
300     LPDWORD lpcbMaxValueNameLen,
301     LPDWORD lpcbMaxValueLen,
302     LPDWORD lpcbSecurityDescriptor,
303     PFILETIME lpftLastWriteTime)
304 {
305     TRACE("\n");
306     return ERROR_SUCCESS;
307 }
308 
309 
310 /* Function 17 */
311 error_status_t
312 __stdcall
BaseRegQueryValue(RPC_HKEY hKey,PRPC_UNICODE_STRING lpValueName,LPDWORD lpType,LPBYTE lpData,LPDWORD lpcbData,LPDWORD lpcbLen)313 BaseRegQueryValue(
314     RPC_HKEY hKey,
315     PRPC_UNICODE_STRING lpValueName,
316     LPDWORD lpType,
317     LPBYTE lpData,
318     LPDWORD lpcbData,
319     LPDWORD lpcbLen)
320 {
321     TRACE("\n");
322     return ERROR_SUCCESS;
323 }
324 
325 
326 /* Function 18 */
327 error_status_t
328 __stdcall
BaseRegReplaceKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey,PRPC_UNICODE_STRING lpNewFile,PRPC_UNICODE_STRING lpOldFile)329 BaseRegReplaceKey(
330     RPC_HKEY hKey,
331     PRPC_UNICODE_STRING lpSubKey,
332     PRPC_UNICODE_STRING lpNewFile,
333     PRPC_UNICODE_STRING lpOldFile)
334 {
335     TRACE("\n");
336     return ERROR_SUCCESS;
337 }
338 
339 
340 /* Function 19 */
341 error_status_t
342 __stdcall
BaseRegRestoreKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpFile,DWORD Flags)343 BaseRegRestoreKey(
344     RPC_HKEY hKey,
345     PRPC_UNICODE_STRING lpFile,
346     DWORD Flags)
347 {
348     TRACE("\n");
349     return ERROR_SUCCESS;
350 }
351 
352 
353 /* Function 20 */
354 error_status_t
355 __stdcall
BaseRegSaveKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpFile,PRPC_SECURITY_ATTRIBUTES pSecurityAttributes)356 BaseRegSaveKey(
357     RPC_HKEY hKey,
358     PRPC_UNICODE_STRING lpFile,
359     PRPC_SECURITY_ATTRIBUTES pSecurityAttributes)
360 {
361     TRACE("\n");
362     return ERROR_SUCCESS;
363 }
364 
365 
366 /* Function 21 */
367 error_status_t
368 __stdcall
BaseRegSetKeySecurity(RPC_HKEY hKey,SECURITY_INFORMATION SecurityInformation,PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptor)369 BaseRegSetKeySecurity(
370     RPC_HKEY hKey,
371     SECURITY_INFORMATION SecurityInformation,
372     PRPC_SECURITY_DESCRIPTOR pRpcSecurityDescriptor)
373 {
374     TRACE("\n");
375     return ERROR_SUCCESS;
376 }
377 
378 
379 /* Function 22 */
380 error_status_t
381 __stdcall
BaseRegSetValue(RPC_HKEY hKey,PRPC_UNICODE_STRING lpValueName,DWORD dwType,LPBYTE lpData,DWORD cbData)382 BaseRegSetValue(
383     RPC_HKEY hKey,
384     PRPC_UNICODE_STRING lpValueName,
385     DWORD dwType,
386     LPBYTE lpData,
387     DWORD cbData)
388 {
389     TRACE("\n");
390     return ERROR_SUCCESS;
391 }
392 
393 
394 /* Function 23 */
395 error_status_t
396 __stdcall
BaseRegUnLoadKey(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey)397 BaseRegUnLoadKey(
398     RPC_HKEY hKey,
399     PRPC_UNICODE_STRING lpSubKey)
400 {
401     TRACE("\n");
402     return ERROR_SUCCESS;
403 }
404 
405 
406 /* Function 24 */
407 ULONG
408 __stdcall
BaseInitiateSystemShutdown(PREGISTRY_SERVER_NAME ServerName,PRPC_UNICODE_STRING lpMessage,ULONG dwTimeout,BOOLEAN bForceAppsClosed,BOOLEAN bRebootAfterShutdown)409 BaseInitiateSystemShutdown(
410     PREGISTRY_SERVER_NAME ServerName,
411     PRPC_UNICODE_STRING lpMessage,
412     ULONG dwTimeout,
413     BOOLEAN bForceAppsClosed,
414     BOOLEAN bRebootAfterShutdown)
415 {
416     TRACE("BaseInitiateSystemShutdown()\n");
417     return BaseInitiateSystemShutdownEx(ServerName,
418                                         lpMessage,
419                                         dwTimeout,
420                                         bForceAppsClosed,
421                                         bRebootAfterShutdown,
422                                         0);
423 }
424 
425 
426 /* Function 25 */
427 ULONG
428 __stdcall
BaseAbortSystemShutdown(PREGISTRY_SERVER_NAME ServerName)429 BaseAbortSystemShutdown(
430     PREGISTRY_SERVER_NAME ServerName)
431 {
432     TRACE("BaseAbortSystemShutdown()\n");
433 
434     //FIXME: Verify that the caller actually has the correct privileges
435 
436     return TerminateSystemShutdown();
437 }
438 
439 
440 /* Function 26 */
441 error_status_t
442 __stdcall
BaseRegGetVersion(RPC_HKEY hKey,LPDWORD lpdwVersion)443 BaseRegGetVersion(
444     RPC_HKEY hKey,
445     LPDWORD lpdwVersion)
446 {
447     TRACE("\n");
448     return ERROR_SUCCESS;
449 }
450 
451 
452 /* Function 27 */
453 error_status_t
454 __stdcall
OpenCurrentConfig(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)455 OpenCurrentConfig(
456     PREGISTRY_SERVER_NAME ServerName,
457     REGSAM samDesired,
458     PRPC_HKEY phKey)
459 {
460     TRACE("\n");
461     return ERROR_SUCCESS;
462 }
463 
464 
465 /* Function 28 - Not used on wire */
466 void
467 __stdcall
OpenDynData(handle_t IDL_handle)468 OpenDynData(
469     handle_t IDL_handle)
470 {
471     TRACE("\n");
472 }
473 
474 
475 /* Function 29 */
476 error_status_t
477 __stdcall
BaseRegQueryMultipleValues(RPC_HKEY hKey,PRVALENT val_listIn,PRVALENT val_listOut,DWORD num_vals,char * lpvalueBuf,LPDWORD ldwTotsize)478 BaseRegQueryMultipleValues(
479     RPC_HKEY hKey,
480     PRVALENT val_listIn,
481     PRVALENT val_listOut,
482     DWORD num_vals,
483     char *lpvalueBuf,
484     LPDWORD ldwTotsize)
485 {
486     TRACE("\n");
487     return ERROR_SUCCESS;
488 }
489 
490 
491 /* Function 30 */
492 ULONG
493 __stdcall
BaseInitiateSystemShutdownEx(PREGISTRY_SERVER_NAME ServerName,PRPC_UNICODE_STRING lpMessage,ULONG dwTimeout,BOOLEAN bForceAppsClosed,BOOLEAN bRebootAfterShutdown,ULONG dwReason)494 BaseInitiateSystemShutdownEx(
495     PREGISTRY_SERVER_NAME ServerName,
496     PRPC_UNICODE_STRING lpMessage,
497     ULONG dwTimeout,
498     BOOLEAN bForceAppsClosed,
499     BOOLEAN bRebootAfterShutdown,
500     ULONG dwReason)
501 {
502     TRACE("BaseInitiateSystemShutdownEx()\n");
503     TRACE("  Message: %wZ\n", lpMessage);
504     TRACE("  Timeout: %lu\n", dwTimeout);
505     TRACE("  Force: %d\n", bForceAppsClosed);
506     TRACE("  Reboot: %d\n", bRebootAfterShutdown);
507     TRACE("  Reason: %lu\n", dwReason);
508 
509     //FIXME: Verify that the caller actually has the correct privileges
510 
511     return StartSystemShutdown((PUNICODE_STRING)lpMessage,
512                                dwTimeout,
513                                bForceAppsClosed,
514                                bRebootAfterShutdown,
515                                dwReason);
516 }
517 
518 
519 /* Function 31 */
520 error_status_t
521 __stdcall
BaseRegSaveKeyEx(RPC_HKEY hKey,PRPC_UNICODE_STRING lpFile,PRPC_SECURITY_ATTRIBUTES pSecurityAttributes,DWORD Flags)522 BaseRegSaveKeyEx(
523     RPC_HKEY hKey,
524     PRPC_UNICODE_STRING lpFile,
525     PRPC_SECURITY_ATTRIBUTES pSecurityAttributes,
526     DWORD Flags)
527 {
528     TRACE("\n");
529     return ERROR_SUCCESS;
530 }
531 
532 
533 /* Function 32 */
534 error_status_t
535 __stdcall
OpenPerformanceText(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)536 OpenPerformanceText(
537     PREGISTRY_SERVER_NAME ServerName,
538     REGSAM samDesired,
539     PRPC_HKEY phKey)
540 {
541     TRACE("\n");
542     return ERROR_SUCCESS;
543 }
544 
545 
546 /* Function 33 */
547 error_status_t
548 __stdcall
OpenPerformanceNlsText(PREGISTRY_SERVER_NAME ServerName,REGSAM samDesired,PRPC_HKEY phKey)549 OpenPerformanceNlsText(
550     PREGISTRY_SERVER_NAME ServerName,
551     REGSAM samDesired,
552     PRPC_HKEY phKey)
553 {
554     TRACE("\n");
555     return ERROR_SUCCESS;
556 }
557 
558 
559 /* Function 34 */
560 error_status_t
561 __stdcall
BaseRegQueryMultipleValues2(RPC_HKEY hKey,PRVALENT val_listIn,PRVALENT val_listOut,DWORD num_vals,char * lpvalueBuf,LPDWORD ldwTotsize,LPDWORD ldwRequiredSize)562 BaseRegQueryMultipleValues2(
563     RPC_HKEY hKey,
564     PRVALENT val_listIn,
565     PRVALENT val_listOut,
566     DWORD num_vals,
567     char *lpvalueBuf,
568     LPDWORD ldwTotsize,
569     LPDWORD ldwRequiredSize)
570 {
571     TRACE("\n");
572     return ERROR_SUCCESS;
573 }
574 
575 
576 /* Function 35 */
577 error_status_t
578 __stdcall
BaseRegDeleteKeyEx(RPC_HKEY hKey,PRPC_UNICODE_STRING lpSubKey,REGSAM AccessMask,DWORD Reserved)579 BaseRegDeleteKeyEx(
580     RPC_HKEY hKey,
581     PRPC_UNICODE_STRING lpSubKey,
582     REGSAM AccessMask,
583     DWORD Reserved)
584 {
585     TRACE("\n");
586     return ERROR_SUCCESS;
587 }
588 
589 /* EOF */
590