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
April 2013
----- 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
14 participants
265 discussions
Start a n
N
ew thread
[hbelusca] 58876: [KDCOM] Add resource files for KDCOM and compile them.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Apr 27 21:46:02 2013 New Revision: 58876 URL:
http://svn.reactos.org/svn/reactos?rev=58876&view=rev
Log: [KDCOM] Add resource files for KDCOM and compile them. Added: trunk/reactos/drivers/base/kddll/kdcom.rc (with props) Modified: trunk/reactos/drivers/base/kdcom/CMakeLists.txt trunk/reactos/drivers/base/kdcom/kdcom.rc trunk/reactos/drivers/base/kddll/CMakeLists.txt Modified: trunk/reactos/drivers/base/kdcom/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdcom/CMakeLi…
============================================================================== --- trunk/reactos/drivers/base/kdcom/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/base/kdcom/CMakeLists.txt [iso-8859-1] Sat Apr 27 21:46:02 2013 @@ -8,7 +8,9 @@ elseif(ARCH STREQUAL "arm") list(APPEND SOURCE arm/kdbg.c) endif(ARCH STREQUAL "i386") -list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/kdcom.def) +list(APPEND SOURCE + kdcom.rc + ${CMAKE_CURRENT_BINARY_DIR}/kdcom.def) add_library(kdcom SHARED ${SOURCE}) Modified: trunk/reactos/drivers/base/kdcom/kdcom.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kdcom/kdcom.r…
============================================================================== --- trunk/reactos/drivers/base/kdcom/kdcom.rc [iso-8859-1] (original) +++ trunk/reactos/drivers/base/kdcom/kdcom.rc [iso-8859-1] Sat Apr 27 21:46:02 2013 @@ -1,6 +1,6 @@ #define REACTOS_VERSION_DLL -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS KDBG COM Library\0" -#define REACTOS_STR_INTERNAL_NAME "kdcom\0" -#define REACTOS_STR_ORIGINAL_FILENAME "kdcom.sys\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS KDBG COM Library" +#define REACTOS_STR_INTERNAL_NAME "kdcom" +#define REACTOS_STR_ORIGINAL_FILENAME "kdcom.dll" #include <reactos/version.rc> Modified: trunk/reactos/drivers/base/kddll/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/CMakeLi…
============================================================================== --- trunk/reactos/drivers/base/kddll/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/drivers/base/kddll/CMakeLists.txt [iso-8859-1] Sat Apr 27 21:46:02 2013 @@ -5,6 +5,7 @@ kdcom.c kddll.c kdserial.c + kdcom.rc ${CMAKE_CURRENT_BINARY_DIR}/kdcom.def) set_entrypoint(kdcom 0) Added: trunk/reactos/drivers/base/kddll/kdcom.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/base/kddll/kdcom.r…
============================================================================== --- trunk/reactos/drivers/base/kddll/kdcom.rc (added) +++ trunk/reactos/drivers/base/kddll/kdcom.rc [iso-8859-1] Sat Apr 27 21:46:02 2013 @@ -1,0 +1,6 @@ + +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Kernel Debugger COM Extension DLL" +#define REACTOS_STR_INTERNAL_NAME "kdcom" +#define REACTOS_STR_ORIGINAL_FILENAME "kdcom.dll" +#include <reactos/version.rc> Propchange: trunk/reactos/drivers/base/kddll/kdcom.rc ------------------------------------------------------------------------------ svn:eol-style = native
11 years, 8 months
1
0
0
0
[spetreolle] 58875: [MKHIVE] Set proper parent for registry keys. Patch by theflash < theflash at sdf dot lonestar dot org > CORE-7128 #resolve
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Apr 27 19:33:31 2013 New Revision: 58875 URL:
http://svn.reactos.org/svn/reactos?rev=58875&view=rev
Log: [MKHIVE] Set proper parent for registry keys. Patch by theflash < theflash at sdf dot lonestar dot org > CORE-7128 #resolve Modified: trunk/reactos/tools/mkhive/cmi.c Modified: trunk/reactos/tools/mkhive/cmi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/mkhive/cmi.c?rev=588…
============================================================================== --- trunk/reactos/tools/mkhive/cmi.c [iso-8859-1] (original) +++ trunk/reactos/tools/mkhive/cmi.c [iso-8859-1] Sat Apr 27 19:33:31 2013 @@ -294,7 +294,7 @@ NewKeyCell->Flags = 0; } KeQuerySystemTime(&NewKeyCell->LastWriteTime); - NewKeyCell->Parent = HCELL_NIL; + NewKeyCell->Parent = ParentKeyCellOffset; NewKeyCell->SubKeyCounts[Stable] = 0; NewKeyCell->SubKeyCounts[Volatile] = 0; NewKeyCell->SubKeyLists[Stable] = HCELL_NIL;
11 years, 8 months
1
0
0
0
[tfaber] 58874: [KMTESTS:MM] - Add tests for ZwAllocateVirtualMemory, ZwCreateSection, ZwMapViewOfSection. Patch by Nikolay Borisov (nib9 at aber dot ac dot uk). - Some tests are currently skipped ...
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Apr 27 18:33:50 2013 New Revision: 58874 URL:
http://svn.reactos.org/svn/reactos?rev=58874&view=rev
Log: [KMTESTS:MM] - Add tests for ZwAllocateVirtualMemory, ZwCreateSection, ZwMapViewOfSection. Patch by Nikolay Borisov (nib9 at aber dot ac dot uk). - Some tests are currently skipped because they crash or assert on ROS: See ROSTESTS-107, ROSTESTS-108, ROSTESTS-109, ROSTESTS-110. ROSTESTS-105 #resolve Added: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c (with props) trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c (with props) trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c (with props) Modified: trunk/rostests/kmtests/CMakeLists.txt trunk/rostests/kmtests/kmtest_drv/testlist.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/rostests/kmtests/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/CMakeLists.txt?re…
Modified: trunk/rostests/kmtests/kmtest_drv/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/testli…
Added: trunk/rostests/kmtests/ntos_mm/ZwAllocateVirtualMemory.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwAllocat…
Added: trunk/rostests/kmtests/ntos_mm/ZwCreateSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwCreateS…
Added: trunk/rostests/kmtests/ntos_mm/ZwMapViewOfSection.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_mm/ZwMapView…
11 years, 8 months
1
0
0
0
[tfaber] 58873: [KMTESTS] - Implement a mechanism for kmtests to retrieve information from user-mode. Patch by Nikolay Borisov (nib9 at aber dot ac dot uk). - Currently supported function: QueryVir...
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Apr 27 18:18:17 2013 New Revision: 58873 URL:
http://svn.reactos.org/svn/reactos?rev=58873&view=rev
Log: [KMTESTS] - Implement a mechanism for kmtests to retrieve information from user-mode. Patch by Nikolay Borisov (nib9 at aber dot ac dot uk). - Currently supported function: QueryVirtualMemory ROSTESTS-96 #resolve Modified: trunk/rostests/kmtests/include/kmt_public.h trunk/rostests/kmtests/include/kmt_test.h trunk/rostests/kmtests/kmtest/support.c trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c Modified: trunk/rostests/kmtests/include/kmt_public.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_publi…
============================================================================== --- trunk/rostests/kmtests/include/kmt_public.h [iso-8859-1] (original) +++ trunk/rostests/kmtests/include/kmt_public.h [iso-8859-1] Sat Apr 27 18:18:17 2013 @@ -17,6 +17,12 @@ #define IOCTL_KMTEST_SET_RESULTBUFFER \ CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_NEITHER, FILE_READ_DATA | FILE_WRITE_DATA) +#define IOCTL_KMTEST_USERMODE_SEND_RESPONSE \ + CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_IN_DIRECT, FILE_WRITE_DATA) + +#define IOCTL_KMTEST_USERMODE_AWAIT_REQ \ + CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, FILE_READ_DATA) + #define KMTEST_DEVICE_NAME L"Kmtest" #define KMTEST_DEVICE_DRIVER_PATH L"\\Device\\" KMTEST_DEVICE_NAME #define KMTEST_DEVICE_PATH L"\\\\.\\Global\\GLOBALROOT" KMTEST_DEVICE_DRIVER_PATH Modified: trunk/rostests/kmtests/include/kmt_test.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_test.…
============================================================================== --- trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] (original) +++ trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] Sat Apr 27 18:18:17 2013 @@ -37,6 +37,48 @@ LONG LogBufferMaxLength; CHAR LogBuffer[ANYSIZE_ARRAY]; } KMT_RESULTBUFFER, *PKMT_RESULTBUFFER; + +#ifndef KMT_STANDALONE_DRIVER + +/* usermode call-back mechanism */ + +/* list of supported operations */ +typedef enum _KMT_CALLBACK_INFORMATION_CLASS +{ + QueryVirtualMemory +} KMT_CALLBACK_INFORMATION_CLASS, *PKMT_CALLBACK_INFORMATION_CLASS; + +/* TODO: "response" is a little generic */ +typedef union _KMT_RESPONSE +{ + MEMORY_BASIC_INFORMATION MemInfo; +} KMT_RESPONSE, *PKMT_RESPONSE; + +/* this struct is sent from driver to usermode */ +typedef struct _KMT_CALLBACK_REQUEST_PACKET +{ + ULONG RequestId; + KMT_CALLBACK_INFORMATION_CLASS OperationClass; + PVOID Parameters; +} KMT_CALLBACK_REQUEST_PACKET, *PKMT_CALLBACK_REQUEST_PACKET; + +PKMT_RESPONSE KmtUserModeCallback(KMT_CALLBACK_INFORMATION_CLASS Operation, PVOID Parameters); +VOID KmtFreeCallbackResponse(PKMT_RESPONSE Response); + +//macro to simplify using the mechanism +#define Test_NtQueryVirtualMemory(BaseAddress, Size, AllocationType, ProtectionType) \ + do { \ + PKMT_RESPONSE NtQueryTest = KmtUserModeCallback(QueryVirtualMemory, BaseAddress); \ + if (NtQueryTest != NULL) \ + { \ + ok_eq_hex(NtQueryTest->MemInfo.Protect, ProtectionType); \ + ok_eq_hex(NtQueryTest->MemInfo.State, AllocationType); \ + ok_eq_size(NtQueryTest->MemInfo.RegionSize, Size); \ + KmtFreeCallbackResponse(NtQueryTest); \ + } \ + } while (0) \ + +#endif #ifdef KMT_STANDALONE_DRIVER #define KMT_KERNEL_MODE Modified: trunk/rostests/kmtests/kmtest/support.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest/support.c?…
============================================================================== --- trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] Sat Apr 27 18:18:17 2013 @@ -11,8 +11,73 @@ #include <kmt_public.h> #include <assert.h> +#include <debug.h> extern HANDLE KmtestHandle; + +/** + * @name KmtUserCallbackThread + * + * Thread routine which awaits callback requests from kernel-mode + * + * @return Win32 error code + */ +DWORD +WINAPI +KmtUserCallbackThread( + PVOID Parameter) +{ + DWORD Error = ERROR_SUCCESS; + /* TODO: RequestPacket? */ + KMT_CALLBACK_REQUEST_PACKET RequestPacket; + KMT_RESPONSE Response; + DWORD BytesReturned; + HANDLE LocalKmtHandle; + + UNREFERENCED_PARAMETER(Parameter); + + /* concurrent IoCtls on the same (non-overlapped) handle aren't possible, + * so open a separate one. + * For more info
http://www.osronline.com/showthread.cfm?link=230782
*/ + LocalKmtHandle = CreateFile(KMTEST_DEVICE_PATH, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + if (LocalKmtHandle == INVALID_HANDLE_VALUE) + error_goto(Error, cleanup); + + while (1) + { + if (!DeviceIoControl(LocalKmtHandle, IOCTL_KMTEST_USERMODE_AWAIT_REQ, NULL, 0, &RequestPacket, sizeof(RequestPacket), &BytesReturned, NULL)) + error_goto(Error, cleanup); + ASSERT(BytesReturned == sizeof(RequestPacket)); + + switch (RequestPacket.OperationClass) + { + case QueryVirtualMemory: + { + SIZE_T InfoBufferSize = VirtualQuery(RequestPacket.Parameters, &Response.MemInfo, sizeof(Response.MemInfo)); + /* FIXME: an error is a valid result. That should go as a response to kernel mode instead of terminating the thread */ + if (InfoBufferSize == 0) + error_goto(Error, cleanup); + + if (!DeviceIoControl(LocalKmtHandle, IOCTL_KMTEST_USERMODE_SEND_RESPONSE, &RequestPacket.RequestId, sizeof(RequestPacket.RequestId), &Response, sizeof(Response), &BytesReturned, NULL)) + error_goto(Error, cleanup); + ASSERT(BytesReturned == 0); + + break; + } + default: + DPRINT1("Unrecognized user-mode callback request\n"); + break; + } + } + +cleanup: + if (LocalKmtHandle != INVALID_HANDLE_VALUE) + CloseHandle(LocalKmtHandle); + + DPRINT("Callback handler dying! Error code %lu", Error); + return Error; +} + /** * @name KmtRunKernelTest @@ -28,11 +93,17 @@ KmtRunKernelTest( IN PCSTR TestName) { + HANDLE CallbackThread; DWORD Error = ERROR_SUCCESS; DWORD BytesRead; + + CallbackThread = CreateThread(NULL, 0, KmtUserCallbackThread, NULL, 0, NULL); if (!DeviceIoControl(KmtestHandle, IOCTL_KMTEST_RUN_TEST, (PVOID)TestName, (DWORD)strlen(TestName), NULL, 0, &BytesRead, NULL)) error(Error); + + if (CallbackThread != NULL) + CloseHandle(CallbackThread); return Error; } Modified: trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/kmtest…
============================================================================== --- trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] (original) +++ trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Sat Apr 27 18:18:17 2013 @@ -18,6 +18,22 @@ #include <kmt_public.h> #define KMT_DEFINE_TEST_FUNCTIONS #include <kmt_test.h> + +/* Usermode callback definitions */ +typedef struct _KMT_USER_WORK_ENTRY +{ + LIST_ENTRY ListEntry; + KEVENT WorkDoneEvent; + KMT_CALLBACK_REQUEST_PACKET Request; + PKMT_RESPONSE Response; +} KMT_USER_WORK_ENTRY, *PKMT_USER_WORK_ENTRY; + +typedef struct _KMT_USER_WORK_LIST +{ + LIST_ENTRY ListHead; + FAST_MUTEX Lock; + KEVENT NewWorkEvent; +} KMT_USER_WORK_LIST, *PKMT_USER_WORK_LIST; /* Prototypes */ DRIVER_INITIALIZE DriverEntry; @@ -30,10 +46,13 @@ static DRIVER_DISPATCH DriverClose; __drv_dispatchType(IRP_MJ_DEVICE_CONTROL) static DRIVER_DISPATCH DriverIoControl; +static VOID KmtCleanUsermodeCallbacks(VOID); /* Globals */ static PDEVICE_OBJECT MainDeviceObject; PDRIVER_OBJECT KmtDriverObject = NULL; +static KMT_USER_WORK_LIST WorkList; +static ULONG RequestId = 0; /* Entry */ /** @@ -92,6 +111,10 @@ DriverObject->MajorFunction[IRP_MJ_CLOSE] = DriverClose; DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = DriverIoControl; + ExInitializeFastMutex(&WorkList.Lock); + KeInitializeEvent(&WorkList.NewWorkEvent, NotificationEvent, FALSE); + InitializeListHead(&WorkList.ListHead); + cleanup: if (MainDeviceObject && !NT_SUCCESS(Status)) { @@ -122,6 +145,8 @@ UNREFERENCED_PARAMETER(DriverObject); DPRINT("DriverUnload\n"); + + KmtCleanUsermodeCallbacks(); if (MainDeviceObject) { @@ -403,6 +428,93 @@ ResultBuffer->LogBufferLength, ResultBuffer->LogBufferMaxLength); break; } + case IOCTL_KMTEST_USERMODE_AWAIT_REQ: + { + PLIST_ENTRY Entry; + PKMT_USER_WORK_ENTRY WorkItem; + + DPRINT("DriverIoControl. IOCTL_KMTEST_USERMODE_AWAIT_REQ, len=%lu\n", + IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength); + + /* TODO: prevent multiple concurrent invocations */ + Status = KeWaitForSingleObject(&WorkList.NewWorkEvent, UserRequest, UserMode, FALSE, NULL); + if (Status == STATUS_USER_APC || Status == STATUS_KERNEL_APC) + break; + + if (IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KMT_CALLBACK_REQUEST_PACKET)) + { + Status = STATUS_INVALID_BUFFER_SIZE; + break; + } + + ASSERT(!IsListEmpty(&WorkList.ListHead)); + + Entry = WorkList.ListHead.Flink; + WorkItem = CONTAINING_RECORD(Entry, KMT_USER_WORK_ENTRY, ListEntry); + + Length = sizeof(WorkItem->Request); + RtlCopyMemory(Irp->AssociatedIrp.SystemBuffer, &WorkItem->Request, Length); + Status = STATUS_SUCCESS; + + KeResetEvent(&WorkList.NewWorkEvent); + break; + + } + case IOCTL_KMTEST_USERMODE_SEND_RESPONSE: + { + PLIST_ENTRY Entry; + PKMT_USER_WORK_ENTRY WorkEntry; + PVOID Response; + ULONG ResponseSize = IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength; + + DPRINT("DriverIoControl. IOCTL_KMTEST_USERMODE_SEND_RESPONSE, inlen=%lu, outlen=%lu\n", + IoStackLocation->Parameters.DeviceIoControl.InputBufferLength, + IoStackLocation->Parameters.DeviceIoControl.OutputBufferLength); + + if (IoStackLocation->Parameters.DeviceIoControl.InputBufferLength != sizeof(ULONG) || ResponseSize != sizeof(KMT_RESPONSE)) + { + Status = STATUS_INVALID_BUFFER_SIZE; + break; + } + + /* FIXME: don't misuse the output buffer as an input! */ + Response = MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); + if (Response == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + ExAcquireFastMutex(&WorkList.Lock); + + Status = STATUS_OBJECTID_NOT_FOUND; + + Entry = WorkList.ListHead.Flink; + while (Entry != &WorkList.ListHead) + { + WorkEntry = CONTAINING_RECORD(Entry, KMT_USER_WORK_ENTRY, ListEntry); + if (WorkEntry->Request.RequestId == *(PULONG)Irp->AssociatedIrp.SystemBuffer) + { + WorkEntry->Response = ExAllocatePoolWithTag(PagedPool, sizeof(KMT_RESPONSE), 'pseR'); + if (WorkEntry->Response == NULL) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + + RtlCopyMemory(WorkEntry->Response, Response, ResponseSize); + KeSetEvent(&WorkEntry->WorkDoneEvent, IO_NO_INCREMENT, FALSE); + Status = STATUS_SUCCESS; + break; + } + + Entry = Entry->Flink; + } + + ExReleaseFastMutex(&WorkList.Lock); + + break; + } default: DPRINT1("DriverIoControl. Invalid IoCtl code 0x%08X\n", IoStackLocation->Parameters.DeviceIoControl.IoControlCode); @@ -417,3 +529,113 @@ return Status; } + +/** + * @name KmtUserModeCallback + * + * Enqueue a request to the usermode callback queue and blocks until the work + * is finished. + * + * @param Operation + * TODO + * @param Parameters + * TODO + * TODO: why is this PVOID? + * + * @return Response from user mode + */ +PKMT_RESPONSE +KmtUserModeCallback( + IN KMT_CALLBACK_INFORMATION_CLASS Operation, + IN PVOID Parameters) +{ + PKMT_RESPONSE Result; + NTSTATUS Status; + PKMT_USER_WORK_ENTRY WorkEntry; + LARGE_INTEGER Timeout; + + PAGED_CODE(); + + WorkEntry = ExAllocatePoolWithTag(PagedPool, sizeof(KMT_USER_WORK_ENTRY), 'ekrW'); + if (WorkEntry == NULL) + return NULL; + + KeInitializeEvent(&WorkEntry->WorkDoneEvent, NotificationEvent, FALSE); + WorkEntry->Request.RequestId = RequestId++; + WorkEntry->Request.OperationClass = Operation; + WorkEntry->Request.Parameters = Parameters; + WorkEntry->Response = NULL; + + ExAcquireFastMutex(&WorkList.Lock); + InsertTailList(&WorkList.ListHead, &WorkEntry->ListEntry); + ExReleaseFastMutex(&WorkList.Lock); + + KeSetEvent(&WorkList.NewWorkEvent, IO_NO_INCREMENT, FALSE); + + Timeout.QuadPart = -10 * 1000 * 1000 * 10; //wait for 10 seconds + Status = KeWaitForSingleObject(&WorkEntry->WorkDoneEvent, Executive, UserMode, FALSE, &Timeout); + + if (Status == STATUS_USER_APC || Status == STATUS_KERNEL_APC || Status == STATUS_TIMEOUT) + { + DPRINT1("Unexpected callback abortion! Reason: %lx\n", Status); + } + + ExAcquireFastMutex(&WorkList.Lock); + RemoveEntryList(&WorkEntry->ListEntry); + ExReleaseFastMutex(&WorkList.Lock); + + Result = WorkEntry->Response; + + ExFreePoolWithTag(WorkEntry, 'ekrW'); + + return Result; +} + +/** + * @name KmtFreeCallbackResponse + * + * TODO + * + * @param Response + * TODO + */ +VOID +KmtFreeCallbackResponse( + PKMT_RESPONSE Response) +{ + PAGED_CODE(); + + ExFreePoolWithTag(Response, 'pseR'); +} + +/** + * @name KmtCleanUsermodeCallbacks + * + * TODO + */ +static +VOID +KmtCleanUsermodeCallbacks(VOID) +{ + PLIST_ENTRY Entry; + + PAGED_CODE(); + + ExAcquireFastMutex(&WorkList.Lock); + + Entry = WorkList.ListHead.Flink; + while (Entry != &WorkList.ListHead) + { + PKMT_USER_WORK_ENTRY WorkEntry = CONTAINING_RECORD(Entry, KMT_USER_WORK_ENTRY, ListEntry); + if (WorkEntry->Response != NULL) + { + KmtFreeCallbackResponse(WorkEntry->Response); + } + + Entry = Entry->Flink; + + ExFreePoolWithTag(WorkEntry, 'ekrW'); + } + + ExReleaseFastMutex(&WorkList.Lock); +}
11 years, 8 months
1
0
0
0
[akhaldi] 58872: [DINPUT] * Add missing psdk dependency for the dinput data formats library.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Apr 27 14:56:43 2013 New Revision: 58872 URL:
http://svn.reactos.org/svn/reactos?rev=58872&view=rev
Log: [DINPUT] * Add missing psdk dependency for the dinput data formats library. Modified: trunk/reactos/dll/directx/dinput/CMakeLists.txt Modified: trunk/reactos/dll/directx/dinput/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/dinput/CMakeLi…
============================================================================== --- trunk/reactos/dll/directx/dinput/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/directx/dinput/CMakeLists.txt [iso-8859-1] Sat Apr 27 14:56:43 2013 @@ -23,6 +23,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/dinput.def) add_library(dinput_data_formats data_formats.c) +add_dependencies(dinput_data_formats psdk) set_module_type(dinput win32dll UNICODE) target_link_libraries(dinput dxguid uuid wine) add_importlibs(dinput comctl32 ole32 user32 advapi32 msvcrt kernel32 ntdll)
11 years, 8 months
1
0
0
0
[akhaldi] 58871: [CMAKE] * Don't set a default list of linked libraries, let us decide that ourselves. Fixes the recent VS build issues.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Apr 27 13:53:29 2013 New Revision: 58871 URL:
http://svn.reactos.org/svn/reactos?rev=58871&view=rev
Log: [CMAKE] * Don't set a default list of linked libraries, let us decide that ourselves. Fixes the recent VS build issues. Modified: trunk/reactos/cmake/Platform/Windows-MSVC.cmake Modified: trunk/reactos/cmake/Platform/Windows-MSVC.cmake URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/Platform/Windows-MSV…
============================================================================== --- trunk/reactos/cmake/Platform/Windows-MSVC.cmake [iso-8859-1] (original) +++ trunk/reactos/cmake/Platform/Windows-MSVC.cmake [iso-8859-1] Sat Apr 27 13:53:29 2013 @@ -148,11 +148,11 @@ if(MSVC_VERSION GREATER 1310) set(_RTC1 "/RTC1") set(_FLAGS_CXX " /GR /EHsc") - set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "") else() set(_RTC1 "/GZ") set(_FLAGS_CXX " /GR /GX") - set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "") endif() endif()
11 years, 8 months
1
0
0
0
[spetreolle] 58870: Import CredMarshalCredential and CredIsMarshaledCredential from wine. ROSTESTS-97 #resolve
by spetreolle@svn.reactos.org
Author: spetreolle Date: Sat Apr 27 12:37:33 2013 New Revision: 58870 URL:
http://svn.reactos.org/svn/reactos?rev=58870&view=rev
Log: Import CredMarshalCredential and CredIsMarshaledCredential from wine. ROSTESTS-97 #resolve Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec trunk/reactos/dll/win32/advapi32/sec/cred.c Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
============================================================================== --- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Sat Apr 27 12:37:33 2013 @@ -113,10 +113,10 @@ @ stdcall CredGetSessionTypes(long ptr) @ stub CredGetTargetInfoA @ stub CredGetTargetInfoW -@ stub CredIsMarshaledCredentialA -@ stub CredIsMarshaledCredentialW -@ stub CredMarshalCredentialA -@ stub CredMarshalCredentialW +@ stdcall CredIsMarshaledCredentialA(str) +@ stdcall CredIsMarshaledCredentialW(wstr) +@ stdcall CredMarshalCredentialA(long ptr str) +@ stdcall CredMarshalCredentialW(long ptr wstr) @ stub CredProfileLoaded @ stdcall CredReadA(str long long ptr) @ stdcall CredReadDomainCredentialsA(ptr long ptr ptr) Modified: trunk/reactos/dll/win32/advapi32/sec/cred.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/cre…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/cred.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/cred.c [iso-8859-1] Sat Apr 27 12:37:33 2013 @@ -1896,6 +1896,120 @@ return TRUE; } +/****************************************************************************** + * CredMarshalCredentialA [ADVAPI32.@] + */ +BOOL WINAPI CredMarshalCredentialA( CRED_MARSHAL_TYPE type, PVOID cred, LPSTR *out ) +{ + BOOL ret; + WCHAR *outW; + + TRACE("%u, %p, %p\n", type, cred, out); + + if ((ret = CredMarshalCredentialW( type, cred, &outW ))) + { + int len = WideCharToMultiByte( CP_ACP, 0, outW, -1, NULL, 0, NULL, NULL ); + if (!(*out = HeapAlloc( GetProcessHeap(), 0, len ))) + { + HeapFree( GetProcessHeap(), 0, outW ); + return FALSE; + } + WideCharToMultiByte( CP_ACP, 0, outW, -1, *out, len, NULL, NULL ); + HeapFree( GetProcessHeap(), 0, outW ); + } + return ret; +} + +static UINT cred_encode( const char *bin, unsigned int len, WCHAR *cred ) +{ + static char enc[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789#-"; + UINT n = 0, x; + + while (len > 0) + { + cred[n++] = enc[bin[0] & 0x3f]; + x = (bin[0] & 0xc0) >> 6; + if (len == 1) + { + cred[n++] = enc[x]; + break; + } + cred[n++] = enc[((bin[1] & 0xf) << 2) | x]; + x = (bin[1] & 0xf0) >> 4; + if (len == 2) + { + cred[n++] = enc[x]; + break; + } + cred[n++] = enc[((bin[2] & 0x3) << 4) | x]; + cred[n++] = enc[(bin[2] & 0xfc) >> 2]; + bin += 3; + len -= 3; + } + return n; +} + +/****************************************************************************** + * CredMarshalCredentialW [ADVAPI32.@] + */ +BOOL WINAPI CredMarshalCredentialW( CRED_MARSHAL_TYPE type, PVOID cred, LPWSTR *out ) +{ + CERT_CREDENTIAL_INFO *cert = cred; + USERNAME_TARGET_CREDENTIAL_INFO *target = cred; + DWORD len, size; + WCHAR *p; + + TRACE("%u, %p, %p\n", type, cred, out); + + if (!cred || (type == CertCredential && cert->cbSize < sizeof(*cert)) || + (type != CertCredential && type != UsernameTargetCredential && type != BinaryBlobCredential) || + (type == UsernameTargetCredential && (!target->UserName || !target->UserName[0]))) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + switch (type) + { + case CertCredential: + { + char hash[CERT_HASH_LENGTH + 2]; + + memcpy( hash, cert->rgbHashOfCert, sizeof(cert->rgbHashOfCert) ); + memset( hash + sizeof(cert->rgbHashOfCert), 0, sizeof(hash) - sizeof(cert->rgbHashOfCert) ); + + size = sizeof(hash) * 4 / 3; + if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE; + p[0] = '@'; + p[1] = '@'; + p[2] = 'A' + type; + len = cred_encode( (const char *)hash, sizeof(hash), p + 3 ); + p[len] = 0; + break; + } + case UsernameTargetCredential: + { + len = strlenW( target->UserName ); + size = (sizeof(DWORD) + len * sizeof(WCHAR) + 2) * 4 / 3; + if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE; + p[0] = '@'; + p[1] = '@'; + p[2] = 'A' + type; + size = len * sizeof(WCHAR); + len = cred_encode( (const char *)&size, sizeof(DWORD), p + 3 ); + len += cred_encode( (const char *)target->UserName, size, p + 3 + len ); + p[len + 3] = 0; + break; + } + case BinaryBlobCredential: + FIXME("BinaryBlobCredential not implemented\n"); + return FALSE; + default: + return FALSE; + } + *out = p; + return TRUE; +} + BOOL WINAPI CredWriteDomainCredentialsW(PCREDENTIAL_TARGET_INFORMATIONW TargetInfo, @@ -1916,22 +2030,218 @@ return FALSE; } -BOOL -WINAPI -CredUnmarshalCredentialW(LPCWSTR MarshaledCredential, - PCRED_MARSHAL_TYPE CredType, - PVOID *Credential) -{ - WARN("Not implemented\n"); +static inline char char_decode( WCHAR c ) +{ + if (c >= 'A' && c <= 'Z') return c - 'A'; + if (c >= 'a' && c <= 'z') return c - 'a' + 26; + if (c >= '0' && c <= '9') return c - '0' + 52; + if (c == '#') return 62; + if (c == '-') return 63; + return 64; +} + +static BOOL cred_decode( const WCHAR *cred, unsigned int len, char *buf ) +{ + unsigned int i = 0; + char c0, c1, c2, c3; + const WCHAR *p = cred; + + while (len >= 4) + { + if ((c0 = char_decode( p[0] )) > 63) return FALSE; + if ((c1 = char_decode( p[1] )) > 63) return FALSE; + if ((c2 = char_decode( p[2] )) > 63) return FALSE; + if ((c3 = char_decode( p[3] )) > 63) return FALSE; + + buf[i + 0] = (c1 << 6) | c0; + buf[i + 1] = (c2 << 4) | (c1 >> 2); + buf[i + 2] = (c3 << 2) | (c2 >> 4); + len -= 4; + i += 3; + p += 4; + } + if (len == 3) + { + if ((c0 = char_decode( p[0] )) > 63) return FALSE; + if ((c1 = char_decode( p[1] )) > 63) return FALSE; + if ((c2 = char_decode( p[2] )) > 63) return FALSE; + + buf[i + 0] = (c1 << 6) | c0; + buf[i + 1] = (c2 << 4) | (c1 >> 2); + buf[i + 2] = c2 >> 4; + } + else if (len == 2) + { + if ((c0 = char_decode( p[0] )) > 63) return FALSE; + if ((c1 = char_decode( p[1] )) > 63) return FALSE; + + buf[i + 0] = (c1 << 6) | c0; + buf[i + 1] = c1 >> 2; + buf[i + 2] = 0; + } + else if (len == 1) + { + if ((c0 = char_decode( p[0] )) > 63) return FALSE; + + buf[i + 0] = c0; + buf[i + 1] = 0; + buf[i + 2] = 0; + } + return TRUE; +} + +/****************************************************************************** + * CredUnmarshalCredentialW [ADVAPI32.@] + */ +BOOL WINAPI CredUnmarshalCredentialW( LPCWSTR cred, PCRED_MARSHAL_TYPE type, PVOID *out ) +{ + unsigned int len, buflen; + + TRACE("%s, %p, %p\n", debugstr_w(cred), type, out); + + if (!cred || cred[0] != '@' || cred[1] != '@' || !cred[2] || !cred[3]) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + len = strlenW( cred + 3 ); + switch (cred[2] - 'A') + { + case CertCredential: + { + char hash[CERT_HASH_LENGTH + 2]; + CERT_CREDENTIAL_INFO *cert; + + if (len != 27 || !cred_decode( cred + 3, len, hash )) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + if (!(cert = HeapAlloc( GetProcessHeap(), 0, sizeof(*cert) ))) return FALSE; + memcpy( cert->rgbHashOfCert, hash, sizeof(cert->rgbHashOfCert) ); + cert->cbSize = sizeof(*cert); + *type = CertCredential; + *out = cert; + break; + } + case UsernameTargetCredential: + { + USERNAME_TARGET_CREDENTIAL_INFO *target; + ULONGLONG size = 0; + + if (len < 9 || !cred_decode( cred + 3, 6, (char *)&size ) || + !size || size % sizeof(WCHAR) || size > INT_MAX) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + buflen = sizeof(*target) + size + sizeof(WCHAR); + if (!(target = HeapAlloc( GetProcessHeap(), 0, buflen ))) return FALSE; + if (!cred_decode( cred + 9, len - 6, (char *)(target + 1) )) + { + HeapFree( GetProcessHeap(), 0, target ); + return FALSE; + } + target->UserName = (WCHAR *)(target + 1); + target->UserName[size / sizeof(WCHAR)] = 0; + *type = UsernameTargetCredential; + *out = target; + break; + } + case BinaryBlobCredential: + FIXME("BinaryBlobCredential not implemented\n"); + return FALSE; + default: + WARN("unhandled type %u\n", cred[2] - 'A'); + return FALSE; + } + return TRUE; +} + +/****************************************************************************** + * CredUnmarshalCredentialA [ADVAPI32.@] + */ +BOOL WINAPI CredUnmarshalCredentialA( LPCSTR cred, PCRED_MARSHAL_TYPE type, PVOID *out ) +{ + BOOL ret; + WCHAR *credW = NULL; + + TRACE("%s, %p, %p\n", debugstr_a(cred), type, out); + + if (cred) + { + int len = MultiByteToWideChar( CP_ACP, 0, cred, -1, NULL, 0 ); + if (!(credW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE; + MultiByteToWideChar( CP_ACP, 0, cred, -1, credW, len ); + } + ret = CredUnmarshalCredentialW( credW, type, out ); + HeapFree( GetProcessHeap(), 0, credW ); + return ret; +} + + +/****************************************************************************** + * CredIsMarshaledCredentialW [ADVAPI32.@] + * + * Check, if the name parameter is a marshaled credential, hash or binary blob + * + * PARAMS + * name the name to check + * + * RETURNS + * TRUE: the name parameter is a marshaled credential, hash or binary blob + * FALSE: the name is a plain username + */ +BOOL WINAPI CredIsMarshaledCredentialW(LPCWSTR name) +{ + TRACE("(%s)\n", debugstr_w(name)); + + if (name && name[0] == '@' && name[1] == '@' && name[2] > 'A' && name[3]) + { + char hash[CERT_HASH_LENGTH + 2]; + int len = strlenW(name + 3 ); + DWORD size; + + if ((name[2] - 'A') == CertCredential && (len == 27) && cred_decode(name + 3, len, hash)) + return TRUE; + + if (((name[2] - 'A') == UsernameTargetCredential) && + (len >= 9) && cred_decode(name + 3, 6, (char *)&size) && size) + return TRUE; + + if ((name[2] - 'A') == BinaryBlobCredential) + FIXME("BinaryBlobCredential not checked\n"); + + if ((name[2] - 'A') > BinaryBlobCredential) + TRACE("unknown type: %d\n", (name[2] - 'A')); + } + + SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } -BOOL -WINAPI -CredUnmarshalCredentialA(LPCSTR MarshaledCredential, - PCRED_MARSHAL_TYPE CredType, - PVOID *Credential) -{ - WARN("Not implemented\n"); - return FALSE; -} +/****************************************************************************** + * CredIsMarshaledCredentialA [ADVAPI32.@] + * + * See CredIsMarshaledCredentialW + * + */ +BOOL WINAPI CredIsMarshaledCredentialA(LPCSTR name) +{ + LPWSTR nameW = NULL; + BOOL res; + int len; + + TRACE("(%s)\n", debugstr_a(name)); + + if (name) + { + len = MultiByteToWideChar(CP_ACP, 0, name, -1, NULL, 0); + nameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, name, -1, nameW, len); + } + + res = CredIsMarshaledCredentialW(nameW); + HeapFree(GetProcessHeap(), 0, nameW); + return res; +}
11 years, 8 months
1
0
0
0
[akhaldi] 58869: [SHELL32] * Silence a compiler warning. Spotted by Thomas Faber.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Apr 27 09:40:27 2013 New Revision: 58869 URL:
http://svn.reactos.org/svn/reactos?rev=58869&view=rev
Log: [SHELL32] * Silence a compiler warning. Spotted by Thomas Faber. Modified: trunk/reactos/dll/win32/shell32/shlview.cpp Modified: trunk/reactos/dll/win32/shell32/shlview.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/shlview.…
============================================================================== --- trunk/reactos/dll/win32/shell32/shlview.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/shlview.cpp [iso-8859-1] Sat Apr 27 09:40:27 2013 @@ -2408,7 +2408,7 @@ TRACE("(%p)->(%u), stub\n", this, ViewMode); /* It's not redundant to check FVM_AUTO because it's a (UINT)-1 */ - if ((ViewMode < FVM_FIRST || ViewMode > FVM_LAST) && (ViewMode != FVM_AUTO)) + if ((ViewMode < FVM_FIRST || ViewMode > FVM_LAST) && (ViewMode != (UINT)FVM_AUTO)) return E_INVALIDARG; /* Windows before Vista uses LVM_SETVIEW and possibly
11 years, 8 months
1
0
0
0
[tfaber] 58868: [ADVAPI32] - Properly stub some commonly used safer functions CORE-6942 #resolve
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Apr 27 09:15:24 2013 New Revision: 58868 URL:
http://svn.reactos.org/svn/reactos?rev=58868&view=rev
Log: [ADVAPI32] - Properly stub some commonly used safer functions CORE-6942 #resolve Added: trunk/reactos/dll/win32/advapi32/sec/safer.c (with props) Modified: trunk/reactos/dll/win32/advapi32/CMakeLists.txt trunk/reactos/dll/win32/advapi32/advapi32.spec trunk/reactos/dll/win32/advapi32/sec/misc.c Modified: trunk/reactos/dll/win32/advapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/advapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/CMakeLists.txt [iso-8859-1] Sat Apr 27 09:15:24 2013 @@ -14,7 +14,6 @@ ${REACTOS_SOURCE_DIR}/include/reactos/idl/eventlogrpc.idl ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl ${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl) - list(APPEND SOURCE crypt/crypt.c @@ -38,6 +37,7 @@ sec/cred.c sec/lsa.c sec/misc.c + sec/safer.c sec/sec.c sec/sid.c sec/trustee.c Modified: trunk/reactos/dll/win32/advapi32/advapi32.spec URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/advapi3…
============================================================================== --- trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/advapi32.spec [iso-8859-1] Sat Apr 27 09:15:24 2013 @@ -553,13 +553,13 @@ @ stdcall ReportEventA(long long long long ptr long long str ptr) @ stdcall ReportEventW(long long long long ptr long long wstr ptr) @ stdcall RevertToSelf() -@ stub SaferCloseLevel -@ stub SaferComputeTokenFromLevel +@ stdcall SaferCloseLevel(ptr) +@ stdcall SaferComputeTokenFromLevel(ptr ptr ptr long ptr) @ stdcall SaferCreateLevel(long long long ptr ptr) @ stub SaferGetLevelInformation @ stdcall SaferGetPolicyInformation(long long long ptr ptr ptr) -@ stub SaferIdentifyLevel -@ stub SaferRecordEventLogEntry +@ stdcall SaferIdentifyLevel(long ptr ptr ptr) +@ stdcall SaferRecordEventLogEntry(ptr wstr ptr) @ stub SaferSetLevelInformation @ stub SaferSetPolicyInformation @ stub SaferiChangeRegistryScope Modified: trunk/reactos/dll/win32/advapi32/sec/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/mis…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/advapi32/sec/misc.c [iso-8859-1] Sat Apr 27 09:15:24 2013 @@ -2280,26 +2280,6 @@ } /****************************************************************************** - * SaferCreateLevel [ADVAPI32.@] - */ -BOOL WINAPI SaferCreateLevel(DWORD ScopeId, DWORD LevelId, DWORD OpenFlags, - SAFER_LEVEL_HANDLE* LevelHandle, LPVOID lpReserved) -{ - FIXME("(%u, %x, %u, %p, %p) stub\n", ScopeId, LevelId, OpenFlags, LevelHandle, lpReserved); - return FALSE; -} - -/****************************************************************************** - * SaferGetPolicyInformation [ADVAPI32.@] - */ -BOOL WINAPI SaferGetPolicyInformation(DWORD scope, SAFER_POLICY_INFO_CLASS class, DWORD size, - PVOID buffer, PDWORD required, LPVOID lpReserved) -{ - FIXME("(%u %u %u %p %p %p) stub\n", scope, class, size, buffer, required, lpReserved); - return FALSE; -} - -/****************************************************************************** * QueryWindows31FilesMigration [ADVAPI32.@] * * PARAMS Added: trunk/reactos/dll/win32/advapi32/sec/safer.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/advapi32/sec/saf…
============================================================================== --- trunk/reactos/dll/win32/advapi32/sec/safer.c (added) +++ trunk/reactos/dll/win32/advapi32/sec/safer.c [iso-8859-1] Sat Apr 27 09:15:24 2013 @@ -1,0 +1,187 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Safer functions + * PROGRAMMER: Thomas Faber <thomas.faber(a)reactos.org> + */ + +/* INCLUDES ******************************************************************/ + +#include <advapi32.h> +WINE_DEFAULT_DEBUG_CHANNEL(advapi); + + +/* FUNCTIONS *****************************************************************/ + +/********************************************************************** + * SaferCreateLevel + * + * @unimplemented + */ +BOOL +WINAPI +SaferCreateLevel( + _In_ DWORD dwScopeId, + _In_ DWORD dwLevelId, + _In_ DWORD OpenFlags, + _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle, + _Reserved_ PVOID pReserved) +{ + FIXME("(%lu, %lu, %lu, %p, %p) stub\n", dwScopeId, dwLevelId, OpenFlags, pLevelHandle, pReserved); + *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42; + return TRUE; +} + + +/********************************************************************** + * SaferIdentifyLevel + * + * @unimplemented + */ +BOOL +WINAPI +SaferIdentifyLevel( + _In_ DWORD dwNumProperties, + _In_reads_opt_(dwNumProperties) PSAFER_CODE_PROPERTIES pCodeProperties, + _Outptr_ SAFER_LEVEL_HANDLE *pLevelHandle, + _Reserved_ PVOID pReserved) +{ + DWORD i; + + if (pLevelHandle == NULL) + { + SetLastError(ERROR_NOACCESS); + return FALSE; + } + + for (i = 0; i < dwNumProperties; i++) + { + if (pCodeProperties[i].cbSize != sizeof(SAFER_CODE_PROPERTIES_V1)) + { + SetLastError(ERROR_BAD_LENGTH); + return FALSE; + } + } + + FIXME("(%lu, %p, %p, %p) stub\n", dwNumProperties, pCodeProperties, pLevelHandle, pReserved); + + *pLevelHandle = (SAFER_LEVEL_HANDLE)0x42; + return TRUE; +} + + +/********************************************************************** + * SaferCloseLevel + * + * @unimplemented + */ +BOOL +WINAPI +SaferCloseLevel( + _In_ SAFER_LEVEL_HANDLE hLevelHandle) +{ + FIXME("(%p) stub\n", hLevelHandle); + if (hLevelHandle != (SAFER_LEVEL_HANDLE)0x42) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + return TRUE; +} + + +BOOL +WINAPI +SaferGetLevelInformation( + _In_ SAFER_LEVEL_HANDLE LevelHandle, + _In_ SAFER_OBJECT_INFO_CLASS dwInfoType, + _Out_writes_bytes_opt_(dwInBufferSize) PVOID pQueryBuffer, + _In_ DWORD dwInBufferSize, + _Out_ PDWORD pdwOutBufferSize); + + +BOOL +WINAPI +SaferSetLevelInformation( + _In_ SAFER_LEVEL_HANDLE LevelHandle, + _In_ SAFER_OBJECT_INFO_CLASS dwInfoType, + _In_reads_bytes_(dwInBufferSize) PVOID pQueryBuffer, + _In_ DWORD dwInBufferSize); + + +/********************************************************************** + * SaferGetPolicyInformation + * + * @unimplemented + */ +BOOL +WINAPI +SaferGetPolicyInformation( + _In_ DWORD dwScopeId, + _In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass, + _In_ DWORD InfoBufferSize, + _Out_writes_bytes_opt_(InfoBufferSize) PVOID InfoBuffer, + _Out_ PDWORD InfoBufferRetSize, + _Reserved_ PVOID pReserved) +{ + FIXME("(%lu, %d, %lu, %p, %p, %p) stub\n", dwScopeId, SaferPolicyInfoClass, InfoBufferSize, InfoBuffer, InfoBufferRetSize, pReserved); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +BOOL +WINAPI +SaferSetPolicyInformation( + _In_ DWORD dwScopeId, + _In_ SAFER_POLICY_INFO_CLASS SaferPolicyInfoClass, + _In_ DWORD InfoBufferSize, + _In_reads_bytes_(InfoBufferSize) PVOID InfoBuffer, + _Reserved_ PVOID pReserved); + + +/********************************************************************** + * SaferComputeTokenFromLevel + * + * @unimplemented + */ +BOOL +WINAPI +SaferComputeTokenFromLevel( + _In_ SAFER_LEVEL_HANDLE LevelHandle, + _In_opt_ HANDLE InAccessToken, + _Out_ PHANDLE OutAccessToken, + _In_ DWORD dwFlags, + _Inout_opt_ PVOID pReserved) +{ + FIXME("(%p, %p, %p, 0x%lx, %p) stub\n", LevelHandle, InAccessToken, OutAccessToken, dwFlags, pReserved); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/********************************************************************** + * SaferRecordEventLogEntry + * + * @unimplemented + */ +BOOL +WINAPI +SaferRecordEventLogEntry( + _In_ SAFER_LEVEL_HANDLE hLevel, + _In_ PCWSTR szTargetPath, + _Reserved_ PVOID pReserved) +{ + FIXME("(%p, %s, %p) stub\n", hLevel, wine_dbgstr_w(szTargetPath), pReserved); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +BOOL +WINAPI +SaferiIsExecutableFileType( + _In_ PCWSTR szFullPath, + _In_ BOOLEAN bFromShellExecute); + +/* EOF */ Propchange: trunk/reactos/dll/win32/advapi32/sec/safer.c ------------------------------------------------------------------------------ svn:eol-style = native
11 years, 8 months
1
0
0
0
[tfaber] 58867: [ADVAPI32_APITEST] - Add basic parameter tests for SaferIdentifyLevel CORE-6942
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Apr 27 09:12:20 2013 New Revision: 58867 URL:
http://svn.reactos.org/svn/reactos?rev=58867&view=rev
Log: [ADVAPI32_APITEST] - Add basic parameter tests for SaferIdentifyLevel CORE-6942 Added: trunk/rostests/apitests/advapi32/SaferIdentifyLevel.c (with props) Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt trunk/rostests/apitests/advapi32/testlist.c Modified: trunk/rostests/apitests/advapi32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/CMakeLi…
============================================================================== --- trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/CMakeLists.txt [iso-8859-1] Sat Apr 27 09:12:20 2013 @@ -1,12 +1,13 @@ list(APPEND SOURCE - CreateService.c - LockDatabase.c - QueryServiceConfig2.c - testlist.c) + CreateService.c + LockDatabase.c + QueryServiceConfig2.c + SaferIdentifyLevel.c + testlist.c) add_executable(advapi32_apitest ${SOURCE}) -target_link_libraries(advapi32_apitest wine) +target_link_libraries(advapi32_apitest wine ${PSEH_LIB}) set_module_type(advapi32_apitest win32cui) add_importlibs(advapi32_apitest advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET advapi32_apitest DESTINATION reactos/bin FOR all) Added: trunk/rostests/apitests/advapi32/SaferIdentifyLevel.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/SaferId…
============================================================================== --- trunk/rostests/apitests/advapi32/SaferIdentifyLevel.c (added) +++ trunk/rostests/apitests/advapi32/SaferIdentifyLevel.c [iso-8859-1] Sat Apr 27 09:12:20 2013 @@ -1,0 +1,125 @@ +/* + * PROJECT: ReactOS api tests + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: Test for SaferIdentifyLevel + * PROGRAMMER: Thomas Faber <thfabba(a)gmx.de> + */ + +#define WIN32_NO_STATUS +#include <wine/test.h> +#include <windows.h> +#include <ndk/ntndk.h> +#include <winsafer.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 InvalidPointer ((PVOID)0x5555555555555555ULL) + +#define SaferIdentifyLevel(c, p, h, r) SaferIdentifyLevel(c, (PSAFER_CODE_PROPERTIES)(p), h, r) + +START_TEST(SaferIdentifyLevel) +{ + NTSTATUS ExceptionStatus; + BOOL ret; + DWORD error; + SAFER_LEVEL_HANDLE handle; + SAFER_CODE_PROPERTIES_V2 props[16]; + + StartSeh() + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(0, NULL, NULL, NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_NOACCESS, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); + + StartSeh() + (VOID)SaferIdentifyLevel(0, NULL, &handle, NULL); + EndSeh(STATUS_ACCESS_VIOLATION); + + StartSeh() + ZeroMemory(props, sizeof(props)); + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(16, props, &handle, NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); + + StartSeh() + ZeroMemory(props, sizeof(props)); + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(1, props, NULL, NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_NOACCESS, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); + + StartSeh() + handle = InvalidPointer; + ZeroMemory(props, sizeof(props)); + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(1, props, &handle, NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(handle == InvalidPointer, "handle = %p\n", handle); + ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error); + if (handle && handle != InvalidPointer) + SaferCloseLevel(handle); + EndSeh(STATUS_SUCCESS); + + /* Struct sizes */ + StartSeh() + handle = InvalidPointer; + ZeroMemory(props, sizeof(props)); + props[0].cbSize = sizeof(SAFER_CODE_PROPERTIES_V1); + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(1, props, &handle, NULL); + error = GetLastError(); + ok(ret == TRUE, "ret = %d\n", ret); + ok(handle != NULL && handle != INVALID_HANDLE_VALUE && handle != InvalidPointer, "handle = %p\n", handle); + ok(error == 0xbadbad00, "error = %lu\n", error); + if (handle && handle != InvalidPointer) + { + ret = SaferCloseLevel(handle); + ok(ret == TRUE, "ret = %d\n", ret); + } + EndSeh(STATUS_SUCCESS); + + StartSeh() + handle = InvalidPointer; + ZeroMemory(props, sizeof(props)); + props[0].cbSize = sizeof(SAFER_CODE_PROPERTIES_V2); + SetLastError(0xbadbad00); + ret = SaferIdentifyLevel(1, props, &handle, NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(handle == InvalidPointer, "handle = %p\n", handle); + ok(error == ERROR_BAD_LENGTH, "error = %lu\n", error); + if (handle && handle != InvalidPointer) + SaferCloseLevel(handle); + EndSeh(STATUS_SUCCESS); + + /* Test SaferCloseLevel too */ + StartSeh() + ret = SaferCloseLevel(NULL); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); + + StartSeh() + ret = SaferCloseLevel(INVALID_HANDLE_VALUE); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); + + StartSeh() + ret = SaferCloseLevel(InvalidPointer); + error = GetLastError(); + ok(ret == FALSE, "ret = %d\n", ret); + ok(error == ERROR_INVALID_HANDLE, "error = %lu\n", error); + EndSeh(STATUS_SUCCESS); +} Propchange: trunk/rostests/apitests/advapi32/SaferIdentifyLevel.c ------------------------------------------------------------------------------ svn:eol-style = native Modified: trunk/rostests/apitests/advapi32/testlist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/advapi32/testlis…
============================================================================== --- trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] (original) +++ trunk/rostests/apitests/advapi32/testlist.c [iso-8859-1] Sat Apr 27 09:12:20 2013 @@ -6,12 +6,14 @@ extern void func_CreateService(void); extern void func_LockDatabase(void); extern void func_QueryServiceConfig2(void); +extern void func_SaferIdentifyLevel(void); const struct test winetest_testlist[] = { { "CreateService", func_CreateService }, { "LockDatabase" , func_LockDatabase }, { "QueryServiceConfig2", func_QueryServiceConfig2 }, + { "SaferIdentifyLevel", func_SaferIdentifyLevel }, { 0, 0 } };
11 years, 8 months
1
0
0
0
← Newer
1
2
3
4
5
6
...
27
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
Results per page:
10
25
50
100
200