ReactOS  0.4.13-dev-66-gc714b7f
iphlpapi_private.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winnls.h>
#include <ws2tcpip.h>
#include <ndk/iofuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
#include <iphlpapi.h>
#include "resinfo.h"
#include <wine/debug.h>
#include "dhcp.h"
#include <dhcpcsdk.h>
#include <dhcpcapi.h>
#include <tdiinfo.h>
#include <tcpioctl.h>
#include <tdilib.h>
#include "ifenum.h"
#include "ipstats.h"
#include "route.h"
#include <w32api.h>
Include dependency graph for iphlpapi_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _IPRouteEntry
 
union  _IFEntrySafelySized
 
union  _TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY
 
union  _TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY
 
struct  _IFInfo
 
struct  _IP_SET_DATA
 

Macros

#define NtCurrentTeb   NtXCurrentTeb
 
#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define ETH_ALEN   6
 
#define INADDR_NONE   (~0U)
 
#define IFENT_SOFTWARE_LOOPBACK   24 /* This is an SNMP constant from rfc1213 */
 
#define INDEX_IS_LOOPBACK   0x00800000
 
#define IFNAMSIZ   0x20
 
#define TCP_REQUEST_QUERY_INFORMATION_INIT   { { { 0 } } }
 
#define TCP_REQUEST_SET_INFORMATION_INIT   { { 0 } }
 
#define GAA_FLAG_SKIP_UNICAST   0x0001
 
#define GAA_FLAG_SKIP_FRIENDLY_NAME   0x0020
 

Typedefs

typedef struct _IPRouteEntry IPRouteEntry
 
typedef charcaddr_t
 
typedef union _IFEntrySafelySized IFEntrySafelySized
 
typedef union _TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY
 
typedef union _TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRYPTCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY
 
typedef union _TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY
 
typedef union _TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRYPTCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY
 
typedef struct _IFInfo IFInfo
 
typedef struct _IP_SET_DATA IP_SET_DATA
 
typedef struct _IP_SET_DATAPIP_SET_DATA
 
typedef enum _IPHLPAddrType IPHLPAddrType
 
typedef VOID(* EnumNameServersFunc) (PWCHAR Interface, PWCHAR NameServer, PVOID Data)
 

Enumerations

enum  _IPHLPAddrType {
  IPAAddr, IPABcast, IPAMask, IFMtu,
  IFStatus
}
 

Functions

NTSTATUS getNthIpEntity (HANDLE tcpFile, DWORD index, TDIEntityID *ent)
 
NTSTATUS tdiGetIpAddrsForIpEntity (HANDLE tcpFile, TDIEntityID *ent, IPAddrEntry **addrs, PDWORD numAddrs)
 
int GetLongestChildKeyName (HANDLE RegHandle)
 
LONG OpenChildKeyRead (HANDLE RegHandle, PWCHAR ChildKeyName, PHKEY ReturnHandle)
 
PWCHAR GetNthChildKeyName (HANDLE RegHandle, DWORD n)
 
void ConsumeChildKeyName (PWCHAR Name)
 
PWCHAR QueryRegistryValueString (HANDLE RegHandle, PWCHAR ValueName)
 
PWCHARQueryRegistryValueStringMulti (HANDLE RegHandle, PWCHAR ValueName)
 
void ConsumeRegValueString (PWCHAR NameServer)
 
BOOL isInterface (TDIEntityID *if_maybe)
 
BOOL hasArp (HANDLE tcpFile, TDIEntityID *arp_maybe)
 
LSTATUS EnumNameServers (HKEY RegHandle, LPWSTR Interface, PVOID Data, EnumNameServersFunc cb)
 
NTSTATUS getIPAddrEntryForIf (HANDLE tcpFile, char *name, DWORD index, IFInfo *ifInfo)
 
DWORD TCPSendIoctl (HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuffer, PULONG pInBufferSize, LPVOID lpOutBuffer, PULONG pOutBufferSize)
 
BOOL WINAPI GetComputerNameExA (COMPUTER_NAME_FORMAT, LPSTR, LPDWORD)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 23 of file iphlpapi_private.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 24 of file iphlpapi_private.h.

◆ ETH_ALEN

#define ETH_ALEN   6

Definition at line 53 of file iphlpapi_private.h.

◆ GAA_FLAG_SKIP_FRIENDLY_NAME

#define GAA_FLAG_SKIP_FRIENDLY_NAME   0x0020

Definition at line 81 of file iphlpapi_private.h.

◆ GAA_FLAG_SKIP_UNICAST

#define GAA_FLAG_SKIP_UNICAST   0x0001

Definition at line 77 of file iphlpapi_private.h.

◆ IFENT_SOFTWARE_LOOPBACK

#define IFENT_SOFTWARE_LOOPBACK   24 /* This is an SNMP constant from rfc1213 */

Definition at line 61 of file iphlpapi_private.h.

◆ IFNAMSIZ

#define IFNAMSIZ   0x20

Definition at line 69 of file iphlpapi_private.h.

◆ INADDR_NONE

#define INADDR_NONE   (~0U)

Definition at line 57 of file iphlpapi_private.h.

◆ INDEX_IS_LOOPBACK

#define INDEX_IS_LOOPBACK   0x00800000

Definition at line 64 of file iphlpapi_private.h.

◆ NtCurrentTeb

#define NtCurrentTeb   NtXCurrentTeb

Definition at line 4 of file iphlpapi_private.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 31 of file iphlpapi_private.h.

◆ TCP_REQUEST_QUERY_INFORMATION_INIT

#define TCP_REQUEST_QUERY_INFORMATION_INIT   { { { 0 } } }

Definition at line 72 of file iphlpapi_private.h.

◆ TCP_REQUEST_SET_INFORMATION_INIT

#define TCP_REQUEST_SET_INFORMATION_INIT   { { 0 } }

Definition at line 73 of file iphlpapi_private.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 22 of file iphlpapi_private.h.

Typedef Documentation

◆ caddr_t

typedef char* caddr_t

Definition at line 103 of file iphlpapi_private.h.

◆ EnumNameServersFunc

typedef VOID(* EnumNameServersFunc) (PWCHAR Interface, PWCHAR NameServer, PVOID Data)

Definition at line 159 of file iphlpapi_private.h.

◆ IFEntrySafelySized

◆ IFInfo

◆ IP_SET_DATA

◆ IPHLPAddrType

◆ IPRouteEntry

◆ PIP_SET_DATA

◆ PTCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY

◆ PTCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY

◆ TCP_REQUEST_SET_INFORMATION_EX_ARP_ENTRY

◆ TCP_REQUEST_SET_INFORMATION_EX_ROUTE_ENTRY

Enumeration Type Documentation

◆ _IPHLPAddrType

Enumerator
IPAAddr 
IPABcast 
IPAMask 
IFMtu 
IFStatus 

Definition at line 139 of file iphlpapi_private.h.

Function Documentation

◆ ConsumeChildKeyName()

void ConsumeChildKeyName ( PWCHAR  Name)

Definition at line 63 of file registry.c.

63  {
64  if (Name) HeapFree( GetProcessHeap(), 0, Name );
65 }
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ ConsumeRegValueString()

void ConsumeRegValueString ( PWCHAR  NameServer)

Definition at line 140 of file registry.c.

140  {
141  if (Value) HeapFree(GetProcessHeap(), 0, Value);
142 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
#define GetProcessHeap()
Definition: compat.h:395
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ EnumNameServers()

LSTATUS EnumNameServers ( HKEY  RegHandle,
LPWSTR  Interface,
PVOID  Data,
EnumNameServersFunc  cb 
)

Referenced by GetPerAdapterInfo().

◆ GetComputerNameExA()

BOOL WINAPI GetComputerNameExA ( COMPUTER_NAME_FORMAT  ,
LPSTR  ,
LPDWORD   
)

Definition at line 370 of file compname.c.

373 {
376  BOOL Result;
377  PWCHAR TempBuffer = NULL;
378 
379  if ((nSize == NULL) ||
380  (lpBuffer == NULL && *nSize > 0))
381  {
383  return FALSE;
384  }
385 
386  if (*nSize > 0)
387  {
388  TempBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR));
389  if (!TempBuffer)
390  {
392  return FALSE;
393  }
394  }
395 
396  AnsiString.MaximumLength = (USHORT)*nSize;
397  AnsiString.Length = 0;
398  AnsiString.Buffer = lpBuffer;
399 
400  Result = GetComputerNameExW(NameType, TempBuffer, nSize);
401 
402  if (Result)
403  {
404  UnicodeString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR) + sizeof(WCHAR);
405  UnicodeString.Length = (USHORT)*nSize * sizeof(WCHAR);
406  UnicodeString.Buffer = TempBuffer;
407 
409  &UnicodeString,
410  FALSE);
411  }
412 
413  RtlFreeHeap(RtlGetProcessHeap(), 0, TempBuffer);
414 
415  return Result;
416 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
*BytesInUnicodeString PWCH UnicodeString
Definition: rtlfuncs.h:1980
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2024
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:603
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
uint16_t * PWCHAR
Definition: typedefs.h:54
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:213
unsigned int BOOL
Definition: ntddk_ex.h:94
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:173
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:585
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetLastError(x)
Definition: compat.h:409
unsigned short USHORT
Definition: pedump.c:61
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 NameType
Definition: acpixf.h:642

Referenced by get_computer_name(), GetComputerNameA(), test_getaddrinfo(), TestGetComputerNameEx(), and TestReturnValues().

◆ getIPAddrEntryForIf()

NTSTATUS getIPAddrEntryForIf ( HANDLE  tcpFile,
char name,
DWORD  index,
IFInfo ifInfo 
)

Definition at line 460 of file ifenum_reactos.c.

463  {
464  NTSTATUS status =
465  name ?
466  getInterfaceInfoByName( tcpFile, name, ifInfo ) :
467  getInterfaceInfoByIndex( tcpFile, index, ifInfo );
468 
469  if (!NT_SUCCESS(status)) {
470  ERR("getIPAddrEntryForIf returning %lx\n", status);
471  }
472 
473  return status;
474 }
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS getInterfaceInfoByName(HANDLE tcpFile, char *name, IFInfo *info)
GLuint index
Definition: glext.h:6031
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ERR(fmt,...)
Definition: debug.h:109
NTSTATUS getInterfaceInfoByIndex(HANDLE tcpFile, DWORD index, IFInfo *info)
Definition: name.c:36
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by getAddrByIndexOrName().

◆ GetLongestChildKeyName()

int GetLongestChildKeyName ( HANDLE  RegHandle)

Definition at line 3 of file registry.c.

3  {
4  LONG Status;
5  DWORD MaxAdapterName;
6 
8  NULL,
9  NULL,
10  NULL,
11  NULL,
12  &MaxAdapterName,
13  NULL,
14  NULL,
15  NULL,
16  NULL,
17  NULL,
18  NULL);
19  if (Status == ERROR_SUCCESS)
20  return MaxAdapterName + 1;
21  else
22  return -1;
23 }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
unsigned long DWORD
Definition: ntddk_ex.h:95
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3704
Status
Definition: gdiplustypes.h:24

Referenced by GetNthChildKeyName().

◆ GetNthChildKeyName()

PWCHAR GetNthChildKeyName ( HANDLE  RegHandle,
DWORD  n 
)

Definition at line 39 of file registry.c.

39  {
40  LONG Status;
41  int MaxAdapterName = GetLongestChildKeyName( RegHandle );
42  PWCHAR Value;
43  DWORD ValueLen;
44 
45  if (MaxAdapterName == -1)
46  return 0;
47 
48  ValueLen = MaxAdapterName;
49  Value = (PWCHAR)HeapAlloc( GetProcessHeap(), 0, MaxAdapterName * sizeof(WCHAR) );
50  if (!Value) return 0;
51 
52  Status = RegEnumKeyExW( RegHandle, n, Value, &ValueLen,
53  NULL, NULL, NULL, NULL );
54  if (Status != ERROR_SUCCESS) {
56  return 0;
57  } else {
58  Value[ValueLen] = 0;
59  return Value;
60  }
61 }
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2327
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble n
Definition: glext.h:7729
uint16_t * PWCHAR
Definition: typedefs.h:54
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int GetLongestChildKeyName(HANDLE RegHandle)
Definition: registry.c:3
Status
Definition: gdiplustypes.h:24
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2541
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ getNthIpEntity()

