ReactOS  0.4.15-dev-506-ga3ec01c
netlogon.c File Reference
#include "netapi32.h"
#include <winsock2.h>
#include <rpc.h>
#include <dsrole.h>
#include <dsgetdc.h>
#include "netlogon_c.h"
Include dependency graph for netlogon.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netapi32)
 
DWORD WINAPI DsGetDcNameWithAccountA (_In_opt_ LPCSTR ComputerName, _In_opt_ LPCSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
 
DWORD WINAPI DsGetDcNameWithAccountW (_In_opt_ LPCWSTR ComputerName, _In_opt_ LPCWSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCWSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCWSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
 
handle_t __RPC_USER LOGONSRV_HANDLE_bind (LOGONSRV_HANDLE pszSystemName)
 
void __RPC_USER LOGONSRV_HANDLE_unbind (LOGONSRV_HANDLE pszSystemName, handle_t hBinding)
 
DWORD WINAPI DsAddressToSiteNamesA (_In_opt_ LPCSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPSTR **SiteNames)
 
DWORD WINAPI DsAddressToSiteNamesW (_In_opt_ LPCWSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPWSTR **SiteNames)
 
DWORD WINAPI DsAddressToSiteNamesExA (_In_opt_ LPCSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPSTR **SiteNames, _Out_ LPSTR **SubnetNames)
 
DWORD WINAPI DsAddressToSiteNamesExW (_In_opt_ LPCWSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPWSTR **SiteNames, _Out_ LPWSTR **SubnetNames)
 
DWORD WINAPI DsDeregisterDnsHostRecordsA (_In_opt_ LPSTR ServerName, _In_opt_ LPSTR DnsDomainName, _In_opt_ GUID *DomainGuid, _In_opt_ GUID *DsaGuid, _In_ LPSTR DnsHostName)
 
DWORD WINAPI DsDeregisterDnsHostRecordsW (_In_opt_ LPWSTR ServerName, _In_opt_ LPWSTR DnsDomainName, _In_opt_ GUID *DomainGuid, _In_opt_ GUID *DsaGuid, _In_ LPWSTR DnsHostName)
 
DWORD WINAPI DsEnumerateDomainTrustsA (_In_opt_ LPSTR ServerName, _In_ ULONG Flags, _Out_ PDS_DOMAIN_TRUSTSA *Domains, _Out_ PULONG DomainCount)
 
DWORD WINAPI DsEnumerateDomainTrustsW (_In_opt_ LPWSTR ServerName, _In_ ULONG Flags, _Out_ PDS_DOMAIN_TRUSTSW *Domains, _Out_ PULONG DomainCount)
 
DWORD WINAPI DsGetDcNameA (_In_opt_ LPCSTR ComputerName, _In_ LPCSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
 
DWORD WINAPI DsGetDcNameW (_In_opt_ LPCWSTR ComputerName, _In_ LPCWSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCWSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
 
DWORD WINAPI DsGetDcSiteCoverageA (_In_opt_ LPCSTR ServerName, _Out_ PULONG EntryCount, _Out_ LPSTR **SiteNames)
 
DWORD WINAPI DsGetDcSiteCoverageW (_In_opt_ LPCWSTR ServerName, _Out_ PULONG EntryCount, _Out_ LPWSTR **SiteNames)
 
DWORD WINAPI DsGetForestTrustInformationW (_In_opt_ LPCWSTR ServerName, _In_opt_ LPCWSTR TrustedDomainName, _In_ DWORD Flags, _Out_ PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
 
DWORD WINAPI DsGetSiteNameA (_In_opt_ LPCSTR ComputerName, _Out_ LPSTR *SiteName)
 
DWORD WINAPI DsGetSiteNameW (_In_opt_ LPCWSTR ComputerName, _Out_ LPWSTR *SiteName)
 
DWORD WINAPI DsMergeForestTrustInformationW (_In_ LPCWSTR DomainName, _In_ PLSA_FOREST_TRUST_INFORMATION NewForestTrustInfo, _In_opt_ PLSA_FOREST_TRUST_INFORMATION OldForestTrustInfo, _Out_ PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
 
DWORD WINAPI DsValidateSubnetNameA (_In_ LPCSTR SubnetName)
 
DWORD WINAPI DsValidateSubnetNameW (_In_ LPCWSTR SubnetName)
 
NTSTATUS WINAPI NetEnumerateTrustedDomains (_In_ LPWSTR ServerName, _Out_ LPWSTR *DomainNames)
 
NET_API_STATUS WINAPI NetGetAnyDCName (_In_opt_ LPCWSTR ServerName, _In_opt_ LPCWSTR DomainName, _Out_ LPBYTE *BufPtr)
 
NET_API_STATUS WINAPI NetGetDCName (_In_opt_ LPCWSTR ServerName, _In_opt_ LPCWSTR DomainName, _Out_ LPBYTE *BufPtr)
 
NET_API_STATUS WINAPI NetLogonGetTimeServiceParentDomain (_In_ LPWSTR ServerName, _Out_ LPWSTR *DomainName, _Out_ LPBOOL PdcSameSite)
 
NTSTATUS WINAPI NetLogonSetServiceBits (_In_ LPWSTR ServerName, _In_ DWORD ServiceBitsOfInterest, _In_ DWORD ServiceBits)
 

Function Documentation

◆ DsAddressToSiteNamesA()

DWORD WINAPI DsAddressToSiteNamesA ( _In_opt_ LPCSTR  ComputerName,
_In_ DWORD  EntryCount,
_In_ PSOCKET_ADDRESS  SocketAddresses,
_Out_ LPSTR **  SiteNames 
)

Definition at line 109 of file netlogon.c.

114 {
115  PWSTR pComputerNameW = NULL, *pSiteNamesW = NULL;
116  PSTR *pSiteNamesA = NULL, Ptr;
119  ULONG BufferSize, i;
122 
123  TRACE("DsAddressToSiteNamesA(%s, %lu, %p, %p)\n",
124  debugstr_a(ComputerName), EntryCount, SocketAddresses, SiteNames);
125 
126  if (EntryCount == 0)
128 
129  if (ComputerName != NULL)
130  {
131  pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
132  if (pComputerNameW == NULL)
133  {
135  goto done;
136  }
137  }
138 
139  /* Call the Unicode function */
140  status = DsAddressToSiteNamesW(pComputerNameW,
141  EntryCount,
142  SocketAddresses,
143  &pSiteNamesW);
144  if (status != NERR_Success)
145  goto done;
146 
147  /* Calculate the required site names buffer size */
148  BufferSize = EntryCount * sizeof(PSTR);
149  for (i = 0; i < EntryCount; i++)
150  {
151  if (pSiteNamesW[i] != NULL)
152  {
154  pSiteNamesW[i]);
156  }
157  }
158 
159  /* Allocate the site names ANSI buffer */
160  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pSiteNamesA);
161  if (status != NERR_Success)
162  goto done;
163 
164  /* Convert the site names */
165  Ptr = (PSTR)((ULONG_PTR)pSiteNamesA + EntryCount * sizeof(PSTR));
166  BufferSize -= EntryCount * sizeof(PSTR);
167 
168  for (i = 0; i < EntryCount; i++)
169  {
170  if (pSiteNamesW[i] != NULL)
171  {
172  pSiteNamesA[i] = Ptr;
174  pSiteNamesW[i]);
175  AnsiString.Length = 0;
176  AnsiString.MaximumLength = BufferSize;
177  AnsiString.Buffer = Ptr;
178 
180  &UnicodeString,
181  FALSE);
182  if (!NT_SUCCESS(Status))
183  {
185  goto done;
186  }
187 
188  Ptr = Ptr + AnsiString.Length + sizeof(CHAR);
189  BufferSize -= AnsiString.Length + sizeof(CHAR);
190  }
191  }
192 
193  *SiteNames = pSiteNamesA;
194  pSiteNamesA = NULL;
195 
196 done:
197  if (pSiteNamesA != NULL)
198  NetApiBufferFree(pSiteNamesA);
199 
200  if (pSiteNamesW != NULL)
201  NetApiBufferFree(pSiteNamesW);
202 
203  if (pComputerNameW != NULL)
204  NetApiBufferFree(pComputerNameW);
205 
206  return status;
207 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
uint16_t * PWSTR
Definition: typedefs.h:55
DWORD WINAPI DsAddressToSiteNamesW(_In_opt_ LPCWSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPWSTR **SiteNames)
Definition: netlogon.c:212
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define debugstr_a
Definition: kernel32.h:31
#define BufferSize
Definition: classpnp.h:419
Status
Definition: gdiplustypes.h:24
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CHAR(Char)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsAddressToSiteNamesExA()

DWORD WINAPI DsAddressToSiteNamesExA ( _In_opt_ LPCSTR  ComputerName,
_In_ DWORD  EntryCount,
_In_ PSOCKET_ADDRESS  SocketAddresses,
_Out_ LPSTR **  SiteNames,
_Out_ LPSTR **  SubnetNames 
)

Definition at line 284 of file netlogon.c.

290 {
291  PWSTR pComputerNameW = NULL, *pSiteNamesW = NULL;
292  PWSTR *pSubnetNamesW = NULL;
293  PSTR *pSiteNamesA = NULL, *pSubnetNamesA = NULL, Ptr;
296  ULONG BufferSize, i;
299 
300  TRACE("DsAddressToSiteNamesExA(%s, %lu, %p, %p, %p)\n",
301  debugstr_a(ComputerName), EntryCount, SocketAddresses,
302  SiteNames, SubnetNames);
303 
304  if (EntryCount == 0)
306 
307  if (ComputerName != NULL)
308  {
309  pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
310  if (pComputerNameW == NULL)
311  {
313  goto done;
314  }
315  }
316 
317  /* Call the Unicode function */
318  status = DsAddressToSiteNamesExW(pComputerNameW,
319  EntryCount,
320  SocketAddresses,
321  &pSiteNamesW,
322  &pSubnetNamesW);
323  if (status != NERR_Success)
324  goto done;
325 
326  /* Calculate the required site names buffer size */
327  BufferSize = EntryCount * sizeof(PSTR);
328  for (i = 0; i < EntryCount; i++)
329  {
330  if (pSiteNamesW[i] != NULL)
331  {
333  pSiteNamesW[i]);
335  }
336  }
337 
338  /* Allocate the site names ANSI buffer */
339  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pSiteNamesA);
340  if (status != NERR_Success)
341  goto done;
342 
343  /* Convert the site names */
344  Ptr = (PSTR)((ULONG_PTR)pSiteNamesA + EntryCount * sizeof(PSTR));
345  BufferSize -= EntryCount * sizeof(PSTR);
346 
347  for (i = 0; i < EntryCount; i++)
348  {
349  if (pSiteNamesW[i] != NULL)
350  {
351  pSiteNamesA[i] = Ptr;
353  pSiteNamesW[i]);
354  AnsiString.Length = 0;
355  AnsiString.MaximumLength = BufferSize;
356  AnsiString.Buffer = Ptr;
357 
359  &UnicodeString,
360  FALSE);
361  if (!NT_SUCCESS(Status))
362  {
364  goto done;
365  }
366 
367  Ptr = Ptr + AnsiString.Length + sizeof(CHAR);
368  BufferSize -= AnsiString.Length + sizeof(CHAR);
369  }
370  }
371 
372  /* Calculate the required subnet names buffer size */
373  BufferSize = EntryCount * sizeof(PSTR);
374  for (i = 0; i < EntryCount; i++)
375  {
376  if (pSubnetNamesW[i] != NULL)
377  {
379  pSubnetNamesW[i]);
381  }
382  }
383 
384  /* Allocate the subnet names ANSI buffer */
385  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pSubnetNamesA);
386  if (status != NERR_Success)
387  goto done;
388 
389  /* Convert the subnet names */
390  Ptr = (PSTR)((ULONG_PTR)pSubnetNamesA + EntryCount * sizeof(PSTR));
391  BufferSize -= EntryCount * sizeof(PSTR);
392 
393  for (i = 0; i < EntryCount; i++)
394  {
395  if (pSubnetNamesW[i] != NULL)
396  {
397  pSubnetNamesA[i] = Ptr;
399  pSubnetNamesW[i]);
400  AnsiString.Length = 0;
401  AnsiString.MaximumLength = BufferSize;
402  AnsiString.Buffer = Ptr;
403 
405  &UnicodeString,
406  FALSE);
407  if (!NT_SUCCESS(Status))
408  {
410  goto done;
411  }
412 
413  Ptr = Ptr + AnsiString.Length + sizeof(CHAR);
414  BufferSize -= AnsiString.Length + sizeof(CHAR);
415  }
416  }
417 
418  *SiteNames = pSiteNamesA;
419  *SubnetNames = pSubnetNamesA;
420  pSiteNamesA = NULL;
421  pSubnetNamesA = NULL;
422 
423 done:
424  if (pSubnetNamesA != NULL)
425  NetApiBufferFree(pSubnetNamesA);
426 
427  if (pSiteNamesA != NULL)
428  NetApiBufferFree(pSiteNamesA);
429 
430  if (pSubnetNamesW != NULL)
431  NetApiBufferFree(pSubnetNamesW);
432 
433  if (pSiteNamesW != NULL)
434  NetApiBufferFree(pSiteNamesW);
435 
436  if (pComputerNameW != NULL)
437  NetApiBufferFree(pComputerNameW);
438 
439  return status;
440 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI DsAddressToSiteNamesExW(_In_opt_ LPCWSTR ComputerName, _In_ DWORD EntryCount, _In_ PSOCKET_ADDRESS SocketAddresses, _Out_ LPWSTR **SiteNames, _Out_ LPWSTR **SubnetNames)
Definition: netlogon.c:445
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define debugstr_a
Definition: kernel32.h:31
#define BufferSize
Definition: classpnp.h:419
Status
Definition: gdiplustypes.h:24
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CHAR(Char)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsAddressToSiteNamesExW()

DWORD WINAPI DsAddressToSiteNamesExW ( _In_opt_ LPCWSTR  ComputerName,
_In_ DWORD  EntryCount,
_In_ PSOCKET_ADDRESS  SocketAddresses,
_Out_ LPWSTR **  SiteNames,
_Out_ LPWSTR **  SubnetNames 
)

Definition at line 445 of file netlogon.c.

451 {
452  PNL_SITE_NAME_EX_ARRAY SiteNameArray = NULL;
453  PWSTR *SiteNamesBuffer = NULL, *SubnetNamesBuffer = NULL, Ptr;
454  ULONG SiteNameBufferSize, SubnetNameBufferSize, i;
456 
457  TRACE("DsAddressToSiteNamesExW(%s, %lu, %p, %p, %p)\n",
458  debugstr_w(ComputerName), EntryCount, SocketAddresses,
459  SiteNames, SubnetNames);
460 
461  if (EntryCount == 0)
463 
464  *SiteNames = NULL;
465  *SubnetNames = NULL;
466 
468  {
469  status = DsrAddressToSiteNamesExW((PWSTR)ComputerName,
470  EntryCount,
471  (PNL_SOCKET_ADDRESS)SocketAddresses,
472  &SiteNameArray);
473  if (status == NERR_Success)
474  {
475  if (SiteNameArray->EntryCount == 0)
476  {
478  }
479  else
480  {
481  SiteNameBufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
482  SubnetNameBufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
483  for (i = 0; i < SiteNameArray->EntryCount; i++)
484  {
485  SiteNameBufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR);
486  SubnetNameBufferSize += SiteNameArray->SubnetNames[i].Length + sizeof(WCHAR);
487  }
488 
489  status = NetApiBufferAllocate(SiteNameBufferSize, (PVOID*)&SiteNamesBuffer);
490  if (status == NERR_Success)
491  {
492  ZeroMemory(SiteNamesBuffer, SiteNameBufferSize);
493 
494  Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR));
495  for (i = 0; i < SiteNameArray->EntryCount; i++)
496  {
497  SiteNamesBuffer[i] = Ptr;
498  CopyMemory(Ptr,
499  SiteNameArray->SiteNames[i].Buffer,
500  SiteNameArray->SiteNames[i].Length);
501 
502  Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SiteNames[i].Length + sizeof(WCHAR));
503  }
504 
505  *SiteNames = SiteNamesBuffer;
506  }
507 
508  status = NetApiBufferAllocate(SubnetNameBufferSize, (PVOID*)&SubnetNamesBuffer);
509  if (status == NERR_Success)
510  {
511  ZeroMemory(SubnetNamesBuffer, SubnetNameBufferSize);
512 
513  Ptr = (PWSTR)((ULONG_PTR)SubnetNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR));
514  for (i = 0; i < SiteNameArray->EntryCount; i++)
515  {
516  SubnetNamesBuffer[i] = Ptr;
517  CopyMemory(Ptr,
518  SiteNameArray->SubnetNames[i].Buffer,
519  SiteNameArray->SubnetNames[i].Length);
520 
521  Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SubnetNames[i].Length + sizeof(WCHAR));
522  }
523 
524  *SubnetNames = SubnetNamesBuffer;
525  }
526  }
527 
528  MIDL_user_free(SiteNameArray);
529  }
530  }
532  {
534  }
535  RpcEndExcept;
536 
537  return status;
538 }
NET_API_STATUS __stdcall DsrAddressToSiteNamesExW(_In_opt_ LOGONSRV_HANDLE ComputerName, _In_ DWORD EntryCount, _In_ PNL_SOCKET_ADDRESS SocketAddresses, _Out_ PNL_SITE_NAME_EX_ARRAY *SiteNames)
Definition: rpcserver.c:649
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ZeroMemory
Definition: winbase.h:1648
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PRPC_UNICODE_STRING SubnetNames
Definition: netlogon.idl:838
PRPC_UNICODE_STRING SiteNames
Definition: netlogon.idl:837
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
unsigned short Length
Definition: msv1_0.h:22
unsigned int ULONG
Definition: retypes.h:1
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
wchar_t * Buffer
Definition: msv1_0.h:24
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsAddressToSiteNamesExA().

