Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for 10.0.18363.836 #37

Closed
stdedos opened this issue Feb 16, 2024 · 7 comments · Fixed by #39
Closed

Support for 10.0.18363.836 #37

stdedos opened this issue Feb 16, 2024 · 7 comments · Fixed by #39

Comments

@stdedos
Copy link
Contributor

stdedos commented Feb 16, 2024

The error encountered is the same as #33.

I am using https://github.com/sdias/win-10-virtual-desktop-enhancer - which already includes a .dll ready-to-go.

However, even the "suggestion for the source" (https://github.com/Ciantic/VirtualDesktopAccessor/; assuming https://github.com/Ciantic/VirtualDesktopAccessor/tree/2019-windows10 given that the rest are win-11 code), looks like it has the exact same GUIDs.

@stdedos
Copy link
Contributor Author

stdedos commented Feb 16, 2024

... except GUID_IVirtualDesktopManagerInternal2 = GUID("{0F3A72B0-4566-487E-9A33-4ED302F6D6CE}").

Ignoring loading get_vd_manager_internal2(), leads to:

$ python -m pytest --cov-report term-missing --cov=pyvda tests/
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
=============================================================================== test session starts ===============================================================================
platform win32 -- Python 3.11.8, pytest-7.4.2, pluggy-1.0.0
rootdir: E:\stdedos\Desktop\pyvda\pyvda
plugins: anyio-4.2.0, dash-2.14.1, hypothesis-6.87.1, jaxtyping-0.2.22, nbval-0.9.6, cov-4.1.0, typeguard-2.13.3
collected 11 items

tests\test_desktop_functions.py ........F..                                                                                                                                  [100%]

==================================================================================== FAILURES =====================================================================================
_______________________________________________________________________________ test_desktop_names ________________________________________________________________________________

    def test_desktop_names():
>       current_name = current_desktop.name

tests\test_desktop_functions.py:97:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyvda\pyvda.py:331: in name
    for vd in array.iter(IVirtualDesktop2):
pyvda\com_defns.py:126: in iter
    yield self.get_at(i, cls)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <POINTER(IObjectArray) ptr=0x1f5441c90f8 at 1f554287750>, i = 0, cls = <class 'pyvda.com_defns.IVirtualDesktop2'>

    def get_at(self, i: int, cls: Any) -> Any:
        item = POINTER(cls)()
>       self.GetAt(i, cls._iid_, item)
E       _ctypes.COMError: (-2147467262, 'Δεν υποστηρίζεται τέτοια διασύνδεση', (None, None, None, 0, None))

pyvda\com_defns.py:121: COMError

---------- coverage: platform win32, python 3.11.8-final-0 -----------
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
pyvda\__init__.py       15      3    80%   44-45, 49
pyvda\_version.py        1      0   100%
pyvda\com_defns.py     143     31    78%   59, 72-77, 198, 200, 202, 204, 212, 220, 245, 247, 249, 251, 259, 285, 306, 328, 349, 377, 383, 385, 391, 393, 399, 401, 407, 409
pyvda\pyvda.py         153     27    82%   46, 194, 253, 257, 272, 316, 328, 332-335, 343-346, 357, 384-390, 398-401, 420-423
pyvda\utils.py          35      3    91%   39, 45, 62
pyvda\winstring.py      46     25    46%   37-47, 67-74, 77-81, 84
--------------------------------------------------
TOTAL                  393     89    77%

============================================================================= short test summary info =============================================================================
FAILED tests/test_desktop_functions.py::test_desktop_names - _ctypes.COMError: (-2147467262, 'Δεν υποστηρίζεται τέτοια διασύνδεση', (None, None, None, 0, None))
========================================================================== 1 failed, 10 passed in 3.39s ===========================================================================

@stdedos
Copy link
Contributor Author

stdedos commented Feb 16, 2024

With a couple of fixes, it leads to:

$ python -m pytest --cov-report term-missing --cov=pyvda tests/
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
=============================================================================== test session starts ===============================================================================
platform win32 -- Python 3.11.8, pytest-7.4.2, pluggy-1.0.0
rootdir: E:\stdedos\Desktop\pyvda\pyvda
plugins: anyio-4.2.0, dash-2.14.1, hypothesis-6.87.1, jaxtyping-0.2.22, nbval-0.9.6, cov-4.1.0, pudb-0.7.0, typeguard-2.13.3
collected 11 items

tests\test_desktop_functions.py ........s..                                                                                                                                  [100%]

---------- coverage: platform win32, python 3.11.8-final-0 -----------
Name                 Stmts   Miss  Cover   Missing
--------------------------------------------------
pyvda\__init__.py       15      3    80%   44-45, 49
pyvda\_version.py        1      0   100%
pyvda\com_defns.py     143     31    78%   59, 72-77, 198, 200, 202, 204, 212, 220, 245, 247, 249, 251, 259, 285, 306, 328, 349, 377, 383, 385, 391, 393, 399, 401, 407, 409
pyvda\pyvda.py         157     34    78%   47, 195, 254, 258, 273, 317, 328-339, 347-352, 363, 390-396, 404-407, 426-429
pyvda\utils.py          35      3    91%   39, 45, 62
pyvda\winstring.py      46     25    46%   37-47, 67-74, 77-81, 84
--------------------------------------------------
TOTAL                  397     96    76%


========================================================================== 10 passed, 1 skipped in 3.34s ==========================================================================

i.e. muting and ignoring not BUILD_OVER_19041 things (name and rename)

@stdedos
Copy link
Contributor Author

stdedos commented Feb 16, 2024

According to Grabacr07/VirtualDesktop#17 (comment)

In Windows 10 20H1 there are two additional COM interfaces present that expand the original ones with functions to support desktop naming:

Interface IVirtualDesktop2 (GUID {31EBDE3F-6EC3-4CBD-B9FB-0EF6D09B41F4}) with a new function you could declare as void GetName([MarshalAs(UnmanagedType.HString)] out string name);

Interface IVirtualDesktopManagerInternal2 (GUID {0F3A72B0-4566-487E-9A33-4ED302F6D6CE}) with a new function you could declare as void SetName(IVirtualDesktop desktop, [MarshalAs(UnmanagedType.HString)] string name);

With those declarations desktop naming can be implemented without the need to recycle explorer (investigated with the great OleViewDotNet).

20H1, so ... 19041 🙃

@mrob95
Copy link
Owner

mrob95 commented Feb 17, 2024

Happy to include this without support for naming desktops if we raise a NotImplementedError or similar 👍

@stdedos
Copy link
Contributor Author

stdedos commented Feb 18, 2024

Happy to include this without support for naming desktops if we raise a NotImplementedError or similar 👍

Can we ... silently ignore it, instead? 😅

I would not be "particularly happy" if I used pyvda as a library, and it "randomly" threw me Exceptions 😕
Of course I am not "such an architect" / the owner, so - this is just a "I wish".

@mrob95
Copy link
Owner

mrob95 commented Feb 18, 2024

Well, it's better to throw an exception with a clear explanation that 'this feature is not supported on the version of windows you are running' than just silently ignore the user's request. If the user wants to ignore the exception then they are welcome to.

@mrob95
Copy link
Owner

mrob95 commented Feb 18, 2024

We do the same thing e.g. here - https://github.com/mrob95/pyvda/blob/master/pyvda/pyvda.py#L423

stdedos added a commit to stdedos/pyvda that referenced this issue Feb 19, 2024
…nager

`raise NotImplementedError` on `.name` and `.rename` methods.

Fixes mrob95#37

Signed-off-by: Stavros Ntentos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants