ReactOS  0.4.15-dev-494-g1d8c567
main.c File Reference
#include "precomp.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

handle_t __RPC_USER WINSPOOL_HANDLE_bind (WINSPOOL_HANDLE wszName)
 
void __RPC_USER WINSPOOL_HANDLE_unbind (WINSPOOL_HANDLE wszName, handle_t hBinding)
 
void __RPC_FAR *__RPC_USER midl_user_allocate (SIZE_T len)
 
void __RPC_USER midl_user_free (void __RPC_FAR *ptr)
 
BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 
BOOL WINAPI SpoolerInit (VOID)
 

Variables

HANDLE hProcessHeap
 
HINSTANCE hinstWinSpool = NULL
 
CRITICAL_SECTION rtlCritSec
 

Function Documentation

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  fdwReason,
LPVOID  lpvReserved 
)

Definition at line 74 of file main.c.

75 {
76  TRACE("DllMain(%p, %lu, %p)\n", hinstDLL, fdwReason, lpvReserved);
77 
78  switch (fdwReason)
79  {
80  case DLL_PROCESS_ATTACH:
81  DisableThreadLibraryCalls(hinstDLL);
83  hinstWinSpool = hinstDLL;
85  break;
86 
87  case DLL_PROCESS_DETACH:
89  break;
90  }
91 
92  return TRUE;
93 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
static IN DWORD IN LPVOID lpvReserved
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:404
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
HANDLE hProcessHeap
Definition: main.c:13
CRITICAL_SECTION rtlCritSec
Definition: main.c:13
HINSTANCE hinstWinSpool
Definition: main.c:12

◆ midl_user_allocate()

void __RPC_FAR* __RPC_USER midl_user_allocate ( SIZE_T  len)

Definition at line 62 of file main.c.

63 {
65 }
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLenum GLsizei len
Definition: glext.h:6722
HANDLE hProcessHeap
Definition: main.c:13
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

◆ midl_user_free()

void __RPC_USER midl_user_free ( void __RPC_FAR ptr)

Definition at line 68 of file main.c.

69 {
71 }
static PVOID ptr
Definition: dispmode.c:27
HANDLE hProcessHeap
Definition: main.c:13
#define HeapFree(x, y, z)
Definition: compat.h:403

◆ SpoolerInit()

BOOL WINAPI SpoolerInit ( VOID  )

Definition at line 96 of file main.c.

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  }
114  RpcEndExcept;
115 
116  return bReturnValue;
117 }
#define RpcEndExcept
Definition: rpc.h:128
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD _RpcSpoolerInit(VOID)
Definition: init.c:11
unsigned int BOOL
Definition: ntddk_ex.h:94
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:418
#define ERR(fmt,...)
Definition: debug.h:110
#define RpcExcept(expr)
Definition: rpc.h:127

◆ WINSPOOL_HANDLE_bind()

handle_t __RPC_USER WINSPOOL_HANDLE_bind ( WINSPOOL_HANDLE  wszName)

Definition at line 16 of file main.c.

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 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:876
handle_t hBinding
Definition: ctx_c.c:54
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
uint16_t * PWSTR
Definition: typedefs.h:55
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
long RPC_STATUS
Definition: rpc.h:52
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:110
#define RPC_S_OK
Definition: rpcnterr.h:22

◆ WINSPOOL_HANDLE_unbind()

void __RPC_USER WINSPOOL_HANDLE_unbind ( WINSPOOL_HANDLE  wszName,
handle_t  hBinding 
)

Definition at line 50 of file main.c.

51 {
53 
55  if (Status != RPC_S_OK)
56  {
57  ERR("RpcBindingFree failed with status %ld!\n", Status);
58  }
59 }
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
handle_t hBinding
Definition: ctx_c.c:54
long RPC_STATUS
Definition: rpc.h:52
Status
Definition: gdiplustypes.h:24
#define ERR(fmt,...)
Definition: debug.h:110
#define RPC_S_OK
Definition: rpcnterr.h:22

Variable Documentation

◆ hinstWinSpool

HINSTANCE hinstWinSpool = NULL

◆ hProcessHeap

HANDLE hProcessHeap

Definition at line 11 of file main.c.

◆ rtlCritSec

CRITICAL_SECTION rtlCritSec

Definition at line 13 of file main.c.

Referenced by DllMain(), IntProtectHandle(), and IntUnprotectHandle().