Hi,
here
viewtopic.php?p=552745#p552745was something not working.
I jumped in.
For me it looks like a bug.
Test code:
Code:
#ShowBug = #True
UseZipPacker()
File = OpenPack(#PB_Any, "c:\tmp\test.zip")
If File
If ExaminePack(File)
CompilerIf Defined(ShowBug, #PB_Constant)
While NextPackEntry(File)
Wend
CompilerEndIf
EndIf
ClosePack(File)
EndIf
; this is only to see an action between in procmon
File = CreateFile(#PB_Any, "c:\tmp\test.123")
If File
CloseFile(File)
DeleteFile("c:\tmp\test.123")
EndIf
File = OpenFile(#PB_Any, "c:\tmp\test.zip", #PB_File_Append)
If File
MessageRequester("OK", "Ok")
CloseFile(File)
Else
MessageRequester("Error", "Error")
EndIf
I used SysInternals ProcMon to see the file accesses.
Without #ShowBug
6828 CreateFile C:\tmp\test.zip SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened
6828 QueryInformationVolume C:\tmp\test.zip BUFFER OVERFLOW VolumeCreationTime: 28.09.2018 17:06:27, VolumeSerialNumber: 4ED4-AC1E, SupportsObjects: True, VolumeLabel: Winֹ
6828 QueryAllInformationFile C:\tmp\test.zip BUFFER OVERFLOW CreationTime: 17.04.2020 13:24:26, LastAccessTime: 17.04.2020 13:24:28, LastWriteTime: 17.04.2020 13:24:28, ChangeTime: 17.04.2020 14:01:04, FileAttributes: A, AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x7e00000002a9ba, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word
6828 ReadFile C:\tmp\test.zip SUCCESS Offset: 0, Length: 65.536, Priority: Normal
6828 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
6828 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
6828 ReadFile C:\tmp\test.zip SUCCESS Offset: 1.007.616, Length: 16.384
6828 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
6828 CloseFile C:\tmp\test.zip SUCCESS6828 CreateFile C:\tmp\test.123 SUCCESS Desired Access: Generic Read/Write, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: 0, OpenResult: Created
6828 CloseFile C:\tmp\test.123 SUCCESS
6828 CreateFile C:\tmp\test.123 SUCCESS Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
6828 QueryAttributeTagFile C:\tmp\test.123 SUCCESS Attributes: A, ReparseTag: 0x0
6828 SetDispositionInformationEx C:\tmp\test.123 SUCCESS Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
6828 CloseFile C:\tmp\test.123 SUCCESS
6828 CreateFile C:\tmp\test.zip SUCCESS Desired Access: Generic Read/Write, Disposition: OpenIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: 0, OpenResult: Opened
6828 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
6828 CloseFile C:\tmp\test.zip SUCCESS
With #ShowBug
11452 CreateFile C:\tmp\test.zip SUCCESS Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: n/a, OpenResult: Opened
11452 QueryInformationVolume C:\tmp\test.zip BUFFER OVERFLOW VolumeCreationTime: 28.09.2018 17:06:27, VolumeSerialNumber: 4ED4-AC1E, SupportsObjects: True, VolumeLabel: Winܘ
11452 QueryAllInformationFile C:\tmp\test.zip BUFFER OVERFLOW CreationTime: 17.04.2020 13:24:26, LastAccessTime: 17.04.2020 13:24:28, LastWriteTime: 17.04.2020 13:24:28, ChangeTime: 17.04.2020 14:01:04, FileAttributes: A, AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False, IndexNumber: 0x7e00000002a9ba, EaSize: 0, Access: Generic Read, Position: 0, Mode: Synchronous IO Non-Alert, AlignmentRequirement: Word
11452 ReadFile C:\tmp\test.zip SUCCESS Offset: 0, Length: 65.536, Priority: Normal
11452 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
11452 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
11452 ReadFile C:\tmp\test.zip SUCCESS Offset: 1.007.616, Length: 16.384
11452 QueryStandardInformationFile C:\tmp\test.zip SUCCESS AllocationSize: 1.024.000, EndOfFile: 1.024.000, NumberOfLinks: 1, DeletePending: False, Directory: False
11452 ReadFile C:\tmp\test.zip SUCCESS Offset: 0, Length: 65.536
11452 ReadFile C:\tmp\test.zip END OF FILE Offset: 32.747.815, Length: 65.53611452 CreateFile C:\tmp\test.123 SUCCESS Desired Access: Generic Read/Write, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: 0, OpenResult: Created
11452 CloseFile C:\tmp\test.123 SUCCESS
11452 CreateFile C:\tmp\test.123 SUCCESS Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
11452 QueryAttributeTagFile C:\tmp\test.123 SUCCESS Attributes: A, ReparseTag: 0x0
11452 SetDispositionInformationEx C:\tmp\test.123 SUCCESS Flags: FILE_DISPOSITION_DELETE, FILE_DISPOSITION_POSIX_SEMANTICS, FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK
11452 CloseFile C:\tmp\test.123 SUCCESS
11452 CreateFile C:\tmp\test.zip SHARING VIOLATION Desired Access: Generic Read/Write, Disposition: OpenIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: None, AllocationSize: 0
11452 CloseFile C:\tmp\test.zip SUCCESS
As you can see when the NextPackEntry() loop is in use,
the file test.zip is not closed before an access to test.123
In my opinion it is a bug.
Tested with PB 5.72 x86 on Win10 x64.