519{
540
541 DPRINT(
"IpAddAddress()\n");
542
544 0,
546 if (pdwTagType ==
NULL)
547 {
549 }
550
555 pttTags,
557 pdwTagType);
559 {
560 DPRINT1(
"MatchTagsInCmdLine() failed (Error %lu)\n", dwError);
562 return dwError;
563 }
564
566 {
567 DPRINT(
"Tag %lu: %lu\n",
i, pdwTagType[
i]);
568
569 switch (pdwTagType[
i])
570 {
571 case 0:
574 &InterfaceGUID,
575 0, 0);
577 {
578 DPRINT1(
"NhGetGuidFromInterfaceName() failed (Error %lu)\n", dwError);
583 break;
584 }
586 DPRINT(
"Interface: {%08lx-%04hx-%04hx-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
587 InterfaceGUID.Data1, InterfaceGUID.Data2, InterfaceGUID.Data3, InterfaceGUID.Data4[0], InterfaceGUID.Data4[1],
588 InterfaceGUID.Data4[2], InterfaceGUID.Data4[3], InterfaceGUID.Data4[4], InterfaceGUID.Data4[5], InterfaceGUID.Data4[6], InterfaceGUID.Data4[7]);
590 break;
591
592 case 1:
596 &Term,
599 {
600 DPRINT(
"RtlIpv4StringToAddressW() failed (Status 0x%08lx)\n",
Status);
604 pttTags[pdwTagType[
i]].pwszTag);
606 break;
607 }
608 DPRINT(
"IP Address: %u.%u.%u.%u\n",
611 DPRINT(
"IP Address: %S\n", pszAddress);
613 break;
614
615 case 2:
619 &Term,
622 {
623 DPRINT(
"RtlIpv4StringToAddressW() failed (Status 0x%08lx)\n",
Status);
627 pttTags[pdwTagType[
i]].pwszTag);
629 break;
630 }
631 DPRINT(
"Subnet Mask: %u.%u.%u.%u\n",
632 Mask.S_un.S_un_b.s_b1,
Mask.S_un.S_un_b.s_b2,
Mask.S_un.S_un_b.s_b3,
Mask.S_un.S_un_b.s_b4);
634 DPRINT(
"Subnat Mask: %S\n", pszMask);
636 break;
637
638 case 3:
642 &Term,
643 &Gateway);
645 {
646 DPRINT(
"RtlIpv4StringToAddressW() failed (Status 0x%08lx)\n",
Status);
650 pttTags[pdwTagType[
i]].pwszTag);
652 break;
653 }
655 DPRINT(
"Gateway: %u.%u.%u.%u\n",
658 break;
659
660 case 4:
663 (wchar_t**)&Term,
664 10);
665 if (dwMetric > 9999)
666 {
668 break;
669 }
671 DPRINT(
"Metric: %lu\n", dwMetric);
673 break;
674
675 default:
676 DPRINT1(
"Unknown tag type %lu\n", pdwTagType[
i]);
677 break;
678 }
679 }
680
681 if (pdwTagType)
683
685 return dwError;
686
687
688
689
690 if (bHaveName ==
FALSE)
692
693
694 if ((bHaveAddress && !bHaveMask) ||
695 (!bHaveAddress && bHaveMask))
697
698
699 if ((bHaveGateway && !bHaveMetric) ||
700 (!bHaveGateway && bHaveMetric))
702
705 {
708 pszName);
710 }
711
712 if (pszAddress && pszMask)
713 {
715 {
719 goto done;
720 }
721
724 if (pszNewIpAddress ==
NULL)
725 {
727 goto done;
728 }
729
732 wcscat(pszNewIpAddress, pszAddress);
733
736 if (pszNewSubnetMask ==
NULL)
737 {
739 goto done;
740 }
741
743 wcscat(pszNewSubnetMask,
L",");
744 wcscat(pszNewSubnetMask, pszMask);
745 }
746
747 if (pszGateway && pszGwMetric)
748 {
751
753 if (pszNewParameters ==
NULL)
754 {
756 goto done;
757 }
758
762 }
763
768
770
771done:
772 if (pszNewIpAddress)
774
775 if (pszNewSubnetMask)
777
778 if (pszNewParameters)
780
783
784 DPRINT(
"IpAddAddress() done (Error %lu)\n", dwError);
785 return dwError;
786}
static HINSTANCE hDllInstance
#define ERROR_NOT_ENOUGH_MEMORY
void WINAPI CoTaskMemFree(void *ptr)
#define ERROR_INVALID_PARAMETER
#define HeapFree(x, y, z)
static DWORD DWORD * dwLength
static HRESULT SetInterfaceProperties(GUID *InterfaceGuid, PTCPIP_PROPERTIES pProperties)
static HRESULT GetInterfaceProperties(GUID *InterfaceGuid, PTCPIP_PROPERTIES *ppProperties)
static BOOL AppendParameterValue(PWSTR pszParameters, PWSTR pszParameter, PWSTR pszValue)
#define IDS_ERROR_GET_PROPERTIES
#define IDS_ERROR_BAD_VALUE
#define IDS_ERROR_ADD_DHCP_ADDRESS
#define IDS_ERROR_INVALID_INTERFACE
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
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
DWORD WINAPI NhGetGuidFromInterfaceName(_In_ PWCHAR pInterfaceName, _Out_ GUID *pInterfaceGUID, DWORD dwUnknown3, DWORD dwUnknown4)
NTSYSAPI NTSTATUS NTAPI RtlIpv4StringToAddressW(_In_ PCWSTR String, _In_ BOOLEAN Strict, _Out_ PCWSTR *Terminator, _Out_ struct in_addr *Addr)
DWORD WINAPI MatchTagsInCmdLine(_In_ HANDLE hModule, _Inout_ LPWSTR *ppwcArguments, _In_ DWORD dwCurrentIndex, _In_ DWORD dwArgCount, _Inout_ TAG_TYPE *pttTags, _In_ DWORD dwTagCount, _Out_ DWORD *pdwTagType)
DWORD CDECL PrintMessageFromModule(_In_ HANDLE hModule, _In_ DWORD dwMsgId,...)
#define ERROR_SUPPRESS_OUTPUT
#define ERROR_INVALID_SYNTAX
_In_ LPWSTR _In_ DWORD dwArgCount
_In_ LPWSTR _In_ DWORD dwCurrentIndex
struct in_addr::@1123::@1124 S_un_b
union in_addr::@1123 S_un