ReactOS  0.4.12-dev-14-gd0c8636
epmp.c File Reference
#include "epm_s.h"
#include "wine/debug.h"
#include "wine/list.h"
Include dependency graph for epmp.c:

Go to the source code of this file.

Classes

struct  registered_ept_entry
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
static void delete_registered_ept_entry (struct registered_ept_entry *entry)
 
static struct registered_ept_entryfind_ept_entry (const RPC_SYNTAX_IDENTIFIER *iface, const RPC_SYNTAX_IDENTIFIER *syntax, const char *protseq, const char *endpoint, const char *address, const UUID *object)
 
void __RPC_USER ept_lookup_handle_t_rundown (ept_lookup_handle_t entry_handle)
 
void __cdecl ept_insert (handle_t h, unsigned32 num_ents, ept_entry_t entries[], boolean32 replace, error_status_t *status)
 
void __cdecl ept_delete (handle_t h, unsigned32 num_ents, ept_entry_t entries[], error_status_t *status)
 
void __cdecl ept_lookup (handle_t h, unsigned32 inquiry_type, uuid_p_t object, rpc_if_id_p_t interface_id, unsigned32 vers_option, ept_lookup_handle_t *entry_handle, unsigned32 max_ents, unsigned32 *num_ents, ept_entry_t entries[], error_status_t *status)
 
void __cdecl ept_map (handle_t h, uuid_p_t object, twr_p_t map_tower, ept_lookup_handle_t *entry_handle, unsigned32 max_towers, unsigned32 *num_towers, twr_p_t *towers, error_status_t *status)
 
void __cdecl ept_lookup_handle_free (handle_t h, ept_lookup_handle_t *entry_handle, error_status_t *status)
 
void __cdecl ept_inq_object (handle_t h, GUID *ept_object, error_status_t *status)
 
void __cdecl ept_mgmt_delete (handle_t h, boolean32 object_speced, uuid_p_t object, twr_p_t tower, error_status_t *status)
 

Variables

static struct list registered_ept_entry_list = LIST_INIT(registered_ept_entry_list)
 
static CRITICAL_SECTION csEpm = { &critsect_debug, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG critsect_debug
 
static const UUID nil_object
 

Function Documentation

◆ delete_registered_ept_entry()

static void delete_registered_ept_entry ( struct registered_ept_entry entry)
static

Definition at line 54 of file epmp.c.

Referenced by ept_delete(), and ept_insert().

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 }
char * endpoint
Definition: epmp.c:35
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
char * address
Definition: epmp.c:36
#define GetProcessHeap()
Definition: compat.h:395
struct list entry
Definition: epmp.c:30
char * protseq
Definition: epmp.c:34
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ ept_delete()

void __cdecl ept_delete ( handle_t  h,
unsigned32  num_ents,
ept_entry_t  entries[],
error_status_t status 
)

Definition at line 142 of file epmp.c.

146 {
147  unsigned32 i;
148  RPC_STATUS rpc_status;
149 
150  *status = RPC_S_OK;
151 
152  WINE_TRACE("(%p, %u, %p, %p)\n", h, num_ents, entries, status);
153 
155 
156  for (i = 0; i < num_ents; i++)
157  {
158  struct registered_ept_entry *entry;
160  char *protseq;
161  char *endpoint;
162  char *address;
163  rpc_status = TowerExplode(entries[i].tower, &iface, &syntax, &protseq,
164  &endpoint, &address);
165  if (rpc_status != RPC_S_OK)
166  break;
167  entry = find_ept_entry(&iface, &syntax, protseq, endpoint, address, &entries[i].object);
168 
169  I_RpcFree(protseq);
170  I_RpcFree(endpoint);
171  I_RpcFree(address);
172 
173  if (entry)
175  else
176  {
178  break;
179  }
180  }
181 
183 }
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
uint8_t entry
Definition: isohybrid.c:63
#define WINE_TRACE
Definition: debug.h:358
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
long RPC_STATUS
Definition: rpc.h:52
GLenum GLclampf GLint i
Definition: glfuncs.h:14
struct endpoint endpoint
Definition: nis.h:15
GLuint address
Definition: glext.h:9393
Definition: epmp.c:28
RPC_SYNTAX_IDENTIFIER syntax
Definition: epmp.c:33
static struct registered_ept_entry * find_ept_entry(const RPC_SYNTAX_IDENTIFIER *iface, const RPC_SYNTAX_IDENTIFIER *syntax, const char *protseq, const char *endpoint, const char *address, const UUID *object)
Definition: epmp.c:63
RPC_SYNTAX_IDENTIFIER iface
Definition: epmp.c:32
unsigned int unsigned32
Definition: rpc.c:43
static void delete_registered_ept_entry(struct registered_ept_entry *entry)
Definition: epmp.c:54
#define EPT_S_NOT_REGISTERED
Definition: winerror.h:1061
char * protseq
Definition: epmp.c:34
RPC_STATUS WINAPI TowerExplode(const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax, char **protseq, char **endpoint, char **address)
Definition: rpc_epmap.c:524
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csEpm
Definition: epmp.c:42
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

