3535#include " config/app_constants.h"
3636#include " String_define.h"
3737
38- using std::wstring;
39-
4038#define BUFFER_SIZE 1024
4139#define ACTION_NAME (L" SakuraEditor" )
4240#define PROGID_BACKUP_NAME (L" SakuraEditorBackup" )
4341#define ACTION_BACKUP_PATH (L" \\ ShellBackup" )
4442
4543// 関数プロトタイプ
46- int CopyRegistry (HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstring& destPath);
47- int DeleteRegistry (HKEY root, const wstring& path);
44+ int CopyRegistry (HKEY srcRoot, const std:: wstring& srcPath, HKEY destRoot, const std:: wstring& destPath);
45+ int DeleteRegistry (HKEY root, const std:: wstring& path);
4846int RegistExt (LPCWSTR sExt , bool bDefProg);
4947int UnregistExt (LPCWSTR sExt );
5048int CheckExt (LPCWSTR sExt , bool *pbRMenu, bool *pbDblClick);
@@ -252,15 +250,15 @@ INT_PTR CDlgTypeList::DispatchEvent( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM
252250 {
253251 WCHAR buf[BUFFER_SIZE ] = {0 };
254252 ::FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM , NULL , nRet, 0 , buf, _countof(buf), NULL );
255- ::MessageBox ( GetHwnd(), (wstring(LS (STR_DLGTYPELIST_ERR1 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
253+ ::MessageBox ( GetHwnd(), (std:: wstring(LS (STR_DLGTYPELIST_ERR1 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
256254 break ;
257255 }
258256 }else { // 「右クリック」チェックOFF
259257 if ( (nRet = UnregistExt ( ext )) != 0 )
260258 {
261259 WCHAR buf[BUFFER_SIZE ] = {0 };
262260 ::FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM , NULL , nRet, 0 , buf, _countof(buf), NULL );
263- ::MessageBox ( GetHwnd(), (wstring(LS (STR_DLGTYPELIST_ERR2 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
261+ ::MessageBox ( GetHwnd(), (std:: wstring(LS (STR_DLGTYPELIST_ERR2 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
264262 break ;
265263 }
266264 }
@@ -290,7 +288,7 @@ INT_PTR CDlgTypeList::DispatchEvent( HWND hWnd, UINT wMsg, WPARAM wParam, LPARAM
290288 {
291289 WCHAR buf[BUFFER_SIZE ] = {0 };
292290 ::FormatMessage ( FORMAT_MESSAGE_FROM_SYSTEM , NULL , nRet, 0 , buf, _countof(buf), NULL );
293- ::MessageBox ( GetHwnd(), (wstring(LS (STR_DLGTYPELIST_ERR1 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
291+ ::MessageBox ( GetHwnd(), (std:: wstring(LS (STR_DLGTYPELIST_ERR1 )) + buf).c_str(), GSTR_APPNAME, MB_OK );
294292 break ;
295293 }
296294 }
@@ -714,7 +712,7 @@ bool CDlgTypeList::DelType()
714712}
715713
716714/* ! 再帰的レジストリコピー */
717- int CopyRegistry (HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstring& destPath)
715+ int CopyRegistry (HKEY srcRoot, const std:: wstring& srcPath, HKEY destRoot, const std:: wstring& destPath)
718716{
719717 int errorCode;
720718 CRegKey keySrc;
@@ -767,7 +765,7 @@ int CopyRegistry(HKEY srcRoot, const wstring& srcPath, HKEY destRoot, const wstr
767765}
768766
769767/* ! 再帰的レジストリ削除 */
770- int DeleteRegistry (HKEY root, const wstring& path)
768+ int DeleteRegistry (HKEY root, const std:: wstring& path)
771769{
772770 int errorCode;
773771 CRegKey keySrc;
@@ -827,15 +825,15 @@ int DeleteRegistry(HKEY root, const wstring& path)
827825int RegistExt (LPCWSTR sExt , bool bDefProg)
828826{
829827 int errorCode = ERROR_SUCCESS ;
830- wstring sBasePath = wstring ( L" Software\\ Classes\\ " );
828+ std:: wstring sBasePath = std:: wstring ( L" Software\\ Classes\\ " );
831829
832830 // 小文字化
833831 WCHAR szLowerExt[MAX_PATH ] = {0 };
834832 wcsncpy_s (szLowerExt, sExt , _TRUNCATE);
835833 CharLower (szLowerExt);
836834
837- wstring sDotExt = sBasePath + L" ." + szLowerExt;
838- wstring sGenProgID = wstring () + L" SakuraEditor_" + szLowerExt;
835+ std:: wstring sDotExt = sBasePath + L" ." + szLowerExt;
836+ std:: wstring sGenProgID = std:: wstring () + L" SakuraEditor_" + szLowerExt;
839837
840838 CRegKey keyExt_HKLM;
841839 WCHAR szProgID_HKLM[ BUFFER_SIZE ] = {0 };
@@ -861,7 +859,7 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
861859 if ( (errorCode = keyExt.SetValue (NULL , sGenProgID .c_str ())) != 0 ){ return errorCode; }
862860 }
863861
864- wstring sProgIDPath = sBasePath + sGenProgID ;
862+ std:: wstring sProgIDPath = sBasePath + sGenProgID ;
865863 if ( ! CRegKey::ExistsKey (HKEY_CURRENT_USER , sProgIDPath .c_str ()) )
866864 {
867865 if ( szProgID_HKLM[0 ] != L' \0 ' )
@@ -870,10 +868,10 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
870868 }
871869 }
872870
873- wstring sShellPath = sProgIDPath + L" \\ shell" ;
874- wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
875- wstring sShellActionCommandPath = sShellActionPath + L" \\ command" ;
876- wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH ;
871+ std:: wstring sShellPath = sProgIDPath + L" \\ shell" ;
872+ std:: wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
873+ std:: wstring sShellActionCommandPath = sShellActionPath + L" \\ command" ;
874+ std:: wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH ;
877875
878876 CRegKey keyShellActionCommand;
879877 if ( (errorCode = keyShellActionCommand.Open (HKEY_CURRENT_USER , sShellActionCommandPath .c_str (), KEY_READ | KEY_WRITE )) != 0 )
@@ -883,7 +881,7 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
883881
884882 WCHAR sExePath [_MAX_PATH] = {0 };
885883 ::GetModuleFileName ( NULL , sExePath , _countof(sExePath ) );
886- wstring sCommandPathArg = wstring () + L" \" " + sExePath + L" \" \" %1\" " ;
884+ std:: wstring sCommandPathArg = std:: wstring () + L" \" " + sExePath + L" \" \" %1\" " ;
887885 if ( (errorCode = keyShellActionCommand.SetValue (NULL , sCommandPathArg .c_str ())) != 0 ){ return errorCode; }
888886
889887 CRegKey keyShellAction;
@@ -947,14 +945,14 @@ int RegistExt(LPCWSTR sExt, bool bDefProg)
947945int UnregistExt (LPCWSTR sExt )
948946{
949947 int errorCode = ERROR_SUCCESS ;
950- wstring sBasePath = wstring ( L" Software\\ Classes\\ " );
948+ std:: wstring sBasePath = std:: wstring ( L" Software\\ Classes\\ " );
951949
952950 // 小文字化
953951 WCHAR szLowerExt[MAX_PATH ] = {0 };
954952 wcsncpy_s (szLowerExt, sExt , _TRUNCATE);
955953 CharLower (szLowerExt);
956954
957- wstring sDotExt = sBasePath + L" ." + szLowerExt;
955+ std:: wstring sDotExt = sBasePath + L" ." + szLowerExt;
958956
959957 CRegKey keyExt;
960958 if ((errorCode = keyExt.Open (HKEY_CURRENT_USER , sDotExt .c_str (), KEY_READ | KEY_WRITE )) != 0 )
@@ -970,10 +968,10 @@ int UnregistExt(LPCWSTR sExt)
970968 return ERROR_SUCCESS ;
971969 }
972970
973- wstring sProgIDPath = sBasePath + szProgID;
974- wstring sShellPath = sProgIDPath + L" \\ shell" ;
975- wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
976- wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH ;
971+ std:: wstring sProgIDPath = sBasePath + szProgID;
972+ std:: wstring sShellPath = sProgIDPath + L" \\ shell" ;
973+ std:: wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
974+ std:: wstring sBackupPath = sShellActionPath + ACTION_BACKUP_PATH ;
977975
978976 CRegKey keyShellAction;
979977 if ( (errorCode = keyShellAction.Open (HKEY_CURRENT_USER , sShellActionPath .c_str (), KEY_READ | KEY_WRITE )) != 0 )
@@ -1034,7 +1032,7 @@ int UnregistExt(LPCWSTR sExt)
10341032int CheckExt (LPCWSTR sExt , bool *pbRMenu, bool *pbDblClick)
10351033{
10361034 int errorCode = ERROR_SUCCESS ;
1037- wstring sBasePath = wstring ( L" Software\\ Classes\\ " );
1035+ std:: wstring sBasePath = std:: wstring ( L" Software\\ Classes\\ " );
10381036
10391037 *pbRMenu = false ;
10401038 *pbDblClick = false ;
@@ -1044,7 +1042,7 @@ int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick)
10441042 wcsncpy_s (szLowerExt, sExt , _TRUNCATE);
10451043 CharLower (szLowerExt);
10461044
1047- wstring sDotExt = sBasePath + L" ." + szLowerExt;
1045+ std:: wstring sDotExt = sBasePath + L" ." + szLowerExt;
10481046
10491047 CRegKey keyExt;
10501048 if ((errorCode = keyExt.Open (HKEY_CURRENT_USER , sDotExt .c_str (), KEY_READ )) != 0 )
@@ -1060,8 +1058,8 @@ int CheckExt(LPCWSTR sExt, bool *pbRMenu, bool *pbDblClick)
10601058 return ERROR_SUCCESS ;
10611059 }
10621060
1063- wstring sShellPath = wstring () + L" Software\\ Classes\\ " + szProgID + L" \\ shell" ;
1064- wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
1061+ std:: wstring sShellPath = std:: wstring () + L" Software\\ Classes\\ " + szProgID + L" \\ shell" ;
1062+ std:: wstring sShellActionPath = sShellPath + L" \\ " + ACTION_NAME ;
10651063 if ( ! CRegKey::ExistsKey (HKEY_CURRENT_USER , sShellActionPath .c_str ()) )
10661064 {
10671065 return ERROR_SUCCESS ;
0 commit comments