ReactOS 0.4.15-dev-8339-g4028de8
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 (   void)    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.

139 {
@ IFMtu
@ IPABcast
@ IPAMask
@ IFStatus
@ IPAAddr
enum _IPHLPAddrType IPHLPAddrType

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:736
#define HeapFree(x, y, z)
Definition: compat.h:735

◆ ConsumeRegValueString()

void ConsumeRegValueString ( PWCHAR  NameServer)

Definition at line 140 of file registry.c.

140 {
142}
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

◆ EnumNameServers()

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

Referenced by GetPerAdapterInfo().

◆ GetComputerNameExA()

BOOL WINAPI GetComputerNameExA ( COMPUTER_NAME_FORMAT  NameType,
LPSTR  lpBuffer,
LPDWORD  nSize 
)

Definition at line 376 of file compname.c.

379{
382 BOOL Result;
383 PWCHAR TempBuffer = NULL;
384
385 if ((nSize == NULL) ||
386 (lpBuffer == NULL && *nSize > 0))
387 {
389 return FALSE;
390 }
391
392 if (*nSize > 0)
393 {
394 TempBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, *nSize * sizeof(WCHAR));
395 if (!TempBuffer)
396 {
398 return FALSE;
399 }
400 }
401
402 AnsiString.MaximumLength = (USHORT)*nSize;
403 AnsiString.Length = 0;
404 AnsiString.Buffer = lpBuffer;
405
406 Result = GetComputerNameExW(NameType, TempBuffer, nSize);
407
408 if (Result)
409 {
410 UnicodeString.MaximumLength = (USHORT)*nSize * sizeof(WCHAR) + sizeof(WCHAR);
411 UnicodeString.Length = (USHORT)*nSize * sizeof(WCHAR);
412 UnicodeString.Buffer = TempBuffer;
413
416 FALSE);
417 }
418
419 RtlFreeHeap(RtlGetProcessHeap(), 0, TempBuffer);
420
421 return Result;
422}
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx 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:658
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:590
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:608
BOOL WINAPI GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, LPWSTR lpBuffer, LPDWORD nSize)
Definition: compname.c:216
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
@ AnsiString
Definition: dnslib.h:19
unsigned int BOOL
Definition: ntddk_ex.h:94
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
unsigned short USHORT
Definition: pedump.c:61
uint16_t * PWCHAR
Definition: typedefs.h:56
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2084
_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:409
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by get_computer_name(), GetComputerNameA(), ShowInfo(), START_TEST(), TestGetComputerNameEx(), and TestReturnValues().

◆ getIPAddrEntryForIf()

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

Definition at line 460 of file ifenum_reactos.c.

463 {
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
#define ERR(fmt,...)
Definition: precomp.h:57
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
GLuint index
Definition: glext.h:6031
NTSTATUS getInterfaceInfoByIndex(HANDLE tcpFile, DWORD index, IFInfo *info)
NTSTATUS getInterfaceInfoByName(HANDLE tcpFile, char *name, IFInfo *info)
Definition: name.c:39
Definition: ps.c:97

Referenced by getAddrByIndexOrName().

◆ GetLongestChildKeyName()

int GetLongestChildKeyName ( HANDLE  RegHandle)

Definition at line 3 of file registry.c.

3 {
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 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:3662
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
long LONG
Definition: pedump.c:60
_In_opt_ PETWENABLECALLBACK _In_opt_ PVOID _Out_ PREGHANDLE RegHandle
Definition: wmifuncs.h:78

Referenced by GetNthChildKeyName().

◆ GetNthChildKeyName()

PWCHAR GetNthChildKeyName ( HANDLE  RegHandle,
DWORD  n 
)

Definition at line 39 of file registry.c.

39 {
41 int MaxAdapterName = GetLongestChildKeyName( RegHandle );
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}
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:2504
#define HeapAlloc
Definition: compat.h:733
int GetLongestChildKeyName(HANDLE RegHandle)
Definition: registry.c:3
GLdouble n
Definition: glext.h:7729

◆ 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 );
92 }
93}
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
BOOL isIpEntity(HANDLE tcpFile, TDIEntityID *ent)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VOID tdiFreeThingSet(PVOID things)
Definition: enum.c:118
NTSTATUS tdiGetEntityIDSet(HANDLE tcpFile, TDIEntityID **entitySet, PDWORD numEntities)
Definition: enum.c:122
#define STATUS_SUCCESS
Definition: shellext.h:65
#define TRACE(s)
Definition: solgame.cpp:4
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

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