◆ ept_inq_object()

void __cdecl ept_inq_object ( handle_t  h,
GUID ept_object,
error_status_t status 
)

Definition at line 270 of file epmp.c.

273 {
274  WINE_FIXME("(%p, %p, %p): stub\n", h, ept_object, status);
275 
277 }
#define EPT_S_CANT_PERFORM_OP
Definition: winerror.h:1060
#define WINE_FIXME
Definition: debug.h:370
Definition: ps.c:97

◆ ept_insert()

void __cdecl ept_insert ( handle_t  h,
unsigned32  num_ents,
ept_entry_t  entries[],
boolean32  replace,
error_status_t status 
)

Definition at line 92 of file epmp.c.

Referenced by epm_register(), and RpcEpUnregister().

97 {
98  unsigned32 i;
99  RPC_STATUS rpc_status;
100 
101  WINE_TRACE("(%p, %u, %p, %u, %p)\n", h, num_ents, entries, replace, status);
102 
103  *status = RPC_S_OK;
104 
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 */
114  break;
115  }
116  memcpy(entry->annotation, entries[i].annotation, sizeof(entries[i].annotation));
117  rpc_status = TowerExplode(entries[i].tower, &entry->iface, &entry->syntax,
118  &entry->protseq, &entry->endpoint,
119  &entry->address);
120  if (rpc_status != RPC_S_OK)
121  {
122  WINE_WARN("TowerExplode failed %u\n", rpc_status);
123  *status = rpc_status;
124  HeapFree(GetProcessHeap(), 0, entry);
125  break; /* FIXME: more cleanup? */
126  }
127 
128  entry->object = entries[i].object;
129 
130  if (replace)
131  {
132  /* FIXME: correct find algorithm */
133  struct registered_ept_entry *old_entry = find_ept_entry(&entry->iface, &entry->syntax, entry->protseq, entry->endpoint, entry->address, &entry->object);
134  if (old_entry) delete_registered_ept_entry(old_entry);
135  }
137  }
138 
140 }
char * endpoint
Definition: epmp.c:35
uint8_t entry
Definition: isohybrid.c:63
#define WINE_TRACE
Definition: debug.h:358
static struct list registered_ept_entry_list
Definition: epmp.c:40
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
long RPC_STATUS
Definition: rpc.h:52
GLenum GLclampf GLint i
Definition: glfuncs.h:14
GUID object
Definition: epmp.c:31
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
Definition: replace.c:47
char * address
Definition: epmp.c:36
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
struct list entry
Definition: epmp.c:30
char annotation[ept_max_annotation_size]
Definition: epmp.c:37
Definition: epmp.c:28
RPC_SYNTAX_IDENTIFIER syntax
Definition: epmp.c:33
static struct registered_ept_entry * find_ept_entry(const RPC_SYNTAX_IDENTIFIER *iface, const RPC_SYNTAX_IDENTIFIER *syntax, const char *protseq, const char *endpoint, const char *address, const UUID *object)
Definition: epmp.c:63
RPC_SYNTAX_IDENTIFIER iface
Definition: epmp.c:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned int unsigned32
Definition: rpc.c:43
#define WINE_WARN
Definition: debug.h:364
static void delete_registered_ept_entry(struct registered_ept_entry *entry)
Definition: epmp.c:54
char * protseq
Definition: epmp.c:34
RPC_STATUS WINAPI TowerExplode(const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax, char **protseq, char **endpoint, char **address)
Definition: rpc_epmap.c:524
#define EPT_S_CANT_PERFORM_OP
Definition: winerror.h:1060
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csEpm
Definition: epmp.c:42
#define HeapFree(x, y, z)
Definition: compat.h:394
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