NTSTATUS getNthIpEntity ( HANDLE  tcpFile,
DWORD  index,
TDIEntityID ent 
)

Prototypes

Definition at line 65 of file ipstats_reactos.c.

65  {
66  DWORD numEntities = 0;
67  DWORD numRoutes = 0;
68  TDIEntityID *entitySet = 0;
69  NTSTATUS status = tdiGetEntityIDSet( tcpFile, &entitySet, &numEntities );
70  int i;
71 
72  if( !NT_SUCCESS(status) )
73  return status;
74 
75  for( i = 0; i < numEntities; i++ ) {
76  if( isIpEntity( tcpFile, &entitySet[i] ) ) {
77  TRACE("Entity %d is an IP Entity\n", i);
78  if( numRoutes == index ) break;
79  else numRoutes++;
80  }
81  }
82 
83  if( numRoutes == index && i < numEntities ) {
84  TRACE("Index %lu is entity #%d - %04x:%08x\n", index, i,
85  entitySet[i].tei_entity, entitySet[i].tei_instance);
86  memcpy( ent, &entitySet[i], sizeof(*ent) );
87  tdiFreeThingSet( entitySet );
88  return STATUS_SUCCESS;
89  } else {
90  tdiFreeThingSet( entitySet );
91  return STATUS_UNSUCCESSFUL;
92  }
93 }
BOOL isIpEntity(HANDLE tcpFile, TDIEntityID *ent)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
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 index
Definition: glext.h:6031
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
#define TRACE(s)
Definition: solgame.cpp:4
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
return STATUS_SUCCESS
Definition: btrfs.c:2725
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by createIpForwardEntry(), deleteIpForwardEntry(), getInterfaceInfoSet(), getRouteTable(), and SetIpNetEntry().

◆ hasArp()

BOOL hasArp ( HANDLE  tcpFile,
TDIEntityID arp_maybe 
)

Definition at line 130 of file ifenum_reactos.c.

130  {
133  DWORD returnSize, type;
134 
137  req.ID.toi_id = ENTITY_TYPE_ID;
139  req.ID.toi_entity.tei_instance = arp_maybe->tei_instance;
140 
141  status = DeviceIoControl( tcpFile,
143  &req,
144  sizeof(req),
145  &type,
146  sizeof(type),
147  &returnSize,
148  NULL );
149  if( !NT_SUCCESS(status) ) return FALSE;
150 
151  return (type & AT_ARP);
152 }
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define AT_ENTITY
Definition: tdiinfo.h:41
#define TCP_REQUEST_QUERY_INFORMATION_INIT
ULONG toi_class
Definition: tdiinfo.h:75
LONG NTSTATUS
Definition: precomp.h:26
#define ENTITY_TYPE_ID
Definition: tdiinfo.h:39
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: ticonsts.h:42
#define AT_ARP
Definition: tdiinfo.h:49
ULONG toi_id
Definition: tdiinfo.h:77
smooth NULL
Definition: ftsmooth.c:416
ULONG tei_entity
Definition: tdiinfo.h:31
#define INFO_CLASS_GENERIC
Definition: tdiinfo.h:64
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG tei_instance
Definition: tdiinfo.h:32
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: deviceio.c:136
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
return STATUS_SUCCESS
Definition: btrfs.c:2725
ULONG toi_type
Definition: tdiinfo.h:76
Definition: ps.c:97

Referenced by getArpTable(), getNumArpEntries(), getNumTcpEntries(), getNumUdpEntries(), getTcpTable(), and getUdpTable().

◆ isInterface()

BOOL isInterface ( TDIEntityID if_maybe)

Definition at line 113 of file ifenum_reactos.c.

113  {
114  return
115  if_maybe->tei_entity == IF_ENTITY;
116 }
ULONG tei_entity
Definition: tdiinfo.h:31
#define IF_ENTITY
Definition: tdiinfo.h:47

Referenced by getArpTable(), getInterfaceInfoSet(), getNthInterfaceEntity(), getNumArpEntries(), and getNumInterfacesInt().

◆ OpenChildKeyRead()

LONG OpenChildKeyRead ( HANDLE  RegHandle,
PWCHAR  ChildKeyName,
PHKEY  ReturnHandle 
)

