how to integrate WinFSP own code with right click mount in windows?

204 views
Skip to first unread message

Tomas Dalebjörk

unread,
Sep 20, 2019, 2:22:31 AM9/20/19
to WinFsp
Hi,
Thanks for this excellent tool.
It is great to see such initiative.

I have started to create a file system using WinFsp.
And are now thinking about how this is integrated with the "Right Click" (on my computer) -> "Mount Network drive" ...
As viewed in the video..

Anyone having an idea about how to do this?

Regards Tomas

Bill Zissimopoulos

unread,
Sep 20, 2019, 2:47:31 PM9/20/19
to Tomas Dalebjörk, WinFsp

Hello, Tomas:

 

Here is the documentation on how to do this:

       https://github.com/billziss-gh/winfsp/wiki/WinFsp-Service-Architecture

 

The WinFsp distribution includes a batch file named fsreg.bat (found in \Program Files (x86)\WinFsp\bin) that can be used to create the necessary registry entries for you.

 

Bill

--
You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winfsp+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/winfsp/09972469-bed4-4847-859c-d7266e160711%40googlegroups.com.

Tomas Dalebjörk

unread,
Sep 23, 2019, 8:36:26 AM9/23/19
to WinFsp
Hi,

I tried to implement this according to the documentation.
But my file system code is not getting executed at all using "Right click mount share" option in Windows.

All entries I can see in the event-viewer is:
  launcher-x64: reate myfs\share = 0
  launcher-x64: terminated myfs\share

No messages from from my code?

I have added the registry keys, as mentioned in the samples.

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\WinFsp\Services\MYFS]
"Executable"="C:\Program Files\MYFS\bin\MYFS.EXE"
"CommandLine"="-p %1 -m %2"
"Security"="D:P(A;;RPWPLC;;;WD"
"JobControl"=dword:00000001

And in the beginning of my code:

int wmain(int argc, wchar_t **argv)
{
  FILE *fp = NULL;
...

   fp = fopen("C:\\Program Files\\MYFS\\var\\debug.log","w");
   fprintf(fp,"hello\n");
   fclose(fp);
...
}

Executing this from command line works, and the content in debug.log gets written.
But, executing this using Right Click -> mount, doesn't work.
And nothing is getting written in  the debug.log file...

Not sure what I have been doing wrongly here...

Please suggest or help me understand.

Regards Tomas

Tomas Dalebjörk

unread,
Sep 23, 2019, 10:24:21 AM9/23/19
to WinFsp
I found the issue.

The WinFsp.dll library is not included in the Path.

Regards Tomas

Den fredag 20 september 2019 kl. 08:22:31 UTC+2 skrev Tomas Dalebjörk:

Bill Zissimopoulos

unread,
Sep 23, 2019, 12:24:53 PM9/23/19
to Tomas Dalebjörk, WinFsp

This is by design. The best way to use the WinFsp DLL is to delay load the DLL and load it at runtime using FspLoad.

 

First add the WinFsp DLL as a delay loaded DLL. Open the project properties and change the following setting:

 

Linker > Input > Delay Loaded Dll’s: winfsp-$(PlatformTarget).dll

 

Then add the following lines in your main/wmain:

 

    if (!NT_SUCCESS(FspLoad(0)))

        return ERROR_DELAY_LOAD_FAILED;

 

For more see this link:

 

https://github.com/billziss-gh/winfsp/wiki/WinFsp-Tutorial#create-the-project-skeleton

 

Bill

--

You received this message because you are subscribed to the Google Groups "WinFsp" group.
To unsubscribe from this group and stop receiving emails from it, send an email to winfsp+un...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages