ReactOS  0.4.14-dev-49-gfb4591c
wksta.c File Reference
#include "netapi32.h"
#include <lmwksta.h>
#include <lmjoin.h>
Include dependency graph for wksta.c:

Go to the source code of this file.

Classes

struct  WkstaTransportEnumData
 

Macros

#define MAX_TRANSPORT_NAME   MAX_INTERFACE_NAME_LEN
 
#define MAX_TRANSPORT_ADDR   13
 
#define NBT_TRANSPORT_NAME_HEADER   "\\Device\\NetBT_Tcpip_"
 
#define UNKNOWN_TRANSPORT_NAME_HEADER   "\\Device\\UnknownTransport_"
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (netapi32)
 
DECLSPEC_HIDDEN BOOL NETAPI_IsLocalComputer (LMCSTR name)
 
static void wprint_mac (WCHAR *buffer, int len, const MIB_IFROW *ifRow)
 
static void wprint_name (WCHAR *buffer, int len, ULONG transport, PMIB_IFROW ifRow)
 
static BOOL WkstaEnumAdaptersCallback (UCHAR totalLANAs, UCHAR lanaIndex, ULONG transport, const NetBIOSAdapterImpl *data, void *closure)
 
NET_API_STATUS WINAPI NetWkstaTransportEnum (LMSTR ServerName, DWORD level, PBYTE *pbuf, DWORD prefmaxlen, LPDWORD read_entries, PDWORD total_entries, PDWORD hresume)
 
NET_API_STATUS WINAPI NetWkstaUserGetInfo (LMSTR reserved, DWORD level, PBYTE *bufptr)
 
NET_API_STATUS WINAPI NetWkstaUserEnum (LMSTR servername, DWORD level, LPBYTE *bufptr, DWORD prefmaxlen, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle)
 
NET_API_STATUS WINAPI NetpGetComputerName (LPWSTR *Buffer)
 
NET_API_STATUS WINAPI I_NetNameCompare (LPVOID p1, LPWSTR wkgrp, LPWSTR comp, LPVOID p4, LPVOID p5)
 
NET_API_STATUS WINAPI I_NetNameValidate (LPVOID p1, LPWSTR wkgrp, LPVOID p3, LPVOID p4)
 
NET_API_STATUS WINAPI NetWkstaGetInfo (LMSTR servername, DWORD level, LPBYTE *bufptr)
 
NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation (LPCWSTR Server, LPWSTR *Name, PNETSETUP_JOIN_STATUS type)
 

Macro Definition Documentation

◆ MAX_TRANSPORT_ADDR

#define MAX_TRANSPORT_ADDR   13

Definition at line 82 of file wksta.c.

◆ MAX_TRANSPORT_NAME

#define MAX_TRANSPORT_NAME   MAX_INTERFACE_NAME_LEN

Definition at line 81 of file wksta.c.

◆ NBT_TRANSPORT_NAME_HEADER

#define NBT_TRANSPORT_NAME_HEADER   "\\Device\\NetBT_Tcpip_"

Definition at line 84 of file wksta.c.

◆ UNKNOWN_TRANSPORT_NAME_HEADER

#define UNKNOWN_TRANSPORT_NAME_HEADER   "\\Device\\UnknownTransport_"

Definition at line 85 of file wksta.c.

Function Documentation

◆ I_NetNameCompare()

NET_API_STATUS WINAPI I_NetNameCompare ( LPVOID  p1,
LPWSTR  wkgrp,
LPWSTR  comp,
LPVOID  p4,
LPVOID  p5 
)

Definition at line 457 of file wksta.c.