◆ DsAddressToSiteNamesW()

DWORD WINAPI DsAddressToSiteNamesW ( _In_opt_ LPCWSTR  ComputerName,
_In_ DWORD  EntryCount,
_In_ PSOCKET_ADDRESS  SocketAddresses,
_Out_ LPWSTR **  SiteNames 
)

Definition at line 212 of file netlogon.c.

217 {
218  PNL_SITE_NAME_ARRAY SiteNameArray = NULL;
219  PWSTR *SiteNamesBuffer = NULL, Ptr;
220  ULONG BufferSize, i;
222 
223  TRACE("DsAddressToSiteNamesW(%s, %lu, %p, %p)\n",
224  debugstr_w(ComputerName), EntryCount, SocketAddresses, SiteNames);
225 
226  if (EntryCount == 0)
228 
229  *SiteNames = NULL;
230 
232  {
233  status = DsrAddressToSiteNamesW((PWSTR)ComputerName,
234  EntryCount,
235  (PNL_SOCKET_ADDRESS)SocketAddresses,
236  &SiteNameArray);
237  if (status == NERR_Success)
238  {
239  if (SiteNameArray->EntryCount == 0)
240  {
242  }
243  else
244  {
245  BufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
246  for (i = 0; i < SiteNameArray->EntryCount; i++)
247  BufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR);
248 
249  status = NetApiBufferAllocate(BufferSize, (PVOID*)&SiteNamesBuffer);
250  if (status == NERR_Success)
251  {
252  ZeroMemory(SiteNamesBuffer, BufferSize);
253 
254  Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR));
255  for (i = 0; i < SiteNameArray->EntryCount; i++)
256  {
257  SiteNamesBuffer[i] = Ptr;
258  CopyMemory(Ptr,
259  SiteNameArray->SiteNames[i].Buffer,
260  SiteNameArray->SiteNames[i].Length);
261 
262  Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SiteNames[i].Length + sizeof(WCHAR));
263  }
264 
265  *SiteNames = SiteNamesBuffer;
266  }
267  }
268 
269  MIDL_user_free(SiteNameArray);
270  }
271  }
273  {
275  }
276  RpcEndExcept;
277 
278  return status;
279 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ZeroMemory
Definition: winbase.h:1648
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
#define BufferSize
Definition: classpnp.h:419
NET_API_STATUS __stdcall DsrAddressToSiteNamesW(_In_opt_ LOGONSRV_HANDLE ComputerName, _In_ DWORD EntryCount, _In_ PNL_SOCKET_ADDRESS SocketAddresses, _Out_ PNL_SITE_NAME_ARRAY *SiteNames)
Definition: rpcserver.c:592
unsigned short Length
Definition: msv1_0.h:22
unsigned int ULONG
Definition: retypes.h:1
PRPC_UNICODE_STRING SiteNames
Definition: netlogon.idl:811
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
wchar_t * Buffer
Definition: msv1_0.h:24
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsAddressToSiteNamesA().

◆ DsDeregisterDnsHostRecordsA()

DWORD WINAPI DsDeregisterDnsHostRecordsA ( _In_opt_ LPSTR  ServerName,
_In_opt_ LPSTR  DnsDomainName,
_In_opt_ GUID DomainGuid,
_In_opt_ GUID DsaGuid,
_In_ LPSTR  DnsHostName 
)

Definition at line 543 of file netlogon.c.

549 {
550  PWSTR pServerNameW = NULL, pDnsDomainNameW = NULL;
551  PWSTR pDnsHostNameW = NULL;
553 
554  TRACE("DsDeregisterDnsHostRecordsA(%s, %s, %p, %p, %s)\n",
555  debugstr_a(ServerName), debugstr_a(DnsDomainName),
556  DomainGuid, DsaGuid, debugstr_a(DnsHostName));
557 
558  if (ServerName != NULL)
559  {
560  pServerNameW = NetpAllocWStrFromAnsiStr((PSTR)ServerName);
561  if (pServerNameW == NULL)
562  {
564  goto done;
565  }
566  }
567 
568  if (DnsDomainName != NULL)
569  {
570  pDnsDomainNameW = NetpAllocWStrFromAnsiStr((PSTR)DnsDomainName);
571  if (pDnsDomainNameW == NULL)
572  {
574  goto done;
575  }
576  }
577 
578  pDnsHostNameW = NetpAllocWStrFromAnsiStr((PSTR)DnsHostName);
579  if (pDnsHostNameW == NULL)
580  {
582  goto done;
583  }
584 
585  status = DsDeregisterDnsHostRecordsW(pServerNameW,
586  pDnsDomainNameW,
587  DomainGuid,
588  DsaGuid,
589  pDnsHostNameW);
590 
591 done:
592  if (pDnsHostNameW != NULL)
593  NetApiBufferFree(pDnsHostNameW);
594 
595  if (pDnsDomainNameW != NULL)
596  NetApiBufferFree(pDnsDomainNameW);
597 
598  if (pServerNameW != NULL)
599  NetApiBufferFree(pServerNameW);
600 
601  return status;
602 }
DWORD WINAPI DsDeregisterDnsHostRecordsW(_In_opt_ LPWSTR ServerName, _In_opt_ LPWSTR DnsDomainName, _In_opt_ GUID *DomainGuid, _In_opt_ GUID *DsaGuid, _In_ LPWSTR DnsHostName)
Definition: netlogon.c:607
uint16_t * PWSTR
Definition: typedefs.h:55
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NERR_Success
Definition: lmerr.h:5
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsDeregisterDnsHostRecordsW()

DWORD WINAPI DsDeregisterDnsHostRecordsW ( _In_opt_ LPWSTR  ServerName,
_In_opt_ LPWSTR  DnsDomainName,
_In_opt_ GUID DomainGuid,
_In_opt_ GUID DsaGuid,
_In_ LPWSTR  DnsHostName 
)

Definition at line 607 of file netlogon.c.

613 {
615 
616  TRACE("DsDeregisterDnsHostRecordsW(%s, %s, %p, %p, %s)\n",
617  debugstr_w(ServerName), debugstr_w(DnsDomainName),
618  DomainGuid, DsaGuid, debugstr_w(DnsHostName));
619 
621  {
622  status = DsrDeregisterDnsHostRecords(ServerName,
623  DnsDomainName,
624  DomainGuid,
625  DsaGuid,
626  DnsHostName);
627  }
629  {
631  }
632  RpcEndExcept;
633 
634  return status;
635 }
#define RpcEndExcept
Definition: rpc.h:128
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NET_API_STATUS __stdcall DsrDeregisterDnsHostRecords(_In_opt_ LOGONSRV_HANDLE ServerName, _In_opt_ wchar_t *DnsDomainName, _In_opt_ GUID *DomainGuid, _In_opt_ GUID *DsaGuid, _In_ wchar_t *DnsHostName)
Definition: rpcserver.c:707
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsDeregisterDnsHostRecordsA().

◆ DsEnumerateDomainTrustsA()

DWORD WINAPI DsEnumerateDomainTrustsA ( _In_opt_ LPSTR  ServerName,
_In_ ULONG  Flags,
_Out_ PDS_DOMAIN_TRUSTSA Domains,
_Out_ PULONG  DomainCount 
)

Definition at line 640 of file netlogon.c.

