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
June 2012
----- 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
11 participants
120 discussions
Start a n
N
ew thread
[pschweitzer] 56795: [RTL] Implement RtlConvertVariantToProperty, RtlConvertPropertyToVariant, PropertyLengthAsVariant Those are just wrappers around Ole32 functions.
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jun 24 14:11:55 2012 New Revision: 56795 URL:
http://svn.reactos.org/svn/reactos?rev=56795&view=rev
Log: [RTL] Implement RtlConvertVariantToProperty, RtlConvertPropertyToVariant, PropertyLengthAsVariant Those are just wrappers around Ole32 functions. Modified: trunk/reactos/lib/rtl/propvar.c Modified: trunk/reactos/lib/rtl/propvar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/propvar.c?rev=5679…
============================================================================== --- trunk/reactos/lib/rtl/propvar.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/propvar.c [iso-8859-1] Sun Jun 24 14:11:55 2012 @@ -3,7 +3,7 @@ * PROJECT: ReactOS system libraries * FILE: lib/rtl/propvar.c * PURPOSE: Native properties and variants API - * PROGRAMMER: + * PROGRAMMER: Pierre Schweitzer (pierre(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -15,66 +15,152 @@ /* FUNCTIONS ***************************************************************/ +UNICODE_STRING Old32Dll = RTL_CONSTANT_STRING(L"ole32.dll"); +/* FIXME: (or not) + * Define those here to allow build. They don't need to be dereferenced + * so it's OK. + * Furthermore till Vista those Ole32 API were private so those defines + * should be made in a private header + * Finally, having those defined that way allows to write that code plain C. + */ +typedef PVOID PPMemoryAllocator; +typedef PVOID PSERIALIZEDPROPERTYVALUE; + /* - * @unimplemented + * @implemented */ -NTSTATUS -NTAPI -PropertyLengthAsVariant ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3 - ) +PVOID +LoadOle32Export(PVOID * BaseAddress, const PCHAR ProcedureName) { - return (STATUS_NOT_IMPLEMENTED); + NTSTATUS Status; + ANSI_STRING ExportName; + PVOID ProcedureAddress; + + /* First load ole32.dll */ + Status = LdrLoadDll(NULL, NULL, &Old32Dll, BaseAddress); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + + RtlInitAnsiString(&ExportName, ProcedureName); + + /* Look for the procedure */ + Status = LdrGetProcedureAddress(*BaseAddress, &ExportName, + 0, &ProcedureAddress); + if (!NT_SUCCESS(Status)) + { + RtlRaiseStatus(Status); + } + + /* Return its address */ + return ProcedureAddress; } /* - * @unimplemented + * @implemented + */ +ULONG +NTAPI +PropertyLengthAsVariant(IN PSERIALIZEDPROPERTYVALUE pProp, + IN ULONG cbProp, + IN USHORT CodePage, + IN BYTE bReserved) +{ + BOOLEAN Success = FALSE; + PVOID BaseAddress = NULL; + ULONG (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, ULONG, USHORT, BYTE); + + _SEH2_TRY + { + /* Simply call the appropriate Ole32 export */ + ProcedureAddress = LoadOle32Export(&BaseAddress, + "StgPropertyLengthAsVariant"); + + Success = ProcedureAddress(pProp, cbProp, CodePage, bReserved); + } + _SEH2_FINALLY + { + if (BaseAddress != NULL) + { + LdrUnloadDll(BaseAddress); + } + } + _SEH2_END; + + return Success; +} + +/* + * @implemented */ BOOLEAN NTAPI -RtlCompareVariants ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) +RtlConvertPropertyToVariant(IN PSERIALIZEDPROPERTYVALUE prop, + IN USHORT CodePage, + OUT PROPVARIANT * pvar, + IN PPMemoryAllocator pma) { - return (FALSE); + BOOLEAN Success = FALSE; + PVOID BaseAddress = NULL; + BOOLEAN (*ProcedureAddress)(PSERIALIZEDPROPERTYVALUE, USHORT, PROPVARIANT*, PPMemoryAllocator); + + _SEH2_TRY + { + /* Simply call the appropriate Ole32 export */ + ProcedureAddress = LoadOle32Export(&BaseAddress, + "StgConvertPropertyToVariant"); + + Success = ProcedureAddress(prop, CodePage, pvar, pma); + } + _SEH2_FINALLY + { + if (BaseAddress != NULL) + { + LdrUnloadDll(BaseAddress); + } + } + _SEH2_END; + + return Success; } /* - * @unimplemented + * @implemented */ -BOOLEAN +PSERIALIZEDPROPERTYVALUE NTAPI -RtlConvertPropertyToVariant ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3 - ) +RtlConvertVariantToProperty(IN const PROPVARIANT * pvar, + IN USHORT CodePage, + OUT PSERIALIZEDPROPERTYVALUE pprop OPTIONAL, + IN OUT PULONG pcb, + IN PROPID pid, + IN BOOLEAN fReserved, + IN OUT PULONG pcIndirect OPTIONAL) { - return (FALSE); -} + PSERIALIZEDPROPERTYVALUE Serialized = NULL; + PVOID BaseAddress = NULL; + PSERIALIZEDPROPERTYVALUE (*ProcedureAddress)(const PROPVARIANT*, USHORT, PSERIALIZEDPROPERTYVALUE, + PULONG, PROPID, BOOLEAN, PULONG); -/* - * @unimplemented - */ -NTSTATUS -NTAPI -RtlConvertVariantToProperty ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5, - DWORD Unknown6 - ) -{ - return (STATUS_NOT_IMPLEMENTED); + _SEH2_TRY + { + /* Simply call the appropriate Ole32 export */ + ProcedureAddress = LoadOle32Export(&BaseAddress, + "StgConvertVariantToProperty"); + + Serialized = ProcedureAddress(pvar, CodePage, pprop, pcb, pid, fReserved, pcIndirect); + } + _SEH2_FINALLY + { + if (BaseAddress != NULL) + { + LdrUnloadDll(BaseAddress); + } + } + _SEH2_END; + + return Serialized; }
12 years, 6 months
1
0
0
0
[tkreuzer] 56794: [RTL] Fix a mistake in RtlNumberOfSetBits, check for index out of range in RtlFindNextForwardRun*
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 24 13:39:32 2012 New Revision: 56794 URL:
http://svn.reactos.org/svn/reactos?rev=56794&view=rev
Log: [RTL] Fix a mistake in RtlNumberOfSetBits, check for index out of range in RtlFindNextForwardRun* Modified: trunk/reactos/lib/rtl/bitmap.c Modified: trunk/reactos/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=56794…
============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun Jun 24 13:39:32 2012 @@ -421,7 +421,7 @@ } Shift = 8 - (BitMapHeader->SizeOfBitMap & 7); - BitCount += BitCountTable[(*Byte) << Shift]; + BitCount += BitCountTable[((*Byte) << Shift) & 0xFF]; return BitCount; } @@ -618,6 +618,13 @@ { ULONG Length; + /* Check for buffer overrun */ + if (FromIndex >= BitMapHeader->SizeOfBitMap) + { + *StartingRunIndex = FromIndex; + return 0; + } + /* Assume a set run first, count it's length */ Length = RtlpGetLengthOfRunSet(BitMapHeader, FromIndex, MAXULONG); *StartingRunIndex = FromIndex + Length; @@ -634,6 +641,13 @@ IN PULONG StartingRunIndex) { ULONG Length; + + /* Check for buffer overrun */ + if (FromIndex >= BitMapHeader->SizeOfBitMap) + { + *StartingRunIndex = FromIndex; + return 0; + } /* Assume a clear run first, count it's length */ Length = RtlpGetLengthOfRunClear(BitMapHeader, FromIndex, MAXULONG);
12 years, 6 months
1
0
0
0
[tkreuzer] 56793: [RTL] Fix a bug in RtlNumberOfSetBits
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 24 12:51:27 2012 New Revision: 56793 URL:
http://svn.reactos.org/svn/reactos?rev=56793&view=rev
Log: [RTL] Fix a bug in RtlNumberOfSetBits Modified: trunk/reactos/lib/rtl/bitmap.c Modified: trunk/reactos/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=56793…
============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun Jun 24 12:51:27 2012 @@ -410,16 +410,18 @@ IN PRTL_BITMAP BitMapHeader) { PUCHAR Byte, MaxByte; - ULONG BitCount = 0; + ULONG BitCount = 0, Shift; Byte = (PUCHAR)BitMapHeader->Buffer; - MaxByte = Byte + (BitMapHeader->SizeOfBitMap + 7) / 8; - - do + MaxByte = Byte + BitMapHeader->SizeOfBitMap / 8; + + while (Byte < MaxByte); { BitCount += BitCountTable[*Byte++]; } - while (Byte <= MaxByte); + + Shift = 8 - (BitMapHeader->SizeOfBitMap & 7); + BitCount += BitCountTable[(*Byte) << Shift]; return BitCount; }
12 years, 6 months
1
0
0
0
[tkreuzer] 56792: [RTL] bitmap.c: - hack away ASSERT() for now to fix tests - Optimize 64 bit builds - add BSD license
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sun Jun 24 11:32:11 2012 New Revision: 56792 URL:
http://svn.reactos.org/svn/reactos?rev=56792&view=rev
Log: [RTL] bitmap.c: - hack away ASSERT() for now to fix tests - Optimize 64 bit builds - add BSD license Modified: trunk/reactos/lib/rtl/bitmap.c Modified: trunk/reactos/lib/rtl/bitmap.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/bitmap.c?rev=56792…
============================================================================== --- trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/bitmap.c [iso-8859-1] Sun Jun 24 11:32:11 2012 @@ -1,6 +1,7 @@ /* - * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries + * LICENSE: GNU GPL - See COPYING in the top level directory + * BSD - See COPYING.ARM in the top level directory * FILE: lib/rtl/bitmap.c * PURPOSE: Bitmap functions * PROGRAMMER: Timo Kreuzer (timo.kreuzer(a)reactos.org) @@ -13,6 +14,9 @@ #define NDEBUG #include <debug.h> +// FIXME: hack +#undef ASSERT +#define ASSERT(...) /* DATA *********************************************************************/ @@ -150,6 +154,12 @@ { ULONG Position; +#ifdef _M_AMD64 + if (BitScanReverse64(&Position, Value)) + { + return (CCHAR)Position; + } +#else if (BitScanReverse(&Position, Value >> 32)) { return (CCHAR)(Position + 32); @@ -158,7 +168,7 @@ { return (CCHAR)Position; } - +#endif return -1; } @@ -168,6 +178,12 @@ { ULONG Position; +#ifdef _M_AMD64 + if (BitScanForward64(&Position, Value)) + { + return (CCHAR)Position; + } +#else if (BitScanForward(&Position, (ULONG)Value)) { return (CCHAR)Position; @@ -176,7 +192,7 @@ { return (CCHAR)(Position + 32); } - +#endif return -1; }
12 years, 6 months
1
0
0
0
[pschweitzer] 56791: [RTL] - Really implement RtlRandomEx and add its values table - Rename SavedValue to RtlpRandomConstantVector to allow RtlRandom & RtlRandomEx to have two different values tabl...
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Sun Jun 24 01:10:58 2012 New Revision: 56791 URL:
http://svn.reactos.org/svn/reactos?rev=56791&view=rev
Log: [RTL] - Really implement RtlRandomEx and add its values table - Rename SavedValue to RtlpRandomConstantVector to allow RtlRandom & RtlRandomEx to have two different values tables - Complete and fix documentation - Stop using magic values Modified: trunk/reactos/lib/rtl/random.c Modified: trunk/reactos/lib/rtl/random.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/random.c?rev=56791…
============================================================================== --- trunk/reactos/lib/rtl/random.c [iso-8859-1] (original) +++ trunk/reactos/lib/rtl/random.c [iso-8859-1] Sun Jun 24 01:10:58 2012 @@ -3,7 +3,8 @@ * PROJECT: ReactOS system libraries * PURPOSE: Random number generator functions * FILE: lib/rtl/random.c - * PROGRAMMER: + * PROGRAMMER: Wine + * Pierre Schweitzer (pierre(a)reactos.org) */ /* INCLUDES *****************************************************************/ @@ -13,47 +14,91 @@ #define NDEBUG #include <debug.h> -static ULONG SavedValue[128] = - { - 0x4c8bc0aa, 0x4c022957, 0x2232827a, 0x2f1e7626, /* 0 */ - 0x7f8bdafb, 0x5c37d02a, 0x0ab48f72, 0x2f0c4ffa, /* 4 */ - 0x290e1954, 0x6b635f23, 0x5d3885c0, 0x74b49ff8, /* 8 */ - 0x5155fa54, 0x6214ad3f, 0x111e9c29, 0x242a3a09, /* 12 */ - 0x75932ae1, 0x40ac432e, 0x54f7ba7a, 0x585ccbd5, /* 16 */ - 0x6df5c727, 0x0374dad1, 0x7112b3f1, 0x735fc311, /* 20 */ - 0x404331a9, 0x74d97781, 0x64495118, 0x323e04be, /* 24 */ - 0x5974b425, 0x4862e393, 0x62389c1d, 0x28a68b82, /* 28 */ - 0x0f95da37, 0x7a50bbc6, 0x09b0091c, 0x22cdb7b4, /* 32 */ - 0x4faaed26, 0x66417ccd, 0x189e4bfa, 0x1ce4e8dd, /* 36 */ - 0x5274c742, 0x3bdcf4dc, 0x2d94e907, 0x32eac016, /* 40 */ - 0x26d33ca3, 0x60415a8a, 0x31f57880, 0x68c8aa52, /* 44 */ - 0x23eb16da, 0x6204f4a1, 0x373927c1, 0x0d24eb7c, /* 48 */ - 0x06dd7379, 0x2b3be507, 0x0f9c55b1, 0x2c7925eb, /* 52 */ - 0x36d67c9a, 0x42f831d9, 0x5e3961cb, 0x65d637a8, /* 56 */ - 0x24bb3820, 0x4d08e33d, 0x2188754f, 0x147e409e, /* 60 */ - 0x6a9620a0, 0x62e26657, 0x7bd8ce81, 0x11da0abb, /* 64 */ - 0x5f9e7b50, 0x23e444b6, 0x25920c78, 0x5fc894f0, /* 68 */ - 0x5e338cbb, 0x404237fd, 0x1d60f80f, 0x320a1743, /* 72 */ - 0x76013d2b, 0x070294ee, 0x695e243b, 0x56b177fd, /* 76 */ - 0x752492e1, 0x6decd52f, 0x125f5219, 0x139d2e78, /* 80 */ - 0x1898d11e, 0x2f7ee785, 0x4db405d8, 0x1a028a35, /* 84 */ - 0x63f6f323, 0x1f6d0078, 0x307cfd67, 0x3f32a78a, /* 88 */ - 0x6980796c, 0x462b3d83, 0x34b639f2, 0x53fce379, /* 92 */ - 0x74ba50f4, 0x1abc2c4b, 0x5eeaeb8d, 0x335a7a0d, /* 96 */ - 0x3973dd20, 0x0462d66b, 0x159813ff, 0x1e4643fd, /* 100 */ - 0x06bc5c62, 0x3115e3fc, 0x09101613, 0x47af2515, /* 104 */ - 0x4f11ec54, 0x78b99911, 0x3db8dd44, 0x1ec10b9b, /* 108 */ - 0x5b5506ca, 0x773ce092, 0x567be81a, 0x5475b975, /* 112 */ - 0x7a2cde1a, 0x494536f5, 0x34737bb4, 0x76d9750b, /* 116 */ - 0x2a1f6232, 0x2e49644d, 0x7dddcbe7, 0x500cebdb, /* 120 */ - 0x619dab9e, 0x48c626fe, 0x1cda3193, 0x52dabe9d /* 124 */ - }; - +static ULONG RtlpRandomConstantVector[128] = +{ + 0x4c8bc0aa, 0x4c022957, 0x2232827a, 0x2f1e7626, /* 0 */ + 0x7f8bdafb, 0x5c37d02a, 0x0ab48f72, 0x2f0c4ffa, /* 4 */ + 0x290e1954, 0x6b635f23, 0x5d3885c0, 0x74b49ff8, /* 8 */ + 0x5155fa54, 0x6214ad3f, 0x111e9c29, 0x242a3a09, /* 12 */ + 0x75932ae1, 0x40ac432e, 0x54f7ba7a, 0x585ccbd5, /* 16 */ + 0x6df5c727, 0x0374dad1, 0x7112b3f1, 0x735fc311, /* 20 */ + 0x404331a9, 0x74d97781, 0x64495118, 0x323e04be, /* 24 */ + 0x5974b425, 0x4862e393, 0x62389c1d, 0x28a68b82, /* 28 */ + 0x0f95da37, 0x7a50bbc6, 0x09b0091c, 0x22cdb7b4, /* 32 */ + 0x4faaed26, 0x66417ccd, 0x189e4bfa, 0x1ce4e8dd, /* 36 */ + 0x5274c742, 0x3bdcf4dc, 0x2d94e907, 0x32eac016, /* 40 */ + 0x26d33ca3, 0x60415a8a, 0x31f57880, 0x68c8aa52, /* 44 */ + 0x23eb16da, 0x6204f4a1, 0x373927c1, 0x0d24eb7c, /* 48 */ + 0x06dd7379, 0x2b3be507, 0x0f9c55b1, 0x2c7925eb, /* 52 */ + 0x36d67c9a, 0x42f831d9, 0x5e3961cb, 0x65d637a8, /* 56 */ + 0x24bb3820, 0x4d08e33d, 0x2188754f, 0x147e409e, /* 60 */ + 0x6a9620a0, 0x62e26657, 0x7bd8ce81, 0x11da0abb, /* 64 */ + 0x5f9e7b50, 0x23e444b6, 0x25920c78, 0x5fc894f0, /* 68 */ + 0x5e338cbb, 0x404237fd, 0x1d60f80f, 0x320a1743, /* 72 */ + 0x76013d2b, 0x070294ee, 0x695e243b, 0x56b177fd, /* 76 */ + 0x752492e1, 0x6decd52f, 0x125f5219, 0x139d2e78, /* 80 */ + 0x1898d11e, 0x2f7ee785, 0x4db405d8, 0x1a028a35, /* 84 */ + 0x63f6f323, 0x1f6d0078, 0x307cfd67, 0x3f32a78a, /* 88 */ + 0x6980796c, 0x462b3d83, 0x34b639f2, 0x53fce379, /* 92 */ + 0x74ba50f4, 0x1abc2c4b, 0x5eeaeb8d, 0x335a7a0d, /* 96 */ + 0x3973dd20, 0x0462d66b, 0x159813ff, 0x1e4643fd, /* 100 */ + 0x06bc5c62, 0x3115e3fc, 0x09101613, 0x47af2515, /* 104 */ + 0x4f11ec54, 0x78b99911, 0x3db8dd44, 0x1ec10b9b, /* 108 */ + 0x5b5506ca, 0x773ce092, 0x567be81a, 0x5475b975, /* 112 */ + 0x7a2cde1a, 0x494536f5, 0x34737bb4, 0x76d9750b, /* 116 */ + 0x2a1f6232, 0x2e49644d, 0x7dddcbe7, 0x500cebdb, /* 120 */ + 0x619dab9e, 0x48c626fe, 0x1cda3193, 0x52dabe9d /* 124 */ +}; + +static ULONG RtlpRandomExConstantVector[128] = +{ + 0x4c8bc0aa, 0x51a0b326, 0x7112b3f1, 0x1b9ca4e1, /* 0 */ + 0x735fc311, 0x6fe48580, 0x320a1743, 0x494045ca, /* 4 */ + 0x103ad1c5, 0x4ba26e25, 0x62f1d304, 0x280d5677, /* 8 */ + 0x070294ee, 0x7acef21a, 0x62a407d5, 0x2dd36af5, /* 12 */ + 0x194f0f95, 0x1f21d7b4, 0x307cfd67, 0x66b9311e, /* 16 */ + 0x60415a8a, 0x5b264785, 0x3c28b0e4, 0x08faded7, /* 20 */ + 0x556175ce, 0x29c44179, 0x666f23c9, 0x65c057d8, /* 24 */ + 0x72b97abc, 0x7c3be3d0, 0x478e1753, 0x3074449b, /* 28 */ + 0x675ee842, 0x53f4c2de, 0x44d58949, 0x6426cf59, /* 32 */ + 0x111e9c29, 0x3aba68b9, 0x242a3a09, 0x50ddb118, /* 36 */ + 0x7f8bdafb, 0x089ebf23, 0x5c37d02a, 0x27db8ca6, /* 40 */ + 0x0ab48f72, 0x34995a4e, 0x189e4bfa, 0x2c405c36, /* 44 */ + 0x373927c1, 0x66c20c71, 0x5f991360, 0x67a38fa3, /* 48 */ + 0x4edc56aa, 0x25a59126, 0x34b639f2, 0x1679b2ce, /* 52 */ + 0x54f7ba7a, 0x319d28b5, 0x5155fa54, 0x769e6b87, /* 56 */ + 0x323e04be, 0x4565a5aa, 0x5974b425, 0x5c56a104, /* 60 */ + 0x25920c78, 0x362912dc, 0x7af3996f, 0x5feb9c87, /* 64 */ + 0x618361bf, 0x433fbe97, 0x0244da8e, 0x54e3c739, /* 68 */ + 0x33183689, 0x3533f398, 0x0d24eb7c, 0x06428590, /* 72 */ + 0x09101613, 0x53ce5c5a, 0x47af2515, 0x2e003f35, /* 76 */ + 0x15fb4ed5, 0x5e5925f4, 0x7f622ea7, 0x0bb6895f, /* 80 */ + 0x2173cdb6, 0x0467bb41, 0x2c4d19f1, 0x364712e1, /* 84 */ + 0x78b99911, 0x0a39a380, 0x3db8dd44, 0x6b4793b8, /* 88 */ + 0x09b0091c, 0x47ef52b0, 0x293cdcb3, 0x707b9e7b, /* 92 */ + 0x26d33ca3, 0x1e527faa, 0x3fe08625, 0x42560b04, /* 96 */ + 0x139d2e78, 0x0b558cdb, 0x28a68b82, 0x7ba3a51d, /* 100 */ + 0x52dabe9d, 0x59c3da1d, 0x5676cf9c, 0x152e972f, /* 104 */ + 0x6d8ac746, 0x5eb33591, 0x78b30601, 0x0ab68db0, /* 108 */ + 0x34737bb4, 0x1b6dd168, 0x76d9750b, 0x2ddc4ff2, /* 112 */ + 0x18a610cd, 0x2bacc08c, 0x422db55f, 0x169b89b6, /* 116 */ + 0x5274c742, 0x615535dd, 0x46ad005d, 0x4128f8dd, /* 120 */ + 0x29f5875c, 0x62c6f3ef, 0x2b3be507, 0x4a8e003f /* 124 */ +}; + +static ULONG RtlpRandomExAuxVarY = 0x7775fb16; + +#define LCG_A 0x7fffffed +#define LCG_C 0x7fffffc3 +#define LCG_M MAXLONG /************************************************************************* * RtlRandom [NTDLL.@] * - * Generates a random number + * Generates a random number. This is based on a LCG. + * This makes it not suitable for Monte Carlo simulations nor + * cryptographic applications. + * See LCG_A, LCG_C, LCG_M for parameters. * * PARAMS * Seed [O] The seed of the Random function @@ -73,15 +118,30 @@ PAGED_CODE_RTL(); - Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; - *Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; - Pos = *Seed & 0x7f; - Result = SavedValue[Pos]; - SavedValue[Pos] = Rand; + Rand = (*Seed * LCG_A + LCG_C) % LCG_M; + *Seed = (Rand * LCG_A + LCG_C) % LCG_M; + Pos = *Seed & (sizeof(RtlpRandomConstantVector) / sizeof(RtlpRandomConstantVector[0]) - 1); + Result = RtlpRandomConstantVector[Pos]; + RtlpRandomConstantVector[Pos] = Rand; return Result; } +/************************************************************************* + * RtlRandomEx [NTDLL.@] + * + * Generates a random number. This is based on a LCG. + * This makes it not suitable for Monte Carlo simulations nor + * cryptographic applications. + * This one is faster than RtlRandom. + * See LCG_A, LCG_C, LCG_M for parameters. + * + * PARAMS + * Seed [O] The seed of the Random function + * + * RETURNS + * It returns a random number distributed over [0..MAXLONG-1]. + */ /* * @implemented */ @@ -92,17 +152,16 @@ { ULONG Rand; int Pos; - ULONG Result; PAGED_CODE_RTL(); - Rand = (*Seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; - *Seed = (Rand * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; - Pos = *Seed & 0x7f; - Result = SavedValue[Pos]; - SavedValue[Pos] = Rand; - - return Result; + Pos = RtlpRandomExAuxVarY & (sizeof(RtlpRandomExConstantVector) / sizeof(RtlpRandomExConstantVector[0]) - 1); + RtlpRandomExAuxVarY = RtlpRandomExConstantVector[Pos]; + Rand = (*Seed * LCG_A + LCG_C) % LCG_M; + RtlpRandomExConstantVector[Pos] = Rand; + *Seed = Rand; + + return Rand; } @@ -119,12 +178,11 @@ * It returns a random number uniformly distributed over [0..MAXLONG-1]. * * NOTES - * Generates an uniform random number using D.H. Lehmer's 1948 algorithm. - * In our case the algorithm is: - * - * Result = (*Seed * 0x7fffffed + 0x7fffffc3) % MAXLONG; - * - * *Seed = Result; + * Generates an uniform random number using LCG. In spite of what + * MSDN states, this is an LCG and not a Lehmer RNG since C is defined. + * This makes it not suitable for Monte Carlo simulations nor + * cryptographic applications. + * See LCG_A, LCG_C, LCG_M for parameters. * * DIFFERENCES * The native documentation states that the random number is @@ -139,7 +197,7 @@ ULONG Result; /* Generate the random number */ - Result = (*Seed * 0x7fffffed + 0x7fffffc3) % MAXLONG; + Result = (*Seed * LCG_A + LCG_C) % LCG_M; /* Return it */ *Seed = Result;
12 years, 6 months
1
0
0
0
[tkreuzer] 56790: [MKHIVE] Fix 64 bit build
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jun 23 18:08:09 2012 New Revision: 56790 URL:
http://svn.reactos.org/svn/reactos?rev=56790&view=rev
Log: [MKHIVE] Fix 64 bit build Modified: trunk/reactos/tools/mkhive/mkhive.h Modified: trunk/reactos/tools/mkhive/mkhive.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/mkhive.h?rev=…
============================================================================== --- trunk/reactos/tools/mkhive/mkhive.h [iso-8859-1] (original) +++ trunk/reactos/tools/mkhive/mkhive.h [iso-8859-1] Sat Jun 23 18:08:09 2012 @@ -46,6 +46,11 @@ unsigned char BitScanForward(ULONG * Index, unsigned long Mask); unsigned char BitScanReverse(ULONG * const Index, unsigned long Mask); #define RtlFillMemoryUlong(dst, len, val) memset(dst, val, len) + +#ifdef _M_AMD64 +#define BitScanForward64 _BitScanForward64 +#define BitScanReverse64 _BitScanReverse64 +#endif NTSTATUS NTAPI RtlAnsiStringToUnicodeString(
12 years, 6 months
1
0
0
0
[tfaber] 56789: [WININET][WINHTTP] - Initialize Winsock before using getaddrinfo (and in general). Fixes test regressions from r56773. See issue #7135 for more details.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 23 16:40:24 2012 New Revision: 56789 URL:
http://svn.reactos.org/svn/reactos?rev=56789&view=rev
Log: [WININET][WINHTTP] - Initialize Winsock before using getaddrinfo (and in general). Fixes test regressions from r56773. See issue #7135 for more details. Modified: trunk/reactos/dll/win32/winhttp/session.c trunk/reactos/dll/win32/wininet/internet.c trunk/reactos/dll/win32/wininet/wininet_ros.diff Modified: trunk/reactos/dll/win32/winhttp/session.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winhttp/session.…
============================================================================== --- trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winhttp/session.c [iso-8859-1] Sat Jun 23 16:40:24 2012 @@ -91,6 +91,9 @@ heap_free( session->proxy_username ); heap_free( session->proxy_password ); heap_free( session ); +#ifdef __REACTOS__ + WSACleanup(); +#endif } static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen ) @@ -199,6 +202,11 @@ { session_t *session; HINTERNET handle = NULL; +#ifdef __REACTOS__ + WSADATA wsaData; + int error = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (error) ERR("WSAStartup failed: %d\n", error); +#endif TRACE("%s, %u, %s, %s, 0x%08x\n", debugstr_w(agent), access, debugstr_w(proxy), debugstr_w(bypass), flags); Modified: trunk/reactos/dll/win32/wininet/internet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/internet…
============================================================================== --- trunk/reactos/dll/win32/wininet/internet.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/internet.c [iso-8859-1] Sat Jun 23 16:40:24 2012 @@ -747,6 +747,9 @@ heap_free(lpwai->proxyBypass); heap_free(lpwai->proxyUsername); heap_free(lpwai->proxyPassword); +#ifdef __REACTOS__ + WSACleanup(); +#endif } static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) @@ -908,6 +911,11 @@ LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags) { appinfo_t *lpwai = NULL; +#ifdef __REACTOS__ + WSADATA wsaData; + int error = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (error) ERR("WSAStartup failed: %d\n", error); +#endif if (TRACE_ON(wininet)) { #define FE(x) { x, #x } Modified: trunk/reactos/dll/win32/wininet/wininet_ros.diff URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wininet/wininet_…
============================================================================== --- trunk/reactos/dll/win32/wininet/wininet_ros.diff [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wininet/wininet_ros.diff [iso-8859-1] Sat Jun 23 16:40:24 2012 @@ -1,5 +1,5 @@ --- wine-1.5.4/dlls/wininet/internet.h 2012-06-20 14:38:39 +0200 -+++ dll/win32/wininet/internet.h 2012-06-20 16:49:05 +0200 ++++ dll/win32/wininet/internet.h 2012-06-23 17:25:14 +0200 @@ -536,7 +536,30 @@ BOOL NETCON_is_alive(netconn_t*) DECLSPE LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN; @@ -71,7 +71,7 @@ /****************************************************************************** * NETCON_secure_connect --- wine-1.5.4/dlls/wininet/internet.c 2012-06-20 14:38:38 +0200 -+++ dll/win32/wininet/internet.c 2012-06-20 15:50:05 +0200 ++++ dll/win32/wininet/internet.c 2012-06-23 17:45:14 +0200 @@ -292,7 +292,9 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, if (g_dwTlsErrIndex == TLS_OUT_OF_INDEXES) return FALSE; @@ -82,7 +82,29 @@ WININET_hModule = hinstDLL; break; -@@ -3716,19 +3718,23 @@ LPSTR INTERNET_GetResponseBuffer(void) +@@ -745,6 +747,9 @@ static VOID APPINFO_Destroy(object_heade + heap_free(lpwai->proxyBypass); + heap_free(lpwai->proxyUsername); + heap_free(lpwai->proxyPassword); ++#ifdef __REACTOS__ ++ WSACleanup(); ++#endif + } + + static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) +@@ -906,6 +911,11 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR l + LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags) + { + appinfo_t *lpwai = NULL; ++#ifdef __REACTOS__ ++ WSADATA wsaData; ++ int error = WSAStartup(MAKEWORD(2, 2), &wsaData); ++ if (error) ERR("WSAStartup failed: %d\n", error); ++#endif + + if (TRACE_ON(wininet)) { + #define FE(x) { x, #x } +@@ -3716,19 +3726,23 @@ LPSTR INTERNET_GetResponseBuffer(void) LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen) {
12 years, 6 months
1
0
0
0
[tkreuzer] 56788: [CMAKE] - Fix issues with newer cmake versions (brought to you by Amine) - Add support for ninja to configure script
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Sat Jun 23 16:09:11 2012 New Revision: 56788 URL:
http://svn.reactos.org/svn/reactos?rev=56788&view=rev
Log: [CMAKE] - Fix issues with newer cmake versions (brought to you by Amine) - Add support for ninja to configure script Modified: trunk/reactos/CMakeLists.txt trunk/reactos/configure.cmd Modified: trunk/reactos/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/CMakeLists.txt?rev=56788&r…
============================================================================== --- trunk/reactos/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/CMakeLists.txt [iso-8859-1] Sat Jun 23 16:09:11 2012 @@ -14,6 +14,9 @@ # Don't escape preprocessor definition values added via add_definitions cmake_policy(SET CMP0005 OLD) cmake_policy(SET CMP0002 NEW) +if(POLICY CMP0018) + cmake_policy(SET CMP0018 OLD) +endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) @@ -48,7 +51,7 @@ if(MSVC) if(ARCH MATCHES i386) - add_definitions(/DWIN32 /D_WINDOWS) + add_definitions(/D_X86_ /DWIN32 /D_WINDOWS) endif() add_definitions(/Dinline=__inline) else() Modified: trunk/reactos/configure.cmd URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/configure.cmd?rev=56788&r1…
============================================================================== --- trunk/reactos/configure.cmd [iso-8859-1] (original) +++ trunk/reactos/configure.cmd [iso-8859-1] Sat Jun 23 16:09:11 2012 @@ -16,6 +16,8 @@ set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles" ) else if /I "%1" == "Eclipse" ( set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles" + ) else if /I "%1" == "Ninja" ( + set CMAKE_GENERATOR="Ninja" ) else ( set CMAKE_GENERATOR="MinGW Makefiles" ) @@ -106,6 +108,8 @@ set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles" ) else if /I "%1" == "JOM" ( set CMAKE_GENERATOR="NMake Makefiles JOM" + ) else if /I "%1" == "Ninja" ( + set CMAKE_GENERATOR="Ninja" ) else ( set CMAKE_GENERATOR="NMake Makefiles" )
12 years, 6 months
1
0
0
0
[tfaber] 56787: [WS2_32_APITEST] - Add a test for basic functionality of getaddrinfo
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Jun 23 12:40:36 2012 New Revision: 56787 URL:
http://svn.reactos.org/svn/reactos?rev=56787&view=rev
Log: [WS2_32_APITEST] - Add a test for basic functionality of getaddrinfo Added: trunk/rostests/apitests/ws2_32/getaddrinfo.c (with props) Modified: trunk/rostests/apitests/ws2_32/CMakeLists.txt trunk/rostests/apitests/ws2_32/testlist.c Modified: trunk/rostests/apitests/ws2_32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/CMakeList…
============================================================================== --- trunk/rostests/apitests/ws2_32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/ws2_32/CMakeLists.txt [iso-8859-1] Sat Jun 23 12:40:36 2012 @@ -1,14 +1,13 @@ - -add_definitions(-D_DLL -D__USE_CRTIMP) list(APPEND SOURCE + getaddrinfo.c helpers.c ioctlsocket.c recv.c testlist.c) add_executable(ws2_32_apitest ${SOURCE}) -target_link_libraries(ws2_32_apitest wine) +target_link_libraries(ws2_32_apitest wine ${PSEH_LIB}) set_module_type(ws2_32_apitest win32cui) add_importlibs(ws2_32_apitest ws2_32 msvcrt kernel32 ntdll) add_cd_file(TARGET ws2_32_apitest DESTINATION reactos/bin FOR all) Added: trunk/rostests/apitests/ws2_32/getaddrinfo.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/getaddrin…
============================================================================== --- trunk/rostests/apitests/ws2_32/getaddrinfo.c (added) +++ trunk/rostests/apitests/ws2_32/getaddrinfo.c [iso-8859-1] Sat Jun 23 12:40:36 2012 @@ -1,0 +1,264 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for getaddrinfo + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#define WIN32_NO_STATUS +#include <winsock2.h> +#include <ws2tcpip.h> +#include <wine/test.h> +#include <pseh/pseh2.h> +#include <ndk/umtypes.h> + +#define StartSeh() ExceptionStatus = STATUS_SUCCESS; _SEH2_TRY { +#define EndSeh(ExpectedStatus) } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { ExceptionStatus = _SEH2_GetExceptionCode(); } _SEH2_END; ok(ExceptionStatus == ExpectedStatus, "Exception %lx, expected %lx\n", ExceptionStatus, ExpectedStatus) + +#define ok_addrinfo(ai, flags, family, socktype, protocol, addrlen) do \ +{ \ + ok_hex((ai)->ai_flags, flags); \ + ok_dec((ai)->ai_family, family); \ + ok_dec((ai)->ai_socktype, socktype); \ + ok_dec((ai)->ai_protocol, protocol); \ + ok_dec((ai)->ai_addrlen, addrlen); \ +} while (0) + +#define ok_sockaddr_in(sockaddr, family, port, addr) do \ +{ \ + int _i; \ + ok_dec(((SOCKADDR_IN *)(sockaddr))->sin_family, family); \ + ok_dec(ntohs(((SOCKADDR_IN *)(sockaddr))->sin_port), port); \ + ok_hex(((SOCKADDR_IN *)(sockaddr))->sin_addr.S_un.S_addr, \ + inet_addr(addr)); \ + for (_i = 0; _i < 7; _i++) \ + ok_dec(((SOCKADDR_IN *)(sockaddr))->sin_zero[_i], 0); \ +} while (0) + +#define InvalidPointer ((PVOID)0x5555555555555555ULL) + +CHAR LocalAddress[sizeof("255.255.255.255")]; + +static +VOID +TestNodeName(VOID) +{ + int Error; + PADDRINFOA AddrInfo; + ADDRINFOA Hints; + NTSTATUS ExceptionStatus; + struct + { + PCSTR NodeName; + PCSTR ExpectedAddress; + INT Flags; + } Tests[] = + { + { "", LocalAddress }, + { " ", NULL }, + { "
doesntexist.reactos.org
", NULL }, + { "localhost", "127.0.0.1" }, + { "localhost:80", NULL }, + { "7.8.9.10", "7.8.9.10", AI_NUMERICHOST }, + { "0.0.0.0", "0.0.0.0", AI_NUMERICHOST }, + { "255.255.255.255", "255.255.255.255", AI_NUMERICHOST }, + { "0.0.0.0 ", "0.0.0.0", /* no AI_NUMERICHOST */ }, + { "0.0.0.0:80", NULL }, + { "0.0.0.0.0", NULL }, + { "1.1.1.256", NULL }, + /* let's just assume this one doesn't change any time soon ;) */ + { "
google-public-dns-a.google.com
", "8.8.8.8" }, + }; + const INT TestCount = sizeof(Tests) / sizeof(Tests[0]); + INT i; + + /* make sure we don't get IPv6 responses */ + ZeroMemory(&Hints, sizeof(Hints)); + Hints.ai_family = AF_INET; + + trace("Nodes\n"); + for (i = 0; i < TestCount; i++) + { + trace("%d: '%s'\n", i, Tests[i].NodeName); + StartSeh(); + AddrInfo = InvalidPointer; + Error = getaddrinfo(Tests[i].NodeName, NULL, &Hints, &AddrInfo); + if (Tests[i].ExpectedAddress) + { + ok_dec(Error, 0); + ok_dec(WSAGetLastError(), 0); + ok(AddrInfo != NULL && AddrInfo != InvalidPointer, + "AddrInfo = %p\n", AddrInfo); + } + else + { + ok_dec(Error, WSAHOST_NOT_FOUND); + ok_dec(WSAGetLastError(), WSAHOST_NOT_FOUND); + ok_ptr(AddrInfo, NULL); + } + if (!Error && AddrInfo && AddrInfo != InvalidPointer) + { + ok_addrinfo(AddrInfo, Tests[i].Flags, AF_INET, + 0, 0, sizeof(SOCKADDR_IN)); + ok_ptr(AddrInfo->ai_canonname, NULL); + ok_sockaddr_in(AddrInfo->ai_addr, AF_INET, + 0, Tests[i].ExpectedAddress); + ok_ptr(AddrInfo->ai_next, NULL); + freeaddrinfo(AddrInfo); + } + EndSeh(STATUS_SUCCESS); + } +} + +static +VOID +TestServiceName(VOID) +{ + int Error; + PADDRINFOA AddrInfo; + ADDRINFOA Hints; + NTSTATUS ExceptionStatus; + struct + { + PCSTR ServiceName; + INT ExpectedPort; + INT SockType; + } Tests[] = + { + { "", 0 }, + { "0", 0 }, + { "1", 1 }, + { "a", -1 }, + { "010", 10 }, + { "0x1a", -1 }, + { "http", 80, SOCK_STREAM }, + { "smtp", 25, SOCK_STREAM }, + { "mail", 25, SOCK_STREAM }, /* alias for smtp */ + { "router", 520, SOCK_DGRAM }, + { "domain", 53, 0 /* DNS supports both UDP and TCP */ }, + { ":0", -1 }, + { "123", 123 }, + { " 123", 123 }, + { " 123", 123 }, + { "32767", 32767 }, + { "32768", 32768 }, + { "65535", 65535 }, + { "65536", 0 }, + { "65537", 1 }, + { "65540", 4 }, + { "65536", 0 }, + { "4294967295", 65535 }, + { "4294967296", 65535 }, + { "9999999999", 65535 }, + { "999999999999999999999999999999999999", 65535 }, + { "+5", 5 }, + { "-1", 65535 }, + { "-4", 65532 }, + { "-65534", 2 }, + { "-65535", 1 }, + { "-65536", 0 }, + { "-65537", 65535 }, + { "28a", -1 }, + { "28 ", -1 }, + { "a28", -1 }, + }; + const INT TestCount = sizeof(Tests) / sizeof(Tests[0]); + INT i; + + /* make sure we don't get IPv6 responses */ + ZeroMemory(&Hints, sizeof(Hints)); + Hints.ai_family = AF_INET; + + trace("Services\n"); + for (i = 0; i < TestCount; i++) + { + trace("%d: '%s'\n", i, Tests[i].ServiceName); + StartSeh() + AddrInfo = InvalidPointer; + Error = getaddrinfo(NULL, Tests[i].ServiceName, &Hints, &AddrInfo); + if (Tests[i].ExpectedPort != -1) + { + ok_dec(Error, 0); + ok_dec(WSAGetLastError(), 0); + ok(AddrInfo != NULL && AddrInfo != InvalidPointer, + "AddrInfo = %p\n", AddrInfo); + } + else + { + ok_dec(Error, WSATYPE_NOT_FOUND); + ok_dec(WSAGetLastError(), WSATYPE_NOT_FOUND); + ok_ptr(AddrInfo, NULL); + } + if (!Error && AddrInfo && AddrInfo != InvalidPointer) + { + ok_addrinfo(AddrInfo, 0, AF_INET, + Tests[i].SockType, 0, sizeof(SOCKADDR_IN)); + ok_ptr(AddrInfo->ai_canonname, NULL); + ok_sockaddr_in(AddrInfo->ai_addr, AF_INET, + Tests[i].ExpectedPort, "127.0.0.1"); + ok_ptr(AddrInfo->ai_next, NULL); + freeaddrinfo(AddrInfo); + } + EndSeh(STATUS_SUCCESS); + } +} + +START_TEST(getaddrinfo) +{ + WSADATA WsaData; + int Error; + PADDRINFOA AddrInfo; + ADDRINFOA Hints; + NTSTATUS ExceptionStatus; + CHAR LocalHostName[128]; + struct hostent *Hostent; + + /* not yet initialized */ + Error = getaddrinfo("127.0.0.1", "80", NULL, &AddrInfo); + ok_dec(Error, WSANOTINITIALISED); + + Error = WSAStartup(MAKEWORD(2, 2), &WsaData); + ok_dec(Error, 0); + + /* initialize LocalAddress for tests */ + Error = gethostname(LocalHostName, sizeof(LocalHostName)); + ok_dec(Error, 0); + ok_dec(WSAGetLastError(), 0); + trace("Local host name is '%s'\n", LocalHostName); + Hostent = gethostbyname(LocalHostName); + ok(Hostent != NULL, "gethostbyname failed with %d\n", WSAGetLastError()); + if (Hostent && Hostent->h_addr_list[0] && Hostent->h_length == sizeof(IN_ADDR)) + { + IN_ADDR Address; + memcpy(&Address, Hostent->h_addr_list[0], sizeof(Address)); + strcpy(LocalAddress, inet_ntoa(Address)); + } + trace("Local address is '%s'\n", LocalAddress); + ok(LocalAddress[0] != '\0', + "Could not determine local address. Following test results may be wrong.\n"); + + ZeroMemory(&Hints, sizeof(Hints)); + /* parameter tests */ + StartSeh(); getaddrinfo(NULL, NULL, NULL, NULL); EndSeh(STATUS_ACCESS_VIOLATION); + StartSeh(); getaddrinfo("", "", &Hints, NULL); EndSeh(STATUS_ACCESS_VIOLATION); + StartSeh(); + AddrInfo = InvalidPointer; + Error = getaddrinfo(NULL, NULL, NULL, &AddrInfo); + ok_dec(Error, WSAHOST_NOT_FOUND); + ok_dec(WSAGetLastError(), WSAHOST_NOT_FOUND); + ok_ptr(AddrInfo, NULL); + EndSeh(STATUS_SUCCESS); + + TestNodeName(); + TestServiceName(); + /* TODO: test passing both node name and service name */ + /* TODO: test hints */ + /* TODO: test IPv6 */ + + Error = WSACleanup(); + ok_dec(Error, 0); + + /* not initialized anymore */ + Error = getaddrinfo("127.0.0.1", "80", NULL, &AddrInfo); + ok_dec(Error, WSANOTINITIALISED); +} Propchange: trunk/rostests/apitests/ws2_32/getaddrinfo.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/ws2_32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/ws2_32/testlist.…
============================================================================== --- trunk/rostests/apitests/ws2_32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/ws2_32/testlist.c [iso-8859-1] Sat Jun 23 12:40:36 2012 @@ -5,11 +5,13 @@ #define STANDALONE #include "wine/test.h" +extern void func_getaddrinfo(void); extern void func_ioctlsocket(void); extern void func_recv(void); const struct test winetest_testlist[] = { + { "getaddrinfo", func_getaddrinfo }, { "ioctlsocket", func_ioctlsocket }, { "recv", func_recv },
12 years, 6 months
1
0
0
0
[ekohl] 56786: [SAMLIB][SAMSRV] Prevent multiple declarations of SAM types.
by ekohl@svn.reactos.org
Author: ekohl Date: Sat Jun 23 10:29:20 2012 New Revision: 56786 URL:
http://svn.reactos.org/svn/reactos?rev=56786&view=rev
Log: [SAMLIB][SAMSRV] Prevent multiple declarations of SAM types. Modified: trunk/reactos/include/reactos/idl/sam.idl Modified: trunk/reactos/include/reactos/idl/sam.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/idl/sam.id…
============================================================================== --- trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] (original) +++ trunk/reactos/include/reactos/idl/sam.idl [iso-8859-1] Sat Jun 23 10:29:20 2012 @@ -396,10 +396,11 @@ [case(GroupReplicationInformation)] SAMPR_GROUP_GENERAL_INFORMATION DoNotUse; } SAMPR_GROUP_INFO_BUFFER, *PSAMPR_GROUP_INFO_BUFFER; +cpp_quote("#ifndef _NTSAM_") typedef struct _SAMPR_ALIAS_GENERAL_INFORMATION { RPC_UNICODE_STRING Name; - unsigned long MemberCount; + ULONG MemberCount; RPC_UNICODE_STRING AdminComment; } SAMPR_ALIAS_GENERAL_INFORMATION, *PSAMPR_ALIAS_GENERAL_INFORMATION; @@ -419,6 +420,7 @@ AliasNameInformation, AliasAdminCommentInformation, } ALIAS_INFORMATION_CLASS; +cpp_quote("#endif") typedef [switch_type(ALIAS_INFORMATION_CLASS)] union _SAMPR_ALIAS_INFO_BUFFER {
12 years, 6 months
1
0
0
0
← Newer
1
2
3
4
5
6
...
12
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
Results per page:
10
25
50
100
200