erocarrera / pefile

pefile is a Python module to read and work with PE (Portable Executable) files
MIT License
1.88k stars 521 forks source link

Parser crashes on system's locked files (Windows) #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. pe = PE("C:\\Windows\\System32\\catroot2\\edb.log")

What is the expected output? What do you see instead?

There should be no exceptions, but PEFormatError(), in fact:

Traceback (most recent call last):
  File "C:\Temp\pefile_mockup_3.py", line 15, in <module>
    pe = PE(file_name)
  File "build\bdist.win32\egg\pefile.py", line 1754, in __init__
  File "build\bdist.win32\egg\pefile.py", line 1810, in __parse__
UnboundLocalError: local variable 'fd' referenced before assignment

What version of the product are you using? On what operating system?

pefile-1.2.10-139.zip 

Please provide any additional information below.

File C:\Windows\System32\catroot2\edb.log is locked by this system process - 
svchost.exe running under NT AUTHORITY\NETWORK SERVICE account.

Original issue reported on code.google.com by DMAl...@gmail.com on 19 Aug 2014 at 5:52

GoogleCodeExporter commented 9 years ago

Original comment by ero.carr...@gmail.com on 27 Oct 2014 at 3:38

bernhl commented 7 years ago

Fixed in https://github.com/erocarrera/pefile/commit/ee84316f5f94cd5293bfb3623f15ee858e3f30f0#diff-c948f10453930d93b48fd0edbe7fcc2dR1816