ReactOS 0.4.16-dev-197-g92996da
browser.c File Reference
#include "netapi32.h"
#include <rpc.h>
#include <lmbrowsr.h>
#include <lmserver.h>
#include "browser_c.h"
Include dependency graph for browser.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netapi32)
 
handle_t __RPC_USER BROWSER_IDENTIFY_HANDLE_bind (BROWSER_IDENTIFY_HANDLE pszSystemName)
 
void __RPC_USER BROWSER_IDENTIFY_HANDLE_unbind (BROWSER_IDENTIFY_HANDLE pszSystemName, handle_t hBinding)
 
NET_API_STATUS WINAPI I_BrowserDebugTrace (_In_opt_ LPWSTR ServerName, _In_ PCHAR Buffer)
 
NET_API_STATUS WINAPI I_BrowserQueryEmulatedDomains (_In_opt_ LPWSTR ServerName, _Out_ PBROWSER_EMULATED_DOMAIN *EmulatedDomains, _Out_ LPDWORD EntriesRead)
 
NET_API_STATUS WINAPI I_BrowserQueryOtherDomains (_In_opt_ LPCWSTR ServerName, _Out_ LPBYTE *BufPtr, _Out_ LPDWORD EntriesRead, _Out_ LPDWORD TotalEntries)
 
NET_API_STATUS WINAPI I_BrowserServerEnum (_In_opt_ LPCWSTR ServerName, _In_opt_ LPCWSTR Transport, _In_opt_ LPCWSTR ClientName, _In_ DWORD Level, _Out_ LPBYTE *BufPtr, _In_ DWORD PrefMaxLen, _Out_ LPDWORD EntriesRead, _Out_ LPDWORD TotalEntries, _In_ DWORD ServerType, _In_opt_ LPCWSTR Domain, _Inout_opt_ LPDWORD ResumeHandle)
 
NET_API_STATUS WINAPI I_BrowserQueryStatistics (_In_opt_ LPCWSTR ServerName, _Inout_ LPBROWSER_STATISTICS *Statistics)
 
NET_API_STATUS WINAPI I_BrowserResetStatistics (_In_opt_ LPCWSTR ServerName)
 
NET_API_STATUS WINAPI I_BrowserResetNetlogonState (_In_ LPCWSTR ServerName)
 
NET_API_STATUS WINAPI I_BrowserSetNetlogonState (_In_ LPWSTR ServerName, _In_ LPWSTR DomainName, _In_ LPWSTR EmulatedServerName, _In_ DWORD Role)
 
NET_API_STATUS WINAPI NetBrowserStatisticsGet (_In_ LPWSTR ServerName, _In_ DWORD Level, _Out_ LPBYTE *Buffer)
 
NET_API_STATUS WINAPI NetServerEnum (_In_opt_ LMCSTR servername, _In_ DWORD level, _Out_ LPBYTE *bufptr, _In_ DWORD prefmaxlen, _Out_ LPDWORD entriesread, _Out_ LPDWORD totalentries, _In_ DWORD servertype, _In_opt_ LMCSTR domain, _Inout_opt_ LPDWORD resume_handle)
 
NET_API_STATUS WINAPI NetServerEnumEx (_In_opt_ LMCSTR ServerName, _In_ DWORD Level, _Out_ LPBYTE *Bufptr, _In_ DWORD PrefMaxlen, _Out_ LPDWORD EntriesRead, _Out_ LPDWORD totalentries, _In_ DWORD servertype, _In_opt_ LMCSTR domain, _In_opt_ LMCSTR FirstNameToReturn)
 

Function Documentation

◆ BROWSER_IDENTIFY_HANDLE_bind()

handle_t __RPC_USER BROWSER_IDENTIFY_HANDLE_bind ( BROWSER_IDENTIFY_HANDLE  pszSystemName)

Definition at line 24 of file browser.c.

