Commit 260e11c4416334d538389cb50bcd70fcb8592290
1 parent
dd9931c7
Fixed closing PE file
Showing
1 changed file
with
1 additions
and
0 deletions
winver.py
@@ -26,6 +26,7 @@ def getWindowsVersion(path): | @@ -26,6 +26,7 @@ def getWindowsVersion(path): | ||
26 | version = "" | 26 | version = "" |
27 | pe = pefile.PE(getWindowsDirectory(path) + "/System32/ntdll.dll") | 27 | pe = pefile.PE(getWindowsDirectory(path) + "/System32/ntdll.dll") |
28 | version = str(pe.FileInfo[0].StringTable[0].entries[b'ProductVersion'],'utf-8') | 28 | version = str(pe.FileInfo[0].StringTable[0].entries[b'ProductVersion'],'utf-8') |
29 | + pe.close() | ||
29 | if re.match("(3|4)\.",version) != None: | 30 | if re.match("(3|4)\.",version) != None: |
30 | return _WIN_NT | 31 | return _WIN_NT |
31 | elif re.match("5\.0", version) != None: | 32 | elif re.match("5\.0", version) != None: |