Definition at line 25 of file registry.c.

27  {
28  return RegOpenKeyExW( RegHandle,
29  ChildKeyName,
30  0,
31  KEY_READ,
32  ReturnHandle );
33 }
#define KEY_READ
Definition: nt_native.h:1023
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3381

◆ QueryRegistryValueString()

PWCHAR QueryRegistryValueString ( HANDLE  RegHandle,
PWCHAR  ValueName 
)

Definition at line 119 of file registry.c.

120 {
121  PWCHAR String, TerminatedString;
122  DWORD Type, Length;
123 
125  if (!String) return NULL;
126  if (Type != REG_SZ)
127  {
128  DbgPrint("Type mismatch for %S (%d != %d)\n", ValueName, Type, REG_SZ);
129  //HeapFree(GetProcessHeap(), 0, String);
130  //return NULL;
131  }
132 
133  TerminatedString = TerminateReadString(String, Length);
135  if (!TerminatedString) return NULL;
136 
137  return TerminatedString;
138 }
Type
Definition: Type.h:6
#define DbgPrint
Definition: loader.c:25
PWCHAR TerminateReadString(PWCHAR String, DWORD Length)
Definition: registry.c:104
static WCHAR String[]
Definition: stringtable.c:55
uint16_t * PWCHAR
Definition: typedefs.h:54
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
PVOID QueryRegistryValue(HANDLE RegHandle, PWCHAR ValueName, LPDWORD RegistryType, LPDWORD Length)
Definition: registry.c:67
#define GetProcessHeap()
Definition: compat.h:395
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define HeapFree(x, y, z)
Definition: compat.h:394
#define REG_SZ
Definition: layer.c:22

◆ QueryRegistryValueStringMulti()

PWCHAR* QueryRegistryValueStringMulti ( HANDLE  RegHandle,
PWCHAR  ValueName 
)

Definition at line 144 of file registry.c.

144  {
145  PWCHAR String, TerminatedString, Tmp;
146  PWCHAR *Table;
147  DWORD Type, Length, i, j;
148 
150  if (!String) return NULL;
151  if (Type != REG_MULTI_SZ)
152  {
153  DbgPrint("Type mismatch for %S (%d != %d)\n", ValueName, Type, REG_MULTI_SZ);
154  //HeapFree(GetProcessHeap(), 0, String);
155  //return NULL;
156  }
157 
158  TerminatedString = TerminateReadString(String, Length);
160  if (!TerminatedString) return NULL;
161 
162  for (Tmp = TerminatedString, i = 0; *Tmp; Tmp++, i++) while (*Tmp) Tmp++;
163 
164  Table = HeapAlloc(GetProcessHeap(), 0, (i + 1) * sizeof(PWCHAR));
165  if (!Table)
166  {
167  HeapFree(GetProcessHeap(), 0, TerminatedString);
168  return NULL;
169  }
170 
171  for (Tmp = TerminatedString, j = 0; *Tmp; Tmp++, j++)
172  {
173  PWCHAR Orig = Tmp;
174 
175  for (i = 0; *Tmp; i++, Tmp++);
176 
177  Table[j] = HeapAlloc(GetProcessHeap(), 0, i * sizeof(WCHAR));
178  memcpy(Table[j], Orig, i * sizeof(WCHAR));
179  }
180 
181  Table[j] = NULL;
182 
183  HeapFree(GetProcessHeap(), 0, TerminatedString);
184 
185  return Table;
186 }
ASMGENDATA Table[]
Definition: genincdata.c:61
Type
Definition: Type.h:6
#define DbgPrint
Definition: loader.c:25
PWCHAR TerminateReadString(PWCHAR String, DWORD Length)
Definition: registry.c:104
static WCHAR String[]
Definition: stringtable.c:55
uint16_t * PWCHAR
Definition: typedefs.h:54
_In_ PUNICODE_STRING ValueName
Definition: cmfuncs.h:264
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 REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:76
PVOID QueryRegistryValue(HANDLE RegHandle, PWCHAR ValueName, LPDWORD RegistryType, LPDWORD Length)
Definition: registry.c:67
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 GLint GLint j
Definition: glfuncs.h:250
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ TCPSendIoctl()