◆ ept_lookup()

void __cdecl ept_lookup ( handle_t  h,
unsigned32  inquiry_type,
uuid_p_t  object,
rpc_if_id_p_t  interface_id,
unsigned32  vers_option,
ept_lookup_handle_t *  entry_handle,
unsigned32  max_ents,
unsigned32 num_ents,
ept_entry_t  entries[],
error_status_t status 
)

Definition at line 185 of file epmp.c.

195 {
196  WINE_FIXME("(%p, %p, %p): stub\n", h, entry_handle, status);
197 
199 }
#define EPT_S_CANT_PERFORM_OP
Definition: winerror.h:1060
#define WINE_FIXME
Definition: debug.h:370
Definition: ps.c:97

◆ ept_lookup_handle_free()

void __cdecl ept_lookup_handle_free ( handle_t  h,
ept_lookup_handle_t *  entry_handle,
error_status_t status 
)

Definition at line 261 of file epmp.c.

264 {
265  WINE_FIXME("(%p, %p, %p): stub\n", h, entry_handle, status);
266 
268 }
#define EPT_S_CANT_PERFORM_OP
Definition: winerror.h:1060
#define WINE_FIXME
Definition: debug.h:370
Definition: ps.c:97

◆ ept_lookup_handle_t_rundown()

void __RPC_USER ept_lookup_handle_t_rundown ( ept_lookup_handle_t  entry_handle)

Definition at line 87 of file epmp.c.

88 {
89  WINE_FIXME("%p\n", entry_handle);
90 }
#define WINE_FIXME
Definition: debug.h:370

◆ ept_map()

void __cdecl ept_map ( handle_t  h,
uuid_p_t  object,
twr_p_t  map_tower,
ept_lookup_handle_t *  entry_handle,
unsigned32  max_towers,
unsigned32 num_towers,
twr_p_t towers,
error_status_t status 
)

Definition at line 201 of file epmp.c.

Referenced by RpcEpResolveBinding().

209 {
210  RPC_STATUS rpc_status;
212  char *protseq;
213  struct registered_ept_entry *entry;
214 
215  *status = RPC_S_OK;
216  *num_towers = 0;
217 
218  WINE_TRACE("(%p, %p, %p, %p, %u, %p, %p, %p)\n", h, object, map_tower,
219  entry_handle, max_towers, num_towers, towers, status);
220 
221  rpc_status = TowerExplode(map_tower, &iface, &syntax, &protseq,
222  NULL, NULL);
223  if (rpc_status != RPC_S_OK)
224  {
225  *status = rpc_status;
226  return;
227  }
228 
230 
232  {
233  if (IsEqualGUID(&entry->iface.SyntaxGUID, &iface.SyntaxGUID) &&
236  !memcmp(&entry->syntax, &syntax, sizeof(syntax)) &&
237  !strcmp(entry->protseq, protseq) &&
238  ((!object && IsEqualGUID(&entry->object, &nil_object)) || IsEqualGUID(object, &entry->object)))
239  {
240  if (*num_towers < max_towers)
241  {
242  rpc_status = TowerConstruct(&entry->iface, &entry->syntax,
243  entry->protseq, entry->endpoint,
244  entry->address,
245  &towers[*num_towers]);
246  if (rpc_status != RPC_S_OK)
247  {
248  *status = rpc_status;
249  break; /* FIXME: more cleanup? */
250  }
251  }
252  (*num_towers)++;
253  }
254  }
255 
257 
258  I_RpcFree(protseq);
259 }
static const UUID nil_object
Definition: epmp.c:51
char * endpoint
Definition: epmp.c:35
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
void WINAPI I_RpcFree(void *Object)
Definition: rpcrt4_main.c:725
unsigned short MajorVersion
Definition: rpcdcep.h:27
uint8_t entry
Definition: isohybrid.c:63
RPC_STATUS WINAPI TowerConstruct(const RPC_SYNTAX_IDENTIFIER *object, const RPC_SYNTAX_IDENTIFIER *syntax, const char *protseq, const char *endpoint, const char *address, twr_t **tower)
Definition: rpc_epmap.c:596
#define WINE_TRACE
Definition: debug.h:358
static struct list registered_ept_entry_list
Definition: epmp.c:40
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
long RPC_STATUS
Definition: rpc.h:52
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
GUID object
Definition: epmp.c:31
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
smooth NULL
Definition: ftsmooth.c:416
char * address
Definition: epmp.c:36
Definition: epmp.c:28
RPC_SYNTAX_IDENTIFIER syntax
Definition: epmp.c:33
unsigned short MinorVersion
Definition: rpcdcep.h:28
RPC_SYNTAX_IDENTIFIER iface
Definition: epmp.c:32
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4024
char * protseq
Definition: epmp.c:34
RPC_STATUS WINAPI TowerExplode(const twr_t *tower, PRPC_SYNTAX_IDENTIFIER object, PRPC_SYNTAX_IDENTIFIER syntax, char **protseq, char **endpoint, char **address)
Definition: rpc_epmap.c:524
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static CRITICAL_SECTION csEpm
Definition: epmp.c:42
#define RPC_S_OK
Definition: rpcnterr.h:22
Definition: ps.c:97

