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 Colin Finck (colin@reactos.org)
15 WINSPOOL_HANDLE_bind(WINSPOOL_HANDLE wszName
)
18 PWSTR wszStringBinding
;
21 // Get us a string binding handle from the supplied connection information
22 Status
= RpcStringBindingComposeW(NULL
, L
"ncalrpc", NULL
, L
"spoolss", NULL
, &wszStringBinding
);
23 if (Status
!= RPC_S_OK
)
25 ERR("RpcStringBindingComposeW failed with status %ld!\n", Status
);
29 // Get a handle_t binding handle from the string binding handle
30 Status
= RpcBindingFromStringBindingW(wszStringBinding
, &hBinding
);
31 if (Status
!= RPC_S_OK
)
33 ERR("RpcBindingFromStringBindingW failed with status %ld!\n", Status
);
37 // Free the string binding handle
38 Status
= RpcStringFreeW(&wszStringBinding
);
39 if (Status
!= RPC_S_OK
)
41 ERR("RpcStringFreeW failed with status %ld!\n", Status
);
49 WINSPOOL_HANDLE_unbind(WINSPOOL_HANDLE wszName
, handle_t hBinding
)
53 Status
= RpcBindingFree(&hBinding
);
54 if (Status
!= RPC_S_OK
)
56 ERR("RpcBindingFree failed with status %ld!\n", Status
);
60 void __RPC_FAR
* __RPC_USER
61 midl_user_allocate(SIZE_T len
)
63 return HeapAlloc(hProcessHeap
, HEAP_ZERO_MEMORY
, len
);
67 midl_user_free(void __RPC_FAR
* ptr
)
69 HeapFree(hProcessHeap
, 0, ptr
);
73 DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
77 case DLL_PROCESS_ATTACH
:
78 DisableThreadLibraryCalls(hinstDLL
);
79 hProcessHeap
= GetProcessHeap();
89 BOOL bReturnValue
= FALSE
;
92 // Nothing to initialize here yet, but pass this call to the Spool Service as well.
95 dwErrorCode
= _RpcSpoolerInit();
96 SetLastError(dwErrorCode
);
97 bReturnValue
= (dwErrorCode
== ERROR_SUCCESS
);
99 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
101 ERR("_RpcSpoolerInit failed with exception code %lu!\n", RpcExceptionCode());