645 {
646  PWSTR pServerNameW = NULL;
647  PDS_DOMAIN_TRUSTSW pDomainsW = NULL;
648  PDS_DOMAIN_TRUSTSA pDomainsA = NULL;
651  PSTR Ptr;
652  ULONG i, BufferSize, SidLength;
655 
656  TRACE("DsEnumerateDomainTrustsA(%s, %x, %p, %p)\n",
657  debugstr_a(ServerName), Flags, Domains, DomainCount);
658 
659  if (ServerName != NULL)
660  {
661  pServerNameW = NetpAllocWStrFromAnsiStr((PSTR)ServerName);
662  if (pServerNameW == NULL)
663  {
665  goto done;
666  }
667  }
668 
669  status = DsEnumerateDomainTrustsW(pServerNameW,
670  Flags,
671  &pDomainsW,
672  DomainCount);
673  if (status != NERR_Success)
674  goto done;
675 
676  BufferSize = *DomainCount * sizeof(DS_DOMAIN_TRUSTSA);
677  for (i = 0; i < *DomainCount; i++)
678  {
680  pDomainsW[i].NetbiosDomainName);
682 
683  if (pDomainsW[i].DnsDomainName != NULL)
684  {
686  pDomainsW[i].DnsDomainName);
688  }
689 
690  BufferSize += RtlLengthSid(pDomainsW[i].DomainSid);
691  }
692 
693  /* Allocate the ANSI buffer */
694  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pDomainsA);
695  if (status != NERR_Success)
696  goto done;
697 
698  Ptr = (PSTR)((ULONG_PTR)pDomainsA + *DomainCount * sizeof(DS_DOMAIN_TRUSTSA));
699  for (i = 0; i < *DomainCount; i++)
700  {
701  pDomainsA[i].NetbiosDomainName = Ptr;
703  pDomainsW[i].NetbiosDomainName);
704  AnsiString.Length = 0;
705  AnsiString.MaximumLength = BufferSize;
706  AnsiString.Buffer = Ptr;
707 
709  &UnicodeString,
710  FALSE);
711  if (!NT_SUCCESS(Status))
712  {
714  goto done;
715  }
716 
717  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
718  BufferSize -= AnsiString.Length + sizeof(CHAR);
719 
720  if (pDomainsW[i].DnsDomainName != NULL)
721  {
722  pDomainsA[i].DnsDomainName = Ptr;
724  pDomainsW[i].DnsDomainName);
725  AnsiString.Length = 0;
726  AnsiString.MaximumLength = BufferSize;
727  AnsiString.Buffer = Ptr;
728 
730  &UnicodeString,
731  FALSE);
732  if (!NT_SUCCESS(Status))
733  {
735  goto done;
736  }
737 
738  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
739  BufferSize -= AnsiString.Length + sizeof(CHAR);
740  }
741 
742  pDomainsA[i].Flags = pDomainsW[i].Flags;
743  pDomainsA[i].ParentIndex = pDomainsW[i].ParentIndex;
744  pDomainsA[i].TrustType = pDomainsW[i].TrustType;
745  pDomainsA[i].TrustAttributes = pDomainsW[i].TrustAttributes;
746 
747  /* DomainSid */
748  pDomainsA[i].DomainSid = (PSID)Ptr;
749  SidLength = RtlLengthSid(pDomainsW[i].DomainSid);
750  Status = RtlCopySid(SidLength,
751  (PSID)Ptr,
752  pDomainsW[i].DomainSid);
753  if (!NT_SUCCESS(Status))
754  {
756  goto done;
757  }
758 
759  Ptr = (PSTR)((ULONG_PTR)Ptr + SidLength);
760  BufferSize -= SidLength;
761 
762  CopyMemory(&pDomainsA[i].DomainGuid,
763  &pDomainsW[i].DomainGuid,
764  sizeof(GUID));
765  }
766 
767  *Domains = pDomainsA;
768  pDomainsA = NULL;
769 
770 done:
771  if (pDomainsA != NULL)
772  NetApiBufferFree(pDomainsA);
773 
774  if (pDomainsW != NULL)
775  NetApiBufferFree(pDomainsW);
776 
777  if (pServerNameW != NULL)
778  NetApiBufferFree(pServerNameW);
779 
780  return status;
781 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
LPSTR NetbiosDomainName
Definition: dsgetdc.h:43
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI DsEnumerateDomainTrustsW(_In_opt_ LPWSTR ServerName, _In_ ULONG Flags, _Out_ PDS_DOMAIN_TRUSTSW *Domains, _Out_ PULONG DomainCount)
Definition: netlogon.c:786
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
struct _DS_DOMAIN_TRUSTSA DS_DOMAIN_TRUSTSA
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI ULONG NTAPI RtlLengthSid(IN PSID Sid)
Definition: sid.c:150
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
ULONG ParentIndex
Definition: dsgetdc.h:58
#define TRACE(s)
Definition: solgame.cpp:4
ULONG TrustAttributes
Definition: dsgetdc.h:60
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define debugstr_a
Definition: kernel32.h:31
#define CopyMemory
Definition: winbase.h:1646
#define BufferSize
Definition: classpnp.h:419
struct _SID * PSID
Definition: eventlog.c:35
LPSTR DnsDomainName
Definition: dsgetdc.h:44
NTSYSAPI BOOLEAN WINAPI RtlCopySid(DWORD, PSID, PSID)
ULONG TrustAttributes
Definition: dsgetdc.h:48
Status
Definition: gdiplustypes.h:24
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
ULONG ParentIndex
Definition: dsgetdc.h:46
#define CHAR(Char)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsEnumerateDomainTrustsW()

DWORD WINAPI DsEnumerateDomainTrustsW ( _In_opt_ LPWSTR  ServerName,
_In_ ULONG  Flags,
_Out_ PDS_DOMAIN_TRUSTSW Domains,
_Out_ PULONG  DomainCount 
)

Definition at line 786 of file netlogon.c.

791 {
792  NETLOGON_TRUSTED_DOMAIN_ARRAY DomainsArray = {0, NULL};
794 
795  TRACE("DsEnumerateDomainTrustsW(%s, %x, %p, %p)\n",
796  debugstr_w(ServerName), Flags, Domains, DomainCount);
797 
799  {
800  status = DsrEnumerateDomainTrusts(ServerName,
801  Flags,
802  &DomainsArray);
803  if (status == NERR_Success)
804  {
805  *Domains = DomainsArray.Domains;
806  *DomainCount = DomainsArray.DomainCount;
807  }
808  }
810  {
812  }
813  RpcEndExcept;
814 
815  return status;
816 }
PDS_DOMAIN_TRUSTSW Domains
Definition: netlogon.idl:831
#define RpcEndExcept
Definition: rpc.h:128
#define NERR_Success
Definition: lmerr.h:5
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
NET_API_STATUS __stdcall DsrEnumerateDomainTrusts(_In_opt_ LOGONSRV_HANDLE ServerName, _In_ ULONG Flags, _Out_ PNETLOGON_TRUSTED_DOMAIN_ARRAY Domains)
Definition: rpcserver.c:694
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsEnumerateDomainTrustsA().

◆ DsGetDcNameA()

DWORD WINAPI DsGetDcNameA ( _In_opt_ LPCSTR  ComputerName,
_In_ LPCSTR  DomainName,
_In_ GUID DomainGuid,
_In_ LPCSTR  SiteName,
_In_ ULONG  Flags,
_Out_ PDOMAIN_CONTROLLER_INFOA DomainControllerInfo 
)

Definition at line 821 of file netlogon.c.