◆ ept_mgmt_delete()

void __cdecl ept_mgmt_delete ( handle_t  h,
boolean32  object_speced,
uuid_p_t  object,
twr_p_t  tower,
error_status_t status 
)

Definition at line 279 of file epmp.c.

284 {
285  WINE_FIXME("(%p, %d, %p, %p, %p): stub\n", h, object_speced, object, tower, status);
286 
288 }
#define EPT_S_CANT_PERFORM_OP
Definition: winerror.h:1060
#define WINE_FIXME
Definition: debug.h:370
Definition: ps.c:97

◆ find_ept_entry()

static struct registered_ept_entry* find_ept_entry ( const RPC_SYNTAX_IDENTIFIER iface,
const RPC_SYNTAX_IDENTIFIER syntax,
const char protseq,
const char endpoint,
const char address,
const UUID object 
)
static

Definition at line 63 of file epmp.c.

Referenced by ept_delete(), and ept_insert().

67 {
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",
80  wine_dbgstr_guid(&entry->object));
81  return entry;
82  }
83  WINE_TRACE("not found\n");
84  return NULL;
85 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
unsigned short MajorVersion
Definition: rpcdcep.h:27
uint8_t entry
Definition: isohybrid.c:63
const char * wine_dbgstr_guid(const GUID *guid)
#define WINE_TRACE
Definition: debug.h:358
static struct list registered_ept_entry_list
Definition: epmp.c:40
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
GUID object
Definition: epmp.c:31
RPC_VERSION SyntaxVersion
Definition: rpcdcep.h:33
smooth NULL
Definition: ftsmooth.c:416
Definition: epmp.c:28
RPC_SYNTAX_IDENTIFIER syntax
Definition: epmp.c:33
unsigned short MinorVersion
Definition: rpcdcep.h:28
RPC_SYNTAX_IDENTIFIER iface
Definition: epmp.c:32
char * protseq
Definition: epmp.c:34
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

Variable Documentation

◆ critsect_debug

CRITICAL_SECTION_DEBUG critsect_debug
static
Initial value:
=
{
0, 0, &csEpm,
0, 0, { (DWORD_PTR)(__FILE__ ": csEpm") }
}
#define DWORD_PTR
Definition: treelist.c:76
static CRITICAL_SECTION_DEBUG critsect_debug
Definition: epmp.c:43
LIST_ENTRY ProcessLocksList
Definition: winbase.h:848
static CRITICAL_SECTION csEpm
Definition: epmp.c:42

Definition at line 43 of file epmp.c.

◆ csEpm

static CRITICAL_SECTION csEpm = { &critsect_debug, -1, 0, 0, 0, 0 }
static

Definition at line 42 of file epmp.c.

◆ nil_object

const UUID nil_object
static

Definition at line 51 of file epmp.c.

◆ registered_ept_entry_list

struct list registered_ept_entry_list = LIST_INIT(registered_ept_entry_list)
static

Definition at line 40 of file epmp.c.