PfmMount::Control sample code

Home Forums PFM Developer Support PfmMount::Control sample code

This topic contains 1 post, has 1 voice, and was last updated by  Dhebug 2 years.

Viewing 1 post (of 1 total)
  • Author

  • Dhebug
    Posts: 12

    does anyone know if there is some sample code somewhere showing how to use the mount control code?

    I tried without success to use the PfmMount::Control function, I got a valid PfmMount object (checked that the GetMountId, GetMountSourceName, GetMountPoint and GetFormatterName did point to my application), but when I try to call the Control function I get an error 1 (ERROR_INVALID_FUNCTION).

    I checked in the debug log output, I looked in the trace tool output, but I did see anything special there.

    On the other side, I had a breakpoint and some print outs in my PfmMarshallerControlOp handler, which did not trigger, so I’m pretty certain I’m doing something wrong on the calling side.

    My code looks like that, not quite sure what’s wrong:

              int controlCode = 0;
              char* input = "This is a test";
              size_t inputSize = 5; // sizeof(input);
              char output[256];
              size_t maxOutputSize = sizeof(output);
              size_t outputSize = 0;
              err = mount->Control(controlCode, input, inputSize, output, maxOutputSize, &outputSize);
              if (!err)
                DebugPrint("mount->Control: Success");
                return true;
              DebugPrint("mount->Control: Fail with code %u",err);

    The only documentation I found is :

    int /*error*/ PfmMount::Control (
    int controlCode ,
    const void* input ,
    size_t inputSize ,
    void* output ,
    size_t maxOutputSize ,
    size_t* outputSize )
    Send a server specific control code through to the server. Servers using PfmMarshaller will see a the control code via a call to their implementation of PfmFormatterDispatch::Control .

    Since control codes are server specific, applications must identify the server before sending control codes. This can be done using the PfmMount::GetFormatterName method.

    Servers should number their control codes starting at zero or one and not leave gaps. The range of available control codes is limited and is not guaranteed to remain constant.

    This last sentence puzzles me: I’ve not see any place where to register control codes, based on the API it looks like the system is just passing whatever parameter is sent to the Control function to the marshaller callback associated to this particular mount, but it’s probably not the way it works.

    I spent a couple of day on that this week, tried earlier a few weeks ago without much success.

    I’m stuck, so any suggestion are welcome.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.