459 {
460  FIXME("(%p %s %s %p %p): stub\n", p1, debugstr_w(wkgrp), debugstr_w(comp),
461  p4, p5);
463 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ I_NetNameValidate()

NET_API_STATUS WINAPI I_NetNameValidate ( LPVOID  p1,
LPWSTR  wkgrp,
LPVOID  p3,
LPVOID  p4 
)

Definition at line 465 of file wksta.c.

467 {
468  FIXME("(%p %s %p %p): stub\n", p1, debugstr_w(wkgrp), p3, p4);
470 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ NETAPI_IsLocalComputer()

DECLSPEC_HIDDEN BOOL NETAPI_IsLocalComputer ( LMCSTR  name)

Definition at line 33 of file wksta.c.

34 {
36  DWORD size = sizeof(buf) / sizeof(buf[0]);
37  BOOL ret;
38 
39  if (!name || !name[0]) return TRUE;
40 
42  if (ret && name[0] == '\\' && name[1] == '\\') name += 2;
43  return ret && !strcmpiW( name, buf );
44 }
#define TRUE
Definition: types.h:120
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
unsigned int BOOL
Definition: ntddk_ex.h:94
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
#define strcmpiW(s1, s2)
Definition: unicode.h:39
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
Definition: name.c:36

Referenced by NetWkstaGetInfo(), and NetWkstaTransportEnum().

◆ NetGetJoinInformation()

NET_API_STATUS NET_API_FUNCTION NetGetJoinInformation ( LPCWSTR  Server,
LPWSTR Name,
PNETSETUP_JOIN_STATUS  type 
)

Definition at line 559 of file wksta.c.

563 {
564  FIXME("Stub %s %p %p\n", wine_dbgstr_w(Server), Name, type);
565 
566  if (Name == NULL || type == NULL)
568 
569  *Name = NULL;
571 
572  return NERR_Success;
573 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void Server(int port)
Definition: srltest.c:69
#define NERR_Success
Definition: lmerr.h:5
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

Referenced by AllSysInfo(), and NetworkPropDlgProc().

◆ NetpGetComputerName()

NET_API_STATUS WINAPI NetpGetComputerName ( LPWSTR Buffer)

Definition at line 438 of file wksta.c.

439 {
441 
442  TRACE("(%p)\n", Buffer);
445  {
446  return NetApiBufferReallocate(
447  *Buffer, (dwSize + 1) * sizeof(WCHAR),
448  (LPVOID *) Buffer);
449  }
450  else
451  {
454  }
455 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
Definition: bufpool.h:45
NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount, LPVOID *NewBuffer)
Definition: apibuf.c:53
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ NetWkstaGetInfo()

NET_API_STATUS WINAPI NetWkstaGetInfo ( LMSTR  servername,
DWORD  level,
LPBYTE bufptr 
)

Definition at line 472 of file wksta.c.

474 {
476 
477  TRACE("%s %d %p\n", debugstr_w( servername ), level, bufptr );
478  if (servername)
479  {
480  if (!NETAPI_IsLocalComputer(servername))
481  {
482  FIXME("remote computers not supported\n");
483  return ERROR_INVALID_LEVEL;
484  }
485  }
486  if (!bufptr) return ERROR_INVALID_PARAMETER;
487 
488  switch (level)
489  {
490  case 100:
491  case 101:
492  case 102:
493  {
494  static const WCHAR lanroot[] = {'c',':','\\','l','a','n','m','a','n',0}; /* FIXME */
495  DWORD computerNameLen, domainNameLen, size;
496  WCHAR computerName[MAX_COMPUTERNAME_LENGTH + 1];
498  LSA_HANDLE PolicyHandle;
499  NTSTATUS NtStatus;
500 
501  computerNameLen = MAX_COMPUTERNAME_LENGTH + 1;
502  GetComputerNameW(computerName, &computerNameLen);
503  computerNameLen++; /* include NULL terminator */
504 
506  NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes,
507  POLICY_VIEW_LOCAL_INFORMATION, &PolicyHandle);
508  if (NtStatus != STATUS_SUCCESS)
509  ret = LsaNtStatusToWinError(NtStatus);
510  else
511  {
512  PPOLICY_PRIMARY_DOMAIN_INFO DomainInfo;
513 
514  LsaQueryInformationPolicy(PolicyHandle,
515  PolicyPrimaryDomainInformation, (PVOID*)&DomainInfo);
516  domainNameLen = lstrlenW(DomainInfo->Name.Buffer) + 1;
517  size = sizeof(WKSTA_INFO_102) + computerNameLen * sizeof(WCHAR)
518  + domainNameLen * sizeof(WCHAR) + sizeof(lanroot);
520  if (ret == NERR_Success)
521  {
522  /* INFO_100 and INFO_101 structures are subsets of INFO_102 */
524  OSVERSIONINFOW verInfo;
525 
526  info->wki102_platform_id = PLATFORM_ID_NT;
527  info->wki102_computername = (LMSTR)(*bufptr +
528  sizeof(WKSTA_INFO_102));
529  memcpy(info->wki102_computername, computerName,
530  computerNameLen * sizeof(WCHAR));
531  info->wki102_langroup = info->wki102_computername + computerNameLen;
532  memcpy(info->wki102_langroup, DomainInfo->Name.Buffer,
533  domainNameLen * sizeof(WCHAR));
534  info->wki102_lanroot = info->wki102_langroup + domainNameLen;
535  memcpy(info->wki102_lanroot, lanroot, sizeof(lanroot));
536  memset(&verInfo, 0, sizeof(verInfo));
537  verInfo.dwOSVersionInfoSize = sizeof(verInfo);
538  GetVersionExW(&verInfo);
539  info->wki102_ver_major = verInfo.dwMajorVersion;
540  info->wki102_ver_minor = verInfo.dwMinorVersion;
541  info->wki102_logged_on_users = 1;
542  }
543  LsaFreeMemory(DomainInfo);
544  LsaClose(PolicyHandle);
545  }
546  break;
547  }
548 
549  default:
550  FIXME("level %d unimplemented\n", level);
552  }
553  return ret;
554 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
GLint level
Definition: gl.h:1546
WCHAR * LMSTR
Definition: ms-dtyp.idl:119
static unsigned int bufptr
Definition: tncon.cpp:77
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1471
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
#define ZeroMemory
Definition: winbase.h:1635
BOOL WINAPI GetComputerNameW(LPWSTR lpBuffer, LPDWORD lpnSize)
Definition: compname.c:440
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define lstrlenW
Definition: compat.h:407
#define NERR_Success
Definition: lmerr.h:5
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1181
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
LSA_UNICODE_STRING Name
Definition: ntsecapi.h:567
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
ULONG dwMajorVersion
Definition: rtltypes.h:243
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:242
struct _WKSTA_INFO_102 * PWKSTA_INFO_102
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _WKSTA_INFO_102 WKSTA_INFO_102
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define MAX_COMPUTERNAME_LENGTH
Definition: winbase.h:240
#define PLATFORM_ID_NT
Definition: lmcons.h:60
ULONG dwMinorVersion
Definition: rtltypes.h:244
DECLSPEC_HIDDEN BOOL NETAPI_IsLocalComputer(LMCSTR name)
Definition: wksta.c:33
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define memset(x, y, z)
Definition: compat.h:39

Referenced by DisplayWorkstationConfig(), DisplayWorkstationStatistics(), NetIDPage_OnInitDialog(), and NetworkPropDlgProc().

◆ NetWkstaTransportEnum()

NET_API_STATUS WINAPI NetWkstaTransportEnum ( LMSTR  ServerName,
DWORD  level,
PBYTE pbuf,
DWORD  prefmaxlen,
LPDWORD  read_entries,
PDWORD  total_entries,
PDWORD  hresume 
)

Definition at line 221 of file wksta.c.

224 {
226 
227  TRACE(":%s, 0x%08x, %p, 0x%08x, %p, %p, %p\n", debugstr_w(ServerName),
228  level, pbuf, prefmaxlen, read_entries, total_entries,hresume);
229  if (!NETAPI_IsLocalComputer(ServerName))
230  {
231  FIXME(":not implemented for non-local computers\n");
233  }
234  else
235  {
236  if (hresume && *hresume)
237  {
238  FIXME(":resume handle not implemented\n");
239  return ERROR_INVALID_LEVEL;
240  }
241 
242  switch (level)
243  {
244  case 0: /* transport info */
245  {
246  ULONG allTransports;
247  struct WkstaTransportEnumData enumData;
248 
249  if (NetBIOSNumAdapters() == 0)
251  if (!read_entries)
253  if (!total_entries || !pbuf)
254  return RPC_X_NULL_REF_POINTER;
255 
256  enumData.prefmaxlen = prefmaxlen;
257  enumData.pbuf = pbuf;
258  memcpy(&allTransports, ALL_TRANSPORTS, sizeof(ULONG));
260  &enumData);
261  *read_entries = enumData.n_read;
262  *total_entries = enumData.n_adapt;
263  if (hresume) *hresume= 0;
264  ret = enumData.ret;
265  break;
266  }
267  default:
268  TRACE("Invalid level %d is specified\n", level);
270  }
271  }
272  return ret;
273 }
GLint level
Definition: gl.h:1546
#define RPC_X_NULL_REF_POINTER
Definition: winerror.h:1087
UCHAR NetBIOSNumAdapters(void)
Definition: netbios.c:284
void NetBIOSEnumAdapters(ULONG transport, NetBIOSEnumAdaptersCallback cb, void *closure)
Definition: netbios.c:296
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define TRACE(s)
Definition: solgame.cpp:4
Definition: pbuf.h:79
int ret
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static BOOL WkstaEnumAdaptersCallback(UCHAR totalLANAs, UCHAR lanaIndex, ULONG transport, const NetBIOSAdapterImpl *data, void *closure)
Definition: wksta.c:128
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:228
#define ERROR_NETWORK_UNREACHABLE
Definition: winerror.h:734
unsigned int ULONG
Definition: retypes.h:1
DECLSPEC_HIDDEN BOOL NETAPI_IsLocalComputer(LMCSTR name)
Definition: wksta.c:33
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
#define ALL_TRANSPORTS
Definition: nb30.h:23

Referenced by DisplayWorkstationConfig().

◆ NetWkstaUserEnum()

NET_API_STATUS WINAPI NetWkstaUserEnum ( LMSTR  servername,
DWORD  level,
LPBYTE bufptr,
DWORD  prefmaxlen,
LPDWORD  entriesread,
LPDWORD  totalentries,
LPDWORD  resumehandle 
)

Definition at line 426 of file wksta.c.

429 {
430  FIXME("(%s, %d, %p, %d, %p, %p, %p): stub!\n", debugstr_w(servername),
431  level, bufptr, prefmaxlen, entriesread, totalentries, resumehandle);
433 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
GLint level
Definition: gl.h:1546
static unsigned int bufptr
Definition: tncon.cpp:77
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ NetWkstaUserGetInfo()

NET_API_STATUS WINAPI NetWkstaUserGetInfo ( LMSTR  reserved,
DWORD  level,
PBYTE bufptr 
)

Definition at line 279 of file wksta.c.

281 {
282  NET_API_STATUS nastatus;
283 
284  TRACE("(%s, %d, %p)\n", debugstr_w(reserved), level, bufptr);
285  switch (level)
286  {
287  case 0:
288  {
290  DWORD dwSize = UNLEN + 1;
291 
292  /* set up buffer */
293  nastatus = NetApiBufferAllocate(sizeof(WKSTA_USER_INFO_0) + dwSize * sizeof(WCHAR),
294  (LPVOID *) bufptr);
295  if (nastatus != NERR_Success)
297 
299  ui->wkui0_username = (LMSTR) (*bufptr + sizeof(WKSTA_USER_INFO_0));
300 
301  /* get data */
302  if (!GetUserNameW(ui->wkui0_username, &dwSize))
303  {
306  }
307  else {
308  nastatus = NetApiBufferReallocate(
309  *bufptr, sizeof(WKSTA_USER_INFO_0) +
310  (lstrlenW(ui->wkui0_username) + 1) * sizeof(WCHAR),
311  (LPVOID *) bufptr);
312  if (nastatus != NERR_Success)
313  {
315  return nastatus;
316  }
318  ui->wkui0_username = (LMSTR) (*bufptr + sizeof(WKSTA_USER_INFO_0));
319  }
320  break;
321  }
322 
323  case 1:
324  {
326  PWKSTA_USER_INFO_0 ui0;
328  LSA_HANDLE PolicyHandle;
329  PPOLICY_ACCOUNT_DOMAIN_INFO DomainInfo;
330  NTSTATUS NtStatus;
331 
332  /* sizes of the field buffers in WCHARS */
333  int username_sz, logon_domain_sz, oth_domains_sz, logon_server_sz;
334 
335  FIXME("Level 1 processing is partially implemented\n");
336  oth_domains_sz = 1;
337  logon_server_sz = 1;
338 
339  /* get some information first to estimate size of the buffer */
340  ui0 = NULL;
341  nastatus = NetWkstaUserGetInfo(NULL, 0, (PBYTE *) &ui0);
342  if (nastatus != NERR_Success)
343  return nastatus;
344  username_sz = lstrlenW(ui0->wkui0_username) + 1;
345 
347  NtStatus = LsaOpenPolicy(NULL, &ObjectAttributes,
349  &PolicyHandle);
350  if (NtStatus != STATUS_SUCCESS)
351  {
352  TRACE("LsaOpenPolicyFailed with NT status %x\n",
353  LsaNtStatusToWinError(NtStatus));
354  NetApiBufferFree(ui0);
356  }
358  (PVOID*) &DomainInfo);
359  logon_domain_sz = lstrlenW(DomainInfo->DomainName.Buffer) + 1;
360  LsaClose(PolicyHandle);
361 
362  /* set up buffer */
363  nastatus = NetApiBufferAllocate(sizeof(WKSTA_USER_INFO_1) +
364  (username_sz + logon_domain_sz +
365  oth_domains_sz + logon_server_sz) * sizeof(WCHAR),
366  (LPVOID *) bufptr);
367  if (nastatus != NERR_Success) {
368  NetApiBufferFree(ui0);
369  return nastatus;
370  }
371  ui = (WKSTA_USER_INFO_1 *) *bufptr;
372  ui->wkui1_username = (LMSTR) (*bufptr + sizeof(WKSTA_USER_INFO_1));
373  ui->wkui1_logon_domain = (LMSTR) (
374  ((PBYTE) ui->wkui1_username) + username_sz * sizeof(WCHAR));
375  ui->wkui1_oth_domains = (LMSTR) (
376  ((PBYTE) ui->wkui1_logon_domain) +
377  logon_domain_sz * sizeof(WCHAR));
378  ui->wkui1_logon_server = (LMSTR) (
379  ((PBYTE) ui->wkui1_oth_domains) +
380  oth_domains_sz * sizeof(WCHAR));
381 
382  /* get data */
383  lstrcpyW(ui->wkui1_username, ui0->wkui0_username);
384  NetApiBufferFree(ui0);
385 
386  lstrcpynW(ui->wkui1_logon_domain, DomainInfo->DomainName.Buffer,
387  logon_domain_sz);
388  LsaFreeMemory(DomainInfo);
389 
390  /* FIXME. Not implemented. Populated with empty strings */
391  ui->wkui1_oth_domains[0] = 0;
392  ui->wkui1_logon_server[0] = 0;
393  break;
394  }
395  case 1101:
396  {
398  DWORD dwSize = 1;
399 
400  FIXME("Stub. Level 1101 processing is not implemented\n");
401  /* FIXME see also wkui1_oth_domains for level 1 */
402 
403  /* set up buffer */
404  nastatus = NetApiBufferAllocate(sizeof(WKSTA_USER_INFO_1101) + dwSize * sizeof(WCHAR),
405  (LPVOID *) bufptr);
406  if (nastatus != NERR_Success)
407  return nastatus;
409  ui->wkui1101_oth_domains = (LMSTR)(ui + 1);
410 
411  /* get data */
412  ui->wkui1101_oth_domains[0] = 0;
413  break;
414  }
415  default:
416  TRACE("Invalid level %d is specified\n", level);
417  return ERROR_INVALID_LEVEL;
418  }
419  return NERR_Success;
420 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
GLint level
Definition: gl.h:1546
WCHAR * LMSTR
Definition: ms-dtyp.idl:119
static unsigned int bufptr
Definition: tncon.cpp:77
NTSTATUS WINAPI LsaQueryInformationPolicy(IN LSA_HANDLE PolicyHandle, IN POLICY_INFORMATION_CLASS InformationClass, OUT PVOID *Buffer)
Definition: lsa.c:1471
#define POLICY_VIEW_LOCAL_INFORMATION
Definition: ntsecapi.h:61
UINT ui
Definition: oleauto.h:49
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS WINAPI LsaClose(IN LSA_HANDLE ObjectHandle)
Definition: lsa.c:192
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ZeroMemory
Definition: winbase.h:1635
#define lstrlenW
Definition: compat.h:407
#define lstrcpynW
Definition: compat.h:397
#define NERR_Success
Definition: lmerr.h:5
NTSTATUS WINAPI LsaOpenPolicy(IN PLSA_UNICODE_STRING SystemName OPTIONAL, IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes, IN ACCESS_MASK DesiredAccess, OUT PLSA_HANDLE PolicyHandle)
Definition: lsa.c:1181
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2893
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS WINAPI LsaFreeMemory(IN PVOID Buffer)
Definition: lsa.c:699
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
NET_API_STATUS WINAPI NetApiBufferReallocate(LPVOID OldBuffer, DWORD NewByteCount, LPVOID *NewBuffer)
Definition: apibuf.c:53
NET_API_STATUS WINAPI NetWkstaUserGetInfo(LMSTR reserved, DWORD level, PBYTE *bufptr)
Definition: wksta.c:279
BOOL WINAPI GetUserNameW(LPWSTR lpszName, LPDWORD lpSize)
Definition: misc.c:291
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
ULONG WINAPI LsaNtStatusToWinError(IN NTSTATUS Status)
Definition: lsa.c:1129
unsigned long DWORD
Definition: ntddk_ex.h:95
struct _WKSTA_USER_INFO_1101 * PWKSTA_USER_INFO_1101
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
Definition: apibuf.c:43
#define lstrcpyW
Definition: compat.h:406
#define UNLEN
Definition: sspi.c:28
LSA_UNICODE_STRING DomainName
Definition: ntsecapi.h:563
#define ERROR_INVALID_LEVEL
Definition: winerror.h:196
struct _WKSTA_USER_INFO_0 * PWKSTA_USER_INFO_0
return STATUS_SUCCESS
Definition: btrfs.c:2966
BYTE * PBYTE
Definition: pedump.c:66
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
LPWSTR wkui0_username
Definition: lmwksta.h:202

Referenced by DisplayWorkstationConfig(), NetWkstaUserGetInfo(), and ntlm_InitializeSecurityContextW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( netapi32  )

◆ WkstaEnumAdaptersCallback()

static BOOL WkstaEnumAdaptersCallback ( UCHAR  totalLANAs,
UCHAR  lanaIndex,
ULONG  transport,
const NetBIOSAdapterImpl data,
void closure 
)
static

Definition at line 128 of file wksta.c.

130 {
131  BOOL ret;
132  struct WkstaTransportEnumData *enumData = closure;
133 
134  if (enumData && enumData->pbuf)
135  {
136  if (lanaIndex == 0)
137  {
138  DWORD toAllocate;
139 
140  enumData->n_adapt = totalLANAs;
141  enumData->n_read = 0;
142 
143  toAllocate = totalLANAs * (sizeof(WKSTA_TRANSPORT_INFO_0)
144  + MAX_TRANSPORT_NAME * sizeof(WCHAR) +
145  MAX_TRANSPORT_ADDR * sizeof(WCHAR));
146  if (enumData->prefmaxlen != MAX_PREFERRED_LENGTH)
147  toAllocate = enumData->prefmaxlen;
148  NetApiBufferAllocate(toAllocate, (LPVOID *)enumData->pbuf);
149  }
150  if (*(enumData->pbuf))
151  {
152  UCHAR spaceFor;
153 
154  if (enumData->prefmaxlen == MAX_PREFERRED_LENGTH)
155  spaceFor = totalLANAs;
156  else
157  spaceFor = enumData->prefmaxlen /
159  MAX_TRANSPORT_ADDR) * sizeof(WCHAR));
160  if (enumData->n_read < spaceFor)
161  {
163  LMSTR transport_name, transport_addr;
164  MIB_IFROW ifRow;
165 
166  ti = (PWKSTA_TRANSPORT_INFO_0)(*(enumData->pbuf) +
167  enumData->n_read * sizeof(WKSTA_TRANSPORT_INFO_0));
168  transport_name = (LMSTR)(*(enumData->pbuf) +
169  totalLANAs * sizeof(WKSTA_TRANSPORT_INFO_0) +
170  enumData->n_read * MAX_TRANSPORT_NAME * sizeof(WCHAR));
171  transport_addr = (LMSTR)(*(enumData->pbuf) +
172  totalLANAs * (sizeof(WKSTA_TRANSPORT_INFO_0) +
173  MAX_TRANSPORT_NAME * sizeof(WCHAR)) +
174  enumData->n_read * MAX_TRANSPORT_ADDR * sizeof(WCHAR));
175 
176  ifRow.dwIndex = data->ifIndex;
177  GetIfEntry(&ifRow);
178  ti->wkti0_quality_of_service = 0;
179  ti->wkti0_number_of_vcs = 0;
180  ti->wkti0_transport_name = transport_name;
182  transport, &ifRow);
183  ti->wkti0_transport_address = transport_addr;
185  &ifRow);
186  if (!memcmp(&transport, TRANSPORT_NBT, sizeof(ULONG)))
187  ti->wkti0_wan_ish = TRUE;
188  else
189  ti->wkti0_wan_ish = FALSE;
190  TRACE("%d of %d:ti at %p\n", lanaIndex, totalLANAs, ti);
191  TRACE("transport_name at %p %s\n",
194  TRACE("transport_address at %p %s\n",
197  enumData->n_read++;
198  enumData->ret = NERR_Success;
199  ret = TRUE;
200  }
201  else
202  {
203  enumData->ret = ERROR_MORE_DATA;
204  ret = FALSE;
205  }
206  }
207  else
208  {
209  enumData->ret = ERROR_OUTOFMEMORY;
210  ret = FALSE;
211  }
212  }
213  else
214  ret = FALSE;
215  return ret;
216 }
NET_API_STATUS WINAPI NetApiBufferAllocate(DWORD ByteCount, LPVOID *Buffer)
Definition: apibuf.c:28
#define MAX_PREFERRED_LENGTH
Definition: lmcons.h:48
WCHAR * LMSTR
Definition: ms-dtyp.idl:119
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
LPWSTR wkti0_transport_address
Definition: lmwksta.h:214
NET_API_STATUS ret
Definition: wksta.c:123
#define NERR_Success
Definition: lmerr.h:5
DWORD wkti0_quality_of_service
Definition: lmwksta.h:211
unsigned int BOOL
Definition: ntddk_ex.h:94
static void wprint_name(WCHAR *buffer, int len, ULONG transport, PMIB_IFROW ifRow)
Definition: wksta.c:87
#define debugstr_w
Definition: kernel32.h:32
#define MAX_TRANSPORT_NAME
Definition: wksta.c:81
LPWSTR wkti0_transport_name
Definition: lmwksta.h:213
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_TRANSPORT_ADDR
Definition: wksta.c:82
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char UCHAR
Definition: xmlstorage.h:181
int ret
struct _WKSTA_TRANSPORT_INFO_0 WKSTA_TRANSPORT_INFO_0
#define ERROR_MORE_DATA
Definition: dderror.h:13
#define TRANSPORT_NBT
Definition: netbios.h:173
DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
unsigned int ULONG
Definition: retypes.h:1
DWORD dwIndex
Definition: ifmib.h:38
static void wprint_mac(WCHAR *buffer, int len, const MIB_IFROW *ifRow)
Definition: wksta.c:46
struct _WKSTA_TRANSPORT_INFO_0 * PWKSTA_TRANSPORT_INFO_0
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13

Referenced by NetWkstaTransportEnum().

◆ wprint_mac()

static void wprint_mac ( WCHAR buffer,
int  len,
const MIB_IFROW ifRow 
)
static

Definition at line 46 of file wksta.c.

47 {
48  int i;
49  unsigned char val;
50 
51  if (!buffer)
52  return;
53  if (len < 1)
54  return;
55  if (!ifRow)
56  {
57  *buffer = '\0';
58  return;
59  }
60 
61  for (i = 0; i < ifRow->dwPhysAddrLen && 2 * i < len; i++)
62  {
63  val = ifRow->bPhysAddr[i];
64  if ((val >>4) >9)
65  buffer[2*i] = (WCHAR)((val >>4) + 'A' - 10);
66  else
67  buffer[2*i] = (WCHAR)((val >>4) + '0');
68  if ((val & 0xf ) >9)
69  buffer[2*i+1] = (WCHAR)((val & 0xf) + 'A' - 10);
70  else
71  buffer[2*i+1] = (WCHAR)((val & 0xf) + '0');
72  }
73  buffer[2*i]=0;
74 }
GLuint buffer
Definition: glext.h:5915
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
GLuint GLfloat * val
Definition: glext.h:7180
UCHAR bPhysAddr[MAXLEN_PHYSADDR]
Definition: ifmib.h:43
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD dwPhysAddrLen
Definition: ifmib.h:42
GLenum GLsizei len
Definition: glext.h:6722

Referenced by WkstaEnumAdaptersCallback().

◆ wprint_name()

static void wprint_name ( WCHAR buffer,
int  len,
ULONG  transport,
PMIB_IFROW  ifRow 
)
static

Definition at line 87 of file wksta.c.

89 {
90  WCHAR *ptr1, *ptr2;
91  const char *name;
92 
93  if (!buffer)
94  return;
95  if (!ifRow)
96  {
97  *buffer = '\0';
98  return;
99  }
100 
101  if (!memcmp(&transport, TRANSPORT_NBT, sizeof(ULONG)))
103  else
105 
106  for (ptr1 = buffer; *name && ptr1 < buffer + len; ptr1++, name++)
107  *ptr1 = *name;
108  for (ptr2 = ifRow->wszName; *ptr2 && ptr1 < buffer + len; ptr1++, ptr2++)
109  *ptr1 = *ptr2;
110  *ptr1 = '\0';
111 }
WCHAR wszName[MAX_INTERFACE_NAME_LEN]
Definition: ifmib.h:37
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
GLuint buffer
Definition: glext.h:5915
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NBT_TRANSPORT_NAME_HEADER
Definition: wksta.c:84
GLenum GLsizei len
Definition: glext.h:6722
#define TRANSPORT_NBT
Definition: netbios.h:173
#define UNKNOWN_TRANSPORT_NAME_HEADER
Definition: wksta.c:85
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by WkstaEnumAdaptersCallback().