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 2014
----- 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
19 participants
730 discussions
Start a n
N
ew thread
[akhaldi] 64932: [DSOUND] * ProjectVector is used in commented out code.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Oct 23 18:07:43 2014 New Revision: 64932 URL:
http://svn.reactos.org/svn/reactos?rev=64932&view=rev
Log: [DSOUND] * ProjectVector is used in commented out code. Modified: trunk/reactos/dll/directx/wine/dsound/sound3d.c Modified: trunk/reactos/dll/directx/wine/dsound/sound3d.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/dsound/so…
============================================================================== --- trunk/reactos/dll/directx/wine/dsound/sound3d.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/dsound/sound3d.c [iso-8859-1] Thu Oct 23 18:07:43 2014 @@ -121,6 +121,7 @@ return c; } +#ifndef __REACTOS__ /* calculates the length of vector's projection on another vector */ static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p) { @@ -131,6 +132,7 @@ p->y, p->z, result); return result; } +#endif /******************************************************************************* * 3D Buffer and Listener mixing
10 years, 2 months
1
0
0
0
[tfaber] 64931: [NTOS:FORMATTING] - Try to fix indentation in iomgr/driver.c. Whitespace changes only
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Oct 23 17:59:16 2014 New Revision: 64931 URL:
http://svn.reactos.org/svn/reactos?rev=64931&view=rev
Log: [NTOS:FORMATTING] - Try to fix indentation in iomgr/driver.c. Whitespace changes only Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Thu Oct 23 17:59:16 2014 @@ -39,15 +39,16 @@ /* PRIVATE FUNCTIONS **********************************************************/ -NTSTATUS NTAPI +NTSTATUS +NTAPI IopInvalidDeviceRequest( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -{ - Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; - Irp->IoStatus.Information = 0; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_INVALID_DEVICE_REQUEST; + PDEVICE_OBJECT DeviceObject, + PIRP Irp) +{ + Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST; + Irp->IoStatus.Information = 0; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_INVALID_DEVICE_REQUEST; } VOID @@ -64,8 +65,7 @@ ASSERT(!DriverObject->DeviceObject); /* Get the extension and loop them */ - DriverExtension = IoGetDrvObjExtension(DriverObject)-> - ClientDriverExtension; + DriverExtension = IoGetDrvObjExtension(DriverObject)->ClientDriverExtension; while (DriverExtension) { /* Get the next one */ @@ -98,61 +98,60 @@ } } -NTSTATUS FASTCALL +NTSTATUS +FASTCALL IopGetDriverObject( - PDRIVER_OBJECT *DriverObject, - PUNICODE_STRING ServiceName, - BOOLEAN FileSystem) -{ - PDRIVER_OBJECT Object; - WCHAR NameBuffer[MAX_PATH]; - UNICODE_STRING DriverName; - NTSTATUS Status; - - DPRINT("IopGetDriverObject(%p '%wZ' %x)\n", - DriverObject, ServiceName, FileSystem); - - *DriverObject = NULL; - - /* Create ModuleName string */ - if (ServiceName == NULL || ServiceName->Buffer == NULL) - /* We don't know which DriverObject we have to open */ - return STATUS_INVALID_PARAMETER_2; - - DriverName.Buffer = NameBuffer; - DriverName.Length = 0; - DriverName.MaximumLength = sizeof(NameBuffer); - - if (FileSystem == TRUE) - RtlAppendUnicodeToString(&DriverName, FILESYSTEM_ROOT_NAME); - else - RtlAppendUnicodeToString(&DriverName, DRIVER_ROOT_NAME); - RtlAppendUnicodeStringToString(&DriverName, ServiceName); - - DPRINT("Driver name: '%wZ'\n", &DriverName); - - /* Open driver object */ - Status = ObReferenceObjectByName( - &DriverName, - OBJ_OPENIF | OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, /* Attributes */ - NULL, /* PassedAccessState */ - 0, /* DesiredAccess */ - IoDriverObjectType, - KernelMode, - NULL, /* ParseContext */ - (PVOID*)&Object); - - if (!NT_SUCCESS(Status)) - { - DPRINT("Failed to reference driver object, status=0x%08x\n", Status); - return Status; - } - - *DriverObject = Object; - - DPRINT("Driver Object: %p\n", Object); - - return STATUS_SUCCESS; + PDRIVER_OBJECT *DriverObject, + PUNICODE_STRING ServiceName, + BOOLEAN FileSystem) +{ + PDRIVER_OBJECT Object; + WCHAR NameBuffer[MAX_PATH]; + UNICODE_STRING DriverName; + NTSTATUS Status; + + DPRINT("IopGetDriverObject(%p '%wZ' %x)\n", + DriverObject, ServiceName, FileSystem); + + *DriverObject = NULL; + + /* Create ModuleName string */ + if (ServiceName == NULL || ServiceName->Buffer == NULL) + /* We don't know which DriverObject we have to open */ + return STATUS_INVALID_PARAMETER_2; + + DriverName.Buffer = NameBuffer; + DriverName.Length = 0; + DriverName.MaximumLength = sizeof(NameBuffer); + + if (FileSystem == TRUE) + RtlAppendUnicodeToString(&DriverName, FILESYSTEM_ROOT_NAME); + else + RtlAppendUnicodeToString(&DriverName, DRIVER_ROOT_NAME); + RtlAppendUnicodeStringToString(&DriverName, ServiceName); + + DPRINT("Driver name: '%wZ'\n", &DriverName); + + /* Open driver object */ + Status = ObReferenceObjectByName(&DriverName, + OBJ_OPENIF | OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, /* Attributes */ + NULL, /* PassedAccessState */ + 0, /* DesiredAccess */ + IoDriverObjectType, + KernelMode, + NULL, /* ParseContext */ + (PVOID*)&Object); + if (!NT_SUCCESS(Status)) + { + DPRINT("Failed to reference driver object, status=0x%08x\n", Status); + return Status; + } + + *DriverObject = Object; + + DPRINT("Driver Object: %p\n", Object); + + return STATUS_SUCCESS; } /* @@ -193,7 +192,6 @@ * * Display 'Loading XXX...' message. */ - VOID FASTCALL INIT_FUNCTION @@ -234,55 +232,55 @@ * Remarks * The input image path isn't freed on error. */ - NTSTATUS FASTCALL IopNormalizeImagePath( - _Inout_ _When_(return>=0, _At_(ImagePath->Buffer, _Post_notnull_ __drv_allocatesMem(Mem))) - PUNICODE_STRING ImagePath, - _In_ PUNICODE_STRING ServiceName) -{ - UNICODE_STRING InputImagePath; - - DPRINT("Normalizing image path '%wZ' for service '%wZ'\n", ImagePath, ServiceName); - - RtlCopyMemory( - &InputImagePath, - ImagePath, - sizeof(UNICODE_STRING)); - - if (InputImagePath.Length == 0) - { - ImagePath->Length = 0; - ImagePath->MaximumLength = - (33 * sizeof(WCHAR)) + ServiceName->Length + sizeof(UNICODE_NULL); - ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->MaximumLength); - if (ImagePath->Buffer == NULL) - return STATUS_NO_MEMORY; - - RtlAppendUnicodeToString(ImagePath, L"\\SystemRoot\\system32\\drivers\\"); - RtlAppendUnicodeStringToString(ImagePath, ServiceName); - RtlAppendUnicodeToString(ImagePath, L".sys"); - } else - if (InputImagePath.Buffer[0] != L'\\') - { - ImagePath->Length = 0; - ImagePath->MaximumLength = - 12 * sizeof(WCHAR) + InputImagePath.Length + sizeof(UNICODE_NULL); - ImagePath->Buffer = ExAllocatePool(NonPagedPool, ImagePath->MaximumLength); - if (ImagePath->Buffer == NULL) - return STATUS_NO_MEMORY; - - RtlAppendUnicodeToString(ImagePath, L"\\SystemRoot\\"); - RtlAppendUnicodeStringToString(ImagePath, &InputImagePath); - - /* Free caller's string */ - ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY); - } - - DPRINT("Normalized image path is '%wZ' for service '%wZ'\n", ImagePath, ServiceName); - - return STATUS_SUCCESS; + _Inout_ _When_(return>=0, _At_(ImagePath->Buffer, _Post_notnull_ __drv_allocatesMem(Mem))) + PUNICODE_STRING ImagePath, + _In_ PUNICODE_STRING ServiceName) +{ + UNICODE_STRING InputImagePath; + + DPRINT("Normalizing image path '%wZ' for service '%wZ'\n", ImagePath, ServiceName); + + RtlCopyMemory(&InputImagePath, + ImagePath, + sizeof(UNICODE_STRING)); + + if (InputImagePath.Length == 0) + { + ImagePath->Length = 0; + ImagePath->MaximumLength = + (33 * sizeof(WCHAR)) + ServiceName->Length + sizeof(UNICODE_NULL); + ImagePath->Buffer = ExAllocatePool(NonPagedPool, + ImagePath->MaximumLength); + if (ImagePath->Buffer == NULL) + return STATUS_NO_MEMORY; + + RtlAppendUnicodeToString(ImagePath, L"\\SystemRoot\\system32\\drivers\\"); + RtlAppendUnicodeStringToString(ImagePath, ServiceName); + RtlAppendUnicodeToString(ImagePath, L".sys"); + } + else if (InputImagePath.Buffer[0] != L'\\') + { + ImagePath->Length = 0; + ImagePath->MaximumLength = + 12 * sizeof(WCHAR) + InputImagePath.Length + sizeof(UNICODE_NULL); + ImagePath->Buffer = ExAllocatePool(NonPagedPool, + ImagePath->MaximumLength); + if (ImagePath->Buffer == NULL) + return STATUS_NO_MEMORY; + + RtlAppendUnicodeToString(ImagePath, L"\\SystemRoot\\"); + RtlAppendUnicodeStringToString(ImagePath, &InputImagePath); + + /* Free caller's string */ + ExFreePoolWithTag(InputImagePath.Buffer, TAG_RTLREGISTRY); + } + + DPRINT("Normalized image path is '%wZ' for service '%wZ'\n", ImagePath, ServiceName); + + return STATUS_SUCCESS; } /* @@ -297,130 +295,129 @@ * Return Value * Status */ - -NTSTATUS FASTCALL +NTSTATUS +FASTCALL IopLoadServiceModule( - IN PUNICODE_STRING ServiceName, - OUT PLDR_DATA_TABLE_ENTRY *ModuleObject) -{ - RTL_QUERY_REGISTRY_TABLE QueryTable[3]; - ULONG ServiceStart; - UNICODE_STRING ServiceImagePath, CCSName; - NTSTATUS Status; - HANDLE CCSKey, ServiceKey; - PVOID BaseAddress; + IN PUNICODE_STRING ServiceName, + OUT PLDR_DATA_TABLE_ENTRY *ModuleObject) +{ + RTL_QUERY_REGISTRY_TABLE QueryTable[3]; + ULONG ServiceStart; + UNICODE_STRING ServiceImagePath, CCSName; + NTSTATUS Status; + HANDLE CCSKey, ServiceKey; + PVOID BaseAddress; ASSERT(ServiceName->Length); DPRINT("IopLoadServiceModule(%wZ, 0x%p)\n", ServiceName, ModuleObject); - if (ExpInTextModeSetup) - { - /* We have no registry, but luckily we know where all the drivers are */ - - /* ServiceStart < 4 is all that matters */ - ServiceStart = 0; - - /* IopNormalizeImagePath will do all of the work for us if we give it an empty string */ - ServiceImagePath.Length = ServiceImagePath.MaximumLength = 0; - ServiceImagePath.Buffer = NULL; - } - else - { - /* Open CurrentControlSet */ - RtlInitUnicodeString(&CCSName, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services"); - Status = IopOpenRegistryKeyEx(&CCSKey, NULL, &CCSName, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with Status %08X\n", - &CCSName, Status); - return Status; - } - - /* Open service key */ - Status = IopOpenRegistryKeyEx(&ServiceKey, CCSKey, ServiceName, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with Status %08X\n", - ServiceName, Status); - ZwClose(CCSKey); - return Status; - } - - /* - * Get information about the service. - */ - - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - - RtlInitUnicodeString(&ServiceImagePath, NULL); - - QueryTable[0].Name = L"Start"; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[0].EntryContext = &ServiceStart; - - QueryTable[1].Name = L"ImagePath"; - QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[1].EntryContext = &ServiceImagePath; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, - (PWSTR)ServiceKey, QueryTable, NULL, NULL); - - ZwClose(ServiceKey); - ZwClose(CCSKey); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); - return Status; - } - } - - /* - * Normalize the image path for all later processing. - */ - - Status = IopNormalizeImagePath(&ServiceImagePath, ServiceName); - - if (!NT_SUCCESS(Status)) - { - DPRINT("IopNormalizeImagePath() failed (Status %x)\n", Status); - return Status; - } - - /* - * Case for disabled drivers - */ - - if (ServiceStart >= 4) - { - /* We can't load this */ - Status = STATUS_DRIVER_UNABLE_TO_LOAD; - } - else - { - DPRINT("Loading module from %wZ\n", &ServiceImagePath); - Status = MmLoadSystemImage(&ServiceImagePath, NULL, NULL, 0, (PVOID)ModuleObject, &BaseAddress); - if (NT_SUCCESS(Status)) - { - IopDisplayLoadingMessage(ServiceName); - } - } - - ExFreePool(ServiceImagePath.Buffer); - - /* - * Now check if the module was loaded successfully. - */ - - if (!NT_SUCCESS(Status)) - { - DPRINT("Module loading failed (Status %x)\n", Status); - } - - DPRINT("Module loading (Status %x)\n", Status); - - return Status; + if (ExpInTextModeSetup) + { + /* We have no registry, but luckily we know where all the drivers are */ + + /* ServiceStart < 4 is all that matters */ + ServiceStart = 0; + + /* IopNormalizeImagePath will do all of the work for us if we give it an empty string */ + ServiceImagePath.Length = ServiceImagePath.MaximumLength = 0; + ServiceImagePath.Buffer = NULL; + } + else + { + /* Open CurrentControlSet */ + RtlInitUnicodeString(&CCSName, + L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services"); + Status = IopOpenRegistryKeyEx(&CCSKey, NULL, &CCSName, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with Status %08X\n", + &CCSName, Status); + return Status; + } + + /* Open service key */ + Status = IopOpenRegistryKeyEx(&ServiceKey, CCSKey, ServiceName, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopOpenRegistryKeyEx() failed for '%wZ' with Status %08X\n", + ServiceName, Status); + ZwClose(CCSKey); + return Status; + } + + /* + * Get information about the service. + */ + RtlZeroMemory(QueryTable, sizeof(QueryTable)); + + RtlInitUnicodeString(&ServiceImagePath, NULL); + + QueryTable[0].Name = L"Start"; + QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[0].EntryContext = &ServiceStart; + + QueryTable[1].Name = L"ImagePath"; + QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[1].EntryContext = &ServiceImagePath; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PWSTR)ServiceKey, + QueryTable, + NULL, + NULL); + + ZwClose(ServiceKey); + ZwClose(CCSKey); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); + return Status; + } + } + + /* + * Normalize the image path for all later processing. + */ + Status = IopNormalizeImagePath(&ServiceImagePath, ServiceName); + + if (!NT_SUCCESS(Status)) + { + DPRINT("IopNormalizeImagePath() failed (Status %x)\n", Status); + return Status; + } + + /* + * Case for disabled drivers + */ + if (ServiceStart >= 4) + { + /* We can't load this */ + Status = STATUS_DRIVER_UNABLE_TO_LOAD; + } + else + { + DPRINT("Loading module from %wZ\n", &ServiceImagePath); + Status = MmLoadSystemImage(&ServiceImagePath, NULL, NULL, 0, (PVOID)ModuleObject, &BaseAddress); + if (NT_SUCCESS(Status)) + { + IopDisplayLoadingMessage(ServiceName); + } + } + + ExFreePool(ServiceImagePath.Buffer); + + /* + * Now check if the module was loaded successfully. + */ + if (!NT_SUCCESS(Status)) + { + DPRINT("Module loading failed (Status %x)\n", Status); + } + + DPRINT("Module loading (Status %x)\n", Status); + + return Status; } VOID @@ -450,84 +447,83 @@ * On successful return this contains the driver object representing * the loaded driver. */ - -NTSTATUS FASTCALL +NTSTATUS +FASTCALL IopInitializeDriverModule( - IN PDEVICE_NODE DeviceNode, - IN PLDR_DATA_TABLE_ENTRY ModuleObject, - IN PUNICODE_STRING ServiceName, - IN BOOLEAN FileSystemDriver, - OUT PDRIVER_OBJECT *DriverObject) -{ - const WCHAR ServicesKeyName[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"; - WCHAR NameBuffer[MAX_PATH]; - UNICODE_STRING DriverName; - UNICODE_STRING RegistryKey; - PDRIVER_INITIALIZE DriverEntry; - PDRIVER_OBJECT Driver; - NTSTATUS Status; - - DriverEntry = ModuleObject->EntryPoint; - - if (ServiceName != NULL && ServiceName->Length != 0) - { - RegistryKey.Length = 0; - RegistryKey.MaximumLength = sizeof(ServicesKeyName) + ServiceName->Length; - RegistryKey.Buffer = ExAllocatePool(PagedPool, RegistryKey.MaximumLength); - if (RegistryKey.Buffer == NULL) - { - return STATUS_INSUFFICIENT_RESOURCES; - } - RtlAppendUnicodeToString(&RegistryKey, ServicesKeyName); - RtlAppendUnicodeStringToString(&RegistryKey, ServiceName); - } - else - { - RtlInitUnicodeString(&RegistryKey, NULL); - } - - /* Create ModuleName string */ - if (ServiceName && ServiceName->Length > 0) - { - if (FileSystemDriver == TRUE) - wcscpy(NameBuffer, FILESYSTEM_ROOT_NAME); - else - wcscpy(NameBuffer, DRIVER_ROOT_NAME); - - RtlInitUnicodeString(&DriverName, NameBuffer); - DriverName.MaximumLength = sizeof(NameBuffer); - - RtlAppendUnicodeStringToString(&DriverName, ServiceName); - - DPRINT("Driver name: '%wZ'\n", &DriverName); - } - else - DriverName.Length = 0; - - Status = IopCreateDriver( - DriverName.Length > 0 ? &DriverName : NULL, - DriverEntry, - &RegistryKey, - ServiceName, - ModuleObject, - &Driver); - RtlFreeUnicodeString(&RegistryKey); - - *DriverObject = Driver; - if (!NT_SUCCESS(Status)) - { - DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status); - return Status; - } - - MmFreeDriverInitialization((PLDR_DATA_TABLE_ENTRY)Driver->DriverSection); - - /* Set the driver as initialized */ - IopReadyDeviceObjects(Driver); - - if (PnpSystemInit) IopReinitializeDrivers(); - - return STATUS_SUCCESS; + IN PDEVICE_NODE DeviceNode, + IN PLDR_DATA_TABLE_ENTRY ModuleObject, + IN PUNICODE_STRING ServiceName, + IN BOOLEAN FileSystemDriver, + OUT PDRIVER_OBJECT *DriverObject) +{ + const WCHAR ServicesKeyName[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"; + WCHAR NameBuffer[MAX_PATH]; + UNICODE_STRING DriverName; + UNICODE_STRING RegistryKey; + PDRIVER_INITIALIZE DriverEntry; + PDRIVER_OBJECT Driver; + NTSTATUS Status; + + DriverEntry = ModuleObject->EntryPoint; + + if (ServiceName != NULL && ServiceName->Length != 0) + { + RegistryKey.Length = 0; + RegistryKey.MaximumLength = sizeof(ServicesKeyName) + ServiceName->Length; + RegistryKey.Buffer = ExAllocatePool(PagedPool, RegistryKey.MaximumLength); + if (RegistryKey.Buffer == NULL) + { + return STATUS_INSUFFICIENT_RESOURCES; + } + RtlAppendUnicodeToString(&RegistryKey, ServicesKeyName); + RtlAppendUnicodeStringToString(&RegistryKey, ServiceName); + } + else + { + RtlInitUnicodeString(&RegistryKey, NULL); + } + + /* Create ModuleName string */ + if (ServiceName && ServiceName->Length > 0) + { + if (FileSystemDriver == TRUE) + wcscpy(NameBuffer, FILESYSTEM_ROOT_NAME); + else + wcscpy(NameBuffer, DRIVER_ROOT_NAME); + + RtlInitUnicodeString(&DriverName, NameBuffer); + DriverName.MaximumLength = sizeof(NameBuffer); + + RtlAppendUnicodeStringToString(&DriverName, ServiceName); + + DPRINT("Driver name: '%wZ'\n", &DriverName); + } + else + DriverName.Length = 0; + + Status = IopCreateDriver(DriverName.Length > 0 ? &DriverName : NULL, + DriverEntry, + &RegistryKey, + ServiceName, + ModuleObject, + &Driver); + RtlFreeUnicodeString(&RegistryKey); + + *DriverObject = Driver; + if (!NT_SUCCESS(Status)) + { + DPRINT("IopCreateDriver() failed (Status 0x%08lx)\n", Status); + return Status; + } + + MmFreeDriverInitialization((PLDR_DATA_TABLE_ENTRY)Driver->DriverSection); + + /* Set the driver as initialized */ + IopReadyDeviceObjects(Driver); + + if (PnpSystemInit) IopReinitializeDrivers(); + + return STATUS_SUCCESS; } /* @@ -535,64 +531,67 @@ * * Internal routine used by IopAttachFilterDrivers. */ - -NTSTATUS NTAPI +NTSTATUS +NTAPI IopAttachFilterDriversCallback( - PWSTR ValueName, - ULONG ValueType, - PVOID ValueData, - ULONG ValueLength, - PVOID Context, - PVOID EntryContext) -{ - PDEVICE_NODE DeviceNode = Context; - UNICODE_STRING ServiceName; - PWCHAR Filters; - PLDR_DATA_TABLE_ENTRY ModuleObject; - PDRIVER_OBJECT DriverObject; - NTSTATUS Status; - - /* No filter value present */ - if (ValueType == REG_NONE) - return STATUS_SUCCESS; - - for (Filters = ValueData; - ((ULONG_PTR)Filters - (ULONG_PTR)ValueData) < ValueLength && - *Filters != 0; - Filters += (ServiceName.Length / sizeof(WCHAR)) + 1) - { - DPRINT("Filter Driver: %S (%wZ)\n", Filters, &DeviceNode->InstancePath); - - ServiceName.Buffer = Filters; - ServiceName.MaximumLength = - ServiceName.Length = (USHORT)wcslen(Filters) * sizeof(WCHAR); - - Status = IopGetDriverObject(&DriverObject, - &ServiceName, - FALSE); - if (!NT_SUCCESS(Status)) - { - /* Load and initialize the filter driver */ - Status = IopLoadServiceModule(&ServiceName, &ModuleObject); - if (!NT_SUCCESS(Status)) - return Status; - - Status = IopInitializeDriverModule(DeviceNode, ModuleObject, &ServiceName, - FALSE, &DriverObject); - if (!NT_SUCCESS(Status)) - return Status; - } - - Status = IopInitializeDevice(DeviceNode, DriverObject); - - /* Remove extra reference */ - ObDereferenceObject(DriverObject); - - if (!NT_SUCCESS(Status)) - return Status; - } - - return STATUS_SUCCESS; + PWSTR ValueName, + ULONG ValueType, + PVOID ValueData, + ULONG ValueLength, + PVOID Context, + PVOID EntryContext) +{ + PDEVICE_NODE DeviceNode = Context; + UNICODE_STRING ServiceName; + PWCHAR Filters; + PLDR_DATA_TABLE_ENTRY ModuleObject; + PDRIVER_OBJECT DriverObject; + NTSTATUS Status; + + /* No filter value present */ + if (ValueType == REG_NONE) + return STATUS_SUCCESS; + + for (Filters = ValueData; + ((ULONG_PTR)Filters - (ULONG_PTR)ValueData) < ValueLength && + *Filters != 0; + Filters += (ServiceName.Length / sizeof(WCHAR)) + 1) + { + DPRINT("Filter Driver: %S (%wZ)\n", Filters, &DeviceNode->InstancePath); + + ServiceName.Buffer = Filters; + ServiceName.MaximumLength = + ServiceName.Length = (USHORT)wcslen(Filters) * sizeof(WCHAR); + + Status = IopGetDriverObject(&DriverObject, + &ServiceName, + FALSE); + if (!NT_SUCCESS(Status)) + { + /* Load and initialize the filter driver */ + Status = IopLoadServiceModule(&ServiceName, &ModuleObject); + if (!NT_SUCCESS(Status)) + return Status; + + Status = IopInitializeDriverModule(DeviceNode, + ModuleObject, + &ServiceName, + FALSE, + &DriverObject); + if (!NT_SUCCESS(Status)) + return Status; + } + + Status = IopInitializeDevice(DeviceNode, DriverObject); + + /* Remove extra reference */ + ObDereferenceObject(DriverObject); + + if (!NT_SUCCESS(Status)) + return Status; + } + + return STATUS_SUCCESS; } /* @@ -605,143 +604,148 @@ * Set to TRUE for loading lower level filters or FALSE for upper * level filters. */ - -NTSTATUS FASTCALL +NTSTATUS +FASTCALL IopAttachFilterDrivers( - PDEVICE_NODE DeviceNode, - BOOLEAN Lower) -{ - RTL_QUERY_REGISTRY_TABLE QueryTable[2] = { { NULL, 0, NULL, NULL, 0, NULL, 0 }, }; - UNICODE_STRING Class; - WCHAR ClassBuffer[40]; - UNICODE_STRING EnumRoot = RTL_CONSTANT_STRING(ENUM_ROOT); - HANDLE EnumRootKey, SubKey; - NTSTATUS Status; - - /* Open enumeration root key */ - Status = IopOpenRegistryKeyEx(&EnumRootKey, NULL, - &EnumRoot, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); - return Status; - } - - /* Open subkey */ - Status = IopOpenRegistryKeyEx(&SubKey, EnumRootKey, - &DeviceNode->InstancePath, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); - ZwClose(EnumRootKey); - return Status; - } - - /* - * First load the device filters - */ - QueryTable[0].QueryRoutine = IopAttachFilterDriversCallback; - if (Lower) - QueryTable[0].Name = L"LowerFilters"; - else - QueryTable[0].Name = L"UpperFilters"; - QueryTable[0].Flags = 0; - QueryTable[0].DefaultType = REG_NONE; - - Status = RtlQueryRegistryValues( - RTL_REGISTRY_HANDLE, - (PWSTR)SubKey, - QueryTable, - DeviceNode, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to load device %s filters: %08X\n", - Lower ? "lower" : "upper", Status); - ZwClose(SubKey); - ZwClose(EnumRootKey); - return Status; - } - - /* - * Now get the class GUID - */ - Class.Length = 0; - Class.MaximumLength = 40 * sizeof(WCHAR); - Class.Buffer = ClassBuffer; - QueryTable[0].QueryRoutine = NULL; - QueryTable[0].Name = L"ClassGUID"; - QueryTable[0].EntryContext = &Class; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_DIRECT; - - Status = RtlQueryRegistryValues( - RTL_REGISTRY_HANDLE, - (PWSTR)SubKey, - QueryTable, - DeviceNode, - NULL); - - /* Close handles */ - ZwClose(SubKey); - ZwClose(EnumRootKey); - - /* - * Load the class filter driver - */ - if (NT_SUCCESS(Status)) - { - UNICODE_STRING ControlClass = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class"); - - Status = IopOpenRegistryKeyEx(&EnumRootKey, NULL, - &ControlClass, KEY_READ); - if (!NT_SUCCESS(Status)) - { - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); - return Status; - } - - /* Open subkey */ - Status = IopOpenRegistryKeyEx(&SubKey, EnumRootKey, - &Class, KEY_READ); - if (!NT_SUCCESS(Status)) - { - /* It's okay if there's no class key */ - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); - ZwClose(EnumRootKey); - return STATUS_SUCCESS; - } - - QueryTable[0].QueryRoutine = IopAttachFilterDriversCallback; - if (Lower) - QueryTable[0].Name = L"LowerFilters"; - else - QueryTable[0].Name = L"UpperFilters"; - QueryTable[0].EntryContext = NULL; - QueryTable[0].Flags = 0; - QueryTable[0].DefaultType = REG_NONE; - - Status = RtlQueryRegistryValues( - RTL_REGISTRY_HANDLE, - (PWSTR)SubKey, - QueryTable, - DeviceNode, - NULL); - - /* Clean up */ - ZwClose(SubKey); - ZwClose(EnumRootKey); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to load class %s filters: %08X\n", - Lower ? "lower" : "upper", Status); - ZwClose(SubKey); - ZwClose(EnumRootKey); - return Status; - } - } - - return STATUS_SUCCESS; + PDEVICE_NODE DeviceNode, + BOOLEAN Lower) +{ + RTL_QUERY_REGISTRY_TABLE QueryTable[2] = { { NULL, 0, NULL, NULL, 0, NULL, 0 }, }; + UNICODE_STRING Class; + WCHAR ClassBuffer[40]; + UNICODE_STRING EnumRoot = RTL_CONSTANT_STRING(ENUM_ROOT); + HANDLE EnumRootKey, SubKey; + NTSTATUS Status; + + /* Open enumeration root key */ + Status = IopOpenRegistryKeyEx(&EnumRootKey, + NULL, + &EnumRoot, + KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + return Status; + } + + /* Open subkey */ + Status = IopOpenRegistryKeyEx(&SubKey, + EnumRootKey, + &DeviceNode->InstancePath, + KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + ZwClose(EnumRootKey); + return Status; + } + + /* + * First load the device filters + */ + QueryTable[0].QueryRoutine = IopAttachFilterDriversCallback; + if (Lower) + QueryTable[0].Name = L"LowerFilters"; + else + QueryTable[0].Name = L"UpperFilters"; + QueryTable[0].Flags = 0; + QueryTable[0].DefaultType = REG_NONE; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PWSTR)SubKey, + QueryTable, + DeviceNode, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to load device %s filters: %08X\n", + Lower ? "lower" : "upper", Status); + ZwClose(SubKey); + ZwClose(EnumRootKey); + return Status; + } + + /* + * Now get the class GUID + */ + Class.Length = 0; + Class.MaximumLength = 40 * sizeof(WCHAR); + Class.Buffer = ClassBuffer; + QueryTable[0].QueryRoutine = NULL; + QueryTable[0].Name = L"ClassGUID"; + QueryTable[0].EntryContext = &Class; + QueryTable[0].Flags = RTL_QUERY_REGISTRY_REQUIRED | RTL_QUERY_REGISTRY_DIRECT; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PWSTR)SubKey, + QueryTable, + DeviceNode, + NULL); + + /* Close handles */ + ZwClose(SubKey); + ZwClose(EnumRootKey); + + /* + * Load the class filter driver + */ + if (NT_SUCCESS(Status)) + { + UNICODE_STRING ControlClass = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Class"); + + Status = IopOpenRegistryKeyEx(&EnumRootKey, + NULL, + &ControlClass, + KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + return Status; + } + + /* Open subkey */ + Status = IopOpenRegistryKeyEx(&SubKey, + EnumRootKey, + &Class, + KEY_READ); + if (!NT_SUCCESS(Status)) + { + /* It's okay if there's no class key */ + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + ZwClose(EnumRootKey); + return STATUS_SUCCESS; + } + + QueryTable[0].QueryRoutine = IopAttachFilterDriversCallback; + if (Lower) + QueryTable[0].Name = L"LowerFilters"; + else + QueryTable[0].Name = L"UpperFilters"; + QueryTable[0].EntryContext = NULL; + QueryTable[0].Flags = 0; + QueryTable[0].DefaultType = REG_NONE; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PWSTR)SubKey, + QueryTable, + DeviceNode, + NULL); + + /* Clean up */ + ZwClose(SubKey); + ZwClose(EnumRootKey); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to load class %s filters: %08X\n", + Lower ? "lower" : "upper", Status); + ZwClose(SubKey); + ZwClose(EnumRootKey); + return Status; + } + } + + return STATUS_SUCCESS; } NTSTATUS @@ -836,7 +840,6 @@ * * Initialize a driver that is already loaded in memory. */ - NTSTATUS NTAPI INIT_FUNCTION @@ -852,85 +855,91 @@ PLIST_ENTRY NextEntry; UNICODE_STRING ServiceName; - /* - * Display 'Loading XXX...' message - */ - IopDisplayLoadingMessage(ModuleName); - InbvIndicateProgress(); - - /* - * Generate filename without path (not needed by freeldr) - */ - FileNameWithoutPath = wcsrchr(ModuleName->Buffer, L'\\'); - if (FileNameWithoutPath == NULL) - { - FileNameWithoutPath = ModuleName->Buffer; - } - else - { - FileNameWithoutPath++; - } - - /* - * Strip the file extension from ServiceName - */ - RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath); - FileExtension = wcsrchr(ServiceName.Buffer, '.'); - if (FileExtension != NULL) - { - ServiceName.Length -= (USHORT)wcslen(FileExtension) * sizeof(WCHAR); - FileExtension[0] = 0; - } - - /* - * Determine the right device object - */ - /* Use IopRootDeviceNode for now */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); - return(Status); - } - - /* Lookup the new Ldr entry in PsLoadedModuleList */ - NextEntry = PsLoadedModuleList.Flink; - while (NextEntry != &PsLoadedModuleList) - { - LdrEntry = CONTAINING_RECORD(NextEntry, - LDR_DATA_TABLE_ENTRY, - InLoadOrderLinks); - if (RtlEqualUnicodeString(ModuleName, &LdrEntry->BaseDllName, TRUE)) - { - break; - } - - NextEntry = NextEntry->Flink; - } - NT_ASSERT(NextEntry != &PsLoadedModuleList); - - /* - * Initialize the driver - */ - Status = IopInitializeDriverModule(DeviceNode, LdrEntry, - &DeviceNode->ServiceName, FALSE, &DriverObject); - - if (!NT_SUCCESS(Status)) - { - IopFreeDeviceNode(DeviceNode); - return Status; - } - - Status = IopInitializeDevice(DeviceNode, DriverObject); - if (NT_SUCCESS(Status)) - { - Status = IopStartDevice(DeviceNode); - } - - /* Remove extra reference from IopInitializeDriverModule */ - ObDereferenceObject(DriverObject); - - return Status; + /* + * Display 'Loading XXX...' message + */ + IopDisplayLoadingMessage(ModuleName); + InbvIndicateProgress(); + + /* + * Generate filename without path (not needed by freeldr) + */ + FileNameWithoutPath = wcsrchr(ModuleName->Buffer, L'\\'); + if (FileNameWithoutPath == NULL) + { + FileNameWithoutPath = ModuleName->Buffer; + } + else + { + FileNameWithoutPath++; + } + + /* + * Strip the file extension from ServiceName + */ + RtlCreateUnicodeString(&ServiceName, FileNameWithoutPath); + FileExtension = wcsrchr(ServiceName.Buffer, '.'); + if (FileExtension != NULL) + { + ServiceName.Length -= (USHORT)wcslen(FileExtension) * sizeof(WCHAR); + FileExtension[0] = 0; + } + + /* + * Determine the right device object + */ + /* Use IopRootDeviceNode for now */ + Status = IopCreateDeviceNode(IopRootDeviceNode, + NULL, + &ServiceName, + &DeviceNode); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); + return(Status); + } + + /* Lookup the new Ldr entry in PsLoadedModuleList */ + NextEntry = PsLoadedModuleList.Flink; + while (NextEntry != &PsLoadedModuleList) + { + LdrEntry = CONTAINING_RECORD(NextEntry, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); + if (RtlEqualUnicodeString(ModuleName, &LdrEntry->BaseDllName, TRUE)) + { + break; + } + + NextEntry = NextEntry->Flink; + } + NT_ASSERT(NextEntry != &PsLoadedModuleList); + + /* + * Initialize the driver + */ + Status = IopInitializeDriverModule(DeviceNode, + LdrEntry, + &DeviceNode->ServiceName, + FALSE, + &DriverObject); + + if (!NT_SUCCESS(Status)) + { + IopFreeDeviceNode(DeviceNode); + return Status; + } + + Status = IopInitializeDevice(DeviceNode, DriverObject); + if (NT_SUCCESS(Status)) + { + Status = IopStartDevice(DeviceNode); + } + + /* Remove extra reference from IopInitializeDriverModule */ + ObDereferenceObject(DriverObject); + + return Status; } /* @@ -1195,180 +1204,180 @@ NTSTATUS NTAPI IopUnloadDriver(PUNICODE_STRING DriverServiceName, BOOLEAN UnloadPnpDrivers) { - RTL_QUERY_REGISTRY_TABLE QueryTable[2]; - UNICODE_STRING ImagePath; - UNICODE_STRING ServiceName; - UNICODE_STRING ObjectName; - PDRIVER_OBJECT DriverObject; - PDEVICE_OBJECT DeviceObject; - PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; - NTSTATUS Status; - LPWSTR Start; - BOOLEAN SafeToUnload = TRUE; - - DPRINT("IopUnloadDriver('%wZ', %u)\n", DriverServiceName, UnloadPnpDrivers); - - PAGED_CODE(); - - /* - * Get the service name from the registry key name - */ - - Start = wcsrchr(DriverServiceName->Buffer, L'\\'); - if (Start == NULL) - Start = DriverServiceName->Buffer; - else - Start++; - - RtlInitUnicodeString(&ServiceName, Start); - - /* - * Construct the driver object name - */ - - ObjectName.Length = ((USHORT)wcslen(Start) + 8) * sizeof(WCHAR); - ObjectName.MaximumLength = ObjectName.Length + sizeof(WCHAR); - ObjectName.Buffer = ExAllocatePool(PagedPool, ObjectName.MaximumLength); - if (!ObjectName.Buffer) return STATUS_INSUFFICIENT_RESOURCES; - wcscpy(ObjectName.Buffer, DRIVER_ROOT_NAME); - memcpy(ObjectName.Buffer + 8, Start, ObjectName.Length - 8 * sizeof(WCHAR)); - ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = 0; - - /* - * Find the driver object - */ - Status = ObReferenceObjectByName(&ObjectName, - 0, - 0, - 0, - IoDriverObjectType, - KernelMode, - 0, - (PVOID*)&DriverObject); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Can't locate driver object for %wZ\n", &ObjectName); - ExFreePool(ObjectName.Buffer); - return Status; - } - - /* - * Free the buffer for driver object name - */ - ExFreePool(ObjectName.Buffer); - - /* Check that driver is not already unloading */ - if (DriverObject->Flags & DRVO_UNLOAD_INVOKED) - { - DPRINT1("Driver deletion pending\n"); - ObDereferenceObject(DriverObject); - return STATUS_DELETE_PENDING; - } - - /* - * Get path of service... - */ - - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - - RtlInitUnicodeString(&ImagePath, NULL); - - QueryTable[0].Name = L"ImagePath"; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[0].EntryContext = &ImagePath; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, - DriverServiceName->Buffer, QueryTable, NULL, NULL); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); - ObDereferenceObject(DriverObject); - return Status; - } - - /* - * Normalize the image path for all later processing. - */ - - Status = IopNormalizeImagePath(&ImagePath, &ServiceName); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("IopNormalizeImagePath() failed (Status %x)\n", Status); - ObDereferenceObject(DriverObject); - return Status; - } - - /* - * Free the service path - */ - - ExFreePool(ImagePath.Buffer); - - /* - * Unload the module and release the references to the device object - */ + RTL_QUERY_REGISTRY_TABLE QueryTable[2]; + UNICODE_STRING ImagePath; + UNICODE_STRING ServiceName; + UNICODE_STRING ObjectName; + PDRIVER_OBJECT DriverObject; + PDEVICE_OBJECT DeviceObject; + PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; + NTSTATUS Status; + LPWSTR Start; + BOOLEAN SafeToUnload = TRUE; + + DPRINT("IopUnloadDriver('%wZ', %u)\n", DriverServiceName, UnloadPnpDrivers); + + PAGED_CODE(); + + /* + * Get the service name from the registry key name + */ + + Start = wcsrchr(DriverServiceName->Buffer, L'\\'); + if (Start == NULL) + Start = DriverServiceName->Buffer; + else + Start++; + + RtlInitUnicodeString(&ServiceName, Start); + + /* + * Construct the driver object name + */ + + ObjectName.Length = ((USHORT)wcslen(Start) + 8) * sizeof(WCHAR); + ObjectName.MaximumLength = ObjectName.Length + sizeof(WCHAR); + ObjectName.Buffer = ExAllocatePool(PagedPool, ObjectName.MaximumLength); + if (!ObjectName.Buffer) return STATUS_INSUFFICIENT_RESOURCES; + wcscpy(ObjectName.Buffer, DRIVER_ROOT_NAME); + memcpy(ObjectName.Buffer + 8, Start, ObjectName.Length - 8 * sizeof(WCHAR)); + ObjectName.Buffer[ObjectName.Length/sizeof(WCHAR)] = 0; + + /* + * Find the driver object + */ + Status = ObReferenceObjectByName(&ObjectName, + 0, + 0, + 0, + IoDriverObjectType, + KernelMode, + 0, + (PVOID*)&DriverObject); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Can't locate driver object for %wZ\n", &ObjectName); + ExFreePool(ObjectName.Buffer); + return Status; + } + + /* + * Free the buffer for driver object name + */ + ExFreePool(ObjectName.Buffer); + + /* Check that driver is not already unloading */ + if (DriverObject->Flags & DRVO_UNLOAD_INVOKED) + { + DPRINT1("Driver deletion pending\n"); + ObDereferenceObject(DriverObject); + return STATUS_DELETE_PENDING; + } + + /* + * Get path of service... + */ + RtlZeroMemory(QueryTable, sizeof(QueryTable)); + + RtlInitUnicodeString(&ImagePath, NULL); + + QueryTable[0].Name = L"ImagePath"; + QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[0].EntryContext = &ImagePath; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, + DriverServiceName->Buffer, + QueryTable, + NULL, + NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); + ObDereferenceObject(DriverObject); + return Status; + } + + /* + * Normalize the image path for all later processing. + */ + Status = IopNormalizeImagePath(&ImagePath, &ServiceName); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopNormalizeImagePath() failed (Status %x)\n", Status); + ObDereferenceObject(DriverObject); + return Status; + } + + /* + * Free the service path + */ + ExFreePool(ImagePath.Buffer); + + /* + * Unload the module and release the references to the device object + */ /* Call the load/unload routine, depending on current process */ - if (DriverObject->DriverUnload && DriverObject->DriverSection && - (UnloadPnpDrivers || (DriverObject->Flags & DRVO_LEGACY_DRIVER))) - { - /* Loop through each device object of the driver - and set DOE_UNLOAD_PENDING flag */ - DeviceObject = DriverObject->DeviceObject; - while (DeviceObject) - { - /* Set the unload pending flag for the device */ - DeviceExtension = IoGetDevObjExtension(DeviceObject); - DeviceExtension->ExtensionFlags |= DOE_UNLOAD_PENDING; - - /* Make sure there are no attached devices or no reference counts */ - if ((DeviceObject->ReferenceCount) || (DeviceObject->AttachedDevice)) - { - /* Not safe to unload */ - DPRINT1("Drivers device object is referenced or has attached devices\n"); - - SafeToUnload = FALSE; - } - - DeviceObject = DeviceObject->NextDevice; - } - - /* If not safe to unload, then return success */ - if (!SafeToUnload) - { - ObDereferenceObject(DriverObject); - return STATUS_SUCCESS; - } - - DPRINT1("Unloading driver '%wZ' (manual)\n", &DriverObject->DriverName); - - /* Set the unload invoked flag and call the unload routine */ - DriverObject->Flags |= DRVO_UNLOAD_INVOKED; - Status = IopLoadUnloadDriver(NULL, &DriverObject); - NT_ASSERT(Status == STATUS_SUCCESS); - - /* Mark the driver object temporary, so it could be deleted later */ - ObMakeTemporaryObject(DriverObject); - - /* Dereference it 2 times */ - ObDereferenceObject(DriverObject); - ObDereferenceObject(DriverObject); - - return Status; - } - else - { - DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName); - - /* Dereference one time (refd inside this function) */ - ObDereferenceObject(DriverObject); - - /* Return unloading failure */ - return STATUS_INVALID_DEVICE_REQUEST; - } + if (DriverObject->DriverUnload && DriverObject->DriverSection && + (UnloadPnpDrivers || (DriverObject->Flags & DRVO_LEGACY_DRIVER))) + { + /* Loop through each device object of the driver + and set DOE_UNLOAD_PENDING flag */ + DeviceObject = DriverObject->DeviceObject; + while (DeviceObject) + { + /* Set the unload pending flag for the device */ + DeviceExtension = IoGetDevObjExtension(DeviceObject); + DeviceExtension->ExtensionFlags |= DOE_UNLOAD_PENDING; + + /* Make sure there are no attached devices or no reference counts */ + if ((DeviceObject->ReferenceCount) || (DeviceObject->AttachedDevice)) + { + /* Not safe to unload */ + DPRINT1("Drivers device object is referenced or has attached devices\n"); + + SafeToUnload = FALSE; + } + + DeviceObject = DeviceObject->NextDevice; + } + + /* If not safe to unload, then return success */ + if (!SafeToUnload) + { + ObDereferenceObject(DriverObject); + return STATUS_SUCCESS; + } + + DPRINT1("Unloading driver '%wZ' (manual)\n", &DriverObject->DriverName); + + /* Set the unload invoked flag and call the unload routine */ + DriverObject->Flags |= DRVO_UNLOAD_INVOKED; + Status = IopLoadUnloadDriver(NULL, &DriverObject); + NT_ASSERT(Status == STATUS_SUCCESS); + + /* Mark the driver object temporary, so it could be deleted later */ + ObMakeTemporaryObject(DriverObject); + + /* Dereference it 2 times */ + ObDereferenceObject(DriverObject); + ObDereferenceObject(DriverObject); + + return Status; + } + else + { + DPRINT1("No DriverUnload function! '%wZ' will not be unloaded!\n", &DriverObject->DriverName); + + /* Dereference one time (refd inside this function) */ + ObDereferenceObject(DriverObject); + + /* Return unloading failure */ + return STATUS_INVALID_DEVICE_REQUEST; + } } VOID @@ -1652,8 +1661,8 @@ IoCreateDriver(IN PUNICODE_STRING DriverName OPTIONAL, IN PDRIVER_INITIALIZE InitializationFunction) { - PDRIVER_OBJECT DriverObject; - return IopCreateDriver(DriverName, InitializationFunction, NULL, DriverName, NULL, &DriverObject); + PDRIVER_OBJECT DriverObject; + return IopCreateDriver(DriverName, InitializationFunction, NULL, DriverName, NULL, &DriverObject); } /* @@ -1925,9 +1934,8 @@ } /* - * Get service type. - */ - + * Get service type. + */ RtlZeroMemory(&QueryTable, sizeof(QueryTable)); RtlInitUnicodeString(&ImagePath, NULL); @@ -1951,9 +1959,8 @@ } /* - * Normalize the image path for all later processing. - */ - + * Normalize the image path for all later processing. + */ Status = IopNormalizeImagePath(&ImagePath, &ServiceName); if (!NT_SUCCESS(Status)) { @@ -1978,7 +1985,6 @@ /* * Load the driver module */ - DPRINT("Loading module from %wZ\n", &ImagePath); Status = MmLoadSystemImage(&ImagePath, NULL, NULL, 0, (PVOID)&ModuleObject, &BaseAddress); if (!NT_SUCCESS(Status)) @@ -2109,7 +2115,7 @@ NTSTATUS NTAPI NtUnloadDriver(IN PUNICODE_STRING DriverServiceName) { - return IopUnloadDriver(DriverServiceName, FALSE); + return IopUnloadDriver(DriverServiceName, FALSE); } /* EOF */
10 years, 2 months
1
0
0
0
[akhaldi] 64930: [WINSPOOL.DRV] * We're not using any debugging routines here.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Oct 23 17:55:42 2014 New Revision: 64930 URL:
http://svn.reactos.org/svn/reactos?rev=64930&view=rev
Log: [WINSPOOL.DRV] * We're not using any debugging routines here. Modified: trunk/reactos/dll/win32/winspool/info.c Modified: trunk/reactos/dll/win32/winspool/info.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/winspool/info.c?…
============================================================================== --- trunk/reactos/dll/win32/winspool/info.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/winspool/info.c [iso-8859-1] Thu Oct 23 17:55:42 2014 @@ -28,10 +28,6 @@ #include <winnls.h> #include <shlwapi.h> -#include <wine/debug.h> - -WINE_DEFAULT_DEBUG_CHANNEL(winspool); - /****************************************************************************** * GetDefaultPrinterA (WINSPOOL.@) */
10 years, 2 months
1
0
0
0
[dquintana] 64929: [RSHELL] * CMenuBand: Increase the refcount of m_smc before returning it. * CMenuBand: Improve the closing logic so that the object is reusable when it needs to be, and can still...
by dquintana@svn.reactos.org
Author: dquintana Date: Thu Oct 23 17:17:16 2014 New Revision: 64929 URL:
http://svn.reactos.org/svn/reactos?rev=64929&view=rev
Log: [RSHELL] * CMenuBand: Increase the refcount of m_smc before returning it. * CMenuBand: Improve the closing logic so that the object is reusable when it needs to be, and can still be released properly. * CMenuDeskBar: Protect self against unexpected termination. * CMenuFocusManager: Refcount objects that are being used. * CStartMenu: Properly release the created objects after it's done using them (by using CComPtr instead of raw pointers). [BROWSEUI] * AddressBand: Release the addressband site when closing the band. * InternetToolbar: Do not filter away ALL the items of the favorites folder. * InternetToolbar: Do not AddRef a CComPtr that already did the refcounting itself. CORE-8690 Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp branches/shell-experiments/base/shell/rshell/CStartMenu.cpp branches/shell-experiments/dll/win32/browseui/addressband.cpp branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp branches/shell-experiments/include/psdk/shobjidl.idl branches/shell-experiments/include/reactos/undocshell.h Modified: branches/shell-experiments/base/shell/rshell/CMenuBand.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuBand.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -104,7 +104,10 @@ return E_INVALIDARG; if (ppsmc) + { + m_psmc->AddRef(); *ppsmc = m_psmc; + } if (puId) *puId = m_uId; @@ -373,6 +376,8 @@ if (m_Show == fShow) return S_OK; + m_Show = fShow; + if (m_staticToolbar != NULL) { hr = m_staticToolbar->ShowWindow(fShow); @@ -413,8 +418,6 @@ hr = m_focusManager->PopMenuBar(this); } - m_Show = fShow; - return S_OK; } @@ -435,19 +438,14 @@ if (m_staticToolbar != NULL) { m_staticToolbar->Close(); - delete m_staticToolbar; - m_staticToolbar = NULL; } if (m_SFToolbar != NULL) { m_SFToolbar->Close(); - delete m_staticToolbar; - m_staticToolbar = NULL; } if (m_site) m_site.Release(); - if (m_psmc) m_psmc.Release(); if (m_subMenuChild) m_subMenuChild.Release(); if (m_subMenuParent) m_subMenuParent.Release(); if (m_childBand) m_childBand.Release(); @@ -596,7 +594,7 @@ HRESULT CMenuBand::_IsPopup() { - return m_subMenuParent ? S_OK : S_FALSE; + return !(m_dwFlags & SMINIT_VERTICAL); } HRESULT CMenuBand::_IsTracking() @@ -606,9 +604,14 @@ HRESULT STDMETHODCALLTYPE CMenuBand::SetClient(IUnknown *punkClient) { - if (m_subMenuChild) - { - ReleaseCComPtrExpectZero(m_subMenuChild); + CComPtr<IMenuPopup> child = m_subMenuChild; + + m_subMenuChild = NULL; + + if (child) + { + IUnknown_SetSite(child, NULL); + child.Release(); } if (!punkClient) @@ -989,15 +992,29 @@ HRESULT CMenuBand::_OnPopupSubMenu(IShellMenu * childShellMenu, POINTL * pAt, RECTL * pExclude, BOOL keyInitiated) { HRESULT hr = 0; - IBandSite* pBandSite; - IDeskBar* pDeskBar; + CComPtr<IBandSite> pBandSite; + CComPtr<IDeskBar> pDeskBar; // Create the necessary objects +#if USE_SYSTEM_MENUSITE + hr = CoCreateInstance(CLSID_MenuBandSite, + NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARG(IBandSite, &pBandSite)); +#else hr = CMenuSite_Constructor(IID_PPV_ARG(IBandSite, &pBandSite)); - if (FAILED_UNEXPECTEDLY(hr)) - return hr; - +#endif + if (FAILED_UNEXPECTEDLY(hr)) + return hr; + +#if USE_SYSTEM_MENUDESKBAR + hr = CoCreateInstance(CLSID_MenuDeskBar, + NULL, + CLSCTX_INPROC_SERVER, + IID_PPV_ARG(IDeskBar, &pDeskBar)); +#else hr = CMenuDeskBar_Constructor(IID_PPV_ARG(IDeskBar, &pDeskBar)); +#endif if (FAILED_UNEXPECTEDLY(hr)) return hr; Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -47,6 +47,19 @@ { } +LRESULT CMenuDeskBar::_OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled) +{ + this->AddRef(); + + bHandled = FALSE; + return 0; +} + +void CMenuDeskBar::OnFinalMessage(HWND /* hWnd */) +{ + this->Release(); +} + HRESULT STDMETHODCALLTYPE CMenuDeskBar::Initialize(THIS) { return S_OK; @@ -245,8 +258,8 @@ } else { + SetClient(NULL); DestroyWindow(); - SetClient(NULL); } return S_OK; @@ -450,6 +463,8 @@ HRESULT STDMETHODCALLTYPE CMenuDeskBar::OnSelect(DWORD dwSelectType) { + CComPtr<IDeskBar> safeThis = this; + /* As far as I can tell, the submenu hierarchy looks like this: * * The DeskBar's Child is the Band it contains. @@ -493,6 +508,7 @@ HRESULT CMenuDeskBar::_CloseBar() { + CComPtr<IDeskBar> safeThis = this; CComPtr<IDeskBarClient> dbc; HRESULT hr; Modified: branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuDeskBar.h [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -50,6 +50,7 @@ BOOL m_Shown; DWORD m_ShowFlags; + virtual void OnFinalMessage(HWND hWnd); public: CMenuDeskBar(); virtual ~CMenuDeskBar(); @@ -60,6 +61,7 @@ DECLARE_WND_CLASS_EX(_T("BaseBar"), CS_SAVEBITS | CS_DROPSHADOW, COLOR_3DFACE) BEGIN_MSG_MAP(CMenuDeskBar) + MESSAGE_HANDLER(WM_CREATE, _OnCreate) MESSAGE_HANDLER(WM_SIZE, _OnSize) MESSAGE_HANDLER(WM_NOTIFY, _OnNotify) MESSAGE_HANDLER(WM_PAINT, _OnPaint) @@ -125,6 +127,7 @@ private: // message handlers + LRESULT _OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT _OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT _OnNotify(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); LRESULT _OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled); Modified: branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMenuFocusManager.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -759,7 +759,9 @@ HRESULT CMenuFocusManager::PushMenuBar(CMenuBand * mb) { - TRACE("PushTrackedPopup %p\n", mb); + DbgPrint("PushMenuBar %p\n", mb); + + mb->AddRef(); _ASSERT(m_bandCount == 0); @@ -772,7 +774,9 @@ HRESULT CMenuFocusManager::PushMenuPopup(CMenuBand * mb) { - TRACE("PushTrackedPopup %p\n", mb); + DbgPrint("PushTrackedPopup %p\n", mb); + + mb->AddRef(); _ASSERT(!m_current || m_current->type != TrackedMenuEntry); @@ -793,7 +797,7 @@ HRESULT CMenuFocusManager::PushTrackedPopup(HMENU popup) { - TRACE("PushTrackedPopup %p\n", popup); + DbgPrint("PushTrackedPopup %p\n", popup); _ASSERT(m_bandCount > 0); _ASSERT(!m_current || m_current->type != TrackedMenuEntry); @@ -802,7 +806,7 @@ if (FAILED_UNEXPECTEDLY(hr)) return hr; - TRACE("PushTrackedPopup %p\n", popup); + DbgPrint("PushTrackedPopup %p\n", popup); m_selectedMenu = popup; m_selectedItem = -1; m_selectedItemFlags = 0; @@ -816,7 +820,7 @@ CMenuBand * mbc; HRESULT hr; - TRACE("PopMenuBar %p\n", mb); + DbgPrint("PopMenuBar %p\n", mb); hr = PopFromArray(&type, &mbc, NULL); if (FAILED_UNEXPECTEDLY(hr)) @@ -834,6 +838,8 @@ mbc->_SetParentBand(NULL); + mbc->Release(); + hr = UpdateFocus(); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -853,7 +859,7 @@ CMenuBand * mbc; HRESULT hr; - TRACE("PopMenuPopup %p\n", mb); + DbgPrint("PopMenuPopup %p\n", mb); hr = PopFromArray(&type, &mbc, NULL); if (FAILED_UNEXPECTEDLY(hr)) @@ -871,6 +877,8 @@ mbc->_SetParentBand(NULL); + mbc->Release(); + hr = UpdateFocus(); if (FAILED_UNEXPECTEDLY(hr)) return hr; @@ -890,7 +898,7 @@ HMENU hmenu; HRESULT hr; - TRACE("PopTrackedPopup %p\n", popup); + DbgPrint("PopTrackedPopup %p\n", popup); hr = PopFromArray(&type, NULL, &hmenu); if (FAILED_UNEXPECTEDLY(hr)) Modified: branches/shell-experiments/base/shell/rshell/CStartMenu.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rs…
============================================================================== --- branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CStartMenu.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -390,9 +390,9 @@ HRESULT WINAPI CStartMenu_Constructor(REFIID riid, void **ppv) { - IShellMenu* pShellMenu; - IBandSite* pBandSite; - IDeskBar* pDeskBar; + CComPtr<IShellMenu> pShellMenu; + CComPtr<IBandSite> pBandSite; + CComPtr<IDeskBar> pDeskBar; HRESULT hr; IShellFolder * psf; Modified: branches/shell-experiments/dll/win32/browseui/addressband.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
============================================================================== --- branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/addressband.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -254,6 +254,8 @@ m_hWnd = NULL; + IUnknown_SetSite(fAddressEditBox, NULL); + if (fAddressEditBox) fAddressEditBox.Release(); if (fSite) fSite.Release(); Modified: branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
============================================================================== --- branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/internettoolbar.cpp [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -587,11 +587,13 @@ hResult = newMenu->SetShellFolder(favoritesFolder, favoritesPIDL, orderRegKey, SMSET_BOTTOM | SMINIT_CACHED | SMINV_ID); if (favoritesPIDL) ILFree(favoritesPIDL); - if (SUCCEEDED(hResult)) - fFavoritesMenu.Attach(newMenu.Detach()); - } - if (fFavoritesMenu.p == NULL) - return E_FAIL; + + if (FAILED(hResult)) + return hResult; + + fFavoritesMenu = newMenu; + } + return fFavoritesMenu->QueryInterface(riid, ppvObject); } @@ -665,7 +667,7 @@ case 49: break; case 0x10000000: - break; + return S_OK; } return S_FALSE; } @@ -743,8 +745,6 @@ } } #endif - - menubar->AddRef(); if (FAILED_UNEXPECTEDLY(hResult)) { Modified: branches/shell-experiments/include/psdk/shobjidl.idl URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/psdk/…
============================================================================== --- branches/shell-experiments/include/psdk/shobjidl.idl [iso-8859-1] (original) +++ branches/shell-experiments/include/psdk/shobjidl.idl [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -4040,3 +4040,154 @@ interface IShellItem2; } } + +enum _OPPROGDLGF +{ + OPPROGDLG_DEFAULT = 0, + OPPROGDLG_ENABLEPAUSE = 0x80, + OPPROGDLG_ALLOWUNDO = 0x100, + OPPROGDLG_DONTDISPLAYSOURCEPATH = 0x200, + OPPROGDLG_DONTDISPLAYDESTPATH = 0x400, + OPPROGDLG_NOMULTIDAYESTIMATES = 0x800, + OPPROGDLG_DONTDISPLAYLOCATIONS = 0x1000 +}; +typedef DWORD OPPROGDLGF; + +enum _PDMODE +{ + PDM_DEFAULT = 0, + PDM_RUN = 0x1, + PDM_PREFLIGHT = 0x2, + PDM_UNDOING = 0x4, + PDM_ERRORSBLOCKING = 0x8, + PDM_INDETERMINATE = 0x10 +}; +typedef DWORD PDMODE; + +typedef enum PDOPSTATUS +{ + PDOPS_RUNNING = 1, + PDOPS_PAUSED = 2, + PDOPS_CANCELLED = 3, + PDOPS_STOPPED = 4, + PDOPS_ERRORS = 5 +} PDOPSTATUS; + +typedef enum _SPACTION +{ + SPACTION_NONE = 0, + SPACTION_MOVING = 1, + SPACTION_COPYING = 2, + SPACTION_RECYCLING = 3, + SPACTION_APPLYINGATTRIBS = 4, + SPACTION_DOWNLOADING = 5, + SPACTION_SEARCHING_INTERNET = 6, + SPACTION_CALCULATING = 7, + SPACTION_UPLOADING = 8, + SPACTION_SEARCHING_FILES = 9, + SPACTION_DELETING = 10, + SPACTION_RENAMING = 11, + SPACTION_FORMATTING = 12, + SPACTION_COPY_MOVING = 13 +} SPACTION; + +[ + uuid(0C9FB851-E5C9-43EB-A370-F0677B13874C), + object, + pointer_default(unique) +] +interface IOperationsProgressDialog : IUnknown +{ + HRESULT StartProgressDialog( + [in] HWND hwndOwner, + [in] OPPROGDLGF flags); + HRESULT StopProgressDialog(); + HRESULT SetOperation( + [in] SPACTION action); + HRESULT SetMode( + [in] PDMODE mode); + HRESULT UpdateProgress( + [in] ULONGLONG ullPointsCurrent, + [in] ULONGLONG ullPointsTotal, + [in] ULONGLONG ullSizeCurrent, + [in] ULONGLONG ullSizeTotal, + [in] ULONGLONG ullItemsCurrent, + [in] ULONGLONG ullItemsTotal); + HRESULT UpdateLocations( + [in, optional] IShellItem *psiSource, + [in, optional] IShellItem *psiTarget, + [in, optional] IShellItem *psiItem); + HRESULT ResetTimer(); + HRESULT PauseTimer(); + HRESULT ResumeTimer(); + HRESULT GetMilliseconds( + [out] ULONGLONG *pullElapsed, + [out] ULONGLONG *pullRemaining); + HRESULT GetOperationStatus( + [out] PDOPSTATUS *popstatus); +}; + +[ + uuid(947aab5f-0a5c-4c13-b4d6-4bf7836fc9f8), + object, + pointer_default(unique) +] +interface IFileOperation : IUnknown +{ + HRESULT Advise( + [in] IFileOperationProgressSink *pfops, + [out] DWORD *pdwCookie); + HRESULT Unadvise( + [in] DWORD dwCookie); + HRESULT SetOperationFlags( + [in] DWORD dwOperationFlags); + HRESULT SetProgressMessage( + [in] LPCWSTR pszMessage); + HRESULT SetProgressDialog( + [in] IOperationsProgressDialog *popd); + HRESULT SetProperties( + [in] IPropertyChangeArray *pproparray); + HRESULT SetOwnerWindow( + [in] HWND hwndOwner); + HRESULT ApplyPropertiesToItem( + [in] IShellItem *psiItem); + HRESULT ApplyPropertiesToItems( + [in] IUnknown *punkItems); + HRESULT RenameItem( + [in] IShellItem *psiItem, + [in] LPCWSTR pszNewName, + [in] IFileOperationProgressSink *pfopsItem); + HRESULT RenameItems( + [in] IUnknown *pUnkItems, + [in] LPCWSTR pszNewName); + HRESULT MoveItem( + [in] IShellItem *psiItem, + [in] IShellItem *psiDestinationFolder, + [in] LPCWSTR pszNewName, + [in] IFileOperationProgressSink *pfopsItem); + HRESULT MoveItems( + [in] IUnknown *punkItems, + [in] IShellItem *psiDestinationFolder); + HRESULT CopyItem( + [in] IShellItem *psiItem, + [in] IShellItem *psiDestinationFolder, + [in] LPCWSTR pszCopyName, + [in] IFileOperationProgressSink *pfopsItem); + HRESULT CopyItems( + [in] IUnknown *punkItems, + [in] IShellItem *psiDestinationFolder); + HRESULT DeleteItem( + [in] IShellItem *psiItem, + [in] IFileOperationProgressSink *pfopsItem); + HRESULT DeleteItems( + [in] IUnknown *punkItems); + HRESULT NewItem( + [in] IShellItem *psiDestinationFolder, + [in] DWORD dwFileAttributes, + [in] LPCWSTR pszName, + [in] LPCWSTR pszTemplateName, + [in] IFileOperationProgressSink *pfopsItem); + HRESULT PerformOperations(); + HRESULT GetAnyOperationsAborted( + [out] BOOL *pfAnyOperationsAborted); +}; Modified: branches/shell-experiments/include/reactos/undocshell.h URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/react…
============================================================================== --- branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] (original) +++ branches/shell-experiments/include/reactos/undocshell.h [iso-8859-1] Thu Oct 23 17:17:16 2014 @@ -638,7 +638,7 @@ STDMETHOD_(ULONG, AddRef)() { int rc = this->InternalAddRef(); - DbgPrint("RefCount is now %d(++)!\n", rc); + DbgPrint("RefCount is now %d(++)! %s\n", rc, __FUNCTION__); return rc; } @@ -647,9 +647,15 @@ ULONG newRefCount; newRefCount = this->InternalRelease(); - DbgPrint("RefCount is now %d(--)!\n", newRefCount); if (newRefCount == 0) + { + DbgPrint("RefCount is now 0! Deleting! %s\n", newRefCount, __FUNCTION__); delete this; + } + else + { + DbgPrint("RefCount is now %d(--)! %s\n", newRefCount, __FUNCTION__); + } return newRefCount; } @@ -691,6 +697,12 @@ } }; +#ifdef DEBUG_CCOMOBJECT +# define _CComObject CComDebugObject +#else +# define _CComObject CComObject +#endif + template<class T> void ReleaseCComPtrExpectZero(CComPtr<T>& cptr, BOOL forceRelease = FALSE) { @@ -721,7 +733,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); +ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(ppv)); @@ -740,7 +752,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result)); @@ -766,7 +778,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result)); @@ -792,7 +804,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result)); @@ -818,7 +830,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result)); @@ -844,7 +856,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result)); @@ -870,7 +882,7 @@ if (ppv == NULL) return E_POINTER; *ppv = NULL; - ATLTRY(obj = new CComObject<T>); + ATLTRY(obj = new _CComObject<T>); if (obj.p == NULL) return E_OUTOFMEMORY; hResult = obj->QueryInterface(riid, reinterpret_cast<void **>(&result));
10 years, 2 months
1
0
0
0
[zguo] 64928: [CRT] Cherrypick fix for CRT that broke LMarbles/LBreakout. Games are important. CORE-8670
by zguo@svn.reactos.org
Author: zguo Date: Thu Oct 23 15:55:03 2014 New Revision: 64928 URL:
http://svn.reactos.org/svn/reactos?rev=64928&view=rev
Log: [CRT] Cherrypick fix for CRT that broke LMarbles/LBreakout. Games are important. CORE-8670 Modified: branches/0.3.17/reactos/ (props changed) branches/0.3.17/reactos/lib/sdk/crt/stdlib/errno.c Propchange: branches/0.3.17/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Oct 23 15:55:03 2014 @@ -18,4 +18,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:64752-64754,64765,64769,64771,64776,64793,64800,64825,64829,64832-64833 +/trunk/reactos:64752-64754,64765,64769,64771,64776,64793,64800,64825,64829,64832-64833,64909 Modified: branches/0.3.17/reactos/lib/sdk/crt/stdlib/errno.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/lib/sdk/crt/stdl…
============================================================================== --- branches/0.3.17/reactos/lib/sdk/crt/stdlib/errno.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/lib/sdk/crt/stdlib/errno.c [iso-8859-1] Thu Oct 23 15:55:03 2014 @@ -141,7 +141,9 @@ else { ERR( "%s:%u %s: %s %lx\n", debugstr_w(file), line, debugstr_w(func), debugstr_w(expr), arg ); +#if _MSVCR_VER > 0 // FIXME: possible improvement: use a global variable in the DLL RaiseException( STATUS_INVALID_CRUNTIME_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, NULL ); +#endif } }
10 years, 2 months
1
0
0
0
[zguo] 64927: [NTFS] Cherrypick NTFS related changes from trunk for 0.3.17.
by zguo@svn.reactos.org
Author: zguo Date: Thu Oct 23 15:45:12 2014 New Revision: 64927 URL:
http://svn.reactos.org/svn/reactos?rev=64927&view=rev
Log: [NTFS] Cherrypick NTFS related changes from trunk for 0.3.17. Modified: branches/0.3.17/ (props changed) branches/0.3.17/reactos/ (props changed) branches/0.3.17/reactos/drivers/filesystems/ntfs/dirctl.c branches/0.3.17/reactos/drivers/filesystems/ntfs/fsctl.c branches/0.3.17/reactos/drivers/filesystems/ntfs/mft.c branches/0.3.17/reactos/drivers/filesystems/ntfs/misc.c branches/0.3.17/reactos/drivers/filesystems/ntfs/ntfs.h branches/0.3.17/reactos/drivers/filesystems/ntfs/volinfo.c Propchange: branches/0.3.17/ ------------------------------------------------------------------------------ svn:mergeinfo = /trunk:64769 Propchange: branches/0.3.17/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Oct 23 15:45:12 2014 @@ -18,4 +18,4 @@ /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 /branches/usb-bringup-trunk:55019-55543,55548-55554,55556-55567 /branches/wlan-bringup:54809-54998 -/trunk/reactos:64769 +/trunk/reactos:64752-64754,64765,64769,64771,64776,64793,64800,64825,64829,64832-64833 Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/dirctl.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/dirctl.c [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -120,400 +120,206 @@ return(STATUS_SUCCESS); } +#endif static NTSTATUS -CdfsFindFile(PDEVICE_EXTENSION DeviceExt, - PFCB Fcb, - PFCB Parent, - PWSTR FileToFind, - PULONG pDirIndex, - PULONG pDirIndex2) -/* - * FUNCTION: Find a file - */ -{ - WCHAR name[256]; - WCHAR TempStr[2]; - PVOID Block; - NTSTATUS Status; - ULONG len; - ULONG DirIndex; - ULONG Offset; - ULONG Read; - BOOLEAN IsRoot; - PVOID Context = NULL; - ULONG DirSize; - PUCHAR Ptr; - PDIR_RECORD Record; - LARGE_INTEGER StreamOffset; - - DPRINT("FindFile(Parent %x, FileToFind '%S', DirIndex: %d)\n", - Parent, FileToFind, pDirIndex ? *pDirIndex : 0); - DPRINT("FindFile: old Pathname %x, old Objectname %x)\n", - Fcb->PathName, Fcb->ObjectName); - - IsRoot = FALSE; - DirIndex = 0; - if (wcslen (FileToFind) == 0) - { - CHECKPOINT; - TempStr[0] = (WCHAR) '.'; - TempStr[1] = 0; - FileToFind = (PWSTR)&TempStr; - } - - if (Parent) - { - if (Parent->Entry.ExtentLocationL == DeviceExt->CdInfo.RootStart) - { - IsRoot = TRUE; - } - } - else - { - IsRoot = TRUE; - } - - if (IsRoot == TRUE) - { - StreamOffset.QuadPart = (LONGLONG)DeviceExt->CdInfo.RootStart * (LONGLONG)BLOCKSIZE; - DirSize = DeviceExt->CdInfo.RootSize; - - - if (FileToFind[0] == 0 || (FileToFind[0] == '\\' && FileToFind[1] == 0) - || (FileToFind[0] == '.' && FileToFind[1] == 0)) - { - /* it's root : complete essentials fields then return ok */ - RtlZeroMemory(Fcb, sizeof(FCB)); - - Fcb->PathName[0]='\\'; - Fcb->ObjectName = &Fcb->PathName[1]; - Fcb->Entry.ExtentLocationL = DeviceExt->CdInfo.RootStart; - Fcb->Entry.DataLengthL = DeviceExt->CdInfo.RootSize; - Fcb->Entry.FileFlags = 0x02; //FILE_ATTRIBUTE_DIRECTORY; - - if (pDirIndex) - *pDirIndex = 0; - if (pDirIndex2) - *pDirIndex2 = 0; - DPRINT("CdfsFindFile: new Pathname %S, new Objectname %S)\n",Fcb->PathName, Fcb->ObjectName); - return (STATUS_SUCCESS); - } - } - else - { - StreamOffset.QuadPart = (LONGLONG)Parent->Entry.ExtentLocationL * (LONGLONG)BLOCKSIZE; - DirSize = Parent->Entry.DataLengthL; - } - - DPRINT("StreamOffset %I64u DirSize %lu\n", StreamOffset.QuadPart, DirSize); - - if (pDirIndex && (*pDirIndex)) - DirIndex = *pDirIndex; - - if(!CcMapData(DeviceExt->StreamFileObject, &StreamOffset, - BLOCKSIZE, TRUE, &Context, &Block)) - { - DPRINT("CcMapData() failed\n"); - return(STATUS_UNSUCCESSFUL); - } - - Ptr = (PUCHAR)Block; - while(TRUE) - { - Record = (PDIR_RECORD)Ptr; - if (Record->RecordLength == 0) - { - DPRINT1("Stopped!\n"); - break; - } - - DPRINT("RecordLength %u ExtAttrRecordLength %u NameLength %u\n", - Record->RecordLength, Record->ExtAttrRecordLength, Record->FileIdLength); - - Status = CdfsGetEntryName(DeviceExt, &Context, &Block, &StreamOffset, - DirSize, (PVOID*)&Ptr, name, &DirIndex, pDirIndex2); - if (Status == STATUS_NO_MORE_ENTRIES) - { - break; - } - else if (Status == STATUS_UNSUCCESSFUL) - { - /* Note: the directory cache has already been unpinned */ - return(Status); - } - - DPRINT("Name '%S'\n", name); - - if (wstrcmpjoki(name, FileToFind)) /* || wstrcmpjoki (name2, FileToFind)) */ - { - if (Parent && Parent->PathName) - { - len = wcslen(Parent->PathName); - memcpy(Fcb->PathName, Parent->PathName, len*sizeof(WCHAR)); - Fcb->ObjectName=&Fcb->PathName[len]; - if (len != 1 || Fcb->PathName[0] != '\\') - { - Fcb->ObjectName[0] = '\\'; - Fcb->ObjectName = &Fcb->ObjectName[1]; - } - } - else - { - Fcb->ObjectName=Fcb->PathName; - Fcb->ObjectName[0]='\\'; - Fcb->ObjectName=&Fcb->ObjectName[1]; - } - - DPRINT("PathName '%S' ObjectName '%S'\n", Fcb->PathName, Fcb->ObjectName); - - memcpy(&Fcb->Entry, Ptr, sizeof(DIR_RECORD)); - wcsncpy(Fcb->ObjectName, name, MAX_PATH); - if (pDirIndex) - *pDirIndex = DirIndex; - - DPRINT("FindFile: new Pathname %S, new Objectname %S, DirIndex %d\n", - Fcb->PathName, Fcb->ObjectName, DirIndex); - - CcUnpinData(Context); - - return(STATUS_SUCCESS); - } - - - Ptr = Ptr + Record->RecordLength; - DirIndex++; - - if (((ULONG)Ptr - (ULONG)Block) >= DirSize) - { - DPRINT("Stopped!\n"); - break; - } - } - - CcUnpinData(Context); - - if (pDirIndex) - *pDirIndex = DirIndex; - - return(STATUS_UNSUCCESSFUL); +NtfsGetNameInformation(PDEVICE_EXTENSION DeviceExt, + PFILE_RECORD_HEADER FileRecord, + PNTFS_ATTR_CONTEXT DataContext, + PFILE_NAMES_INFORMATION Info, + ULONG BufferLength) +{ + ULONG Length; + PFILENAME_ATTRIBUTE FileName; + + DPRINT("NtfsGetNameInformation() called\n"); + + FileName = GetFileNameFromRecord(FileRecord); + ASSERT(FileName != NULL); + + Length = FileName->NameLength * sizeof (WCHAR); + if ((sizeof(FILE_NAMES_INFORMATION) + Length) > BufferLength) + return(STATUS_BUFFER_OVERFLOW); + + Info->FileNameLength = Length; + Info->NextEntryOffset = + ROUND_UP(sizeof(FILE_NAMES_INFORMATION) + Length, sizeof(ULONG)); + RtlCopyMemory(Info->FileName, FileName->Name, Length); + + return(STATUS_SUCCESS); } static NTSTATUS -CdfsGetNameInformation(PFCB Fcb, - PDEVICE_EXTENSION DeviceExt, - PFILE_NAMES_INFORMATION Info, - ULONG BufferLength) -{ - ULONG Length; - - DPRINT("CdfsGetNameInformation() called\n"); - - Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR); - if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength) - return(STATUS_BUFFER_OVERFLOW); - - Info->FileNameLength = Length; - Info->NextEntryOffset = - ROUND_UP(sizeof(FILE_BOTH_DIRECTORY_INFORMATION) + Length, 4); - memcpy(Info->FileName, Fcb->ObjectName, Length); - - return(STATUS_SUCCESS); +NtfsGetDirectoryInformation(PDEVICE_EXTENSION DeviceExt, + PFILE_RECORD_HEADER FileRecord, + PNTFS_ATTR_CONTEXT DataContext, + PFILE_DIRECTORY_INFORMATION Info, + ULONG BufferLength) +{ + ULONG Length; + PFILENAME_ATTRIBUTE FileName; + + DPRINT("NtfsGetDirectoryInformation() called\n"); + + FileName = GetFileNameFromRecord(FileRecord); + ASSERT(FileName != NULL); + + Length = FileName->NameLength * sizeof (WCHAR); + if ((sizeof(FILE_DIRECTORY_INFORMATION) + Length) > BufferLength) + return(STATUS_BUFFER_OVERFLOW); + + Info->FileNameLength = Length; + Info->NextEntryOffset = + ROUND_UP(sizeof(FILE_DIRECTORY_INFORMATION) + Length, sizeof(ULONG)); + RtlCopyMemory(Info->FileName, FileName->Name, Length); + + Info->CreationTime.QuadPart = FileName->CreationTime; + Info->LastAccessTime.QuadPart = FileName->LastAccessTime; + Info->LastWriteTime.QuadPart = FileName->LastWriteTime; + Info->ChangeTime.QuadPart = FileName->ChangeTime; + + /* Convert file flags */ + NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes); + + Info->EndOfFile.QuadPart = FileName->AllocatedSize; + Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster); + +// Info->FileIndex=; + + return STATUS_SUCCESS; } static NTSTATUS -CdfsGetDirectoryInformation(PFCB Fcb, - PDEVICE_EXTENSION DeviceExt, - PFILE_DIRECTORY_INFORMATION Info, - ULONG BufferLength) -{ - ULONG Length; - - DPRINT("CdfsGetDirectoryInformation() called\n"); - - Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR); - if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength) - return(STATUS_BUFFER_OVERFLOW); - - Info->FileNameLength = Length; - Info->NextEntryOffset = - ROUND_UP(sizeof(FILE_BOTH_DIRECTORY_INFORMATION) + Length, 4); - memcpy(Info->FileName, Fcb->ObjectName, Length); - - /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); - - /* Convert file flags */ - CdfsFileFlagsToAttributes(Fcb, - &Info->FileAttributes); - - Info->EndOfFile.QuadPart = Fcb->Entry.DataLengthL; - - /* Make AllocSize a rounded up multiple of the sector size */ - Info->AllocationSize.QuadPart = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE); +NtfsGetFullDirectoryInformation(PDEVICE_EXTENSION DeviceExt, + PFILE_RECORD_HEADER FileRecord, + PNTFS_ATTR_CONTEXT DataContext, + PFILE_FULL_DIRECTORY_INFORMATION Info, + ULONG BufferLength) +{ + ULONG Length; + PFILENAME_ATTRIBUTE FileName; + + DPRINT("NtfsGetFullDirectoryInformation() called\n"); + + FileName = GetFileNameFromRecord(FileRecord); + ASSERT(FileName != NULL); + + Length = FileName->NameLength * sizeof (WCHAR); + if ((sizeof(FILE_FULL_DIRECTORY_INFORMATION) + Length) > BufferLength) + return(STATUS_BUFFER_OVERFLOW); + + Info->FileNameLength = Length; + Info->NextEntryOffset = + ROUND_UP(sizeof(FILE_FULL_DIRECTORY_INFORMATION) + Length, sizeof(ULONG)); + RtlCopyMemory(Info->FileName, FileName->Name, Length); + + Info->CreationTime.QuadPart = FileName->CreationTime; + Info->LastAccessTime.QuadPart = FileName->LastAccessTime; + Info->LastWriteTime.QuadPart = FileName->LastWriteTime; + Info->ChangeTime.QuadPart = FileName->ChangeTime; + + /* Convert file flags */ + NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes); + + Info->EndOfFile.QuadPart = FileName->AllocatedSize; + Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster); // Info->FileIndex=; - - return(STATUS_SUCCESS); + Info->EaSize = 0; + + return STATUS_SUCCESS; } static NTSTATUS -CdfsGetFullDirectoryInformation(PFCB Fcb, - PDEVICE_EXTENSION DeviceExt, - PFILE_FULL_DIRECTORY_INFORMATION Info, - ULONG BufferLength) -{ - ULONG Length; - - DPRINT("CdfsGetFullDirectoryInformation() called\n"); - - Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR); - if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength) - return(STATUS_BUFFER_OVERFLOW); - - Info->FileNameLength = Length; - Info->NextEntryOffset = - ROUND_UP(sizeof(FILE_BOTH_DIRECTORY_INFORMATION) + Length, 4); - memcpy(Info->FileName, Fcb->ObjectName, Length); - - /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); - - /* Convert file flags */ - CdfsFileFlagsToAttributes(Fcb, - &Info->FileAttributes); - - Info->EndOfFile.QuadPart = Fcb->Entry.DataLengthL; - - /* Make AllocSize a rounded up multiple of the sector size */ - Info->AllocationSize.QuadPart = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE); +NtfsGetBothDirectoryInformation(PDEVICE_EXTENSION DeviceExt, + PFILE_RECORD_HEADER FileRecord, + PNTFS_ATTR_CONTEXT DataContext, + PFILE_BOTH_DIR_INFORMATION Info, + ULONG BufferLength) +{ + ULONG Length; + PFILENAME_ATTRIBUTE FileName; + + DPRINT("NtfsGetBothDirectoryInformation() called\n"); + + FileName = GetFileNameFromRecord(FileRecord); + ASSERT(FileName != NULL); + + Length = FileName->NameLength * sizeof (WCHAR); + if ((sizeof(FILE_BOTH_DIR_INFORMATION) + Length) > BufferLength) + return(STATUS_BUFFER_OVERFLOW); + + Info->FileNameLength = Length; + Info->NextEntryOffset = + ROUND_UP(sizeof(FILE_BOTH_DIR_INFORMATION) + Length, sizeof(ULONG)); + RtlCopyMemory(Info->FileName, FileName->Name, Length); + + Info->CreationTime.QuadPart = FileName->CreationTime; + Info->LastAccessTime.QuadPart = FileName->LastAccessTime; + Info->LastWriteTime.QuadPart = FileName->LastWriteTime; + Info->ChangeTime.QuadPart = FileName->ChangeTime; + + /* Convert file flags */ + NtfsFileFlagsToAttributes(FileName->FileAttributes, &Info->FileAttributes); + + Info->EndOfFile.QuadPart = FileName->AllocatedSize; + Info->AllocationSize.QuadPart = ROUND_UP(FileName->AllocatedSize, DeviceExt->NtfsInfo.BytesPerCluster); // Info->FileIndex=; - Info->EaSize = 0; - - return(STATUS_SUCCESS); -} - - -static NTSTATUS -CdfsGetBothDirectoryInformation(PFCB Fcb, - PDEVICE_EXTENSION DeviceExt, - PFILE_BOTH_DIRECTORY_INFORMATION Info, - ULONG BufferLength) -{ - ULONG Length; - - DPRINT("CdfsGetBothDirectoryInformation() called\n"); - - Length = wcslen(Fcb->ObjectName) * sizeof(WCHAR); - if ((sizeof (FILE_BOTH_DIRECTORY_INFORMATION) + Length) > BufferLength) - return(STATUS_BUFFER_OVERFLOW); - - Info->FileNameLength = Length; - Info->NextEntryOffset = - ROUND_UP(sizeof(FILE_BOTH_DIRECTORY_INFORMATION) + Length, 4); - memcpy(Info->FileName, Fcb->ObjectName, Length); - - /* Convert file times */ - CdfsDateTimeToFileTime(Fcb, - &Info->CreationTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastAccessTime); - CdfsDateTimeToFileTime(Fcb, - &Info->LastWriteTime); - CdfsDateTimeToFileTime(Fcb, - &Info->ChangeTime); - - /* Convert file flags */ - CdfsFileFlagsToAttributes(Fcb, - &Info->FileAttributes); - - Info->EndOfFile.QuadPart = Fcb->Entry.DataLengthL; - - /* Make AllocSize a rounded up multiple of the sector size */ - Info->AllocationSize.QuadPart = ROUND_UP(Fcb->Entry.DataLengthL, BLOCKSIZE); - -// Info->FileIndex=; - Info->EaSize = 0; - - if (DeviceExt->CdInfo.JolietLevel == 0) - { - /* Standard ISO-9660 format */ - Info->ShortNameLength = Length; - memcpy(Info->ShortName, Fcb->ObjectName, Length); - } - else - { - /* Joliet extension */ - - /* FIXME: Copy or create a short file name */ - - Info->ShortName[0] = 0; - Info->ShortNameLength = 0; - } - - return(STATUS_SUCCESS); -} -#endif + Info->EaSize = 0; + + Info->ShortName[0] = 0; + Info->ShortNameLength = 0; + + return STATUS_SUCCESS; +} NTSTATUS NtfsQueryDirectory(PNTFS_IRP_CONTEXT IrpContext) { PIRP Irp; - //PDEVICE_OBJECT DeviceObject; - //PDEVICE_EXTENSION DeviceExtension; - //LONG BufferLength = 0; + PDEVICE_OBJECT DeviceObject; + PDEVICE_EXTENSION DeviceExtension; + LONG BufferLength = 0; PUNICODE_STRING SearchPattern = NULL; - //FILE_INFORMATION_CLASS FileInformationClass; + FILE_INFORMATION_CLASS FileInformationClass; ULONG FileIndex = 0; PUCHAR Buffer = NULL; PFILE_NAMES_INFORMATION Buffer0 = NULL; - //PNTFS_FCB Fcb; + PNTFS_FCB Fcb; PNTFS_CCB Ccb; -// FCB TempFcb; BOOLEAN First = FALSE; PIO_STACK_LOCATION Stack; PFILE_OBJECT FileObject; - //NTSTATUS Status = STATUS_SUCCESS; + NTSTATUS Status = STATUS_SUCCESS; + PFILE_RECORD_HEADER FileRecord; + PNTFS_ATTR_CONTEXT DataContext; + ULONGLONG MFTRecord; + UNICODE_STRING Pattern; DPRINT1("NtfsQueryDirectory() called\n"); ASSERT(IrpContext); Irp = IrpContext->Irp; -// DeviceObject = IrpContext->DeviceObject; - -// DeviceExtension = DeviceObject->DeviceExtension; + DeviceObject = IrpContext->DeviceObject; + + DeviceExtension = DeviceObject->DeviceExtension; Stack = IoGetCurrentIrpStackLocation(Irp); FileObject = Stack->FileObject; Ccb = (PNTFS_CCB)FileObject->FsContext2; -// Fcb = (PNTFS_FCB)FileObject->FsContext; + Fcb = (PNTFS_FCB)FileObject->FsContext; /* Obtain the callers parameters */ - //BufferLength = Stack->Parameters.QueryDirectory.Length; + BufferLength = Stack->Parameters.QueryDirectory.Length; SearchPattern = Stack->Parameters.QueryDirectory.FileName; - //FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass; + FileInformationClass = Stack->Parameters.QueryDirectory.FileInformationClass; FileIndex = Stack->Parameters.QueryDirectory.FileIndex; - if (SearchPattern != NULL) { @@ -546,7 +352,10 @@ Ccb->DirectorySearchPattern[1] = 0; } - DPRINT("Search pattern '%S'\n", Ccb->DirectorySearchPattern); + RtlInitUnicodeString(&Pattern, Ccb->DirectorySearchPattern); + + DPRINT1("Search pattern '%S'\n", Ccb->DirectorySearchPattern); + DPRINT1("In: '%S'\n", Fcb->PathName); /* Determine directory index */ if (Stack->Flags & SL_INDEX_SPECIFIED) @@ -570,93 +379,96 @@ DPRINT("Buffer=%p tofind=%S\n", Buffer, Ccb->DirectorySearchPattern); -#if 0 - TempFcb.ObjectName = TempFcb.PathName; - while (Status == STATUS_SUCCESS && BufferLength > 0) - { - Status = CdfsFindFile(DeviceExtension, - &TempFcb, - Fcb, - Ccb->DirectorySearchPattern, - &Ccb->Entry, - NULL); - DPRINT("Found %S, Status=%x, entry %x\n", TempFcb.ObjectName, Status, Ccb->Entry); - - if (NT_SUCCESS(Status)) - { - switch (FileInformationClass) - { - case FileNameInformation: - Status = CdfsGetNameInformation(&TempFcb, - DeviceExtension, - (PFILE_NAMES_INFORMATION)Buffer, - BufferLength); - break; - - case FileDirectoryInformation: - Status = CdfsGetDirectoryInformation(&TempFcb, - DeviceExtension, - (PFILE_DIRECTORY_INFORMATION)Buffer, - BufferLength); - break; - - case FileFullDirectoryInformation: - Status = CdfsGetFullDirectoryInformation(&TempFcb, - DeviceExtension, - (PFILE_FULL_DIRECTORY_INFORMATION)Buffer, - BufferLength); - break; - - case FileBothDirectoryInformation: - Status = NtfsGetBothDirectoryInformation(&TempFcb, - DeviceExtension, - (PFILE_BOTH_DIRECTORY_INFORMATION)Buffer, - BufferLength); - break; - - default: - Status = STATUS_INVALID_INFO_CLASS; - } - - if (Status == STATUS_BUFFER_OVERFLOW) - { - if (Buffer0) - { - Buffer0->NextEntryOffset = 0; - } - break; - } - } - else - { - if (Buffer0) - { - Buffer0->NextEntryOffset = 0; - } - - if (First) - { - Status = STATUS_NO_SUCH_FILE; - } - else - { - Status = STATUS_NO_MORE_FILES; - } - break; - } - - Buffer0 = (PFILE_NAMES_INFORMATION)Buffer; - Buffer0->FileIndex = FileIndex++; - Ccb->Entry++; - - if (Stack->Flags & SL_RETURN_SINGLE_ENTRY) - { - break; - } - BufferLength -= Buffer0->NextEntryOffset; - Buffer += Buffer0->NextEntryOffset; - } -#endif + while (Status == STATUS_SUCCESS && BufferLength > 0) + { + Status = NtfsFindFileAt(DeviceExtension, + &Pattern, + &Ccb->Entry, + &FileRecord, + &DataContext, + &MFTRecord, + Fcb->MFTIndex); + //DPRINT("Found %S, Status=%x, entry %x\n", TempFcb.ObjectName, Status, Ccb->Entry); + + if (NT_SUCCESS(Status)) + { + switch (FileInformationClass) + { + case FileNameInformation: + Status = NtfsGetNameInformation(DeviceExtension, + FileRecord, + DataContext, + (PFILE_NAMES_INFORMATION)Buffer, + BufferLength); + break; + + case FileDirectoryInformation: + Status = NtfsGetDirectoryInformation(DeviceExtension, + FileRecord, + DataContext, + (PFILE_DIRECTORY_INFORMATION)Buffer, + BufferLength); + break; + + case FileFullDirectoryInformation: + Status = NtfsGetFullDirectoryInformation(DeviceExtension, + FileRecord, + DataContext, + (PFILE_FULL_DIRECTORY_INFORMATION)Buffer, + BufferLength); + break; + + case FileBothDirectoryInformation: + Status = NtfsGetBothDirectoryInformation(DeviceExtension, + FileRecord, + DataContext, + (PFILE_BOTH_DIR_INFORMATION)Buffer, + BufferLength); + break; + + default: + Status = STATUS_INVALID_INFO_CLASS; + } + + if (Status == STATUS_BUFFER_OVERFLOW) + { + if (Buffer0) + { + Buffer0->NextEntryOffset = 0; + } + break; + } + } + else + { + if (Buffer0) + { + Buffer0->NextEntryOffset = 0; + } + + if (First) + { + Status = STATUS_NO_SUCH_FILE; + } + else + { + Status = STATUS_NO_MORE_FILES; + } + break; + } + + Buffer0 = (PFILE_NAMES_INFORMATION)Buffer; + Buffer0->FileIndex = FileIndex++; + Ccb->Entry++; + + if (Stack->Flags & SL_RETURN_SINGLE_ENTRY) + { + break; + } + BufferLength -= Buffer0->NextEntryOffset; + Buffer += Buffer0->NextEntryOffset; + ExFreePoolWithTag(FileRecord, TAG_NTFS); + } if (Buffer0) { @@ -665,11 +477,10 @@ if (FileIndex > 0) { - //Status = STATUS_SUCCESS; - } - -// return Status; - return STATUS_NO_MORE_FILES; + Status = STATUS_SUCCESS; + } + + return Status; } Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/fsctl.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/fsctl.c [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -34,8 +34,6 @@ #define NDEBUG #include <debug.h> -UNICODE_STRING EmptyName = RTL_CONSTANT_STRING(L""); - /* FUNCTIONS ****************************************************************/ /* @@ -274,7 +272,7 @@ return Status; } - Status = FindAttribute(DeviceExt, DeviceExt->MasterFileTable, AttributeData, &EmptyName, &DeviceExt->MFTContext); + Status = FindAttribute(DeviceExt, DeviceExt->MasterFileTable, AttributeData, L"", 0, &DeviceExt->MFTContext); if (!NT_SUCCESS(Status)) { DPRINT1("Can't find data attribute for Master File Table.\n"); @@ -312,7 +310,7 @@ NtfsDumpFileAttributes(VolumeRecord); /* Get volume name */ - Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeName, &EmptyName, &AttrCtxt); + Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeName, L"", 0, &AttrCtxt); if (NT_SUCCESS(Status) && AttrCtxt->Record.Resident.ValueLength != 0) { @@ -348,7 +346,7 @@ DeviceExt->VolumeFcb = VolumeFcb; /* Get volume information */ - Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeInformation, &EmptyName, &AttrCtxt); + Status = FindAttribute(DeviceExt, VolumeRecord, AttributeVolumeInformation, L"", 0, &AttrCtxt); if (NT_SUCCESS(Status) && AttrCtxt->Record.Resident.ValueLength != 0) { Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/mft.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/mft.c [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -31,8 +31,6 @@ #define NDEBUG #include <debug.h> -UNICODE_STRING IndexOfFileNames = RTL_CONSTANT_STRING(L"$I30"); - /* FUNCTIONS ****************************************************************/ PNTFS_ATTR_CONTEXT @@ -84,10 +82,10 @@ PNTFS_ATTR_RECORD AttrRecord, PNTFS_ATTR_RECORD AttrRecordEnd, ULONG Type, - const WCHAR *Name, + PCWSTR Name, ULONG NameLength) { - DPRINT("FindAttributeHelper(%p, %p, %p, 0x%x, %s, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength); + DPRINT1("FindAttributeHelper(%p, %p, %p, 0x%x, %S, %u)\n", Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength); while (AttrRecord < AttrRecordEnd) { @@ -143,7 +141,6 @@ if (AttrRecord->Type == Type) { - DPRINT("%d, %d\n", AttrRecord->NameLength, NameLength); if (AttrRecord->NameLength == NameLength) { PWCHAR AttrName; @@ -176,18 +173,19 @@ FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, - PUNICODE_STRING Name, + PCWSTR Name, + ULONG NameLength, PNTFS_ATTR_CONTEXT * AttrCtx) { PNTFS_ATTR_RECORD AttrRecord; PNTFS_ATTR_RECORD AttrRecordEnd; - DPRINT("NtfsFindAttribute(%p, %p, %u, %s)\n", Vcb, MftRecord, Type, Name); + DPRINT1("FindAttribute(%p, %p, %u, %S, %u, %p)\n", Vcb, MftRecord, Type, Name, NameLength, AttrCtx); AttrRecord = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + MftRecord->AttributeOffset); AttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)MftRecord + Vcb->NtfsInfo.BytesPerFileRecord); - *AttrCtx = FindAttributeHelper(Vcb, AttrRecord, AttrRecordEnd, Type, Name->Buffer, Name->Length); + *AttrCtx = FindAttributeHelper(Vcb, AttrRecord, AttrRecordEnd, Type, Name, NameLength); if (*AttrCtx == NULL) { return STATUS_OBJECT_NAME_NOT_FOUND; @@ -399,6 +397,8 @@ { ULONGLONG BytesRead; + DPRINT1("ReadFileRecord(%p, %I64x, %p)\n", Vcb, index, file); + BytesRead = ReadAttribute(Vcb, Vcb->MFTContext, index * Vcb->NtfsInfo.BytesPerFileRecord, (PCHAR)file, Vcb->NtfsInfo.BytesPerFileRecord); if (BytesRead != Vcb->NtfsInfo.BytesPerFileRecord) { @@ -488,8 +488,7 @@ PUNICODE_STRING FileName, PULONG FirstEntry, BOOLEAN DirSearch, - ULONGLONG *OutMFTIndex, - PWSTR OutName) + ULONGLONG *OutMFTIndex) { PFILE_RECORD_HEADER MftRecord; //ULONG Magic; @@ -497,6 +496,7 @@ PNTFS_ATTR_CONTEXT IndexBitmapCtx; PNTFS_ATTR_CONTEXT IndexAllocationCtx; PINDEX_ROOT_ATTRIBUTE IndexRoot; + PINDEX_BUFFER IndexBuffer; ULONGLONG BitmapDataSize; ULONGLONG IndexAllocationSize; PCHAR BitmapData; @@ -507,6 +507,8 @@ NTSTATUS Status; ULONG CurrentEntry = 0; + DPRINT1("NtfsFindMftRecord(%p, %I64d, %wZ, %p, %u, %p)\n", Vcb, MFTIndex, FileName, FirstEntry, DirSearch, OutMFTIndex); + MftRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS); @@ -519,7 +521,7 @@ { //Magic = MftRecord->Magic; - Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, &IndexOfFileNames, &IndexRootCtx); + Status = FindAttribute(Vcb, MftRecord, AttributeIndexRoot, L"$I30", 4, &IndexRootCtx); if (!NT_SUCCESS(Status)) { ExFreePoolWithTag(MftRecord, TAG_NTFS); @@ -545,12 +547,12 @@ while (IndexEntry < IndexEntryEnd && !(IndexEntry->Flags & NTFS_INDEX_ENTRY_END)) { - if (CurrentEntry >= *FirstEntry && CompareFileName(FileName, IndexEntry, DirSearch)) - { - *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile; + if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) > 0x10 && + CurrentEntry >= *FirstEntry && + CompareFileName(FileName, IndexEntry, DirSearch)) + { + *OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK); *FirstEntry = CurrentEntry; - RtlCopyMemory(OutName, IndexEntry->FileName.Name, IndexEntry->FileName.NameLength); - OutName[IndexEntry->FileName.NameLength / sizeof(WCHAR)] = UNICODE_NULL; ExFreePoolWithTag(IndexRecord, TAG_NTFS); ExFreePoolWithTag(MftRecord, TAG_NTFS); return STATUS_SUCCESS; @@ -566,10 +568,10 @@ IndexBlockSize = IndexRoot->SizeOfEntry; - Status = FindAttribute(Vcb, MftRecord, AttributeBitmap, &IndexOfFileNames, &IndexBitmapCtx); + Status = FindAttribute(Vcb, MftRecord, AttributeBitmap, L"$I30", 4, &IndexBitmapCtx); if (!NT_SUCCESS(Status)) { - DPRINT("Corrupted filesystem!\n"); + DPRINT1("Corrupted filesystem!\n"); ExFreePoolWithTag(MftRecord, TAG_NTFS); return Status; } @@ -589,7 +591,7 @@ ReadAttribute(Vcb, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize); ReleaseAttributeContext(IndexBitmapCtx); - Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, &IndexOfFileNames, &IndexAllocationCtx); + Status = FindAttribute(Vcb, MftRecord, AttributeIndexAllocation, L"$I30", 4, &IndexAllocationCtx); if (!NT_SUCCESS(Status)) { DPRINT("Corrupted filesystem!\n"); @@ -621,25 +623,28 @@ ReadAttribute(Vcb, IndexAllocationCtx, RecordOffset, IndexRecord, IndexBlockSize); - if (!FixupUpdateSequenceArray(Vcb, &((PFILE_RECORD_HEADER)IndexRecord)->Ntfs)) + if (!NT_SUCCESS(FixupUpdateSequenceArray(Vcb, &((PFILE_RECORD_HEADER)IndexRecord)->Ntfs))) { break; } - /* FIXME */ - IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + 0x18 + *(USHORT *)(IndexRecord + 0x18)); - IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(IndexRecord + IndexBlockSize); + IndexBuffer = (PINDEX_BUFFER)IndexRecord; + ASSERT(IndexBuffer->Ntfs.Type == 'XDNI'); + ASSERT(IndexBuffer->Header.AllocatedSize + 0x18 == IndexBlockSize); + IndexEntry = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.FirstEntryOffset); + IndexEntryEnd = (PINDEX_ENTRY_ATTRIBUTE)(&IndexBuffer->Header + IndexBuffer->Header.TotalSizeOfEntries); + //ASSERT(IndexEntryEnd <= (PINDEX_ENTRY_ATTRIBUTE)((ULONG_PTR)IndexBuffer + IndexBlockSize)); FIXME: Why doesn't it work? while (IndexEntry < IndexEntryEnd && !(IndexEntry->Flags & NTFS_INDEX_ENTRY_END)) { - if (CurrentEntry >= *FirstEntry && CompareFileName(FileName, IndexEntry, DirSearch)) + if ((IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK) > 0x10 && + CurrentEntry >= *FirstEntry && + CompareFileName(FileName, IndexEntry, DirSearch)) { DPRINT("File found\n"); - *OutMFTIndex = IndexEntry->Data.Directory.IndexedFile; + *OutMFTIndex = (IndexEntry->Data.Directory.IndexedFile & NTFS_MFT_MASK); *FirstEntry = CurrentEntry; - RtlCopyMemory(OutName, IndexEntry->FileName.Name, IndexEntry->FileName.NameLength); - OutName[IndexEntry->FileName.NameLength / sizeof(WCHAR)] = UNICODE_NULL; ExFreePoolWithTag(BitmapData, TAG_NTFS); ExFreePoolWithTag(IndexRecord, TAG_NTFS); ExFreePoolWithTag(MftRecord, TAG_NTFS); @@ -677,9 +682,8 @@ PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex) { - UNICODE_STRING Current, Remaining, Found; + UNICODE_STRING Current, Remaining; NTSTATUS Status; - WCHAR FoundName[MAX_PATH + 1]; ULONG FirstEntry = 0; DPRINT1("NtfsLookupFileAt(%p, %wZ, %p, %p, %I64x)\n", Vcb, PathName, FileRecord, DataContext, CurrentMFTIndex); @@ -688,15 +692,18 @@ while (Current.Length != 0) { - DPRINT1("Lookup: %wZ\n", &Current); - - Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, &CurrentMFTIndex, FoundName); + DPRINT1("Current: %wZ\n", &Current); + + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, &Current, &FirstEntry, FALSE, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { return Status; } - FsRtlDissectName(*PathName, &Current, &Remaining); + if (Remaining.Length == 0) + return STATUS_OBJECT_PATH_NOT_FOUND; + + FsRtlDissectName(Current, &Current, &Remaining); } *FileRecord = ExAllocatePoolWithTag(NonPagedPool, Vcb->NtfsInfo.BytesPerFileRecord, TAG_NTFS); @@ -710,18 +717,23 @@ if (!NT_SUCCESS(Status)) { DPRINT("NtfsLookupFileAt: Can't read MFT record\n"); - ExFreePoolWithTag(FileRecord, TAG_NTFS); + ExFreePoolWithTag(*FileRecord, TAG_NTFS); return Status; } - RtlInitUnicodeString(&Found, FoundName); - - Status = FindAttribute(Vcb, *FileRecord, AttributeData, &Found, DataContext); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtfsLookupFileAt: Can't find data attribute\n"); - ExFreePoolWithTag(FileRecord, TAG_NTFS); - return Status; + if (!((*FileRecord)->Flags & FRH_DIRECTORY)) + { + Status = FindAttribute(Vcb, *FileRecord, AttributeData, L"", 0, DataContext); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtfsLookupFileAt: Can't find data attribute\n"); + ExFreePoolWithTag(*FileRecord, TAG_NTFS); + return Status; + } + } + else + { + *DataContext = NULL; } *MFTIndex = CurrentMFTIndex; @@ -748,13 +760,11 @@ PULONGLONG MFTIndex, ULONGLONG CurrentMFTIndex) { - UNICODE_STRING Found; NTSTATUS Status; - WCHAR FoundName[MAX_PATH + 1]; DPRINT1("NtfsFindFileAt(%p, %wZ, %p, %p, %p, %p, %I64x)\n", Vcb, SearchPattern, FirstEntry, FileRecord, DataContext, MFTIndex, CurrentMFTIndex); - Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex, FoundName); + Status = NtfsFindMftRecord(Vcb, CurrentMFTIndex, SearchPattern, FirstEntry, TRUE, &CurrentMFTIndex); if (!NT_SUCCESS(Status)) { return Status; @@ -771,18 +781,23 @@ if (!NT_SUCCESS(Status)) { DPRINT("NtfsFindFileAt: Can't read MFT record\n"); - ExFreePoolWithTag(FileRecord, TAG_NTFS); + ExFreePoolWithTag(*FileRecord, TAG_NTFS); return Status; } - RtlInitUnicodeString(&Found, FoundName); - - Status = FindAttribute(Vcb, *FileRecord, AttributeData, &Found, DataContext); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtfsFindFileAt: Can't find data attribute\n"); - ExFreePoolWithTag(FileRecord, TAG_NTFS); - return Status; + if (!((*FileRecord)->Flags & FRH_DIRECTORY)) + { + Status = FindAttribute(Vcb, *FileRecord, AttributeData, L"", 0, DataContext); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtfsFindFileAt: Can't find data attribute\n"); + ExFreePoolWithTag(*FileRecord, TAG_NTFS); + return Status; + } + } + else + { + *DataContext = NULL; } *MFTIndex = CurrentMFTIndex; Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/misc.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/misc.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/misc.c [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -97,4 +97,19 @@ return IrpContext; } +VOID +NtfsFileFlagsToAttributes(ULONG NtfsAttributes, + PULONG FileAttributes) +{ + *FileAttributes = NtfsAttributes; + if ((NtfsAttributes & NTFS_FILE_TYPE_DIRECTORY) == NTFS_FILE_TYPE_DIRECTORY) + { + *FileAttributes = NtfsAttributes & ~NTFS_FILE_TYPE_DIRECTORY; + *FileAttributes |= FILE_ATTRIBUTE_DIRECTORY; + } + + if (NtfsAttributes == 0) + *FileAttributes = FILE_ATTRIBUTE_NORMAL; +} + /* EOF */ Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/ntfs.h URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/ntfs.h [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -168,6 +168,8 @@ #define NTFS_FILE_QUOTA 9 #define NTFS_FILE_UPCASE 10 #define NTFS_FILE_EXTEND 11 + +#define NTFS_MFT_MASK 0x0000FFFFFFFFFFFFULL #define COLLATION_BINARY 0x00 #define COLLATION_FILE_NAME 0x01 @@ -331,6 +333,13 @@ typedef struct { + NTFS_RECORD_HEADER Ntfs; + ULONGLONG VCN; + INDEX_HEADER_ATTRIBUTE Header; +} INDEX_BUFFER, *PINDEX_BUFFER; + +typedef struct +{ union { struct @@ -613,7 +622,8 @@ FindAttribute(PDEVICE_EXTENSION Vcb, PFILE_RECORD_HEADER MftRecord, ULONG Type, - PUNICODE_STRING Name, + PCWSTR Name, + ULONG NameLength, PNTFS_ATTR_CONTEXT * AttrCtx); VOID @@ -680,15 +690,11 @@ CdfsSwapString(PWCHAR Out, PUCHAR In, ULONG Count); - -VOID -CdfsDateTimeToFileTime(PFCB Fcb, - TIME *FileTime); - -VOID -CdfsFileFlagsToAttributes(PFCB Fcb, - PULONG FileAttributes); #endif + +VOID +NtfsFileFlagsToAttributes(ULONG NtfsAttributes, + PULONG FileAttributes); /* rw.c */ Modified: branches/0.3.17/reactos/drivers/filesystems/ntfs/volinfo.c URL:
http://svn.reactos.org/svn/reactos/branches/0.3.17/reactos/drivers/filesyst…
============================================================================== --- branches/0.3.17/reactos/drivers/filesystems/ntfs/volinfo.c [iso-8859-1] (original) +++ branches/0.3.17/reactos/drivers/filesystems/ntfs/volinfo.c [iso-8859-1] Thu Oct 23 15:45:12 2014 @@ -31,6 +31,14 @@ #include <debug.h> /* FUNCTIONS ****************************************************************/ + +static +ULONGLONG +NtfsGetFreeClusters(PDEVICE_EXTENSION DeviceExt) +{ + UNIMPLEMENTED; + return 0; +} static NTSTATUS @@ -130,8 +138,8 @@ DeviceExt = DeviceObject->DeviceExtension; - FsSizeInfo->AvailableAllocationUnits.QuadPart = 0; - FsSizeInfo->TotalAllocationUnits.QuadPart = DeviceExt->NtfsInfo.SectorCount; /* ?? */ + FsSizeInfo->AvailableAllocationUnits.QuadPart = NtfsGetFreeClusters(DeviceExt); + FsSizeInfo->TotalAllocationUnits.QuadPart = DeviceExt->NtfsInfo.SectorCount / DeviceExt->NtfsInfo.SectorsPerCluster; FsSizeInfo->SectorsPerAllocationUnit = DeviceExt->NtfsInfo.SectorsPerCluster; FsSizeInfo->BytesPerSector = DeviceExt->NtfsInfo.BytesPerSector; @@ -145,7 +153,8 @@ static NTSTATUS -NtfsGetFsDeviceInformation(PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, +NtfsGetFsDeviceInformation(PDEVICE_OBJECT DeviceObject, + PFILE_FS_DEVICE_INFORMATION FsDeviceInfo, PULONG BufferLength) { DPRINT("NtfsGetFsDeviceInformation()\n"); @@ -157,7 +166,7 @@ return STATUS_BUFFER_OVERFLOW; FsDeviceInfo->DeviceType = FILE_DEVICE_DISK; - FsDeviceInfo->Characteristics = 0; /* FIXME: fix this !! */ + FsDeviceInfo->Characteristics = DeviceObject->Characteristics; DPRINT("NtfsGetFsDeviceInformation() finished.\n"); @@ -215,7 +224,8 @@ break; case FileFsDeviceInformation: - Status = NtfsGetFsDeviceInformation(SystemBuffer, + Status = NtfsGetFsDeviceInformation(DeviceObject, + SystemBuffer, &BufferLength); break;
10 years, 2 months
1
0
0
0
[jgardou] 64926: [USER32] - Fix wrong size check. Spotted by Thomas
by jgardou@svn.reactos.org
Author: jgardou Date: Thu Oct 23 15:40:13 2014 New Revision: 64926 URL:
http://svn.reactos.org/svn/reactos?rev=64926&view=rev
Log: [USER32] - Fix wrong size check. Spotted by Thomas Modified: trunk/reactos/win32ss/user/user32/windows/cursoricon_new.c Modified: trunk/reactos/win32ss/user/user32/windows/cursoricon_new.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
============================================================================== --- trunk/reactos/win32ss/user/user32/windows/cursoricon_new.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/windows/cursoricon_new.c [iso-8859-1] Thu Oct 23 15:40:13 2014 @@ -397,7 +397,7 @@ if ( dwFileSize < sizeof(*dir) ) return NULL; - if (dwFileSize < (sizeof(*dir) + FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount]))) + if (dwFileSize < FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount])) return NULL; /*
10 years, 2 months
1
0
0
0
[tfaber] 64925: [NTOS:IO] - Simplify how IopLoadUnloadDriver is called by making the function queue a work item instead of its caller
by tfaber@svn.reactos.org
Author: tfaber Date: Thu Oct 23 14:37:51 2014 New Revision: 64925 URL:
http://svn.reactos.org/svn/reactos?rev=64925&view=rev
Log: [NTOS:IO] - Simplify how IopLoadUnloadDriver is called by making the function queue a work item instead of its caller Modified: trunk/reactos/ntoskrnl/include/internal/io.h trunk/reactos/ntoskrnl/io/iomgr/driver.c Modified: trunk/reactos/ntoskrnl/include/internal/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/…
============================================================================== --- trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/include/internal/io.h [iso-8859-1] Thu Oct 23 14:37:51 2014 @@ -385,7 +385,7 @@ typedef struct _LOAD_UNLOAD_PARAMS { NTSTATUS Status; - PUNICODE_STRING ServiceName; + PCUNICODE_STRING RegistryPath; WORK_QUEUE_ITEM WorkItem; KEVENT Event; PDRIVER_OBJECT DriverObject; @@ -1083,10 +1083,11 @@ OUT PLDR_DATA_TABLE_ENTRY *ModuleObject ); -VOID +NTSTATUS NTAPI IopLoadUnloadDriver( - IN OUT PLOAD_UNLOAD_PARAMS LoadParams + _In_opt_ PCUNICODE_STRING RegistryPath, + _Inout_ PDRIVER_OBJECT *DriverObject ); NTSTATUS Modified: trunk/reactos/ntoskrnl/io/iomgr/driver.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/driver.c…
============================================================================== --- trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/io/iomgr/driver.c [iso-8859-1] Thu Oct 23 14:37:51 2014 @@ -1202,7 +1202,6 @@ PDRIVER_OBJECT DriverObject; PDEVICE_OBJECT DeviceObject; PEXTENDED_DEVOBJ_EXTENSION DeviceExtension; - LOAD_UNLOAD_PARAMS LoadParams; NTSTATUS Status; LPWSTR Start; BOOLEAN SafeToUnload = TRUE; @@ -1346,33 +1345,10 @@ DPRINT1("Unloading driver '%wZ' (manual)\n", &DriverObject->DriverName); - /* Set the unload invoked flag */ + /* Set the unload invoked flag and call the unload routine */ DriverObject->Flags |= DRVO_UNLOAD_INVOKED; - - if (PsGetCurrentProcess() == PsInitialSystemProcess) - { - /* Just call right away */ - (*DriverObject->DriverUnload)(DriverObject); - } - else - { - /* Load/Unload must be called from system process */ - - /* Prepare parameters block */ - LoadParams.DriverObject = DriverObject; - KeInitializeEvent(&LoadParams.Event, NotificationEvent, FALSE); - - ExInitializeWorkItem(&LoadParams.WorkItem, - (PWORKER_THREAD_ROUTINE)IopLoadUnloadDriver, - (PVOID)&LoadParams); - - /* Queue it */ - ExQueueWorkItem(&LoadParams.WorkItem, DelayedWorkQueue); - - /* And wait when it completes */ - KeWaitForSingleObject(&LoadParams.Event, UserRequest, KernelMode, - FALSE, NULL); - } + Status = IopLoadUnloadDriver(NULL, &DriverObject); + NT_ASSERT(Status == STATUS_SUCCESS); /* Mark the driver object temporary, so it could be deleted later */ ObMakeTemporaryObject(DriverObject); @@ -1381,7 +1357,7 @@ ObDereferenceObject(DriverObject); ObDereferenceObject(DriverObject); - return STATUS_SUCCESS; + return Status; } else { @@ -1865,8 +1841,24 @@ return DriverExtensions + 1; } -VOID NTAPI -IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) +VOID +NTAPI +IopLoadUnloadDriverWorker( + _Inout_ PVOID Parameter) +{ + PLOAD_UNLOAD_PARAMS LoadParams = Parameter; + + NT_ASSERT(PsGetCurrentProcess() == PsInitialSystemProcess); + LoadParams->Status = IopLoadUnloadDriver(LoadParams->RegistryPath, + &LoadParams->DriverObject); + KeSetEvent(&LoadParams->Event, 0, FALSE); +} + +NTSTATUS +NTAPI +IopLoadUnloadDriver( + _In_opt_ PCUNICODE_STRING RegistryPath, + _Inout_ PDRIVER_OBJECT *DriverObject) { RTL_QUERY_REGISTRY_TABLE QueryTable[3]; UNICODE_STRING ImagePath; @@ -1874,20 +1866,40 @@ NTSTATUS Status; ULONG Type; PDEVICE_NODE DeviceNode; - PDRIVER_OBJECT DriverObject; PLDR_DATA_TABLE_ENTRY ModuleObject; PVOID BaseAddress; WCHAR *cur; + /* Load/Unload must be called from system process */ + if (PsGetCurrentProcess() != PsInitialSystemProcess) + { + LOAD_UNLOAD_PARAMS LoadParams; + + /* Prepare parameters block */ + LoadParams.RegistryPath = RegistryPath; + LoadParams.DriverObject = *DriverObject; + KeInitializeEvent(&LoadParams.Event, NotificationEvent, FALSE); + + /* Initialize and queue a work item */ + ExInitializeWorkItem(&LoadParams.WorkItem, + IopLoadUnloadDriverWorker, + &LoadParams); + ExQueueWorkItem(&LoadParams.WorkItem, DelayedWorkQueue); + + /* And wait till it completes */ + KeWaitForSingleObject(&LoadParams.Event, + UserRequest, + KernelMode, + FALSE, + NULL); + return LoadParams.Status; + } + /* Check if it's an unload request */ - if (LoadParams->DriverObject) - { - (*LoadParams->DriverObject->DriverUnload)(LoadParams->DriverObject); - - /* Return success and signal the event */ - LoadParams->Status = STATUS_SUCCESS; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + if (*DriverObject) + { + (*DriverObject)->DriverUnload(*DriverObject); + return STATUS_SUCCESS; } RtlInitUnicodeString(&ImagePath, NULL); @@ -1895,19 +1907,18 @@ /* * Get the service name from the registry key name. */ - ASSERT(LoadParams->ServiceName->Length >= sizeof(WCHAR)); - - ServiceName = *LoadParams->ServiceName; - cur = LoadParams->ServiceName->Buffer + - (LoadParams->ServiceName->Length / sizeof(WCHAR)) - 1; - while (LoadParams->ServiceName->Buffer != cur) + ASSERT(RegistryPath->Length >= sizeof(WCHAR)); + + ServiceName = *RegistryPath; + cur = RegistryPath->Buffer + RegistryPath->Length / sizeof(WCHAR) - 1; + while (RegistryPath->Buffer != cur) { if (*cur == L'\\') { ServiceName.Buffer = cur + 1; - ServiceName.Length = LoadParams->ServiceName->Length - + ServiceName.Length = RegistryPath->Length - (USHORT)((ULONG_PTR)ServiceName.Buffer - - (ULONG_PTR)LoadParams->ServiceName->Buffer); + (ULONG_PTR)RegistryPath->Buffer); break; } cur--; @@ -1930,15 +1941,13 @@ QueryTable[1].EntryContext = &ImagePath; Status = RtlQueryRegistryValues(RTL_REGISTRY_ABSOLUTE, - LoadParams->ServiceName->Buffer, + RegistryPath->Buffer, QueryTable, NULL, NULL); if (!NT_SUCCESS(Status)) { DPRINT("RtlQueryRegistryValues() failed (Status %lx)\n", Status); if (ImagePath.Buffer) ExFreePool(ImagePath.Buffer); - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + return Status; } /* @@ -1949,9 +1958,7 @@ if (!NT_SUCCESS(Status)) { DPRINT("IopNormalizeImagePath() failed (Status %x)\n", Status); - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + return Status; } DPRINT("FullImagePath: '%wZ'\n", &ImagePath); @@ -1961,7 +1968,7 @@ * Get existing DriverObject pointer (in case the driver * has already been loaded and initialized). */ - Status = IopGetDriverObject(&DriverObject, + Status = IopGetDriverObject(DriverObject, &ServiceName, (Type == 2 /* SERVICE_FILE_SYSTEM_DRIVER */ || Type == 8 /* SERVICE_RECOGNIZER_DRIVER */)); @@ -1977,9 +1984,7 @@ if (!NT_SUCCESS(Status)) { DPRINT("MmLoadSystemImage() failed (Status %lx)\n", Status); - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + return Status; } /* @@ -1990,9 +1995,7 @@ { DPRINT1("IopCreateDeviceNode() failed (Status %lx)\n", Status); MmUnloadSystemImage(ModuleObject); - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + return Status; } IopDisplayLoadingMessage(&DeviceNode->ServiceName); @@ -2002,19 +2005,17 @@ &DeviceNode->ServiceName, (Type == 2 /* SERVICE_FILE_SYSTEM_DRIVER */ || Type == 8 /* SERVICE_RECOGNIZER_DRIVER */), - &DriverObject); + DriverObject); if (!NT_SUCCESS(Status)) { DPRINT1("IopInitializeDriverModule() failed (Status %lx)\n", Status); MmUnloadSystemImage(ModuleObject); IopFreeDeviceNode(DeviceNode); - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); - return; + return Status; } /* Initialize and start device */ - IopInitializeDevice(DeviceNode, DriverObject); + IopInitializeDevice(DeviceNode, *DriverObject); Status = IopStartDevice(DeviceNode); } else @@ -2023,12 +2024,10 @@ Status = STATUS_IMAGE_ALREADY_LOADED; /* IopGetDriverObject references the DriverObject, so dereference it */ - ObDereferenceObject(DriverObject); - } - - /* Pass status to the caller and signal the event */ - LoadParams->Status = Status; - KeSetEvent(&LoadParams->Event, 0, FALSE); + ObDereferenceObject(*DriverObject); + } + + return Status; } /* @@ -2051,7 +2050,7 @@ { UNICODE_STRING CapturedDriverServiceName = { 0, 0, NULL }; KPROCESSOR_MODE PreviousMode; - LOAD_UNLOAD_PARAMS LoadParams; + PDRIVER_OBJECT DriverObject; NTSTATUS Status; PAGED_CODE(); @@ -2081,35 +2080,14 @@ DPRINT("NtLoadDriver('%wZ')\n", &CapturedDriverServiceName); - LoadParams.ServiceName = &CapturedDriverServiceName; - LoadParams.DriverObject = NULL; - KeInitializeEvent(&LoadParams.Event, NotificationEvent, FALSE); - - /* Call the load/unload routine, depending on current process */ - if (PsGetCurrentProcess() == PsInitialSystemProcess) - { - /* Just call right away */ - IopLoadUnloadDriver(&LoadParams); - } - else - { - /* Load/Unload must be called from system process */ - ExInitializeWorkItem(&LoadParams.WorkItem, - (PWORKER_THREAD_ROUTINE)IopLoadUnloadDriver, - (PVOID)&LoadParams); - - /* Queue it */ - ExQueueWorkItem(&LoadParams.WorkItem, DelayedWorkQueue); - - /* And wait when it completes */ - KeWaitForSingleObject(&LoadParams.Event, UserRequest, KernelMode, - FALSE, NULL); - } + /* Load driver and call its entry point */ + DriverObject = NULL; + Status = IopLoadUnloadDriver(&CapturedDriverServiceName, &DriverObject); ReleaseCapturedUnicodeString(&CapturedDriverServiceName, PreviousMode); - return LoadParams.Status; + return Status; } /*
10 years, 2 months
1
0
0
0
[akhaldi] 64924: [USER32] * Merge r64866 from the shell branch which had: * Fix wrong array length passed to GetClassNameW. CID 716222 * Replace other instances of explicit array length to GetWindo...
by akhaldi@svn.reactos.org
Author: akhaldi Date: Thu Oct 23 12:24:07 2014 New Revision: 64924 URL:
http://svn.reactos.org/svn/reactos?rev=64924&view=rev
Log: [USER32] * Merge r64866 from the shell branch which had: * Fix wrong array length passed to GetClassNameW. CID 716222 * Replace other instances of explicit array length to GetWindowTextW with _countof(x). Based on a patch by Christoph von Wittich. Modified: trunk/reactos/ (props changed) trunk/reactos/win32ss/user/user32/controls/appswitch.c Propchange: trunk/reactos/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Thu Oct 23 12:24:07 2014 @@ -13,6 +13,7 @@ /branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 /branches/ros-branch-0_3_15-lt2013:59059 /branches/ros-csrss:57561-58762 +/branches/shell-experiments:64866 /branches/shell32_new-bringup:51893-53652,53661,53700 /branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454 /branches/usb-bringup:51335,51337,51341-51343,51348,51350,51353,51355,51365-51369,51372,51384-54388,54396-54398,54736-54737,54752-54754,54756-54760,54762,54764-54765,54767-54768,54772,54774-54777,54781,54787,54790-54792,54797-54798,54806,54808,54834-54838,54843,54850,54852,54856,54858-54859 Modified: trunk/reactos/win32ss/user/user32/controls/appswitch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/contro…
============================================================================== --- trunk/reactos/win32ss/user/user32/controls/appswitch.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/user32/controls/appswitch.c [iso-8859-1] Thu Oct 23 12:24:07 2014 @@ -83,7 +83,7 @@ { HWND hwnd = windowList[selectedWindow]; - GetWindowTextW(hwnd, windowText, 1023); + GetWindowTextW(hwnd, windowText, _countof(windowText)); TRACE("[ATbot] CompleteSwitch Switching to 0x%08x (%ls)\n", hwnd, windowText); @@ -103,9 +103,9 @@ if (!IsWindowVisible(window)) return TRUE; - GetClassNameW(window,windowText,4095); - if ((wcscmp(L"Shell_TrayWnd",windowText)==0) || - (wcscmp(L"Progman",windowText)==0) ) + GetClassNameW(window, windowText, _countof(windowText)); + if ((wcscmp(L"Shell_TrayWnd", windowText)==0) || + (wcscmp(L"Progman", windowText)==0) ) return TRUE; // First try to get the big icon assigned to the window @@ -194,7 +194,7 @@ HPEN hPen; HFONT dcFont; COLORREF cr; - int nch = GetWindowTextW(windowList[selectedWindow], windowText, 1023); + int nch = GetWindowTextW(windowList[selectedWindow], windowText, _countof(windowText)); dialogDC = BeginPaint(hWnd, &paint); { @@ -373,7 +373,7 @@ } TRACE("DoAppSwitch VK_ESCAPE 1 Count %d windowCount %d\n",Count,windowCount); hwnd = windowList[Count]; - GetWindowTextW(hwnd, Text, 1023); + GetWindowTextW(hwnd, Text, _countof(Text)); TRACE("[ATbot] Switching to 0x%08x (%ls)\n", hwnd, Text); MakeWindowActive(hwnd); Esc = TRUE; @@ -456,7 +456,7 @@ Count = windowCount - 1; } hwnd = windowList[Count]; - GetWindowTextW(hwnd, Text, 1023); + GetWindowTextW(hwnd, Text, _countof(Text)); MakeWindowActive(hwnd); } }
10 years, 2 months
1
0
0
0
[hbelusca] 64923: [NTVDM]: Addendum to revision 64917: remove unnecessary casts.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Thu Oct 23 12:21:46 2014 New Revision: 64923 URL:
http://svn.reactos.org/svn/reactos?rev=64923&view=rev
Log: [NTVDM]: Addendum to revision 64917: remove unnecessary casts. Modified: trunk/reactos/subsystems/ntvdm/io.c trunk/reactos/subsystems/ntvdm/io.h Modified: trunk/reactos/subsystems/ntvdm/io.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/io.c?rev=…
============================================================================== --- trunk/reactos/subsystems/ntvdm/io.c [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/io.c [iso-8859-1] Thu Oct 23 12:21:46 2014 @@ -70,7 +70,7 @@ { UCHAR Data; ASSERT(Port <= MAXWORD); - IoPortProc[Port].VddIoHandlers.inb_handler((WORD)Port, &Data); + IoPortProc[Port].VddIoHandlers.inb_handler(Port, &Data); return Data; } else @@ -82,7 +82,7 @@ } VOID -IOReadStrB(USHORT Port, +IOReadStrB(USHORT Port, PUCHAR Buffer, ULONG Count) { @@ -96,7 +96,7 @@ { ASSERT(Port <= MAXWORD); ASSERT(Count <= MAXWORD); - IoPortProc[Port].VddIoHandlers.insb_handler((WORD)Port, Buffer, (WORD)Count); + IoPortProc[Port].VddIoHandlers.insb_handler(Port, Buffer, (WORD)Count); } else { @@ -106,7 +106,7 @@ VOID IOWriteB(USHORT Port, - UCHAR Buffer) + UCHAR Buffer) { if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE && IoPortProc[Port].IoHandlers.OutB) @@ -117,7 +117,7 @@ IoPortProc[Port].VddIoHandlers.outb_handler) { ASSERT(Port <= MAXWORD); - IoPortProc[Port].VddIoHandlers.outb_handler((WORD)Port, Buffer); + IoPortProc[Port].VddIoHandlers.outb_handler(Port, Buffer); } else { @@ -127,7 +127,7 @@ } VOID -IOWriteStrB(USHORT Port, +IOWriteStrB(USHORT Port, PUCHAR Buffer, ULONG Count) { @@ -141,7 +141,7 @@ { ASSERT(Port <= MAXWORD); ASSERT(Count <= MAXWORD); - IoPortProc[Port].VddIoHandlers.outsb_handler((WORD)Port, Buffer, (WORD)Count); + IoPortProc[Port].VddIoHandlers.outsb_handler(Port, Buffer, (WORD)Count); } else { @@ -162,7 +162,7 @@ { USHORT Data; ASSERT(Port <= MAXWORD); - IoPortProc[Port].VddIoHandlers.inw_handler((WORD)Port, &Data); + IoPortProc[Port].VddIoHandlers.inw_handler(Port, &Data); return Data; } else @@ -177,7 +177,7 @@ } VOID -IOReadStrW(USHORT Port, +IOReadStrW(USHORT Port, PUSHORT Buffer, ULONG Count) { @@ -191,7 +191,7 @@ { ASSERT(Port <= MAXWORD); ASSERT(Count <= MAXWORD); - IoPortProc[Port].VddIoHandlers.insw_handler((WORD)Port, Buffer, (WORD)Count); + IoPortProc[Port].VddIoHandlers.insw_handler(Port, Buffer, (WORD)Count); } else { @@ -200,7 +200,7 @@ } VOID -IOWriteW(USHORT Port, +IOWriteW(USHORT Port, USHORT Buffer) { if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE && @@ -212,7 +212,7 @@ IoPortProc[Port].VddIoHandlers.outw_handler) { ASSERT(Port <= MAXWORD); - IoPortProc[Port].VddIoHandlers.outw_handler((WORD)Port, Buffer); + IoPortProc[Port].VddIoHandlers.outw_handler(Port, Buffer); } else { @@ -223,7 +223,7 @@ } VOID -IOWriteStrW(USHORT Port, +IOWriteStrW(USHORT Port, PUSHORT Buffer, ULONG Count) { @@ -237,7 +237,7 @@ { ASSERT(Port <= MAXWORD); ASSERT(Count <= MAXWORD); - IoPortProc[Port].VddIoHandlers.outsw_handler((WORD)Port, Buffer, (WORD)Count); + IoPortProc[Port].VddIoHandlers.outsw_handler(Port, Buffer, (WORD)Count); } else { @@ -265,7 +265,7 @@ } VOID -IOReadStrD(USHORT Port, +IOReadStrD(USHORT Port, PULONG Buffer, ULONG Count) { @@ -282,7 +282,7 @@ VOID IOWriteD(USHORT Port, - ULONG Buffer) + ULONG Buffer) { if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE && IoPortProc[Port].IoHandlers.OutD) @@ -298,7 +298,7 @@ } VOID -IOWriteStrD(USHORT Port, +IOWriteStrD(USHORT Port, PULONG Buffer, ULONG Count) { Modified: trunk/reactos/subsystems/ntvdm/io.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/ntvdm/io.h?rev=…
============================================================================== --- trunk/reactos/subsystems/ntvdm/io.h [iso-8859-1] (original) +++ trunk/reactos/subsystems/ntvdm/io.h [iso-8859-1] Thu Oct 23 12:21:46 2014 @@ -36,45 +36,45 @@ UCHAR IOReadB(USHORT Port); VOID -IOReadStrB(USHORT Port, +IOReadStrB(USHORT Port, PUCHAR Buffer, ULONG Count); VOID IOWriteB(USHORT Port, - UCHAR Buffer); + UCHAR Buffer); VOID -IOWriteStrB(USHORT Port, +IOWriteStrB(USHORT Port, PUCHAR Buffer, ULONG Count); USHORT IOReadW(USHORT Port); VOID -IOReadStrW(USHORT Port, +IOReadStrW(USHORT Port, PUSHORT Buffer, ULONG Count); VOID -IOWriteW(USHORT Port, +IOWriteW(USHORT Port, USHORT Buffer); VOID -IOWriteStrW(USHORT Port, +IOWriteStrW(USHORT Port, PUSHORT Buffer, ULONG Count); ULONG IOReadD(USHORT Port); VOID -IOReadStrD(USHORT Port, +IOReadStrD(USHORT Port, PULONG Buffer, ULONG Count); VOID IOWriteD(USHORT Port, - ULONG Buffer); + ULONG Buffer); VOID -IOWriteStrD(USHORT Port, +IOWriteStrD(USHORT Port, PULONG Buffer, ULONG Count);
10 years, 2 months
1
0
0
0
← Newer
1
...
21
22
23
24
25
26
27
...
73
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Results per page:
10
25
50
100
200