ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

rpc.c
Go to the documentation of this file.
00001 /*
00002  * RPC support routines
00003  *
00004  * Copyright 2005 Eric Kohl
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00019  */
00020 
00021 #include "setupapi_private.h"
00022 
00023 WINE_DEFAULT_DEBUG_CHANNEL(setupapi);
00024 
00025 static RPC_BINDING_HANDLE LocalBindingHandle = NULL;
00026 static HSTRING_TABLE LocalStringTable = NULL;
00027 
00028 
00029 RPC_STATUS
00030 PnpBindRpc(LPCWSTR pszMachine,
00031            RPC_BINDING_HANDLE* BindingHandle)
00032 {
00033     PWSTR pszStringBinding = NULL;
00034     RPC_STATUS Status;
00035 
00036     Status = RpcStringBindingComposeW(NULL,
00037                                       L"ncacn_np",
00038                                       (LPWSTR)pszMachine,
00039                                       L"\\pipe\\plugplay",
00040                                       NULL,
00041                                       &pszStringBinding);
00042     if (Status != RPC_S_OK)
00043         return Status;
00044 
00045     Status = RpcBindingFromStringBindingW(pszStringBinding,
00046                                           BindingHandle);
00047 
00048     RpcStringFreeW(&pszStringBinding);
00049 
00050     return Status;
00051 }
00052 
00053 
00054 RPC_STATUS
00055 PnpUnbindRpc(RPC_BINDING_HANDLE *BindingHandle)
00056 {
00057     if (BindingHandle != NULL)
00058     {
00059         RpcBindingFree(*BindingHandle);
00060         *BindingHandle = NULL;
00061     }
00062 
00063     return RPC_S_OK;
00064 }
00065 
00066 
00067 BOOL
00068 PnpGetLocalHandles(RPC_BINDING_HANDLE *BindingHandle,
00069                    HSTRING_TABLE *StringTable)
00070 {
00071     if (LocalBindingHandle != NULL)
00072     {
00073         if (BindingHandle != NULL)
00074             *BindingHandle = LocalBindingHandle;
00075 
00076         if (StringTable != NULL)
00077             *StringTable = LocalStringTable;
00078 
00079         return TRUE;
00080     }
00081 
00082     LocalStringTable = pSetupStringTableInitialize();
00083     if (LocalStringTable == NULL)
00084         return FALSE;
00085 
00086     if (PnpBindRpc(NULL, &LocalBindingHandle) != RPC_S_OK)
00087     {
00088         pSetupStringTableDestroy(LocalStringTable);
00089         return FALSE;
00090     }
00091 
00092     pSetupStringTableAddString(LocalStringTable, L"PLT", 1);
00093 
00094     if (BindingHandle != NULL)
00095         *BindingHandle = LocalBindingHandle;
00096 
00097     if (StringTable != NULL)
00098         *StringTable = LocalStringTable;
00099 
00100     return TRUE;
00101 }
00102 
00103 
00104 RPC_STATUS
00105 PnpUnbindLocalBindingHandle(VOID)
00106 {
00107     pSetupStringTableDestroy(LocalStringTable);
00108     LocalStringTable = NULL;
00109     return PnpUnbindRpc(&LocalBindingHandle);
00110 }
00111 
00112 
00113 void __RPC_FAR * __RPC_USER
00114 midl_user_allocate(SIZE_T len)
00115 {
00116     return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
00117 }
00118 
00119 
00120 void __RPC_USER
00121 midl_user_free(void __RPC_FAR * ptr)
00122 {
00123     HeapFree(GetProcessHeap(), 0, ptr);
00124 }
00125 
00126 /* EOF */

Generated on Thu May 24 2012 04:17:53 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.