BOOL RPCSS_Initialize(void) { static unsigned short irot_protseq[] = IROT_PROTSEQ; static unsigned short irot_endpoint[] = IROT_ENDPOINT; static unsigned short epm_protseq[] = {'n','c','a','c','n','_','n','p',0}; static unsigned short epm_endpoint[] = {'\\','p','i','p','e','\\','e','p','m','a','p','p','e','r',0}; static unsigned short epm_protseq_lrpc[] = {'n','c','a','l','r','p','c',0}; static unsigned short epm_endpoint_lrpc[] = {'e','p','m','a','p','p','e','r',0}; RPC_STATUS status; WINE_TRACE("\n"); status = RpcServerRegisterIf(epm_v3_0_s_ifspec, NULL, NULL); if (status != RPC_S_OK) return status; status = RpcServerRegisterIf(Irot_v0_2_s_ifspec, NULL, NULL); if (status != RPC_S_OK) { RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, FALSE); return FALSE; } status = RpcServerUseProtseqEpW(epm_protseq, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, epm_endpoint, NULL); if (status != RPC_S_OK) goto fail; status = RpcServerUseProtseqEpW(epm_protseq_lrpc, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, epm_endpoint_lrpc, NULL); if (status != RPC_S_OK) goto fail; status = RpcServerUseProtseqEpW(irot_protseq, RPC_C_PROTSEQ_MAX_REQS_DEFAULT, irot_endpoint, NULL); if (status != RPC_S_OK) goto fail; status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE); if (status != RPC_S_OK) goto fail; #ifndef __REACTOS__ exit_event = __wine_make_process_system(); #else exit_event = CreateEventW(NULL, FALSE, FALSE, NULL); // never fires #endif return TRUE; fail: RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, FALSE); RpcServerUnregisterIf(Irot_v0_2_s_ifspec, NULL, FALSE); return FALSE; }
DWORD WINAPI RpcThreadRoutine( LPVOID lpParameter) { RPC_STATUS Status; Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\srvsvc", NULL); if (Status != RPC_S_OK) { ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); return 0; } Status = RpcServerRegisterIf(srvsvc_v3_0_s_ifspec, NULL, NULL); if (Status != RPC_S_OK) { ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status); return 0; } Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, FALSE); if (Status != RPC_S_OK) { ERR("RpcServerListen() failed (Status %lx)\n", Status); } return 0; }
DWORD WINAPI LrpcThreadProc(LPVOID lpParameter) { RPC_STATUS Status; Status = RpcServerUseProtseqEpW(L"ncalrpc", 20, L"spoolss", NULL); if (Status != RPC_S_OK) { ERR("RpcServerUseProtseqEpW failed with status %ld!\n", Status); return 0; } Status = RpcServerRegisterIf(winspool_v1_0_s_ifspec, NULL, NULL); if (Status != RPC_S_OK) { ERR("RpcServerRegisterIf failed with status %ld!\n", Status); return 0; } Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, 0); if (Status != RPC_S_OK) { ERR("RpcServerListen() failed with status %ld!\n", Status); } return 0; }
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter) { RPC_STATUS Status; InitializeListHead(&LogHandleListHead); Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\EventLog", NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); return 0; } Status = RpcServerRegisterIf(eventlog_v0_0_s_ifspec, NULL, NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status); return 0; } Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, FALSE); if (Status != RPC_S_OK) { DPRINT("RpcServerListen() failed (Status %lx)\n", Status); } return 0; }
/* FUNCTIONS *****************************************************************/ static DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter) { RPC_STATUS Status; Status = RpcServerUseProtseqEpW(L"ncalrpc", 20, L"wlansvc", NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); return 0; } Status = RpcServerRegisterIf(wlansvc_interface_v1_0_s_ifspec, NULL, NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status); return 0; } Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, 0); if (Status != RPC_S_OK) { DPRINT("RpcServerListen() failed (Status %lx)\n", Status); } DPRINT("RpcServerListen finished\n"); return 0; }
DWORD WINAPI start_gdipp_rpc_server(LPVOID lpParameter) { if (process_heap == NULL) return 1; //bool b_ret; RPC_STATUS rpc_status; scoped_rw_lock::initialize(); server_cache_size = min(config_instance.get_number(L"/gdipp/server/cache_size/text()", server_config::CACHE_SIZE), 24); glyph_cache_instance.initialize(); initialize_freetype(); //b_ret = rpc_index_initialize(); //if (!b_ret) // return 1; rpc_status = RpcServerUseProtseqEpW(reinterpret_cast<RPC_WSTR>(L"ncalrpc"), RPC_C_PROTSEQ_MAX_REQS_DEFAULT, reinterpret_cast<RPC_WSTR>(L"gdipp"), NULL); if (rpc_status != RPC_S_OK) return 1; rpc_status = RpcServerRegisterIf(gdipp_rpc_v1_0_s_ifspec, NULL, NULL); if (rpc_status != RPC_S_OK) return 1; rpc_status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE); if (rpc_status != RPC_S_OK) return 1; rpc_status = RpcMgmtWaitServerListen(); if (rpc_status != RPC_S_OK) return 1; return 0; }
NTSTATUS NTAPI RpcpAddInterface ( _In_ LPCWSTR IfName, _In_ RPC_IF_HANDLE IfSpec ) { PWCHAR endpointName; NTSTATUS ntStatus; RPC_STATUS rpcStatus; /* Allocate space for the interface name and the \\PIPE\\ prefix */ endpointName = LocalAlloc(0, sizeof(WCHAR) * wcslen(IfName) + 16); if (endpointName) { /* Copy the prefix, and then the interface name */ wcscpy(endpointName, L"\\PIPE\\"); wcscat(endpointName, IfName); /* Create a named pipe endpoint with this name */ rpcStatus = RpcServerUseProtseqEpW(L"ncacn_np", 10, endpointName, NULL); if ((rpcStatus != RPC_S_OK) && (rpcStatus != RPC_S_DUPLICATE_ENDPOINT)) { /* We couldn't create it, or it already existed... */ DbgPrint("RpcServerUseProtseqW failed! rpcstatus = %u\n", rpcStatus); } else { /* It worked, register an interface on this endpoint now*/ rpcStatus = RpcServerRegisterIf(IfSpec, 0, 0); } /* In both success and failure, free the name, and convert the status */ LocalFree(endpointName); ntStatus = I_RpcMapWin32Status(rpcStatus); } else { /* No memory, bail out */ ntStatus = STATUS_NO_MEMORY; } /* Return back to the caller */ return ntStatus; }
DWORD WINAPI RpcThreadRoutine(LPVOID lpParameter) { RPC_STATUS Status; InitializeCriticalSection(&LogHandleListCs); InitializeListHead(&LogHandleListHead); Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\EventLog", NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status); goto Quit; } Status = RpcServerRegisterIf(eventlog_v0_0_s_ifspec, NULL, NULL); if (Status != RPC_S_OK) { DPRINT("RpcServerRegisterIf() failed (Status %lx)\n", Status); goto Quit; } Status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, FALSE); if (Status != RPC_S_OK) { DPRINT("RpcServerListen() failed (Status %lx)\n", Status); } EnterCriticalSection(&LogHandleListCs); while (!IsListEmpty(&LogHandleListHead)) { IELF_HANDLE LogHandle = (IELF_HANDLE)CONTAINING_RECORD(LogHandleListHead.Flink, LOGHANDLE, LogHandleListEntry); ElfDeleteEventLogHandle(&LogHandle); } LeaveCriticalSection(&LogHandleListCs); Quit: DeleteCriticalSection(&LogHandleListCs); return 0; }