4 * Copyright 2005 Eric Kohl
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "setupapi_private.h"
23 static RPC_BINDING_HANDLE LocalBindingHandle
= NULL
;
24 static HSTRING_TABLE LocalStringTable
= NULL
;
28 PnpBindRpc(LPCWSTR pszMachine
,
29 RPC_BINDING_HANDLE
* BindingHandle
)
31 PWSTR pszStringBinding
= NULL
;
34 Status
= RpcStringBindingComposeW(NULL
,
40 if (Status
!= RPC_S_OK
)
43 Status
= RpcBindingFromStringBindingW(pszStringBinding
,
46 RpcStringFreeW(&pszStringBinding
);
53 PnpUnbindRpc(RPC_BINDING_HANDLE
*BindingHandle
)
55 if (BindingHandle
!= NULL
)
57 RpcBindingFree(*BindingHandle
);
58 *BindingHandle
= NULL
;
66 PnpGetLocalHandles(RPC_BINDING_HANDLE
*BindingHandle
,
67 HSTRING_TABLE
*StringTable
)
69 if (LocalBindingHandle
!= NULL
)
71 if (BindingHandle
!= NULL
)
72 *BindingHandle
= LocalBindingHandle
;
74 if (StringTable
!= NULL
)
75 *StringTable
= LocalStringTable
;
80 LocalStringTable
= pSetupStringTableInitialize();
81 if (LocalStringTable
== NULL
)
84 if (PnpBindRpc(NULL
, &LocalBindingHandle
) != RPC_S_OK
)
86 pSetupStringTableDestroy(LocalStringTable
);
90 pSetupStringTableAddString(LocalStringTable
, L
"PLT", 1);
92 if (BindingHandle
!= NULL
)
93 *BindingHandle
= LocalBindingHandle
;
95 if (StringTable
!= NULL
)
96 *StringTable
= LocalStringTable
;
103 PnpUnbindLocalBindingHandle(VOID
)
105 pSetupStringTableDestroy(LocalStringTable
);
106 LocalStringTable
= NULL
;
107 return PnpUnbindRpc(&LocalBindingHandle
);
111 void __RPC_FAR
* __RPC_USER
112 midl_user_allocate(SIZE_T len
)
114 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, len
);
119 midl_user_free(void __RPC_FAR
* ptr
)
121 HeapFree(GetProcessHeap(), 0, ptr
);