Coder Social home page Coder Social logo

C example about dokany HOT 25 CLOSED

dokan-dev avatar dokan-dev commented on August 26, 2024
C example

from dokany.

Comments (25)

suy avatar suy commented on August 26, 2024 1

I've been doing my application with Dokan and OSXFUSE at the same time, and it's not an easy task. They have different semantics for some thing (e.g., in Dokan, CreateDirectory implies creating a directory and opening a file handle, while in FUSE the mkdir operation just creates it).

Look at things one step at a time. Understand the Dokan API first. Try to create a simple file system where everything is in memory or hardcoded in the application (there is a "hello world" example for FUSE that fakes a file system with just one file hardcoded, and is really simple: very few operations are needed).

Later on you can read how other bindings for FUSE or Dokan are done. Oh, and there is also the dokan-fuse bridge, but I haven't tried how well it works.

from dokany.

sherter avatar sherter commented on August 26, 2024

That would be mirror.c ...

from dokany.

Liryna avatar Liryna commented on August 26, 2024

What do you mean by port dokan in another high-level language ?
Wrapping dokan api like https://github.com/dokan-dev/dokan-dotnet for C# ?

Or mirror.c like @sherter told πŸ‘

from dokany.

Kleak avatar Kleak commented on August 26, 2024

It's for wrapping dokan api :)

from dokany.

Liryna avatar Liryna commented on August 26, 2024

https://github.com/dokan-dev/dokany/wiki/API#api-wrapping

from dokany.

Kleak avatar Kleak commented on August 26, 2024

And you don't have a example how to use dokan in C.

from dokany.

Liryna avatar Liryna commented on August 26, 2024

mirror.c is a simple example of dokan in C using the C API.

from dokany.

Kleak avatar Kleak commented on August 26, 2024

ok I think i can close this thread if i have question i will re-open it :)
thanks

from dokany.

Kleak avatar Kleak commented on August 26, 2024

I have installed the latest release but when i launch mirror.exe nothings happen, is it normal?

from dokany.

Liryna avatar Liryna commented on August 26, 2024

No,
What is the command line that you are using ?
could you give us more informations ?

from dokany.

Kleak avatar Kleak commented on August 26, 2024

oups i have found sorry :)
i haven't seen that mirror.exe need some parameters

from dokany.

Kleak avatar Kleak commented on August 26, 2024

I really don't know where start to wrap dokan so if you can take a look :)
Actually the drive appear and disappear instantly because the vm is stopped but i don't know why :/

https://github.com/Rollercops/Dart-Dokany

thanks a lot

from dokany.

Liryna avatar Liryna commented on August 26, 2024

Could you give us more informations ?
"the vm is stopped" do you mean that DokanStart return ? what is the return value ?
Have you enabled debug output ? What is the result ?

It looks like you have only implement one DokanOperation.

Please look at https://github.com/dokan-dev/dokany/wiki/API
If you see something missing please tell me and I will add it.

Mirror.c is enough to understand how dokan work and with the different wrapper as exemples, it is going to be very easy.

from dokany.

Kleak avatar Kleak commented on August 26, 2024

yes i have implement only one DokanOperation because i have try in c to just malloc an empty structure and the disk appear until i Ctrl+C the program so i would like, for the beginning just start correctly and after implement all the operation.

If i put 0 in the variable ThreadCount DokanStart (so DokanMain because DokanStart return value is the value that DokanMain return) is -6 (DOKAN_MOUNT_POINT_ERROR). and if i put 1 in the variable ThreadCount the program create the drive and crash after, and sometime crash windows entirely (aka bluescreen)

Debug mode is enable but nothing appear on the output when I put something else than 0 in ThreadCount

from dokany.

Liryna avatar Liryna commented on August 26, 2024

https://github.com/dokan-dev/dokany/blob/master/dokan/dokan.c#L142
You should begin to make it work with 1.

return DOKAN_MOUNT_POINT_ERROR;

If your CreateFile fail, you will get this error.

There is no default routine for the operations, so if you do not implement them, it is normal that it doesn't work.

from dokany.

Kleak avatar Kleak commented on August 26, 2024

It don't work but the drive appear in the explorer for the moment i just want this happen :)

This launch with :
dokanOptions->Version 730
dokanOptions->ThreadCount 1
dokanOptions->Options 11
dokanOptions->GlobalContext 0
dokanOptions->MountPoint m

I have this return value : Mount point error

It's at me to implement CreateFile?

from dokany.

Liryna avatar Liryna commented on August 26, 2024

https://github.com/Rollercops/Dart-Dokany/blob/master/example/extension.dart#L10
Try to simply implement all Operations and simplify print the name of functions called.

It's at me to implement CreateFile?
Your dart wrapper no, but the example that use your wrapper, yes.
As Mirror.c does with the C API!

from dokany.

Kleak avatar Kleak commented on August 26, 2024

So CreateFile is part of dokan operations?

from dokany.

Liryna avatar Liryna commented on August 26, 2024

https://github.com/dokan-dev/dokan-java/blob/master/src/main/java/com/github/dokandev/dokanjava/DokanOperations.java#L24
https://github.com/dokan-dev/dokan-delphi/blob/master/Mirror.dpr#L704
https://github.com/dokan-dev/dokan-dotnet/blob/master/DokanNet/DokanOperationProxy.cs#L13

https://github.com/dokan-dev/dokany/wiki/API#how-to-create-your-file-systems

Please.

Private joke: OK, l'annΓ©e Γ  l'international on glande pendant 1 an, mais ce n'est pas une excuse pour oublier ce que tu as appris pendant les piscines ! πŸ˜„

from dokany.

Kleak avatar Kleak commented on August 26, 2024

ahah I didn't forget !

Mais je vois pas ce que ca Γ  avoir avec ceci ?

from dokany.

Kleak avatar Kleak commented on August 26, 2024

I have implement all the dokan operation in my .cc file and i have the same problem DokanMain return DOKAN_MOUNT_POINT_ERROR

from dokany.

Kleak avatar Kleak commented on August 26, 2024

found ^^
After my drive start correctly what is the best way? to do inside the dokan operations function call the dart methods? or there is a better way?

from dokany.

Liryna avatar Liryna commented on August 26, 2024

About your wrapper, dokan operations should stay abstract and force the user to implement it.
When the drive start correctly, it should call every endpoint of your wrapper (CreateFile, Cleanup, close,...).
You probably want that Dart C code forwards the operation to javascript no ?

from dokany.

Kleak avatar Kleak commented on August 26, 2024

No.
I have, not for the moment after, to abstract all the thinks because i need the same things on linux (with fuse) and macos (with osxfuse).
So the best way will be implement all the things in dart and less as possible in C?

from dokany.

Kleak avatar Kleak commented on August 26, 2024

Thanks, i will begin with Dokan and after try to add fuse in my library

from dokany.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.