I want to create many programs that will share same dll.
Now I'm searching a directory in wich I can install these common dll.
I think I can create a subdirectory in the CSIDL_COMMON_APPDATA folder (c:\documents and settings\all users\application data)

Can I use this folder or is there a better common folder?
Posted on 2004-01-07 07:57:27 by greenant
I don't know which is correct or best place, but many programs seems to create their own common files folder under c:\program files\common files folder.
Posted on 2004-01-07 14:04:03 by SamiP
You refer to this
CSIDL_PROGRAM_FILES_COMMON (0x002b)
Version 5.0. A folder for components that are shared across applications. A typical path is C:\Program

Files\Common. Valid only for Windows NT, Windows 2000, and Windows XP systems. Not valid for Windows

Millennium Edition (Windows Me).

but I want a folder that exsist also in Windows 9x and Me.

Now, as Greenant, I'm developing and distributing only one program, but I have other unfinished

programs that soon will be finished and I will distribute them.
The installation of these program is done with Microsoft Installer.
I need to create a common folder where I can put all my dll and other data that can be shared between

my application.
Now I need to put there only zlib but, in the future, there will be other dll. When I upgrade this dll,

all my programs that use this dll will use the new (and better) dll.

I don't want to create a subfolder under c:\program files\greenant because the user might change this

folder during installation and I will not find my dll.

I think I can use COMMON_APPDATA but I don't know if there is a better solution.
Posted on 2004-01-07 14:25:26 by greenant
Put the DLLs in the system folder, it is the logical place for it. The System and Windows folders are always in the search tree for a DLL when Windows tries to load it and it will suceed even if your future apps do not specify a path. You can always create your own common folder and add it to the "path" environment variable, that will also cause Windows to search there for the DLL without having to specify it's path.
Posted on 2004-01-07 14:49:25 by donkey
I don't want to care about name duplication. I want to be free to create a dll called shell32.dll (it is only an example) and I want to be the only one who can load this dll.

When I will load these dll I will do the following steps:

    [*]SHGetSpecialFolderPath to retrieve the path of the special folder
    [*]Add "\subfolder" to the special folder path
    [*]LoadLibrary with an absolute path to load the dll
    [*]GetProcAddress to get functions addresses


    I should also to create a sort of dll registration, because I must keep track whether dll are used or not. If they are not used I must uninstall them. Maybe I will create a program to do this
Posted on 2004-01-07 14:58:59 by greenant
Well, in that case I would store the path in the registry. The installer is capable of verifying and writing registry entries at least the NULLSOFT one is. Then when your app starts read the location and load the DLL with a specified path. Though why you would want to use the name of existing DLLs is beyond me and IMHO dangerous to other applications. If you want to be free to use any name you like why bother giving it the extension DLL, you could do what I did and make up you very own, in TBPaint the DLL files all have the extension TBX. Works fine for me and there can never be a naming conflict, though in my case it is because I just load everything that I find in the current folder.
Posted on 2004-01-07 15:07:29 by donkey
Shell32.dll is only a stupid example but I don't want to care about name conflicts.
I think I will create my custom folder under COMMON_APPDATA.

How can I keep track of wich dll are used and wich are not?
Do you think I should create a sort of semaphore?
Every time I install a program that uses that dll I increase a counter. When I uninstall a program that uses that dll I decrease the counter. When the counter reaches zero I uninstall the dll.

Or should I write somewhere the name of each programs that uses my dll, and then act like a semaphore.
I keep a list of program that uses my dll. When the list has zero items I delete the dll.

I don't know how commercial progams (and installers) keep track of unused dll.
Posted on 2004-01-07 15:25:55 by greenant
Do the sensible thing - on NT systems, use the Common Program Files folder (and of course get the path via registry or ShGetSpecialFolderPath). On 9x, do <whatever> - dumping in windir\system is a dirty thing to do, but it gets the job done. Since you do LoadLib+GPA you could play nice on both systems, though. (Hm, whonder whether Common Program Files are search on LoadLibrary...)


When the counter reaches zero I uninstall the dll.

probably the best way to do it. It's error-prone like everything else, but hopefully you'll avoid uninstalling a DLL that really needs to be used. Of course you could do the "really do-goody thing" and read the microsoft installer docs and see what the recommended procedure is...
Posted on 2004-01-08 18:39:44 by f0dder