2 * PROJECT: ReactOS DNS Resolver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/services/dnsrslvr/rpcserver.c
5 * PURPOSE: RPC server interface
6 * COPYRIGHT: Copyright 2016 Christoph von Wittich
16 RpcThreadRoutine(LPVOID lpParameter
)
20 Status
= RpcServerUseProtseqEpW(L
"ncalrpc", 20, L
"DNSResolver", NULL
);
21 if (Status
!= RPC_S_OK
)
23 DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status
);
27 Status
= RpcServerRegisterIf(DnsResolver_v2_0_s_ifspec
, NULL
, NULL
);
28 if (Status
!= RPC_S_OK
)
30 DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status
);
34 Status
= RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT
, 0);
35 if (Status
!= RPC_S_OK
)
37 DPRINT("RpcServerListen() failed (Status %lx)\n", Status
);
40 DPRINT("RpcServerListen finished\n");
46 DNSRSLVR_HANDLE pwszServerName
)
48 DPRINT("R_ResolverFlushCache()\n");
50 // FIXME Should store (and flush) entries by server handle
57 DNSRSLVR_HANDLE pszServerName
,
62 DNS_RECORDW
**ppResultRecords
)
67 DPRINT("R_ResolverQuery(%S %S %x %lx %p %p)\n",
68 pszServerName
, pszName
, wType
, dwFlags
, dwRecords
, ppResultRecords
);
70 if (pszName
== NULL
|| wType
== 0 || ppResultRecords
== NULL
)
71 return ERROR_INVALID_PARAMETER
;
73 if ((dwFlags
& DNS_QUERY_WIRE_ONLY
) != 0 && (dwFlags
& DNS_QUERY_NO_WIRE_QUERY
) != 0)
74 return ERROR_INVALID_PARAMETER
;
76 if (DnsIntCacheGetEntryFromName(pszName
, ppResultRecords
))
78 DPRINT("DNS cache query successful!\n");
79 Status
= ERROR_SUCCESS
;
83 DPRINT("DNS query!\n");
84 Status
= Query_Main(pszName
,
88 if (Status
== ERROR_SUCCESS
)
90 DPRINT("DNS query successful!\n");
91 DnsIntCacheAddEntry(*ppResultRecords
);
99 if (Status
== ERROR_SUCCESS
)
101 Record
= *ppResultRecords
;
104 DPRINT("Record: %S\n", Record
->pName
);
106 Record
= Record
->pNext
;
111 DPRINT("R_ResolverQuery result %ld %ld\n", Status
, *dwRecords
);
116 void __RPC_FAR
* __RPC_USER
midl_user_allocate(SIZE_T len
)
118 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
121 void __RPC_USER
midl_user_free(void __RPC_FAR
* ptr
)
123 HeapFree(GetProcessHeap(), 0, ptr
);
126 void __RPC_USER
WLANSVC_RPC_HANDLE_rundown(DNSRSLVR_HANDLE hClientHandle
)