Reactos
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
18BOOL
19StartRpcServer(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
56void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len)
57{
58 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
59}
60
61
62void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr)
63{
64 HeapFree(GetProcessHeap(), 0, ptr);
65}
66
67
68void __RPC_USER RPC_HKEY_rundown(RPC_HKEY hSCObject)
69{
70}
71
72
73/* Function 0 */
74error_status_t
75WINAPI
76OpenClassesRoot(
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 */
87error_status_t
88WINAPI
89OpenCurrentUser(
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 */
100error_status_t
101WINAPI
102OpenLocalMachine(
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 */
113error_status_t
114WINAPI
115OpenPerformanceData(
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 */
126error_status_t
127WINAPI
128OpenUsers(
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 */
139error_status_t
140WINAPI
141BaseRegCloseKey(
142 PRPC_HKEY hKey)
143{
144 TRACE("\n");
145 return ERROR_SUCCESS;
146}
147
148
149/* Function 6 */
150error_status_t
151WINAPI
152BaseRegCreateKey(
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 */
168error_status_t
169WINAPI
170BaseRegDeleteKey(
171 RPC_HKEY hKey,
172 PRPC_UNICODE_STRING lpSubKey)
173{
174 TRACE("\n");
175 return ERROR_SUCCESS;
176}
177
178
179/* Function 8 */
180error_status_t
181WINAPI
182BaseRegDeleteValue(
183 RPC_HKEY hKey,
184 PRPC_UNICODE_STRING lpValueName)
185{
186 TRACE("\n");
187 return ERROR_SUCCESS;
188}
189
190
191/* Function 9 */
192error_status_t
193WINAPI
194BaseRegEnumKey(
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 */
209error_status_t
210WINAPI
211BaseRegEnumValue(
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 */
227error_status_t
228__stdcall
229BaseRegFlushKey(
230 RPC_HKEY hKey)
231{
232 TRACE("\n");
233 return ERROR_SUCCESS;
234}
235
236
237/* Function 12 */
238error_status_t
239__stdcall
240BaseRegGetKeySecurity(
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 */
252error_status_t
253__stdcall
254BaseRegLoadKey(
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 */
265void
266__stdcall
267BaseRegNotifyChangeKeyValue(
268 handle_t IDL_handle)
269{
270 TRACE("\n");
271}
272
273
274/* Function 15 */
275error_status_t
276__stdcall
277BaseRegOpenKey(
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 */
290error_status_t
291__stdcall
292BaseRegQueryInfoKey(
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 */
311error_status_t
312__stdcall
313BaseRegQueryValue(
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 */
327error_status_t
328__stdcall
329BaseRegReplaceKey(
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 */
341error_status_t
342__stdcall
343BaseRegRestoreKey(
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 */
354error_status_t
355__stdcall
356BaseRegSaveKey(
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 */
367error_status_t
368__stdcall
369BaseRegSetKeySecurity(
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 */
380error_status_t
381__stdcall
382BaseRegSetValue(
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 */
395error_status_t
396__stdcall
397BaseRegUnLoadKey(
398 RPC_HKEY hKey,
399 PRPC_UNICODE_STRING lpSubKey)
400{
401 TRACE("\n");
402 return ERROR_SUCCESS;
403}
404
405
406/* Function 24 */
407ULONG
408__stdcall
409BaseInitiateSystemShutdown(
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 */
427ULONG
428__stdcall
429BaseAbortSystemShutdown(
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 */
441error_status_t
442__stdcall
443BaseRegGetVersion(
444 RPC_HKEY hKey,
445 LPDWORD lpdwVersion)
446{
447 TRACE("\n");
448 return ERROR_SUCCESS;
449}
450
451
452/* Function 27 */
453error_status_t
454__stdcall
455OpenCurrentConfig(
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 */
466void
467__stdcall
468OpenDynData(
469 handle_t IDL_handle)
470{
471 TRACE("\n");
472}
473
474
475/* Function 29 */
476error_status_t
477__stdcall
478BaseRegQueryMultipleValues(
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 */
492ULONG
493__stdcall
494BaseInitiateSystemShutdownEx(
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 */
520error_status_t
521__stdcall
522BaseRegSaveKeyEx(
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 */
534error_status_t
535__stdcall
536OpenPerformanceText(
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 */
547error_status_t
548__stdcall
549OpenPerformanceNlsText(
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 */
560error_status_t
561__stdcall
562BaseRegQueryMultipleValues2(
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 */
577error_status_t
578__stdcall
579BaseRegDeleteKeyEx(
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 */