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
October 2018
----- 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
21 participants
354 discussions
Start a n
N
ew thread
03/03: [KMTESTS:CC] Properly check for memory allocations
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c467169708160efd4f6df…
commit c467169708160efd4f6df845b1f72431f3488509 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Oct 13 19:17:00 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Oct 13 19:17:00 2018 +0200 [KMTESTS:CC] Properly check for memory allocations --- modules/rostests/kmtests/ntos_cc/CcMapData_drv.c | 2 +- modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c index 16de38cfbf..5f7dc93469 100644 --- a/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcMapData_drv.c @@ -287,7 +287,7 @@ PerformTest( PTEST_CONTEXT TestContext; TestContext = ExAllocatePool(NonPagedPool, sizeof(TEST_CONTEXT)); - if (!skip(Fcb != NULL, "ExAllocatePool failed\n")) + if (!skip(TestContext != NULL, "ExAllocatePool failed\n")) { Ret = FALSE; Offset.QuadPart = 0x1000; diff --git a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c index 26ae0edf8c..369d105742 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinRead_drv.c @@ -404,7 +404,7 @@ PerformTest( PTEST_CONTEXT TestContext; TestContext = ExAllocatePool(NonPagedPool, sizeof(TEST_CONTEXT)); - if (!skip(Fcb != NULL, "ExAllocatePool failed\n")) + if (!skip(TestContext != NULL, "ExAllocatePool failed\n")) { Ret = FALSE; Offset.QuadPart = 0x1000;
6 years, 2 months
1
0
0
0
02/03: [KMTESTS:CC] Add more tests for CcPinMappedData()
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ce0650d37dd3c22acb7e8…
commit ce0650d37dd3c22acb7e84fc989a911828833a5d Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Oct 13 19:15:48 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Oct 13 19:15:48 2018 +0200 [KMTESTS:CC] Add more tests for CcPinMappedData() --- .../rostests/kmtests/ntos_cc/CcPinMappedData_drv.c | 30 ++++++++++++++++++++++ .../kmtests/ntos_cc/CcPinMappedData_user.c | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c index 89b348fe71..1a41bf144f 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c @@ -353,6 +353,36 @@ PerformTest( ExFreePool(TestContext); } } + else if (TestId == 3) + { + Ret = FALSE; + Offset.QuadPart = 0; + KmtStartSeh(); + Ret = CcMapData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcMapData failed\n")) + { + Ret = FALSE; + PinBcb = Bcb; + ok_eq_ulong(Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE); + + KmtStartSeh(); + Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_IF_BCB, &PinBcb); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == FALSE, "CcPinMappedData succeed\n")) + { + ok_eq_pointer(Bcb, PinBcb); + } + else + { + Bcb = PinBcb; + } + + CcUnpinData(Bcb); + } + } } } } diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c index 14bc2aa5e9..21fe904bb9 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c @@ -19,7 +19,7 @@ START_TEST(CcPinMappedData) KmtOpenDriver(); /* 1 basic test */ - for (TestId = 0; TestId < 3; ++TestId) + for (TestId = 0; TestId < 4; ++TestId) { Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId); ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);
6 years, 2 months
1
0
0
0
01/03: [KMTESTS:CC] Add more tests for CcPinMappedData()
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e3531499c25d1ce48139f…
commit e3531499c25d1ce48139fd600f0bba8cf1f3a46e Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Oct 13 19:13:07 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Oct 13 19:13:07 2018 +0200 [KMTESTS:CC] Add more tests for CcPinMappedData() --- .../rostests/kmtests/ntos_cc/CcPinMappedData_drv.c | 100 ++++++++++++++++++++- .../kmtests/ntos_cc/CcPinMappedData_user.c | 2 +- 2 files changed, 100 insertions(+), 2 deletions(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c index 06cbc95987..89b348fe71 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c @@ -23,7 +23,7 @@ typedef struct _TEST_FCB typedef struct _TEST_CONTEXT { PVOID Bcb; - PVOID Buffer; + PULONG Buffer; ULONG Length; } TEST_CONTEXT, *PTEST_CONTEXT; @@ -144,6 +144,74 @@ MapAndLockUserBuffer( return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); } +static +VOID +NTAPI +PinInAnotherThreadExclusive(IN PVOID Context) +{ + BOOLEAN Ret; + PULONG Buffer; + PVOID Bcb, PinBcb; + LARGE_INTEGER Offset; + PTEST_CONTEXT TestContext; + + ok(TestFileObject != NULL, "Called in invalid context!\n"); + ok_eq_ulong(TestTestId, 2); + + TestContext = Context; + ok(TestContext != NULL, "Called in invalid context!\n"); + ok(TestContext->Bcb != NULL, "Called in invalid context!\n"); + ok(TestContext->Buffer != NULL, "Called in invalid context!\n"); + ok(TestContext->Length != 0, "Called in invalid context!\n"); + + Ret = FALSE; + Offset.QuadPart = 0; + + KmtStartSeh(); + Ret = CcMapData(TestFileObject, &Offset, TestContext->Length, MAP_WAIT, &Bcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcMapData failed\n")) + { + ok(Bcb != TestContext->Bcb, "Returned same BCB!\n"); + ok_eq_pointer(Buffer, TestContext->Buffer); + + Ret = FALSE; + PinBcb = Bcb; + + KmtStartSeh(); + Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_EXCLUSIVE, &PinBcb); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == FALSE, "CcPinMappedData succeed\n")) + { + ok_eq_pointer(PinBcb, Bcb); + + Ret = FALSE; + PinBcb = Bcb; + + KmtStartSeh(); + Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, 0, &PinBcb); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == FALSE, "CcPinMappedData succeed\n")) + { + ok_eq_pointer(PinBcb, Bcb); + } + else + { + Bcb = PinBcb; + } + } + else + { + Bcb = PinBcb; + } + + CcUnpinData(Bcb); + } +} + static VOID PerformTest( @@ -255,6 +323,36 @@ PerformTest( CcUnpinData(PinBcb); } } + else if (TestId == 2) + { + PTEST_CONTEXT TestContext; + + TestContext = ExAllocatePool(NonPagedPool, sizeof(TEST_CONTEXT)); + if (!skip(TestContext != NULL, "ExAllocatePool failed\n")) + { + Ret = FALSE; + Offset.QuadPart = 0; + KmtStartSeh(); + Ret = CcPinRead(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT | PIN_EXCLUSIVE, &TestContext->Bcb, (PVOID *)&TestContext->Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcPinRead failed\n")) + { + PKTHREAD ThreadHandle; + + ok(*(PUSHORT)TestContext->Bcb == 0x2FD, "Not a BCB: %x\n", *(PUSHORT)TestContext->Bcb); + ok_eq_ulong(TestContext->Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE); + + TestContext->Length = FileSizes.FileSize.QuadPart - Offset.QuadPart; + ThreadHandle = KmtStartThread(PinInAnotherThreadExclusive, TestContext); + KmtFinishThread(ThreadHandle, NULL); + + CcUnpinData(TestContext->Bcb); + } + + ExFreePool(TestContext); + } + } } } } diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c index 095d55ed1d..14bc2aa5e9 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c @@ -19,7 +19,7 @@ START_TEST(CcPinMappedData) KmtOpenDriver(); /* 1 basic test */ - for (TestId = 0; TestId < 2; ++TestId) + for (TestId = 0; TestId < 3; ++TestId) { Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId); ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);
6 years, 2 months
1
0
0
0
01/01: [KMTESTS:CC] Add more tests for CcPinMappedData()
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=991db73e375af22102151…
commit 991db73e375af22102151a585974652b4061d798 Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Oct 13 18:53:08 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Oct 13 18:53:08 2018 +0200 [KMTESTS:CC] Add more tests for CcPinMappedData() --- .../rostests/kmtests/ntos_cc/CcPinMappedData_drv.c | 48 +++++++++++++++++++++- .../kmtests/ntos_cc/CcPinMappedData_user.c | 2 +- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c index 5f52301cce..06cbc95987 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c @@ -150,7 +150,7 @@ PerformTest( ULONG TestId, PDEVICE_OBJECT DeviceObject) { - PVOID Bcb, PinBcb; + PVOID Bcb, PinBcb, NewBcb; BOOLEAN Ret; PULONG Buffer; PTEST_FCB Fcb; @@ -184,7 +184,7 @@ PerformTest( if (TestId == 0) { Ret = FALSE; - Offset.QuadPart = TestId * 0x1000; + Offset.QuadPart = 0; KmtStartSeh(); Ret = CcMapData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer); KmtEndSeh(STATUS_SUCCESS); @@ -211,6 +211,50 @@ PerformTest( CcUnpinData(Bcb); } } + else if (TestId == 1) + { + Ret = FALSE; + Offset.QuadPart = 0; + KmtStartSeh(); + Ret = CcPinRead(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &PinBcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcPinRead failed\n")) + { + ok(*(PUSHORT)PinBcb == 0x2FD, "Not a BCB: %x\n", *(PUSHORT)PinBcb); + ok_eq_ulong(Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE); + + Ret = FALSE; + KmtStartSeh(); + Ret = CcMapData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcMapData failed\n")) + { + ok(Bcb != PinBcb, "Returned same BCB!\n"); + + Ret = FALSE; + NewBcb = Bcb; + KmtStartSeh(); + Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &NewBcb); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcPinMappedData failed\n")) + { + ok(Bcb != NewBcb, "Returned same BCB!\n"); + ok_eq_pointer(NewBcb, PinBcb); + ok(*(PUSHORT)NewBcb == 0x2FD, "Not a BCB: %x\n", *(PUSHORT)NewBcb); + + /* Previous BCB isn't valid anymore! */ + Bcb = NewBcb; + } + + CcUnpinData(Bcb); + } + + CcUnpinData(PinBcb); + } + } } } } diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c index df3cc320a2..095d55ed1d 100644 --- a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c @@ -19,7 +19,7 @@ START_TEST(CcPinMappedData) KmtOpenDriver(); /* 1 basic test */ - for (TestId = 0; TestId < 1; ++TestId) + for (TestId = 0; TestId < 2; ++TestId) { Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId); ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret);
6 years, 2 months
1
0
0
0
01/01: [KMTESTS:CC] Add a test showing our CcPinMappedData() implementation is broken
by Pierre Schweitzer
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45231fbbc55a91d67d4eb…
commit 45231fbbc55a91d67d4ebeec990edf9d9118355c Author: Pierre Schweitzer <pierre(a)reactos.org> AuthorDate: Sat Oct 13 14:23:38 2018 +0200 Commit: Pierre Schweitzer <pierre(a)reactos.org> CommitDate: Sat Oct 13 14:24:52 2018 +0200 [KMTESTS:CC] Add a test showing our CcPinMappedData() implementation is broken --- modules/rostests/kmtests/CMakeLists.txt | 1 + modules/rostests/kmtests/kmtest/testlist.c | 2 + modules/rostests/kmtests/ntos_cc/CMakeLists.txt | 15 + .../rostests/kmtests/ntos_cc/CcPinMappedData_drv.c | 366 +++++++++++++++++++++ .../kmtests/ntos_cc/CcPinMappedData_user.c | 32 ++ 5 files changed, 416 insertions(+) diff --git a/modules/rostests/kmtests/CMakeLists.txt b/modules/rostests/kmtests/CMakeLists.txt index 51407959c4..623188e913 100644 --- a/modules/rostests/kmtests/CMakeLists.txt +++ b/modules/rostests/kmtests/CMakeLists.txt @@ -137,6 +137,7 @@ list(APPEND KMTEST_SOURCE kernel32/FindFile_user.c ntos_cc/CcCopyRead_user.c ntos_cc/CcMapData_user.c + ntos_cc/CcPinMappedData_user.c ntos_cc/CcPinRead_user.c ntos_io/IoCreateFile_user.c ntos_io/IoDeviceObject_user.c diff --git a/modules/rostests/kmtests/kmtest/testlist.c b/modules/rostests/kmtests/kmtest/testlist.c index a0ede71368..5b5b65364b 100644 --- a/modules/rostests/kmtests/kmtest/testlist.c +++ b/modules/rostests/kmtests/kmtest/testlist.c @@ -8,6 +8,7 @@ KMT_TESTFUNC Test_CcCopyRead; KMT_TESTFUNC Test_CcMapData; +KMT_TESTFUNC Test_CcPinMappedData; KMT_TESTFUNC Test_CcPinRead; KMT_TESTFUNC Test_Example; KMT_TESTFUNC Test_FileAttributes; @@ -38,6 +39,7 @@ const KMT_TEST TestList[] = { { "CcCopyRead", Test_CcCopyRead }, { "CcMapData", Test_CcMapData }, + { "CcPinMappedData", Test_CcPinMappedData }, { "CcPinRead", Test_CcPinRead }, { "-Example", Test_Example }, { "FileAttributes", Test_FileAttributes }, diff --git a/modules/rostests/kmtests/ntos_cc/CMakeLists.txt b/modules/rostests/kmtests/ntos_cc/CMakeLists.txt index 83d2317a75..3357f19e68 100644 --- a/modules/rostests/kmtests/ntos_cc/CMakeLists.txt +++ b/modules/rostests/kmtests/ntos_cc/CMakeLists.txt @@ -31,6 +31,21 @@ add_target_compile_definitions(ccmapdata_drv KMT_STANDALONE_DRIVER) #add_pch(ccmapdata_drv ../include/kmt_test.h) add_rostests_file(TARGET ccmapdata_drv) +# +# CcPinMappedData +# +list(APPEND CCPINMAPPEDDATA_DRV_SOURCE + ../kmtest_drv/kmtest_standalone.c + CcPinMappedData_drv.c) + +add_library(ccpinmappeddata_drv SHARED ${CCPINMAPPEDDATA_DRV_SOURCE}) +set_module_type(ccpinmappeddata_drv kernelmodedriver) +target_link_libraries(ccpinmappeddata_drv kmtest_printf ${PSEH_LIB}) +add_importlibs(ccpinmappeddata_drv ntoskrnl hal) +add_target_compile_definitions(ccpinmappeddata_drv KMT_STANDALONE_DRIVER) +#add_pch(ccpinmappeddata_drv ../include/kmt_test.h) +add_rostests_file(TARGET ccpinmappeddata_drv) + # # CcPinRead # diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c new file mode 100644 index 0000000000..5f52301cce --- /dev/null +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_drv.c @@ -0,0 +1,366 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory + * PURPOSE: Test driver for CcPinMappedData function + * PROGRAMMER: Pierre Schweitzer <pierre(a)reactos.org> + */ + +#include <kmt_test.h> + +#define NDEBUG +#include <debug.h> + +#define IOCTL_START_TEST 1 +#define IOCTL_FINISH_TEST 2 + +typedef struct _TEST_FCB +{ + FSRTL_ADVANCED_FCB_HEADER Header; + SECTION_OBJECT_POINTERS SectionObjectPointers; + FAST_MUTEX HeaderMutex; +} TEST_FCB, *PTEST_FCB; + +typedef struct _TEST_CONTEXT +{ + PVOID Bcb; + PVOID Buffer; + ULONG Length; +} TEST_CONTEXT, *PTEST_CONTEXT; + +static ULONG TestTestId = -1; +static PFILE_OBJECT TestFileObject; +static PDEVICE_OBJECT TestDeviceObject; +static KMT_IRP_HANDLER TestIrpHandler; +static KMT_MESSAGE_HANDLER TestMessageHandler; + +NTSTATUS +TestEntry( + _In_ PDRIVER_OBJECT DriverObject, + _In_ PCUNICODE_STRING RegistryPath, + _Out_ PCWSTR *DeviceName, + _Inout_ INT *Flags) +{ + NTSTATUS Status = STATUS_SUCCESS; + + PAGED_CODE(); + + UNREFERENCED_PARAMETER(RegistryPath); + + *DeviceName = L"CcPinMappedData"; + *Flags = TESTENTRY_NO_EXCLUSIVE_DEVICE | + TESTENTRY_BUFFERED_IO_DEVICE | + TESTENTRY_NO_READONLY_DEVICE; + + KmtRegisterIrpHandler(IRP_MJ_READ, NULL, TestIrpHandler); + KmtRegisterMessageHandler(0, NULL, TestMessageHandler); + + + return Status; +} + +VOID +TestUnload( + _In_ PDRIVER_OBJECT DriverObject) +{ + PAGED_CODE(); +} + +BOOLEAN +NTAPI +AcquireForLazyWrite( + _In_ PVOID Context, + _In_ BOOLEAN Wait) +{ + return TRUE; +} + +VOID +NTAPI +ReleaseFromLazyWrite( + _In_ PVOID Context) +{ + return; +} + +BOOLEAN +NTAPI +AcquireForReadAhead( + _In_ PVOID Context, + _In_ BOOLEAN Wait) +{ + return TRUE; +} + +VOID +NTAPI +ReleaseFromReadAhead( + _In_ PVOID Context) +{ + return; +} + +static CACHE_MANAGER_CALLBACKS Callbacks = { + AcquireForLazyWrite, + ReleaseFromLazyWrite, + AcquireForReadAhead, + ReleaseFromReadAhead, +}; + +static CC_FILE_SIZES FileSizes = { + RTL_CONSTANT_LARGE_INTEGER((LONGLONG)0x4000), // .AllocationSize + RTL_CONSTANT_LARGE_INTEGER((LONGLONG)0x4000), // .FileSize + RTL_CONSTANT_LARGE_INTEGER((LONGLONG)0x4000) // .ValidDataLength +}; + +static +PVOID +MapAndLockUserBuffer( + _In_ _Out_ PIRP Irp, + _In_ ULONG BufferLength) +{ + PMDL Mdl; + + if (Irp->MdlAddress == NULL) + { + Mdl = IoAllocateMdl(Irp->UserBuffer, BufferLength, FALSE, FALSE, Irp); + if (Mdl == NULL) + { + return NULL; + } + + _SEH2_TRY + { + MmProbeAndLockPages(Mdl, Irp->RequestorMode, IoWriteAccess); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + IoFreeMdl(Mdl); + Irp->MdlAddress = NULL; + _SEH2_YIELD(return NULL); + } + _SEH2_END; + } + + return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +} + +static +VOID +PerformTest( + ULONG TestId, + PDEVICE_OBJECT DeviceObject) +{ + PVOID Bcb, PinBcb; + BOOLEAN Ret; + PULONG Buffer; + PTEST_FCB Fcb; + LARGE_INTEGER Offset; + + ok_eq_pointer(TestFileObject, NULL); + ok_eq_pointer(TestDeviceObject, NULL); + ok_eq_ulong(TestTestId, -1); + + TestDeviceObject = DeviceObject; + TestTestId = TestId; + TestFileObject = IoCreateStreamFileObject(NULL, DeviceObject); + if (!skip(TestFileObject != NULL, "Failed to allocate FO\n")) + { + Fcb = ExAllocatePool(NonPagedPool, sizeof(TEST_FCB)); + if (!skip(Fcb != NULL, "ExAllocatePool failed\n")) + { + RtlZeroMemory(Fcb, sizeof(TEST_FCB)); + ExInitializeFastMutex(&Fcb->HeaderMutex); + FsRtlSetupAdvancedHeader(&Fcb->Header, &Fcb->HeaderMutex); + + TestFileObject->FsContext = Fcb; + TestFileObject->SectionObjectPointer = &Fcb->SectionObjectPointers; + + KmtStartSeh(); + CcInitializeCacheMap(TestFileObject, &FileSizes, TRUE, &Callbacks, NULL); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(CcIsFileCached(TestFileObject) == TRUE, "CcInitializeCacheMap failed\n")) + { + if (TestId == 0) + { + Ret = FALSE; + Offset.QuadPart = TestId * 0x1000; + KmtStartSeh(); + Ret = CcMapData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, MAP_WAIT, &Bcb, (PVOID *)&Buffer); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcMapData failed\n")) + { + Ret = FALSE; + PinBcb = Bcb; + ok_eq_ulong(Buffer[0x3000 / sizeof(ULONG)], 0xDEADBABE); + + KmtStartSeh(); + Ret = CcPinMappedData(TestFileObject, &Offset, FileSizes.FileSize.QuadPart - Offset.QuadPart, PIN_WAIT, &PinBcb); + KmtEndSeh(STATUS_SUCCESS); + + if (!skip(Ret == TRUE, "CcPinMappedData failed\n")) + { + ok(Bcb != PinBcb, "Returned same BCB!\n"); + ok(*(PUSHORT)PinBcb == 0x2FD, "Not a BCB: %x\n", *(PUSHORT)PinBcb); + + /* Previous BCB isn't valid anymore! */ + Bcb = PinBcb; + } + + CcUnpinData(Bcb); + } + } + } + } + } +} + + +static +VOID +CleanupTest( + ULONG TestId, + PDEVICE_OBJECT DeviceObject) +{ + LARGE_INTEGER Zero = RTL_CONSTANT_LARGE_INTEGER(0LL); + CACHE_UNINITIALIZE_EVENT CacheUninitEvent; + + ok_eq_pointer(TestDeviceObject, DeviceObject); + ok_eq_ulong(TestTestId, TestId); + + if (!skip(TestFileObject != NULL, "No test FO\n")) + { + if (CcIsFileCached(TestFileObject)) + { + KeInitializeEvent(&CacheUninitEvent.Event, NotificationEvent, FALSE); + CcUninitializeCacheMap(TestFileObject, &Zero, &CacheUninitEvent); + KeWaitForSingleObject(&CacheUninitEvent.Event, Executive, KernelMode, FALSE, NULL); + } + + if (TestFileObject->FsContext != NULL) + { + ExFreePool(TestFileObject->FsContext); + TestFileObject->FsContext = NULL; + TestFileObject->SectionObjectPointer = NULL; + } + + ObDereferenceObject(TestFileObject); + } + + TestFileObject = NULL; + TestDeviceObject = NULL; + TestTestId = -1; +} + + +static +NTSTATUS +TestMessageHandler( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ ULONG ControlCode, + _In_opt_ PVOID Buffer, + _In_ SIZE_T InLength, + _Inout_ PSIZE_T OutLength) +{ + NTSTATUS Status = STATUS_SUCCESS; + + FsRtlEnterFileSystem(); + + switch (ControlCode) + { + case IOCTL_START_TEST: + ok_eq_ulong((ULONG)InLength, sizeof(ULONG)); + PerformTest(*(PULONG)Buffer, DeviceObject); + break; + + case IOCTL_FINISH_TEST: + ok_eq_ulong((ULONG)InLength, sizeof(ULONG)); + CleanupTest(*(PULONG)Buffer, DeviceObject); + break; + + default: + Status = STATUS_NOT_IMPLEMENTED; + break; + } + + FsRtlExitFileSystem(); + + return Status; +} + +static +NTSTATUS +TestIrpHandler( + _In_ PDEVICE_OBJECT DeviceObject, + _In_ PIRP Irp, + _In_ PIO_STACK_LOCATION IoStack) +{ + NTSTATUS Status; + + PAGED_CODE(); + + DPRINT("IRP %x/%x\n", IoStack->MajorFunction, IoStack->MinorFunction); + ASSERT(IoStack->MajorFunction == IRP_MJ_READ); + + FsRtlEnterFileSystem(); + + Status = STATUS_NOT_SUPPORTED; + Irp->IoStatus.Information = 0; + + if (IoStack->MajorFunction == IRP_MJ_READ) + { + PMDL Mdl; + ULONG Length; + PVOID Buffer; + LARGE_INTEGER Offset; + + Offset = IoStack->Parameters.Read.ByteOffset; + Length = IoStack->Parameters.Read.Length; + + ok_eq_pointer(DeviceObject, TestDeviceObject); + ok_eq_pointer(IoStack->FileObject, TestFileObject); + + ok(FlagOn(Irp->Flags, IRP_NOCACHE), "Not coming from Cc\n"); + + ok_irql(APC_LEVEL); + ok((Offset.QuadPart % PAGE_SIZE == 0 || Offset.QuadPart == 0), "Offset is not aligned: %I64i\n", Offset.QuadPart); + ok(Length % PAGE_SIZE == 0, "Length is not aligned: %I64i\n", Length); + + ok(Irp->AssociatedIrp.SystemBuffer == NULL, "A SystemBuffer was allocated!\n"); + Buffer = MapAndLockUserBuffer(Irp, Length); + ok(Buffer != NULL, "Null pointer!\n"); + RtlFillMemory(Buffer, Length, 0xBA); + + Status = STATUS_SUCCESS; + if (Offset.QuadPart <= 0x3000 && Offset.QuadPart + Length > 0x3000) + { + *(PULONG)((ULONG_PTR)Buffer + (ULONG_PTR)(0x3000 - Offset.QuadPart)) = 0xDEADBABE; + } + + Mdl = Irp->MdlAddress; + ok(Mdl != NULL, "Null pointer for MDL!\n"); + ok((Mdl->MdlFlags & MDL_PAGES_LOCKED) != 0, "MDL not locked\n"); + ok((Mdl->MdlFlags & MDL_SOURCE_IS_NONPAGED_POOL) == 0, "MDL from non paged\n"); + ok((Mdl->MdlFlags & MDL_IO_PAGE_READ) != 0, "Non paging IO\n"); + ok((Irp->Flags & IRP_PAGING_IO) != 0, "Non paging IO\n"); + + Irp->IoStatus.Information = Length; + } + + if (Status == STATUS_PENDING) + { + IoMarkIrpPending(Irp); + IoCompleteRequest(Irp, IO_NO_INCREMENT); + Status = STATUS_PENDING; + } + else + { + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + } + + FsRtlExitFileSystem(); + + return Status; +} diff --git a/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c new file mode 100644 index 0000000000..df3cc320a2 --- /dev/null +++ b/modules/rostests/kmtests/ntos_cc/CcPinMappedData_user.c @@ -0,0 +1,32 @@ +/* + * PROJECT: ReactOS kernel-mode tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Kernel-Mode Test Suite CcPinMappedData test user-mode part + * PROGRAMMER: Pierre Schweitzer <pierre(a)reactos.org> + */ + +#include <kmt_test.h> + +#define IOCTL_START_TEST 1 +#define IOCTL_FINISH_TEST 2 + +START_TEST(CcPinMappedData) +{ + DWORD Ret; + ULONG TestId; + + KmtLoadDriver(L"CcPinMappedData", FALSE); + KmtOpenDriver(); + + /* 1 basic test */ + for (TestId = 0; TestId < 1; ++TestId) + { + Ret = KmtSendUlongToDriver(IOCTL_START_TEST, TestId); + ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret); + Ret = KmtSendUlongToDriver(IOCTL_FINISH_TEST, TestId); + ok(Ret == ERROR_SUCCESS, "KmtSendUlongToDriver failed: %lx\n", Ret); + } + + KmtCloseDriver(); + KmtUnloadDriver(); +}
6 years, 2 months
1
0
0
0
06/06: [SDK] Implement __wine_spec_unimplemented_stub with ntdll functions
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ef202724d8f20b98c0da0…
commit ef202724d8f20b98c0da0734c6e5a56875a424c5 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed Sep 5 23:20:46 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Fri Oct 12 19:30:36 2018 +0200 [SDK] Implement __wine_spec_unimplemented_stub with ntdll functions --- sdk/include/reactos/stubs.h | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/sdk/include/reactos/stubs.h b/sdk/include/reactos/stubs.h index 3be4027260..d8c59c9fa5 100644 --- a/sdk/include/reactos/stubs.h +++ b/sdk/include/reactos/stubs.h @@ -1,22 +1,31 @@ #define WIN32_NO_STATUS #include <windef.h> -#define EXCEPTION_WINE_STUB 0x80000100 -#define EH_NONCONTINUABLE 0x01 - -ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format, ...); +#define EXCEPTION_WINE_STUB 0x80000100 +#define EH_NONCONTINUABLE 0x01 +NTSYSAPI VOID -WINAPI -RaiseException(_In_ DWORD dwExceptionCode, - _In_ DWORD dwExceptionFlags, - _In_ DWORD nNumberOfArguments, - _In_ CONST ULONG_PTR *lpArguments OPTIONAL); +NTAPI +RtlRaiseException( + _In_ PEXCEPTION_RECORD ExceptionRecord +); + +ULONG +__cdecl +DbgPrint( + _In_z_ _Printf_format_string_ PCSTR Format, + ... +); #define __wine_spec_unimplemented_stub(module, function) \ { \ - ULONG_PTR args[2]; \ - args[0] = (ULONG_PTR)module; \ - args[1] = (ULONG_PTR)function; \ - RaiseException( EXCEPTION_WINE_STUB, EH_NONCONTINUABLE, 2, args ); \ + EXCEPTION_RECORD ExceptionRecord = {0}; \ + ExceptionRecord.ExceptionRecord = NULL; \ + ExceptionRecord.ExceptionCode = EXCEPTION_WINE_STUB; \ + ExceptionRecord.ExceptionFlags = EXCEPTION_NONCONTINUABLE; \ + ExceptionRecord.ExceptionInformation[0] = (ULONG_PTR)module; \ + ExceptionRecord.ExceptionInformation[1] = (ULONG_PTR)function; \ + ExceptionRecord.NumberParameters = 2; \ + RtlRaiseException(&ExceptionRecord); \ }
6 years, 2 months
1
0
0
0
05/06: [DBGHELP] Exclude stubs from pch
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1968776bf233d0bc06560…
commit 1968776bf233d0bc065602a048d637022411a250 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed Sep 5 23:20:28 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Fri Oct 12 19:30:36 2018 +0200 [DBGHELP] Exclude stubs from pch --- dll/win32/dbghelp/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt index 66229f410a..ed64611e40 100644 --- a/dll/win32/dbghelp/CMakeLists.txt +++ b/dll/win32/dbghelp/CMakeLists.txt @@ -70,12 +70,12 @@ else() storage.c symbol.c type.c - precomp.h - ${CMAKE_CURRENT_BINARY_DIR}/dbghelp_stubs.c) + precomp.h) add_library(dbghelp SHARED ${SOURCE} version.rc + ${CMAKE_CURRENT_BINARY_DIR}/dbghelp_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/dbghelp.def) set_module_type(dbghelp win32dll)
6 years, 2 months
1
0
0
0
04/06: [SDK] Add version option to our spec2def cmake command
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b494abbd721bed2da579c…
commit b494abbd721bed2da579c80b0b30782686fcc751 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed Sep 5 21:59:16 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Fri Oct 12 19:30:36 2018 +0200 [SDK] Add version option to our spec2def cmake command --- sdk/cmake/gcc.cmake | 8 ++++++-- sdk/cmake/msvc.cmake | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/sdk/cmake/gcc.cmake b/sdk/cmake/gcc.cmake index d54fc3a93e..ae4056b21b 100644 --- a/sdk/cmake/gcc.cmake +++ b/sdk/cmake/gcc.cmake @@ -358,7 +358,7 @@ set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill- set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-delaylib=<TARGET>") function(spec2def _dllname _spec_file) - cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "" "" ${ARGN}) + cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "VERSION" "" ${ARGN}) # Get library basename get_filename_component(_file ${_dllname} NAME_WE) @@ -372,10 +372,14 @@ function(spec2def _dllname _spec_file) set(__with_relay_arg "--with-tracing") endif() + if(__spec2def_VERSION) + set(__version_arg "--version=0x${__spec2def_VERSION}") + endif() + # Generate exports def and C stubs file for the DLL add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c - COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) if(__spec2def_ADD_IMPORTLIB) diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index 8d2c8cebc3..95a0c252b9 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -401,7 +401,7 @@ else() endif() function(spec2def _dllname _spec_file) - cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "" "" ${ARGN}) + cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "VERSION" "" ${ARGN}) # Get library basename get_filename_component(_file ${_dllname} NAME_WE) @@ -415,10 +415,14 @@ function(spec2def _dllname _spec_file) set(__with_relay_arg "--with-tracing") endif() + if(__spec2def_VERSION) + set(__version_arg "--version=0x${__spec2def_VERSION}") + endif() + # Generate exports def and C stubs file for the DLL add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c - COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${__version_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) if(__spec2def_ADD_IMPORTLIB)
6 years, 2 months
1
0
0
0
03/06: [SDK] Add the WITH_RELAY option to msvc's spec2def command. (GCC already had it)
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4e3f76352a46cdd32703b…
commit 4e3f76352a46cdd32703b6dc472169d0a47779f7 Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed Sep 5 21:51:59 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Fri Oct 12 19:30:35 2018 +0200 [SDK] Add the WITH_RELAY option to msvc's spec2def command. (GCC already had it) --- sdk/cmake/msvc.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sdk/cmake/msvc.cmake b/sdk/cmake/msvc.cmake index d2da8dc3e9..8d2c8cebc3 100644 --- a/sdk/cmake/msvc.cmake +++ b/sdk/cmake/msvc.cmake @@ -401,7 +401,7 @@ else() endif() function(spec2def _dllname _spec_file) - cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS" "" "" ${ARGN}) + cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;NO_PRIVATE_WARNINGS;WITH_RELAY" "" "" ${ARGN}) # Get library basename get_filename_component(_file ${_dllname} NAME_WE) @@ -411,10 +411,14 @@ function(spec2def _dllname _spec_file) message(FATAL_ERROR "spec2def only takes spec files as input.") endif() + if (__spec2def_WITH_RELAY) + set(__with_relay_arg "--with-tracing") + endif() + # Generate exports def and C stubs file for the DLL add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c - COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + COMMAND native-spec2def --ms -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) if(__spec2def_ADD_IMPORTLIB)
6 years, 2 months
1
0
0
0
02/06: [SPEC2DEF] Fix support for different OS versions.
by Mark Jansen
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d564c7c8e33a3bc9579b1…
commit d564c7c8e33a3bc9579b1f5d7886ea2c4f589ffa Author: Mark Jansen <mark.jansen(a)reactos.org> AuthorDate: Wed Sep 5 21:49:02 2018 +0200 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Fri Oct 12 19:30:35 2018 +0200 [SPEC2DEF] Fix support for different OS versions. --- sdk/tools/spec2def/spec2def.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sdk/tools/spec2def/spec2def.c b/sdk/tools/spec2def/spec2def.c index f5a91aa326..1246ce3ad3 100644 --- a/sdk/tools/spec2def/spec2def.c +++ b/sdk/tools/spec2def/spec2def.c @@ -4,7 +4,8 @@ #include <string.h> #ifdef _MSC_VER -#define strcasecmp _stricmp +#define strcasecmp(_String1, _String2) _stricmp(_String1, _String2) +#define strncasecmp(_String1, _String2, _MaxCount) _strnicmp(_String1, _String2, _MaxCount) #endif #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0])) @@ -1126,6 +1127,7 @@ int main(int argc, char *argv[]) { size_t nFileSize; char *pszSource, *pszDefFileName = NULL, *pszStubFileName = NULL, *pszLibStubName = NULL; + const char* pszVersionOption = "--version=0x"; char achDllName[40]; FILE *file; int result = 0, i; @@ -1161,9 +1163,9 @@ int main(int argc, char *argv[]) { pszDllName = argv[i] + 3; } - else if (strcasecmp(argv[i], "--version=0x") == 0) + else if (strncasecmp(argv[i], pszVersionOption, strlen(pszVersionOption)) == 0) { - guOsVersion = strtoul(argv[i] + sizeof("--version=0x"), NULL, 16); + guOsVersion = strtoul(argv[i] + strlen(pszVersionOption), NULL, 16); } else if (strcasecmp(argv[i], "--implib") == 0) {
6 years, 2 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
36
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
Results per page:
10
25
50
100
200