828 {
829  TRACE("DsGetDcNameA(%s, %s, %s, %s, %08lx, %p): stub\n",
830  debugstr_a(ComputerName), debugstr_a(DomainName), debugstr_guid(DomainGuid),
831  debugstr_a(SiteName), Flags, DomainControllerInfo);
832  return DsGetDcNameWithAccountA(ComputerName,
833  NULL,
834  0,
835  DomainName,
836  DomainGuid,
837  SiteName,
838  Flags,
839  DomainControllerInfo);
840 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
DWORD WINAPI DsGetDcNameWithAccountA(_In_opt_ LPCSTR ComputerName, _In_opt_ LPCSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOA *DomainControllerInfo)
Definition: netlogon.c:869
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ DsGetDcNameW()

DWORD WINAPI DsGetDcNameW ( _In_opt_ LPCWSTR  ComputerName,
_In_ LPCWSTR  DomainName,
_In_ GUID DomainGuid,
_In_ LPCWSTR  SiteName,
_In_ ULONG  Flags,
_Out_ PDOMAIN_CONTROLLER_INFOW DomainControllerInfo 
)

Definition at line 845 of file netlogon.c.

852 {
853  TRACE("DsGetDcNameW(%s, %s, %s, %s, %08lx, %p)\n",
854  debugstr_w(ComputerName), debugstr_w(DomainName), debugstr_guid(DomainGuid),
855  debugstr_w(SiteName), Flags, DomainControllerInfo);
856  return DsGetDcNameWithAccountW(ComputerName,
857  NULL,
858  0,
859  DomainName,
860  DomainGuid,
861  SiteName,
862  Flags,
863  DomainControllerInfo);
864 }
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI DsGetDcNameWithAccountW(_In_opt_ LPCWSTR ComputerName, _In_opt_ LPCWSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCWSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCWSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
Definition: netlogon.c:1134
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4

◆ DsGetDcNameWithAccountA()

DWORD WINAPI DsGetDcNameWithAccountA ( _In_opt_ LPCSTR  ComputerName,
_In_opt_ LPCSTR  AccountName,
_In_ ULONG  AccountControlBits,
_In_ LPCSTR  DomainName,
_In_ GUID DomainGuid,
_In_ LPCSTR  SiteName,
_In_ ULONG  Flags,
_Out_ PDOMAIN_CONTROLLER_INFOA DomainControllerInfo 
)

Definition at line 869 of file netlogon.c.

878 {
879  PWSTR pComputerNameW = NULL, pAccountNameW = NULL;
880  PWSTR pDomainNameW = NULL, pSiteNameW = NULL;
881  PDOMAIN_CONTROLLER_INFOW pDomainControllerInfoW = NULL;
882  PDOMAIN_CONTROLLER_INFOA pDomainControllerInfoA = NULL;
885  PSTR Ptr;
889 
890  TRACE("DsGetDcNameWithAccountA(%s, %s, %08lx, %s, %s, %s, %08lx, %p): stub\n",
891  debugstr_a(ComputerName), debugstr_a(AccountName), AccountControlBits,
892  debugstr_a(DomainName), debugstr_guid(DomainGuid),
893  debugstr_a(SiteName), Flags, DomainControllerInfo);
894 
895  if (ComputerName != NULL)
896  {
897  pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
898  if (pComputerNameW == NULL)
899  {
901  goto done;
902  }
903  }
904 
905  if (AccountName != NULL)
906  {
907  pAccountNameW = NetpAllocWStrFromAnsiStr((PSTR)AccountName);
908  if (pAccountNameW == NULL)
909  {
911  goto done;
912  }
913  }
914 
915  pDomainNameW = NetpAllocWStrFromAnsiStr((PSTR)DomainName);
916  if (pDomainNameW == NULL)
917  {
919  goto done;
920  }
921 
922  pSiteNameW = NetpAllocWStrFromAnsiStr((PSTR)SiteName);
923  if (pSiteNameW == NULL)
924  {
926  goto done;
927  }
928 
929  status = DsGetDcNameWithAccountW(pComputerNameW,
930  pAccountNameW,
931  AccountControlBits,
932  pDomainNameW,
933  DomainGuid,
934  pSiteNameW,
935  Flags,
936  &pDomainControllerInfoW);
937  if (status != NERR_Success)
938  goto done;
939 
941 
943  pDomainControllerInfoW->DomainControllerName);
945 
947  pDomainControllerInfoW->DomainControllerAddress);
949 
951  pDomainControllerInfoW->DomainName);
953 
955  pDomainControllerInfoW->DnsForestName);
957 
958  if (pDomainControllerInfoW->DcSiteName != NULL)
959  {
961  pDomainControllerInfoW->DcSiteName);
963  }
964 
965  if (pDomainControllerInfoW->ClientSiteName != NULL)
966  {
968  pDomainControllerInfoW->ClientSiteName);
970  }
971 
972  /* Allocate the ANSI buffer */
973  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pDomainControllerInfoA);
974  if (status != NERR_Success)
975  goto done;
976 
977  pDomainControllerInfoA->DomainControllerAddressType =
978  pDomainControllerInfoW->DomainControllerAddressType;
979 
980  pDomainControllerInfoA->Flags = pDomainControllerInfoW->Flags;
981 
982  CopyMemory(&pDomainControllerInfoA->DomainGuid,
983  &pDomainControllerInfoW->DomainGuid,
984  sizeof(GUID));
985 
986  Ptr = (PSTR)((ULONG_PTR)pDomainControllerInfoA + sizeof(DOMAIN_CONTROLLER_INFOA));
988 
989  pDomainControllerInfoA->DomainControllerName = Ptr;
991  pDomainControllerInfoW->DomainControllerName);
992  AnsiString.Length = 0;
993  AnsiString.MaximumLength = BufferSize;
994  AnsiString.Buffer = Ptr;
995 
997  &UnicodeString,
998  FALSE);
999  if (!NT_SUCCESS(Status))
1000  {
1002  goto done;
1003  }
1004 
1005  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1006  BufferSize -= AnsiString.Length + sizeof(CHAR);
1007 
1008  pDomainControllerInfoA->DomainControllerAddress = Ptr;
1010  pDomainControllerInfoW->DomainControllerAddress);
1011  AnsiString.Length = 0;
1012  AnsiString.MaximumLength = BufferSize;
1013  AnsiString.Buffer = Ptr;
1014 
1016  &UnicodeString,
1017  FALSE);
1018  if (!NT_SUCCESS(Status))
1019  {
1021  goto done;
1022  }
1023 
1024  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1025  BufferSize -= AnsiString.Length + sizeof(CHAR);
1026 
1027  pDomainControllerInfoA->DomainName = Ptr;
1029  pDomainControllerInfoW->DomainName);
1030  AnsiString.Length = 0;
1031  AnsiString.MaximumLength = BufferSize;
1032  AnsiString.Buffer = Ptr;
1033 
1035  &UnicodeString,
1036  FALSE);
1037  if (!NT_SUCCESS(Status))
1038  {
1040  goto done;
1041  }
1042 
1043  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1044  BufferSize -= AnsiString.Length + sizeof(CHAR);
1045 
1046  pDomainControllerInfoA->DnsForestName = Ptr;
1048  pDomainControllerInfoW->DnsForestName);
1049  AnsiString.Length = 0;
1050  AnsiString.MaximumLength = BufferSize;
1051  AnsiString.Buffer = Ptr;
1052 
1054  &UnicodeString,
1055  FALSE);
1056  if (!NT_SUCCESS(Status))
1057  {
1059  goto done;
1060  }
1061 
1062  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1063  BufferSize -= AnsiString.Length + sizeof(CHAR);
1064 
1065  if (pDomainControllerInfoW->DcSiteName != NULL)
1066  {
1067  pDomainControllerInfoA->DcSiteName = Ptr;
1069  pDomainControllerInfoW->DcSiteName);
1070  AnsiString.Length = 0;
1071  AnsiString.MaximumLength = BufferSize;
1072  AnsiString.Buffer = Ptr;
1073 
1075  &UnicodeString,
1076  FALSE);
1077  if (!NT_SUCCESS(Status))
1078  {
1080  goto done;
1081  }
1082 
1083  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1084  BufferSize -= AnsiString.Length + sizeof(CHAR);
1085  }
1086 
1087  if (pDomainControllerInfoW->ClientSiteName != NULL)
1088  {
1089  pDomainControllerInfoA->ClientSiteName = Ptr;
1091  pDomainControllerInfoW->ClientSiteName);
1092  AnsiString.Length = 0;
1093  AnsiString.MaximumLength = BufferSize;
1094  AnsiString.Buffer = Ptr;
1095 
1097  &UnicodeString,
1098  FALSE);
1099  if (!NT_SUCCESS(Status))
1100  {
1102  goto done;
1103  }
1104  }
1105 
1106  *DomainControllerInfo = pDomainControllerInfoA;
1107  pDomainControllerInfoA = NULL;
1108 
1109 done:
1110  if (pDomainControllerInfoA != NULL)
1111  NetApiBufferFree(pDomainControllerInfoA);
1112 
1113  if (pDomainControllerInfoW != NULL)
1114  NetApiBufferFree(pDomainControllerInfoW);
1115 
1116  if (pSiteNameW != NULL)
1117  NetApiBufferFree(pSiteNameW);
1118 
1119  if (pDomainNameW != NULL)
1120  NetApiBufferFree(pDomainNameW);
1121 
1122  if (pAccountNameW != NULL)
1123  NetApiBufferFree(pAccountNameW);
1124 
1125  if (pComputerNameW != NULL)
1126  NetApiBufferFree(pComputerNameW);
1127 
1128  return status;
1129 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
ULONG DomainControllerAddressType
Definition: dsgetdc.h:19
struct _DOMAIN_CONTROLLER_INFOA DOMAIN_CONTROLLER_INFOA
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
smooth NULL
Definition: ftsmooth.c:416
LPWSTR DomainControllerName
Definition: dsgetdc.h:30
DWORD WINAPI DsGetDcNameWithAccountW(_In_opt_ LPCWSTR ComputerName, _In_opt_ LPCWSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCWSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCWSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
Definition: netlogon.c:1134
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define debugstr_guid
Definition: kernel32.h:35
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define debugstr_a
Definition: kernel32.h:31
#define CopyMemory
Definition: winbase.h:1646
#define BufferSize
Definition: classpnp.h:419
Status
Definition: gdiplustypes.h:24
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
ULONG DomainControllerAddressType
Definition: dsgetdc.h:32
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
LPWSTR DomainControllerAddress
Definition: dsgetdc.h:31
#define CHAR(Char)
static SERVICE_STATUS status
Definition: service.c:31
LPSTR DomainControllerAddress
Definition: dsgetdc.h:18
Definition: ps.c:97

Referenced by DsGetDcNameA().

◆ DsGetDcNameWithAccountW()

DWORD WINAPI DsGetDcNameWithAccountW ( _In_opt_ LPCWSTR  ComputerName,
_In_opt_ LPCWSTR  AccountName,
_In_ ULONG  AccountControlBits,
_In_ LPCWSTR  DomainName,
_In_ GUID DomainGuid,
_In_ LPCWSTR  SiteName,
_In_ ULONG  Flags,
_Out_ PDOMAIN_CONTROLLER_INFOW DomainControllerInfo 
)

Definition at line 1134 of file netlogon.c.

1143 {
1145 
1146  TRACE("DsGetDcNameWithAccountW(%s, %s, %08lx, %s, %s, %s, %08lx, %p): stub\n",
1147  debugstr_w(ComputerName), debugstr_w(AccountName), AccountControlBits,
1148  debugstr_w(DomainName), debugstr_guid(DomainGuid),
1149  debugstr_w(SiteName), Flags, DomainControllerInfo);
1150 
1151  RpcTryExcept
1152  {
1153  status = DsrGetDcNameEx2((PWSTR)ComputerName,
1154  (PWSTR)AccountName,
1155  AccountControlBits,
1156  (PWSTR)DomainName,
1157  DomainGuid,
1158  (PWSTR)SiteName,
1159  Flags,
1160  DomainControllerInfo);
1161  }
1163  {
1165  }
1166  RpcEndExcept;
1167 
1168  return status;
1169 }
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NET_API_STATUS __stdcall DsrGetDcNameEx2(_In_opt_ LOGONSRV_HANDLE ComputerName, _In_opt_ wchar_t *AccountName, _In_ ULONG AllowableAccountControlBits, _In_opt_ wchar_t *DomainName, _In_opt_ GUID *DomainGuid, _In_opt_ wchar_t *SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
Definition: rpcserver.c:606
#define debugstr_guid
Definition: kernel32.h:35
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsGetDcNameW(), DsGetDcNameWithAccountA(), and NetGetDCName().

◆ DsGetDcSiteCoverageA()

DWORD WINAPI DsGetDcSiteCoverageA ( _In_opt_ LPCSTR  ServerName,
_Out_ PULONG  EntryCount,
_Out_ LPSTR **  SiteNames 
)

Definition at line 1174 of file netlogon.c.

1178 {
1179  PWSTR pServerNameW = NULL;
1180  PWSTR *pSiteNamesW = NULL;
1181  PSTR *pSiteNamesA = NULL;
1184  PSTR Ptr;
1185  ULONG BufferSize, i;
1186  NTSTATUS Status;
1188 
1189  TRACE("DsGetDcSiteCoverageA(%s, %p, %p)\n",
1190  debugstr_a(ServerName), EntryCount, SiteNames);
1191 
1192  if (ServerName != NULL)
1193  {
1194  pServerNameW = NetpAllocWStrFromAnsiStr((PSTR)ServerName);
1195  if (pServerNameW == NULL)
1196  {
1198  goto done;
1199  }
1200  }
1201 
1202  status = DsGetDcSiteCoverageW(pServerNameW,
1203  EntryCount,
1204  &pSiteNamesW);
1205  if (status != ERROR_SUCCESS)
1206  goto done;
1207 
1208  BufferSize = *EntryCount * sizeof(PSTR);
1209  for (i = 0; i < *EntryCount; i++)
1210  {
1211  RtlInitUnicodeString(&UnicodeString, pSiteNamesW[i]);
1213  }
1214 
1215  status = NetApiBufferAllocate(BufferSize, (PVOID*)&pSiteNamesA);
1216  if (status != NERR_Success)
1217  goto done;
1218 
1219  ZeroMemory(pSiteNamesA, BufferSize);
1220 
1221  Ptr = (PSTR)((ULONG_PTR)pSiteNamesA + *EntryCount * sizeof(PSTR));
1222  for (i = 0; i < *EntryCount; i++)
1223  {
1224  pSiteNamesA[i] = Ptr;
1225 
1226  RtlInitUnicodeString(&UnicodeString, pSiteNamesW[i]);
1227 
1228  AnsiString.Length = 0;
1229  AnsiString.MaximumLength = BufferSize;
1230  AnsiString.Buffer = Ptr;
1231 
1233  &UnicodeString,
1234  FALSE);
1235  if (!NT_SUCCESS(Status))
1236  {
1238  goto done;
1239  }
1240 
1241  Ptr = (PSTR)((ULONG_PTR)Ptr + AnsiString.Length + sizeof(CHAR));
1242  BufferSize -= (AnsiString.Length + sizeof(CHAR));
1243  }
1244 
1245  *SiteNames = pSiteNamesA;
1246  pSiteNamesA = NULL;
1247 
1248 done:
1249  if (status != NERR_Success && pSiteNamesA != NULL)
1250  NetApiBufferFree(pSiteNamesA);
1251 
1252  if (pSiteNamesW != NULL)
1253  NetApiBufferFree(pSiteNamesW);
1254 
1255  if (pServerNameW != NULL)
1256  NetApiBufferFree(pServerNameW);
1257 
1258  return status;
1259 }
DWORD WINAPI DsGetDcSiteCoverageW(_In_opt_ LPCWSTR ServerName, _Out_ PULONG EntryCount, _Out_ LPWSTR **SiteNames)
Definition: netlogon.c:1264
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1979
#define ERROR_SUCCESS
Definition: deptool.c:10
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ZeroMemory
Definition: winbase.h:1648
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define debugstr_a
Definition: kernel32.h:31
#define BufferSize
Definition: classpnp.h:419
Status
Definition: gdiplustypes.h:24
NTSYSAPI DWORD WINAPI RtlUnicodeStringToAnsiSize(const UNICODE_STRING *)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
unsigned int ULONG
Definition: retypes.h:1
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define CHAR(Char)
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsGetDcSiteCoverageW()

DWORD WINAPI DsGetDcSiteCoverageW ( _In_opt_ LPCWSTR  ServerName,
_Out_ PULONG  EntryCount,
_Out_ LPWSTR **  SiteNames 
)

Definition at line 1264 of file netlogon.c.

1268 {
1269  PNL_SITE_NAME_ARRAY SiteNameArray = NULL;
1270  PWSTR *SiteNamesBuffer = NULL, Ptr;
1271  ULONG BufferSize, i;
1273 
1274  TRACE("DsGetDcSiteCoverageW(%s, %p, %p)\n",
1275  debugstr_w(ServerName), EntryCount, SiteNames);
1276 
1277  *EntryCount = 0;
1278  *SiteNames = NULL;
1279 
1280  RpcTryExcept
1281  {
1282  status = DsrGetDcSiteCoverageW((PWSTR)ServerName,
1283  &SiteNameArray);
1284  if (status == NERR_Success)
1285  {
1286  if (SiteNameArray->EntryCount == 0)
1287  {
1289  }
1290  else
1291  {
1292  BufferSize = SiteNameArray->EntryCount * sizeof(PWSTR);
1293  for (i = 0; i < SiteNameArray->EntryCount; i++)
1294  BufferSize += SiteNameArray->SiteNames[i].Length + sizeof(WCHAR);
1295 
1296  status = NetApiBufferAllocate(BufferSize, (PVOID*)&SiteNamesBuffer);
1297  if (status == NERR_Success)
1298  {
1299  ZeroMemory(SiteNamesBuffer, BufferSize);
1300 
1301  Ptr = (PWSTR)((ULONG_PTR)SiteNamesBuffer + SiteNameArray->EntryCount * sizeof(PWSTR));
1302  for (i = 0; i < SiteNameArray->EntryCount; i++)
1303  {
1304  SiteNamesBuffer[i] = Ptr;
1305  CopyMemory(Ptr,
1306  SiteNameArray->SiteNames[i].Buffer,
1307  SiteNameArray->SiteNames[i].Length);
1308 
1309  Ptr = (PWSTR)((ULONG_PTR)Ptr + SiteNameArray->SiteNames[i].Length + sizeof(WCHAR));
1310  }
1311 
1312  *EntryCount = SiteNameArray->EntryCount;
1313  *SiteNames = SiteNamesBuffer;
1314  }
1315  }
1316 
1317  MIDL_user_free(SiteNameArray);
1318  }
1319  }
1321  {
1323  }
1324  RpcEndExcept;
1325 
1326  return status;
1327 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
Definition: fsrtlfuncs.h:898
#define ZeroMemory
Definition: winbase.h:1648
#define NERR_Success
Definition: lmerr.h:5
uint32_t ULONG_PTR
Definition: typedefs.h:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CopyMemory
Definition: winbase.h:1646
#define BufferSize
Definition: classpnp.h:419
unsigned short Length
Definition: msv1_0.h:22
unsigned int ULONG
Definition: retypes.h:1
PRPC_UNICODE_STRING SiteNames
Definition: netlogon.idl:811
NET_API_STATUS __stdcall DsrGetDcSiteCoverageW(_In_opt_ LOGONSRV_HANDLE ServerName, _Out_ PNL_SITE_NAME_ARRAY *SiteNames)
Definition: rpcserver.c:663
void __RPC_USER MIDL_user_free(void *p)
Definition: irotp.c:376
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
wchar_t * Buffer
Definition: msv1_0.h:24
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsGetDcSiteCoverageA().

◆ DsGetForestTrustInformationW()

DWORD WINAPI DsGetForestTrustInformationW ( _In_opt_ LPCWSTR  ServerName,
_In_opt_ LPCWSTR  TrustedDomainName,
_In_ DWORD  Flags,
_Out_ PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo 
)

Definition at line 1332 of file netlogon.c.

1337 {
1339 
1340  TRACE("DsGetForestTrustInformationW(%s, %s, 0x%08lx, %p)\n",
1341  debugstr_w(ServerName), debugstr_w(TrustedDomainName),
1342  Flags, ForestTrustInfo);
1343 
1344  RpcTryExcept
1345  {
1347  (PWSTR)TrustedDomainName,
1348  Flags,
1349  ForestTrustInfo);
1350  }
1352  {
1354  }
1355  RpcEndExcept;
1356 
1357  return status;
1358 }
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
NET_API_STATUS __stdcall DsrGetForestTrustInformation(_In_opt_ LOGONSRV_HANDLE ServerName, _In_opt_ wchar_t *TrustedDomainName, _In_ DWORD Flags, _Out_ PLSA_FOREST_TRUST_INFORMATION *ForestTrustInfo)
Definition: rpcserver.c:740
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

◆ DsGetSiteNameA()

DWORD WINAPI DsGetSiteNameA ( _In_opt_ LPCSTR  ComputerName,
_Out_ LPSTR SiteName 
)

Definition at line 1363 of file netlogon.c.

1366 {
1367  PWSTR pComputerNameW = NULL;
1368  PWSTR pSiteNameW = NULL;
1370 
1371  TRACE("DsGetSiteNameA(%s, %p)\n",
1372  debugstr_a(ComputerName), SiteName);
1373 
1374  if (ComputerName != NULL)
1375  {
1376  pComputerNameW = NetpAllocWStrFromAnsiStr((PSTR)ComputerName);
1377  if (pComputerNameW == NULL)
1378  {
1380  goto done;
1381  }
1382  }
1383 
1384  status = DsGetSiteNameW(pComputerNameW,
1385  &pSiteNameW);
1386  if (status != ERROR_SUCCESS)
1387  goto done;
1388 
1389  *SiteName = NetpAllocAnsiStrFromWStr(pSiteNameW);
1390  if (*SiteName == NULL)
1391  {
1393  }
1394 
1395 done:
1396  if (pSiteNameW != NULL)
1397  NetApiBufferFree(pSiteNameW);
1398 
1399  if (pComputerNameW != NULL)
1400  NetApiBufferFree(pComputerNameW);
1401 
1402  return status;
1403 }
PSTR WINAPI NetpAllocAnsiStrFromWStr(_In_ PWSTR InString)
Definition: misc.c:140
#define ERROR_SUCCESS
Definition: deptool.c:10
uint16_t * PWSTR
Definition: typedefs.h:55
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
DWORD WINAPI DsGetSiteNameW(_In_opt_ LPCWSTR ComputerName, _Out_ LPWSTR *SiteName)
Definition: netlogon.c:1408
PWSTR WINAPI NetpAllocWStrFromAnsiStr(_In_ PSTR InString)
Definition: misc.c:204
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
signed char * PSTR
Definition: retypes.h:7
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ DsGetSiteNameW()

DWORD WINAPI DsGetSiteNameW ( _In_opt_ LPCWSTR  ComputerName,
_Out_ LPWSTR SiteName 
)

Definition at line 1408 of file netlogon.c.

1411 {
1413 
1414  TRACE("DsGetSiteNameW(%s, %p)\n",
1415  debugstr_w(ComputerName), SiteName);
1416 
1417  RpcTryExcept
1418  {
1419  status = DsrGetSiteName((PWSTR)ComputerName,
1420  SiteName);
1421  }
1423  {
1425  }
1426  RpcEndExcept;
1427 
1428  return status;
1429 }
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NET_API_STATUS __stdcall DsrGetSiteName(_In_opt_ LOGONSRV_HANDLE ComputerName, _Out_ wchar_t **SiteName)
Definition: rpcserver.c:513
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738
Definition: ps.c:97

Referenced by DsGetSiteNameA().

◆ DsMergeForestTrustInformationW()

DWORD WINAPI DsMergeForestTrustInformationW ( _In_ LPCWSTR  DomainName,
_In_ PLSA_FOREST_TRUST_INFORMATION  NewForestTrustInfo,
_In_opt_ PLSA_FOREST_TRUST_INFORMATION  OldForestTrustInfo,
_Out_ PLSA_FOREST_TRUST_INFORMATION ForestTrustInfo 
)

Definition at line 1434 of file netlogon.c.

1439 {
1440  FIXME("DsMergeForestTrustInformationW(%s, %p, %p, %p)\n",
1441  debugstr_w(DomainName), NewForestTrustInfo,
1442  OldForestTrustInfo, ForestTrustInfo);
1444 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ DsValidateSubnetNameA()

DWORD WINAPI DsValidateSubnetNameA ( _In_ LPCSTR  SubnetName)

Definition at line 1449 of file netlogon.c.

1451 {
1452  FIXME("DsValidateSubnetNameA(%s)\n",
1453  debugstr_a(SubnetName));
1455 }
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ DsValidateSubnetNameW()

DWORD WINAPI DsValidateSubnetNameW ( _In_ LPCWSTR  SubnetName)

Definition at line 1460 of file netlogon.c.

1462 {
1463  FIXME("DsValidateSubnetNameW(%s)\n",
1464  debugstr_w(SubnetName));
1466 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ LOGONSRV_HANDLE_bind()

handle_t __RPC_USER LOGONSRV_HANDLE_bind ( LOGONSRV_HANDLE  pszSystemName)

Definition at line 48 of file netlogon.c.

50 {
52  LPWSTR pszStringBinding;
54 
55  TRACE("LOGONSRV_HANDLE_bind() called\n");
56 
58  L"ncacn_np",
59  pszSystemName,
60  L"\\pipe\\netlogon",
61  NULL,
62  &pszStringBinding);
63  if (status)
64  {
65  TRACE("RpcStringBindingCompose returned 0x%x\n", status);
66  return NULL;
67  }
68 
69  /* Set the binding handle that will be used to bind to the server. */
70  status = RpcBindingFromStringBindingW(pszStringBinding,
71  &hBinding);
72  if (status)
73  {
74  TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
75  }
76 
77  status = RpcStringFreeW(&pszStringBinding);
78  if (status)
79  {
80 // TRACE("RpcStringFree returned 0x%x\n", status);
81  }
82 
83  return hBinding;
84 }
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:876
handle_t hBinding
Definition: ctx_c.c:54
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:174
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
long RPC_STATUS
Definition: rpc.h:52
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR L[]
Definition: oid.c:1250
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ LOGONSRV_HANDLE_unbind()

void __RPC_USER LOGONSRV_HANDLE_unbind ( LOGONSRV_HANDLE  pszSystemName,
handle_t  hBinding 
)

Definition at line 89 of file netlogon.c.

92 {
94 
95  TRACE("LOGONSRV_HANDLE_unbind() called\n");
96 
98  if (status)
99  {
100  TRACE("RpcBindingFree returned 0x%x\n", status);
101  }
102 }
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:783
handle_t hBinding
Definition: ctx_c.c:54
long RPC_STATUS
Definition: rpc.h:52
#define TRACE(s)
Definition: solgame.cpp:4
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

◆ NetEnumerateTrustedDomains()

NTSTATUS WINAPI NetEnumerateTrustedDomains ( _In_ LPWSTR  ServerName,
_Out_ LPWSTR DomainNames 
)

Definition at line 1471 of file netlogon.c.

1474 {
1475  DOMAIN_NAME_BUFFER DomainNameBuffer = {0, NULL};
1476  NTSTATUS Status = 0;
1477 
1478  TRACE("NetEnumerateTrustedDomains(%s, %p)\n",
1479  debugstr_w(ServerName), DomainNames);
1480 
1481  RpcTryExcept
1482  {
1483  Status = NetrEnumerateTrustedDomains(ServerName,
1484  &DomainNameBuffer);
1485  if (NT_SUCCESS(Status))
1486  {
1487  *DomainNames = (LPWSTR)DomainNameBuffer.DomainNames;
1488  }
1489  }
1491  {
1493  } RpcEndExcept;
1494 
1495  return Status;
1496 }
#define RpcEndExcept
Definition: rpc.h:128
NTSTATUS __stdcall NetrEnumerateTrustedDomains(_In_opt_ LOGONSRV_HANDLE ServerName, _Out_ PDOMAIN_NAME_BUFFER DomainNameBuffer)
Definition: rpcserver.c:377
LONG NTSTATUS
Definition: precomp.h:26
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738

◆ NetGetAnyDCName()

NET_API_STATUS WINAPI NetGetAnyDCName ( _In_opt_ LPCWSTR  ServerName,
_In_opt_ LPCWSTR  DomainName,
_Out_ LPBYTE BufPtr 
)

Definition at line 1501 of file netlogon.c.

1505 {
1507 
1508  TRACE("NetGetAnyDCName(%s, %s, %p)\n",
1509  debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
1510 
1511  *BufPtr = NULL;
1512 
1513  RpcTryExcept
1514  {
1515  Status = NetrGetAnyDCName((PWSTR)ServerName,
1516  (PWSTR)DomainName,
1517  (PWSTR*)BufPtr);
1518  }
1520  {
1522  }
1523  RpcEndExcept;
1524 
1525  return Status;
1526 }
#define RpcEndExcept
Definition: rpc.h:128
uint16_t * PWSTR
Definition: typedefs.h:55
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
NET_API_STATUS __stdcall NetrGetAnyDCName(_In_opt_ LOGONSRV_HANDLE ServerName, _In_opt_ wchar_t *DomainName, _Out_ wchar_t **Buffer)
Definition: rpcserver.c:281
Status
Definition: gdiplustypes.h:24
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738

◆ NetGetDCName()

NET_API_STATUS WINAPI NetGetDCName ( _In_opt_ LPCWSTR  ServerName,
_In_opt_ LPCWSTR  DomainName,
_Out_ LPBYTE BufPtr 
)

Definition at line 1531 of file netlogon.c.

1535 {
1536  PDOMAIN_CONTROLLER_INFOW pDomainControllerInfo = NULL;
1538 
1539  FIXME("NetGetDCName(%s, %s, %p)\n",
1540  debugstr_w(ServerName), debugstr_w(DomainName), BufPtr);
1541 
1542  if (ServerName == NULL || *ServerName == UNICODE_NULL)
1543  {
1545  NULL,
1546  0,
1547  DomainName,
1548  NULL,
1549  NULL,
1550  0, //???
1551  &pDomainControllerInfo);
1552  if (Status != NERR_Success)
1553  goto done;
1554 
1555  Status = NetApiBufferAllocate((wcslen(pDomainControllerInfo->DomainControllerName) + 1) * sizeof(WCHAR),
1556  (PVOID*)BufPtr);
1557  if (Status != NERR_Success)
1558  goto done;
1559 
1560  wcscpy((PWSTR)*BufPtr,
1561  pDomainControllerInfo->DomainControllerName);
1562  }
1563  else
1564  {
1565  FIXME("Not implemented yet!\n");
1567  }
1568 
1569 done:
1570  if (pDomainControllerInfo != NULL)
1571  NetApiBufferFree(pDomainControllerInfo);
1572 
1573  return Status;
1574 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
uint16_t * PWSTR
Definition: typedefs.h:55
#define NERR_Success
Definition: lmerr.h:5
#define UNICODE_NULL
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define NERR_DCNotFound
Definition: lmerr.h:205
smooth NULL
Definition: ftsmooth.c:416
LPWSTR DomainControllerName
Definition: dsgetdc.h:30
DWORD WINAPI DsGetDcNameWithAccountW(_In_opt_ LPCWSTR ComputerName, _In_opt_ LPCWSTR AccountName, _In_ ULONG AccountControlBits, _In_ LPCWSTR DomainName, _In_ GUID *DomainGuid, _In_ LPCWSTR SiteName, _In_ ULONG Flags, _Out_ PDOMAIN_CONTROLLER_INFOW *DomainControllerInfo)
Definition: netlogon.c:1134
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
__wchar_t WCHAR
Definition: xmlstorage.h:180
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
Status
Definition: gdiplustypes.h:24
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

◆ NetLogonGetTimeServiceParentDomain()

NET_API_STATUS WINAPI NetLogonGetTimeServiceParentDomain ( _In_ LPWSTR  ServerName,
_Out_ LPWSTR DomainName,
_Out_ LPBOOL  PdcSameSite 
)

Definition at line 1579 of file netlogon.c.

1583 {
1585 
1586  TRACE("NetLogonGetTimeServiceParentDomain(%s, %p, %p)\n",
1587  debugstr_w(ServerName), DomainName, PdcSameSite);
1588 
1589  RpcTryExcept
1590  {
1592  DomainName,
1593  PdcSameSite);
1594  }
1596  {
1598  }
1599  RpcEndExcept;
1600 
1601  return Status;
1602 }
#define RpcEndExcept
Definition: rpc.h:128
NET_API_STATUS __stdcall NetrLogonGetTimeServiceParentDomain(_In_opt_ LOGONSRV_HANDLE ServerName, _Out_ wchar_t **DomainName, _Out_ int *PdcSameSite)
Definition: rpcserver.c:624
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
Status
Definition: gdiplustypes.h:24
#define RpcExcept(expr)
Definition: rpc.h:127
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:738

◆ NetLogonSetServiceBits()

NTSTATUS WINAPI NetLogonSetServiceBits ( _In_ LPWSTR  ServerName,
_In_ DWORD  ServiceBitsOfInterest,
_In_ DWORD  ServiceBits 
)

Definition at line 1607 of file netlogon.c.

1611 {
1612  NTSTATUS Status;
1613 
1614  TRACE("NetLogonSetServiceBits(%s 0x%lx 0x%lx)\n",
1615  debugstr_w(ServerName), ServiceBitsOfInterest, ServiceBits);
1616 
1617  RpcTryExcept
1618  {
1619  Status = NetrLogonSetServiceBits(ServerName,
1620  ServiceBitsOfInterest,
1621  ServiceBits);
1622  }
1624  {
1626  }
1627  RpcEndExcept;
1628 
1629  return Status;
1630 }
#define RpcEndExcept
Definition: rpc.h:128
LONG NTSTATUS
Definition: precomp.h:26
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS __stdcall NetrLogonSetServiceBits(_In_opt_ LOGONSRV_HANDLE ServerName, _In_ DWORD ServiceBitsOfInterest, _In_ DWORD ServiceBits)
Definition: rpcserver.c:421
Status
Definition: gdiplustypes.h:24
#define RpcExcept(expr)
Definition: rpc.h:127

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netapi32  )