2 * PROJECT: ReactOS Spooler API
3 * LICENSE: GNU LGPL v2.1 or any later version as published by the Free Software Foundation
4 * PURPOSE: Main functions
5 * COPYRIGHT: Copyright 2015 Colin Finck <colin@reactos.org>
11 WINSPOOL_HANDLE_bind(WINSPOOL_HANDLE wszName
)
14 PWSTR wszStringBinding
;
17 // Get us a string binding handle from the supplied connection information
18 Status
= RpcStringBindingComposeW(NULL
, L
"ncacn_np", wszName
, L
"\\pipe\\spoolss", NULL
, &wszStringBinding
);
19 if (Status
!= RPC_S_OK
)
21 ERR("RpcStringBindingComposeW failed with status %ld!\n", Status
);
25 // Get a handle_t binding handle from the string binding handle
26 Status
= RpcBindingFromStringBindingW(wszStringBinding
, &hBinding
);
27 if (Status
!= RPC_S_OK
)
29 ERR("RpcBindingFromStringBindingW failed with status %ld!\n", Status
);
33 // Free the string binding handle
34 Status
= RpcStringFreeW(&wszStringBinding
);
35 if (Status
!= RPC_S_OK
)
37 ERR("RpcStringFreeW failed with status %ld!\n", Status
);
45 WINSPOOL_HANDLE_unbind(WINSPOOL_HANDLE wszName
, handle_t hBinding
)
49 Status
= RpcBindingFree(&hBinding
);
50 if (Status
!= RPC_S_OK
)
52 ERR("RpcBindingFree failed with status %ld!\n", Status
);
56 void __RPC_FAR
* __RPC_USER
57 midl_user_allocate(SIZE_T len
)
59 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
63 midl_user_free(void __RPC_FAR
* ptr
)
65 HeapFree(GetProcessHeap(), 0, ptr
);
71 BOOL bReturnValue
= FALSE
;
74 // Nothing to initialize here yet, but pass this call to the Spool Service as well.
77 dwErrorCode
= _RpcSpoolerInit();
78 SetLastError(dwErrorCode
);
79 bReturnValue
= (dwErrorCode
== ERROR_SUCCESS
);
81 RpcExcept(EXCEPTION_EXECUTE_HANDLER
)
83 ERR("_RpcSpoolerInit failed with exception code %lu!\n", RpcExceptionCode());