ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2015
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
18 participants
496 discussions
Start a n
N
ew thread
[janderwald] 66853: [SYSAUDIO][KMIXER] - convert to pnp software device
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Mar 22 11:27:52 2015 New Revision: 66853 URL:
http://svn.reactos.org/svn/reactos?rev=66853&view=rev
Log: [SYSAUDIO][KMIXER] - convert to pnp software device Modified: trunk/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c trunk/reactos/drivers/wdm/audio/sysaudio/main.c trunk/reactos/media/inf/wdmaudio.inf Modified: trunk/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/filters/…
============================================================================== --- trunk/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/filters/kmixer/kmixer.c [iso-8859-1] Sun Mar 22 11:27:52 2015 @@ -40,13 +40,15 @@ NTSTATUS NTAPI -KMix_InstallDevice( - IN PDRIVER_OBJECT DriverObject) +KMix_AddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT PhysicalDeviceObject) { NTSTATUS Status; UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\kmixer"); PDEVICE_OBJECT DeviceObject; PKMIXER_DEVICE_EXT DeviceExtension; + PDEVICE_OBJECT NextDeviceObject; DPRINT1("KMix_InstallDevice called\n"); @@ -80,8 +82,12 @@ /* set io flags */ DeviceObject->Flags |= DO_DIRECT_IO | DO_POWER_PAGABLE; + /* clear initializing flag */ DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; + + NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject, PhysicalDeviceObject); + KsSetDevicePnpAndBaseObject(DeviceExtension->KsDeviceHeader, NextDeviceObject, DeviceObject); DPRINT("KMix_InstallDevice result %x\n", Status); return STATUS_SUCCESS; @@ -110,6 +116,7 @@ DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = KsDefaultForwardIrp; DriverObject->MajorFunction[IRP_MJ_PNP] = KMix_Pnp; DriverObject->DriverUnload = KMix_Unload; + DriverObject->DriverExtension->AddDevice = KMix_AddDevice; - return KMix_InstallDevice(DriverObject); + return STATUS_SUCCESS; } Modified: trunk/reactos/drivers/wdm/audio/sysaudio/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/sysaudio…
============================================================================== --- trunk/reactos/drivers/wdm/audio/sysaudio/main.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/sysaudio/main.c [iso-8859-1] Sun Mar 22 11:27:52 2015 @@ -131,17 +131,17 @@ NTSTATUS NTAPI -SysAudio_InstallDevice( - IN PDRIVER_OBJECT DriverObject) +SysAudio_AddDevice( + IN PDRIVER_OBJECT DriverObject, + IN PDEVICE_OBJECT PhysicalDeviceObject) { NTSTATUS Status; UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\sysaudio"); UNICODE_STRING SymlinkName = RTL_CONSTANT_STRING(L"\\DosDevices\\sysaudio"); - PDEVICE_OBJECT DeviceObject; + PDEVICE_OBJECT DeviceObject, NextDeviceObject; SYSAUDIODEVEXT *DeviceExtension; - - DPRINT("SysAudio_InstallDevice called\n"); + DPRINT("SysAudio_AddDevice called\n"); /* Create the device */ Status = IoCreateDevice(DriverObject, @@ -160,7 +160,7 @@ } /* Register device interfaces */ - Status = SysAudioRegisterDeviceInterfaces(DeviceObject); + Status = SysAudioRegisterDeviceInterfaces(PhysicalDeviceObject); if (!NT_SUCCESS(Status)) { /* Failed to register @@ -215,6 +215,10 @@ /* clear initializing flag */ DeviceObject->Flags &= ~ DO_DEVICE_INITIALIZING; + /* atttach to device stack */ + NextDeviceObject = IoAttachDeviceToDeviceStack(DeviceObject, PhysicalDeviceObject); + KsSetDevicePnpAndBaseObject(DeviceExtension->KsDeviceHeader, NextDeviceObject, DeviceObject); + /* register shutdown notfication */ IoRegisterShutdownNotification(DeviceObject); @@ -259,7 +263,8 @@ /* Sysaudio needs to do work on pnp, so handle it */ DriverObject->MajorFunction[IRP_MJ_PNP] = SysAudio_Pnp; DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = SysAudio_Shutdown; - - /* Call our initialization function */ - return SysAudio_InstallDevice(DriverObject); -} + DriverObject->DriverExtension->AddDevice = SysAudio_AddDevice; + + /* done */ + return STATUS_SUCCESS; +} Modified: trunk/reactos/media/inf/wdmaudio.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/inf/wdmaudio.inf?rev…
============================================================================== --- trunk/reactos/media/inf/wdmaudio.inf [iso-8859-1] (original) +++ trunk/reactos/media/inf/wdmaudio.inf [iso-8859-1] Sun Mar 22 11:27:52 2015 @@ -25,8 +25,8 @@ ExcludeFromSelect = WDMAUDIO_CopyFilesOnlyId [GenericMfg] -;%WDM_KMIXER.DeviceDesc% = WDM_KMIXER, SW\{B7EAFDC0-A680-11D0-96D8-00AA0051E51D} -;%WDM_SYSAUDIO.DeviceDesc% = WDM_SYSAUDIO, SW\{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407} +%WDM_KMIXER.DeviceDesc% = WDM_KMIXER, SW\{B7EAFDC0-A680-11D0-96D8-00AA0051E51D} +%WDM_SYSAUDIO.DeviceDesc% = WDM_SYSAUDIO, SW\{A7C7A5B0-5AF3-11D1-9CED-00A024BF0407} %WDM_WDMAUD.DeviceDesc% = WDM_WDMAUD, SW\{CD171DE3-69E5-11D2-B56D-0000F8754380} ;%WDM_DRMKAUD.DeviceDesc% = WDM_DRMKAUD, SW\{EEC12DB6-AD9C-4168-8658-B03DAEF417FE} @@ -51,11 +51,11 @@ [DeviceRegistration] ; Kmixer swenum install -;HKLM,%RunOnce%,"WDM_KMIXER0",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_MIXER%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" -;HKLM,%RunOnce%,"WDM_KMIXER1",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_AUDIO%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" +HKLM,%RunOnce%,"WDM_KMIXER0",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_MIXER%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" +HKLM,%RunOnce%,"WDM_KMIXER1",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_KMIXER.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_AUDIO%,%17%\WDMAUDIO.inf,WDM_KMIXER.Interface.Install" ; Sysaudio swenum install -;HKLM,%RunOnce%,"WDM_SYSAUDIO",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_SYSAUDIO.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_SYSAUDIO%,%17%\WDMAUDIO.inf,WDM_SYSAUDIO.Interface.Install" +HKLM,%RunOnce%,"WDM_SYSAUDIO",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_SYSAUDIO.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_SYSAUDIO%,%17%\WDMAUDIO.inf,WDM_SYSAUDIO.Interface.Install" ; WDMAud install HKLM,%RunOnce%,"WDM_WDMAUD",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_WDMAUD.DeviceId%,%KSNAME_Filter%,%KSCATEGORY_WDMAUD%,%17%\WDMAUDIO.inf,WDM_WDMAUD.Interface.Install"
9 years, 9 months
1
0
0
0
[janderwald] 66852: [KS] - fix a few bugs
by janderwald@svn.reactos.org
Author: janderwald Date: Sun Mar 22 10:27:44 2015 New Revision: 66852 URL:
http://svn.reactos.org/svn/reactos?rev=66852&view=rev
Log: [KS] - fix a few bugs Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/swenum…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] Sun Mar 22 10:27:44 2015 @@ -73,7 +73,11 @@ DeviceExtension->DeviceEntry = DeviceEntry; DeviceExtension->BusDeviceExtension = BusDeviceExtension; - /* TODO: update last creation time in bus device extension */ + /* not started yet*/ + DeviceEntry->DeviceState = NotStarted; + + /* get current time */ + KeQuerySystemTime(&DeviceEntry->TimeCreated); /* setup flags */ DeviceObject->Flags |= DO_POWER_PAGABLE; @@ -1209,10 +1213,10 @@ if (Diff.QuadPart > Int32x32To64(15000, 10000)) { - //DPRINT1("DeviceID %S Instance %S TimeCreated %I64u Now %I64u Diff %I64u hung\n", DeviceEntry->DeviceName, DeviceEntry->Instance, DeviceEntry->TimeCreated.QuadPart, Time.QuadPart, Diff.QuadPart); - /* release spin lock */ KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel); + + DPRINT1("DeviceID %S Instance %S TimeCreated %I64u Now %I64u Diff %I64u hung\n", DeviceEntry->DeviceName, DeviceEntry->Instance, DeviceEntry->TimeCreated.QuadPart, Time.QuadPart, Diff.QuadPart); /* deactivate interfaces */ //KspEnableBusDeviceInterface(DeviceEntry, FALSE); @@ -1966,10 +1970,8 @@ InsertTailList(&DeviceEntry->IrpPendingList, &Irp->Tail.Overlay.ListEntry); Time.QuadPart = Int32x32To64(1500, -10000); - DbgPrint("PENDING Irp %p %wZ\n", Irp, &IoStack->FileObject->FileName); - - /* query current time */ - KeQuerySystemTime(&DeviceEntry->TimeCreated); + DbgPrint("PENDING Irp %p %wZ DeviceState %d\n", Irp, &IoStack->FileObject->FileName, DeviceEntry->DeviceState); + /* set timer */ KeSetTimer(&BusDeviceExtension->Timer, Time, &BusDeviceExtension->Dpc); @@ -1996,9 +1998,6 @@ /* insert into irp pending list */ InsertTailList(&DeviceEntry->IrpPendingList, &Irp->Tail.Overlay.ListEntry); - - /* get current time */ - KeQuerySystemTime(&DeviceEntry->TimeCreated); /* invalidate device relations */ IoInvalidateDeviceRelations(BusDeviceExtension->PhysicalDeviceObject, BusRelations); @@ -2123,6 +2122,11 @@ { /* start bus */ Status = KspStartBusDevice(DeviceObject, ChildDeviceExtension, Irp); + if (NT_SUCCESS(Status)) + { + /* complete pending irps*/ + KspCompletePendingIrps(ChildDeviceExtension->DeviceEntry, STATUS_REPARSE); + } /* set time out */ Time.QuadPart = Int32x32To64(1500, -10000);
9 years, 9 months
1
0
0
0
[cwittich] 66851: [WIN32K] Gracefully handle failure in DrvEnableSurface. patch by Timo Kreuzer
by cwittich@svn.reactos.org
Author: cwittich Date: Sat Mar 21 16:29:40 2015 New Revision: 66851 URL:
http://svn.reactos.org/svn/reactos?rev=66851&view=rev
Log: [WIN32K] Gracefully handle failure in DrvEnableSurface. patch by Timo Kreuzer Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c Modified: trunk/reactos/win32ss/gdi/eng/pdevobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/pdevobj.c?…
============================================================================== --- trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/gdi/eng/pdevobj.c [iso-8859-1] Sat Mar 21 16:29:40 2015 @@ -217,9 +217,15 @@ { /* Call the drivers DrvEnableSurface */ hsurf = ppdev->pldev->pfn.EnableSurface(ppdev->dhpdev); + if (hsurf== NULL) + { + DPRINT1("Failed to create PDEV surface!"); + return NULL; + } /* Get a reference to the surface */ ppdev->pSurface = SURFACE_ShareLockSurface(hsurf); + NT_ASSERT(ppdev->pSurface != NULL); } /* Increment reference count */ @@ -469,7 +475,7 @@ pSurface = PDEVOBJ_pSurface(ppdevTmp); if (!pSurface) { - DPRINT1("DrvEnableSurface failed\n"); + DPRINT1("PDEVOBJ_pSurface failed\n"); goto leave; }
9 years, 9 months
1
0
0
0
[spetreolle] 66850: [LDR] Addendum to r66735: Copy it, but copy it good.
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Mar 21 15:26:50 2015 New Revision: 66850 URL:
http://svn.reactos.org/svn/reactos?rev=66850&view=rev
Log: [LDR] Addendum to r66735: Copy it, but copy it good. Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c Modified: trunk/reactos/dll/ntdll/ldr/ldrinit.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/ldrinit.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] (original) +++ trunk/reactos/dll/ntdll/ldr/ldrinit.c [iso-8859-1] Sat Mar 21 15:26:50 2015 @@ -2077,7 +2077,7 @@ if (((Peb->OSCSDVersion >> 8) & 0xFF) != 0) { WCHAR szCSDVersion[128]; - ULONG i; + LONG i; ULONG Length = ARRAYSIZE(szCSDVersion) - 1; i = _snwprintf(szCSDVersion, Length, L"Service Pack %d",
9 years, 9 months
1
0
0
0
[akhaldi] 66849: [NTDLL_WINETEST] Bring-in Mark Jansen's ipv4/6 test additions.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Mar 21 13:07:55 2015 New Revision: 66849 URL:
http://svn.reactos.org/svn/reactos?rev=66849&view=rev
Log: [NTDLL_WINETEST] Bring-in Mark Jansen's ipv4/6 test additions. Modified: trunk/rostests/winetests/ntdll/rtl.c Modified: trunk/rostests/winetests/ntdll/rtl.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/ntdll/rtl.c?rev…
============================================================================== --- trunk/rostests/winetests/ntdll/rtl.c [iso-8859-1] (original) +++ trunk/rostests/winetests/ntdll/rtl.c [iso-8859-1] Sat Mar 21 13:07:55 2015 @@ -25,6 +25,7 @@ #include "ntdll_test.h" #include "inaddr.h" +#include "in6addr.h" #ifndef __WINE_WINTERNL_H @@ -92,9 +93,14 @@ static NTSTATUS (WINAPI *pRtlIpv4AddressToStringExA)(const IN_ADDR *, USHORT, LPSTR, PULONG); static NTSTATUS (WINAPI *pRtlIpv4StringToAddressA)(PCSTR, BOOLEAN, PCSTR *, IN_ADDR *); static NTSTATUS (WINAPI *pRtlIpv4StringToAddressExA)(PCSTR, BOOLEAN, IN_ADDR *, PUSHORT); +static NTSTATUS (WINAPI *pRtlIpv6StringToAddressA)(PCSTR, PCSTR *, struct in6_addr *); +static NTSTATUS (WINAPI *pRtlIpv6StringToAddressW)(PCWSTR, PCWSTR *, struct in6_addr *); +static NTSTATUS (WINAPI *pRtlIpv6StringToAddressExA)(PCSTR, struct in6_addr *, PULONG, PUSHORT); +static NTSTATUS (WINAPI *pRtlIpv6StringToAddressExW)(PCWSTR, struct in6_addr *, PULONG, PUSHORT); static NTSTATUS (WINAPI *pLdrAddRefDll)(ULONG, HMODULE); static NTSTATUS (WINAPI *pLdrLockLoaderLock)(ULONG, ULONG*, ULONG_PTR*); static NTSTATUS (WINAPI *pLdrUnlockLoaderLock)(ULONG, ULONG_PTR); +static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)(LPWSTR, DWORD, LPDWORD, LPCSTR, DWORD); static NTSTATUS (WINAPI *pRtlGetCompressionWorkSpaceSize)(USHORT, PULONG, PULONG); static NTSTATUS (WINAPI *pRtlDecompressBuffer)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, PULONG); static NTSTATUS (WINAPI *pRtlDecompressFragment)(USHORT, PUCHAR, ULONG, const UCHAR*, ULONG, ULONG, PULONG, PVOID); @@ -146,9 +152,14 @@ pRtlIpv4AddressToStringExA = (void *)GetProcAddress(hntdll, "RtlIpv4AddressToStringExA"); pRtlIpv4StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressA"); pRtlIpv4StringToAddressExA = (void *)GetProcAddress(hntdll, "RtlIpv4StringToAddressExA"); + pRtlIpv6StringToAddressA = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressA"); + pRtlIpv6StringToAddressW = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressW"); + pRtlIpv6StringToAddressExA = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressExA"); + pRtlIpv6StringToAddressExW = (void *)GetProcAddress(hntdll, "RtlIpv6StringToAddressExW"); pLdrAddRefDll = (void *)GetProcAddress(hntdll, "LdrAddRefDll"); pLdrLockLoaderLock = (void *)GetProcAddress(hntdll, "LdrLockLoaderLock"); pLdrUnlockLoaderLock = (void *)GetProcAddress(hntdll, "LdrUnlockLoaderLock"); + pRtlMultiByteToUnicodeN = (void *)GetProcAddress(hntdll, "RtlMultiByteToUnicodeN"); pRtlGetCompressionWorkSpaceSize = (void *)GetProcAddress(hntdll, "RtlGetCompressionWorkSpaceSize"); pRtlDecompressBuffer = (void *)GetProcAddress(hntdll, "RtlDecompressBuffer"); pRtlDecompressFragment = (void *)GetProcAddress(hntdll, "RtlDecompressFragment"); @@ -1374,98 +1385,109 @@ res, size, buffer); } +static struct +{ + PCSTR address; + NTSTATUS res; + int terminator_offset; + int ip[4]; + enum { normal_4, strict_diff_4 = 1, ex_fail_4 = 2 } flags; + NTSTATUS res_strict; + int terminator_offset_strict; + int ip_strict[4]; +} ipv4_tests[] = +{ + { "", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { " ", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "1.1.1.1", STATUS_SUCCESS, 7, { 1, 1, 1, 1 } }, + { "0.0.0.0", STATUS_SUCCESS, 7, { 0, 0, 0, 0 } }, + { "255.255.255.255", STATUS_SUCCESS, 15, { 255, 255, 255, 255 } }, + { "255.255.255.255:123", STATUS_SUCCESS, 15, { 255, 255, 255, 255 } }, + { "255.255.255.256", STATUS_INVALID_PARAMETER, 15, { -1 } }, + { "255.255.255.4294967295", STATUS_INVALID_PARAMETER, 22, { -1 } }, + { "255.255.255.4294967296", STATUS_INVALID_PARAMETER, 21, { -1 } }, + { "255.255.255.4294967297", STATUS_INVALID_PARAMETER, 21, { -1 } }, + { "a", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "1.1.1.0xaA", STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0XaA", STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0x", STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0xff", STATUS_SUCCESS, 10, { 1, 1, 1, 255 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0x100", STATUS_INVALID_PARAMETER, 11, { -1 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0xffffffff", STATUS_INVALID_PARAMETER, 16, { -1 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.0x100000000", STATUS_INVALID_PARAMETER, 16, { -1, 0, 0, 0 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "1.1.1.010", STATUS_SUCCESS, 9, { 1, 1, 1, 8 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "1.1.1.00", STATUS_SUCCESS, 8, { 1, 1, 1, 0 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "1.1.1.007", STATUS_SUCCESS, 9, { 1, 1, 1, 7 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "1.1.1.08", STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "1.1.1.008", STATUS_SUCCESS, 8, { 1, 1, 1, 0 }, strict_diff_4 | ex_fail_4, + STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "1.1.1.0a", STATUS_SUCCESS, 7, { 1, 1, 1, 0 }, ex_fail_4 }, + { "1.1.1.0o10", STATUS_SUCCESS, 7, { 1, 1, 1, 0 }, ex_fail_4 }, + { "1.1.1.0b10", STATUS_SUCCESS, 7, { 1, 1, 1, 0 }, ex_fail_4 }, + { "1.1.1.-2", STATUS_INVALID_PARAMETER, 6, { -1 } }, + { "1", STATUS_SUCCESS, 1, { 0, 0, 0, 1 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 1, { -1 } }, + { "-1", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "203569230", STATUS_SUCCESS, 9, { 12, 34, 56, 78 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 9, { -1 } }, + { "1.223756", STATUS_SUCCESS, 8, { 1, 3, 106, 12 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 8, { -1 } }, + { "3.4.756", STATUS_SUCCESS, 7, { 3, 4, 2, 244 }, strict_diff_4, + STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "3.4.756.1", STATUS_INVALID_PARAMETER, 9, { -1 } }, + { "3.4.65536", STATUS_INVALID_PARAMETER, 9, { -1 } }, + { "3.4.5.6.7", STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "3.4.5.+6", STATUS_INVALID_PARAMETER, 6, { -1 } }, + { " 3.4.5.6", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "\t3.4.5.6", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "3.4.5.6 ", STATUS_SUCCESS, 7, { 3, 4, 5, 6 }, ex_fail_4 }, + { "3. 4.5.6", STATUS_INVALID_PARAMETER, 2, { -1 } }, + { ".", STATUS_INVALID_PARAMETER, 1, { -1 } }, + { "..", STATUS_INVALID_PARAMETER, 1, { -1 } }, + { "1.", STATUS_INVALID_PARAMETER, 2, { -1 } }, + { "1..", STATUS_INVALID_PARAMETER, 3, { -1 } }, + { ".1", STATUS_INVALID_PARAMETER, 1, { -1 } }, + { ".1.", STATUS_INVALID_PARAMETER, 1, { -1 } }, + { ".1.2.3", STATUS_INVALID_PARAMETER, 1, { -1 } }, + { "0.1.2.3", STATUS_SUCCESS, 7, { 0, 1, 2, 3 } }, + { "0.1.2.3.", STATUS_INVALID_PARAMETER, 7, { -1 } }, + { "[0.1.2.3]", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { "::1", STATUS_INVALID_PARAMETER, 0, { -1 } }, + { ":1", STATUS_INVALID_PARAMETER, 0, { -1 } }, +}; +const unsigned int ipv4_testcount = sizeof(ipv4_tests) / sizeof(ipv4_tests[0]); + +static void init_ip4(IN_ADDR* addr, const int src[4]) +{ + if (!src || src[0] == -1) + { + addr->S_un.S_addr = 0xabababab; + } + else + { + addr->S_un.S_un_b.s_b1 = src[0]; + addr->S_un.S_un_b.s_b2 = src[1]; + addr->S_un.S_un_b.s_b3 = src[2]; + addr->S_un.S_un_b.s_b4 = src[3]; + } +} + static void test_RtlIpv4StringToAddress(void) { NTSTATUS res; IN_ADDR ip, expected_ip; PCSTR terminator; CHAR dummy; - struct - { - PCSTR address; - NTSTATUS res; - int terminator_offset; - int ip[4]; - BOOL strict_is_different; - NTSTATUS res_strict; - int terminator_offset_strict; - int ip_strict[4]; - } tests[] = - { - { "", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { " ", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "1.1.1.1", STATUS_SUCCESS, 7, { 1, 1, 1, 1 } }, - { "0.0.0.0", STATUS_SUCCESS, 7, { 0, 0, 0, 0 } }, - { "255.255.255.255", STATUS_SUCCESS, 15, { 255, 255, 255, 255 } }, - { "255.255.255.255:123", - STATUS_SUCCESS, 15, { 255, 255, 255, 255 } }, - { "255.255.255.256", STATUS_INVALID_PARAMETER, 15, { -1 } }, - { "255.255.255.4294967295", - STATUS_INVALID_PARAMETER, 22, { -1 } }, - { "255.255.255.4294967296", - STATUS_INVALID_PARAMETER, 21, { -1 } }, - { "255.255.255.4294967297", - STATUS_INVALID_PARAMETER, 21, { -1 } }, - { "a", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "1.1.1.0xaA", STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0XaA", STATUS_SUCCESS, 10, { 1, 1, 1, 170 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0x", STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0xff", STATUS_SUCCESS, 10, { 1, 1, 1, 255 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0x100", STATUS_INVALID_PARAMETER, 11, { -1 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0xffffffff",STATUS_INVALID_PARAMETER, 16, { -1 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.0x100000000", - STATUS_INVALID_PARAMETER, 16, { -1, 0, 0, 0 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "1.1.1.010", STATUS_SUCCESS, 9, { 1, 1, 1, 8 }, - TRUE, STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "1.1.1.00", STATUS_SUCCESS, 8, { 1, 1, 1, 0 }, - TRUE, STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "1.1.1.007", STATUS_SUCCESS, 9, { 1, 1, 1, 7 }, - TRUE, STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "1.1.1.08", STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "1.1.1.008", STATUS_SUCCESS, 8, { 1, 1, 1, 0 }, - TRUE, STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "1.1.1.0a", STATUS_SUCCESS, 7, { 1, 1, 1, 0 } }, - { "1.1.1.0o10", STATUS_SUCCESS, 7, { 1, 1, 1, 0 } }, - { "1.1.1.0b10", STATUS_SUCCESS, 7, { 1, 1, 1, 0 } }, - { "1.1.1.-2", STATUS_INVALID_PARAMETER, 6, { -1 } }, - { "1", STATUS_SUCCESS, 1, { 0, 0, 0, 1 }, - TRUE, STATUS_INVALID_PARAMETER, 1, { -1 } }, - { "-1", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "203569230", STATUS_SUCCESS, 9, { 12, 34, 56, 78 }, - TRUE, STATUS_INVALID_PARAMETER, 9, { -1 } }, - { "1.223756", STATUS_SUCCESS, 8, { 1, 3, 106, 12 }, - TRUE, STATUS_INVALID_PARAMETER, 8, { -1 } }, - { "3.4.756", STATUS_SUCCESS, 7, { 3, 4, 2, 244 }, - TRUE, STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "3.4.756.1", STATUS_INVALID_PARAMETER, 9, { -1 } }, - { "3.4.65536", STATUS_INVALID_PARAMETER, 9, { -1 } }, - { "3.4.5.6.7", STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "3.4.5.+6", STATUS_INVALID_PARAMETER, 6, { -1 } }, - { " 3.4.5.6", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "\t3.4.5.6", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "3.4.5.6 ", STATUS_SUCCESS, 7, { 3, 4, 5, 6 } }, - { "3. 4.5.6", STATUS_INVALID_PARAMETER, 2, { -1 } }, - { ".", STATUS_INVALID_PARAMETER, 1, { -1 } }, - { "..", STATUS_INVALID_PARAMETER, 1, { -1 } }, - { "1.", STATUS_INVALID_PARAMETER, 2, { -1 } }, - { "1..", STATUS_INVALID_PARAMETER, 3, { -1 } }, - { ".1", STATUS_INVALID_PARAMETER, 1, { -1 } }, - { ".1.", STATUS_INVALID_PARAMETER, 1, { -1 } }, - { ".1.2.3", STATUS_INVALID_PARAMETER, 1, { -1 } }, - { "0.1.2.3", STATUS_SUCCESS, 7, { 0, 1, 2, 3 } }, - { "0.1.2.3.", STATUS_INVALID_PARAMETER, 7, { -1 } }, - { "[0.1.2.3]", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { "::1", STATUS_INVALID_PARAMETER, 0, { -1 } }, - { ":1", STATUS_INVALID_PARAMETER, 0, { -1 } }, - }; - const int testcount = sizeof(tests) / sizeof(tests[0]); - int i; + unsigned int i; if (!pRtlIpv4StringToAddressA) { @@ -1487,62 +1509,48 @@ */ } - for (i = 0; i < testcount; i++) + for (i = 0; i < ipv4_testcount; i++) { /* non-strict */ terminator = &dummy; ip.S_un.S_addr = 0xabababab; - res = pRtlIpv4StringToAddressA(tests[i].address, FALSE, &terminator, &ip); - ok(res == tests[i].res, + res = pRtlIpv4StringToAddressA(ipv4_tests[i].address, FALSE, &terminator, &ip); + ok(res == ipv4_tests[i].res, "[%s] res = 0x%08x, expected 0x%08x\n", - tests[i].address, res, tests[i].res); - ok(terminator == tests[i].address + tests[i].terminator_offset, + ipv4_tests[i].address, res, ipv4_tests[i].res); + ok(terminator == ipv4_tests[i].address + ipv4_tests[i].terminator_offset, "[%s] terminator = %p, expected %p\n", - tests[i].address, terminator, tests[i].address + tests[i].terminator_offset); - if (tests[i].ip[0] == -1) - expected_ip.S_un.S_addr = 0xabababab; - else - { - expected_ip.S_un.S_un_b.s_b1 = tests[i].ip[0]; - expected_ip.S_un.S_un_b.s_b2 = tests[i].ip[1]; - expected_ip.S_un.S_un_b.s_b3 = tests[i].ip[2]; - expected_ip.S_un.S_un_b.s_b4 = tests[i].ip[3]; - } + ipv4_tests[i].address, terminator, ipv4_tests[i].address + ipv4_tests[i].terminator_offset); + + init_ip4(&expected_ip, ipv4_tests[i].ip); ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n", - tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); - - if (!tests[i].strict_is_different) - { - tests[i].res_strict = tests[i].res; - tests[i].terminator_offset_strict = tests[i].terminator_offset; - tests[i].ip_strict[0] = tests[i].ip[0]; - tests[i].ip_strict[1] = tests[i].ip[1]; - tests[i].ip_strict[2] = tests[i].ip[2]; - tests[i].ip_strict[3] = tests[i].ip[3]; + ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); + + if (!(ipv4_tests[i].flags & strict_diff_4)) + { + ipv4_tests[i].res_strict = ipv4_tests[i].res; + ipv4_tests[i].terminator_offset_strict = ipv4_tests[i].terminator_offset; + ipv4_tests[i].ip_strict[0] = ipv4_tests[i].ip[0]; + ipv4_tests[i].ip_strict[1] = ipv4_tests[i].ip[1]; + ipv4_tests[i].ip_strict[2] = ipv4_tests[i].ip[2]; + ipv4_tests[i].ip_strict[3] = ipv4_tests[i].ip[3]; } /* strict */ terminator = &dummy; ip.S_un.S_addr = 0xabababab; - res = pRtlIpv4StringToAddressA(tests[i].address, TRUE, &terminator, &ip); - ok(res == tests[i].res_strict, + res = pRtlIpv4StringToAddressA(ipv4_tests[i].address, TRUE, &terminator, &ip); + ok(res == ipv4_tests[i].res_strict, "[%s] res = 0x%08x, expected 0x%08x\n", - tests[i].address, res, tests[i].res_strict); - ok(terminator == tests[i].address + tests[i].terminator_offset_strict, + ipv4_tests[i].address, res, ipv4_tests[i].res_strict); + ok(terminator == ipv4_tests[i].address + ipv4_tests[i].terminator_offset_strict, "[%s] terminator = %p, expected %p\n", - tests[i].address, terminator, tests[i].address + tests[i].terminator_offset_strict); - if (tests[i].ip_strict[0] == -1) - expected_ip.S_un.S_addr = 0xabababab; - else - { - expected_ip.S_un.S_un_b.s_b1 = tests[i].ip_strict[0]; - expected_ip.S_un.S_un_b.s_b2 = tests[i].ip_strict[1]; - expected_ip.S_un.S_un_b.s_b3 = tests[i].ip_strict[2]; - expected_ip.S_un.S_un_b.s_b4 = tests[i].ip_strict[3]; - } + ipv4_tests[i].address, terminator, ipv4_tests[i].address + ipv4_tests[i].terminator_offset_strict); + + init_ip4(&expected_ip, ipv4_tests[i].ip_strict); ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n", - tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); + ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); } } @@ -1551,19 +1559,21 @@ NTSTATUS res; IN_ADDR ip, expected_ip; USHORT port; - struct + static const struct { PCSTR address; NTSTATUS res; int ip[4]; USHORT port; - } tests[] = + } ipv4_ex_tests[] = { { "", STATUS_INVALID_PARAMETER, { -1 }, 0xdead }, { " ", STATUS_INVALID_PARAMETER, { -1 }, 0xdead }, { "1.1.1.1:", STATUS_INVALID_PARAMETER, { 1, 1, 1, 1 }, 0xdead }, { "1.1.1.1+", STATUS_INVALID_PARAMETER, { 1, 1, 1, 1 }, 0xdead }, { "1.1.1.1:1", STATUS_SUCCESS, { 1, 1, 1, 1 }, 0x100 }, + { "256.1.1.1:1", STATUS_INVALID_PARAMETER, { -1 }, 0xdead }, + { "-1.1.1.1:1", STATUS_INVALID_PARAMETER, { -1 }, 0xdead }, { "0.0.0.0:0", STATUS_INVALID_PARAMETER, { 0, 0, 0, 0 }, 0xdead }, { "0.0.0.0:1", STATUS_SUCCESS, { 0, 0, 0, 0 }, 0x100 }, { "1.2.3.4:65535", STATUS_SUCCESS, { 1, 2, 3, 4 }, 65535 }, @@ -1576,8 +1586,9 @@ { "1.2.3.4: 1234", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead }, { "1.2.3.4:\t1234", STATUS_INVALID_PARAMETER, { 1, 2, 3, 4 }, 0xdead }, }; - const int testcount = sizeof(tests) / sizeof(tests[0]); - int i, Strict; + const unsigned int ipv4_ex_testcount = sizeof(ipv4_ex_tests) / sizeof(ipv4_ex_tests[0]); + unsigned int i; + BOOLEAN strict; if (!pRtlIpv4StringToAddressExA) { @@ -1589,48 +1600,764 @@ ip.S_un.S_addr = 0xabababab; port = 0xdead; res = pRtlIpv4StringToAddressExA(NULL, FALSE, &ip, &port); - ok(res == STATUS_INVALID_PARAMETER, "[null address] res = 0x%08x, expected 0x%08x\n", res, STATUS_INVALID_PARAMETER); + ok(res == STATUS_INVALID_PARAMETER, "[null address] res = 0x%08x, expected 0x%08x\n", + res, STATUS_INVALID_PARAMETER); ok(ip.S_un.S_addr == 0xabababab, "RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n", ip.S_un.S_addr); ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port); port = 0xdead; res = pRtlIpv4StringToAddressExA("1.1.1.1", FALSE, NULL, &port); - ok(res == STATUS_INVALID_PARAMETER, "[null ip] res = 0x%08x, expected 0x%08x\n", res, STATUS_INVALID_PARAMETER); + ok(res == STATUS_INVALID_PARAMETER, "[null ip] res = 0x%08x, expected 0x%08x\n", + res, STATUS_INVALID_PARAMETER); ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port); ip.S_un.S_addr = 0xabababab; port = 0xdead; res = pRtlIpv4StringToAddressExA("1.1.1.1", FALSE, &ip, NULL); - ok(res == STATUS_INVALID_PARAMETER, "[null port] res = 0x%08x, expected 0x%08x\n", res, STATUS_INVALID_PARAMETER); + ok(res == STATUS_INVALID_PARAMETER, "[null port] res = 0x%08x, expected 0x%08x\n", + res, STATUS_INVALID_PARAMETER); ok(ip.S_un.S_addr == 0xabababab, "RtlIpv4StringToAddressExA should not touch the ip!, ip == %x\n", ip.S_un.S_addr); ok(port == 0xdead, "RtlIpv4StringToAddressExA should not touch the port!, port == %x\n", port); - for (i = 0; i < testcount; i++) + /* first we run the non-ex testcases on the ex function */ + for (i = 0; i < ipv4_testcount; i++) + { + NTSTATUS expect_res = (ipv4_tests[i].flags & ex_fail_4) ? STATUS_INVALID_PARAMETER : ipv4_tests[i].res; + + /* non-strict */ + port = 0xdead; + ip.S_un.S_addr = 0xabababab; + res = pRtlIpv4StringToAddressExA(ipv4_tests[i].address, FALSE, &ip, &port); + ok(res == expect_res, "[%s] res = 0x%08x, expected 0x%08x\n", + ipv4_tests[i].address, res, expect_res); + + init_ip4(&expected_ip, ipv4_tests[i].ip); + ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n", + ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); + + if (!(ipv4_tests[i].flags & strict_diff_4)) + { + ipv4_tests[i].res_strict = ipv4_tests[i].res; + ipv4_tests[i].terminator_offset_strict = ipv4_tests[i].terminator_offset; + ipv4_tests[i].ip_strict[0] = ipv4_tests[i].ip[0]; + ipv4_tests[i].ip_strict[1] = ipv4_tests[i].ip[1]; + ipv4_tests[i].ip_strict[2] = ipv4_tests[i].ip[2]; + ipv4_tests[i].ip_strict[3] = ipv4_tests[i].ip[3]; + } + /* strict */ + expect_res = (ipv4_tests[i].flags & ex_fail_4) ? STATUS_INVALID_PARAMETER : ipv4_tests[i].res_strict; + port = 0xdead; + ip.S_un.S_addr = 0xabababab; + res = pRtlIpv4StringToAddressExA(ipv4_tests[i].address, TRUE, &ip, &port); + ok(res == expect_res, "[%s] res = 0x%08x, expected 0x%08x\n", + ipv4_tests[i].address, res, expect_res); + + init_ip4(&expected_ip, ipv4_tests[i].ip_strict); + ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n", + ipv4_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); + } + + + for (i = 0; i < ipv4_ex_testcount; i++) { /* Strict is only relevant for the ip address, so make sure that it does not influence the port */ - for (Strict = 0; Strict < 2; Strict++) + for (strict = 0; strict < 2; strict++) { ip.S_un.S_addr = 0xabababab; port = 0xdead; - res = pRtlIpv4StringToAddressExA(tests[i].address, Strict, &ip, &port); - if (tests[i].ip[0] == -1) - { - expected_ip.S_un.S_addr = 0xabababab; - } - else - { - expected_ip.S_un.S_un_b.s_b1 = tests[i].ip[0]; - expected_ip.S_un.S_un_b.s_b2 = tests[i].ip[1]; - expected_ip.S_un.S_un_b.s_b3 = tests[i].ip[2]; - expected_ip.S_un.S_un_b.s_b4 = tests[i].ip[3]; - } - ok(res == tests[i].res, "[%s] res = 0x%08x, expected 0x%08x\n", - tests[i].address, res, tests[i].res); + res = pRtlIpv4StringToAddressExA(ipv4_ex_tests[i].address, strict, &ip, &port); + ok(res == ipv4_ex_tests[i].res, "[%s] res = 0x%08x, expected 0x%08x\n", + ipv4_ex_tests[i].address, res, ipv4_ex_tests[i].res); + + init_ip4(&expected_ip, ipv4_ex_tests[i].ip); ok(ip.S_un.S_addr == expected_ip.S_un.S_addr, "[%s] ip = %08x, expected %08x\n", - tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); - ok(port == tests[i].port, "[%s] port = %u, expected %u\n", - tests[i].address, port, tests[i].port); + ipv4_ex_tests[i].address, ip.S_un.S_addr, expected_ip.S_un.S_addr); + ok(port == ipv4_ex_tests[i].port, "[%s] port = %u, expected %u\n", + ipv4_ex_tests[i].address, port, ipv4_ex_tests[i].port); } + } +} + +/* ipv6 addresses based on the set from
https://github.com/beaugunderson/javascript-ipv6/tree/master/test/data
*/ +static const struct +{ + PCSTR address; + NTSTATUS res; + int terminator_offset; + int ip[8]; + /* win_broken: older versions of windows do not handle this correct + ex_fail: Ex function does need the string to be terminated, non-Ex does not. + ex_skip: test doesnt make sense for Ex (f.e. it's invalid for non-Ex but valid for Ex) */ + enum { normal_6, win_broken_6 = 1, ex_fail_6 = 2, ex_skip_6 = 4 } flags; +} ipv6_tests[] = +{ + { "0000:0000:0000:0000:0000:0000:0000:0000", STATUS_SUCCESS, 39, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "0000:0000:0000:0000:0000:0000:0000:0001", STATUS_SUCCESS, 39, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "0:0:0:0:0:0:0:0", STATUS_SUCCESS, 15, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "0:0:0:0:0:0:0:1", STATUS_SUCCESS, 15, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "0:0:0:0:0:0:0::", STATUS_SUCCESS, 13, + { 0, 0, 0, 0, 0, 0, 0, 0 }, win_broken_6 }, + { "0:0:0:0:0:0:13.1.68.3", STATUS_SUCCESS, 21, + { 0, 0, 0, 0, 0, 0, 0x10d, 0x344 } }, + { "0:0:0:0:0:0::", STATUS_SUCCESS, 13, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "0:0:0:0:0::", STATUS_SUCCESS, 11, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "0:0:0:0:0:FFFF:129.144.52.38", STATUS_SUCCESS, 28, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "0::", STATUS_SUCCESS, 3, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "0:1:2:3:4:5:6:7", STATUS_SUCCESS, 15, + { 0, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700 } }, + { "1080:0:0:0:8:800:200c:417a", STATUS_SUCCESS, 26, + { 0x8010, 0, 0, 0, 0x800, 0x8, 0x0c20, 0x7a41 } }, + { "0:a:b:c:d:e:f::", STATUS_SUCCESS, 13, + { 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00, 0xf00, 0 }, win_broken_6 }, + { "1111:2222:3333:4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 45, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } }, + { "1111:2222:3333:4444:5555:6666:7777:8888", STATUS_SUCCESS, 39, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } }, + { "1111:2222:3333:4444:0x5555:6666:7777:8888", STATUS_INVALID_PARAMETER, 21, + { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:x555:6666:7777:8888", STATUS_INVALID_PARAMETER, 20, + { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:0r5555:6666:7777:8888", STATUS_INVALID_PARAMETER, 21, + { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:r5555:6666:7777:8888", STATUS_INVALID_PARAMETER, 20, + { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:5555:6666:7777::", STATUS_SUCCESS, 34, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0 }, win_broken_6 }, + { "1111:2222:3333:4444:5555:6666::", STATUS_SUCCESS, 31, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0 } }, + { "1111:2222:3333:4444:5555:6666::8888", STATUS_SUCCESS, 35, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0, 0x8888 } }, + { "1111:2222:3333:4444:5555::", STATUS_SUCCESS, 26, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 } }, + { "1111:2222:3333:4444:5555::123.123.123.123", STATUS_SUCCESS, 41, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7b7b, 0x7b7b } }, + { "1111:2222:3333:4444:5555::0x1.123.123.123", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x100 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::0x88", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::0X88", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::0X", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::0X88:7777", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8800 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::0x8888", STATUS_SUCCESS, 27, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555::08888", STATUS_INVALID_PARAMETER, 31, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:5555::fffff", STATUS_INVALID_PARAMETER, 31, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444::fffff", STATUS_INVALID_PARAMETER, 26, + { 0x1111, 0x2222, 0x3333, 0x4444, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333::fffff", STATUS_INVALID_PARAMETER, 21, + { 0x1111, 0x2222, 0x3333, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:5555::7777:8888", STATUS_SUCCESS, 35, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0x7777, 0x8888 } }, + { "1111:2222:3333:4444:5555::8888", STATUS_SUCCESS, 30, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0, 0, 0x8888 } }, + { "1111::", STATUS_SUCCESS, 6, + { 0x1111, 0, 0, 0, 0, 0, 0, 0 } }, + { "1111::123.123.123.123", STATUS_SUCCESS, 21, + { 0x1111, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } }, + { "1111::3333:4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 41, + { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } }, + { "1111::3333:4444:5555:6666:7777:8888", STATUS_SUCCESS, 35, + { 0x1111, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } }, + { "1111::4444:5555:6666:123.123.123.123", STATUS_SUCCESS, 36, + { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7b7b, 0x7b7b } }, + { "1111::4444:5555:6666:7777:8888", STATUS_SUCCESS, 30, + { 0x1111, 0, 0, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 } }, + { "1111::5555:6666:123.123.123.123", STATUS_SUCCESS, 31, + { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7b7b, 0x7b7b } }, + { "1111::5555:6666:7777:8888", STATUS_SUCCESS, 25, + { 0x1111, 0, 0, 0, 0x5555, 0x6666, 0x7777, 0x8888 } }, + { "1111::6666:123.123.123.123", STATUS_SUCCESS, 26, + { 0x1111, 0, 0, 0, 0, 0x6666, 0x7b7b, 0x7b7b } }, + { "1111::6666:7777:8888", STATUS_SUCCESS, 20, + { 0x1111, 0, 0, 0, 0, 0x6666, 0x7777, 0x8888 } }, + { "1111::7777:8888", STATUS_SUCCESS, 15, + { 0x1111, 0, 0, 0, 0, 0, 0x7777, 0x8888 } }, + { "1111::8888", STATUS_SUCCESS, 10, + { 0x1111, 0, 0, 0, 0, 0, 0, 0x8888 } }, + { "1:2:3:4:5:6:1.2.3.4", STATUS_SUCCESS, 19, + { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x201, 0x403 } }, + { "1:2:3:4:5:6:7:8", STATUS_SUCCESS, 15, + { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, 0x800 } }, + { "1:2:3:4:5:6::", STATUS_SUCCESS, 13, + { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0 } }, + { "1:2:3:4:5:6::8", STATUS_SUCCESS, 14, + { 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0, 0x800 } }, + { "2001:0000:1234:0000:0000:C1C0:ABCD:0876", STATUS_SUCCESS, 39, + { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 } }, + { "2001:0000:4136:e378:8000:63bf:3fff:fdd2", STATUS_SUCCESS, 39, + { 0x120, 0, 0x3641, 0x78e3, 0x80, 0xbf63, 0xff3f, 0xd2fd } }, + { "2001:0db8:0:0:0:0:1428:57ab", STATUS_SUCCESS, 27, + { 0x120, 0xb80d, 0, 0, 0, 0, 0x2814, 0xab57 } }, + { "2001:0db8:1234:ffff:ffff:ffff:ffff:ffff", STATUS_SUCCESS, 39, + { 0x120, 0xb80d, 0x3412, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } }, + { "2001::CE49:7601:2CAD:DFFF:7C94:FFFE", STATUS_SUCCESS, 35, + { 0x120, 0, 0x49ce, 0x176, 0xad2c, 0xffdf, 0x947c, 0xfeff } }, + { "2001:db8:85a3::8a2e:370:7334", STATUS_SUCCESS, 28, + { 0x120, 0xb80d, 0xa385, 0, 0, 0x2e8a, 0x7003, 0x3473 } }, + { "3ffe:0b00:0000:0000:0001:0000:0000:000a", STATUS_SUCCESS, 39, + { 0xfe3f, 0xb, 0, 0, 0x100, 0, 0, 0xa00 } }, + { "::", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::%16", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::/16", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "::0", STATUS_SUCCESS, 3, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::0:0", STATUS_SUCCESS, 5, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::0:0:0", STATUS_SUCCESS, 7, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::0:0:0:0", STATUS_SUCCESS, 9, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::0:0:0:0:0", STATUS_SUCCESS, 11, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "::0:0:0:0:0:0", STATUS_SUCCESS, 13, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + /* this one and the next one are incorrectly parsed by windows, + it adds one zero too many in front, cutting off the last digit. */ + { "::0:0:0:0:0:0:0", STATUS_SUCCESS, 13, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "::0:a:b:c:d:e:f", STATUS_SUCCESS, 13, + { 0, 0, 0, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00 }, ex_fail_6 }, + { "::123.123.123.123", STATUS_SUCCESS, 17, + { 0, 0, 0, 0, 0, 0, 0x7b7b, 0x7b7b } }, + { "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", STATUS_SUCCESS, 39, + { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff } }, + + { "':10.0.0.1", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { "-1", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { "02001:0000:1234:0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, -1, + { -1 } }, + { "2001:00000:1234:0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, -1, + { 0x120, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "2001:0000:01234:0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, -1, + { 0x120, 0, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1.2.3.4", STATUS_INVALID_PARAMETER, 7, + { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1.2.3.4:1111::5555", STATUS_INVALID_PARAMETER, 7, + { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1.2.3.4::5555", STATUS_INVALID_PARAMETER, 7, + { 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "11112222:3333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, -1, + { -1 } }, + { "11112222:3333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1, + { -1 } }, + { "1111", STATUS_INVALID_PARAMETER, 4, + { -1 } }, + { "1111:22223333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, -1, + { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:22223333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, -1, + { 0x1111, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:", STATUS_INVALID_PARAMETER, 10, + { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:1.2.3.4", STATUS_INVALID_PARAMETER, 17, + { 0x1111, 0x2222, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333", STATUS_INVALID_PARAMETER, 14, + { 0x1111, 0x2222, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111:2222:3333:4444:5555:6666:7777:1.2.3.4", STATUS_SUCCESS, 36, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x100 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555:6666:7777:8888:", STATUS_SUCCESS, 39, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555:6666:7777:8888:1.2.3.4",STATUS_SUCCESS, 39, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 }, + { "1111:2222:3333:4444:5555:6666:7777:8888:9999", STATUS_SUCCESS, 39, + { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, ex_fail_6 }, + { "1111:2222:::", STATUS_SUCCESS, 11, + { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "1111::5555:", STATUS_INVALID_PARAMETER, 11, + { 0x1111, 0x5555, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1111::3333:4444:5555:6666:7777::", STATUS_SUCCESS, 30, + { 0x1111, 0, 0, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777 }, ex_fail_6 }, + { "1111:2222:::4444:5555:6666:1.2.3.4", STATUS_SUCCESS, 11, + { 0x1111, 0x2222, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "1111::3333::5555:6666:1.2.3.4", STATUS_SUCCESS, 10, + { 0x1111, 0, 0, 0, 0, 0, 0, 0x3333 }, ex_fail_6 }, + { "12345::6:7:8", STATUS_INVALID_PARAMETER, -1, + { -1 } }, + { "1::1.2.256.4", STATUS_INVALID_PARAMETER, -1, + { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3.256", STATUS_INVALID_PARAMETER, 12, + { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3.300", STATUS_INVALID_PARAMETER, 12, + { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2::1", STATUS_INVALID_PARAMETER, 6, + { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3.4::1", STATUS_SUCCESS, 10, + { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 }, ex_fail_6 }, + { "1::1.", STATUS_INVALID_PARAMETER, 5, + { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2", STATUS_INVALID_PARAMETER, 6, + { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.", STATUS_INVALID_PARAMETER, 7, + { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3", STATUS_INVALID_PARAMETER, 8, + { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3.", STATUS_INVALID_PARAMETER, 9, + { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.3.4", STATUS_SUCCESS, 10, + { 0x100, 0, 0, 0, 0, 0, 0x201, 0x403 } }, + { "1::1.2.3.900", STATUS_INVALID_PARAMETER, 12, + { 0x100, 0x201, 0xab03, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.2.300.4", STATUS_INVALID_PARAMETER, -1, + { 0x100, 0x201, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::1.256.3.4", STATUS_INVALID_PARAMETER, -1, + { 0x100, 0xab01, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::256.2.3.4", STATUS_INVALID_PARAMETER, -1, + { 0x100, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "1::2::3", STATUS_SUCCESS, 4, + { 0x100, 0, 0, 0, 0, 0, 0, 0x200 }, ex_fail_6 }, + { "2001:0000:1234: 0000:0000:C1C0:ABCD:0876", STATUS_INVALID_PARAMETER, 15, + { 0x120, 0, 0x3412, 0xabab, 0xabab, 0xabab, 0xabab, 0xabab } }, + { "2001:0000:1234:0000:0000:C1C0:ABCD:0876 0", STATUS_SUCCESS, 39, + { 0x120, 0, 0x3412, 0, 0, 0xc0c1, 0xcdab, 0x7608 }, ex_fail_6 }, + { "2001:1:1:1:1:1:255Z255X255Y255", STATUS_INVALID_PARAMETER, 18, + { 0x120, 0x100, 0x100, 0x100, 0x100, 0x100, 0xabab, 0xabab } }, + { "2001::FFD3::57ab", STATUS_SUCCESS, 10, + { 0x120, 0, 0, 0, 0, 0, 0, 0xd3ff }, ex_fail_6 }, + { ":", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { ":1111:2222:3333:4444:5555:6666:1.2.3.4", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { ":1111:2222:3333:4444:5555:6666:7777:8888", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { ":1111::", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { "::-1", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "::.", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "::..", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "::...", STATUS_SUCCESS, 2, + { 0, 0, 0, 0, 0, 0, 0, 0 }, ex_fail_6 }, + { "XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:1.2.3.4", STATUS_INVALID_PARAMETER, 0, + { -1 } }, + { "[::]", STATUS_INVALID_PARAMETER, 0, + { -1 }, ex_skip_6 }, +}; +const unsigned int ipv6_testcount = sizeof(ipv6_tests) / sizeof(ipv6_tests[0]); + +static void init_ip6(IN6_ADDR* addr, const int src[8]) +{ + unsigned int j; + if (!src || src[0] == -1) + { + for (j = 0; j < 8; ++j) + addr->s6_words[j] = 0xabab; + } + else + { + for (j = 0; j < 8; ++j) + addr->s6_words[j] = src[j]; + } +} + +static void compare_RtlIpv6StringToAddressW(PCSTR name_a, int terminator_offset_a, + const struct in6_addr *addr_a, NTSTATUS res_a) +{ + WCHAR name[512]; + NTSTATUS res; + IN6_ADDR ip; + PCWSTR terminator; + + if (!pRtlIpv6StringToAddressW) + return; + + pRtlMultiByteToUnicodeN(name, sizeof(name), NULL, name_a, strlen(name_a) + 1); + + init_ip6(&ip, NULL); + terminator = (void *)0xdeadbeef; + res = pRtlIpv6StringToAddressW(name, &terminator, &ip); + ok(res == res_a, "[W:%s] res = 0x%08x, expected 0x%08x\n", name_a, res, res_a); + + if (terminator_offset_a < 0) + { + ok(terminator == (void *)0xdeadbeef, + "[W:%s] terminator = %p, expected it not to change\n", + name_a, terminator); + } + else + { + ok(terminator == name + terminator_offset_a, + "[W:%s] terminator = %p, expected %p\n", + name_a, terminator, name + terminator_offset_a); + } + + ok(!memcmp(&ip, addr_a, sizeof(ip)), + "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n", + name_a, + ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3], + ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7], + addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3], + addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]); +} + +static void test_RtlIpv6StringToAddress(void) +{ + NTSTATUS res; + IN6_ADDR ip, expected_ip; + PCSTR terminator; + unsigned int i; + + if (!pRtlIpv6StringToAddressW) + { + skip("RtlIpv6StringToAddressW not available\n"); + /* we can continue, just not test W */ + } + + if (!pRtlIpv6StringToAddressA) + { + skip("RtlIpv6StringToAddressA not available\n"); + return; /* all tests are centered around A, we cannot continue */ + } + + res = pRtlIpv6StringToAddressA("::", &terminator, &ip); + ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res); + if (0) + { + /* any of these crash */ + res = pRtlIpv6StringToAddressA(NULL, &terminator, &ip); + ok(res == STATUS_INVALID_PARAMETER, "[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + res = pRtlIpv6StringToAddressA("::", NULL, &ip); + ok(res == STATUS_INVALID_PARAMETER, "[null terminator] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + res = pRtlIpv6StringToAddressA("::", &terminator, NULL); + ok(res == STATUS_INVALID_PARAMETER, "[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + } + + /* sanity check */ + ok(sizeof(ip) == sizeof(USHORT)* 8, "sizeof(ip)\n"); + + for (i = 0; i < ipv6_testcount; i++) + { + init_ip6(&ip, NULL); + terminator = (void *)0xdeadbeef; + res = pRtlIpv6StringToAddressA(ipv6_tests[i].address, &terminator, &ip); + compare_RtlIpv6StringToAddressW(ipv6_tests[i].address, (terminator != (void *)0xdeadbeef) ? + (terminator - ipv6_tests[i].address) : -1, &ip, res); + + if (ipv6_tests[i].flags & win_broken_6) + { + ok(res == ipv6_tests[i].res || broken(res == STATUS_INVALID_PARAMETER), + "[%s] res = 0x%08x, expected 0x%08x\n", + ipv6_tests[i].address, res, ipv6_tests[i].res); + + if (res == STATUS_INVALID_PARAMETER) + continue; + } + else + { + ok(res == ipv6_tests[i].res, + "[%s] res = 0x%08x, expected 0x%08x\n", + ipv6_tests[i].address, res, ipv6_tests[i].res); + } + + if (ipv6_tests[i].terminator_offset < 0) + { + ok(terminator == (void *)0xdeadbeef, + "[%s] terminator = %p, expected it not to change\n", + ipv6_tests[i].address, terminator); + } + else if (ipv6_tests[i].flags & win_broken_6) + { + PCSTR expected = ipv6_tests[i].address + ipv6_tests[i].terminator_offset; + ok(terminator == expected || broken(terminator == expected + 2), + "[%s] terminator = %p, expected %p\n", + ipv6_tests[i].address, terminator, expected); + } + else + { + ok(terminator == ipv6_tests[i].address + ipv6_tests[i].terminator_offset, + "[%s] terminator = %p, expected %p\n", + ipv6_tests[i].address, terminator, ipv6_tests[i].address + ipv6_tests[i].terminator_offset); + } + + init_ip6(&expected_ip, ipv6_tests[i].ip); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n", + ipv6_tests[i].address, + ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3], + ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7], + expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3], + expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]); + } +} + +static void compare_RtlIpv6StringToAddressExW(PCSTR name_a, const struct in6_addr *addr_a, HRESULT res_a, ULONG scope_a, USHORT port_a) +{ + WCHAR name[512]; + NTSTATUS res; + IN6_ADDR ip; + ULONG scope = 0xbadf00d; + USHORT port = 0xbeef; + + if (!pRtlIpv6StringToAddressExW) + return; + + pRtlMultiByteToUnicodeN(name, sizeof(name), NULL, name_a, strlen(name_a) + 1); + + init_ip6(&ip, NULL); + res = pRtlIpv6StringToAddressExW(name, &ip, &scope, &port); + + ok(res == res_a, "[W:%s] res = 0x%08x, expected 0x%08x\n", name_a, res, res_a); + ok(scope == scope_a, "[W:%s] scope = 0x%08x, expected 0x%08x\n", name_a, scope, scope_a); + ok(port == port_a, "[W:%s] port = 0x%08x, expected 0x%08x\n", name_a, port, port_a); + + ok(!memcmp(&ip, addr_a, sizeof(ip)), + "[W:%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n", + name_a, + ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3], + ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7], + addr_a->s6_words[0], addr_a->s6_words[1], addr_a->s6_words[2], addr_a->s6_words[3], + addr_a->s6_words[4], addr_a->s6_words[5], addr_a->s6_words[6], addr_a->s6_words[7]); +} + +static void test_RtlIpv6StringToAddressEx(void) +{ + NTSTATUS res; + IN6_ADDR ip, expected_ip; + ULONG scope; + USHORT port; + static const struct + { + PCSTR address; + NTSTATUS res; + ULONG scope; + USHORT port; + int ip[8]; + } ipv6_ex_tests[] = + { + { "[::]", STATUS_SUCCESS, 0, 0, + { 0, 0, 0, 0, 0, 0, 0, 0 } }, + { "[::1]:8080", STATUS_SUCCESS, 0, 0x901f, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "[::1]:0x80", STATUS_SUCCESS, 0, 0x8000, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "[::1]:0X80", STATUS_SUCCESS, 0, 0x8000, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "[::1]:080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "[::1]:800000000080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0, 0, 0, 0, 0, 0, 0, 0x100 } }, + { "[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80", STATUS_SUCCESS, 0, 0x5000, + { 0xdcfe, 0x98ba, 0x5476, 0x1032, 0xdcfe, 0x98ba, 0x5476, 0x1032 } }, + { "[1080:0:0:0:8:800:200C:417A]:1234", STATUS_SUCCESS, 0, 0xd204, + { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[3ffe:2a00:100:7031::1]:8080", STATUS_SUCCESS, 0, 0x901f, + { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } }, + { "[ 3ffe:2a00:100:7031::1]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { -1 } }, + { "[3ffe:2a00:100:7031::1 ]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } }, + { "[3ffe:2a00:100:7031::1].8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0xfe3f, 0x2a, 1, 0x3170, 0, 0, 0, 0x100 } }, + { "[1080::8:800:200C:417A]:8080", STATUS_SUCCESS, 0, 0x901f, + { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[1080::8:800:200C:417A]!8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x8010, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[::FFFF:129.144.52.38]:80", STATUS_SUCCESS, 0, 0x5000, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "[::FFFF:129.144.52.38]:-80", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "[::FFFF:129.144.52.38]:999999999999", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "[::FFFF:129.144.52.38%-8]:80", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "[::FFFF:129.144.52.38]:80", STATUS_SUCCESS, 0, 0x5000, + { 0, 0, 0, 0, 0, 0xffff, 0x9081, 0x2634 } }, + { "[12345::6:7:8]:80", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { -1 } }, + { "[ff01::8:800:200C:417A%16]:8080", STATUS_SUCCESS, 16, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%100]:8080", STATUS_SUCCESS, 100, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%1000]:8080", STATUS_SUCCESS, 1000, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%10000]:8080", STATUS_SUCCESS, 10000, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%1000000]:8080", STATUS_SUCCESS, 1000000, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%4294967295]:8080", STATUS_SUCCESS, 0xffffffff, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%4294967296]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%-1]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%0]:8080", STATUS_SUCCESS, 0, 0x901f, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%1", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A%0x1000]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + { "[ff01::8:800:200C:417A/16]:8080", STATUS_INVALID_PARAMETER, 0xbadf00d, 0xbeef, + { 0x1ff, 0, 0, 0, 0x800, 8, 0xc20, 0x7a41 } }, + }; + const unsigned int ipv6_ex_testcount = sizeof(ipv6_ex_tests) / sizeof(ipv6_ex_tests[0]); + const char *simple_ip = "::"; + unsigned int i; + + if (!pRtlIpv6StringToAddressExW) + { + skip("RtlIpv6StringToAddressExW not available\n"); + /* we can continue, just not test W */ + } + + if (!pRtlIpv6StringToAddressExA) + { + skip("RtlIpv6StringToAddressExA not available\n"); + return; + } + + res = pRtlIpv6StringToAddressExA(simple_ip, &ip, &scope, &port); + ok(res == STATUS_SUCCESS, "[validate] res = 0x%08x, expected STATUS_SUCCESS\n", res); + + init_ip6(&ip, NULL); + init_ip6(&expected_ip, NULL); + scope = 0xbadf00d; + port = 0xbeef; + res = pRtlIpv6StringToAddressExA(NULL, &ip, &scope, &port); + ok(res == STATUS_INVALID_PARAMETER, + "[null string] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + ok(scope == 0xbadf00d, "[null string] scope = 0x%08x, expected 0xbadf00d\n", scope); + ok(port == 0xbeef, "[null string] port = 0x%08x, expected 0xbeef\n", port); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[null string] ip is changed, expected it not to change\n"); + + + init_ip6(&ip, NULL); + scope = 0xbadf00d; + port = 0xbeef; + res = pRtlIpv6StringToAddressExA(simple_ip, NULL, &scope, &port); + ok(res == STATUS_INVALID_PARAMETER, + "[null result] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + ok(scope == 0xbadf00d, "[null result] scope = 0x%08x, expected 0xbadf00d\n", scope); + ok(port == 0xbeef, "[null result] port = 0x%08x, expected 0xbeef\n", port); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[null result] ip is changed, expected it not to change\n"); + + init_ip6(&ip, NULL); + scope = 0xbadf00d; + port = 0xbeef; + res = pRtlIpv6StringToAddressExA(simple_ip, &ip, NULL, &port); + ok(res == STATUS_INVALID_PARAMETER, + "[null scope] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + ok(scope == 0xbadf00d, "[null scope] scope = 0x%08x, expected 0xbadf00d\n", scope); + ok(port == 0xbeef, "[null scope] port = 0x%08x, expected 0xbeef\n", port); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[null scope] ip is changed, expected it not to change\n"); + + init_ip6(&ip, NULL); + scope = 0xbadf00d; + port = 0xbeef; + res = pRtlIpv6StringToAddressExA(simple_ip, &ip, &scope, NULL); + ok(res == STATUS_INVALID_PARAMETER, + "[null port] res = 0x%08x, expected STATUS_INVALID_PARAMETER\n", res); + ok(scope == 0xbadf00d, "[null port] scope = 0x%08x, expected 0xbadf00d\n", scope); + ok(port == 0xbeef, "[null port] port = 0x%08x, expected 0xbeef\n", port); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[null port] ip is changed, expected it not to change\n"); + + /* sanity check */ + ok(sizeof(ip) == sizeof(USHORT)* 8, "sizeof(ip)\n"); + + /* first we run all ip related tests, to make sure someone didnt accidentally reimplement instead of re-use. */ + for (i = 0; i < ipv6_testcount; i++) + { + ULONG scope = 0xbadf00d; + USHORT port = 0xbeef; + NTSTATUS expect_ret = (ipv6_tests[i].flags & ex_fail_6) ? STATUS_INVALID_PARAMETER : ipv6_tests[i].res; + + if (ipv6_tests[i].flags & ex_skip_6) + continue; + + init_ip6(&ip, NULL); + res = pRtlIpv6StringToAddressExA(ipv6_tests[i].address, &ip, &scope, &port); + compare_RtlIpv6StringToAddressExW(ipv6_tests[i].address, &ip, res, scope, port); + + /* make sure nothing was changed if this function fails. */ + if (res == STATUS_INVALID_PARAMETER) + { + ok(scope == 0xbadf00d, "[%s] scope = 0x%08x, expected 0xbadf00d\n", + ipv6_tests[i].address, scope); + ok(port == 0xbeef, "[%s] port = 0x%08x, expected 0xbeef\n", + ipv6_tests[i].address, port); + } + else + { + ok(scope != 0xbadf00d, "[%s] scope = 0x%08x, not expected 0xbadf00d\n", + ipv6_tests[i].address, scope); + ok(port != 0xbeef, "[%s] port = 0x%08x, not expected 0xbeef\n", + ipv6_tests[i].address, port); + } + + if (ipv6_tests[i].flags & win_broken_6) + { + ok(res == expect_ret || broken(res == STATUS_INVALID_PARAMETER), + "[%s] res = 0x%08x, expected 0x%08x\n", ipv6_tests[i].address, res, expect_ret); + + if (res == STATUS_INVALID_PARAMETER) + continue; + } + else + { + ok(res == expect_ret, "[%s] res = 0x%08x, expected 0x%08x\n", + ipv6_tests[i].address, res, expect_ret); + } + + /* If ex fails but non-ex does not we cannot check if the part that is converted + before it failed was correct, since there is no data for it in the table. */ + if (res == expect_ret) + { + init_ip6(&expected_ip, ipv6_tests[i].ip); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n", + ipv6_tests[i].address, + ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3], + ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7], + expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3], + expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]); + } + } + + /* now we run scope / port related tests */ + for (i = 0; i < ipv6_ex_testcount; i++) + { + scope = 0xbadf00d; + port = 0xbeef; + init_ip6(&ip, NULL); + res = pRtlIpv6StringToAddressExA(ipv6_ex_tests[i].address, &ip, &scope, &port); + compare_RtlIpv6StringToAddressExW(ipv6_ex_tests[i].address, &ip, res, scope, port); + + ok(res == ipv6_ex_tests[i].res, "[%s] res = 0x%08x, expected 0x%08x\n", + ipv6_ex_tests[i].address, res, ipv6_ex_tests[i].res); + ok(scope == ipv6_ex_tests[i].scope, "[%s] scope = 0x%08x, expected 0x%08x\n", + ipv6_ex_tests[i].address, scope, ipv6_ex_tests[i].scope); + ok(port == ipv6_ex_tests[i].port, "[%s] port = 0x%08x, expected 0x%08x\n", + ipv6_ex_tests[i].address, port, ipv6_ex_tests[i].port); + + init_ip6(&expected_ip, ipv6_ex_tests[i].ip); + ok(!memcmp(&ip, &expected_ip, sizeof(ip)), + "[%s] ip = %x:%x:%x:%x:%x:%x:%x:%x, expected %x:%x:%x:%x:%x:%x:%x:%x\n", + ipv6_ex_tests[i].address, + ip.s6_words[0], ip.s6_words[1], ip.s6_words[2], ip.s6_words[3], + ip.s6_words[4], ip.s6_words[5], ip.s6_words[6], ip.s6_words[7], + expected_ip.s6_words[0], expected_ip.s6_words[1], expected_ip.s6_words[2], expected_ip.s6_words[3], + expected_ip.s6_words[4], expected_ip.s6_words[5], expected_ip.s6_words[6], expected_ip.s6_words[7]); } } @@ -2496,6 +3223,8 @@ test_RtlIpv4AddressToStringEx(); test_RtlIpv4StringToAddress(); test_RtlIpv4StringToAddressEx(); + test_RtlIpv6StringToAddress(); + test_RtlIpv6StringToAddressEx(); test_LdrAddRefDll(); test_LdrLockLoaderLock(); test_RtlGetCompressionWorkSpaceSize();
9 years, 9 months
1
0
0
0
[akhaldi] 66848: [FUSION] Sync with Wine Staging 1.7.37. CORE-9246
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Mar 21 12:21:40 2015 New Revision: 66848 URL:
http://svn.reactos.org/svn/reactos?rev=66848&view=rev
Log: [FUSION] Sync with Wine Staging 1.7.37. CORE-9246 Modified: trunk/reactos/dll/win32/fusion/asmcache.c trunk/reactos/dll/win32/fusion/asmname.c trunk/reactos/dll/win32/fusion/fusion.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/fusion/asmcache.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/asmcache.…
============================================================================== --- trunk/reactos/dll/win32/fusion/asmcache.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/asmcache.c [iso-8859-1] Sat Mar 21 12:21:40 2015 @@ -20,6 +20,19 @@ #include "fusionpriv.h" +typedef struct { + IAssemblyCache IAssemblyCache_iface; + + LONG ref; + HANDLE lock; +} IAssemblyCacheImpl; + +typedef struct { + IAssemblyCacheItem IAssemblyCacheItem_iface; + + LONG ref; +} IAssemblyCacheItemImpl; + static const WCHAR cache_mutex_nameW[] = {'_','_','W','I','N','E','_','F','U','S','I','O','N','_','C','A','C','H','E','_','M','U','T','E','X','_','_',0}; @@ -119,13 +132,6 @@ } /* IAssemblyCache */ - -typedef struct { - IAssemblyCache IAssemblyCache_iface; - - LONG ref; - HANDLE lock; -} IAssemblyCacheImpl; static inline IAssemblyCacheImpl *impl_from_IAssemblyCache(IAssemblyCache *iface) { @@ -330,16 +336,33 @@ return hr; } +static const IAssemblyCacheItemVtbl AssemblyCacheItemVtbl; + static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyCacheItem(IAssemblyCache *iface, DWORD dwFlags, PVOID pvReserved, IAssemblyCacheItem **ppAsmItem, LPCWSTR pszAssemblyName) { - FIXME("(%p, %d, %p, %p, %s) stub!\n", iface, dwFlags, pvReserved, + IAssemblyCacheItemImpl *item; + + FIXME("(%p, %d, %p, %p, %s) semi-stub!\n", iface, dwFlags, pvReserved, ppAsmItem, debugstr_w(pszAssemblyName)); - return E_NOTIMPL; + if (!ppAsmItem) + return E_INVALIDARG; + + *ppAsmItem = NULL; + + item = HeapAlloc(GetProcessHeap(), 0, sizeof(IAssemblyCacheItemImpl)); + if (!item) + return E_OUTOFMEMORY; + + item->IAssemblyCacheItem_iface.lpVtbl = &AssemblyCacheItemVtbl; + item->ref = 1; + + *ppAsmItem = &item->IAssemblyCacheItem_iface; + return S_OK; } static HRESULT WINAPI IAssemblyCacheImpl_CreateAssemblyScavenger(IAssemblyCache *iface, @@ -539,12 +562,6 @@ /* IAssemblyCacheItem */ -typedef struct { - IAssemblyCacheItem IAssemblyCacheItem_iface; - - LONG ref; -} IAssemblyCacheItemImpl; - static inline IAssemblyCacheItemImpl *impl_from_IAssemblyCacheItem(IAssemblyCacheItem *iface) { return CONTAINING_RECORD(iface, IAssemblyCacheItemImpl, IAssemblyCacheItem_iface); Modified: trunk/reactos/dll/win32/fusion/asmname.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/asmname.c…
============================================================================== --- trunk/reactos/dll/win32/fusion/asmname.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/asmname.c [iso-8859-1] Sat Mar 21 12:21:40 2015 @@ -482,7 +482,7 @@ if (*len <= buffer_size) lstrcpyW(buf, name->path); else - return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + return E_NOT_SUFFICIENT_BUFFER; return S_OK; } Modified: trunk/reactos/dll/win32/fusion/fusion.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/fusion/fusion.c?…
============================================================================== --- trunk/reactos/dll/win32/fusion/fusion.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/fusion/fusion.c [iso-8859-1] Sat Mar 21 12:21:40 2015 @@ -148,7 +148,7 @@ len++; if (*pcchPath <= len || !pwzCachePath) - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + hr = E_NOT_SUFFICIENT_BUFFER; else if (pwzCachePath) strcpyW(pwzCachePath, path); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Mar 21 12:21:40 2015 @@ -75,7 +75,7 @@ reactos/dll/win32/dwmapi # Synced to WineStaging-1.7.37 reactos/dll/win32/faultrep # Synced to Wine-1.7.27 reactos/dll/win32/fltlib # Synced to Wine-1.7.27 -reactos/dll/win32/fusion # Synced to Wine-1.7.27 +reactos/dll/win32/fusion # Synced to WineStaging-1.7.37 reactos/dll/win32/gdiplus # Synced to Wine-1.7.27 reactos/dll/win32/hhctrl.ocx # Synced to Wine-1.7.27 reactos/dll/win32/hlink # Synced to Wine-1.7.27
9 years, 9 months
1
0
0
0
[akhaldi] 66847: [KS] Tabs => Spaces. NFC.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Mar 21 09:36:40 2015 New Revision: 66847 URL:
http://svn.reactos.org/svn/reactos?rev=66847&view=rev
Log: [KS] Tabs => Spaces. NFC. Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/swenum…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] Sat Mar 21 09:36:40 2015 @@ -272,8 +272,8 @@ /* check if the device is already present */ Entry = DeviceEntry->DeviceInterfaceList.Flink; - DPRINT1("KspCreateDeviceAssociation ReferenceString %S\n", ReferenceString); - DPRINT1("KspCreateDeviceAssociation InterfaceString %S\n", InterfaceString); + DPRINT1("KspCreateDeviceAssociation ReferenceString %S\n", ReferenceString); + DPRINT1("KspCreateDeviceAssociation InterfaceString %S\n", InterfaceString); while(Entry != &DeviceEntry->DeviceInterfaceList) { @@ -690,7 +690,7 @@ Length += 2; /* allocate buffer */ - Buffer = ExAllocatePoolWithTag(NonPagedPool, Length * sizeof(WCHAR), 'mNoI'); + Buffer = ExAllocatePoolWithTag(NonPagedPool, Length * sizeof(WCHAR), 'mNoI'); if (!Buffer) { /* no resources */ @@ -1229,14 +1229,14 @@ } else if (DeviceEntry->DeviceState == Started) { - /* release spin lock */ - KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel); + /* release spin lock */ + KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel); /* found pending irps */ KspCompletePendingIrps(DeviceEntry, STATUS_REPARSE); - /* re-acquire lock */ - KeAcquireSpinLock(&BusDeviceExtension->Lock, &OldLevel); + /* re-acquire lock */ + KeAcquireSpinLock(&BusDeviceExtension->Lock, &OldLevel); } }
9 years, 9 months
1
0
0
0
[janderwald] 66846: [KS] - try fix sound #1
by janderwald@svn.reactos.org
Author: janderwald Date: Sat Mar 21 09:33:34 2015 New Revision: 66846 URL:
http://svn.reactos.org/svn/reactos?rev=66846&view=rev
Log: [KS] - try fix sound #1 Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c Modified: trunk/reactos/drivers/ksfilter/ks/swenum.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/ksfilter/ks/swenum…
============================================================================== --- trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] (original) +++ trunk/reactos/drivers/ksfilter/ks/swenum.c [iso-8859-1] Sat Mar 21 09:33:34 2015 @@ -690,7 +690,7 @@ Length += 2; /* allocate buffer */ - Buffer = AllocateItem(NonPagedPool, Length * sizeof(WCHAR)); + Buffer = ExAllocatePoolWithTag(NonPagedPool, Length * sizeof(WCHAR), 'mNoI'); if (!Buffer) { /* no resources */ @@ -699,8 +699,9 @@ /* construct buffer */ swprintf(Buffer, L"%s\\%s", DeviceEntry->PDODeviceName, DeviceEntry->Instance); - // HACK - //ExFreePool(IoStack->FileObject->FileName.Buffer); + + /* free old buffer*/ + ExFreePoolWithTag(IoStack->FileObject->FileName.Buffer, 'mNoI'); /* store new file name */ RtlInitUnicodeString(&IoStack->FileObject->FileName, Buffer); @@ -1228,8 +1229,14 @@ } else if (DeviceEntry->DeviceState == Started) { + /* release spin lock */ + KeReleaseSpinLock(&BusDeviceExtension->Lock, OldLevel); + /* found pending irps */ KspCompletePendingIrps(DeviceEntry, STATUS_REPARSE); + + /* re-acquire lock */ + KeAcquireSpinLock(&BusDeviceExtension->Lock, &OldLevel); } }
9 years, 9 months
1
0
0
0
[tfaber] 66845: [NTOS:WMI] - Fill out WmipGenericMapping according to kmtest:ObTypes
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Mar 21 08:39:54 2015 New Revision: 66845 URL:
http://svn.reactos.org/svn/reactos?rev=66845&view=rev
Log: [NTOS:WMI] - Fill out WmipGenericMapping according to kmtest:ObTypes Modified: trunk/reactos/include/psdk/wmistr.h trunk/reactos/ntoskrnl/wmi/guidobj.c Modified: trunk/reactos/include/psdk/wmistr.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wmistr.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/wmistr.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/wmistr.h [iso-8859-1] Sat Mar 21 08:39:54 2015 @@ -170,4 +170,6 @@ #define TRACELOG_ACCESS_REALTIME 0x0400 #define TRACELOG_REGISTER_GUIDS 0x0800 +#define WMIGUID_ALL_ACCESS (STANDARD_RIGHTS_READ | SYNCHRONIZE | 0xFFF) + #endif /* _WMISTR_ */ Modified: trunk/reactos/ntoskrnl/wmi/guidobj.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/wmi/guidobj.c?rev…
============================================================================== --- trunk/reactos/ntoskrnl/wmi/guidobj.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/wmi/guidobj.c [iso-8859-1] Sat Mar 21 08:39:54 2015 @@ -19,7 +19,13 @@ /* GLOBALS ******************************************************************/ POBJECT_TYPE WmipGuidObjectType; -GENERIC_MAPPING WmipGenericMapping; +GENERIC_MAPPING WmipGenericMapping = +{ + WMIGUID_QUERY, + WMIGUID_SET, + WMIGUID_EXECUTE, + WMIGUID_ALL_ACCESS +}; /* FUNCTIONS *****************************************************************/ @@ -120,7 +126,7 @@ ObjectTypeInitializer.MaintainHandleCount = FALSE; ObjectTypeInitializer.ValidAccessMask = STANDARD_RIGHTS_ALL | 0xFFF; ObjectTypeInitializer.SecurityRequired = TRUE; - ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(WMIP_GUID_OBJECT);; + ObjectTypeInitializer.DefaultNonPagedPoolCharge = sizeof(WMIP_GUID_OBJECT); ObjectTypeInitializer.SecurityProcedure = WmipSecurityMethod; ObjectTypeInitializer.DeleteProcedure = WmipDeleteMethod; ObjectTypeInitializer.CloseProcedure = WmipCloseMethod;
9 years, 9 months
1
0
0
0
[tfaber] 66844: [NTOS:CM] - Always fill out KEY_NAME_INFORMATION::NameLength in CmpQueryNameInformation if enough space is available. Fixes ntdll:reg test failures. CORE-9403 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Mar 21 08:25:59 2015 New Revision: 66844 URL:
http://svn.reactos.org/svn/reactos?rev=66844&view=rev
Log: [NTOS:CM] - Always fill out KEY_NAME_INFORMATION::NameLength in CmpQueryNameInformation if enough space is available. Fixes ntdll:reg test failures. CORE-9403 #resolve Modified: trunk/reactos/ntoskrnl/config/cmapi.c Modified: trunk/reactos/ntoskrnl/config/cmapi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/config/cmapi.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/config/cmapi.c [iso-8859-1] Sat Mar 21 08:25:59 2015 @@ -1543,9 +1543,14 @@ _SEH2_TRY { - *ResultLength = NeededLength + FIELD_OFFSET(KEY_NAME_INFORMATION, Name[0]); + *ResultLength = FIELD_OFFSET(KEY_NAME_INFORMATION, Name) + NeededLength; + if (Length < RTL_SIZEOF_THROUGH_FIELD(KEY_NAME_INFORMATION, NameLength)) + return STATUS_BUFFER_TOO_SMALL; if (Length < *ResultLength) - return STATUS_BUFFER_TOO_SMALL; + { + KeyNameInfo->NameLength = NeededLength; + return STATUS_BUFFER_OVERFLOW; + } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
9 years, 9 months
1
0
0
0
← Newer
1
...
13
14
15
16
17
18
19
...
50
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Results per page:
10
25
50
100
200