25{
27 LPWSTR pszStringBinding;
29
30 TRACE("BROWSER_IDENTIFY_HANDLE_bind() called\n");
31
33 L"ncacn_np",
34 pszSystemName,
35 L"\\pipe\\browser",
36 NULL,
37 &pszStringBinding);
38 if (status)
39 {
40 TRACE("RpcStringBindingCompose returned 0x%x\n", status);
41 return NULL;
42 }
43
44 /* Set the binding handle that will be used to bind to the server. */
45 status = RpcBindingFromStringBindingW(pszStringBinding,
46 &hBinding);
47 if (status)
48 {
49 TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
50 }
51
52 status = RpcStringFreeW(&pszStringBinding);
53 if (status)
54 {
55// TRACE("RpcStringFree returned 0x%x\n", status);
56 }
57
58 return hBinding;
59}
handle_t hBinding
Definition: ctx_c.c:54
#define NULL
Definition: types.h:112
#define L(x)
Definition: ntvdm.h:50
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:880
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:510
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:175
long RPC_STATUS
Definition: rpc.h:52
#define TRACE(s)
Definition: solgame.cpp:4
Definition: ps.c:97
WCHAR * LPWSTR
Definition: xmlstorage.h:184

◆ BROWSER_IDENTIFY_HANDLE_unbind()

void __RPC_USER BROWSER_IDENTIFY_HANDLE_unbind ( BROWSER_IDENTIFY_HANDLE  pszSystemName,
handle_t  hBinding 
)

Definition at line 63 of file browser.c.

65{
67
68 TRACE("BROWSER_IDENTIFY_HANDLE_unbind() called\n");
69
71 if (status)
72 {
73 TRACE("RpcBindingFree returned 0x%x\n", status);
74 }
75}
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:787

◆ I_BrowserDebugTrace()

NET_API_STATUS WINAPI I_BrowserDebugTrace ( _In_opt_ LPWSTR  ServerName,
_In_ PCHAR  Buffer 
)

Definition at line 80 of file browser.c.

83{
85
86 TRACE("I_BrowserDebugTrace(%s %s)\n",
87 debugstr_w(ServerName), Buffer);
88
90 {
91 status = I_BrowserrDebugTrace(ServerName,
92 Buffer);
93 }
95 {
97 }
99
100 return status;
101}
NET_API_STATUS __stdcall I_BrowserrDebugTrace(BROWSER_IDENTIFY_HANDLE ServerName, LPSTR String)
Definition: rpcserver.c:117
Definition: bufpool.h:45
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define debugstr_w
Definition: kernel32.h:32
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:740
#define RpcEndExcept
Definition: rpc.h:128
#define RpcTryExcept
Definition: rpc.h:126
#define RpcExcept(expr)
Definition: rpc.h:127
#define RpcExceptionCode()
Definition: rpc.h:132

◆ I_BrowserQueryEmulatedDomains()

NET_API_STATUS WINAPI I_BrowserQueryEmulatedDomains ( _In_opt_ LPWSTR  ServerName,
_Out_ PBROWSER_EMULATED_DOMAIN EmulatedDomains,
_Out_ LPDWORD  EntriesRead 
)

Definition at line 106 of file browser.c.

110{
113
114 TRACE("I_BrowserQueryEmulatedDomains(%s %p %p)\n",
115 debugstr_w(ServerName), EmulatedDomains, EntriesRead);
116
117 *EmulatedDomains = NULL;
118 *EntriesRead = 0;
119
121 {
123 &Container);
124
125 if (status == NERR_Success)
126 {
127 *EmulatedDomains = (PBROWSER_EMULATED_DOMAIN)Container.Buffer;
128 *EntriesRead = Container.EntriesRead;
129 }
130 }
132 {
134 }
136
137 return status;
138}
NET_API_STATUS __stdcall I_BrowserrQueryEmulatedDomains(BROWSER_IDENTIFY_HANDLE ServerName, PBROWSER_EMULATED_DOMAIN_CONTAINER EmulatedDomains)
Definition: rpcserver.c:190
struct _BROWSER_EMULATED_DOMAIN * PBROWSER_EMULATED_DOMAIN
#define NERR_Success
Definition: lmerr.h:5
PBROWSER_EMULATED_DOMAIN Buffer
Definition: browser.idl:21

◆ I_BrowserQueryOtherDomains()

