-
Type: New Feature
-
Status: Resolved
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: 4.0.0
-
Fix Version/s: NoFixVersionApplicable
-
Component/s: Packaging / Build
-
Environment:Windows
-
Epic Link:
-
Tags:
-
Sprint:nxDrive 10.10.2
-
Story Points:5
I copy/paste the comment from NXDRIVE-1156 just below, but the scope of this ticket is to have a working COM server. To validate, the given script Python must be able to connect.
—
Technical information here: The Component Object Model on MSDN.
There is a DLL source code in the wip-NXDRIVE-1156-windows-fs-decorator branch (taken from ownCloud and reduced/adapted for our needs). The revelant code is in tools/windows/icon_overlays.
Requirements
Download Visual Studio 2017 Community. Installation options: select Universal Windows Platform development with its subcomponent C++ Universal Windows Platform tools.
Build the DLL
Open OCShellExtensions.sln with Visual Studio 2017. Press F7 or use the Build menu entry.
Register the DLL
Open a Command Prompt in admin, go to dist/Debug/Win32 and type:
regsvr32 DriveOverlays_x86.dll
A message should tell you the registered status.
The Drive Add-Ons installer will also add more information in the registry, see tools/windows/setup-addons-common.iss for details.
I think both action needs to be done: the regsvr32 and Add-Ons Installation.
Communication
The DLL communicates with Drive via socket. It uses a named pipe \\.\pipe\ndrive-USERNAME instead of a local server.
This part is blurred in my mind: is it the DLL that should start the socket? Because the socket seems closed all the time.
This is a small Python script that will communicate with the socket (but this does not work as the server is not yet started):
import os import time import pywintypes import win32file import win32pipe named_pipe = f"\\\\.\\pipe\\ndrive-{os.getenv('USERNAME')}" print(named_pipe) quit = False while not quit: try: handle = win32file.CreateFile( named_pipe, win32file.GENERIC_READ | win32file.GENERIC_WRITE, 0, None, win32file.OPEN_EXISTING, 0, None, ) res = win32pipe.SetNamedPipeHandleState( handle, win32pipe.PIPE_READMODE_MESSAGE, None, None, ) data = win32file.ReadFile(res, 64 * 1024) except pywintypes.error as e: if e.args[0] == 2: print("no pipe, trying again in a sec") time.sleep(1) elif e.args[0] == 109: print("broken pipe, bye bye") quit = True else: print(data)
The script will undefinitely try to get something from the server. Easy for debugging and testing.
Ideas
In the registry, I saw a key like Root: HKCR; Subkey: "CLSID\\{{#RegistryKey}\LocalServer32"; ValueType: string; ValueData: "C:\Users\Windows7\Desktop\some.dll".
Perhaps this is required to launch the server, but as the DLL contains everything to manager the server, and I read somewhere that it should be used for testing only, this is not a good idea.
As I am writing this comment, I just found this post: Abusing the COM Registry Structure: CLSID, LocalServer32, & InprocServer32.
It may be very interesting to read
- is related to
-
NXDRIVE-1156 (timebox) Use file system decoration on Windows
- Resolved