Thread: callback from exe called with system()

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    15

    callback from exe called with system()

    I am not sure this is posted in the right board, but I want to add a volume shadow copy function (windows) inside a C program that in turn calls rsync. The program is done in C (as opposed to shell) to allow effecient error checking and verfication.

    The vshadow.exe (from VSS SDK) command will create the shadow copy, but it only exists as long as vshadow.exe is running. This is solved in shell examples by callback to the original script with a variable defined so the script knows this is the callback.

    My question is, is it possible to have a c program call an external program like vshadow.exe (called with system() ) to return a callback to a function inside the c program?

    any help will be greatly appreciated.

    Thanks,
    Leon

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    That is certainly not trivially supported. There are probably ways that you could achieve such a thing, for example using a DLL of some sort, but it's definitely not part of standard ways of doing things.

    What exactly do you want these "callbacks" to do?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    15

    What the callback should do

    When the callback is made, windows is saying the shadow build is complete and the shadow is active. At this point, the name of the shadow can be pulled from a file vshadow.exe builds. I would use the name of that shadow to run a backup process, pulling files from the shadow instead from the original files. In this way, I can back up files even if a process has them open.

    Thanks,
    Leon

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, you can probably solve that by storing the name of the result in a shared memory or file, and use a semaphore/event to signal the main program that the data is available.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. asynchronous function callback
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 06-09-2008, 09:13 PM
  2. Callback function as class method
    By schifers in forum Windows Programming
    Replies: 39
    Last Post: 05-19-2008, 03:02 PM
  3. dllimport function not allowed
    By steve1_rm in forum C++ Programming
    Replies: 5
    Last Post: 03-11-2008, 03:33 AM
  4. Replies: 16
    Last Post: 03-08-2008, 05:42 AM
  5. New system build wont boot
    By lightatdawn in forum Tech Board
    Replies: 7
    Last Post: 12-02-2005, 06:58 AM