◆ hasArp()

BOOL hasArp ( HANDLE  tcpFile,
TDIEntityID arp_maybe 
)

Definition at line 131 of file ifenum_reactos.c.

131 {
134 DWORD returnSize, type;
135
140 req.ID.toi_entity.tei_instance = arp_maybe->tei_instance;
141
142 status = DeviceIoControl( tcpFile,
144 &req,
145 sizeof(req),
146 &type,
147 sizeof(type),
148 &returnSize,
149 NULL );
150 if( !NT_SUCCESS(status) ) return FALSE;
151
152 /* AT_ARP corresponds to an individual TDI entity type */
153 return (type == AT_ARP);
154}
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
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TCP_REQUEST_QUERY_INFORMATION_INIT
ULONG tei_entity
Definition: tdiinfo.h:31
ULONG tei_instance
Definition: tdiinfo.h:32
ULONG toi_id
Definition: tdiinfo.h:77
ULONG toi_type
Definition: tdiinfo.h:76
ULONG toi_class
Definition: tdiinfo.h:75
TDIEntityID toi_entity
Definition: tdiinfo.h:74
#define ENTITY_TYPE_ID
Definition: tdiinfo.h:39
#define INFO_CLASS_GENERIC
Definition: tdiinfo.h:64
#define AT_ENTITY
Definition: tdiinfo.h:41
#define INFO_TYPE_PROVIDER
Definition: tdiinfo.h:69
#define AT_ARP
Definition: tdiinfo.h:49
#define IOCTL_TCP_QUERY_INFORMATION_EX
Definition: tditest.h:110

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

◆ isInterface()

BOOL isInterface ( TDIEntityID if_maybe)

Definition at line 114 of file ifenum_reactos.c.

114 {
115 return
116 if_maybe->tei_entity == IF_ENTITY;
117}
#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 {
29 ChildKeyName,
30 0,
32 ReturnHandle );
33}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
#define KEY_READ
Definition: nt_native.h:1023

◆ QueryRegistryValueString()

PWCHAR QueryRegistryValueString ( HANDLE  RegHandle,
PWCHAR  ValueName 
)

Definition at line 119 of file registry.c.

120{
121 PWCHAR String, TerminatedString;
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:7
PWCHAR TerminateReadString(PWCHAR String, DWORD Length)
Definition: registry.c:104
PVOID QueryRegistryValue(HANDLE RegHandle, PWCHAR ValueName, LPDWORD RegistryType, LPDWORD Length)
Definition: registry.c:67
#define DbgPrint
Definition: hal.h:12
#define REG_SZ
Definition: layer.c:22
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFSTRING String
Definition: wdfdevice.h:2433
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING ValueName
Definition: wdfregistry.h:243

◆ 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
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 REG_MULTI_SZ
Definition: nt_native.h:1501

◆ 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;
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);
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}
#define FIXME(fmt,...)
Definition: precomp.h:53
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:36
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define FILE_SHARE_READ
Definition: compat.h:136
#define FILE_OPEN_IF
Definition: from_kernel.h:56
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
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 FILE_SHARE_WRITE
Definition: nt_native.h:681
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)
NTSYSAPI NTSTATUS NTAPI NtWaitForSingleObject(IN HANDLE hObject, IN BOOLEAN bAlertable, IN PLARGE_INTEGER Timeout)
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 GENERIC_EXECUTE
Definition: nt_native.h:91
#define STATUS_PENDING
Definition: ntstatus.h:82
#define L(x)
Definition: ntvdm.h:50
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
_In_ DWORD dwIoControlCode
Definition: winddi.h:1700

Referenced by SendARP().

◆ tdiGetIpAddrsForIpEntity()

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

Definition at line 170 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,
182 ent->tei_instance,
183 0,
184 sizeof(IPAddrEntry),
185 (PVOID *)addrs,
186 numAddrs);
187
188 return status;
189}
#define IP_MIB_ADDRTABLE_ENTRY_ID
Definition: afd.h:36
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_CLASS_PROTOCOL
Definition: tdiinfo.h:65
#define CL_NL_ENTITY
Definition: tdiinfo.h:42

Referenced by getInterfaceInfoSet().