~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/programs/rpcss/epmp.c

Version: ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Endpoint Mapper
  3  *
  4  * Copyright (C) 2007 Robert Shearman for CodeWeavers
  5  *
  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.
 10  *
 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.
 15  *
 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
 19  */
 20 
 21 #include "epm.h"
 22 
 23 #include "wine/debug.h"
 24 #include "wine/list.h"
 25 
 26 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 27 
 28 struct registered_ept_entry
 29 {
 30     struct list entry;
 31     GUID object;
 32     RPC_SYNTAX_IDENTIFIER iface;
 33     RPC_SYNTAX_IDENTIFIER syntax;
 34     char *protseq;
 35     char *endpoint;
 36     char *address;
 37     char annotation[ept_max_annotation_size];
 38 };
 39 
 40 static struct list registered_ept_entry_list = LIST_INIT(registered_ept_entry_list);
 41 
 42 static CRITICAL_SECTION csEpm;
 43 static CRITICAL_SECTION_DEBUG critsect_debug =
 44 {
 45     0, 0, &csEpm,
 46     { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
 47     0, 0, { (DWORD_PTR)(__FILE__ ": csEpm") }
 48 };
 49 static CRITICAL_SECTION csEpm = { &critsect_debug, -1, 0, 0, 0, 0 };
 50 
 51 static const UUID nil_object;
 52 
 53 /* must be called inside csEpm */
 54 static void delete_registered_ept_entry(struct registered_ept_entry *entry)
 55 {
 56     I_RpcFree(entry->protseq);
 57     I_RpcFree(entry->endpoint);
 58     I_RpcFree(entry->address);
 59     list_remove(&entry->entry);
 60     HeapFree(GetProcessHeap(), 0, entry);
 61 }
 62 
 63 static struct registered_ept_entry *find_ept_entry(
 64     const RPC_SYNTAX_IDENTIFIER *iface, const RPC_SYNTAX_IDENTIFIER *syntax,
 65     const char *protseq, const char *endpoint, const char *address,
 66     const UUID *object)
 67 {
 68     struct registered_ept_entry *entry;
 69     LIST_FOR_EACH_ENTRY(entry, &registered_ept_entry_list, struct registered_ept_entry, entry)
 70     {
 71         if (memcmp(&entry->iface, iface, sizeof(RPC_SYNTAX_IDENTIFIER))) continue;
 72         if (memcmp(&entry->syntax, syntax, sizeof(RPC_SYNTAX_IDENTIFIER))) continue;
 73         if (strcmp(entry->protseq, protseq)) continue;
 74         if (memcmp(&entry->object, object, sizeof(UUID))) continue;
 75         WINE_TRACE("found entry with iface %d.%d %s, syntax %d.%d %s, protseq %s, object %s\n",
 76                    entry->iface.SyntaxVersion.MajorVersion, entry->iface.SyntaxVersion.MinorVersion,
 77                    wine_dbgstr_guid(&entry->iface.SyntaxGUID),
 78                    entry->syntax.SyntaxVersion.MajorVersion, entry->syntax.SyntaxVersion.MinorVersion,
 79                    wine_dbgstr_guid(&entry->syntax.SyntaxGUID), protseq,
 80                    wine_dbgstr_guid(&entry->object));
 81         return entry;
 82     }
 83     WINE_TRACE("not found\n");
 84     return NULL;
 85 }
 86 
 87 void __RPC_USER ept_lookup_handle_t_rundown(ept_lookup_handle_t entry_handle)
 88 {
 89     WINE_FIXME("%p\n", entry_handle);
 90 }
 91 
 92 void ept_insert(handle_t h,
 93                 unsigned32 num_ents,
 94                 ept_entry_t entries[],
 95                 boolean32 replace,
 96                 error_status_t *status)
 97 {
 98     unsigned32 i;
 99     RPC_STATUS rpc_status;
100 
101     WINE_TRACE("(%p, %lu, %p, %lu, %p)\n", h, num_ents, entries, replace, status);
102 
103     *status = RPC_S_OK;
104 
105     EnterCriticalSection(&csEpm);
106 
107     for (i = 0; i < num_ents; i++)
108     {
109         struct registered_ept_entry *entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
110         if (!entry)
111         {
112             /* FIXME: cleanup code to delete added entries */
113             *status = EPT_S_CANT_PERFORM_OP;
114             break;
115         }
116         list_init(&entry->entry);
117         memcpy(entry->annotation, entries[i].annotation, sizeof(entries[i].annotation));
118         rpc_status = TowerExplode(entries[i].tower, &entry->iface, &entry->syntax,
119                                   &entry->protseq, &entry->endpoint,
120                                   &entry->address);
121         if (rpc_status != RPC_S_OK)
122         {
123             *status = rpc_status;
124             break; /* FIXME: more cleanup? */
125         }
126 
127         entry->object = entries[i].object;
128 
129         if (replace)
130         {
131             /* FIXME: correct find algorithm */
132             struct registered_ept_entry *old_entry = find_ept_entry(&entry->iface, &entry->syntax, entry->protseq, entry->endpoint, entry->address, &entry->object);
133             if (old_entry) delete_registered_ept_entry(old_entry);
134         }
135         list_add_tail(&registered_ept_entry_list, &entry->entry);
136     }
137 
138     LeaveCriticalSection(&csEpm);
139 }
140 
141 void ept_delete(handle_t h,
142                 unsigned32 num_ents,
143                 ept_entry_t entries[],
144                 error_status_t *status)
145 {
146     unsigned32 i;
147     RPC_STATUS rpc_status;
148 
149     *status = RPC_S_OK;
150 
151     WINE_TRACE("(%p, %lu, %p, %p)\n", h, num_ents, entries, status);
152 
153     EnterCriticalSection(&csEpm);
154 
155     for (i = 0; i < num_ents; i++)
156     {
157         struct registered_ept_entry *entry;
158         RPC_SYNTAX_IDENTIFIER iface, syntax;
159         char *protseq;
160         char *endpoint;
161         char *address;
162         rpc_status = TowerExplode(entries[i].tower, &iface, &syntax, &protseq,
163                                   &endpoint, &address);
164         if (rpc_status != RPC_S_OK)
165             break;
166         entry = find_ept_entry(&iface, &syntax, protseq, endpoint, address, &entries[i].object);
167         if (entry)
168             delete_registered_ept_entry(entry);
169         else
170         {
171             *status = EPT_S_NOT_REGISTERED;
172             break;
173         }
174         I_RpcFree(protseq);
175         I_RpcFree(endpoint);
176         I_RpcFree(address);
177     }
178 
179     LeaveCriticalSection(&csEpm);
180 }
181 
182 void ept_lookup(handle_t h,
183                 unsigned32 inquiry_type,
184                 uuid_p_t object,
185                 rpc_if_id_p_t interface_id,
186                 unsigned32 vers_option,
187                 ept_lookup_handle_t *entry_handle,
188                 unsigned32 max_ents,
189                 unsigned32 *num_ents,
190                 ept_entry_t entries[],
191                 error_status_t *status)
192 {
193     WINE_FIXME("(%p, %p, %p): stub\n", h, entry_handle, status);
194 
195     *status = EPT_S_CANT_PERFORM_OP;
196 }
197 
198 void ept_map(handle_t h,
199              uuid_p_t object,
200              twr_p_t map_tower,
201              ept_lookup_handle_t *entry_handle,
202              unsigned32 max_towers,
203              unsigned32 *num_towers,
204              twr_p_t *towers,
205              error_status_t *status)
206 {
207     RPC_STATUS rpc_status;
208     RPC_SYNTAX_IDENTIFIER iface, syntax;
209     char *protseq;
210     struct registered_ept_entry *entry;
211 
212     *status = RPC_S_OK;
213     *num_towers = 0;
214 
215     WINE_TRACE("(%p, %p, %p, %p, %lu, %p, %p, %p)\n", h, object, map_tower,
216           entry_handle, max_towers, num_towers, towers, status);
217 
218     rpc_status = TowerExplode(map_tower, &iface, &syntax, &protseq,
219                               NULL, NULL);
220     if (rpc_status != RPC_S_OK)
221     {
222         *status = rpc_status;
223         return;
224     }
225 
226     EnterCriticalSection(&csEpm);
227 
228     LIST_FOR_EACH_ENTRY(entry, &registered_ept_entry_list, struct registered_ept_entry, entry)
229     {
230         if (IsEqualGUID(&entry->iface.SyntaxGUID, &iface.SyntaxGUID) &&
231             (entry->iface.SyntaxVersion.MajorVersion == iface.SyntaxVersion.MajorVersion) &&
232             (entry->iface.SyntaxVersion.MinorVersion >= iface.SyntaxVersion.MinorVersion) &&
233             !memcmp(&entry->syntax, &syntax, sizeof(syntax)) &&
234             !strcmp(entry->protseq, protseq) &&
235             ((!object && IsEqualGUID(&entry->object, &nil_object)) || IsEqualGUID(object, &entry->object)))
236         {
237             if (*num_towers < max_towers)
238             {
239                 rpc_status = TowerConstruct(&entry->iface, &entry->syntax,
240                                             entry->protseq, entry->endpoint,
241                                             entry->address,
242                                             &towers[*num_towers]);
243                 if (rpc_status != RPC_S_OK)
244                 {
245                     *status = rpc_status;
246                     break; /* FIXME: more cleanup? */
247                 }
248             }
249             (*num_towers)++;
250         }
251     }
252 
253     LeaveCriticalSection(&csEpm);
254 }
255 
256 void ept_lookup_handle_free(handle_t h,
257                             ept_lookup_handle_t *entry_handle,
258                             error_status_t *status)
259 {
260     WINE_FIXME("(%p, %p, %p): stub\n", h, entry_handle, status);
261 
262     *status = EPT_S_CANT_PERFORM_OP;
263 }
264 
265 void ept_inq_object(handle_t h,
266                     GUID *ept_object,
267                     error_status_t *status)
268 {
269     WINE_FIXME("(%p, %p, %p): stub\n", h, ept_object, status);
270 
271     *status = EPT_S_CANT_PERFORM_OP;
272 }
273 
274 void ept_mgmt_delete(handle_t h,
275                      boolean32 object_speced,
276                      uuid_p_t object,
277                      twr_p_t tower,
278                      error_status_t *status)
279 {
280     WINE_FIXME("(%p, %ld, %p, %p, %p): stub\n", h, object_speced, object, tower, status);
281 
282     *status = EPT_S_CANT_PERFORM_OP;
283 }
284 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.