I am trying to create a dll that writes to a file, the file must remain open as long as a process has the dll loaded. The problem is I want any process that has the dll loaded to be able to write to the file, this won't work because if the handle is in shared memory it only has meaning to the process wich created the file. How can this be done?
Posted on 2003-11-10 22:33:39 by ENF
Make a shared segment on your dll containing the file handle. This will be shared among all processes that call the library but use a method to prevent data from corruption (CreateMutex or equivalent).

Link section with option rws (read write share)
Posted on 2003-11-11 03:31:59 by pelaillo
You could also use a service to control access to the file, or just use a database.
Posted on 2003-11-11 06:44:54 by sluggy
Are you sure that putting the handle in shared data will work because I think that the handle is only valid to the process that created it. I'm going to look into the database option.
Posted on 2003-11-11 13:21:25 by ENF