NET_API_STATUS WINAPI I_BrowserQueryOtherDomains ( _In_opt_ LPCWSTR  ServerName,
_Out_ LPBYTE BufPtr,
_Out_ LPDWORD  EntriesRead,
_Out_ LPDWORD  TotalEntries 
)

Definition at line 143 of file browser.c.

148{
149 SERVER_INFO_100_CONTAINER Level100Container = {0, NULL};
150 SERVER_ENUM_STRUCT EnumStruct;
152
153 TRACE("I_BrowserQueryOtherDomains(%s %p %p %p)\n",
154 debugstr_w(ServerName), BufPtr, EntriesRead, TotalEntries);
155
156 EnumStruct.Level = 100;
157 EnumStruct.ServerInfo.Level100 = &Level100Container;
158
160 {
162 &EnumStruct,
163 TotalEntries);
164
166 {
167 *BufPtr = (LPBYTE)EnumStruct.ServerInfo.Level100->Buffer;
168 *EntriesRead = EnumStruct.ServerInfo.Level100->EntriesRead;
169 }
170 }
172 {
174 }
176
177 return status;
178}
NET_API_STATUS __stdcall I_BrowserrQueryOtherDomains(BROWSER_IDENTIFY_HANDLE ServerName, LPSERVER_ENUM_STRUCT EnumStruct, LPDWORD TotalEntries)
Definition: rpcserver.c:93
#define ERROR_MORE_DATA
Definition: dderror.h:13
union _SERVER_ENUM_STRUCT::_SERVER_ENUM_UNION ServerInfo
LPSERVER_INFO_100 Buffer
Definition: browser.idl:35
uint16_t * PWSTR
Definition: typedefs.h:56
unsigned char * LPBYTE
Definition: typedefs.h:53
LPSERVER_INFO_100_CONTAINER Level100
Definition: browser.idl:43

◆ I_BrowserQueryStatistics()

NET_API_STATUS WINAPI I_BrowserQueryStatistics ( _In_opt_ LPCWSTR  ServerName,
_Inout_ LPBROWSER_STATISTICS Statistics 
)

Definition at line 238 of file browser.c.

241{
243
244 TRACE("I_BrowserQueryStatistics(%s %p)\n",
245 debugstr_w(ServerName), Statistics);
246
248 {
250 Statistics);
251 }
253 {
255 }
257
258 return status;
259}
NET_API_STATUS __stdcall I_BrowserrQueryStatistics(BROWSER_IDENTIFY_HANDLE ServerName, LPBROWSER_STATISTICS *Statistics)
Definition: rpcserver.c:129

◆ I_BrowserResetNetlogonState()

NET_API_STATUS WINAPI I_BrowserResetNetlogonState ( _In_ LPCWSTR  ServerName)

Definition at line 288 of file browser.c.

290{
292
293 TRACE("I_BrowserResetNetlogonState(%s)\n",
294 debugstr_w(ServerName));
295
297 {
299 }
301 {
303 }
305
306 return status;
307}
NET_API_STATUS __stdcall I_BrowserrResetNetlogonState(BROWSER_IDENTIFY_HANDLE ServerName)
Definition: rpcserver.c:106

◆ I_BrowserResetStatistics()

NET_API_STATUS WINAPI I_BrowserResetStatistics ( _In_opt_ LPCWSTR  ServerName)

Definition at line 264 of file browser.c.

266{
268
269 TRACE("I_BrowserResetStatistics(%s)\n",
270 debugstr_w(ServerName));
271
273 {
275 }
277 {
279 }
281
282 return status;
283}
NET_API_STATUS __stdcall I_BrowserrResetStatistics(BROWSER_IDENTIFY_HANDLE ServerName)
Definition: rpcserver.c:141

◆ I_BrowserServerEnum()

NET_API_STATUS WINAPI I_BrowserServerEnum ( _In_opt_ LPCWSTR  ServerName,
_In_opt_ LPCWSTR  Transport,
_In_opt_ LPCWSTR  ClientName,
_In_ DWORD  Level,
_Out_ LPBYTE BufPtr,
_In_ DWORD  PrefMaxLen,
_Out_ LPDWORD  EntriesRead,
_Out_ LPDWORD  TotalEntries,
_In_ DWORD  ServerType,
_In_opt_ LPCWSTR  Domain,
_Inout_opt_ LPDWORD  ResumeHandle 
)

