-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DO-NOT-MERGE: Explore reasons for ctypes test failure
- Loading branch information
Showing
1 changed file
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,52 @@ | ||
from test.libregrtest import main | ||
main() | ||
import os | ||
import sys | ||
|
||
try: | ||
import winreg | ||
except ImportError: | ||
sys.exit(0) | ||
|
||
found = False | ||
for d in os.environ['PATH'].split(os.pathsep): | ||
print('Checking', d) | ||
try: | ||
with os.scandir(d) as sd: | ||
for de in sd: | ||
if de.name == '_sqlite3.dll' and de.is_file(): | ||
print('Found _sqlite3.dll at', de.path) | ||
found = True | ||
except OSError as e: | ||
print(e) | ||
|
||
try: | ||
value = winreg.QueryValueEx( | ||
winreg.OpenKeyEx( | ||
winreg.HKEY_LOCAL_MACHINE, | ||
'SYSTEM\\CurrentControlSet\\Control\\Session Manager' | ||
), | ||
'CWDIllegalInDllSearch' | ||
) | ||
except FileNotFoundError: | ||
print('CWDIllegalInDllSearch not set') | ||
else: | ||
print('CWDIllegalInDllSearch set to', value) | ||
found = True | ||
|
||
base_key = winreg.OpenKeyEx( | ||
winreg.HKEY_LOCAL_MACHINE, | ||
'Software\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution Options' | ||
) | ||
for i in range(winreg.QueryInfoKey(base_key)[0]): | ||
sub_key_name = winreg.EnumKey(base_key, i) | ||
print(sub_key_name) | ||
if 'py' not in sub_key_name: | ||
continue | ||
sub_key = winreg.OpenKeyEx(base_key, sub_key_name) | ||
for j in range(winreg.QueryInfoKey(sub_key)[1]): | ||
name, value, type = winreg.EnumValue(sub_key, j) | ||
if 'CWD' in name: | ||
print(name, value, type) | ||
found = True | ||
|
||
if found: | ||
raise FileExistsError('Found it') |