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
November 2009
----- 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
23 participants
444 discussions
Start a n
N
ew thread
[dgorbachev] 44196: Break long expressions, fix formatting.
by dgorbachev@svn.reactos.org
Author: dgorbachev Date: Mon Nov 16 02:56:48 2009 New Revision: 44196 URL:
http://svn.reactos.org/svn/reactos?rev=44196&view=rev
Log: Break long expressions, fix formatting. Modified: trunk/reactos/ntoskrnl/fsrtl/fastio.c Modified: trunk/reactos/ntoskrnl/fsrtl/fastio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/fsrtl/fastio.c?re…
============================================================================== --- trunk/reactos/ntoskrnl/fsrtl/fastio.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/fsrtl/fastio.c [iso-8859-1] Mon Nov 16 02:56:48 2009 @@ -74,9 +74,9 @@ PFAST_IO_DISPATCH FastIoDispatch; PDEVICE_OBJECT Device; BOOLEAN Result = TRUE; - ULONG PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(FileOffset,Length); - - PAGED_CODE(); + ULONG PageCount = ADDRESS_AND_SIZE_TO_SPAN_PAGES(FileOffset, Length); + + PAGED_CODE(); ASSERT(FileObject); ASSERT(FileObject->FsContext); @@ -89,41 +89,45 @@ return TRUE; } - if (MAXLONGLONG < (LONGLONG) FileOffset->QuadPart + Length) { - IoStatus->Status = STATUS_INVALID_PARAMETER; - IoStatus->Information = 0; - return FALSE; + if (MAXLONGLONG < (LONGLONG) FileOffset->QuadPart + Length) + { + IoStatus->Status = STATUS_INVALID_PARAMETER; + IoStatus->Information = 0; + return FALSE; } /* Get the offset and FCB header */ Offset.QuadPart = FileOffset->QuadPart + Length; FcbHeader = (PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext; - - if (Wait) { + if (Wait) + { /* Use a Resource Acquire */ FsRtlEnterFileSystem(); - CcFastReadWait++; + CcFastReadWait++; ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); - } else { - /* Acquire the resource without blocking */ - /* Return false and the I/O manager will retry using the standard IRP method. */ - /* Use a Resource Acquire */ + } + else + { + /* Acquire the resource without blocking. Return false and the I/O manager + * will retry using the standard IRP method. Use a Resource Acquire. + */ FsRtlEnterFileSystem(); - if (!ExAcquireResourceSharedLite(FcbHeader->Resource, FALSE)) { - FsRtlExitFileSystem(); - FsRtlIncrementCcFastReadResourceMiss(); - return FALSE; - } - } - + if (!ExAcquireResourceSharedLite(FcbHeader->Resource, FALSE)) + { + FsRtlExitFileSystem(); + FsRtlIncrementCcFastReadResourceMiss(); + return FALSE; + } + } /* Check if this is a fast I/O cached file */ if (!(FileObject->PrivateCacheMap) || - (FcbHeader->IsFastIoPossible == FastIoIsNotPossible)) { + (FcbHeader->IsFastIoPossible == FastIoIsNotPossible)) + { /* It's not, so fail */ - Result = FALSE; - goto Cleanup; + Result = FALSE; + goto Cleanup; } /* Check if we need to find out if fast I/O is available */ @@ -134,7 +138,7 @@ /* Get the Fast I/O table */ Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; + FastIoDispatch = Device->DriverObject->FastIoDispatch; /* Sanity check */ ASSERT(FastIoDispatch != NULL); @@ -154,12 +158,14 @@ Result = FALSE; goto Cleanup; } - } + } /* Check if we read too much */ - if (Offset.QuadPart > FcbHeader->FileSize.QuadPart){ + if (Offset.QuadPart > FcbHeader->FileSize.QuadPart) + { /* We did, check if the file offset is past the end */ - if (FileOffset->QuadPart >= FcbHeader->FileSize.QuadPart){ + if (FileOffset->QuadPart >= FcbHeader->FileSize.QuadPart) + { /* Set end of file */ IoStatus->Status = STATUS_END_OF_FILE; IoStatus->Information = 0; @@ -171,45 +177,67 @@ } /* Set this as top-level IRP */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - - _SEH2_TRY - { - /* Make sure the IO and file size is below 4GB */ - if (Wait && !(Offset.HighPart | FcbHeader->FileSize.HighPart )) { - - /* Call the cache controller */ - CcFastCopyRead (FileObject,FileOffset->LowPart,Length,PageCount,Buffer,IoStatus); - /* File was accessed */ - FileObject->Flags |= FO_FILE_FAST_IO_READ; - if (IoStatus->Status != STATUS_END_OF_FILE) { - ASSERT(( FcbHeader->FileSize.QuadPart) >= (FileOffset->QuadPart + IoStatus->Information)); - } - - } else { + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + + _SEH2_TRY + { + /* Make sure the IO and file size is below 4GB */ + if (Wait && !(Offset.HighPart | FcbHeader->FileSize.HighPart)) + { /* Call the cache controller */ - Result = CcCopyRead(FileObject, FileOffset, Length, Wait,Buffer, IoStatus); + CcFastCopyRead(FileObject, + FileOffset->LowPart, + Length, + PageCount, + Buffer, + IoStatus); + /* File was accessed */ - FileObject->Flags |= FO_FILE_FAST_IO_READ; - if (Result == TRUE) { - ASSERT( (IoStatus->Status == STATUS_END_OF_FILE) || - ((LONGLONG)(FileOffset->QuadPart + IoStatus->Information) <= FcbHeader->FileSize.QuadPart) - ); - } - } + FileObject->Flags |= FO_FILE_FAST_IO_READ; + + if (IoStatus->Status != STATUS_END_OF_FILE) + { + ASSERT(FcbHeader->FileSize.QuadPart >= + FileOffset->QuadPart + IoStatus->Information); + } + } + else + { + + /* Call the cache controller */ + Result = CcCopyRead(FileObject, + FileOffset, + Length, + Wait, + Buffer, + IoStatus); + + /* File was accessed */ + FileObject->Flags |= FO_FILE_FAST_IO_READ; + + if (Result == TRUE) + { + ASSERT((IoStatus->Status == STATUS_END_OF_FILE) || + ((LONGLONG)(FileOffset->QuadPart + IoStatus->Information) <= + FcbHeader->FileSize.QuadPart)); + } + } /* Update the current file offset */ - if (Result == TRUE) { - FileObject->CurrentByteOffset.QuadPart += IoStatus->Information; - } - } - _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; - } _SEH2_END; - - PsGetCurrentThread()->TopLevelIrp = 0; + if (Result == TRUE) + { + FileObject->CurrentByteOffset.QuadPart += IoStatus->Information; + } + } + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + Result = FALSE; + } + _SEH2_END; + + PsGetCurrentThread()->TopLevelIrp = 0; /* Return to caller */ Cleanup: @@ -217,12 +245,12 @@ ExReleaseResourceLite(FcbHeader->Resource); FsRtlExitFileSystem(); - if (Result == FALSE) { + if (Result == FALSE) + { CcFastReadNotPossible += 1; - } + } return Result; - } @@ -240,22 +268,23 @@ OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject) { - BOOLEAN Result = TRUE; PFAST_IO_DISPATCH FastIoDispatch; PDEVICE_OBJECT Device; PFSRTL_COMMON_FCB_HEADER FcbHeader; - - /* WDK doc. Offset=0xffffffffffffffff indicates append to the end of file */ - BOOLEAN FileOffsetAppend = ((FileOffset->HighPart == (LONG)0xffffffff) && (FileOffset->LowPart == 0xffffffff)); + PSHARED_CACHE_MAP SharedCacheMap; + + /* WDK doc. + * Offset == 0xffffffffffffffff indicates append to the end of file. + */ + BOOLEAN FileOffsetAppend = (FileOffset->HighPart == (LONG)0xffffffff) && + (FileOffset->LowPart == 0xffffffff); + BOOLEAN ResourceAquiredShared = FALSE; - BOOLEAN b_4GB = FALSE; - BOOLEAN FileSizeModified = FALSE; LARGE_INTEGER OldFileSize; LARGE_INTEGER OldValidDataLength; - LARGE_INTEGER NewSize; LARGE_INTEGER Offset; @@ -269,13 +298,14 @@ Offset.QuadPart = FileOffset->QuadPart + Length; FcbHeader = (PFSRTL_COMMON_FCB_HEADER)FileObject->FsContext; - /* Nagar p.544 -- Check with Cc if we can write and check if the IO > 64kB (WDK macro) */ - if ( (CcCanIWrite(FileObject, Length,Wait, FALSE) == FALSE) || - (CcCopyWriteWontFlush(FileObject,FileOffset,Length) == FALSE) || - ((FileObject->Flags & FO_WRITE_THROUGH )== TRUE) - ) - { - return FALSE; + /* Nagar p.544. + * Check with Cc if we can write and check if the IO > 64kB (WDK macro). + */ + if ((CcCanIWrite(FileObject, Length, Wait, FALSE) == FALSE) || + (CcCopyWriteWontFlush(FileObject, FileOffset, Length) == FALSE) || + ((FileObject->Flags & FO_WRITE_THROUGH) == TRUE)) + { + return FALSE; } /* No actual read */ @@ -288,385 +318,477 @@ FsRtlEnterFileSystem(); - /* Nagar p.544/545 -- The CcFastCopyWrite doesn't deal with filesize beyond 4GB*/ + /* Nagar p.544/545. + * The CcFastCopyWrite doesn't deal with filesize beyond 4GB. + */ if (Wait && (FcbHeader->AllocationSize.HighPart == 0)) { - /* If the file offset is not past the file size, then we can acquire the lock shared */ - if ((FileOffsetAppend == FALSE) && (Offset.LowPart <= FcbHeader->ValidDataLength.LowPart)){ - ExAcquireResourceSharedLite(FcbHeader->Resource,TRUE); - ResourceAquiredShared = TRUE; - } else { - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); - } - - /* Nagar p.544/545 -- If we append, use the file size as offset. Also, check that we aren't crossing the 4GB boundary */ - if ((FileOffsetAppend == TRUE)) { - Offset.LowPart = FcbHeader->FileSize.LowPart; - NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; - b_4GB = (NewSize.LowPart < FcbHeader->FileSize.LowPart); - - } else { - Offset.LowPart = FileOffset->LowPart; - NewSize.LowPart = FileOffset->LowPart + Length; - b_4GB = ((NewSize.LowPart < FileOffset->LowPart) || (FileOffset->HighPart != 0)); - } - - /* Nagar p.544/545 - Make sure that caching is initated. - That fast are allowed for this file stream. - That we are not extending past the allocated size - That we are not creating a hole bigger than 8k - That we are not crossing the 4GB boundary - */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && - (Offset.LowPart < (FcbHeader->ValidDataLength.LowPart + 0x2000) ) && - !b_4GB - ) - { - /* If we are extending past the file size, we need to release the lock and acquire it - exclusively, because we are going to need to update the FcbHeader */ - if (ResourceAquiredShared && (NewSize.LowPart > (FcbHeader->ValidDataLength.LowPart + 0x2000))) { - /* Then we need to acquire the resource exclusive */ - ExReleaseResourceLite(FcbHeader->Resource); - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); - if (FileOffsetAppend == TRUE) { - Offset.LowPart = FcbHeader->FileSize.LowPart; // ?? - NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; - /* Make sure we don't cross the 4GB boundary */ - b_4GB = (NewSize.LowPart < Offset.LowPart); - } + /* If the file offset is not past the file size, + * then we can acquire the lock shared. + */ + if ((FileOffsetAppend == FALSE) && + (Offset.LowPart <= FcbHeader->ValidDataLength.LowPart)) + { + ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); + ResourceAquiredShared = TRUE; + } + else + { + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); + } + + /* Nagar p.544/545. + * If we append, use the file size as offset. + * Also, check that we aren't crossing the 4GB boundary. + */ + if (FileOffsetAppend == TRUE) + { + Offset.LowPart = FcbHeader->FileSize.LowPart; + NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; + b_4GB = (NewSize.LowPart < FcbHeader->FileSize.LowPart); + + } + else + { + Offset.LowPart = FileOffset->LowPart; + NewSize.LowPart = FileOffset->LowPart + Length; + b_4GB = (NewSize.LowPart < FileOffset->LowPart) || + (FileOffset->HighPart != 0); + } + + /* Nagar p.544/545. + * Make sure that caching is initated. + * That fast are allowed for this file stream. + * That we are not extending past the allocated size. + * That we are not creating a hole bigger than 8k. + * That we are not crossing the 4GB boundary. + */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && + (Offset.LowPart < FcbHeader->ValidDataLength.LowPart + 0x2000) && + !b_4GB) + { + /* If we are extending past the file size, we need to + * release the lock and acquire it exclusively, because + * we are going to need to update the FcbHeader. + */ + if (ResourceAquiredShared && + (NewSize.LowPart > FcbHeader->ValidDataLength.LowPart + 0x2000)) + { + /* Then we need to acquire the resource exclusive */ + ExReleaseResourceLite(FcbHeader->Resource); + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); + if (FileOffsetAppend == TRUE) + { + Offset.LowPart = FcbHeader->FileSize.LowPart; // ?? + NewSize.LowPart = FcbHeader->FileSize.LowPart + Length; + + /* Make sure we don't cross the 4GB boundary */ + b_4GB = (NewSize.LowPart < Offset.LowPart); + } /* Recheck some of the conditions since we let the lock go */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && - (FcbHeader->AllocationSize.HighPart == 0) && - !b_4GB - ) - { - } else - { - goto FailAndCleanup; - } - } - - }else - { - goto FailAndCleanup; - } - - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; - - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); - - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; - - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, - FileOffsetAppend? &FcbHeader->FileSize:FileOffset, - Length, - TRUE, - LockKey, - FALSE, - &FastIoCheckIfPossibleStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } - - /* If we are going to extend the file then save the old file size - in case the operation fails - */ - if (NewSize.LowPart > FcbHeader->FileSize.LowPart) { - FileSizeModified = TRUE; - OldFileSize.LowPart = FcbHeader->FileSize.LowPart; - OldValidDataLength.LowPart = FcbHeader->ValidDataLength.LowPart; - FcbHeader->FileSize.LowPart = NewSize.LowPart; - } - - /* Set this as top-level IRP */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - - _SEH2_TRY - { - if (Offset.LowPart > FcbHeader->ValidDataLength.LowPart) { - LARGE_INTEGER OffsetVar; - OffsetVar.LowPart = Offset.LowPart; - OffsetVar.HighPart = 0; - CcZeroData(FileObject,&FcbHeader->ValidDataLength,&OffsetVar,TRUE); - } - - /* Call the cache manager */ - CcFastCopyWrite(FileObject,Offset.LowPart,Length,Buffer); - } - _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; - } _SEH2_END; + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.LowPart >= NewSize.LowPart) && + (FcbHeader->AllocationSize.HighPart == 0) && + !b_4GB) + { + /* Do nothing? */ + } + else + { + goto FailAndCleanup; + } + } + + } + else + { + goto FailAndCleanup; + } + + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; + + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); + + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; + + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + FileOffsetAppend ? + &FcbHeader->FileSize : + FileOffset, + Length, + TRUE, + LockKey, + FALSE, + &FastIoCheckIfPossibleStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } + + /* If we are going to extend the file then save + * the old file size in case the operation fails. + */ + if (NewSize.LowPart > FcbHeader->FileSize.LowPart) + { + FileSizeModified = TRUE; + OldFileSize.LowPart = FcbHeader->FileSize.LowPart; + OldValidDataLength.LowPart = FcbHeader->ValidDataLength.LowPart; + FcbHeader->FileSize.LowPart = NewSize.LowPart; + } + + /* Set this as top-level IRP */ + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + + _SEH2_TRY + { + if (Offset.LowPart > FcbHeader->ValidDataLength.LowPart) + { + LARGE_INTEGER OffsetVar; + OffsetVar.LowPart = Offset.LowPart; + OffsetVar.HighPart = 0; + CcZeroData(FileObject, &FcbHeader->ValidDataLength, &OffsetVar, TRUE); + } + + /* Call the cache manager */ + CcFastCopyWrite(FileObject, Offset.LowPart, Length, Buffer); + } + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : + EXCEPTION_CONTINUE_SEARCH) + { + Result = FALSE; + } + _SEH2_END; /* Remove ourselves at the top level component after the IO is done */ - PsGetCurrentThread()->TopLevelIrp = 0; - - /* Did the operation succeed ? */ - if (Result == TRUE) { - /* Update the valid file size if necessary */ - if (NewSize.LowPart > FcbHeader->ValidDataLength.LowPart){ - FcbHeader->ValidDataLength.LowPart = NewSize.LowPart ; - } + PsGetCurrentThread()->TopLevelIrp = 0; + + /* Did the operation succeed? */ + if (Result == TRUE) + { + /* Update the valid file size if necessary */ + if (NewSize.LowPart > FcbHeader->ValidDataLength.LowPart) + { + FcbHeader->ValidDataLength.LowPart = NewSize.LowPart; + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; - - /* Update the strucutres if the file size changed */ - if (FileSizeModified) { - ((SHARED_CACHE_MAP*) FileObject->SectionObjectPointer->SharedCacheMap)->FileSize.LowPart = NewSize.LowPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } + FileObject->Flags |= FO_FILE_MODIFIED; + + /* Update the strucutres if the file size changed */ + if (FileSizeModified) + { + SharedCacheMap = + (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + SharedCacheMap->FileSize.LowPart = NewSize.LowPart; + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } /* Update the file object current file offset */ - FileObject->CurrentByteOffset.QuadPart = NewSize.LowPart; - - } else { - - /* Result == FALSE if we get here. */ - if (FileSizeModified) { - /* If the file size was modified then restore the old file size */ - if(FcbHeader->PagingIoResource != NULL) { - // Nagar P.544 Restore the old file size if operation didn't succeed. - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource,TRUE); - FcbHeader->FileSize.LowPart = OldFileSize.LowPart; - FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - } else { - /* If there is no lock and do it without */ - FcbHeader->FileSize.LowPart = OldFileSize.LowPart; - FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; - } - } else { - } - } - - goto Cleanup; - - } else { - - LARGE_INTEGER OldFileSize; - - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); - - // Nagar P.544 - /* Check if we need to acquire the resource exclusive */ - if ( (FileOffsetAppend == FALSE) && - ( (FileOffset->QuadPart + Length) <= FcbHeader->ValidDataLength.QuadPart ) - ) - { - /* Acquire the resource shared */ - if (!ExAcquireResourceSharedLite(FcbHeader->Resource,Wait)) { - goto LeaveCriticalAndFail; - } - ResourceAquiredShared =TRUE; - } else { - /* Acquire the resource exclusive */ - if (!ExAcquireResourceExclusiveLite(FcbHeader->Resource,Wait)) { - goto LeaveCriticalAndFail; - } - } - - /* Check if we are appending */ - if (FileOffsetAppend == TRUE) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } else { - Offset.QuadPart = FileOffset->QuadPart; - NewSize.QuadPart += FileOffset->QuadPart + Length; - } - - /* Nagar p.544/545 - Make sure that caching is initated. - That fast are allowed for this file stream. - That we are not extending past the allocated size - That we are not creating a hole bigger than 8k - */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - ((FcbHeader->ValidDataLength.QuadPart + 0x2000) > Offset.QuadPart) && - (MAXLONGLONG > (Offset.QuadPart + Length)) && - (FcbHeader->AllocationSize.QuadPart >= NewSize.QuadPart) - ) - { - /* Check if we can keep the lock shared */ - if (ResourceAquiredShared && (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) ) { - ExReleaseResourceLite(FcbHeader->Resource); - if(!ExAcquireResourceExclusiveLite(FcbHeader->Resource,Wait)) - { - goto LeaveCriticalAndFail; - } + FileObject->CurrentByteOffset.QuadPart = NewSize.LowPart; + + } + else + { + /* Result == FALSE if we get here */ + if (FileSizeModified) + { + /* If the file size was modified then restore the old file size */ + if (FcbHeader->PagingIoResource != NULL) + { + /* Nagar P.544. + * Restore the old file size if operation didn't succeed. + */ + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.LowPart = OldFileSize.LowPart; + FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + /* If there is no lock and do it without */ + FcbHeader->FileSize.LowPart = OldFileSize.LowPart; + FcbHeader->ValidDataLength.LowPart = OldValidDataLength.LowPart; + } + } + else + { + /* Do nothing? */ + } + } + + goto Cleanup; + } + else + { + LARGE_INTEGER OldFileSize; + + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); + + /* Nagar P.544. + * Check if we need to acquire the resource exclusive. + */ + if ((FileOffsetAppend == FALSE) && + (FileOffset->QuadPart + Length <= FcbHeader->ValidDataLength.QuadPart)) + { + /* Acquire the resource shared */ + if (!ExAcquireResourceSharedLite(FcbHeader->Resource, Wait)) + { + goto LeaveCriticalAndFail; + } + ResourceAquiredShared = TRUE; + } + else + { + /* Acquire the resource exclusive */ + if (!ExAcquireResourceExclusiveLite(FcbHeader->Resource, Wait)) + { + goto LeaveCriticalAndFail; + } + } + + /* Check if we are appending */ + if (FileOffsetAppend == TRUE) + { + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } + else + { + Offset.QuadPart = FileOffset->QuadPart; + NewSize.QuadPart += FileOffset->QuadPart + Length; + } + + /* Nagar p.544/545. + * Make sure that caching is initated. + * That fast are allowed for this file stream. + * That we are not extending past the allocated size. + * That we are not creating a hole bigger than 8k. + */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->ValidDataLength.QuadPart + 0x2000 > Offset.QuadPart) && + (MAXLONGLONG > Offset.QuadPart + Length) && + (FcbHeader->AllocationSize.QuadPart >= NewSize.QuadPart)) + { + /* Check if we can keep the lock shared */ + if (ResourceAquiredShared && + (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart)) + { + ExReleaseResourceLite(FcbHeader->Resource); + if (!ExAcquireResourceExclusiveLite(FcbHeader->Resource, Wait)) + { + goto LeaveCriticalAndFail; + } /* Compute the offset and the new filesize */ - if (FileOffsetAppend) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } - - /* Recheck the above points since we released and reacquire the lock */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart) - ) - { - /* Do nothing */ - } else { - goto FailAndCleanup; - } - } - - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; - - /* Sanity check */ - ASSERT(!KeIsExecutingDpc()); - - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; - - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, - FileOffsetAppend? &FcbHeader->FileSize:FileOffset, - Length, - TRUE, - LockKey, - FALSE, - &FastIoCheckIfPossibleStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } - - - /* If we are going to modify the filesize, save the old fs in case the operation fails */ - if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) { - FileSizeModified = TRUE; - OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; - OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; - - /* If the high part of the filesize is going to change, grab the Paging IoResouce */ - if (NewSize.HighPart != FcbHeader->FileSize.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - } else { - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - } - } - - /* Nagar p.544 */ - /* Set ourselves as top component */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { - BOOLEAN CallCc = TRUE; - /* Check if there is a gap between the end of the file and the offset - If yes, then we have to zero the data - */ - if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) { - if (!(Result = CcZeroData(FileObject,&FcbHeader->ValidDataLength,&Offset,Wait))) { - /* If this operation fails, then we have to exit - We can jump outside the SEH, so I a using a variable to exit - normally - */ - CallCc = FALSE; - } - } + if (FileOffsetAppend) + { + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } + + /* Recheck the above points since we released and reacquire the lock */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart)) + { + /* Do nothing */ + } + else + { + goto FailAndCleanup; + } + } + + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + IO_STATUS_BLOCK FastIoCheckIfPossibleStatus; + + /* Sanity check */ + ASSERT(!KeIsExecutingDpc()); + + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; + + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + FileOffsetAppend ? + &FcbHeader->FileSize : + FileOffset, + Length, + TRUE, + LockKey, + FALSE, + &FastIoCheckIfPossibleStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } + + /* If we are going to modify the filesize, + * save the old fs in case the operation fails. + */ + if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) + { + FileSizeModified = TRUE; + OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; + OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; + + /* If the high part of the filesize is going + * to change, grab the Paging IoResouce. + */ + if (NewSize.HighPart != FcbHeader->FileSize.HighPart && + FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + } + } + + /* Nagar p.544. + * Set ourselves as top component. + */ + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + + _SEH2_TRY + { + BOOLEAN CallCc = TRUE; + + /* Check if there is a gap between the end of the file + * and the offset. If yes, then we have to zero the data. + */ + if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) + { + if (!(Result = CcZeroData(FileObject, + &FcbHeader->ValidDataLength, + &Offset, + Wait))) + { + /* If this operation fails, then we have to exit. We can jump + * outside the SEH, so I a using a variable to exit normally. + */ + CallCc = FALSE; + } + } /* Unless the CcZeroData failed, call the cache manager */ - if (CallCc) { - Result = CcCopyWrite(FileObject,&Offset,Length, Wait, Buffer); - } - }_SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; - } _SEH2_END; + if (CallCc) + { + Result = CcCopyWrite(FileObject, &Offset, Length, Wait, Buffer); + } + } + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : + EXCEPTION_CONTINUE_SEARCH) + { + Result = FALSE; + } + _SEH2_END; /* Reset the top component */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; /* Did the operation suceeded */ - if (Result) { - /* Check if we need to update the filesize */ - if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) { - if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - } else { - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - } - } + if (Result) + { + /* Check if we need to update the filesize */ + if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) + { + if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && + FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + } + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; - /* Check if the filesize has changed */ - if (FileSizeModified) { - /* Update the file sizes */ - ((SHARED_CACHE_MAP*) FileObject->SectionObjectPointer->SharedCacheMap)->FileSize.QuadPart = NewSize.QuadPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } - /* Update the current FO byte offset */ - FileObject->CurrentByteOffset.QuadPart = NewSize.QuadPart; - } - else - { - /* The operation did not succeed - Reset the file size to what it should be - */ - if (FileSizeModified) { - if (FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - }else{ - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - } - } - } - goto Cleanup; - } else { - goto FailAndCleanup; - } - - ASSERT(0); - } + FileObject->Flags |= FO_FILE_MODIFIED; + + /* Check if the filesize has changed */ + if (FileSizeModified) + { + /* Update the file sizes */ + SharedCacheMap = + (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + SharedCacheMap->FileSize.QuadPart = NewSize.QuadPart; + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } + + /* Update the current FO byte offset */ + FileObject->CurrentByteOffset.QuadPart = NewSize.QuadPart; + } + else + { + /* The operation did not succeed. + * Reset the file size to what it should be. + */ + if (FileSizeModified) + { + if (FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + } + } + } + + goto Cleanup; + } + else + { + goto FailAndCleanup; + } + } LeaveCriticalAndFail: + FsRtlExitFileSystem(); return FALSE; - FailAndCleanup: @@ -686,7 +808,7 @@ */ NTSTATUS NTAPI -FsRtlGetFileSize(IN PFILE_OBJECT FileObject, +FsRtlGetFileSize(IN PFILE_OBJECT FileObject, IN OUT PLARGE_INTEGER FileSize) { FILE_STANDARD_INFORMATION Info; @@ -699,30 +821,35 @@ PIRP Irp; BOOLEAN OldHardError; - PAGED_CODE(); /* Get Device Object and Fast Calls */ DeviceObject = IoGetRelatedDeviceObject(FileObject); FastDispatch = DeviceObject->DriverObject->FastIoDispatch; - /* Check if we support Fast Calls, and check FastIoQueryStandardInfo */ - /* Call the function and see if it succeeds */ - if ( !FastDispatch || - !FastDispatch->FastIoQueryStandardInfo || - !FastDispatch->FastIoQueryStandardInfo(FileObject,TRUE, - &Info,&IoStatus,DeviceObject)) - { - /* If any of the above failed, then we are going to send an IRP to the device object */ - /* Initialize the even for the IO */ - KeInitializeEvent(&Event,NotificationEvent,FALSE); + /* Check if we support Fast Calls, and check FastIoQueryStandardInfo. + * Call the function and see if it succeeds. + */ + if (!FastDispatch || + !FastDispatch->FastIoQueryStandardInfo || + !FastDispatch->FastIoQueryStandardInfo(FileObject, + TRUE, + &Info, + &IoStatus, + DeviceObject)) + { + /* If any of the above failed, then we are going to send an + * IRP to the device object. Initialize the event for the IO. + */ + KeInitializeEvent(&Event, NotificationEvent, FALSE); + /* Allocate the IRP */ - Irp = IoAllocateIrp(DeviceObject->StackSize,FALSE); + Irp = IoAllocateIrp(DeviceObject->StackSize, FALSE); + if (Irp == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } - /* Don't process hard error */ OldHardError = IoSetThreadHardErrorMode(FALSE); @@ -742,16 +869,18 @@ IoStackLocation->MajorFunction = IRP_MJ_QUERY_INFORMATION; IoStackLocation->FileObject = FileObject; IoStackLocation->DeviceObject = DeviceObject; - IoStackLocation->Parameters.QueryFile.Length = ALIGN_UP(sizeof(FILE_INFORMATION_CLASS),ULONG); - IoStackLocation->Parameters.QueryFile.FileInformationClass = FileStandardInformation; + IoStackLocation->Parameters.QueryFile.Length = + ALIGN_UP(sizeof(FILE_INFORMATION_CLASS), ULONG); + IoStackLocation->Parameters.QueryFile.FileInformationClass = + FileStandardInformation; /* Send the IRP to the related device object */ - Status = IoCallDriver(DeviceObject,Irp); + Status = IoCallDriver(DeviceObject, Irp); /* Standard DDK IRP result processing */ if (Status == STATUS_PENDING) { - KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); + KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); } /* If there was a synchronous error, signal it */ @@ -766,7 +895,7 @@ /* Check the sync/async IO result */ if (NT_SUCCESS(IoStatus.Status)) { - /* Was the request for a directory ? */ + /* Was the request for a directory? */ if (Info.Directory) { IoStatus.Status = STATUS_FILE_IS_A_DIRECTORY; @@ -779,7 +908,6 @@ return IoStatus.Status; } - /* * @implemented @@ -818,8 +946,7 @@ FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch; /* If the Base Device Object has its own FastDispatch Routine, fail */ - if (FastDispatch && FastDispatch->MdlRead && - BaseDeviceObject != DeviceObject) + if (FastDispatch && FastDispatch->MdlRead && BaseDeviceObject != DeviceObject) { return FALSE; } @@ -853,9 +980,7 @@ if (FastDispatch && FastDispatch->MdlReadComplete) { /* Use the fast path */ - return FastDispatch->MdlReadComplete(FileObject, - MdlChain, - DeviceObject); + return FastDispatch->MdlReadComplete(FileObject, MdlChain, DeviceObject); } /* Get the Base File System (Volume) and Fast Calls */ @@ -863,8 +988,9 @@ FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch; /* If the Base Device Object has its own FastDispatch Routine, fail */ - if ((BaseDeviceObject != DeviceObject) && FastDispatch - && FastDispatch->MdlReadComplete) + if ((BaseDeviceObject != DeviceObject) && + FastDispatch && + FastDispatch->MdlReadComplete) { return FALSE; } @@ -876,8 +1002,8 @@ /* * @implemented */ - BOOLEAN - NTAPI +BOOLEAN +NTAPI FsRtlMdlReadCompleteDev(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList, IN PDEVICE_OBJECT DeviceObject) @@ -886,7 +1012,6 @@ CcMdlReadComplete2(MemoryDescriptorList, FileObject); return TRUE; } - /* * @implemented @@ -995,10 +1120,13 @@ CcMdlRead(FileObject, FileOffset, Length, MdlChain, IoStatus); FileObject->Flags |= FO_FILE_FAST_IO_READ; } - _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; - } _SEH2_END; + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : + EXCEPTION_CONTINUE_SEARCH) + { + Result = FALSE; + } + _SEH2_END; /* Remove the top-level IRP flag */ @@ -1006,8 +1134,10 @@ /* Return to caller */ Cleanup: + ExReleaseResourceLite(FcbHeader->Resource); FsRtlExitFileSystem(); + return Result; } @@ -1042,7 +1172,8 @@ FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch; /* If the Base Device Object has its own FastDispatch Routine, fail */ - if (FastDispatch && FastDispatch->MdlWriteComplete && + if (FastDispatch && + FastDispatch->MdlWriteComplete && BaseDeviceObject != DeviceObject) { return FALSE; @@ -1067,12 +1198,11 @@ { if (FileObject->Flags & FO_WRITE_THROUGH) { - return FALSE; - } - + return FALSE; + } /* Call the Cache Manager */ - CcMdlWriteComplete2(FileObject,FileOffset,MdlChain); + CcMdlWriteComplete2(FileObject, FileOffset, MdlChain); return TRUE; } @@ -1113,7 +1243,8 @@ FastDispatch = BaseDeviceObject->DriverObject->FastIoDispatch; /* If the Base Device Object has its own FastDispatch Routine, fail */ - if (FastDispatch && FastDispatch->PrepareMdlWrite && + if (FastDispatch && + FastDispatch->PrepareMdlWrite && BaseDeviceObject != DeviceObject) { return FALSE; @@ -1146,14 +1277,19 @@ PFAST_IO_DISPATCH FastIoDispatch; PDEVICE_OBJECT Device; PFSRTL_COMMON_FCB_HEADER FcbHeader; + PSHARED_CACHE_MAP SharedCacheMap; LARGE_INTEGER OldFileSize; LARGE_INTEGER OldValidDataLength; LARGE_INTEGER NewSize; LARGE_INTEGER Offset; - /* WDK doc. Offset=0xffffffffffffffff indicates append to the end of file */ - BOOLEAN FileOffsetAppend = ((FileOffset->HighPart == (LONG)0xffffffff) && (FileOffset->LowPart == 0xffffffff)); + /* WDK doc. + * Offset == 0xffffffffffffffff indicates append to the end of file. + */ + BOOLEAN FileOffsetAppend = (FileOffset->HighPart == (LONG)0xffffffff) && + (FileOffset->LowPart == 0xffffffff); + BOOLEAN FileSizeModified = FALSE; BOOLEAN ResourceAquiredShared = FALSE; @@ -1165,11 +1301,13 @@ Offset.QuadPart = FileOffset->QuadPart + Length; - /* Nagar p.544 -- Check with Cc if we can write */ - if ( (!CcCanIWrite(FileObject, Length,TRUE,FALSE))|| - (FileObject->Flags & FO_WRITE_THROUGH)) - { - return FALSE; + /* Nagar p.544. + * Check with Cc if we can write. + */ + if (!CcCanIWrite(FileObject, Length, TRUE, FALSE) || + (FileObject->Flags & FO_WRITE_THROUGH)) + { + return FALSE; } IoStatus->Status = STATUS_SUCCESS; @@ -1184,180 +1322,218 @@ FsRtlEnterFileSystem(); /* Check we are going to extend the file */ - if ( (FileOffsetAppend == FALSE) && - ( (FileOffset->QuadPart + Length) <= FcbHeader->ValidDataLength.QuadPart ) - ) - { - /* Acquire the resource shared */ - ExAcquireResourceSharedLite(FcbHeader->Resource,TRUE); - ResourceAquiredShared =TRUE; - } else - { - /* Acquire the resource exclusive */ - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); - } - - /* Check if we are appending */ - if (FileOffsetAppend == TRUE) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } else - { - Offset.QuadPart = FileOffset->QuadPart; - NewSize.QuadPart = FileOffset->QuadPart + Length; - } - - if ( (FileObject->PrivateCacheMap) && - (FcbHeader->IsFastIoPossible) && - (MAXLONGLONG >= (LONGLONG) FileOffset->QuadPart + Length) && - (NewSize.QuadPart <= FcbHeader->AllocationSize.QuadPart) ) + if ((FileOffsetAppend == FALSE) && + (FileOffset->QuadPart + Length <= FcbHeader->ValidDataLength.QuadPart)) + { + /* Acquire the resource shared */ + ExAcquireResourceSharedLite(FcbHeader->Resource, TRUE); + ResourceAquiredShared = TRUE; + } + else + { + /* Acquire the resource exclusive */ + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); + } + + /* Check if we are appending */ + if (FileOffsetAppend == TRUE) + { + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } + else + { + Offset.QuadPart = FileOffset->QuadPart; + NewSize.QuadPart = FileOffset->QuadPart + Length; + } + + if ((FileObject->PrivateCacheMap) && + (FcbHeader->IsFastIoPossible) && + (MAXLONGLONG >= (LONGLONG) FileOffset->QuadPart + Length) && + (NewSize.QuadPart <= FcbHeader->AllocationSize.QuadPart)) { /* Check if we can keep the lock shared */ - if (ResourceAquiredShared && (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) ) { - ExReleaseResourceLite(FcbHeader->Resource); - ExAcquireResourceExclusiveLite(FcbHeader->Resource,TRUE); + if (ResourceAquiredShared && + (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart)) + { + ExReleaseResourceLite(FcbHeader->Resource); + ExAcquireResourceExclusiveLite(FcbHeader->Resource, TRUE); /* Compute the offset and the new filesize */ - if (FileOffsetAppend) { - Offset.QuadPart = FcbHeader->FileSize.QuadPart; - NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; - } - - /* Recheck the above points since we released and reacquire the lock */ - if ( (FileObject->PrivateCacheMap != NULL) && - (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && - (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart) - ) - { - /* Do nothing */ - } else { - goto FailAndCleanup; - } - } - - /* Check if we need to find out if fast I/O is available */ - if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) - { - /* Sanity check */ - /* ASSERT(!KeIsExecutingDpc()); */ - - /* Get the Fast I/O table */ - Device = IoGetRelatedDeviceObject(FileObject); - FastIoDispatch = Device->DriverObject->FastIoDispatch; - - /* Sanity check */ - ASSERT(FastIoDispatch != NULL); - ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); - - /* Ask the driver if we can do it */ - if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, - FileOffset, - Length, - TRUE, - LockKey, - FALSE, - IoStatus, - Device)) - { - /* It's not, fail */ - goto FailAndCleanup; - } - } - - /* If we are going to modify the filesize, save the old fs in case the operation fails */ - if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) - { - FileSizeModified = TRUE; - OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; - OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; - - /* If the high part of the filesize is going to change, grab the Paging IoResouce */ - if (NewSize.HighPart != FcbHeader->FileSize.HighPart && FcbHeader->PagingIoResource) - { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - } else { - FcbHeader->FileSize.QuadPart = NewSize.QuadPart; - } - } - - - /* Nagar p.544 */ - /* Set ourselves as top component */ - PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; - _SEH2_TRY - { - /* Check if there is a gap between the end of the file and the offset - If yes, then we have to zero the data - */ - if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) { - Result = CcZeroData(FileObject,&FcbHeader->ValidDataLength,&Offset,TRUE); - if (Result) - { - CcPrepareMdlWrite(FileObject,&Offset,Length,MdlChain,IoStatus); - } - } else { - CcPrepareMdlWrite(FileObject,&Offset,Length,MdlChain,IoStatus); - } - - }_SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - Result = FALSE; - } _SEH2_END; + if (FileOffsetAppend) + { + Offset.QuadPart = FcbHeader->FileSize.QuadPart; + NewSize.QuadPart = FcbHeader->FileSize.QuadPart + Length; + } + + /* Recheck the above points since we released and reacquire the lock */ + if ((FileObject->PrivateCacheMap != NULL) && + (FcbHeader->IsFastIoPossible != FastIoIsNotPossible) && + (FcbHeader->AllocationSize.QuadPart > NewSize.QuadPart)) + { + /* Do nothing */ + } + else + { + goto FailAndCleanup; + } + } + + /* Check if we need to find out if fast I/O is available */ + if (FcbHeader->IsFastIoPossible == FastIoIsQuestionable) + { + /* Sanity check */ + /* ASSERT(!KeIsExecutingDpc()); */ + + /* Get the Fast I/O table */ + Device = IoGetRelatedDeviceObject(FileObject); + FastIoDispatch = Device->DriverObject->FastIoDispatch; + + /* Sanity check */ + ASSERT(FastIoDispatch != NULL); + ASSERT(FastIoDispatch->FastIoCheckIfPossible != NULL); + + /* Ask the driver if we can do it */ + if (!FastIoDispatch->FastIoCheckIfPossible(FileObject, + FileOffset, + Length, + TRUE, + LockKey, + FALSE, + IoStatus, + Device)) + { + /* It's not, fail */ + goto FailAndCleanup; + } + } + + /* If we are going to modify the filesize, + * save the old fs in case the operation fails. + */ + if (NewSize.QuadPart > FcbHeader->FileSize.QuadPart) + { + FileSizeModified = TRUE; + OldFileSize.QuadPart = FcbHeader->FileSize.QuadPart; + OldValidDataLength.QuadPart = FcbHeader->ValidDataLength.QuadPart; + + /* If the high part of the filesize is going + * to change, grab the Paging IoResouce. + */ + if (NewSize.HighPart != FcbHeader->FileSize.HighPart && + FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->FileSize.QuadPart = NewSize.QuadPart; + } + } + + + /* Nagar p.544. + * Set ourselves as top component. + */ + PsGetCurrentThread()->TopLevelIrp = FSRTL_FAST_IO_TOP_LEVEL_IRP; + _SEH2_TRY + { + /* Check if there is a gap between the end of the file and the offset. + * If yes, then we have to zero the data. + */ + if (Offset.QuadPart > FcbHeader->ValidDataLength.QuadPart) + { + Result = CcZeroData(FileObject, + &FcbHeader->ValidDataLength, + &Offset, + TRUE); + if (Result) + { + CcPrepareMdlWrite(FileObject, + &Offset, + Length, + MdlChain, + IoStatus); + } + } + else + { + CcPrepareMdlWrite(FileObject, &Offset, Length, MdlChain, IoStatus); + } + + } + _SEH2_EXCEPT(FsRtlIsNtstatusExpected(_SEH2_GetExceptionCode()) ? + EXCEPTION_EXECUTE_HANDLER : + EXCEPTION_CONTINUE_SEARCH) + { + Result = FALSE; + } + _SEH2_END; /* Reset the top component */ - PsGetCurrentThread()->TopLevelIrp = 0; + PsGetCurrentThread()->TopLevelIrp = 0; /* Did the operation suceeded */ - if (Result) { - /* Check if we need to update the filesize */ - if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) { - if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - } else { - FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; - } - } + if (Result) + { + /* Check if we need to update the filesize */ + if (NewSize.QuadPart > FcbHeader->ValidDataLength.QuadPart) + { + if (NewSize.HighPart != FcbHeader->ValidDataLength.HighPart && + FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->ValidDataLength.QuadPart = NewSize.QuadPart; + } + } /* Flag the file as modified */ - FileObject->Flags |= FO_FILE_MODIFIED; - /* Check if the filesize has changed */ - if (FileSizeModified) { - /* Update the file sizes */ - ((SHARED_CACHE_MAP*) FileObject->SectionObjectPointer->SharedCacheMap)->FileSize.QuadPart = NewSize.QuadPart; - FileObject->Flags |= FO_FILE_SIZE_CHANGED; - } - - } - else - { - /* The operation did not succeed - Reset the file size to what it should be - */ - if (FileSizeModified) { - if (FcbHeader->PagingIoResource) { - ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - ExReleaseResourceLite(FcbHeader->PagingIoResource); - }else{ - FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; - FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; - } - } - } - - goto Cleanup; - + FileObject->Flags |= FO_FILE_MODIFIED; + + /* Check if the filesize has changed */ + if (FileSizeModified) + { + SharedCacheMap = + (PSHARED_CACHE_MAP)FileObject->SectionObjectPointer->SharedCacheMap; + SharedCacheMap->FileSize.QuadPart = NewSize.QuadPart; + FileObject->Flags |= FO_FILE_SIZE_CHANGED; + } + } + else + { + /* The operation did not succeed. + * Reset the file size to what it should be. + */ + if (FileSizeModified) + { + if (FcbHeader->PagingIoResource) + { + ExAcquireResourceExclusiveLite(FcbHeader->PagingIoResource, TRUE); + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + ExReleaseResourceLite(FcbHeader->PagingIoResource); + } + else + { + FcbHeader->FileSize.QuadPart = OldFileSize.QuadPart; + FcbHeader->ValidDataLength.QuadPart = OldValidDataLength.QuadPart; + } + } + } + + goto Cleanup; } else { goto FailAndCleanup; } - FailAndCleanup: @@ -1370,7 +1546,6 @@ ExReleaseResourceLite(FcbHeader->Resource); FsRtlExitFileSystem(); return Result; - } /* @@ -1380,10 +1555,8 @@ NTAPI FsRtlAcquireFileExclusive(IN PFILE_OBJECT FileObject) { - /* - PAGED_CODE(); - FsRtlAcquireFileExclusiveCommon(FileObject,0,0); - */ + /* PAGED_CODE(); */ + /* FsRtlAcquireFileExclusiveCommon(FileObject, 0, 0); */ KeBugCheck(FILE_SYSTEM); } @@ -1394,7 +1567,6 @@ NTAPI FsRtlReleaseFile(IN PFILE_OBJECT FileObject) { - KeBugCheck(FILE_SYSTEM); } @@ -1423,4 +1595,3 @@ UNIMPLEMENTED; return STATUS_NOT_IMPLEMENTED; } -
15 years, 1 month
1
0
0
0
[cwittich] 44195: sync kernel32 winetest with wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 02:37:38 2009 New Revision: 44195 URL:
http://svn.reactos.org/svn/reactos?rev=44195&view=rev
Log: sync kernel32 winetest with wine 1.1.33 Modified: trunk/rostests/winetests/kernel32/file.c trunk/rostests/winetests/kernel32/format_msg.c trunk/rostests/winetests/kernel32/locale.c trunk/rostests/winetests/kernel32/virtual.c Modified: trunk/rostests/winetests/kernel32/file.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/file.c…
============================================================================== --- trunk/rostests/winetests/kernel32/file.c [iso-8859-1] (original) +++ trunk/rostests/winetests/kernel32/file.c [iso-8859-1] Mon Nov 16 02:37:38 2009 @@ -563,6 +563,7 @@ char source[MAX_PATH], dest[MAX_PATH]; static const char prefix[] = "pfx"; HANDLE hfile; + HANDLE hmapfile; FILETIME ft1, ft2; char buf[10]; DWORD ret; @@ -628,6 +629,34 @@ ok( retok && ret == sizeof(prefix), "ReadFile: error %d\n", GetLastError()); ok(!memcmp(prefix, buf, sizeof(prefix)), "buffer contents mismatch\n"); + + /* check error on copying over a mapped file that was opened with FILE_SHARE_READ */ + hmapfile = CreateFileMapping(hfile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); + ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError()); + + ret = CopyFileA(source, dest, FALSE); + ok(!ret && GetLastError() == ERROR_SHARING_VIOLATION, + "CopyFileA with mapped dest file: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError()); + + CloseHandle(hmapfile); + CloseHandle(hfile); + + hfile = CreateFileA(dest, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + ok(hfile != INVALID_HANDLE_VALUE, "failed to open destination file\n"); + + /* check error on copying over a mapped file that was opened with FILE_SHARE_WRITE */ + hmapfile = CreateFileMapping(hfile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); + ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError()); + + ret = CopyFileA(source, dest, FALSE); + todo_wine { + ok(!ret, "CopyFileA: expected failure\n"); + ok(GetLastError() == ERROR_USER_MAPPED_FILE || + broken(GetLastError() == ERROR_SHARING_VIOLATION), /* Win9x and WinMe */ + "CopyFileA with mapped dest file: expected ERROR_USER_MAPPED_FILE, got %d\n", GetLastError()); + } + + CloseHandle(hmapfile); CloseHandle(hfile); ret = DeleteFileA(source); @@ -1263,7 +1292,10 @@ char tempdir[MAX_PATH]; char source[MAX_PATH], dest[MAX_PATH]; static const char prefix[] = "pfx"; + HANDLE hfile; + HANDLE hmapfile; DWORD ret; + BOOL retok; ret = GetTempPathA(MAX_PATH, tempdir); ok(ret != 0, "GetTempPathA error %d\n", GetLastError()); @@ -1281,6 +1313,50 @@ ret = DeleteFileA(dest); ok(ret, "DeleteFileA: error %d\n", GetLastError()); + + hfile = CreateFileA(source, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); + ok(hfile != INVALID_HANDLE_VALUE, "failed to open source file\n"); + + retok = WriteFile(hfile, prefix, sizeof(prefix), &ret, NULL ); + ok( retok && ret == sizeof(prefix), + "WriteFile error %d\n", GetLastError()); + + hmapfile = CreateFileMapping(hfile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); + ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError()); + + ret = MoveFileA(source, dest); + todo_wine { + ok(!ret, "MoveFileA: expected failure\n"); + ok(GetLastError() == ERROR_SHARING_VIOLATION || + broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */ + "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError()); + } + + CloseHandle(hmapfile); + CloseHandle(hfile); + + /* if MoveFile succeeded, move back to dest */ + if (ret) MoveFile(dest, source); + + hfile = CreateFileA(source, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); + ok(hfile != INVALID_HANDLE_VALUE, "failed to open source file\n"); + + hmapfile = CreateFileMapping(hfile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL); + ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError()); + + ret = MoveFileA(source, dest); + todo_wine { + ok(!ret, "MoveFileA: expected failure\n"); + ok(GetLastError() == ERROR_SHARING_VIOLATION || + broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */ + "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError()); + } + + CloseHandle(hmapfile); + CloseHandle(hfile); + + /* if MoveFile succeeded, move back to dest */ + if (ret) MoveFile(dest, source); ret = MoveFileA(source, dest); ok(ret, "MoveFileA: failed, error %d\n", GetLastError()); Modified: trunk/rostests/winetests/kernel32/format_msg.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/format…
============================================================================== --- trunk/rostests/winetests/kernel32/format_msg.c [iso-8859-1] (original) +++ trunk/rostests/winetests/kernel32/format_msg.c [iso-8859-1] Mon Nov 16 02:37:38 2009 @@ -26,29 +26,29 @@ /* #define ok(cond,failstr) if(!(cond)) {printf("line %d : %s\n",__LINE__,failstr);exit(1);} */ -static DWORD doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, - LPSTR out, DWORD outsize, ... ) +static DWORD __cdecl doit(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, + LPSTR out, DWORD outsize, ... ) { - va_list list; + __ms_va_list list; DWORD r; - va_start(list, outsize); + __ms_va_start(list, outsize); r = FormatMessageA(flags, src, msg_id, lang_id, out, outsize, &list); - va_end(list); + __ms_va_end(list); return r; } -static DWORD doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, - LPWSTR out, DWORD outsize, ... ) +static DWORD __cdecl doitW(DWORD flags, LPCVOID src, DWORD msg_id, DWORD lang_id, + LPWSTR out, DWORD outsize, ... ) { - va_list list; + __ms_va_list list; DWORD r; - va_start(list, outsize); + __ms_va_start(list, outsize); r = FormatMessageW(flags, src, msg_id, lang_id, out, outsize, &list); - va_end(list); + __ms_va_end(list); return r; } @@ -87,6 +87,14 @@ static const WCHAR fmt_hi_crlf[] = {'h','i','\r','\n',0}; static const WCHAR fmt_cr[] = {'\r',0}; static const WCHAR fmt_crcrlf[] = {'\r','\r','\n',0}; + static const WCHAR fmt_13s[] = {'%','1','!','3','s','!',0}; + static const WCHAR fmt_1os[] = {'%','1','!','*','s','!',0}; + static const WCHAR fmt_142u[] = {'%','1','!','4','.','2','u','!',0}; + static const WCHAR fmt_1oou[] = {'%','1','!','*','.','*','u','!',0}; + static const WCHAR fmt_1oou1oou[] = {'%','1','!','*','.','*','u','!',',','%','1','!','*','.','*','u','!',0}; + static const WCHAR fmt_1oou3oou[] = {'%','1','!','*','.','*','u','!',',','%','3','!','*','.','*','u','!',0}; + static const WCHAR fmt_1oou4oou[] = {'%','1','!','*','.','*','u','!',',','%','4','!','*','.','*','u','!',0}; + static const WCHAR s_123d[] = {'1','2','3',0}; static const WCHAR s_14d[] = {' ',' ',' ','1',0}; static const WCHAR s_14x[] = {' ',' ',' ','b',0}; @@ -105,6 +113,16 @@ static const WCHAR s_hi_sp[] = {'h','i',' ',0}; static const WCHAR s_sp[] = {' ',0}; static const WCHAR s_2sp[] = {' ',' ',0}; + static const WCHAR s_spt[] = {' ',' ','t',0}; + static const WCHAR s_sp3t[] = {' ',' ',' ','t',0}; + static const WCHAR s_sp03[] = {' ',' ','0','3',0}; + static const WCHAR s_sp001[] = {' ',' ','0','0','1',0}; + static const WCHAR s_sp001002[] = {' ',' ','0','0','1',',',' ','0','0','0','2',0}; + static const WCHAR s_sp001sp002[] = {' ',' ','0','0','1',',',' ',' ','0','0','0','2',0}; + static const WCHAR s_sp002sp001[] = {' ',' ','0','0','0','2',',',' ',' ','0','0','1',0}; + static const WCHAR s_sp002sp003[] = {' ',' ','0','0','0','2',',',' ','0','0','0','0','3',0}; + static const WCHAR s_sp001004[] = {' ',' ','0','0','1',',','0','0','0','0','0','4',0}; + WCHAR out[0x100] = {0}; DWORD r, error; @@ -296,6 +314,46 @@ ok(!lstrcmpW(s_crlfcrlf, out), "failed out=%s\n", wine_dbgstr_w(out)); ok(r==4,"failed: r=%d\n", r); + /* precision and width */ + + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_13s, + 0, 0, out, sizeof(out)/sizeof(WCHAR), t ); + ok(!lstrcmpW(s_spt, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==3, "failed: r=%d\n",r); + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1os, + 0, 0, out, sizeof(out)/sizeof(WCHAR), 4, t ); + ok(!lstrcmpW( s_sp3t, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==4,"failed: r=%d\n",r); + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_142u, + 0, 0, out, sizeof(out)/sizeof(WCHAR), 3 ); + ok(!lstrcmpW( s_sp03, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==4,"failed: r=%d\n",r); + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1oou, + 0, 0, out, sizeof(out)/sizeof(WCHAR), 5, 3, 1 ); + ok(!lstrcmpW( s_sp001, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==5,"failed: r=%d\n",r); + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1oou1oou, + 0, 0, out, sizeof(out)/sizeof(WCHAR), 5, 3, 1, 4, 2 ); + ok(!lstrcmpW( s_sp001002, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==11,"failed: r=%d\n",r); + r = doitW(FORMAT_MESSAGE_FROM_STRING, fmt_1oou3oou, + 0, 0, out, sizeof(out)/sizeof(WCHAR), 5, 3, 1, 6, 4, 2 ); + ok(!lstrcmpW( s_sp001sp002, out) || broken(!lstrcmpW(s_sp001004, out)), + "failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==12,"failed: r=%d\n",r); + /* args are not counted the same way with an argument array */ + { + ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, fmt_1oou1oou, + 0, 0, out, sizeof(out)/sizeof(WCHAR), (__ms_va_list *)args ); + ok(!lstrcmpW(s_sp002sp003, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==13,"failed: r=%d\n",r); + r = FormatMessageW(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, fmt_1oou4oou, + 0, 0, out, sizeof(out)/sizeof(WCHAR), (__ms_va_list *)args ); + ok(!lstrcmpW(s_sp002sp001, out),"failed out=[%s]\n", wine_dbgstr_w(out)); + ok(r==12,"failed: r=%d\n",r); + } + /* change of pace... test the low byte of dwflags */ /* line feed */ @@ -508,6 +566,52 @@ 0, out, sizeof(out)/sizeof(CHAR)); ok(!strcmp("\r\n\r\n", out),"failed out=[%s]\n",out); ok(r==4,"failed: r=%d\n",r); + + /* precision and width */ + + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!3s!", + 0, 0, out, sizeof(out), "t" ); + ok(!strcmp(" t", out),"failed out=[%s]\n",out); + ok(r==3, "failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*s!", + 0, 0, out, sizeof(out), 4, "t"); + if (!strcmp("*s",out)) win_skip( "width/precision not supported\n" ); + else + { + ok(!strcmp( " t", out),"failed out=[%s]\n",out); + ok(r==4,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!4.2u!", + 0, 0, out, sizeof(out), 3 ); + ok(!strcmp( " 03", out),"failed out=[%s]\n",out); + ok(r==4,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!", + 0, 0, out, sizeof(out), 5, 3, 1 ); + ok(!strcmp( " 001", out),"failed out=[%s]\n",out); + ok(r==5,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!,%1!*.*u!", + 0, 0, out, sizeof(out), 5, 3, 1, 4, 2 ); + ok(!strcmp( " 001, 0002", out),"failed out=[%s]\n",out); + ok(r==11,"failed: r=%d\n",r); + r = doit(FORMAT_MESSAGE_FROM_STRING, "%1!*.*u!,%3!*.*u!", + 0, 0, out, sizeof(out), 5, 3, 1, 6, 4, 2 ); + /* older Win versions marked as broken even though this is arguably the correct behavior */ + /* but the new (brain-damaged) behavior is specified on MSDN */ + ok(!strcmp( " 001, 0002", out) || broken(!strcmp(" 001,000004", out)), + "failed out=[%s]\n",out); + ok(r==12,"failed: r=%d\n",r); + /* args are not counted the same way with an argument array */ + { + ULONG_PTR args[] = { 6, 4, 2, 5, 3, 1 }; + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, + "%1!*.*u!,%1!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); + ok(!strcmp(" 0002, 00003", out),"failed out=[%s]\n",out); + ok(r==13,"failed: r=%d\n",r); + r = FormatMessageA(FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY, + "%1!*.*u!,%4!*.*u!", 0, 0, out, sizeof(out), (__ms_va_list *)args ); + ok(!strcmp(" 0002, 001", out),"failed out=[%s]\n",out); + ok(r==12,"failed: r=%d\n",r); + } + } /* change of pace... test the low byte of dwflags */ @@ -561,9 +665,68 @@ ok(error == ERROR_INVALID_PARAMETER, "last error %u\n", error); } +static void test_message_from_hmodule(void) +{ + DWORD ret, error; + HMODULE h; + CHAR out[0x100] = {0}; + + h = GetModuleHandle("kernel32.dll"); + ok(h != 0, "GetModuleHandle failed\n"); + + /*Test existing messageID; as the message strings from wine's kernel32 differ from windows' kernel32 we don't compare + the strings but only test that FormatMessage doesn't return 0*/ + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 7/*=ERROR_ARENA_TRASHED*/, + MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); + ok(ret != 0, "FormatMessageA returned 0\n"); + + /*Test nonexistent messageID with varying language ID's Note: FormatMessageW behaves the same*/ + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_FOUND, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_LOADED, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_MR_MID_NOT_FOUND || error == ERROR_MUI_FILE_NOT_LOADED, "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_RESOURCE_LANG_NOT_FOUND || + error == ERROR_MR_MID_NOT_FOUND || + error == ERROR_MUI_FILE_NOT_LOADED, + "last error %u\n", error); + + SetLastError(0xdeadbeef); + ret = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE, h, 3044, + MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_UK), out, sizeof(out)/sizeof(CHAR), NULL); + error = GetLastError(); + ok(ret == 0, "FormatMessageA returned %u instead of 0\n", ret); + ok(error == ERROR_RESOURCE_LANG_NOT_FOUND || + error == ERROR_MR_MID_NOT_FOUND || + error == ERROR_MUI_FILE_NOT_FOUND, + "last error %u\n", error); +} + START_TEST(format_msg) { test_message_from_string(); test_message_from_string_wide(); test_message_null_buffer(); + test_message_from_hmodule(); } Modified: trunk/rostests/winetests/kernel32/locale.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/locale…
============================================================================== --- trunk/rostests/winetests/kernel32/locale.c [iso-8859-1] (original) +++ trunk/rostests/winetests/kernel32/locale.c [iso-8859-1] Mon Nov 16 02:37:38 2009 @@ -743,6 +743,18 @@ ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); EXPECT_LENA; EXPECT_EQA; + STRINGSA("235","$235.0"); /* Grouping of a positive number */ + format.Grouping = 3; + ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); + ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); + EXPECT_LENA; EXPECT_EQA; + + STRINGSA("-235","$-235.0"); /* Grouping of a negative number */ + format.NegativeOrder = 2; + ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); + ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); + EXPECT_LENA; EXPECT_EQA; + format.LeadingZero = 1; /* Always provide leading zero */ STRINGSA(".5","$0.5"); ret = GetCurrencyFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); @@ -986,6 +998,18 @@ format.Grouping = 2; /* Group by 100's */ STRINGSA("2353","23,53.0"); + ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); + ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); + EXPECT_LENA; EXPECT_EQA; + + STRINGSA("235","235.0"); /* Grouping of a positive number */ + format.Grouping = 3; + ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); + ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); + EXPECT_LENA; EXPECT_EQA; + + STRINGSA("-235","-235.0"); /* Grouping of a negative number */ + format.NegativeOrder = NEG_LEFT; ret = GetNumberFormatA(lcid, 0, input, &format, buffer, COUNTOF(buffer)); ok(ret, "Expected ret != 0, got %d, error %d\n", ret, GetLastError()); EXPECT_LENA; EXPECT_EQA; Modified: trunk/rostests/winetests/kernel32/virtual.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/kernel32/virtua…
============================================================================== --- trunk/rostests/winetests/kernel32/virtual.c [iso-8859-1] (original) +++ trunk/rostests/winetests/kernel32/virtual.c [iso-8859-1] Mon Nov 16 02:37:38 2009 @@ -748,6 +748,24 @@ ret = UnmapViewOfFile(ptr); ok(ret, "UnmapViewOfFile failed with error %d\n", GetLastError()); CloseHandle(mapping); + + addr = VirtualAlloc(NULL, 0x10000, MEM_COMMIT, PAGE_READONLY ); + ok( addr != NULL, "VirtualAlloc failed with error %u\n", GetLastError() ); + + SetLastError(0xdeadbeef); + ok( !UnmapViewOfFile(addr), "UnmapViewOfFile should fail on VirtualAlloc mem\n" ); + ok( GetLastError() == ERROR_INVALID_ADDRESS, + "got %u, expected ERROR_INVALID_ADDRESS\n", GetLastError()); + SetLastError(0xdeadbeef); + ok( !UnmapViewOfFile((char *)addr + 0x3000), "UnmapViewOfFile should fail on VirtualAlloc mem\n" ); + ok( GetLastError() == ERROR_INVALID_ADDRESS, + "got %u, expected ERROR_INVALID_ADDRESS\n", GetLastError()); + SetLastError(0xdeadbeef); + ok( !UnmapViewOfFile((void *)0xdeadbeef), "UnmapViewOfFile should fail on VirtualAlloc mem\n" ); + ok( GetLastError() == ERROR_INVALID_ADDRESS, + "got %u, expected ERROR_INVALID_ADDRESS\n", GetLastError()); + + ok( VirtualFree(addr, 0, MEM_RELEASE), "VirtualFree failed\n" ); } static DWORD (WINAPI *pNtMapViewOfSection)( HANDLE handle, HANDLE process, PVOID *addr_ptr,
15 years, 1 month
1
0
0
0
[cwittich] 44194: partial FormatMessage wine sync
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 02:37:12 2009 New Revision: 44194 URL:
http://svn.reactos.org/svn/reactos?rev=44194&view=rev
Log: partial FormatMessage wine sync Modified: trunk/reactos/dll/win32/kernel32/misc/errormsg.c Modified: trunk/reactos/dll/win32/kernel32/misc/errormsg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/er…
============================================================================== --- trunk/reactos/dll/win32/kernel32/misc/errormsg.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/misc/errormsg.c [iso-8859-1] Mon Nov 16 02:37:12 2009 @@ -76,6 +76,42 @@ */ /********************************************************************** + * load_messageW (internal) + */ +static LPWSTR load_messageW( HMODULE module, UINT id, WORD lang ) +{ + PRTL_MESSAGE_RESOURCE_ENTRY mre; + WCHAR *buffer; + NTSTATUS Status; + + TRACE("module = %p, id = %08x\n", module, id ); + + if (!module) module = GetModuleHandleW( NULL ); + Status = RtlFindMessage( module, (ULONG) RT_MESSAGETABLE, lang, id, &mre ); + if (!NT_SUCCESS(Status)) + { + SetLastError( RtlNtStatusToDosError(Status) ); + return NULL; + } + + if (mre->Flags & MESSAGE_RESOURCE_UNICODE) + { + int len = (strlenW( (const WCHAR *)mre->Text ) + 1) * sizeof(WCHAR); + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL; + memcpy( buffer, mre->Text, len ); + } + else + { + int len = MultiByteToWideChar( CP_ACP, 0, (const char *)mre->Text, -1, NULL, 0 ); + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; + MultiByteToWideChar( CP_ACP, 0, (const char*)mre->Text, -1, buffer, len ); + } + //TRACE("returning %s\n", wine_dbgstr_w(buffer)); + return buffer; +} + + +/********************************************************************** * load_messageA (internal) */ @@ -90,7 +126,10 @@ if (!module) module = GetModuleHandleW( NULL ); Status = RtlFindMessage( module, (ULONG) RT_MESSAGETABLE, lang, id, &mre ); if (!NT_SUCCESS(Status)) + { + SetLastError( RtlNtStatusToDosError(Status) ); return NULL; + } if (mre->Flags & MESSAGE_RESOURCE_UNICODE) { @@ -108,36 +147,6 @@ return buffer; } - - -static LPWSTR load_messageW( HMODULE module, UINT id, WORD lang ) -{ - PRTL_MESSAGE_RESOURCE_ENTRY mre; - WCHAR *buffer; - NTSTATUS Status; - - TRACE("module = %p, id = %08x\n", module, id ); - - if (!module) module = GetModuleHandleW( NULL ); - Status = RtlFindMessage( module, (ULONG) RT_MESSAGETABLE, lang, id, &mre ); - if (!NT_SUCCESS(Status)) - return NULL; - - if (mre->Flags & MESSAGE_RESOURCE_UNICODE) - { - int len = (strlenW( (const WCHAR *)mre->Text ) + 1) * sizeof(WCHAR); - if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len ))) return NULL; - memcpy( buffer, mre->Text, len ); - } - else - { - int len = MultiByteToWideChar( CP_ACP, 0, (const char *)mre->Text, -1, NULL, 0 ); - if (!(buffer = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return NULL; - MultiByteToWideChar( CP_ACP, 0, (const char*)mre->Text, -1, buffer, len ); - } - //TRACE("returning %s\n", wine_dbgstr_w(buffer)); - return buffer; -} /*********************************************************************** * FormatMessageA (KERNEL32.@) @@ -199,7 +208,6 @@ if (!from) { - SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); return 0; } } @@ -457,7 +465,6 @@ if (!from) { - SetLastError (ERROR_RESOURCE_LANG_NOT_FOUND); return 0; } } @@ -641,7 +648,7 @@ if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) { /* nSize is the MINIMUM size */ DWORD len = strlenW(target) + 1; - *((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR)); + *((LPVOID*)lpBuffer) = LocalAlloc(LMEM_ZEROINIT,len*sizeof(WCHAR)); strcpyW(*(LPWSTR*)lpBuffer, target); } else lstrcpynW(lpBuffer, target, nSize);
15 years, 1 month
1
0
0
0
[cwittich] 44193: add MUI error codes from wine
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 02:23:20 2009 New Revision: 44193 URL:
http://svn.reactos.org/svn/reactos?rev=44193&view=rev
Log: add MUI error codes from wine Modified: trunk/reactos/include/psdk/winerror.h Modified: trunk/reactos/include/psdk/winerror.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/winerror.h?re…
============================================================================== --- trunk/reactos/include/psdk/winerror.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/winerror.h [iso-8859-1] Mon Nov 16 02:23:20 2009 @@ -1924,6 +1924,16 @@ #define ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE 14079L #define ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME 14080 +#define ERROR_MUI_FILE_NOT_FOUND 15100 +#define ERROR_MUI_INVALID_FILE 15101 +#define ERROR_MUI_INVALID_RC_CONFIG 15102 +#define ERROR_MUI_INVALID_LOCALE_NAME 15103 +#define ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME 15104 +#define ERROR_MUI_FILE_NOT_LOADED 15105 +#define ERROR_RESOURCE_ENUM_USER_STOP 15106 +#define ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED 15107 +#define ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME 15108 + /* HRESULT values for OLE, SHELL and other Interface stuff */ /* the codes 4000-40ff are reserved for OLE */
15 years, 1 month
1
0
0
0
[cwittich] 44192: sync msi winetest to wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 02:15:54 2009 New Revision: 44192 URL:
http://svn.reactos.org/svn/reactos?rev=44192&view=rev
Log: sync msi winetest to wine 1.1.33 Modified: trunk/rostests/winetests/msi/db.c trunk/rostests/winetests/msi/install.c trunk/rostests/winetests/msi/msi.c trunk/rostests/winetests/msi/source.c Modified: trunk/rostests/winetests/msi/db.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/db.c?rev=44…
============================================================================== --- trunk/rostests/winetests/msi/db.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/db.c [iso-8859-1] Mon Nov 16 02:15:54 2009 @@ -1565,6 +1565,101 @@ DeleteFile( msifile ); } + +static void test_where_not_in_selected(void) +{ + MSIHANDLE hdb = 0, rec, view; + LPCSTR query; + UINT r; + + hdb = create_db(); + ok( hdb, "failed to create db\n"); + + r = run_query(hdb, 0, + "CREATE TABLE `IESTable` (" + "`Action` CHAR(64), " + "`Condition` CHAR(64), " + "`Sequence` LONG PRIMARY KEY `Sequence`)"); + ok( r == S_OK, "Cannot create IESTable table: %d\n", r); + + r = run_query(hdb, 0, + "CREATE TABLE `CATable` (" + "`Action` CHAR(64), " + "`Type` LONG PRIMARY KEY `Type`)"); + ok( r == S_OK, "Cannot create CATable table: %d\n", r); + + r = run_query(hdb, 0, "INSERT INTO `IESTable` " + "( `Action`, `Condition`, `Sequence`) " + "VALUES ( 'clean', 'cond4', 4)"); + ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `IESTable` " + "( `Action`, `Condition`, `Sequence`) " + "VALUES ( 'depends', 'cond1', 1)"); + ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `IESTable` " + "( `Action`, `Condition`, `Sequence`) " + "VALUES ( 'build', 'cond2', 2)"); + ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `IESTable` " + "( `Action`, `Condition`, `Sequence`) " + "VALUES ( 'build2', 'cond6', 6)"); + ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `IESTable` " + "( `Action`, `Condition`, `Sequence`) " + "VALUES ( 'build', 'cond3', 3)"); + ok(r == S_OK, "cannot add entry to IESTable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `CATable` " + "( `Action`, `Type` ) " + "VALUES ( 'build', 32)"); + ok(r == S_OK, "cannot add entry to CATable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `CATable` " + "( `Action`, `Type` ) " + "VALUES ( 'depends', 64)"); + ok(r == S_OK, "cannot add entry to CATable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `CATable` " + "( `Action`, `Type` ) " + "VALUES ( 'clean', 63)"); + ok(r == S_OK, "cannot add entry to CATable table:%d\n", r ); + + r = run_query(hdb, 0, "INSERT INTO `CATable` " + "( `Action`, `Type` ) " + "VALUES ( 'build2', 34)"); + ok(r == S_OK, "cannot add entry to CATable table:%d\n", r ); + query = "Select IESTable.Condition from CATable, IESTable where " + "CATable.Action = IESTable.Action and CATable.Type = 32"; + r = MsiDatabaseOpenView(hdb, query, &view); + ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r ); + + r = MsiViewExecute(view, 0); + ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); + + r = MsiViewFetch(view, &rec); + ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); + + ok( check_record( rec, 1, "cond2"), "wrong condition\n"); + + MsiCloseHandle( rec ); + r = MsiViewFetch(view, &rec); + ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); + + ok( check_record( rec, 1, "cond3"), "wrong condition\n"); + + MsiCloseHandle( rec ); + MsiViewClose(view); + MsiCloseHandle(view); + + MsiCloseHandle( hdb ); + DeleteFile(msifile); + +} + static void test_where(void) { @@ -8450,6 +8545,7 @@ test_longstrings(); test_streamtable(); test_binary(); + test_where_not_in_selected(); test_where(); test_msiimport(); test_binary_import(); Modified: trunk/rostests/winetests/msi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/install.c?r…
============================================================================== --- trunk/rostests/winetests/msi/install.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/install.c [iso-8859-1] Mon Nov 16 02:15:54 2009 @@ -35,6 +35,8 @@ static UINT (WINAPI *pMsiQueryComponentStateA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); +static UINT (WINAPI *pMsiSetExternalUIRecord) + (INSTALLUI_HANDLER_RECORD, DWORD, LPVOID, PINSTALLUI_HANDLER_RECORD); static UINT (WINAPI *pMsiSourceListEnumSourcesA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, DWORD, DWORD, LPSTR, LPDWORD); static UINT (WINAPI *pMsiSourceListGetInfoA) @@ -172,7 +174,13 @@ "Var1\t=-MSITESTVAR1\t1\tOne\n" "Var2\tMSITESTVAR2\t1\tOne\n" "Var3\t=-MSITESTVAR3\t1\tOne\n" - "Var4\tMSITESTVAR4\t1\tOne\n"; + "Var4\tMSITESTVAR4\t1\tOne\n" + "Var5\t-MSITESTVAR5\t\tOne\n" + "Var6\tMSITESTVAR6\t\tOne\n" + "Var7\t!-MSITESTVAR7\t\tOne\n" + "Var8\t!-*MSITESTVAR8\t\tOne\n" + "Var9\t=-MSITESTVAR9\t\tOne\n" + "Var10\t=MSITESTVAR10\t\tOne\n"; static const CHAR condition_dat[] = "Feature_\tLevel\tCondition\n" "s38\ti2\tS255\n" @@ -1684,6 +1692,7 @@ trace("GetProcAddress(%s) failed\n", #func); GET_PROC(hmsi, MsiQueryComponentStateA); + GET_PROC(hmsi, MsiSetExternalUIRecord); GET_PROC(hmsi, MsiSourceListEnumSourcesA); GET_PROC(hmsi, MsiSourceListGetInfoA); @@ -3944,6 +3953,7 @@ DeleteFile(msifile); DeleteFile("msitest\\maximus"); RemoveDirectory("msitest"); + LocalFree(usersid); } static void test_publish_processcomponents(void) @@ -4068,6 +4078,7 @@ DeleteFile(msifile); DeleteFile("msitest\\maximus"); RemoveDirectory("msitest"); + LocalFree(usersid); } static void test_publish(void) @@ -6605,6 +6616,24 @@ res = RegDeleteValueA(env, "MSITESTVAR4"); ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + res = RegDeleteValueA(env, "MSITESTVAR5"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = RegDeleteValueA(env, "MSITESTVAR6"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = RegDeleteValueA(env, "MSITESTVAR7"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = RegDeleteValueA(env, "MSITESTVAR8"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = RegDeleteValueA(env, "MSITESTVAR9"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + + res = RegDeleteValueA(env, "MSITESTVAR10"); + ok(res == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", res); + RegCloseKey(env); delete_pf("msitest\\cabout\\new\\five.txt", TRUE); @@ -6867,6 +6896,84 @@ delete_cab_files(); delete_test_files(); +} + +static INT CALLBACK handler_a(LPVOID context, UINT type, LPCSTR msg) +{ + return IDOK; +} + +static INT CALLBACK handler_w(LPVOID context, UINT type, LPCWSTR msg) +{ + return IDOK; +} + +static INT CALLBACK handler_record(LPVOID context, UINT type, MSIHANDLE record) +{ + return IDOK; +} + +static void test_MsiSetExternalUI(void) +{ + INSTALLUI_HANDLERA ret_a; + INSTALLUI_HANDLERW ret_w; + INSTALLUI_HANDLER_RECORD prev; + UINT error; + + ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL); + ok(ret_a == NULL, "expected NULL, got %p\n", ret_a); + + ret_a = MsiSetExternalUIA(NULL, 0, NULL); + ok(ret_a == handler_a, "expected %p, got %p\n", handler_a, ret_a); + + /* Not present before Installer 3.1 */ + if (!pMsiSetExternalUIRecord) { + win_skip("MsiSetExternalUIRecord is not available\n"); + return; + } + + error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); + ok(prev == NULL, "expected NULL, got %p\n", prev); + + prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; + error = pMsiSetExternalUIRecord(NULL, INSTALLLOGMODE_ERROR, NULL, &prev); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); + ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev); + + ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL); + ok(ret_w == NULL, "expected NULL, got %p\n", ret_w); + + ret_w = MsiSetExternalUIW(NULL, 0, NULL); + ok(ret_w == handler_w, "expected %p, got %p\n", handler_w, ret_w); + + ret_a = MsiSetExternalUIA(handler_a, INSTALLLOGMODE_ERROR, NULL); + ok(ret_a == NULL, "expected NULL, got %p\n", ret_a); + + ret_w = MsiSetExternalUIW(handler_w, INSTALLLOGMODE_ERROR, NULL); + ok(ret_w == NULL, "expected NULL, got %p\n", ret_w); + + prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; + error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, &prev); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); + ok(prev == NULL, "expected NULL, got %p\n", prev); + + ret_a = MsiSetExternalUIA(NULL, 0, NULL); + ok(ret_a == NULL, "expected NULL, got %p\n", ret_a); + + ret_w = MsiSetExternalUIW(NULL, 0, NULL); + ok(ret_w == NULL, "expected NULL, got %p\n", ret_w); + + prev = (INSTALLUI_HANDLER_RECORD)0xdeadbeef; + error = pMsiSetExternalUIRecord(NULL, 0, NULL, &prev); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); + ok(prev == handler_record, "expected %p, got %p\n", handler_record, prev); + + error = pMsiSetExternalUIRecord(handler_record, INSTALLLOGMODE_ERROR, NULL, NULL); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); + + error = pMsiSetExternalUIRecord(NULL, 0, NULL, NULL); + ok(!error, "MsiSetExternalUIRecord failed %u\n", error); } START_TEST(install) @@ -6957,6 +7064,7 @@ test_installed_prop(); test_file_in_use(); test_file_in_use_cab(); + test_MsiSetExternalUI(); DeleteFileA(log_file); Modified: trunk/rostests/winetests/msi/msi.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/msi.c?rev=4…
============================================================================== --- trunk/rostests/winetests/msi/msi.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/msi.c [iso-8859-1] Mon Nov 16 02:15:54 2009 @@ -1201,6 +1201,7 @@ RegCloseKey(compkey2); RegCloseKey(localkey); RegCloseKey(userkey); + LocalFree(usersid); } static void test_MsiQueryComponentState(void) @@ -1520,6 +1521,7 @@ RegDeleteKeyA(compkey, ""); RegCloseKey(prodkey); RegCloseKey(compkey); + LocalFree(usersid); } static void test_MsiGetComponentPath(void) @@ -1872,6 +1874,7 @@ RegCloseKey(prodkey); RegCloseKey(compkey); DeleteFileA("C:\\imapath"); + LocalFree(usersid); } static void test_MsiGetProductCode(void) @@ -2128,6 +2131,7 @@ RegDeleteValueA(compkey, prod2_squashed); RegDeleteKeyA(compkey, ""); RegCloseKey(compkey); + LocalFree(usersid); } static void test_MsiEnumClients(void) @@ -2314,6 +2318,7 @@ RegDeleteValueA(compkey, prod2_squashed); RegDeleteKeyA(compkey, ""); RegCloseKey(compkey); + LocalFree(usersid); } static void get_version_info(LPSTR path, LPSTR *vercheck, LPDWORD verchecksz, @@ -3845,6 +3850,7 @@ RegCloseKey(localkey); RegCloseKey(source); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiGetProductInfoEx(void) @@ -6582,6 +6588,7 @@ RegDeleteValueA(prodkey, "HelpLink"); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } #define INIT_USERINFO() \ @@ -7161,6 +7168,7 @@ RegCloseKey(userprod); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiOpenProduct(void) @@ -7473,6 +7481,7 @@ RegCloseKey(prodkey); DeleteFileA(msifile); + LocalFree(usersid); } static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid) @@ -9201,6 +9210,7 @@ test_MsiEnumPatchesEx_userunmanaged(NULL, usersid); /* FIXME: Successfully test userunmanaged with a different user */ test_MsiEnumPatchesEx_machine(); + LocalFree(usersid); } static void test_MsiEnumPatches(void) @@ -9864,6 +9874,7 @@ RegCloseKey(udprod); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiGetPatchInfoEx(void) @@ -10876,6 +10887,7 @@ RegCloseKey(props); RegDeleteKeyA(udprod, ""); RegCloseKey(udprod); + LocalFree(usersid); } static void test_MsiEnumProducts(void) Modified: trunk/rostests/winetests/msi/source.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msi/source.c?re…
============================================================================== --- trunk/rostests/winetests/msi/source.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msi/source.c [iso-8859-1] Mon Nov 16 02:15:54 2009 @@ -628,6 +628,7 @@ RegDeleteKeyA(userkey, ""); RegCloseKey(hkey); RegCloseKey(userkey); + LocalFree(usersid); } static void test_MsiSourceListAddSourceEx(void) @@ -1605,6 +1606,7 @@ RegCloseKey(source); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiSourceListSetInfo(void) @@ -2015,6 +2017,7 @@ RegCloseKey(source); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiSourceListAddMediaDisk(void) @@ -2312,6 +2315,7 @@ RegCloseKey(source); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiSourceListEnumMediaDisks(void) @@ -3114,6 +3118,7 @@ RegCloseKey(source); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } static void test_MsiSourceListAddSource(void) @@ -3369,6 +3374,7 @@ RegCloseKey(source); RegDeleteKeyA(prodkey, ""); RegCloseKey(prodkey); + LocalFree(usersid); } START_TEST(source)
15 years, 1 month
1
0
0
0
[cwittich] 44191: sync msi to wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 02:13:42 2009 New Revision: 44191 URL:
http://svn.reactos.org/svn/reactos?rev=44191&view=rev
Log: sync msi to wine 1.1.33 Modified: trunk/reactos/dll/win32/msi/action.c trunk/reactos/dll/win32/msi/alter.c trunk/reactos/dll/win32/msi/appsearch.c trunk/reactos/dll/win32/msi/create.c trunk/reactos/dll/win32/msi/delete.c trunk/reactos/dll/win32/msi/dialog.c trunk/reactos/dll/win32/msi/distinct.c trunk/reactos/dll/win32/msi/insert.c trunk/reactos/dll/win32/msi/install.c trunk/reactos/dll/win32/msi/join.c trunk/reactos/dll/win32/msi/media.c trunk/reactos/dll/win32/msi/msi.c trunk/reactos/dll/win32/msi/msi_main.c trunk/reactos/dll/win32/msi/msipriv.h trunk/reactos/dll/win32/msi/msiquery.c trunk/reactos/dll/win32/msi/msiserver.idl trunk/reactos/dll/win32/msi/package.c trunk/reactos/dll/win32/msi/query.h trunk/reactos/dll/win32/msi/select.c trunk/reactos/dll/win32/msi/sql.tab.c trunk/reactos/dll/win32/msi/sql.y trunk/reactos/dll/win32/msi/storages.c trunk/reactos/dll/win32/msi/streams.c trunk/reactos/dll/win32/msi/table.c trunk/reactos/dll/win32/msi/update.c trunk/reactos/dll/win32/msi/where.c Modified: trunk/reactos/dll/win32/msi/action.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/action.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/action.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/action.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -4888,7 +4888,6 @@ static LONG env_set_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) { LPCWSTR cptr = *name; - LPCWSTR ptr = *value; static const WCHAR prefix[] = {'[','~',']',0}; static const int prefix_len = 3; @@ -4919,18 +4918,22 @@ return ERROR_FUNCTION_FAILED; } - if (!strncmpW(ptr, prefix, prefix_len)) - { - *flags |= ENV_MOD_APPEND; - *value += lstrlenW(prefix); - } - else if (lstrlenW(*value) >= prefix_len) - { - ptr += lstrlenW(ptr) - prefix_len; - if (!lstrcmpW(ptr, prefix)) - { - *flags |= ENV_MOD_PREFIX; - /* the "[~]" will be removed by deformat_string */; + if (*value) + { + LPCWSTR ptr = *value; + if (!strncmpW(ptr, prefix, prefix_len)) + { + *flags |= ENV_MOD_APPEND; + *value += lstrlenW(prefix); + } + else if (lstrlenW(*value) >= prefix_len) + { + ptr += lstrlenW(ptr) - prefix_len; + if (!lstrcmpW(ptr, prefix)) + { + *flags |= ENV_MOD_PREFIX; + /* the "[~]" will be removed by deformat_string */; + } } } @@ -4978,8 +4981,7 @@ if (res != ERROR_SUCCESS) goto done; - deformat_string(package, value, &deformatted); - if (!deformatted) + if (value && !deformat_string(package, value, &deformatted)) { res = ERROR_OUTOFMEMORY; goto done; @@ -5066,7 +5068,7 @@ } } } - else + else if (value) { size = (lstrlenW(value) + 1) * sizeof(WCHAR); newval = msi_alloc(size); @@ -5079,8 +5081,13 @@ lstrcpyW(newval, value); } - TRACE("setting %s to %s\n", debugstr_w(name), debugstr_w(newval)); - res = RegSetValueExW(env, name, 0, type, (LPVOID)newval, size); + if (newval) + { + TRACE("setting %s to %s\n", debugstr_w(name), debugstr_w(newval)); + res = RegSetValueExW(env, name, 0, type, (LPVOID)newval, size); + } + else + res = ERROR_SUCCESS; done: if (env) RegCloseKey(env); Modified: trunk/reactos/dll/win32/msi/alter.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/alter.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/msi/alter.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/alter.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -183,11 +183,12 @@ } static UINT ALTER_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSIALTERVIEW *av = (MSIALTERVIEW*)view; - - TRACE("%p %d %p %p %p\n", av, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSIALTERVIEW *av = (MSIALTERVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", av, n, name, type, temporary, table_name ); return ERROR_FUNCTION_FAILED; } Modified: trunk/reactos/dll/win32/msi/appsearch.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/appsearch.c?…
============================================================================== --- trunk/reactos/dll/win32/msi/appsearch.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/appsearch.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -445,7 +445,8 @@ if (sz == 0) goto end; - if ((ptr = strchrW((LPWSTR)value, '"')) && (end = strchrW(++ptr, '"'))) + if ((regType == REG_SZ || regType == REG_EXPAND_SZ) && + (ptr = strchrW((LPWSTR)value, '"')) && (end = strchrW(++ptr, '"'))) *end = '\0'; else ptr = (LPWSTR)value; Modified: trunk/reactos/dll/win32/msi/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/create.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/create.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/create.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -91,11 +91,12 @@ } static UINT CREATE_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSICREATEVIEW *cv = (MSICREATEVIEW*)view; - - TRACE("%p %d %p %p %p\n", cv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSICREATEVIEW *cv = (MSICREATEVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", cv, n, name, type, temporary, table_name ); return ERROR_FUNCTION_FAILED; } Modified: trunk/reactos/dll/win32/msi/delete.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/delete.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/delete.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/delete.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -127,17 +127,18 @@ } static UINT DELETE_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; - - TRACE("%p %d %p %p %p\n", dv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); if( !dv->table ) return ERROR_FUNCTION_FAILED; return dv->table->ops->get_column_info( dv->table, n, name, - type, temporary ); + type, temporary, table_name); } static UINT DELETE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, Modified: trunk/reactos/dll/win32/msi/dialog.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/dialog.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/dialog.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/dialog.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -606,6 +606,8 @@ func = MSI_RecordGetInteger( rec , 1 ); val = MSI_RecordGetInteger( rec , 2 ); + TRACE("progress: func %u, val %u\n", func, val); + switch (func) { case 0: /* init */ @@ -618,10 +620,12 @@ break; case 2: /* move */ ctrl->progress_current += val; - SendMessageW(ctrl->hwnd, PBM_SETPOS, 100*(ctrl->progress_current/ctrl->progress_max), 0); + if (ctrl->progress_current > ctrl->progress_max) + ctrl->progress_current = ctrl->progress_max; + SendMessageW(ctrl->hwnd, PBM_SETPOS, MulDiv(100, ctrl->progress_current, ctrl->progress_max), 0); break; default: - ERR("Unknown progress message %d\n", func); + FIXME("Unknown progress message %u\n", func); break; } } @@ -681,6 +685,10 @@ name = MSI_RecordGetString( rec, 2 ); attributes = MSI_RecordGetInteger( rec, 8 ); text = MSI_RecordGetString( rec, 10 ); + + TRACE("%s, %s, %08x, %s, %08x\n", debugstr_w(szCls), debugstr_w(name), + attributes, debugstr_w(text), style); + if( attributes & msidbControlAttributesVisible ) style |= WS_VISIBLE; if( ~attributes & msidbControlAttributesEnabled ) @@ -1571,8 +1579,14 @@ static UINT msi_dialog_progress_bar( msi_dialog *dialog, MSIRECORD *rec ) { msi_control *control; - - control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, WS_VISIBLE ); + DWORD attributes, style; + + style = WS_VISIBLE; + attributes = MSI_RecordGetInteger( rec, 8 ); + if( !(attributes & msidbControlAttributesProgress95) ) + style |= PBS_SMOOTH; + + control = msi_dialog_add_control( dialog, rec, PROGRESS_CLASSW, style ); if( !control ) return ERROR_FUNCTION_FAILED; @@ -2600,14 +2614,43 @@ } } +static LONGLONG msi_vcl_get_cost( msi_dialog *dialog ) +{ + MSIFEATURE *feature; + INT each_cost; + LONGLONG total_cost = 0; + + LIST_FOR_EACH_ENTRY( feature, &dialog->package->features, MSIFEATURE, entry ) + { + if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, + MSICOSTTREE_SELFONLY, INSTALLSTATE_LOCAL, &each_cost))) + { + /* each_cost is in 512-byte units */ + total_cost += each_cost * 512; + } + if (ERROR_SUCCESS == (MSI_GetFeatureCost(dialog->package, feature, + MSICOSTTREE_SELFONLY, INSTALLSTATE_ABSENT, &each_cost))) + { + /* each_cost is in 512-byte units */ + total_cost -= each_cost * 512; + } + } + return total_cost; +} + static void msi_dialog_vcl_add_drives( msi_dialog *dialog, msi_control *control ) { ULARGE_INTEGER total, free; + LONGLONG difference, cost; WCHAR size_text[MAX_PATH]; + WCHAR cost_text[MAX_PATH]; LPWSTR drives, ptr; LVITEMW lvitem; DWORD size; int i = 0; + + cost = msi_vcl_get_cost(dialog); + StrFormatByteSizeW(cost, cost_text, MAX_PATH); size = GetLogicalDriveStringsW( 0, NULL ); if ( !size ) return; @@ -2628,6 +2671,7 @@ SendMessageW( control->hwnd, LVM_INSERTITEMW, 0, (LPARAM)&lvitem ); GetDiskFreeSpaceExW(ptr, &free, &total, NULL); + difference = free.QuadPart - cost; StrFormatByteSizeW(total.QuadPart, size_text, MAX_PATH); lvitem.iSubItem = 1; @@ -2637,6 +2681,17 @@ StrFormatByteSizeW(free.QuadPart, size_text, MAX_PATH); lvitem.iSubItem = 2; + lvitem.pszText = size_text; + lvitem.cchTextMax = lstrlenW(size_text) + 1; + SendMessageW( control->hwnd, LVM_SETITEMW, 0, (LPARAM)&lvitem ); + + lvitem.iSubItem = 3; + lvitem.pszText = cost_text; + lvitem.cchTextMax = lstrlenW(cost_text) + 1; + SendMessageW( control->hwnd, LVM_SETITEMW, 0, (LPARAM)&lvitem ); + + StrFormatByteSizeW(difference, size_text, MAX_PATH); + lvitem.iSubItem = 4; lvitem.pszText = size_text; lvitem.cchTextMax = lstrlenW(size_text) + 1; SendMessageW( control->hwnd, LVM_SETITEMW, 0, (LPARAM)&lvitem ); Modified: trunk/reactos/dll/win32/msi/distinct.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/distinct.c?r…
============================================================================== --- trunk/reactos/dll/win32/msi/distinct.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/distinct.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -205,17 +205,18 @@ } static UINT DISTINCT_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; - - TRACE("%p %d %p %p %p\n", dv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSIDISTINCTVIEW *dv = (MSIDISTINCTVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", dv, n, name, type, temporary, table_name ); if( !dv->table ) return ERROR_FUNCTION_FAILED; return dv->table->ops->get_column_info( dv->table, n, name, - type, temporary ); + type, temporary, table_name ); } static UINT DISTINCT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, Modified: trunk/reactos/dll/win32/msi/insert.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/insert.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/insert.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/insert.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -114,8 +114,8 @@ for (i = 1; i <= col_count; i++) { - iv->sv->ops->get_column_info(iv->sv, i, &a, NULL, NULL); - iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL); + iv->sv->ops->get_column_info(iv->sv, i, &a, NULL, NULL, NULL); + iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL, NULL); res = lstrcmpW(a, b); msi_free(a); @@ -157,13 +157,14 @@ for (colidx = 1; colidx <= val_count; colidx++) { - r = iv->sv->ops->get_column_info(iv->sv, colidx, &a, NULL, NULL); + r = iv->sv->ops->get_column_info(iv->sv, colidx, &a, NULL, NULL, NULL); if (r != ERROR_SUCCESS) goto err; for (i = 1; i <= col_count; i++) { - r = iv->table->ops->get_column_info(iv->table, i, &b, NULL, NULL); + r = iv->table->ops->get_column_info(iv->table, i, &b, NULL, + NULL, NULL); if (r != ERROR_SUCCESS) goto err; @@ -200,7 +201,8 @@ for (i = 1; i <= col_count; i++) { - r = iv->table->ops->get_column_info(iv->table, i, NULL, &type, NULL); + r = iv->table->ops->get_column_info(iv->table, i, NULL, &type, + NULL, NULL); if (r != ERROR_SUCCESS) return FALSE; @@ -291,18 +293,19 @@ } static UINT INSERT_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) { MSIINSERTVIEW *iv = (MSIINSERTVIEW*)view; MSIVIEW *sv; - TRACE("%p %d %p %p %p\n", iv, n, name, type, temporary ); + TRACE("%p %d %p %p %p %p\n", iv, n, name, type, temporary, table_name ); sv = iv->sv; if( !sv ) return ERROR_FUNCTION_FAILED; - return sv->ops->get_column_info( sv, n, name, type, temporary ); + return sv->ops->get_column_info( sv, n, name, type, temporary, table_name ); } static UINT INSERT_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row) Modified: trunk/reactos/dll/win32/msi/install.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/install.c?re…
============================================================================== --- trunk/reactos/dll/win32/msi/install.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/install.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -934,8 +934,24 @@ UINT WINAPI MsiGetFeatureCostA(MSIHANDLE hInstall, LPCSTR szFeature, MSICOSTTREE iCostTree, INSTALLSTATE iState, LPINT piCost) { - FIXME("(%d %s %i %i %p): stub\n", hInstall, debugstr_a(szFeature), - iCostTree, iState, piCost); + LPWSTR szwFeature = NULL; + UINT rc; + + szwFeature = strdupAtoW(szFeature); + + rc = MsiGetFeatureCostW(hInstall, szwFeature, iCostTree, iState, piCost); + + msi_free(szwFeature); + + return rc; +} + +UINT MSI_GetFeatureCost(MSIPACKAGE *package, MSIFEATURE *feature, + MSICOSTTREE iCostTree, INSTALLSTATE iState, + LPINT piCost) +{ + FIXME("(%s %i %i %p): not implemented yet\n", + debugstr_w(feature->Feature), iCostTree, iState, piCost); if (piCost) *piCost = 0; return ERROR_SUCCESS; } @@ -946,10 +962,57 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature, MSICOSTTREE iCostTree, INSTALLSTATE iState, LPINT piCost) { - FIXME("(%d %s %i %i %p): stub\n", hInstall, debugstr_w(szFeature), + MSIPACKAGE *package; + MSIFEATURE *feature; + UINT ret; + + TRACE("(%d %s %i %i %p)\n", hInstall, debugstr_w(szFeature), iCostTree, iState, piCost); - if (piCost) *piCost = 0; - return ERROR_SUCCESS; + + package = msihandle2msiinfo(hInstall, MSIHANDLETYPE_PACKAGE); + if (!package) + { + HRESULT hr; + BSTR feature; + IWineMsiRemotePackage *remote_package; + + remote_package = (IWineMsiRemotePackage *)msi_get_remote(hInstall); + if (!remote_package) + return ERROR_INVALID_HANDLE; + + feature = SysAllocString(szFeature); + if (!feature) + { + IWineMsiRemotePackage_Release(remote_package); + return ERROR_OUTOFMEMORY; + } + + hr = IWineMsiRemotePackage_GetFeatureCost(remote_package, feature, + iCostTree, iState, piCost); + + SysFreeString(feature); + IWineMsiRemotePackage_Release(remote_package); + + if (FAILED(hr)) + { + if (HRESULT_FACILITY(hr) == FACILITY_WIN32) + return HRESULT_CODE(hr); + + return ERROR_FUNCTION_FAILED; + } + + return ERROR_SUCCESS; + } + + feature = get_loaded_feature(package, szFeature); + + if (feature) + ret = MSI_GetFeatureCost(package, feature, iCostTree, iState, piCost); + else + ret = ERROR_UNKNOWN_FEATURE; + + msiobj_release( &package->hdr ); + return ret; } /*********************************************************************** Modified: trunk/reactos/dll/win32/msi/join.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/join.c?rev=4…
============================================================================== --- trunk/reactos/dll/win32/msi/join.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/join.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -194,13 +194,14 @@ } static UINT JOIN_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name ) { MSIJOINVIEW *jv = (MSIJOINVIEW*)view; JOINTABLE *table; UINT cols = 0; - TRACE("%p %d %p %p %p\n", jv, n, name, type, temporary ); + TRACE("%p %d %p %p %p %p\n", jv, n, name, type, temporary, table_name ); if (n == 0 || n > jv->columns) return ERROR_FUNCTION_FAILED; @@ -209,7 +210,8 @@ { if (n <= cols + table->columns) return table->view->ops->get_column_info(table->view, n - cols, - name, type, temporary); + name, type, temporary, + table_name); cols += table->columns; } Modified: trunk/reactos/dll/win32/msi/media.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/media.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/msi/media.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/media.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -70,7 +70,6 @@ static UINT msi_change_media(MSIPACKAGE *package, MSIMEDIAINFO *mi) { - LPSTR msg; LPWSTR error, error_dialog; LPWSTR source_dir; UINT r = ERROR_SUCCESS; @@ -78,23 +77,33 @@ static const WCHAR error_prop[] = {'E','r','r','o','r','D','i','a','l','o','g',0}; if ((msi_get_property_int(package, szUILevel, 0) & INSTALLUILEVEL_MASK) == - INSTALLUILEVEL_NONE && !gUIHandlerA) + INSTALLUILEVEL_NONE && !gUIHandlerA && !gUIHandlerW && !gUIHandlerRecord) return ERROR_SUCCESS; error = generate_error_string(package, 1302, 1, mi->disk_prompt); error_dialog = msi_dup_property(package, error_prop); source_dir = msi_dup_property(package, cszSourceDir); - while (r == ERROR_SUCCESS && - !source_matches_volume(mi, source_dir)) + while (r == ERROR_SUCCESS && !source_matches_volume(mi, source_dir)) { r = msi_spawn_error_dialog(package, error_dialog, error); - if (gUIHandlerA) - { - msg = strdupWtoA(error); + if (gUIHandlerW) + { + gUIHandlerW(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, error); + } + else if (gUIHandlerA) + { + char *msg = strdupWtoA(error); gUIHandlerA(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, msg); msi_free(msg); + } + else if (gUIHandlerRecord) + { + MSIHANDLE rec = MsiCreateRecord(1); + MsiRecordSetStringW(rec, 0, error); + gUIHandlerRecord(gUIContext, MB_RETRYCANCEL | INSTALLMESSAGE_ERROR, rec); + MsiCloseHandle(rec); } } Modified: trunk/reactos/dll/win32/msi/msi.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi.c?rev=44…
============================================================================== --- trunk/reactos/dll/win32/msi/msi.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msi.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -1902,10 +1902,12 @@ { INSTALLUI_HANDLERA prev = gUIHandlerA; - TRACE("%p %x %p\n",puiHandler, dwMessageFilter,pvContext); + TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext); + gUIHandlerA = puiHandler; - gUIFilter = dwMessageFilter; - gUIContext = pvContext; + gUIHandlerW = NULL; + gUIFilter = dwMessageFilter; + gUIContext = pvContext; return prev; } @@ -1915,10 +1917,12 @@ { INSTALLUI_HANDLERW prev = gUIHandlerW; - TRACE("%p %x %p\n",puiHandler,dwMessageFilter,pvContext); + TRACE("%p %08x %p\n", puiHandler, dwMessageFilter, pvContext); + + gUIHandlerA = NULL; gUIHandlerW = puiHandler; - gUIFilter = dwMessageFilter; - gUIContext = pvContext; + gUIFilter = dwMessageFilter; + gUIContext = pvContext; return prev; } @@ -3591,13 +3595,20 @@ /*********************************************************************** * MsiSetExternalUIRecord [MSI.@] */ -UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD puiHandler, - DWORD dwMessageFilter, LPVOID pvContext, - PINSTALLUI_HANDLER_RECORD ppuiPrevHandler) -{ - FIXME("%p %08x %p %p\n", puiHandler, dwMessageFilter ,pvContext, - ppuiPrevHandler); - return ERROR_CALL_NOT_IMPLEMENTED; +UINT WINAPI MsiSetExternalUIRecord( INSTALLUI_HANDLER_RECORD handler, + DWORD filter, LPVOID context, + PINSTALLUI_HANDLER_RECORD prev ) +{ + TRACE("%p %08x %p %p\n", handler, filter, context, prev); + + if (prev) + *prev = gUIHandlerRecord; + + gUIHandlerRecord = handler; + gUIFilter = filter; + gUIContext = context; + + return ERROR_SUCCESS; } /*********************************************************************** Modified: trunk/reactos/dll/win32/msi/msi_main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msi_main.c?r…
============================================================================== --- trunk/reactos/dll/win32/msi/msi_main.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msi_main.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -37,12 +37,13 @@ static LONG dll_count; /* the UI level */ -INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC; -HWND gUIhwnd = 0; -INSTALLUI_HANDLERA gUIHandlerA = NULL; -INSTALLUI_HANDLERW gUIHandlerW = NULL; -DWORD gUIFilter = 0; -LPVOID gUIContext = NULL; +INSTALLUILEVEL gUILevel = INSTALLUILEVEL_BASIC; +HWND gUIhwnd = 0; +INSTALLUI_HANDLERA gUIHandlerA = NULL; +INSTALLUI_HANDLERW gUIHandlerW = NULL; +INSTALLUI_HANDLER_RECORD gUIHandlerRecord = NULL; +DWORD gUIFilter = 0; +LPVOID gUIContext = NULL; WCHAR gszLogFile[MAX_PATH]; HINSTANCE msi_hInstance; Modified: trunk/reactos/dll/win32/msi/msipriv.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msipriv.h?re…
============================================================================== --- trunk/reactos/dll/win32/msi/msipriv.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msipriv.h [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -228,11 +228,11 @@ /* * get_column_info - returns the name and type of a specific column * - * The name is HeapAlloc'ed by this function and should be freed by - * the caller. + * The name and tablename is HeapAlloc'ed by this function and should be + * freed by the caller. * The column information can be queried at any time. */ - UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPWSTR *name, UINT *type, BOOL *temporary ); + UINT (*get_column_info)( struct tagMSIVIEW *view, UINT n, LPWSTR *name, UINT *type, BOOL *temporary, LPWSTR *tableName); /* * modify - not yet implemented properly @@ -737,7 +737,7 @@ extern UINT MSI_ViewClose( MSIQUERY* ); extern UINT MSI_ViewGetColumnInfo(MSIQUERY *, MSICOLINFO, MSIRECORD **); extern UINT MSI_ViewModify( MSIQUERY *, MSIMODIFY, MSIRECORD * ); -extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, UINT * ); +extern UINT VIEW_find_column( MSIVIEW *, LPCWSTR, LPCWSTR, UINT * ); extern UINT msi_view_get_row(MSIDATABASE *, MSIVIEW *, UINT, MSIRECORD **); /* install internals */ @@ -759,6 +759,7 @@ extern UINT msi_package_add_info(MSIPACKAGE *, DWORD, DWORD, LPCWSTR, LPWSTR); extern UINT msi_package_add_media_disk(MSIPACKAGE *, DWORD, DWORD, DWORD, LPWSTR, LPWSTR); extern UINT msi_clone_properties(MSIPACKAGE *); +extern UINT MSI_GetFeatureCost(MSIPACKAGE *, MSIFEATURE *, MSICOSTTREE, INSTALLSTATE, LPINT); /* for deformating */ extern UINT MSI_FormatRecordW( MSIPACKAGE *, MSIRECORD *, LPWSTR, LPDWORD ); @@ -843,6 +844,7 @@ extern HWND gUIhwnd; extern INSTALLUI_HANDLERA gUIHandlerA; extern INSTALLUI_HANDLERW gUIHandlerW; +extern INSTALLUI_HANDLER_RECORD gUIHandlerRecord; extern DWORD gUIFilter; extern LPVOID gUIContext; extern WCHAR gszLogFile[MAX_PATH]; Modified: trunk/reactos/dll/win32/msi/msiquery.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msiquery.c?r…
============================================================================== --- trunk/reactos/dll/win32/msi/msiquery.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msiquery.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -56,9 +56,10 @@ } } -UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, UINT *n ) +UINT VIEW_find_column( MSIVIEW *table, LPCWSTR name, LPCWSTR table_name, UINT *n ) { LPWSTR col_name; + LPWSTR haystack_table_name; UINT i, count, r; r = table->ops->get_dimensions( table, NULL, &count ); @@ -70,11 +71,15 @@ INT x; col_name = NULL; - r = table->ops->get_column_info( table, i, &col_name, NULL, NULL ); + r = table->ops->get_column_info( table, i, &col_name, NULL, + NULL, &haystack_table_name ); if( r != ERROR_SUCCESS ) return r; x = lstrcmpW( name, col_name ); + if( table_name ) + x |= lstrcmpW( table_name, haystack_table_name ); msi_free( col_name ); + msi_free( haystack_table_name ); if( !x ) { *n = i; @@ -306,7 +311,7 @@ for (i = 1; i <= col_count; i++) { - ret = view->ops->get_column_info(view, i, NULL, &type, NULL); + ret = view->ops->get_column_info(view, i, NULL, &type, NULL, NULL); if (ret) { ERR("Error getting column type for %d\n", i); @@ -553,7 +558,8 @@ for( i=0; i<count; i++ ) { name = NULL; - r = view->ops->get_column_info( view, i+1, &name, &type, &temporary ); + r = view->ops->get_column_info( view, i+1, &name, &type, &temporary, + NULL ); if( r != ERROR_SUCCESS ) continue; if (info == MSICOLINFO_NAMES) Modified: trunk/reactos/dll/win32/msi/msiserver.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/msiserver.id…
============================================================================== --- trunk/reactos/dll/win32/msi/msiserver.idl [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/msiserver.idl [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -72,6 +72,7 @@ HRESULT SetInstallLevel( [in] int level ); HRESULT FormatRecord( [in] MSIHANDLE record, [out] BSTR *value ); HRESULT EvaluateCondition( [in] BSTR condition ); + HRESULT GetFeatureCost( [in] BSTR feature, [in] INT cost_tree, [in] INSTALLSTATE state, [out] INT *cost); } [ Modified: trunk/reactos/dll/win32/msi/package.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/package.c?re…
============================================================================== --- trunk/reactos/dll/win32/msi/package.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/package.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -1203,19 +1203,28 @@ } } - TRACE("(%p %x %x %s)\n", gUIHandlerA, gUIFilter, log_type, - debugstr_w(message)); + TRACE("%p %p %p %x %x %s\n", gUIHandlerA, gUIHandlerW, gUIHandlerRecord, + gUIFilter, log_type, debugstr_w(message)); /* convert it to ASCII */ - len = WideCharToMultiByte( CP_ACP, 0, message, -1, - NULL, 0, NULL, NULL ); + len = WideCharToMultiByte( CP_ACP, 0, message, -1, NULL, 0, NULL, NULL ); msg = msi_alloc( len ); - WideCharToMultiByte( CP_ACP, 0, message, -1, - msg, len, NULL, NULL ); - - if (gUIHandlerA && (gUIFilter & log_type)) - { - rc = gUIHandlerA(gUIContext,eMessageType,msg); + WideCharToMultiByte( CP_ACP, 0, message, -1, msg, len, NULL, NULL ); + + if (gUIHandlerW && (gUIFilter & log_type)) + { + rc = gUIHandlerW( gUIContext, eMessageType, message ); + } + else if (gUIHandlerA && (gUIFilter & log_type)) + { + rc = gUIHandlerA( gUIContext, eMessageType, msg ); + } + else if (gUIHandlerRecord && (gUIFilter & log_type)) + { + MSIHANDLE rec = MsiCreateRecord( 1 ); + MsiRecordSetStringW( rec, 0, message ); + rc = gUIHandlerRecord( gUIContext, eMessageType, rec ); + MsiCloseHandle( rec ); } if ((!rc) && (gszLogFile[0]) && !((eMessageType & 0xff000000) == @@ -1234,8 +1243,7 @@ } } msi_free( msg ); - - msi_free( message); + msi_free( message ); switch (eMessageType & 0xff000000) { @@ -1887,6 +1895,14 @@ { msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface ); UINT r = MsiEvaluateConditionW(This->package, condition); + return HRESULT_FROM_WIN32(r); +} + +static HRESULT WINAPI mrp_GetFeatureCost( IWineMsiRemotePackage *iface, BSTR feature, + INT cost_tree, INSTALLSTATE state, INT *cost ) +{ + msi_remote_package_impl* This = mrp_from_IWineMsiRemotePackage( iface ); + UINT r = MsiGetFeatureCostW(This->package, feature, cost_tree, state, cost); return HRESULT_FROM_WIN32(r); } @@ -1914,6 +1930,7 @@ mrp_SetInstallLevel, mrp_FormatRecord, mrp_EvaluateCondition, + mrp_GetFeatureCost, }; HRESULT create_msi_remote_package( IUnknown *pOuter, LPVOID *ppObj ) Modified: trunk/reactos/dll/win32/msi/query.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/query.h?rev=…
============================================================================== --- trunk/reactos/dll/win32/msi/query.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/query.h [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -68,6 +68,12 @@ struct expr *right; }; +struct ext_column +{ + LPCWSTR column; + LPCWSTR table; +}; + struct expr { int type; @@ -77,7 +83,7 @@ INT ival; UINT uval; LPCWSTR sval; - LPCWSTR column; + struct ext_column column; UINT col_number; } u; }; Modified: trunk/reactos/dll/win32/msi/select.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/select.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/select.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/select.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -209,11 +209,12 @@ } static UINT SELECT_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSISELECTVIEW *sv = (MSISELECTVIEW*)view; - - TRACE("%p %d %p %p %p\n", sv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSISELECTVIEW *sv = (MSISELECTVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", sv, n, name, type, temporary, table_name ); if( !sv->table ) return ERROR_FUNCTION_FAILED; @@ -224,7 +225,7 @@ n = sv->cols[ n - 1 ]; return sv->table->ops->get_column_info( sv->table, n, name, - type, temporary ); + type, temporary, table_name ); } static UINT msi_select_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) @@ -247,7 +248,7 @@ { col = sv->cols[i]; - r = SELECT_get_column_info(view, i + 1, &name, &type, NULL); + r = SELECT_get_column_info(view, i + 1, &name, &type, NULL, NULL); msi_free(name); if (r != ERROR_SUCCESS) { @@ -388,7 +389,7 @@ if( sv->num_cols >= sv->max_cols ) return ERROR_FUNCTION_FAILED; - r = VIEW_find_column( table, name, &n ); + r = VIEW_find_column( table, name, NULL, &n ); if( r != ERROR_SUCCESS ) return r; Modified: trunk/reactos/dll/win32/msi/sql.tab.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/sql.tab.c?re…
============================================================================== --- trunk/reactos/dll/win32/msi/sql.tab.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/sql.tab.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -2778,7 +2778,8 @@ if( e ) { e->type = EXPR_COLUMN; - e->u.sval = column->column; + e->u.column.column = column->column; + e->u.column.table = column->table; } return e; } Modified: trunk/reactos/dll/win32/msi/sql.y URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/sql.y?rev=44…
============================================================================== --- trunk/reactos/dll/win32/msi/sql.y [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/sql.y [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -856,7 +856,8 @@ if( e ) { e->type = EXPR_COLUMN; - e->u.sval = column->column; + e->u.column.column = column->column; + e->u.column.table = column->table; } return e; } Modified: trunk/reactos/dll/win32/msi/storages.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/storages.c?r…
============================================================================== --- trunk/reactos/dll/win32/msi/storages.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/storages.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -289,14 +289,16 @@ } static UINT STORAGES_get_column_info(struct tagMSIVIEW *view, UINT n, - LPWSTR *name, UINT *type, BOOL *temporary) + LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) { LPCWSTR name_ptr = NULL; static const WCHAR Name[] = {'N','a','m','e',0}; static const WCHAR Data[] = {'D','a','t','a',0}; - TRACE("(%p, %d, %p, %p, %p)\n", view, n, name, type, temporary); + TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, + table_name); if (n == 0 || n > NUM_STORAGES_COLS) return ERROR_INVALID_PARAMETER; Modified: trunk/reactos/dll/win32/msi/streams.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/streams.c?re…
============================================================================== --- trunk/reactos/dll/win32/msi/streams.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/streams.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -255,14 +255,16 @@ } static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, UINT n, - LPWSTR *name, UINT *type, BOOL *temporary) + LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) { LPCWSTR name_ptr = NULL; static const WCHAR Name[] = {'N','a','m','e',0}; static const WCHAR Data[] = {'D','a','t','a',0}; - TRACE("(%p, %d, %p, %p, %p)\n", view, n, name, type, temporary); + TRACE("(%p, %d, %p, %p, %p, %p)\n", view, n, name, type, temporary, + table_name); if (n == 0 || n > NUM_STREAMS_COLS) return ERROR_INVALID_PARAMETER; Modified: trunk/reactos/dll/win32/msi/table.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/table.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/msi/table.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/table.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -1582,7 +1582,8 @@ } static UINT TABLE_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name ) { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; @@ -1595,6 +1596,13 @@ { *name = strdupW( tv->columns[n-1].colname ); if( !*name ) + return ERROR_FUNCTION_FAILED; + } + + if( table_name ) + { + *table_name = strdupW( tv->columns[n-1].tablename ); + if( !*table_name ) return ERROR_FUNCTION_FAILED; } @@ -2118,6 +2126,7 @@ static UINT order_add_column(struct tagMSIVIEW *view, MSIORDERINFO *order, LPCWSTR name) { UINT n, r, count; + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; r = TABLE_get_dimensions(view, NULL, &count); if (r != ERROR_SUCCESS) @@ -2126,7 +2135,7 @@ if (order->num_cols >= count) return ERROR_FUNCTION_FAILED; - r = VIEW_find_column(view, name, &n); + r = VIEW_find_column(view, name, tv->name, &n); if (r != ERROR_SUCCESS) return r; Modified: trunk/reactos/dll/win32/msi/update.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/update.c?rev…
============================================================================== --- trunk/reactos/dll/win32/msi/update.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/update.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -155,18 +155,19 @@ } static UINT UPDATE_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; - MSIVIEW *wv; - - TRACE("%p %d %p %p %p\n", uv, n, name, type, temporary ); - - wv = uv->wv; - if( !wv ) - return ERROR_FUNCTION_FAILED; - - return wv->ops->get_column_info( wv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR* table_name ) +{ + MSIUPDATEVIEW *uv = (MSIUPDATEVIEW*)view; + MSIVIEW *wv; + + TRACE("%p %d %p %p %p %p\n", uv, n, name, type, temporary, table_name ); + + wv = uv->wv; + if( !wv ) + return ERROR_FUNCTION_FAILED; + + return wv->ops->get_column_info( wv, n, name, type, temporary, table_name ); } static UINT UPDATE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, Modified: trunk/reactos/dll/win32/msi/where.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msi/where.c?rev=…
============================================================================== --- trunk/reactos/dll/win32/msi/where.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msi/where.c [iso-8859-1] Mon Nov 16 02:13:42 2009 @@ -490,17 +490,18 @@ } static UINT WHERE_get_column_info( struct tagMSIVIEW *view, - UINT n, LPWSTR *name, UINT *type, BOOL *temporary ) -{ - MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; - - TRACE("%p %d %p %p %p\n", wv, n, name, type, temporary ); + UINT n, LPWSTR *name, UINT *type, BOOL *temporary, + LPWSTR *table_name) +{ + MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view; + + TRACE("%p %d %p %p %p %p\n", wv, n, name, type, temporary, table_name ); if( !wv->table ) return ERROR_FUNCTION_FAILED; return wv->table->ops->get_column_info( wv->table, n, name, - type, temporary ); + type, temporary, table_name ); } static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, @@ -597,11 +598,13 @@ switch( cond->type ) { case EXPR_COLUMN: - r = VIEW_find_column( table, cond->u.column, &val ); + r = VIEW_find_column( table, cond->u.column.column, + cond->u.column.table, &val ); if( r == ERROR_SUCCESS ) { UINT type = 0; - r = table->ops->get_column_info( table, val, NULL, &type, NULL ); + r = table->ops->get_column_info( table, val, NULL, &type, + NULL, NULL ); if( r == ERROR_SUCCESS ) { if (type&MSITYPE_STRING) @@ -619,7 +622,7 @@ else { *valid = 0; - WARN("Couldn't find column %s\n", debugstr_w( cond->u.column ) ); + WARN("Couldn't find column %s.%s\n", debugstr_w( cond->u.column.table ), debugstr_w( cond->u.column.column ) ); } break; case EXPR_COMPLEX:
15 years, 1 month
1
0
0
0
[dreimer] 44190: Update ScummVM Link to the Version 1.0.0. Congrats to the ScummVM Team reaching Final State after 8 years of work. Best wishes for the future from us.
by dreimer@svn.reactos.org
Author: dreimer Date: Mon Nov 16 01:26:56 2009 New Revision: 44190 URL:
http://svn.reactos.org/svn/reactos?rev=44190&view=rev
Log: Update ScummVM Link to the Version 1.0.0. Congrats to the ScummVM Team reaching Final State after 8 years of work. Best wishes for the future from us. Modified: trunk/reactos/base/applications/rapps/rapps/scummvm.txt Modified: trunk/reactos/base/applications/rapps/rapps/scummvm.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/ra…
============================================================================== --- trunk/reactos/base/applications/rapps/rapps/scummvm.txt [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps/rapps/scummvm.txt [iso-8859-1] Mon Nov 16 01:26:56 2009 @@ -2,13 +2,13 @@ [Section] Name = ScummVM -Version = 0.13.1 +Version = 1.0.0 Licence = GPL Description = Sam and Max, Day of the Tentacle, etc on ReactOS. -Size = 2.9MB +Size = 3.1MB Category = 4 URLSite =
http://scummvm.org/
-URLDownload =
http://ovh.dl.sourceforge.net/sourceforge/scummvm/scummvm-0.13.1-win32.exe
+URLDownload =
http://dfn.dl.sourceforge.net/project/scummvm/scummvm/1.0.0/scummvm-1.0.0-w…
CDPath = none
15 years, 1 month
1
0
0
0
[cwittich] 44189: sync mshtml to wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 00:44:20 2009 New Revision: 44189 URL:
http://svn.reactos.org/svn/reactos?rev=44189&view=rev
Log: sync mshtml to wine 1.1.33 Added: trunk/reactos/dll/win32/mshtml/htmlframebase.c (with props) Modified: trunk/reactos/dll/win32/mshtml/Bg.rc trunk/reactos/dll/win32/mshtml/Da.rc trunk/reactos/dll/win32/mshtml/De.rc trunk/reactos/dll/win32/mshtml/En.rc trunk/reactos/dll/win32/mshtml/Es.rc trunk/reactos/dll/win32/mshtml/Fr.rc trunk/reactos/dll/win32/mshtml/Ja.rc trunk/reactos/dll/win32/mshtml/Ko.rc trunk/reactos/dll/win32/mshtml/Lt.rc trunk/reactos/dll/win32/mshtml/Nl.rc trunk/reactos/dll/win32/mshtml/No.rc trunk/reactos/dll/win32/mshtml/Pl.rc trunk/reactos/dll/win32/mshtml/Pt.rc trunk/reactos/dll/win32/mshtml/Ro.rc trunk/reactos/dll/win32/mshtml/Ru.rc trunk/reactos/dll/win32/mshtml/Si.rc trunk/reactos/dll/win32/mshtml/Sv.rc trunk/reactos/dll/win32/mshtml/Tr.rc trunk/reactos/dll/win32/mshtml/Zh.rc trunk/reactos/dll/win32/mshtml/dispex.c trunk/reactos/dll/win32/mshtml/editor.c trunk/reactos/dll/win32/mshtml/htmlanchor.c trunk/reactos/dll/win32/mshtml/htmlbody.c trunk/reactos/dll/win32/mshtml/htmlcomment.c trunk/reactos/dll/win32/mshtml/htmlcurstyle.c trunk/reactos/dll/win32/mshtml/htmldoc.c trunk/reactos/dll/win32/mshtml/htmldoc3.c trunk/reactos/dll/win32/mshtml/htmldoc5.c trunk/reactos/dll/win32/mshtml/htmlelem.c trunk/reactos/dll/win32/mshtml/htmlelem2.c trunk/reactos/dll/win32/mshtml/htmlelem3.c trunk/reactos/dll/win32/mshtml/htmlelemcol.c trunk/reactos/dll/win32/mshtml/htmlevent.c trunk/reactos/dll/win32/mshtml/htmlevent.h trunk/reactos/dll/win32/mshtml/htmlgeneric.c trunk/reactos/dll/win32/mshtml/htmliframe.c trunk/reactos/dll/win32/mshtml/htmlimg.c trunk/reactos/dll/win32/mshtml/htmlinput.c trunk/reactos/dll/win32/mshtml/htmllocation.c trunk/reactos/dll/win32/mshtml/htmlnode.c trunk/reactos/dll/win32/mshtml/htmloption.c trunk/reactos/dll/win32/mshtml/htmlscript.c trunk/reactos/dll/win32/mshtml/htmlselect.c trunk/reactos/dll/win32/mshtml/htmltable.c trunk/reactos/dll/win32/mshtml/htmltablerow.c trunk/reactos/dll/win32/mshtml/htmltextarea.c trunk/reactos/dll/win32/mshtml/htmltextcont.c trunk/reactos/dll/win32/mshtml/htmlwindow.c trunk/reactos/dll/win32/mshtml/main.c trunk/reactos/dll/win32/mshtml/mshtml.inf trunk/reactos/dll/win32/mshtml/mshtml.rbuild trunk/reactos/dll/win32/mshtml/mshtml_private.h trunk/reactos/dll/win32/mshtml/mutation.c trunk/reactos/dll/win32/mshtml/navigate.c trunk/reactos/dll/win32/mshtml/nsembed.c trunk/reactos/dll/win32/mshtml/nsevents.c trunk/reactos/dll/win32/mshtml/nsiface.idl trunk/reactos/dll/win32/mshtml/nsio.c trunk/reactos/dll/win32/mshtml/olecmd.c trunk/reactos/dll/win32/mshtml/persist.c trunk/reactos/dll/win32/mshtml/script.c trunk/reactos/dll/win32/mshtml/secmgr.c trunk/reactos/dll/win32/mshtml/selection.c trunk/reactos/dll/win32/mshtml/task.c trunk/reactos/dll/win32/mshtml/txtrange.c trunk/reactos/include/psdk/mshtmdid.h trunk/reactos/include/psdk/mshtml.idl [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/reactos/dll/win32/mshtml/Bg.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Bg.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Da.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Da.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/De.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/De.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/En.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/En.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Es.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Es.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Fr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Fr.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Ja.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Ja.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Ko.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Ko.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Lt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Lt.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Nl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Nl.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/No.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/No.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Pl.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Pl.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Pt.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Pt.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Ro.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Ro.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Ru.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Ru.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Si.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Si.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Sv.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Sv.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Tr.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Tr.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/Zh.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/Zh.rc?rev…
Modified: trunk/reactos/dll/win32/mshtml/dispex.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/dispex.c?…
Modified: trunk/reactos/dll/win32/mshtml/editor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/editor.c?…
Modified: trunk/reactos/dll/win32/mshtml/htmlanchor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlancho…
Modified: trunk/reactos/dll/win32/mshtml/htmlbody.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlbody.…
Modified: trunk/reactos/dll/win32/mshtml/htmlcomment.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlcomme…
Modified: trunk/reactos/dll/win32/mshtml/htmlcurstyle.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlcurst…
Modified: trunk/reactos/dll/win32/mshtml/htmldoc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmldoc.c…
Modified: trunk/reactos/dll/win32/mshtml/htmldoc3.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmldoc3.…
Modified: trunk/reactos/dll/win32/mshtml/htmldoc5.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmldoc5.…
Modified: trunk/reactos/dll/win32/mshtml/htmlelem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlelem.…
Modified: trunk/reactos/dll/win32/mshtml/htmlelem2.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlelem2…
Modified: trunk/reactos/dll/win32/mshtml/htmlelem3.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlelem3…
Modified: trunk/reactos/dll/win32/mshtml/htmlelemcol.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlelemc…
Modified: trunk/reactos/dll/win32/mshtml/htmlevent.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlevent…
Modified: trunk/reactos/dll/win32/mshtml/htmlevent.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlevent…
Added: trunk/reactos/dll/win32/mshtml/htmlframebase.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlframe…
Modified: trunk/reactos/dll/win32/mshtml/htmlgeneric.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlgener…
Modified: trunk/reactos/dll/win32/mshtml/htmliframe.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlifram…
Modified: trunk/reactos/dll/win32/mshtml/htmlimg.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlimg.c…
Modified: trunk/reactos/dll/win32/mshtml/htmlinput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlinput…
Modified: trunk/reactos/dll/win32/mshtml/htmllocation.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmllocat…
Modified: trunk/reactos/dll/win32/mshtml/htmlnode.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlnode.…
Modified: trunk/reactos/dll/win32/mshtml/htmloption.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmloptio…
Modified: trunk/reactos/dll/win32/mshtml/htmlscript.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlscrip…
Modified: trunk/reactos/dll/win32/mshtml/htmlselect.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlselec…
Modified: trunk/reactos/dll/win32/mshtml/htmltable.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltable…
Modified: trunk/reactos/dll/win32/mshtml/htmltablerow.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltable…
Modified: trunk/reactos/dll/win32/mshtml/htmltextarea.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltexta…
Modified: trunk/reactos/dll/win32/mshtml/htmltextcont.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmltextc…
Modified: trunk/reactos/dll/win32/mshtml/htmlwindow.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/htmlwindo…
Modified: trunk/reactos/dll/win32/mshtml/main.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/main.c?re…
Modified: trunk/reactos/dll/win32/mshtml/mshtml.inf URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/mshtml.in…
Modified: trunk/reactos/dll/win32/mshtml/mshtml.rbuild URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/mshtml.rb…
Modified: trunk/reactos/dll/win32/mshtml/mshtml_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/mshtml_pr…
Modified: trunk/reactos/dll/win32/mshtml/mutation.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/mutation.…
Modified: trunk/reactos/dll/win32/mshtml/navigate.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/navigate.…
Modified: trunk/reactos/dll/win32/mshtml/nsembed.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/nsembed.c…
Modified: trunk/reactos/dll/win32/mshtml/nsevents.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/nsevents.…
Modified: trunk/reactos/dll/win32/mshtml/nsiface.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/nsiface.i…
Modified: trunk/reactos/dll/win32/mshtml/nsio.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/nsio.c?re…
Modified: trunk/reactos/dll/win32/mshtml/olecmd.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/olecmd.c?…
Modified: trunk/reactos/dll/win32/mshtml/persist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/persist.c…
Modified: trunk/reactos/dll/win32/mshtml/script.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/script.c?…
Modified: trunk/reactos/dll/win32/mshtml/secmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/secmgr.c?…
Modified: trunk/reactos/dll/win32/mshtml/selection.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/selection…
Modified: trunk/reactos/dll/win32/mshtml/task.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/task.c?re…
Modified: trunk/reactos/dll/win32/mshtml/txtrange.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/mshtml/txtrange.…
Modified: trunk/reactos/include/psdk/mshtmdid.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mshtmdid.h?re…
Modified: trunk/reactos/include/psdk/mshtml.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/mshtml.idl?re…
15 years, 1 month
1
0
0
0
[cwittich] 44188: sync rsaenh with wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 00:28:15 2009 New Revision: 44188 URL:
http://svn.reactos.org/svn/reactos?rev=44188&view=rev
Log: sync rsaenh with wine 1.1.33 Modified: trunk/reactos/dll/win32/rsaenh/implglue.c Modified: trunk/reactos/dll/win32/rsaenh/implglue.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/rsaenh/implglue.…
============================================================================== --- trunk/reactos/dll/win32/rsaenh/implglue.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/rsaenh/implglue.c [iso-8859-1] Mon Nov 16 00:28:15 2009 @@ -361,7 +361,10 @@ BOOL export_public_key_impl(BYTE *pbDest, const KEY_CONTEXT *pKeyContext, DWORD dwKeyLen,DWORD *pdwPubExp) { mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); - reverse_bytes(pbDest, dwKeyLen); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.N)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0, + dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N)); *pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e); return TRUE; } @@ -396,25 +399,46 @@ DWORD *pdwPubExp) { mp_to_unsigned_bin(&pKeyContext->rsa.N, pbDest); - reverse_bytes(pbDest, dwKeyLen); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.N)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.N) < dwKeyLen) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.N), 0, + dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.N)); pbDest += dwKeyLen; mp_to_unsigned_bin(&pKeyContext->rsa.p, pbDest); - reverse_bytes(pbDest, (dwKeyLen+1)>>1); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.p)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.p) < (dwKeyLen+1)>>1) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.p), 0, + ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.p)); pbDest += (dwKeyLen+1)>>1; mp_to_unsigned_bin(&pKeyContext->rsa.q, pbDest); - reverse_bytes(pbDest, (dwKeyLen+1)>>1); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.q)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.q) < (dwKeyLen+1)>>1) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.q), 0, + ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.q)); pbDest += (dwKeyLen+1)>>1; mp_to_unsigned_bin(&pKeyContext->rsa.dP, pbDest); - reverse_bytes(pbDest, (dwKeyLen+1)>>1); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dP)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.dP) < (dwKeyLen+1)>>1) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dP), 0, + ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dP)); pbDest += (dwKeyLen+1)>>1; mp_to_unsigned_bin(&pKeyContext->rsa.dQ, pbDest); - reverse_bytes(pbDest, (dwKeyLen+1)>>1); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.dQ)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.dQ) < (dwKeyLen+1)>>1) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.dQ), 0, + ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.dQ)); pbDest += (dwKeyLen+1)>>1; mp_to_unsigned_bin(&pKeyContext->rsa.qP, pbDest); - reverse_bytes(pbDest, (dwKeyLen+1)>>1); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.qP)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.qP) < (dwKeyLen+1)>>1) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.qP), 0, + ((dwKeyLen+1)>>1) - mp_unsigned_bin_size(&pKeyContext->rsa.qP)); pbDest += (dwKeyLen+1)>>1; mp_to_unsigned_bin(&pKeyContext->rsa.d, pbDest); - reverse_bytes(pbDest, dwKeyLen); + reverse_bytes(pbDest, mp_unsigned_bin_size(&pKeyContext->rsa.d)); + if (mp_unsigned_bin_size(&pKeyContext->rsa.d) < dwKeyLen) + memset(pbDest + mp_unsigned_bin_size(&pKeyContext->rsa.d), 0, + dwKeyLen - mp_unsigned_bin_size(&pKeyContext->rsa.d)); *pdwPubExp = (DWORD)mp_get_int(&pKeyContext->rsa.e); return TRUE;
15 years, 1 month
1
0
0
0
[cwittich] 44187: sync rsaenh winetest with wine 1.1.33
by cwittich@svn.reactos.org
Author: cwittich Date: Mon Nov 16 00:25:01 2009 New Revision: 44187 URL:
http://svn.reactos.org/svn/reactos?rev=44187&view=rev
Log: sync rsaenh winetest with wine 1.1.33 Modified: trunk/rostests/winetests/rsaenh/rsaenh.c Modified: trunk/rostests/winetests/rsaenh/rsaenh.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/rsaenh/rsaenh.c…
============================================================================== --- trunk/rostests/winetests/rsaenh/rsaenh.c [iso-8859-1] (original) +++ trunk/rostests/winetests/rsaenh/rsaenh.c [iso-8859-1] Mon Nov 16 00:25:01 2009 @@ -176,7 +176,7 @@ result = CryptAcquireContext(&hProv, szContainer, NULL, PROV_RSA_AES, CRYPT_VERIFYCONTEXT); if (!result && GetLastError() == NTE_PROV_TYPE_NOT_DEF) { - win_skip("RSA_ASE provider not supported\n"); + win_skip("RSA_AES provider not supported\n"); return 0; } ok(!result && GetLastError()==NTE_BAD_FLAGS, "%d, %08x\n", result, GetLastError()); @@ -459,7 +459,7 @@ result = derive_key(CALG_RC2, &hKey, 40); if (!result) return; - memcpy(abData, plain, sizeof(abData)); + memcpy(abData, plain, sizeof(plain)); dwMode = CRYPT_MODE_ECB; result = CryptSetKeyParam(hKey, KP_MODE, (BYTE*)&dwMode, 0); @@ -1632,10 +1632,10 @@ static void test_import_export(void) { DWORD dwLen, dwDataLen, dwVal; - HCRYPTKEY hPublicKey; + HCRYPTKEY hPublicKey, hPrivKey; BOOL result; ALG_ID algID; - BYTE emptyKey[2048]; + BYTE emptyKey[2048], *exported_key; static BYTE abPlainPublicKey[84] = { 0x06, 0x02, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x52, 0x53, 0x41, 0x31, 0x00, 0x02, 0x00, 0x00, @@ -1649,6 +1649,160 @@ 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 }; + static BYTE priv_key_with_high_bit[] = { + 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0xd5, 0xa2, 0x0d, 0x66, + 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58, + 0x04, 0x38, 0x2d, 0xf4, 0xa3, 0x5a, 0xda, 0x9e, + 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03, + 0x77, 0x70, 0x79, 0x6e, 0x6c, 0x26, 0x42, 0xa4, + 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91, + 0x90, 0x39, 0x5e, 0x49, 0x56, 0xfd, 0x0a, 0xe5, + 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1, + 0x1f, 0x22, 0x07, 0x3e, 0x4d, 0xc0, 0x73, 0xfd, + 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8, + 0x19, 0xd1, 0x93, 0x83, 0xe0, 0xb8, 0x9f, 0x53, + 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37, + 0x02, 0xb4, 0xa5, 0xf7, 0xa2, 0x28, 0x6e, 0x26, + 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1, + 0xda, 0x76, 0xd0, 0x12, 0x84, 0xb7, 0x48, 0x7d, + 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e, + 0x7d, 0x32, 0x59, 0x92, 0x01, 0xd6, 0x5b, 0x68, + 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b, + 0x4b, 0x13, 0xe2, 0xbd, 0x7d, 0xbe, 0xce, 0xe8, + 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b, + 0xdf, 0xf6, 0x55, 0x6c, 0x50, 0x11, 0xc8, 0x15, + 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78, + 0x7b, 0x22, 0x8d, 0x96, 0x62, 0xe5, 0xda, 0xa2, + 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2, + 0x48, 0x06, 0x1a, 0xc6, 0xd5, 0x94, 0xec, 0x31, + 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c, + 0x6f, 0xb7, 0x55, 0x3d, 0x6b, 0x98, 0x05, 0xd7, + 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d, + 0x27, 0x18, 0x0d, 0x05, 0xba, 0x23, 0x54, 0x37, + 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a, + 0x6a, 0x2f, 0x7f, 0x68, 0x43, 0x86, 0xe7, 0x9c, + 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99, + 0x51, 0xfe, 0x1e, 0xbd, 0x01, 0xc6, 0x10, 0xef, + 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9, + 0xe5, 0x86, 0xe2, 0x8d, 0x85, 0x2e, 0x0d, 0xec, + 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d, + 0x2b, 0x90, 0x70, 0x7f, 0x78, 0xb1, 0x33, 0x7e, + 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42, + 0x22, 0xd5, 0x5f, 0xbc, 0xbd, 0xab, 0x26, 0x98, + 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12, + 0x9e, 0xa5, 0xa2, 0x90, 0x85, 0xc5, 0xca, 0x73, + 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d, + 0xc1, 0xaa, 0x86, 0x53, 0xd5, 0xde, 0xbb, 0x23, + 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0, + 0xe4, 0xdd, 0xd2, 0x03, 0xfd, 0x67, 0x55, 0x19, + 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0, + 0x80, 0x9d, 0xdd, 0xda, 0x9d, 0x30, 0x5c, 0xc8, + 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa, + 0x14, 0xaf, 0xe4, 0xba, 0xb0, 0x84, 0x45, 0xd8, + 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c, + 0xfa, 0xe9, 0x65, 0xa4, 0x21, 0x2d, 0x6b, 0xa2, + 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12, + 0xc2, 0x02, 0x3d, 0xd5, 0x83, 0x1d, 0xfa, 0x42, + 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d, + 0x91, 0x59, 0xf9, 0x38, 0x52, 0xe5, 0xdb, 0xc1, + 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4, + 0x8d, 0x5e, 0xc4, 0x00, 0x01, 0xb8, 0xec, 0x91, + 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15, + 0xb6, 0x3e, 0xa2, 0xdf, 0x62, 0x8d, 0xa8, 0xbe, + 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7, + 0xda, 0xdc, 0x71, 0x30, 0xf1, 0x21, 0x71, 0xa4, + 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60, + 0x5b, 0x63, 0x35, 0xe3, 0x37, 0x5b, 0x25, 0x17, + 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e, + 0x09, 0xef, 0xda, 0x90, 0x3e, 0xd4, 0x09, 0x33, + 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98, + 0x30, 0x42, 0x03, 0x84, 0x61, 0xeb, 0x8e, 0x50, + 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6, + 0xc2, 0x19, 0xb3, 0x5d, 0xe2, 0xf8, 0xc5, 0x8f, + 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98, + 0x9c, 0x16, 0x8c, 0xc3, 0xcd, 0xd9, 0xdb, 0x08, + 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59, + 0xb6, 0x5f, 0x01, 0x5e + }; + static const BYTE expected_exported_priv_key[] = { + 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, + 0x52, 0x53, 0x41, 0x32, 0x00, 0x04, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0xd5, 0xa2, 0x0d, 0x66, + 0xfe, 0x65, 0xb5, 0xf1, 0xc9, 0x6b, 0xf5, 0x58, + 0x04, 0x38, 0x2d, 0xf4, 0xa3, 0x5a, 0xda, 0x9e, + 0x95, 0x81, 0x85, 0x3d, 0x01, 0x07, 0xb2, 0x03, + 0x77, 0x70, 0x79, 0x6e, 0x6c, 0x26, 0x42, 0xa4, + 0x12, 0xfd, 0xaa, 0x29, 0x83, 0x04, 0xce, 0x91, + 0x90, 0x39, 0x5e, 0x49, 0x56, 0xfd, 0x0a, 0xe5, + 0xb1, 0xea, 0x3b, 0xb2, 0x70, 0xb0, 0x20, 0xc1, + 0x1f, 0x22, 0x07, 0x3e, 0x4d, 0xc0, 0x73, 0xfd, + 0x92, 0x8f, 0x87, 0xd8, 0xd1, 0xd1, 0x28, 0xd8, + 0x19, 0xd1, 0x93, 0x83, 0xe0, 0xb8, 0x9f, 0x53, + 0xf4, 0x6a, 0x7c, 0xcb, 0x10, 0x53, 0xd0, 0x37, + 0x02, 0xb4, 0xa5, 0xf7, 0xa2, 0x28, 0x6e, 0x26, + 0xef, 0x5c, 0x14, 0x01, 0x40, 0x1e, 0xa3, 0xe1, + 0xda, 0x76, 0xd0, 0x12, 0x84, 0xb7, 0x48, 0x7d, + 0xc8, 0x67, 0x5c, 0xb2, 0xd5, 0x2e, 0xaf, 0x8e, + 0x7d, 0x32, 0x59, 0x92, 0x01, 0xd6, 0x5b, 0x68, + 0x28, 0x9b, 0xb1, 0x6c, 0x69, 0xeb, 0x61, 0x5b, + 0x4b, 0x13, 0xe2, 0xbd, 0x7d, 0xbe, 0xce, 0xe8, + 0x41, 0x54, 0xca, 0xa8, 0xdd, 0xc7, 0xfe, 0x8b, + 0xdf, 0xf6, 0x55, 0x6c, 0x50, 0x11, 0xc8, 0x15, + 0x13, 0x42, 0x59, 0x9f, 0xbb, 0xea, 0x73, 0x78, + 0x7b, 0x22, 0x8d, 0x96, 0x62, 0xe5, 0xda, 0xa2, + 0x85, 0x5c, 0x20, 0x74, 0x9f, 0x1c, 0x12, 0xf2, + 0x48, 0x06, 0x1a, 0xc6, 0xd5, 0x94, 0xec, 0x31, + 0x6b, 0xb6, 0x7b, 0x54, 0x61, 0x77, 0xec, 0x7c, + 0x6f, 0xb7, 0x55, 0x3d, 0x6b, 0x98, 0x05, 0xd7, + 0x8a, 0x73, 0x25, 0xf2, 0x8f, 0xe4, 0xb8, 0x8d, + 0x27, 0x18, 0x0d, 0x05, 0xba, 0x23, 0x54, 0x37, + 0x10, 0xf0, 0x1c, 0x41, 0xa6, 0xae, 0x4c, 0x2a, + 0x6a, 0x2f, 0x7f, 0x68, 0x43, 0x86, 0xe7, 0x9c, + 0xfd, 0x9e, 0xf1, 0xfe, 0x84, 0xe3, 0xb6, 0x99, + 0x51, 0xfe, 0x1e, 0xbd, 0x01, 0xc6, 0x10, 0xef, + 0x88, 0xa4, 0xd8, 0x53, 0x14, 0x88, 0x15, 0xc9, + 0xe5, 0x86, 0xe2, 0x8d, 0x85, 0x2e, 0x0d, 0xec, + 0x15, 0xa7, 0x48, 0xfa, 0x18, 0xfb, 0x01, 0x8d, + 0x2b, 0x90, 0x70, 0x7f, 0x78, 0xb1, 0x33, 0x7e, + 0xfe, 0x82, 0x40, 0x5f, 0x4a, 0x97, 0xc2, 0x42, + 0x22, 0xd5, 0x5f, 0xbc, 0xbd, 0xab, 0x26, 0x98, + 0xcd, 0xb5, 0xdf, 0x7e, 0xa0, 0x68, 0xa7, 0x12, + 0x9e, 0xa5, 0xa2, 0x90, 0x85, 0xc5, 0xca, 0x73, + 0x4a, 0x59, 0x8a, 0xec, 0xcf, 0xdd, 0x65, 0x5d, + 0xc1, 0xaa, 0x86, 0x53, 0xd5, 0xde, 0xbb, 0x23, + 0x24, 0xb8, 0x9b, 0x74, 0x03, 0x20, 0xb4, 0xf0, + 0xe4, 0xdd, 0xd2, 0x03, 0xfd, 0x67, 0x55, 0x19, + 0x28, 0x1d, 0xc1, 0xb8, 0xa5, 0x89, 0x0e, 0xc0, + 0x80, 0x9d, 0xdd, 0xda, 0x9d, 0x30, 0x5c, 0xc8, + 0xbb, 0xfe, 0x8f, 0xce, 0xd5, 0xf6, 0xdf, 0xfa, + 0x14, 0xaf, 0xe4, 0xba, 0xb0, 0x84, 0x45, 0xd8, + 0x67, 0xa7, 0xd0, 0xce, 0x89, 0x2a, 0x30, 0x8c, + 0xfa, 0xe9, 0x65, 0xa4, 0x21, 0x2d, 0x6b, 0xa2, + 0x9b, 0x8f, 0x92, 0xbd, 0x3a, 0x10, 0x71, 0x12, + 0xc2, 0x02, 0x3d, 0xd5, 0x83, 0x1d, 0xfa, 0x42, + 0xb7, 0x48, 0x1b, 0x31, 0xe3, 0x82, 0x90, 0x2d, + 0x91, 0x59, 0xf9, 0x38, 0x52, 0xe5, 0xdb, 0xc1, + 0x4d, 0x3a, 0xe6, 0x9b, 0x6a, 0xbb, 0xea, 0xa4, + 0x8d, 0x5e, 0xc4, 0x00, 0x01, 0xb8, 0xec, 0x91, + 0xc1, 0xdb, 0x63, 0xbd, 0x57, 0xb6, 0x26, 0x15, + 0xb6, 0x3e, 0xa2, 0xdf, 0x62, 0x8d, 0xa8, 0xbe, + 0xe1, 0xf1, 0x39, 0xbd, 0x18, 0xd2, 0x6f, 0xd7, + 0xda, 0xdc, 0x71, 0x30, 0xf1, 0x21, 0x71, 0xa4, + 0x08, 0x43, 0x46, 0xdf, 0x50, 0xbd, 0x3c, 0x60, + 0x5b, 0x63, 0x35, 0xe3, 0x37, 0x5b, 0x25, 0x17, + 0x54, 0x5e, 0x68, 0x60, 0xb6, 0x49, 0xef, 0x6e, + 0x09, 0xef, 0xda, 0x90, 0x3e, 0xd4, 0x09, 0x33, + 0x36, 0x57, 0x9a, 0x14, 0xbd, 0xf7, 0xb1, 0x98, + 0x30, 0x42, 0x03, 0x84, 0x61, 0xeb, 0x8e, 0x50, + 0xdc, 0x6a, 0x93, 0x1b, 0x32, 0x51, 0xf9, 0xc6, + 0xc2, 0x19, 0xb3, 0x5d, 0xe2, 0xf8, 0xc5, 0x8f, + 0x68, 0xaa, 0x1d, 0xdb, 0xd3, 0x7f, 0x8d, 0x98, + 0x9c, 0x16, 0x8c, 0xc3, 0xcd, 0xd9, 0xdb, 0x08, + 0xe6, 0x36, 0x60, 0xb6, 0x36, 0xdc, 0x1d, 0x59, + 0xb6, 0x5f, 0x01, 0x5e + }; dwLen=84; result = CryptImportKey(hProv, abPlainPublicKey, dwLen, 0, 0, &hPublicKey); @@ -1674,6 +1828,26 @@ ok(!memcmp(emptyKey, abPlainPublicKey, dwLen), "exported key is different from the imported key\n"); CryptDestroyKey(hPublicKey); + + result = CryptImportKey(hProv, priv_key_with_high_bit, + sizeof(priv_key_with_high_bit), 0, CRYPT_EXPORTABLE, &hPrivKey); + ok(result, "CryptImportKey failed: %08x\n", GetLastError()); + + result = CryptExportKey(hPrivKey, 0, PRIVATEKEYBLOB, 0, NULL, &dwDataLen); + ok(result, "CryptExportKey failed: %08x\n", GetLastError()); + exported_key = HeapAlloc(GetProcessHeap(), 0, dwDataLen); + result = CryptExportKey(hPrivKey, 0, PRIVATEKEYBLOB, 0, exported_key, + &dwDataLen); + ok(result, "CryptExportKey failed: %08x\n", GetLastError()); + + ok(dwDataLen == sizeof(expected_exported_priv_key), "unexpected size %d\n", + dwDataLen); + ok(!memcmp(exported_key, expected_exported_priv_key, dwDataLen), + "unexpected value\n"); + + HeapFree(GetProcessHeap(), 0, exported_key); + + CryptDestroyKey(hPrivKey); } static void test_schannel_provider(void) @@ -1857,6 +2031,68 @@ CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_SCHANNEL, CRYPT_DELETEKEYSET); } +/* Test that a key can be used to encrypt data and exported, and that, when + * the exported key is imported again, can be used to decrypt the original + * data again. + */ +static void test_rsa_round_trip(void) +{ + static const char test_string[] = "Well this is a fine how-do-you-do."; + HCRYPTPROV prov; + HCRYPTKEY signKey, keyExchangeKey; + BOOL result; + BYTE data[256], *exportedKey; + DWORD dataLen, keyLen; + + CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL, + CRYPT_DELETEKEYSET); + + /* Generate a new key... */ + result = CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL, + CRYPT_NEWKEYSET); + ok(result, "CryptAcquireContext failed: %08x\n", GetLastError()); + result = CryptGenKey(prov, CALG_RSA_KEYX, CRYPT_EXPORTABLE, &signKey); + ok(result, "CryptGenKey with CALG_RSA_KEYX failed with error %08x\n", GetLastError()); + result = CryptGetUserKey(prov, AT_KEYEXCHANGE, &keyExchangeKey); + ok(result, "CryptGetUserKey failed: %08x\n", GetLastError()); + /* encrypt some data with it... */ + memcpy(data, test_string, strlen(test_string) + 1); + dataLen = strlen(test_string) + 1; + result = CryptEncrypt(keyExchangeKey, 0, TRUE, 0, data, &dataLen, + sizeof(data)); + ok(result || broken(GetLastError() == NTE_BAD_KEY /* Win9x/2000 */), + "CryptEncrypt failed: %08x\n", GetLastError()); + /* export the key... */ + result = CryptExportKey(keyExchangeKey, 0, PRIVATEKEYBLOB, 0, NULL, + &keyLen); + ok(result, "CryptExportKey failed: %08x\n", GetLastError()); + exportedKey = HeapAlloc(GetProcessHeap(), 0, keyLen); + result = CryptExportKey(keyExchangeKey, 0, PRIVATEKEYBLOB, 0, exportedKey, + &keyLen); + /* destroy the key... */ + CryptDestroyKey(keyExchangeKey); + CryptDestroyKey(signKey); + /* import the key again... */ + result = CryptImportKey(prov, exportedKey, keyLen, 0, 0, &keyExchangeKey); + ok(result, "CryptImportKey failed: %08x\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, exportedKey); + /* and decrypt the data encrypted with the original key with the imported + * key. + */ + result = CryptDecrypt(keyExchangeKey, 0, TRUE, 0, data, &dataLen); + ok(result || broken(GetLastError() == NTE_BAD_KEY /* Win9x/2000 */), + "CryptDecrypt failed: %08x\n", GetLastError()); + if (result) + { + ok(dataLen == sizeof(test_string), "unexpected size %d\n", dataLen); + ok(!memcmp(data, test_string, sizeof(test_string)), "unexpected value"); + } + CryptReleaseContext(prov, 0); + + CryptAcquireContext(&prov, szContainer, NULL, PROV_RSA_FULL, + CRYPT_DELETEKEYSET); +} + static void test_enum_container(void) { BYTE abContainerName[MAX_PATH + 2]; /* Larger than maximum name len */ @@ -2071,7 +2307,7 @@ ok(result, "CryptAcquireContext failed: %08x\n", GetLastError()); if (!result) return; result = CryptImportKey(prov, signBlob, sizeof(signBlob), 0, 0, &key); - ok(result, "CryptGenKey failed: %08x\n", GetLastError()); + ok(result, "CryptImportKey failed: %08x\n", GetLastError()); CryptDestroyKey(key); /* doesn't allow access to the key exchange key.. */ result = CryptGetUserKey(prov, AT_KEYEXCHANGE, &key); @@ -2319,6 +2555,7 @@ test_key_initialization(); test_schannel_provider(); test_null_provider(); + test_rsa_round_trip(); if (!init_aes_environment()) return; test_aes(128);
15 years, 1 month
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
45
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
Results per page:
10
25
50
100
200