Changeset 1294
- Timestamp:
- 10/28/2009 10:05:32 AM (4 years ago)
- Location:
- trunk/eraser5/EraserDll
- Files:
-
- 4 edited
-
EraserDll.h (modified) (1 diff)
-
Options.cpp (modified) (7 diffs)
-
Pass.h (modified) (1 diff)
-
StdAfx.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser5/EraserDll/EraserDll.h
r1110 r1294 45 45 const LPCTSTR ERASER_REGISTRY_LIBRARY 46 46 = _T("Library"); 47 const LPCTSTR ERASER_REGISTRY_LIBRARY_VERSION 48 = _T("LibraryVersion"); 47 49 // enable Shell Extension? 48 50 const LPCTSTR ERASEXT_REGISTRY_ENABLED -
trunk/eraser5/EraserDll/Options.cpp
r4 r1294 29 29 #define MAX_CMETHOD_SIZE (CMETHOD_SIZE + PASSES_MAX * sizeof(PASS)) 30 30 #define MAX_LIBRARYSETTINGS_SIZE (LIBRARYSETTINGS_SIZE + (MAX_CUSTOM_METHODS * MAX_CMETHOD_SIZE)) 31 #define LIBRARYVERSION 1 //Unicode library version. 0 is the ASCII one 31 32 32 33 void … … 58 59 CKey &kReg = no_registry ? kReg_ini : kReg_reg; 59 60 bool bResult = FALSE; 61 DWORD LibraryVersion = 0; 60 62 E_UINT32 uSize; 61 63 E_PUINT8 lpData; … … 66 68 return false; 67 69 } 70 71 //Get the version of the library database 72 kReg.GetValue(LibraryVersion, ERASER_REGISTRY_LIBRARY_VERSION, 0); 68 73 69 74 uSize = kReg.GetValueSize(ERASER_REGISTRY_LIBRARY); … … 82 87 83 88 E_UINT32 uPos = LIBRARYSETTINGS_SIZE; 89 #ifdef _UNICODE 90 bool upgradeCustomMethods = LibraryVersion == LIBRARYVERSION || 91 AfxMessageBox(_T("An old version of Eraser settings have been found.\n\n") 92 _T("Would you like to upgrade the settings to match the new format? Clicking no will likely ") 93 _T("result in corrupted custom erase methods."), MB_YESNO) == IDYES; 94 #endif 84 95 85 96 for (E_UINT8 i = 0; i < pls->m_nCMethods; i++) { … … 90 101 91 102 uPos += CMETHOD_SIZE; 103 104 #ifdef _UNICODE 105 // upgrade the name of the method if this is an old library 106 if (LibraryVersion < LIBRARYVERSION && upgradeCustomMethods) 107 { 108 // Cast the raw data to the old method base class 109 MethodBaseA* ansiMethod = reinterpret_cast<MethodBaseA*>(&pls->m_lpCMethods[i]); 110 _MethodBase unicodeMethod; 111 112 // Migrate the data element by element 113 memset(&unicodeMethod, 0, sizeof(_MethodBase)); 114 unicodeMethod.m_nMethodID = ansiMethod->m_nMethodID; 115 unicodeMethod.m_nPasses = ansiMethod->m_nPasses; 116 unicodeMethod.m_pwfFunction = ansiMethod->m_pwfFunction; 117 unicodeMethod.m_bShuffle = ansiMethod->m_bShuffle; 118 119 // Convert the method name to Unicode 120 size_t convCount = 0; 121 mbstowcs_s(&convCount, unicodeMethod.m_szDescription, DESCRIPTION_SIZE, 122 ansiMethod->m_szDescription, DESCRIPTION_SIZE - 1); 123 124 // Copy the new structure 125 memcpy(ansiMethod, &unicodeMethod, sizeof(_MethodBase)); 126 127 // Move the buffer pointer backwards so that the passes loaded will be correct 128 uPos -= (sizeof(wchar_t) - sizeof(char)) * DESCRIPTION_SIZE; 129 } 130 #endif 92 131 93 132 // actual pass information … … 105 144 } 106 145 } 146 147 #ifdef _UNICODE 148 if (LibraryVersion < LIBRARYVERSION && upgradeCustomMethods) 149 saveLibrarySettings(pls); 150 #endif 107 151 } 108 152 … … 152 196 } 153 197 198 // write the library version 199 kReg.SetValue(LIBRARYVERSION, ERASER_REGISTRY_LIBRARY_VERSION); 200 154 201 // calculate data size 155 202 uSize = LIBRARYSETTINGS_SIZE + (pls->m_nCMethods * CMETHOD_SIZE); -
trunk/eraser5/EraserDll/Pass.h
r53 r1294 88 88 LPPASS m_lpPasses; // pointer to PASSes 89 89 } BMETHOD, *LPBMETHOD; 90 91 // Old ANSI Eraser Custom Method as stored in the registry 92 struct MethodBaseA { 93 E_UINT8 m_nMethodID; // ID 94 char m_szDescription[DESCRIPTION_SIZE]; // description 95 E_UINT16 m_nPasses; // number of PASSes 96 WIPEFUNCTION m_pwfFunction; // the wipe function 97 98 E_UINT8 m_bShuffle; // shuffle passes 99 }; 90 100 91 101 #pragma pack() -
trunk/eraser5/EraserDll/StdAfx.h
r1110 r1294 86 86 #include "..\shared\SeException.h" // handling 87 87 #include <Shlwapi.h> 88 #include <vector> 88 89 89 90 #ifndef _AFXDLL
Note: See TracChangeset
for help on using the changeset viewer.