DWORD TCPSendIoctl ( HANDLE  hDevice,
DWORD  dwIoControlCode,
LPVOID  lpInBuffer,
PULONG  pInBufferSize,
LPVOID  lpOutBuffer,
PULONG  pOutBufferSize 
)

Definition at line 13 of file iphlpapi_reactos.c.

14 {
15  BOOL Hack = FALSE;
16  HANDLE Event;
19 
20  /* FIXME: We don't have a global handle opened to \Device\Ip, so open one each time
21  * we need. In a future, it would be cool, just to pass it to TCPSendIoctl using the first arg
22  */
23  if (hDevice == INVALID_HANDLE_VALUE)
24  {
25  UNICODE_STRING DevName = RTL_CONSTANT_STRING(L"\\Device\\Ip");
27 
28  FIXME("Using the handle hack\n");
29  Hack = TRUE;
30 
32  &DevName,
34  NULL,
35  NULL);
36 
39  0, NULL, 0);
40  if (!NT_SUCCESS(Status))
41  {
43  }
44  }
45 
46  /* Sync event */
48  if (Event == NULL)
49  {
50  /* FIXME: See upper */
51  if (Hack)
52  {
53  CloseHandle(hDevice);
54  }
55  return GetLastError();
56  }
57 
58  /* Reinit, and call the networking stack */
61  Status = NtDeviceIoControlFile(hDevice, Event, NULL, NULL, &IoStatusBlock, dwIoControlCode, lpInBuffer, *pInBufferSize, lpOutBuffer, *pOutBufferSize);
62  if (Status == STATUS_PENDING)
63  {
66  }
67 
68  /* Close & return size info */
70  *pOutBufferSize = IoStatusBlock.Information;
71 
72  /* FIXME: See upper */
73  if (Hack)
74  {
75  CloseHandle(hDevice);
76  }
77 
78  /* Return result */
79  if (!NT_SUCCESS(Status))
80  {
82  }
83 
84  return ERROR_SUCCESS;
85 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:398
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
#define FILE_SHARE_READ
Definition: compat.h:125
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:597
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:110
_In_ PVOID _In_ ULONG Event
Definition: iotypes.h:434
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI NtCreateFile(OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize OPTIONAL, IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer OPTIONAL, IN ULONG EaLength)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
static const WCHAR L[]
Definition: oid.c:1250
Status
Definition: gdiplustypes.h:24
NTSYSAPI ULONG WINAPI RtlNtStatusToDosError(NTSTATUS)
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define GENERIC_EXECUTE
Definition: nt_native.h:91
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)

Referenced by SendARP().

◆ tdiGetIpAddrsForIpEntity()

NTSTATUS tdiGetIpAddrsForIpEntity ( HANDLE  tcpFile,
TDIEntityID ent,
IPAddrEntry **  addrs,
PDWORD  numAddrs 
)

Definition at line 171 of file ipstats_reactos.c.

171  {
173 
174  TRACE("TdiGetIpAddrsForIpEntity(tcpFile 0x%p, entityId 0x%x)\n",
175  tcpFile, ent->tei_instance);
176 
177  status = tdiGetSetOfThings( tcpFile,
181  CL_NL_ENTITY,
182  ent->tei_instance,
183  0,
184  sizeof(IPAddrEntry),
185  (PVOID *)addrs,
186  numAddrs );
187 
188  return status;
189 }
LONG NTSTATUS
Definition: precomp.h:26
#define TRACE(s)
Definition: solgame.cpp:4
ULONG tei_instance
Definition: tdiinfo.h:32
#define CL_NL_ENTITY
Definition: tdiinfo.h:42
NTSTATUS tdiGetSetOfThings(HANDLE tcpFile, DWORD toiClass, DWORD toiType, DWORD toiId, DWORD teiEntity, DWORD teiInstance, DWORD fixedPart, DWORD entrySize, PVOID *tdiEntitySet, PDWORD numEntries)
Definition: enum.c:24
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
#define IP_MIB_ADDRTABLE_ENTRY_ID
Definition: afd.h:36
static SERVICE_STATUS status
Definition: service.c:31
#define INFO_CLASS_PROTOCOL
Definition: tdiinfo.h:65
Definition: ps.c:97

Referenced by getInterfaceInfoSet().