Repository: nvaccess/nvda

Issue:
Errors with latest Alpha during import of Screen curtain on Windows 7
### Steps to reproduce:
1. Start Latest Alpha on Windows 7. The same error can be reproduced when focusing vision category of settings.
### Actual behavior:
Error sound is played and The following is logged;
ERROR - vision.visionHandler._getProvidersFromFileSystem (22:09:34.114) - MainThread (1192):
Error while importing vision enhancement provider module screenCurtain
Traceback (most recent call last):
  File "vision\visionHandler.pyc", line 58, in _getProvidersFromFileSystem
  File "vision\visionHandler.pyc", line 36, in _getProviderClass
  File "importlib\__init__.pyc", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "visionEnhancementProviders\screenCurtain.pyc", line 39, in <module>
  File "visionEnhancementProviders\screenCurtain.pyc", line 82, in Magnification
AttributeError: function 'MagShowSystemCursor' not found

### Expected behavior:
No error sound.
### System configuration
#### NVDA installed/portable/running from source:
Portable
#### NVDA version:
Latest Alpha
#### Windows version:
Windows 7 x64
#### Name and version of other software in use when reproducing the issue:
None
#### Other information about your system:

### Other questions
#### Does the issue still occur after restarting your PC?
Yes
#### Have you tried any other versions of NVDA? If so, please report their behaviors.
Alpha from a day ago before integration of Vision GUI. No such problems.


Discussion:
I thought that Windows 7 don't get the screen curtain feature due to OS limitations. Only Windows 8 and later should get it. Please correct me if I'm wrong.

#### Edit: I got it. Quote from the changelog (alpha-19195):
> • Added screen curtain, which when enabled, makes the whole screen black on Windows 8 and later. (#7857)
Yesp, this function is available on win 8 and later

 

From: Daniel Mayr <notifications@github.com> 
Sent: Tuesday, November 19, 2019 3:58 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: Re: [nvaccess/nvda] Errors with latest Alpha during import of Screen curtain on Windows 7 (#10502)

 

I thought that Windows 7 don't get the screen curtain feature due to OS limitations. Only Windows 8.1 and later should get it. Please correct me if I'm wrong.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/nvaccess/nvda/issues/10502?email_source=notifications&email_token=ACVCDE6ILEONT34L7CX3EKDQUNI4JA5CNFSM4JO2HWQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEMVWOY#issuecomment-555309883> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ACVCDEZZXEEQEUHQB2HFFLLQUNI4JANCNFSM4JO2HWQA> .  <https://github.com/notifications/beacon/ACVCDE5L7VKZEMQF4BQVLU3QUNI4JA5CNFSM4JO2HWQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEMVWOY.gif> 



Resolving patch:
diff --git a/source/visionEnhancementProviders/screenCurtain.py b/source/visionEnhancementProviders/screenCurtain.py
--- a/source/visionEnhancementProviders/screenCurtain.py
+++ b/source/visionEnhancementProviders/screenCurtain.py
@@ -63,6 +63,8 @@ class Magnification:
 	MagUninitialize = _MagUninitializeFuncType(("MagUninitialize", _magnification))
 	MagUninitialize.errcheck = _errCheck
 
+	# These magnification functions are not available on versions of Windows prior to Windows 8,
+	# and therefore looking them up from the magnification library will raise an AttributeError.
 	try:
 		MagSetFullscreenColorEffect = _MagSetFullscreenColorEffectFuncType(
 			("MagSetFullscreenColorEffect", _magnification),
@@ -74,14 +76,15 @@ class Magnification:
 			_MagGetFullscreenColorEffectArgTypes
 		)
 		MagGetFullscreenColorEffect.errcheck = _errCheck
+		MagShowSystemCursor = _MagShowSystemCursorFuncType(
+			("MagShowSystemCursor", _magnification),
+			_MagShowSystemCursorArgTypes
+		)
+		MagShowSystemCursor.errcheck = _errCheck
 	except AttributeError:
 		MagSetFullscreenColorEffect = None
 		MagGetFullscreenColorEffect = None
-	MagShowSystemCursor = _MagShowSystemCursorFuncType(
-		("MagShowSystemCursor", _magnification),
-		_MagShowSystemCursorArgTypes
-	)
-	MagShowSystemCursor.errcheck = _errCheck
+		MagShowSystemCursor = None
 
 
 # Translators: Description of a vision enhancement provider that disables output to the screen,


Test patch: