/* * MSVFW32: (Compman, drawdib and video) * * profile.c * * win32/win16 utility functions to read and write profile items * for VFW * * JMK: added functions to convert from Ansi to Unicode & back * * WARNING: This code caches open registry keys. When a profile call * is made the code looks for an atom to correspond to the appname supplied. * If an atom is found, then the table of cached registry keys is searched * for the matching registry handle. If the handle exists, it is used. * No handle would mean that someone else registered an atom using this * name, so we proceed to the next step. * * No atom found, or no matching registry handle, means that we have to * open a registry key. If successful, and there is space in the cache, * we AddAtom the appname, and cache the registry key before returning to * the caller. */ #include #include #ifdef _WIN32 // This whole file is only used for 32 bit code. It is the implementation // that allows Win GetProfilexxx calls to use the registry. #include #include #include #include "mmsystem.h" #include #include "msvideoi.h" #include "debug.h" #include "profile.h" #if MMPROFILECACHE #ifdef DEBUG #define KEYSCACHED 3 // Normally DrawDib, Debug and ?? #else #define KEYSCACHED 2 // Normally DrawDib and ?? #endif HKEY ahkey[KEYSCACHED]; ATOM akeyatoms[KEYSCACHED]; UINT keyscached = 0; #else #define KEYSCACHED 0 #endif static HKEY GetKeyA(LPCSTR appname, BOOL * closekey, BOOL fCreate) { HKEY key = 0; char achName[MAX_PATH]; #if !MMPROFILECACHE *closekey = TRUE; #else UINT n; ATOM atm; *closekey = FALSE; // // See if we have already used this key // atm = FindAtomA(appname); if (atm != 0) { // Atom exists... search the table for it. for (n=0; n