ReactOS 0.4.15-dev-7842-g558ab78
main.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4 * PURPOSE: Main functions
5 * COPYRIGHT: Copyright 2015-2017 Colin Finck (colin@reactos.org)
6 */
7
8#include "precomp.h"
9
10// Global Variables
14
17{
19 PWSTR wszStringBinding;
21
22 // Get us a string binding handle from the supplied connection information
23 Status = RpcStringBindingComposeW(NULL, L"ncalrpc", NULL, L"spoolss", NULL, &wszStringBinding);
24 if (Status != RPC_S_OK)
25 {
26 ERR("RpcStringBindingComposeW failed with status %ld!\n", Status);
27 return NULL;
28 }
29
30 // Get a handle_t binding handle from the string binding handle
31 Status = RpcBindingFromStringBindingW(wszStringBinding, &hBinding);
32 if (Status != RPC_S_OK)
33 {
34 ERR("RpcBindingFromStringBindingW failed with status %ld!\n", Status);
35 return NULL;
36 }
37
38 // Free the string binding handle
39 Status = RpcStringFreeW(&wszStringBinding);
40 if (Status != RPC_S_OK)
41 {
42 ERR("RpcStringFreeW failed with status %ld!\n", Status);
43 return NULL;
44 }
45
46 return hBinding;
47}
48
49void __RPC_USER
51{
53
55 if (Status != RPC_S_OK)
56 {
57 ERR("RpcBindingFree failed with status %ld!\n", Status);
58 }
59}
60
63{
65}
66
67void __RPC_USER
69{
71}
72
75{
76 TRACE("DllMain(%p, %lu, %p)\n", hinstDLL, fdwReason, lpvReserved);
77
78 switch (fdwReason)
79 {
83 hinstWinSpool = hinstDLL;
85 break;
86
89 break;
90 }
91
92 return TRUE;
93}
94
97{
98 BOOL bReturnValue = FALSE;
99 DWORD dwErrorCode;
100
101 TRACE("SpoolerInit()\n");
102
103 // Nothing to initialize here yet, but pass this call to the Spool Service as well.
105 {
106 dwErrorCode = _RpcSpoolerInit();
107 SetLastError(dwErrorCode);
108 bReturnValue = (dwErrorCode == ERROR_SUCCESS);
109 }
111 {
112 ERR("_RpcSpoolerInit failed with exception code %lu!\n", RpcExceptionCode());
113 }
115
116 return bReturnValue;
117}
#define ERR(fmt,...)
Definition: debug.h:110
handle_t hBinding
Definition: ctx_c.c:54
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
#define GetProcessHeap()
Definition: compat.h:736
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define SetLastError(x)
Definition: compat.h:752
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLenum GLsizei len
Definition: glext.h:6722
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static IN DWORD IN LPVOID lpvReserved
HANDLE hProcessHeap
Definition: main.c:13
static PVOID ptr
Definition: dispmode.c:27
#define L(x)
Definition: ntvdm.h:50
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:880
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:510
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:787
#define RPC_S_OK
Definition: rpcnterr.h:22
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:175
#define RpcEndExcept
Definition: rpc.h:128
#define midl_user_free
Definition: rpc.h:45
#define __RPC_FAR
Definition: rpc.h:56
#define RpcTryExcept
Definition: rpc.h:126
#define RpcExcept(expr)
Definition: rpc.h:127
long RPC_STATUS
Definition: rpc.h:52
#define __RPC_USER
Definition: rpc.h:65
#define RpcExceptionCode()
Definition: rpc.h:132
#define midl_user_allocate
Definition: rpc.h:44
#define TRACE(s)
Definition: solgame.cpp:4
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG_PTR SIZE_T
Definition: typedefs.h:80
BOOL WINAPI SpoolerInit(VOID)
Definition: main.c:248
DWORD _RpcSpoolerInit(VOID)
Definition: init.c:11
handle_t __RPC_USER WINSPOOL_HANDLE_bind(WINSPOOL_HANDLE wszName)
Definition: main.c:16
void __RPC_USER WINSPOOL_HANDLE_unbind(WINSPOOL_HANDLE wszName, handle_t hBinding)
Definition: main.c:50
HINSTANCE hinstWinSpool
Definition: main.c:12
CRITICAL_SECTION rtlCritSec
Definition: main.c:13
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define WINAPI
Definition: msvc.h:6
WCHAR * WINSPOOL_HANDLE
Definition: winspool.idl:15