--- /dev/null
+/*
+ * arp - display ARP cache from the IP stack parameters.
+ *
+ * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
+ *
+ * Robert Dickenson <robd@reactos.org>, August 15, 2002.
+ */
+#include <stdio.h>
+#include <windows.h>
+#include <tchar.h>
+#include <time.h>
+
+#include <iptypes.h>
+#include <ipexport.h>
+#include <iphlpapi.h>
+#include <snmp.h>
+
+#include "trace.h"
+
+
+VOID SNMP_FUNC_TYPE SnmpSvcInitUptime();
+DWORD SNMP_FUNC_TYPE SnmpSvcGetUptime();
+
+////////////////////////////////////////////////////////////////////////////////
+
+const char szUsage[] = { "\n" \
+ "Displays and modifies the IP Protocol to physical address translation tables\n" \
+ "used by address resolution protocol (ARP).\n" \
+ "\n" \
+ "ARP -s inet_addr eth_addr [if_addr]\n" \
+ "ARP -d inet_addr [if_addr]\n" \
+ "ARP -a [inet_addr] [-N if_addr]\n" \
+ "\n" \
+ " -a Displays the active ARP table by querying the current protocol\n" \
+ " data. If inet_addr is specified, the IP and physical addresses\n" \
+ " for the specified address are displayed. If more than one\n" \
+ " network interface is using ARP, each interfaces ARP table is\n" \
+ " displayed.\n" \
+ " -g Indentical to -a.\n" \
+ " inet_addr Specifies the IP address.\n" \
+ " -N if_addr Displays the ARP table for the specified interface only\n" \
+ " -d Deletes the host entry specified by inet_addr. inet_addr may be\n" \
+ " wildcarded with * to delete all host entries in the ARP table.\n" \
+ " -s Adds the host and associates the IP address inet_addr with the\n" \
+ " physical address eth_addr. The physical address must be specified\n" \
+ " as 6 hexadecimal characters delimited by hyphens. The new entry\n" \
+ " will become permanent in the ARP table.\n" \
+ " eth_addr Specifies the interface physical address.\n" \
+ " if_addr If present, this specifies the IP address of the interface whose\n" \
+ " address translation table should be modified. If not present, the\n" \
+ " first applicable interface will be used.\n" \
+ "Example:\n" \
+ " > arp -s 192.168.0.12 55-AA-55-01-02-03 .... Static entry creation.\n" \
+ " > arp -a .... ARP table display.\n" \
+ " > arp -d * .... Delete all ARP table entries.\n"
+};
+
+void usage(void)
+{
+// fprintf(stderr,"USAGE:\n");
+ fputs(szUsage, stderr);
+}
+
+int main(int argc, char *argv[])
+{
+ TCHAR szComputerName[50];
+ DWORD dwSize = 50;
+
+ int nBytes = 500;
+ BYTE* pCache;
+
+ if (argc > 1) {
+ usage();
+ return 1;
+ }
+
+ SnmpSvcInitUptime();
+
+ GetComputerName(szComputerName, &dwSize);
+ _tprintf(_T("ReactOS ARP cache on Computer Name: %s\n"), szComputerName);
+
+ pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
+
+ Sleep(2500);
+
+ if (pCache != NULL) {
+
+ DWORD dwUptime = SnmpSvcGetUptime();
+
+ _tprintf(_T("SNMP uptime: %d\n"), dwUptime);
+
+ SnmpUtilMemFree(pCache);
+ } else {
+ _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
+ return 1;
+ }
+ return 0;
+}
+
--- /dev/null
+#include <defines.h>
+#include <reactos/resource.h>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+ PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", RES_STR_COMPANY_NAME
+ VALUE "FileDescription", "ReactOS TCP/IPv4 Win32 arp\0"
+ VALUE "FileVersion", RES_STR_FILE_VERSION
+ VALUE "InternalName", "arp\0"
+ VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
+ VALUE "OriginalCopyright", "Robert Dickenson (robd@reactos.org)\0"
+ VALUE "OriginalFilename", "arp.exe\0"
+ VALUE "ProductName", RES_STR_PRODUCT_NAME
+ VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
--- /dev/null
+
+PATH_TO_TOP = ../../../reactos
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = arp
+
+TARGET_SDKLIBS = user32.a snmpapi.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#include <stdio.h>
+#include <stdarg.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+#include "trace.h"
+
+
+#ifdef _DEBUG
+
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+
+void _DebugBreak(void)
+{
+ DebugBreak();
+}
+
+void Trace(TCHAR* lpszFormat, ...)
+{
+ va_list args;
+ int nBuf;
+ TCHAR szBuffer[512];
+
+ va_start(args, lpszFormat);
+ nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
+ OutputDebugString(szBuffer);
+ // was there an error? was the expanded string too long?
+ //ASSERT(nBuf >= 0);
+ va_end(args);
+}
+
+void Assert(void* assert, TCHAR* file, int line, void* msg)
+{
+ if (msg == NULL) {
+ printf("ASSERT -- %s occured on line %u of file %s.\n",
+ assert, line, file);
+ } else {
+ printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
+ assert, line, file, msg);
+ }
+}
+
+#else
+
+void Trace(TCHAR* lpszFormat, ...) { };
+void Assert(void* assert, TCHAR* file, int line, void* msg) { };
+
+#endif //_DEBUG
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#ifdef _DEBUG
+
+#ifdef _X86_
+#define BreakPoint() _asm { int 3h }
+#else
+#define BreakPoint() _DebugBreak()
+#endif
+
+#ifndef ASSERT
+#define ASSERT(exp) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, NULL); \
+ BreakPoint(); \
+ } \
+} \
+
+#define ASSERTMSG(exp, msg) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, msg); \
+ BreakPoint(); \
+ } \
+}
+#endif
+
+//=============================================================================
+// MACRO: TRACE()
+//=============================================================================
+
+#define TRACE Trace
+
+
+#else // _DEBUG
+
+//=============================================================================
+// Define away MACRO's ASSERT() and TRACE() in non debug builds
+//=============================================================================
+
+#ifndef ASSERT
+#define ASSERT(exp)
+#define ASSERTMSG(exp, msg)
+#endif
+
+#define TRACE 0 ? (void)0 : Trace
+
+#endif // !_DEBUG
+
+
+void Assert(void* assert, TCHAR* file, int line, void* msg);
+void Trace(TCHAR* lpszFormat, ...);
+
+
+#endif // __TRACE_H__
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/*
+ * ipconfig - display IP stack parameters.
+ *
+ * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
+ *
+ * Robert Dickenson <robd@reactos.org>, August 15, 2002.
+ */
+#include <stdio.h>
+#include <windows.h>
+#include <tchar.h>
+#include <time.h>
+
+#ifdef __GNUC__
+#undef WINAPI
+#define WINAPI
+#endif
+
+#include <iptypes.h>
+#include <ipexport.h>
+#include <iphlpapi.h>
+
+#ifdef _DEBUG
+#include "trace.h"
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+
+/* imported from iphlpapi.dll
+
+GetAdapterOrderMap
+GetInterfaceInfo
+GetIpStatsFromStack
+NhGetInterfaceNameFromGuid
+NhpAllocateAndGetInterfaceInfoFromStack
+
+ */
+
+TCHAR* GetNodeTypeName(int nNodeType)
+{
+ switch (nNodeType) {
+ case 0:
+ return _T("zero");
+ case 1:
+ return _T("one");
+ case 2:
+ return _T("two");
+ case 3:
+ return _T("three");
+ case 4:
+ return _T("mixed");
+ default:
+ return _T("unknown");
+ }
+}
+
+void ShowNetworkFixedInfo()
+{
+ FIXED_INFO FixedInfo;
+ ULONG OutBufLen = sizeof(FIXED_INFO);
+ DWORD result;
+
+
+ result = GetNetworkParams(&FixedInfo, &OutBufLen);
+ if (result == ERROR_SUCCESS) {
+ printf("\tHostName. . . . . . . . . . . : %s\n", FixedInfo.HostName);
+ printf("\tDomainName. . . . . . . . . . : %s\n", FixedInfo.DomainName);
+ _tprintf(_T("\tNodeType. . . . . . . . . . . : %d (%s)\n"), FixedInfo.NodeType, GetNodeTypeName(FixedInfo.NodeType));
+ printf("\tScopeId . . . . . . . . . . . : %s\n", FixedInfo.ScopeId);
+ _tprintf(_T("\tEnableRouting . . . . . . . . : %s\n"), FixedInfo.EnableRouting ? _T("yes") : _T("no"));
+ _tprintf(_T("\tEnableProxy . . . . . . . . . : %s\n"), FixedInfo.EnableProxy ? _T("yes") : _T("no"));
+ _tprintf(_T("\tEnableDns . . . . . . . . . . : %s\n"), FixedInfo.EnableDns ? _T("yes") : _T("no"));
+ _tprintf(_T("\n"));
+ //_tprintf(_T("\n"), );
+ //_tprintf(_T("GetNetworkParams() returned with %d\n"), pIfTable->NumAdapters);
+
+// _tprintf(_T("\tConnection specific DNS suffix: %s\n"), FixedInfo.EnableDns ? _T("yes") : _T("no"));
+
+ } else {
+ switch (result) {
+ case ERROR_BUFFER_OVERFLOW:
+ _tprintf(_T("The buffer size indicated by the pOutBufLen parameter is too small to hold the adapter information. The pOutBufLen parameter points to the required size\n"));
+ break;
+ case ERROR_INVALID_PARAMETER:
+ _tprintf(_T("The pOutBufLen parameter is NULL, or the calling process does not have read/write access to the memory pointed to by pOutBufLen, or the calling process does not have write access to the memory pointed to by the pAdapterInfo parameter\n"));
+ break;
+ case ERROR_NO_DATA:
+ _tprintf(_T("No adapter information exists for the local computer\n"));
+ break;
+ case ERROR_NOT_SUPPORTED:
+ _tprintf(_T("This function is not supported on the operating system in use on the local system\n"));
+ break;
+ default:
+ _tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
+ break;
+ }
+ }
+}
+
+void ShowNetworkInterfaces()
+{
+ IP_INTERFACE_INFO* pIfTable = NULL;
+ DWORD result;
+ DWORD dwNumIf;
+ DWORD dwOutBufLen = 0;
+
+ if ((result = GetNumberOfInterfaces(&dwNumIf)) != NO_ERROR) {
+ _tprintf(_T("GetNumberOfInterfaces() failed with code 0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
+ return;
+ }
+
+ result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
+// dwOutBufLen = sizeof(IP_INTERFACE_INFO) + dwNumIf * sizeof(IP_ADAPTER_INDEX_MAP);
+// _tprintf(_T("GetNumberOfInterfaces() returned %d, dwOutBufLen %d\n"), dwNumIf, dwOutBufLen);
+// _tprintf(_T("sizeof(IP_INTERFACE_INFO) %d, sizeof(IP_ADAPTER_INDEX_MAP) %d\n"), sizeof(IP_INTERFACE_INFO), sizeof(IP_ADAPTER_INDEX_MAP));
+
+ pIfTable = (IP_INTERFACE_INFO*)malloc(dwOutBufLen);
+ if (!pIfTable) {
+ _tprintf(_T("ERROR: failed to allocate 0x%08X bytes of memory\n"), dwOutBufLen);
+ return;
+ }
+ result = GetInterfaceInfo(pIfTable, &dwOutBufLen);
+ if (result == NO_ERROR) {
+ int i;
+ //_tprintf(_T("GetInterfaceInfo() returned with %d adaptor entries\n"), pIfTable->NumAdapters);
+ for (i = 0; i < pIfTable->NumAdapters; i++) {
+ wprintf(L"[%d] %s\n", i, pIfTable->Adapter[i].Name);
+
+// \DEVICE\TCPIP_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357}
+// \DEVICE\TCPIP_{BD445697-0945-4591-AE7F-2AB0F383CA87}
+// \DEVICE\TCPIP_{6D87DC08-6BC5-4E78-AB5F-18CAB785CFFE}
+
+//HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NetBT\Parameters\Interfaces\Tcpip_{DB0E61C1-3498-4C5F-B599-59CDE8A1E357}
+ }
+ } else {
+ switch (result) {
+ case ERROR_INVALID_PARAMETER:
+ _tprintf(_T("The dwOutBufLen parameter is NULL, or GetInterfaceInterface is unable to write to the memory pointed to by the dwOutBufLen parameter\n"));
+ break;
+ case ERROR_INSUFFICIENT_BUFFER:
+ _tprintf(_T("The buffer pointed to by the pIfTable parameter is not large enough. The required size is returned in the DWORD variable pointed to by the dwOutBufLen parameter\n"));
+ _tprintf(_T("\tdwOutBufLen: %d\n"), dwOutBufLen);
+ break;
+ case ERROR_NOT_SUPPORTED:
+ _tprintf(_T("This function is not supported on the operating system in use on the local system\n"));
+ break;
+ default:
+ _tprintf(_T("0x%08X - Use FormatMessage to obtain the message string for the returned error\n"), result);
+ break;
+ }
+ }
+ free(pIfTable);
+}
+
+const char szUsage[] = { "USAGE:\n" \
+ " ipconfig [/? | /all | /release [adapter] | /renew [adapter]\n" \
+ " | /flushdns | /registerdns\n" \
+ " | /showclassid adapter\n" \
+ " | /showclassid adapter\n" \
+ " | /setclassid adapter [classidtoset] ]\n" \
+ "\n" \
+ "adapter Full name or pattern with '*' and '?' to 'match',\n" \
+ " * matches any character, ? matches one character.\n" \
+ " Options\n" \
+ " /? Display this help message.\n" \
+ " /all Display full configuration information.\n" \
+ " /release Release the IP address for the specified adapter.\n" \
+ " /renew Renew the IP address for the specified adapter.\n" \
+ " /flushdns Purges the DNS Resolver cache.\n" \
+ " /registerdns Refreshes all DHCP leases and re-registers DNS names\n" \
+ " /displaydns Display the contents of the DNS Resolver Cache.\n" \
+ " /showclassid Displays all the dhcp class IDs allowed for adapter.\n" \
+ " /setclassid Modifies the dhcp class id.\n" \
+ "\n" \
+ "The default is to display only the IP address, subnet mask and\n" \
+ "default gateway for each adapter bound to TCP/IP.\n"
+};
+
+/*
+ "\n" \
+ "For Release and Renew, if no adapter name is specified, then the IP address\n" \
+ "leases for all adapters bound to TCP/IP will be released or renewed.\n" \
+ "\n" \
+ "For SetClassID, if no class id is specified, then the classid is removed.\n" \
+ "\n" \
+ "Examples:\n" \
+ " > ipconfig ... Show information.\n" \
+ " > ipconfig /all ... Show detailed information\n" \
+ " > ipconfig /renew ... renew all adapaters\n" \
+ " > ipconfig /renew EL* ... renew adapters named EL....\n" \
+ " > ipconfig /release *ELINK?21* ... release all matching adapters,\n" \
+ eg. ELINK-21, myELELINKi21adapter.\n"
+ */
+
+void usage(void)
+{
+ fputs(szUsage, stderr);
+}
+
+
+int main(int argc, char *argv[])
+{
+ if (argc > 1) {
+ usage();
+ return 1;
+ }
+ _tprintf(_T("ReactOS IP Configuration\n"));
+ ShowNetworkFixedInfo();
+ ShowNetworkInterfaces();
+ return 0;
+}
+
--- /dev/null
+#include <defines.h>
+#include <reactos/resource.h>
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+ PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", RES_STR_COMPANY_NAME
+ VALUE "FileDescription", "ReactOS TCP/IPv4 Win32 ipconfig\0"
+ VALUE "FileVersion", RES_STR_FILE_VERSION
+ VALUE "InternalName", "ipconfig\0"
+ VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
+ VALUE "OriginalCopyright", "Robert Dickenson (robd@reactos.org)\0"
+ VALUE "OriginalFilename", "ipconfig.exe\0"
+ VALUE "ProductName", RES_STR_PRODUCT_NAME
+ VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
--- /dev/null
+
+PATH_TO_TOP = ../../../reactos
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = ipconfig
+
+TARGET_SDKLIBS = user32.a iphlpapi.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#include <stdio.h>
+#include <stdarg.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+#include "trace.h"
+
+
+#ifdef _DEBUG
+
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+
+void _DebugBreak(void)
+{
+ DebugBreak();
+}
+
+void Trace(TCHAR* lpszFormat, ...)
+{
+ va_list args;
+ int nBuf;
+ TCHAR szBuffer[512];
+
+ va_start(args, lpszFormat);
+ nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
+ OutputDebugString(szBuffer);
+ // was there an error? was the expanded string too long?
+ //ASSERT(nBuf >= 0);
+ va_end(args);
+}
+
+void Assert(void* assert, TCHAR* file, int line, void* msg)
+{
+ if (msg == NULL) {
+ printf("ASSERT -- %s occured on line %u of file %s.\n",
+ assert, line, file);
+ } else {
+ printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
+ assert, line, file, msg);
+ }
+}
+
+#else
+
+void Trace(TCHAR* lpszFormat, ...) { };
+void Assert(void* assert, TCHAR* file, int line, void* msg) { };
+
+#endif //_DEBUG
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#ifdef _DEBUG
+
+#ifdef _X86_
+#define BreakPoint() _asm { int 3h }
+#else
+#define BreakPoint() _DebugBreak()
+#endif
+
+#ifndef ASSERT
+#define ASSERT(exp) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, NULL); \
+ BreakPoint(); \
+ } \
+} \
+
+#define ASSERTMSG(exp, msg) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, msg); \
+ BreakPoint(); \
+ } \
+}
+#endif
+
+//=============================================================================
+// MACRO: TRACE()
+//=============================================================================
+
+#define TRACE Trace
+
+
+#else // _DEBUG
+
+//=============================================================================
+// Define away MACRO's ASSERT() and TRACE() in non debug builds
+//=============================================================================
+
+#ifndef ASSERT
+#define ASSERT(exp)
+#define ASSERTMSG(exp, msg)
+#endif
+
+#define TRACE 0 ? (void)0 : Trace
+
+#endif // !_DEBUG
+
+
+void Assert(void* assert, TCHAR* file, int line, void* msg);
+void Trace(TCHAR* lpszFormat, ...);
+
+
+#endif // __TRACE_H__
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+
+PATH_TO_TOP = ../../../reactos
+
+TARGET_TYPE = program
+
+TARGET_APPTYPE = console
+
+TARGET_NAME = netstat
+
+TARGET_SDKLIBS = user32.a snmpapi.a
+
+TARGET_OBJECTS = $(TARGET_NAME).o
+
+include $(PATH_TO_TOP)/rules.mak
+
+include $(TOOLS_PATH)/helper.mk
+
+# EOF
--- /dev/null
+/*
+ * netstat - display IP stack statistics.
+ *
+ * This source code is in the PUBLIC DOMAIN and has NO WARRANTY.
+ *
+ * Robert Dickenson <robd@reactos.org>, August 15, 2002.
+ */
+#include <windows.h>
+#include <tchar.h>
+#include <stdio.h>
+#include <time.h>
+
+#include <iptypes.h>
+#include <ipexport.h>
+#include <iphlpapi.h>
+#include <snmp.h>
+
+#include "trace.h"
+#include "resource.h"
+
+
+#define MAX_RESLEN 4000
+
+/*
+typedef struct {
+ UINT idLength;
+ UINT* ids;
+} AsnObjectIdentifier;
+
+VOID SnmpUtilPrintAsnAny(AsnAny* pAny); // pointer to value to print
+VOID SnmpUtilPrintOid(AsnObjectIdentifier* Oid); // object identifier to print
+
+ */
+void test_snmp(void)
+{
+ int nBytes = 500;
+ BYTE* pCache;
+
+ pCache = (BYTE*)SnmpUtilMemAlloc(nBytes);
+ if (pCache != NULL) {
+ AsnObjectIdentifier* pOidSrc = NULL;
+ AsnObjectIdentifier AsnObId;
+ if (SnmpUtilOidCpy(&AsnObId, pOidSrc)) {
+ //
+ //
+ //
+ SnmpUtilOidFree(&AsnObId);
+ }
+ SnmpUtilMemFree(pCache);
+ } else {
+ _tprintf(_T("ERROR: call to SnmpUtilMemAlloc() failed\n"));
+ }
+}
+
+
+void usage(void)
+{
+ TCHAR buffer[MAX_RESLEN];
+
+ int length = LoadString(GetModuleHandle(NULL), IDS_APP_USAGE, buffer, sizeof(buffer)/sizeof(buffer[0]));
+ _fputts(buffer, stderr);
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc > 1) {
+ usage();
+ return 1;
+ }
+ _tprintf(_T("\nActive Connections\n\n")\
+ _T(" Proto Local Address Foreign Address State\n\n"));
+ test_snmp();
+ return 0;
+}
--- /dev/null
+#include <defines.h>
+#include <reactos/resource.h>
+
+#include "resource.h"
+
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION RES_UINT_FV_MAJOR,RES_UINT_FV_MINOR,RES_UINT_FV_REVISION,RES_UINT_FV_BUILD
+ PRODUCTVERSION RES_UINT_PV_MAJOR,RES_UINT_PV_MINOR,RES_UINT_PV_REVISION,RES_UINT_PV_BUILD
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", RES_STR_COMPANY_NAME
+ VALUE "FileDescription", "ReactOS TCP/IPv4 Win32 netstat\0"
+ VALUE "FileVersion", RES_STR_FILE_VERSION
+ VALUE "InternalName", "netstat\0"
+ VALUE "LegalCopyright", RES_STR_LEGAL_COPYRIGHT
+ VALUE "OriginalCopyright", "Robert Dickenson (robd@reactos.org)\0"
+ VALUE "OriginalFilename", "netstat.exe\0"
+ VALUE "ProductName", RES_STR_PRODUCT_NAME
+ VALUE "ProductVersion", RES_STR_PRODUCT_VERSION
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+#ifdef __GNUC__
+STRINGTABLE DISCARDABLE
+BEGIN
+ IDS_APP_TITLE "ReactOS netstat"
+ IDS_APP_USAGE "\n"\
+ "Displays current TCP/IP protocol statistics and network connections.\n\n"\
+ "NETSTAT [-a] [-e] [-n] [-s] [-p proto] [-r] [interval]\n\n"\
+ " -a Displays all connections and listening ports.\n"\
+ " -e Displays Ethernet statistics. May be combined with -s\n"\
+ " -n Displays address and port numbers in numeric form.\n"\
+ " -p proto Shows connections for protocol 'proto' TCP or UDP.\n"\
+ " If used with the -s option to display\n"\
+ " per-protocol statistics, 'proto' may be TCP, UDP, or IP.\n"\
+ " -r Displays the current routing table.\n"\
+ " -s Displays per-protocol statistics. Statistics are shown for\n"\
+ " TCP, UDP and IP by default; use -p option to display\n"\
+ " information about a subset of the protocols only.\n"\
+ " interval Redisplays selected statistics every 'interval' seconds.\n"\
+ " Press CTRL+C to stop redisplaying. By default netstat will\n"\
+ " print the current information only once.\n"
+END
+#endif
+
--- /dev/null
+
+#define RES_FIRST_INDEX 1
+#define RES_LAST_INDEX 25
+
+#define IDS_APP_TITLE 100
+#define IDS_APP_USAGE 101
+
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#include <stdio.h>
+#include <stdarg.h>
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <tchar.h>
+#include "trace.h"
+
+
+#ifdef _DEBUG
+
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+
+void _DebugBreak(void)
+{
+ DebugBreak();
+}
+
+void Trace(TCHAR* lpszFormat, ...)
+{
+ va_list args;
+ int nBuf;
+ TCHAR szBuffer[512];
+
+ va_start(args, lpszFormat);
+ nBuf = _vsntprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
+ OutputDebugString(szBuffer);
+ // was there an error? was the expanded string too long?
+ //ASSERT(nBuf >= 0);
+ va_end(args);
+}
+
+void Assert(void* assert, TCHAR* file, int line, void* msg)
+{
+ if (msg == NULL) {
+ printf("ASSERT -- %s occured on line %u of file %s.\n",
+ assert, line, file);
+ } else {
+ printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
+ assert, line, file, msg);
+ }
+}
+
+#else
+
+void Trace(TCHAR* lpszFormat, ...) { };
+void Assert(void* assert, TCHAR* file, int line, void* msg) { };
+
+#endif //_DEBUG
+/////////////////////////////////////////////////////////////////////////////
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Diagnostic Trace
+//
+#ifndef __TRACE_H__
+#define __TRACE_H__
+
+#ifdef _DEBUG
+
+#ifdef _X86_
+#define BreakPoint() _asm { int 3h }
+#else
+#define BreakPoint() _DebugBreak()
+#endif
+
+#ifndef ASSERT
+#define ASSERT(exp) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, NULL); \
+ BreakPoint(); \
+ } \
+} \
+
+#define ASSERTMSG(exp, msg) \
+{ \
+ if (!(exp)) { \
+ Assert(#exp, __FILE__, __LINE__, msg); \
+ BreakPoint(); \
+ } \
+}
+#endif
+
+//=============================================================================
+// MACRO: TRACE()
+//=============================================================================
+
+#define TRACE Trace
+
+
+#else // _DEBUG
+
+//=============================================================================
+// Define away MACRO's ASSERT() and TRACE() in non debug builds
+//=============================================================================
+
+#ifndef ASSERT
+#define ASSERT(exp)
+#define ASSERTMSG(exp, msg)
+#endif
+
+#define TRACE 0 ? (void)0 : Trace
+
+#endif // !_DEBUG
+
+
+void Assert(void* assert, TCHAR* file, int line, void* msg);
+void Trace(TCHAR* lpszFormat, ...);
+
+
+#endif // __TRACE_H__
+/////////////////////////////////////////////////////////////////////////////