Create the AHCI branch for Aman's work
[reactos.git] / dll / win32 / netapi32 / srvsvc.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: NetAPI DLL
4 * FILE: reactos/dll/win32/netapi32/schedule.c
5 * PURPOSE: Server service interface code
6 *
7 * PROGRAMMERS: Eric Kohl
8 */
9
10 /* INCLUDES ******************************************************************/
11
12 #include "netapi32.h"
13 #include "srvsvc_c.h"
14
15 WINE_DEFAULT_DEBUG_CHANNEL(netapi32);
16
17 /* FUNCTIONS *****************************************************************/
18
19 handle_t __RPC_USER
20 SRVSVC_HANDLE_bind(SRVSVC_HANDLE pszSystemName)
21 {
22 handle_t hBinding = NULL;
23 LPWSTR pszStringBinding;
24 RPC_STATUS status;
25
26 TRACE("SRVSVC_HANDLE_bind() called\n");
27
28 status = RpcStringBindingComposeW(NULL,
29 L"ncacn_np",
30 (RPC_WSTR)pszSystemName,
31 L"\\pipe\\srvsvc",
32 NULL,
33 &pszStringBinding);
34 if (status)
35 {
36 TRACE("RpcStringBindingCompose returned 0x%x\n", status);
37 return NULL;
38 }
39
40 /* Set the binding handle that will be used to bind to the server. */
41 status = RpcBindingFromStringBindingW(pszStringBinding,
42 &hBinding);
43 if (status)
44 {
45 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
46 }
47
48 status = RpcStringFreeW(&pszStringBinding);
49 if (status)
50 {
51 // TRACE("RpcStringFree returned 0x%x\n", status);
52 }
53
54 return hBinding;
55 }
56
57
58 void __RPC_USER
59 SRVSVC_HANDLE_unbind(SRVSVC_HANDLE pszSystemName,
60 handle_t hBinding)
61 {
62 RPC_STATUS status;
63
64 TRACE("SRVSVC_HANDLE_unbind() called\n");
65
66 status = RpcBindingFree(&hBinding);
67 if (status)
68 {
69 TRACE("RpcBindingFree returned 0x%x\n", status);
70 }
71 }
72
73
74 NET_API_STATUS
75 WINAPI
76 NetRemoteTOD(
77 LPCWSTR UncServerName,
78 LPBYTE *BufferPtr)
79 {
80 NET_API_STATUS status;
81
82 TRACE("NetRemoteTOD(%s, %p)\n", debugstr_w(UncServerName),
83 BufferPtr);
84
85 *BufferPtr = NULL;
86
87 RpcTryExcept
88 {
89 status = NetrRemoteTOD((SRVSVC_HANDLE)UncServerName,
90 (LPTIME_OF_DAY_INFO *)BufferPtr);
91 }
92 RpcExcept(EXCEPTION_EXECUTE_HANDLER)
93 {
94 status = I_RpcMapWin32Status(RpcExceptionCode());
95 }
96 RpcEndExcept;
97
98 return status;
99 }
100
101 /* EOF */