Definition at line 183 of file browser.c.

195{
196 SERVER_INFO_100_CONTAINER Level100Container = {0, NULL};
197 SERVER_ENUM_STRUCT EnumStruct;
199
200 TRACE("I_BrowserServerEnum(%s %s %s %lu %p %lu %p %p %lu %s %p)\n",
201 debugstr_w(ServerName), debugstr_w(Transport), debugstr_w(ClientName),
202 Level, BufPtr, PrefMaxLen, EntriesRead, TotalEntries, ServerType,
203 debugstr_w(Domain), ResumeHandle);
204
205 EnumStruct.Level = 100;
206 EnumStruct.ServerInfo.Level100 = &Level100Container;
207
209 {
210 status = I_BrowserrServerEnum((PWSTR)ServerName,
211 (PWSTR)Transport,
212 (PWSTR)ClientName,
213 &EnumStruct,
214 PrefMaxLen,
215 TotalEntries,
216 ServerType,
217 (PWSTR)Domain,
218 ResumeHandle);
219
221 {
222 *BufPtr = (LPBYTE)EnumStruct.ServerInfo.Level100->Buffer;
223 *EntriesRead = EnumStruct.ServerInfo.Level100->EntriesRead;
224 }
225 }
227 {
229 }
231
232 return status;
233}
NET_API_STATUS __stdcall I_BrowserrServerEnum(BROWSER_IDENTIFY_HANDLE ServerName, LPWSTR Transport, LPWSTR ClientName, LPSERVER_ENUM_STRUCT EnumStruct, DWORD PreferedMaximumLength, LPDWORD TotalEntries, DWORD ServerType, LPWSTR Domain, LPDWORD ResumeHandle)
Definition: rpcserver.c:64
_IRQL_requires_same_ typedef _In_ ULONG _In_ UCHAR Level
Definition: wmitypes.h:56

◆ I_BrowserSetNetlogonState()

NET_API_STATUS WINAPI I_BrowserSetNetlogonState ( _In_ LPWSTR  ServerName,
_In_ LPWSTR  DomainName,
_In_ LPWSTR  EmulatedServerName,
_In_ DWORD  Role 
)

Definition at line 312 of file browser.c.

317{
319
320 TRACE("I_BrowserSetNetlogonState(%s %s %s %lu)\n",
321 debugstr_w(ServerName), debugstr_w(ServerName),
322 debugstr_w(EmulatedServerName), Role);
323
325 {
327 DomainName,
328 EmulatedServerName,
329 Role);
330 }
332 {
334 }
336
337 return status;
338}
NET_API_STATUS __stdcall I_BrowserrSetNetlogonState(BROWSER_IDENTIFY_HANDLE ServerName, LPWSTR DomainName, LPWSTR EmulatedComputerName, DWORD Role)
Definition: rpcserver.c:176

◆ NetBrowserStatisticsGet()

NET_API_STATUS WINAPI NetBrowserStatisticsGet ( _In_ LPWSTR  ServerName,
_In_ DWORD  Level,
_Out_ LPBYTE Buffer 
)

Definition at line 343 of file browser.c.

