ReactOS 0.4.15-dev-8145-ga541a46
dnsrslvr.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for dnsrslvr.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

DWORD WINAPI RpcThreadRoutine (LPVOID lpParameter)
 
static VOID UpdateServiceStatus (HANDLE hServiceStatus, DWORD NewStatus, DWORD Increment)
 
static DWORD WINAPI ServiceControlHandler (DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
 
VOID WINAPI ServiceMain (DWORD argc, LPWSTR *argv)
 
BOOL WINAPI DllMain (_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ PVOID pvReserved)
 

Variables

HINSTANCE hDllInstance
 
SERVICE_STATUS_HANDLE ServiceStatusHandle
 
SERVICE_STATUS SvcStatus
 
static WCHAR ServiceName [] = L"Dnscache"
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file dnsrslvr.c.

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( _In_ HINSTANCE  hinstDLL,
_In_ DWORD  fdwReason,
_In_ PVOID  pvReserved 
)

Definition at line 131 of file dnsrslvr.c.

135{
137
138 switch (fdwReason)
139 {
142 hDllInstance = hinstDLL;
143 break;
144
146 break;
147 }
148
149 return TRUE;
150}
#define TRUE
Definition: types.h:120
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
HINSTANCE hDllInstance
Definition: dnsrslvr.c:18
static LPCSTR DWORD void * pvReserved
Definition: str.c:196
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317

◆ RpcThreadRoutine()

DWORD WINAPI RpcThreadRoutine ( LPVOID  lpParameter)

Definition at line 20 of file rpcserver.c.

22{
24
25 Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\browser", NULL);
26 if (Status != RPC_S_OK)
27 {
28 ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
29 return 0;
30 }
31
32 Status = RpcServerRegisterIf(browser_v0_0_s_ifspec, NULL, NULL);
33 if (Status != RPC_S_OK)
34 {
35 ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status);
36 return 0;
37 }
38
40 if (Status != RPC_S_OK)
41 {
42 ERR("RpcServerListen() failed (Status %lx)\n", Status);
43 }
44
45 return 0;
46}
#define ERR(fmt,...)
Definition: debug.h:113
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
Status
Definition: gdiplustypes.h:25
#define L(x)
Definition: ntvdm.h:50
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1520
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
#define RPC_S_OK
Definition: rpcnterr.h:22
long RPC_STATUS
Definition: rpc.h:52

Referenced by ServiceMain().

◆ ServiceControlHandler()

static DWORD WINAPI ServiceControlHandler ( DWORD  dwControl,
DWORD  dwEventType,
LPVOID  lpEventData,
LPVOID  lpContext 
)
static

Definition at line 46 of file dnsrslvr.c.

51{
52 switch (dwControl)
53 {
60 break;
61
63 return NO_ERROR;
64
65 default:
67 }
68 return NO_ERROR;
69}
VOID DnsIntCacheFree(VOID)
Definition: cache.c:36
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
static VOID UpdateServiceStatus(HANDLE hServiceStatus, DWORD NewStatus, DWORD Increment)
Definition: dnsrslvr.c:29
SERVICE_STATUS_HANDLE ServiceStatusHandle
Definition: dnsrslvr.c:19
RPC_STATUS WINAPI RpcMgmtStopServerListening(RPC_BINDING_HANDLE Binding)
Definition: rpc_server.c:1596
#define SERVICE_STOPPED
Definition: winsvc.h:21
#define SERVICE_STOP_PENDING
Definition: winsvc.h:23
#define SERVICE_CONTROL_SHUTDOWN
Definition: winsvc.h:40
#define SERVICE_CONTROL_STOP
Definition: winsvc.h:36
#define SERVICE_CONTROL_INTERROGATE
Definition: winsvc.h:39

Referenced by ServiceMain().

◆ ServiceMain()

VOID WINAPI ServiceMain ( DWORD  argc,
LPWSTR argv 
)

Definition at line 73 of file dnsrslvr.c.

