Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Common subdirectories: Debug and Debug diff -cN HmRegIni.cpp HmRegIni.cpp *** HmRegIni.cpp Thu Jan 1 09:00:00 1970 --- HmRegIni.cpp Sun Feb 18 15:06:00 2007 *************** *** 0 **** --- 1,125 ---- + #include + #include + #include "HmRegIni.h" + + + class HmRegIni{ + public: + HmRegIni(){ + m_dll = ::LoadLibrary(_T("HmRegIni.dll")); + if(!m_dll)return; + m_RegOpenKeyEx = (REGOPENKEYEX)::GetProcAddress(m_dll,_T("HmRegOpenKeyEx")); + m_RegCreateKeyEx = (REGCREATEKEYEX)::GetProcAddress(m_dll,_T("HmRegCreateKeyEx")); + m_RegCloseKey = (REGCLOSEKEY)::GetProcAddress(m_dll,_T("HmRegCloseKey")); + m_RegQueryValueEx = (REGQUERYVALUEEX)::GetProcAddress(m_dll,_T("HmRegQueryValueEx")); + m_RegSetValueEx = (REGSETVALUEEX)::GetProcAddress(m_dll,_T("HmRegSetValueEx")); + m_RegDeleteValue = (REGDELETEVALUE)::GetProcAddress(m_dll,_T("HmRegDeleteValue")); + m_RegDeleteKey = (REGDELETEKEY)::GetProcAddress(m_dll,_T("HmRegDeleteKey")); + m_RegEnumKey = (REGENUMKEY)::GetProcAddress(m_dll,_T("HmRegEnumKey")); + m_RegEnumKeyEx = (REGENUMKEYEX)::GetProcAddress(m_dll,_T("HmRegEnumKeyEx")); + m_RegEnumValue = (REGENUMVALUE)::GetProcAddress(m_dll,_T("HmRegEnumValue")); + if(!m_RegOpenKeyEx || !m_RegCreateKeyEx || !m_RegCloseKey || !m_RegQueryValueEx || !m_RegSetValueEx || !m_RegDeleteValue || !m_RegDeleteKey || !m_RegEnumKey || !m_RegEnumKeyEx || !m_RegEnumValue){ + ::FreeLibrary(m_dll); + m_dll = NULL; + return; + } + } + ~HmRegIni(){::FreeLibrary(m_dll);} + LONG RegOpenKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult){ + if(m_dll)return (*m_RegOpenKeyEx)(hKey, lpSubKey, ulOptions, samDesired, phkResult); + else return ::RegOpenKeyEx(hKey, lpSubKey, ulOptions, samDesired, phkResult); + } + LONG RegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition){ + if(m_dll)return (*m_RegCreateKeyEx)(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition); + else return ::RegCreateKeyEx(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition); + } + LONG RegCloseKey(HKEY hKey){ + if(m_dll)return (*m_RegCloseKey)(hKey); + else return ::RegCloseKey(hKey); + } + LONG RegQueryValueEx(HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData){ + DWORD type; + if(m_dll)return (*m_RegQueryValueEx)(hKey, lpValueName, lpReserved, lpType ? lpType : &type, lpData, lpcbData); + else return ::RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); + } + LONG RegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData){ + if(m_dll)return (*m_RegSetValueEx)(hKey, lpValueName, Reserved, dwType, lpData, cbData); + else return ::RegSetValueEx(hKey, lpValueName, Reserved, dwType, lpData, cbData); + } + LONG RegDeleteValue(HKEY hKey, LPCTSTR lpValueName){ + if(m_dll)return (*m_RegDeleteValue)(hKey, lpValueName); + else return ::RegDeleteValue(hKey, lpValueName); + } + LONG RegDeleteKey(HKEY hKey, LPCTSTR lpSubKey){ + if(m_dll)return (*m_RegDeleteKey)(hKey, lpSubKey); + else return ::RegDeleteKey(hKey, lpSubKey); + } + LONG RegEnumKey(HKEY hKey, DWORD dwIndex, LPTSTR lpName, DWORD cbName){ + if(m_dll)return (*m_RegEnumKey)(hKey, dwIndex, lpName, cbName); + else return ::RegEnumKey(hKey, dwIndex, lpName, cbName); + } + LONG RegEnumKeyEx(HKEY hKey, DWORD dwIndex, LPTSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPTSTR lpClass, LPDWORD lpcbClass, PFILETIME pft){ + if(m_dll)return (*m_RegEnumKeyEx)(hKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, lpcbClass, pft); + else return ::RegEnumKeyEx(hKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, lpcbClass, pft); + } + LONG RegEnumValue(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData){ + if(m_dll)return (*m_RegEnumValue)(hKey, dwIndex, lpValueName, lpcValueName, lpReserved, lpType, lpData, lpcbData); + else return ::RegEnumValue(hKey, dwIndex, lpValueName, lpcValueName, lpReserved, lpType, lpData, lpcbData); + } + private: + typedef LONG (__stdcall *REGOPENKEYEX)(HKEY, LPCTSTR, DWORD, REGSAM, PHKEY); + typedef LONG (__stdcall *REGCREATEKEYEX)(HKEY, LPCTSTR, DWORD, LPTSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD); + typedef LONG (__stdcall *REGCLOSEKEY)(HKEY); + typedef LONG (__stdcall *REGQUERYVALUEEX)(HKEY, LPCTSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD); + typedef LONG (__stdcall *REGSETVALUEEX)(HKEY, LPCTSTR, DWORD, DWORD, CONST BYTE*, DWORD); + typedef LONG (__stdcall *REGDELETEVALUE)(HKEY, LPCTSTR); + typedef LONG (__stdcall *REGDELETEKEY)(HKEY, LPCTSTR); + typedef LONG (__stdcall *REGENUMKEY)(HKEY, DWORD, LPTSTR, DWORD); + typedef LONG (__stdcall *REGENUMKEYEX)(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPTSTR, LPDWORD, PFILETIME); + typedef LONG (__stdcall *REGENUMVALUE)(HKEY, DWORD, LPTSTR, LPDWORD, LPDWORD, LPDWORD, LPBYTE, LPDWORD); + REGOPENKEYEX m_RegOpenKeyEx; + REGCREATEKEYEX m_RegCreateKeyEx; + REGCLOSEKEY m_RegCloseKey; + REGQUERYVALUEEX m_RegQueryValueEx; + REGSETVALUEEX m_RegSetValueEx; + REGDELETEVALUE m_RegDeleteValue; + REGDELETEKEY m_RegDeleteKey; + REGENUMKEY m_RegEnumKey; + REGENUMKEYEX m_RegEnumKeyEx; + REGENUMVALUE m_RegEnumValue; + + HINSTANCE m_dll; + }; + + HmRegIni g_hmregini; + + extern "C" LONG MyRegOpenKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult){ + return g_hmregini.RegOpenKeyEx(hKey, lpSubKey, ulOptions, samDesired, phkResult); + } + extern "C" LONG MyRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition){ + return g_hmregini.RegCreateKeyEx(hKey, lpSubKey, Reserved, lpClass, dwOptions, samDesired, lpSecurityAttributes, phkResult, lpdwDisposition); + } + extern "C" LONG MyRegCloseKey(HKEY hKey){ + return g_hmregini.RegCloseKey(hKey); + } + extern "C" LONG MyRegQueryValueEx(HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData){ + return g_hmregini.RegQueryValueEx(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData); + } + extern "C" LONG MyRegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData){ + return g_hmregini.RegSetValueEx(hKey, lpValueName, Reserved, dwType, lpData, cbData); + } + extern "C" LONG MyRegDeleteValue(HKEY hKey, LPCTSTR lpValueName){ + return g_hmregini.RegDeleteValue(hKey, lpValueName); + } + extern "C" LONG MyRegDeleteKey(HKEY hKey, LPCTSTR lpSubKey){ + return g_hmregini.RegDeleteKey(hKey, lpSubKey); + } + extern "C" LONG MyRegEnumKey(HKEY hKey, DWORD dwIndex, LPTSTR lpName, DWORD cbName){ + return g_hmregini.RegEnumKey(hKey, dwIndex, lpName, cbName); + } + extern "C" LONG MyRegEnumKeyEx(HKEY hKey, DWORD dwIndex, LPTSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPTSTR lpClass, LPDWORD lpcbClass, PFILETIME pft){ + return g_hmregini.RegEnumKeyEx(hKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, lpcbClass, pft); + } + extern "C" LONG MyRegEnumValue(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData){ + return g_hmregini.RegEnumValue(hKey, dwIndex, lpValueName, lpcValueName, lpReserved, lpType, lpData, lpcbData); + } diff -cN HmRegIni.h HmRegIni.h *** HmRegIni.h Thu Jan 1 09:00:00 1970 --- HmRegIni.h Sun Feb 18 14:32:20 2007 *************** *** 0 **** --- 1,22 ---- + #ifndef __HMREGINI_H__ + #define __HMREGINI_H__ + + #ifdef __cplusplus + #define EXTERN extern "C" + #else + #define EXTERN + #endif + + EXTERN LONG MyRegOpenKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult); + EXTERN LONG MyRegCreateKeyEx(HKEY hKey, LPCTSTR lpSubKey, DWORD Reserved, LPTSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition); + EXTERN LONG MyRegCloseKey(HKEY hKey); + EXTERN LONG MyRegQueryValueEx(HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData); + EXTERN LONG MyRegSetValueEx(HKEY hKey, LPCTSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData); + EXTERN LONG MyRegDeleteValue(HKEY hKey, LPCTSTR lpValueName); + EXTERN LONG MyRegDeleteKey(HKEY hKey, LPCTSTR lpSubKey); + EXTERN LONG MyRegEnumKey(HKEY hKey, DWORD dwIndex, LPTSTR lpName, DWORD cbName); + EXTERN LONG MyRegEnumKeyEx(HKEY hKey, DWORD dwIndex, LPTSTR lpName, LPDWORD lpcbName, LPDWORD lpReserved, LPTSTR lpClass, LPDWORD lpcbClass, PFILETIME pft); + EXTERN LONG MyRegEnumValue(HKEY hKey, DWORD dwIndex, LPTSTR lpValueName, LPDWORD lpcValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData); + + + #endif //__HMREGINI_H__ Common subdirectories: Release and Release diff -cN bmc.c bmc.c *** bmc.c Sat Jan 15 03:17:00 2005 --- bmc.c Sun Feb 18 15:31:26 2007 *************** *** 1260,1265 **** --- 1260,1266 ---- } #ifdef PLUG_IN + #include "HmRegIni.h" int RestoreString(char* str, int size, char* szKey) { *************** *** 1271,1284 **** DWORD d_size = 256; str[0] = 0; ! if( RegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) return 0; ! lResult = RegEnumValue(hKey, 0, dummy, &d_size, NULL, &dwType, (LPBYTE)str, ©size); if(lResult != ERROR_SUCCESS) str[0] = 0; ! RegCloseKey( hKey ); return lstrlen(str); } --- 1272,1285 ---- DWORD d_size = 256; str[0] = 0; ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) return 0; ! lResult = MyRegEnumValue(hKey, 0, dummy, &d_size, NULL, &dwType, (LPBYTE)str, ©size); if(lResult != ERROR_SUCCESS) str[0] = 0; ! MyRegCloseKey( hKey ); return lstrlen(str); } Files dviout.ncb and dviout.ncb differ Files dviout.suo and dviout.suo differ diff -cN dviout.vcproj dviout.vcproj *** dviout.vcproj Sat Feb 11 03:18:00 2006 --- dviout.vcproj Sun Feb 18 16:33:44 2007 *************** *** 4,9 **** --- 4,10 ---- Version="8.00" Name="dviout" ProjectGUID="{D856A26B-DE13-4A60-8274-66B664FDE9FF}" + RootNamespace="dviout" > + + + + diff -cN tabctrl.c tabctrl.c *** tabctrl.c Sat Mar 18 03:18:02 2006 --- tabctrl.c Sun Feb 18 15:34:04 2007 *************** *** 6596,6601 **** --- 6596,6603 ---- return 0; } + #include "HmRegIni.h" + int RestoreClassString( char* str, int size, char* szKey, char* key, char* def ) { *************** *** 6609,6631 **** { goto copydef; } ! lResult = RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, ©size ); if( lResult == ERROR_MORE_DATA ) { char* szData = (char*)marea( copysize*sizeof(char) + 1 ); ! RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)szData, ©size ); lstrcpyn( str, szData, size ); str[size - 1] = '\0'; Free( szData ); ! RegCloseKey( hKey ); return lstrlen(str); } else if( lResult == ERROR_SUCCESS ){ ! RegCloseKey( hKey ); goto quit; } copydef: ! RegCloseKey( hKey ); if( lstrlen(str) == 0 ) { int l = lstrlen( def ); --- 6611,6633 ---- { goto copydef; } ! lResult = MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, ©size ); if( lResult == ERROR_MORE_DATA ) { char* szData = (char*)marea( copysize*sizeof(char) + 1 ); ! MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)szData, ©size ); lstrcpyn( str, szData, size ); str[size - 1] = '\0'; Free( szData ); ! MyRegCloseKey( hKey ); return lstrlen(str); } else if( lResult == ERROR_SUCCESS ){ ! MyRegCloseKey( hKey ); goto quit; } copydef: ! MyRegCloseKey( hKey ); if( lstrlen(str) == 0 ) { int l = lstrlen( def ); *************** *** 6651,6665 **** HKEY hKey; DWORD dwDisposition; ! if( RegCreateKeyEx( HKEY_CLASSES_ROOT, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return FALSE; } ! RegSetValueEx( hKey, key, 0, REG_SZ, (BYTE *)sz, lstrlen(sz)+1 ); ! RegCloseKey( hKey ); return TRUE; } --- 6653,6667 ---- HKEY hKey; DWORD dwDisposition; ! if( MyRegCreateKeyEx( HKEY_CLASSES_ROOT, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return FALSE; } ! MyRegSetValueEx( hKey, key, 0, REG_SZ, (BYTE *)sz, lstrlen(sz)+1 ); ! MyRegCloseKey( hKey ); return TRUE; } diff -cN wmain.c wmain.c *** wmain.c Sat Mar 18 03:18:02 2006 --- wmain.c Sun Feb 18 15:06:18 2007 *************** *** 2885,2890 **** --- 2885,2892 ---- } } + #include "HmRegIni.h" + void ReserveInt( char* section, char* key, int i ) { /* レジストリに整数値を保管 *************** *** 2897,2911 **** DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return; } ! RegSetValueEx( hKey, key, 0, REG_DWORD, (BYTE *)&i, sizeof(int) ); ! RegCloseKey( hKey ); } void ReserveString( char* section, char* key, char* sz ) --- 2899,2913 ---- DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return; } ! MyRegSetValueEx( hKey, key, 0, REG_DWORD, (BYTE *)&i, sizeof(int) ); ! MyRegCloseKey( hKey ); } void ReserveString( char* section, char* key, char* sz ) *************** *** 2920,2934 **** DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return; } ! RegSetValueEx( hKey, key, 0, REG_SZ, (BYTE *)sz, lstrlen(sz)+1 ); ! RegCloseKey( hKey ); } int RestoreInt( char* section, char* key, int def ) --- 2922,2936 ---- DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { MessageBox( NULL, "Error in RegCreateKey", NULL, MB_OK ); return; } ! MyRegSetValueEx( hKey, key, 0, REG_SZ, (BYTE *)sz, lstrlen(sz)+1 ); ! MyRegCloseKey( hKey ); } int RestoreInt( char* section, char* key, int def ) *************** *** 2945,2961 **** int size = sizeof(int); LONG err; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { return def; } ! err = RegQueryValueEx( hKey, key, 0, NULL, (LPBYTE)&i, (LPDWORD)&size ); if( err != ERROR_SUCCESS ) { return def; } ! RegCloseKey( hKey ); return (int)i; } --- 2947,2963 ---- int size = sizeof(int); LONG err; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { return def; } ! err = MyRegQueryValueEx( hKey, key, 0, NULL, (LPBYTE)&i, (LPDWORD)&size ); if( err != ERROR_SUCCESS ) { return def; } ! MyRegCloseKey( hKey ); return (int)i; } *************** *** 2966,2978 **** char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section); ! if( RegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey ) != ERROR_SUCCESS ) return 0; result = ! // RegDeleteKey(hKey, key); ! RegDeleteValue(hKey, key); ! RegCloseKey( hKey ); return result; } --- 2968,2980 ---- char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section); ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_WRITE, &hKey ) != ERROR_SUCCESS ) return 0; result = ! // MyRegDeleteKey(hKey, key); ! MyRegDeleteValue(hKey, key); ! MyRegCloseKey( hKey ); return result; } *************** *** 3012,3022 **** break; } ! if( RegOpenKeyEx( HKEY_CURRENT_USER, section, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) return 0; ! lResult = RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, &size ); ! RegCloseKey( hKey ); if( lResult == ERROR_MORE_DATA ) res = -1; else if( lResult == ERROR_SUCCESS ) --- 3014,3024 ---- break; } ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, section, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) return 0; ! lResult = MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, &size ); ! MyRegCloseKey( hKey ); if( lResult == ERROR_MORE_DATA ) res = -1; else if( lResult == ERROR_SUCCESS ) *************** *** 3048,3075 **** // for( i = 0; i < size; i++ ) str[i] = '\0'; str[0] = 0; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { goto copydef; } ! lResult = RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, ©size ); if( lResult == ERROR_MORE_DATA ) { char* szData = (char*)marea( copysize*sizeof(char) ); ! RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)szData, ©size ); lstrcpyn( str, szData, size ); str[size - 1] = '\0'; Free( szData ); ! RegCloseKey( hKey ); return lstrlen(str); } else if( lResult == ERROR_SUCCESS ){ ! RegCloseKey( hKey ); goto quit; } copydef: ! RegCloseKey( hKey ); if( lstrlen(str) == 0 ) { int l = lstrlen( def ); --- 3050,3077 ---- // for( i = 0; i < size; i++ ) str[i] = '\0'; str[0] = 0; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { goto copydef; } ! lResult = MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)str, ©size ); if( lResult == ERROR_MORE_DATA ) { char* szData = (char*)marea( copysize*sizeof(char) ); ! MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)szData, ©size ); lstrcpyn( str, szData, size ); str[size - 1] = '\0'; Free( szData ); ! MyRegCloseKey( hKey ); return lstrlen(str); } else if( lResult == ERROR_SUCCESS ){ ! MyRegCloseKey( hKey ); goto quit; } copydef: ! MyRegCloseKey( hKey ); if( lstrlen(str) == 0 ) { int l = lstrlen( def ); *************** *** 3103,3109 **** DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { --- 3105,3111 ---- DWORD dwDisposition; char szKey[256]; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegCreateKeyEx( HKEY_CURRENT_USER, szKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, &dwDisposition ) != ERROR_SUCCESS ) { *************** *** 3111,3118 **** return; } ! RegSetValueEx( hKey, key, 0, REG_BINARY, (BYTE *)data, size ); ! RegCloseKey( hKey ); } int RestoreBinary( char* data, int size, char* section, char* key, BYTE def ) --- 3113,3120 ---- return; } ! MyRegSetValueEx( hKey, key, 0, REG_BINARY, (BYTE *)data, size ); ! MyRegCloseKey( hKey ); } int RestoreBinary( char* data, int size, char* section, char* key, BYTE def ) *************** *** 3132,3148 **** LONG err; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( RegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { return -1; } ! err = RegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)data, (LPDWORD)&size ); if( err != ERROR_SUCCESS ) { memset( data, size, def ); } ! RegCloseKey( hKey ); return 0; } --- 3134,3150 ---- LONG err; wsprintf( szKey, "Software\\SHIMA\\DVIOUT\\%s", section ); ! if( MyRegOpenKeyEx( HKEY_CURRENT_USER, szKey, 0, KEY_READ, &hKey ) != ERROR_SUCCESS ) { return -1; } ! err = MyRegQueryValueEx( hKey, key, 0, &dwType, (LPBYTE)data, (LPDWORD)&size ); if( err != ERROR_SUCCESS ) { memset( data, size, def ); } ! MyRegCloseKey( hKey ); return 0; }