347{
348 BROWSER_STATISTICS_STRUCT StatisticsStruct;
349 BROWSER_STATISTICS_100_CONTAINER Level100Container = {0, NULL};
350 BROWSER_STATISTICS_101_CONTAINER Level101Container = {0, NULL};
352
353 TRACE("NetBrowserStatisticsGet(%s %lu %p)\n",
354 debugstr_w(ServerName), Level, Buffer);
355
356 if (Level != 100 && Level != 101)
357 return ERROR_INVALID_LEVEL;
358
359 StatisticsStruct.Level = Level;
360 switch (Level)
361 {
362 case 100:
363 StatisticsStruct.Statistics.Level100 = &Level100Container;
364 break;
365
366 case 101:
367 StatisticsStruct.Statistics.Level101 = &Level101Container;
368 break;
369 }
370
372 {
373 status = NetrBrowserStatisticsGet(ServerName,
374 Level,
375 &StatisticsStruct);
376
377 switch (Level)
378 {
379 case 100:
380 if (StatisticsStruct.Statistics.Level100->Buffer != NULL)
381 {
382 *Buffer = (LPBYTE)StatisticsStruct.Statistics.Level100->Buffer;
383 }
384 break;
385
386 case 101:
387 if (StatisticsStruct.Statistics.Level101->Buffer != NULL)
388 {
389 *Buffer = (LPBYTE)StatisticsStruct.Statistics.Level101->Buffer;
390 }
391 break;
392 }
393 }
395 {
397 }
399
400 return status;
401}
NET_API_STATUS __stdcall NetrBrowserStatisticsGet(BROWSER_IDENTIFY_HANDLE ServerName, DWORD Level, LPBROWSER_STATISTICS_STRUCT StatisticsStruct)
Definition: rpcserver.c:163
PBROWSER_STATISTICS_100 Buffer
Definition: browser.idl:107
PBROWSER_STATISTICS_101 Buffer
Definition: browser.idl:113
union _BROWSER_STATISTICS_STRUCT::_BROWSER_STATISTICS_UNION Statistics
PBROWSER_STATISTICS_100_CONTAINER Level100
Definition: browser.idl:121
PBROWSER_STATISTICS_101_CONTAINER Level101
Definition: browser.idl:122
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196

◆ NetServerEnum()

NET_API_STATUS WINAPI NetServerEnum ( _In_opt_ LMCSTR  servername,
_In_ DWORD  level,
_Out_ LPBYTE bufptr,
_In_ DWORD  prefmaxlen,
_Out_ LPDWORD  entriesread,
_Out_ LPDWORD  totalentries,
_In_ DWORD  servertype,
_In_opt_ LMCSTR  domain,
_Inout_opt_ LPDWORD  resume_handle 
)

Definition at line 406 of file browser.c.

416{
417 TRACE("NetServerEnum(%s %lu %p %lu %p %p %lu %s %p)\n",
418 debugstr_w(servername), level, bufptr, prefmaxlen, entriesread,
419 totalentries, servertype, debugstr_w(domain), resume_handle);
420
421 if (resume_handle != NULL)
422 *resume_handle = 0;
423
424 return NetServerEnumEx(servername,
425 level,
426 bufptr,
427 prefmaxlen,
428 entriesread,
429 totalentries,
430 servertype,
431 domain,
432 NULL);
433}
NET_API_STATUS WINAPI NetServerEnumEx(_In_opt_ LMCSTR ServerName, _In_ DWORD Level, _Out_ LPBYTE *Bufptr, _In_ DWORD PrefMaxlen, _Out_ LPDWORD EntriesRead, _Out_ LPDWORD totalentries, _In_ DWORD servertype, _In_opt_ LMCSTR domain, _In_opt_ LMCSTR FirstNameToReturn)
Definition: browser.c:438
GLint level
Definition: gl.h:1546
Definition: cookie.c:42
static unsigned int bufptr
Definition: tncon.cpp:77

◆ NetServerEnumEx()

NET_API_STATUS WINAPI NetServerEnumEx ( _In_opt_ LMCSTR  ServerName,
_In_ DWORD  Level,
_Out_ LPBYTE Bufptr,
_In_ DWORD  PrefMaxlen,
_Out_ LPDWORD  EntriesRead,
_Out_ LPDWORD  totalentries,
_In_ DWORD  servertype,
_In_opt_ LMCSTR  domain,
_In_opt_ LMCSTR  FirstNameToReturn 
)

Definition at line 438 of file browser.c.

448{
449 FIXME("NetServerEnumEx(%s %lu %p %lu %p %p %lu %s %s)\n",
450 debugstr_w(ServerName), Level, Bufptr, PrefMaxlen, EntriesRead, totalentries,
451 servertype, debugstr_w(domain), debugstr_w(FirstNameToReturn));
452
454}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERROR_NO_BROWSER_SERVERS_FOUND
Definition: winerror.h:1415

Referenced by NetServerEnum().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netapi32  )