76{
78
81
82 DPRINT("ServiceMain() called\n");
83
90 SvcStatus.dwWaitHint = 4000;
91
94 NULL);
95
97 {
98 DPRINT1("DNSRSLVR: Unable to register service control handler (%lx)\n", GetLastError());
99 return; // FALSE
100 }
101
103
105
107 0,
110 NULL,
111 0,
112 NULL);
113
114 if (!hThread)
115 {
117 DPRINT("Can't create RpcThread\n");
119 }
120 else
121 {
123 }
124
125 DPRINT("ServiceMain() done\n");
127}
static int argc
Definition: ServiceArgs.c:12
#define DPRINT1
Definition: precomp.h:8
VOID DnsIntCacheInitialize(VOID)
Definition: cache.c:21
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
static WCHAR ServiceName[]
Definition: dnsrslvr.c:21
static DWORD WINAPI ServiceControlHandler(DWORD dwControl, DWORD dwEventType, LPVOID lpEventData, LPVOID lpContext)
Definition: dnsrslvr.c:46
SERVICE_STATUS SvcStatus
Definition: dnsrslvr.c:20
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter)
Definition: rpcserver.c:20
BOOL ReadHostsFile(VOID)
Definition: hostsfile.c:291
#define argv
Definition: mplay32.c:18
HANDLE hThread
Definition: wizard.c:28
SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerExW(LPCWSTR lpServiceName, LPHANDLER_FUNCTION_EX lpHandlerProc, LPVOID lpContext)
Definition: sctrl.c:812
#define DPRINT
Definition: sndvol32.h:73
DWORD dwServiceType
Definition: winsvc.h:99
DWORD dwWin32ExitCode
Definition: winsvc.h:102
DWORD dwControlsAccepted
Definition: winsvc.h:101
DWORD dwWaitHint
Definition: winsvc.h:105
DWORD dwCurrentState
Definition: winsvc.h:100
DWORD dwCheckPoint
Definition: winsvc.h:104
DWORD dwServiceSpecificExitCode
Definition: winsvc.h:103
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
Definition: winbase.h:729
#define SERVICE_ACCEPT_STOP
Definition: winsvc.h:28
#define SERVICE_START_PENDING
Definition: winsvc.h:22
#define SERVICE_RUNNING
Definition: winsvc.h:24
#define SERVICE_ACCEPT_SHUTDOWN
Definition: winsvc.h:30
#define SERVICE_WIN32_OWN_PROCESS
Definition: cmtypes.h:962

◆ UpdateServiceStatus()

static VOID UpdateServiceStatus ( HANDLE  hServiceStatus,
DWORD  NewStatus,
DWORD  Increment 
)
static

Definition at line 29 of file dnsrslvr.c.

33{
34 if (Increment > 0)
36 else
38
39 SvcStatus.dwCurrentState = NewStatus;
41}
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:46
BOOL WINAPI SetServiceStatus(SERVICE_STATUS_HANDLE hServiceStatus, LPSERVICE_STATUS lpServiceStatus)
Definition: sctrl.c:997
SERVICE_STATUS_HANDLE hServiceStatus
Definition: main.c:10

Referenced by ServiceControlHandler(), and ServiceMain().

Variable Documentation

◆ hDllInstance

HINSTANCE hDllInstance

Definition at line 18 of file dnsrslvr.c.

Referenced by DllMain().

◆ ServiceName

WCHAR ServiceName[] = L"Dnscache"
static

Definition at line 21 of file dnsrslvr.c.

Referenced by ServiceMain().

◆ ServiceStatusHandle

SERVICE_STATUS_HANDLE ServiceStatusHandle

Definition at line 19 of file dnsrslvr.c.

Referenced by ServiceControlHandler(), and ServiceMain().

◆ SvcStatus

SERVICE_STATUS SvcStatus

Definition at line 20 of file dnsrslvr.c.

Referenced by ServiceMain(), and UpdateServiceStatus().