[Frhed-commits] SF.net SVN: frhed:[223] trunk/FRHED
Brought to you by:
kimmov
From: <ki...@us...> - 2008-12-31 10:53:59
|
Revision: 223 http://frhed.svn.sourceforge.net/frhed/?rev=223&view=rev Author: kimmov Date: 2008-12-31 10:53:47 +0000 (Wed, 31 Dec 2008) Log Message: ----------- Change version number macros to Match WinMerge heksedit. Also code style improvements. Merged one part of Jochen's Unicode patch (WinMerge #2036603, r6165). Modified Paths: -------------- trunk/FRHED/BinTrans.cpp trunk/FRHED/Registry.cpp trunk/FRHED/ShortcutsDlg.cpp trunk/FRHED/UpgradeDlg.cpp trunk/FRHED/dllmain.cpp trunk/FRHED/heksedit.h trunk/FRHED/hexwdlg.cpp trunk/FRHED/hexwnd.cpp trunk/FRHED/hexwnd.h trunk/FRHED/main.cpp trunk/FRHED/version.h trunk/FRHED/version.rc Modified: trunk/FRHED/BinTrans.cpp =================================================================== --- trunk/FRHED/BinTrans.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/BinTrans.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -220,7 +220,7 @@ break; } - if (binmode == ENDIAN_LITTLE) + if (binmode == HexEditorWindow::ENDIAN_LITTLE) { switch (src[1]) { Modified: trunk/FRHED/Registry.cpp =================================================================== --- trunk/FRHED/Registry.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/Registry.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -51,7 +51,7 @@ { //Check if frhed\subreleaseno\links exists HKEY hk; - if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",&hk)){ + if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links",&hk)){ RegCloseKey(hk); return TRUE; } @@ -95,8 +95,9 @@ if( res == ERROR_SUCCESS ){ for(DWORD i = 0;; i++ ){ res = RegEnumKey(hk,i,subkeynam,MAX_PATH + 1); - if(res==ERROR_NO_MORE_ITEMS)break; - else if(0!=strcmp(subkeynam,"v"CURRENT_VERSION"."SUB_RELEASE_NO)){ + if(res==ERROR_NO_MORE_ITEMS) + break; + else if(0!=strcmp(subkeynam,"v"SHARPEN(FRHED_VERSION_3))){ RegCloseKey(hk); return TRUE; } @@ -110,7 +111,7 @@ { //Check if frhed\subreleaseno exists HKEY hk; - if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO ,&hk)){ + if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) ,&hk)){ RegCloseKey(hk); return TRUE; } @@ -145,7 +146,7 @@ char valbuf[_MAX_PATH + 1] = {0}; DWORD valbufsize = _MAX_PATH + 1, ret; if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, - "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links", + "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links", 0, KEY_ALL_ACCESS, &hk)) { for (DWORD i = 0; ; i++) @@ -167,7 +168,7 @@ } RegCloseKey(hk); } - RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links"); + RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links"); } } res = contextpresent() || unknownpresent(); @@ -200,7 +201,7 @@ } } HKEY tmp; - res = RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO, &tmp); + res = RegOpenKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3), &tmp); if (res == ERROR_SUCCESS) { RegCloseKey(tmp); @@ -215,9 +216,9 @@ ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&ver); if (ver.dwPlatformId == VER_PLATFORM_WIN32_NT) - RegDeleteWinNTKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO); + RegDeleteWinNTKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3)); else - RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO); + RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3)); res = oldpresent(); if (res) { Modified: trunk/FRHED/ShortcutsDlg.cpp =================================================================== --- trunk/FRHED/ShortcutsDlg.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/ShortcutsDlg.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -91,7 +91,7 @@ //Add to the Registry sprintf(vn,"%d",li.iItem); SHSetValue(HKEY_CURRENT_USER, - "Software\\frhed\\v"CURRENT_VERSION"."SUB_RELEASE_NO"\\links", + "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3)"\\links", vn, REG_SZ, rn, fnam - rn); li.iItem++; } @@ -197,10 +197,11 @@ case IDOK: { //Delete all values - RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links"); + RegDeleteKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links"); //Save links (from the list box) to the registry & file system HKEY hk; - if(ERROR_SUCCESS==RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",&hk)){ + if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links", &hk)) + { char valnam[50] = {0};//value name char buf[_MAX_PATH + 1] = {0};//location of the link (all links named frhed.lnk) HWND list = GetDlgItem (hw, IDC_LIST);//get the list @@ -223,10 +224,10 @@ MessageBox(hw,"Could not Save shortcut entries", "Shortcuts",MB_OK); //If the key is empty after this kill it (to prevent re-enabling of "Remove frhed") - SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links"); - SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO ); + SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links"); + SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3)); - EndDialog (hw, 0); + EndDialog(hw, 0); return TRUE; } @@ -244,18 +245,22 @@ int di = -1; HKEY hk; - if(LOWORD(w)==IDC_MOVE){ + if (LOWORD(w)==IDC_MOVE) + { di = ListView_GetSelectedCount(list); - if(di>1){ + if (di > 1) + { MessageBox(hw,"Can't move more than 1 link at a time","Move link",MB_OK); return TRUE; } - else if(di!=1){ + else if(di != 1) + { MessageBox(hw,"No link selected to move","Move link",MB_OK); return TRUE; } di = ListView_GetNextItem(list, (UINT)-1, LVNI_SELECTED); - if(di==-1){ + if (di == -1) + { MessageBox(hw,"Couldn't find the selected item","Move link",MB_OK); return TRUE; } @@ -266,15 +271,15 @@ bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT ; bi.hwndOwner = hw; bi.lpfn = BrowseCallbackProc; - if(LOWORD(w)==IDC_ADD) + if (LOWORD(w) == IDC_ADD) bi.lpszTitle = "Place a link to frhed in..."; - else if(LOWORD(w)==IDC_MOVE) + else if (LOWORD(w) == IDC_MOVE) bi.lpszTitle = "Move the link to frhed to..."; pidl = SHBrowseForFolder(&bi); if (pidl) { - if (SHGetPathFromIDList(pidl,szDir)) + if (SHGetPathFromIDList(pidl, szDir)) { //Check if the item is already in the list int num = ListView_GetItemCount(list);//get the # items in the list @@ -295,7 +300,7 @@ } }//end of the loop char valnam[_MAX_PATH+1]; - if(done) + if (done) { MessageBox(hw,"There is already a link in that folder","Add/Move",MB_OK); //Just in case @@ -303,18 +308,19 @@ strncat(szDir, FrhedLink, RTL_NUMBER_OF(szDir) - RTL_NUMBER_OF(FrhedLink)); CreateLink(_pgmptr,szDir); } - else{ - if(LOWORD(w)==IDC_ADD) + else + { + if (LOWORD(w) == IDC_ADD) { //Add to the list LVITEM item; ZeroMemory(&item,sizeof(item)); - item.mask=LVIF_TEXT; + item.mask = LVIF_TEXT; item.pszText = szDir; item.iItem = num; ListView_InsertItem(list, &item); //Add to the registry (find a string name that doesn't exist first) - if(ERROR_SUCCESS==RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",&hk)){ + if (ERROR_SUCCESS == RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links",&hk)){ for (DWORD i = 0 ; ; i++) { _snprintf(valnam, RTL_NUMBER_OF(valnam) - 1, "%d", i); @@ -331,7 +337,7 @@ CreateLink(_pgmptr,szDir); } } - else if(LOWORD(w)==IDC_MOVE) + else if (LOWORD(w) == IDC_MOVE) { //Move the old one to the new loc DWORD valnamsize, typ; @@ -342,15 +348,16 @@ ListView_GetItemText(list, di, 0, cursel, _MAX_PATH + 1); _strupr(cursel); //Set the new path in the registry - if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",0,KEY_ALL_ACCESS,&hk)){ + if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links",0,KEY_ALL_ACCESS,&hk)){ for (DWORD i = 0; ; i++) { - typ=0; + typ = 0; valnamsize = valbufsize = _MAX_PATH + 1; valbuf[0] = valnam[0] = 0; ret = RegEnumValue(hk,i,valnam,&valnamsize,0,&typ,(BYTE*) valbuf,&valbufsize); _strupr(valbuf); - if(typ==REG_SZ && valbuf[0]!=0 && !strcmp(valbuf,cursel)){ + if (typ == REG_SZ && valbuf[0] != 0 && !strcmp(valbuf ,cursel)) + { RegSetValueEx(hk,valnam,0,REG_SZ,(BYTE*)szDir,strlen(szDir)+1); break; } @@ -359,7 +366,7 @@ } RegCloseKey(hk); //Set the new path - ListView_SetItemText(list,di,0,szDir); + ListView_SetItemText(list,di, 0, szDir); //Move the actual file PathAddBackslash(szDir); strncat(szDir, FrhedLink, RTL_NUMBER_OF(szDir) - strlen(szDir)); @@ -383,7 +390,8 @@ { //Go through the file system searching for links to this exe //-Thanks to Raihan for the traversing code this was based on. - if(LOWORD (w) == IDC_FIND_AND_FIX && IDNO == MessageBox(hw,"Existing links to old versions of frhed will be updated to this version\nAre you sure you want to continue","Find & fix",MB_YESNO))return TRUE; + if (LOWORD(w) == IDC_FIND_AND_FIX && IDNO == MessageBox(hw,"Existing links to old versions of frhed will be updated to this version\nAre you sure you want to continue","Find & fix",MB_YESNO)) + return TRUE; //Find a spot to start from LPMALLOC pMalloc; @@ -405,7 +413,7 @@ { WaitCursor wc;//Wait until finished _chdir(szDir);//Set the dir to start searching in - TraverseFolders tf = GetDlgItem(hw,IDC_LIST);//Set the list hwnd; + TraverseFolders tf = GetDlgItem(hw, IDC_LIST);//Set the list hwnd; tf.cr = LOWORD(w) == IDC_FIND_AND_FIX;//any frhed.exe if 1 else _pgmptr tf.Recurse();//Search } @@ -420,7 +428,8 @@ HWND list = GetDlgItem (hw, IDC_LIST);//get the list //Delete the selected links from the registry & the filesystem int di = ListView_GetSelectedCount(list); - if(di==0){ + if (di == 0) + { MessageBox(hw,"No links selected to delete","Delete links",MB_OK); return TRUE; } @@ -434,30 +443,33 @@ char valbuf[_MAX_PATH + 1] = {0}; DWORD valbufsize, ret; char delbuf[_MAX_PATH + 1] = {0}; - ListView_GetItemText(list,di,0,delbuf,_MAX_PATH+1); + ListView_GetItemText(list, di, 0, delbuf, _MAX_PATH + 1); _strupr(delbuf); ListView_DeleteItem(list,di); HKEY hk; - if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",0,KEY_ALL_ACCESS,&hk)){ - for(DWORD i = 0; ; i++) + if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links", 0, KEY_ALL_ACCESS, &hk)) + { + for (DWORD i = 0; ; i++) { - typ=0; + typ = 0; valnamsize = valbufsize = _MAX_PATH+1; - valbuf[0]=valnam[0]=0; + valbuf[0] = valnam[0] = 0; ret = RegEnumValue(hk,i,valnam,&valnamsize,0,&typ,(BYTE*) valbuf,&valbufsize); _strupr(valbuf); - if(typ==REG_SZ && valbuf[0]!=0 && !strcmp(valbuf,delbuf)){ - RegDeleteValue(hk,valnam); + if (typ == REG_SZ && valbuf[0] != 0 && !strcmp(valbuf, delbuf)) + { + RegDeleteValue(hk, valnam); break; } - if(ERROR_NO_MORE_ITEMS==ret)break; + if (ERROR_NO_MORE_ITEMS == ret) + break; } RegCloseKey(hk); PathAddBackslash(delbuf); strncat(delbuf, FrhedLink, RTL_NUMBER_OF(delbuf) - strlen(delbuf)); remove(delbuf); } - SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links"); + SHDeleteEmptyKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links"); } return TRUE; } @@ -476,23 +488,25 @@ ZeroMemory(&item, sizeof(item)); item.mask= LVIF_TEXT; item.pszText = valbuf; - if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",0,KEY_ALL_ACCESS,&hk)){ + if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links",0,KEY_ALL_ACCESS,&hk)){ //Load all the string values - for(DWORD i = 0;;i++) + for (DWORD i = 0 ; ; i++) { - typ=0; + typ = 0; valnamsize = valbufsize = _MAX_PATH+1; - valbuf[0]=valnam[0]=0; + valbuf[0] = valnam[0] = 0; ret = RegEnumValue(hk,i,valnam,&valnamsize,0,&typ,(BYTE*) valbuf,&valbufsize); - if(typ==REG_SZ && valbuf[0]!=0 && PathIsDirectory(valbuf)){//Valid dir + if (typ == REG_SZ && valbuf[0] != 0 && PathIsDirectory(valbuf)) + {//Valid dir //Add the string item.iItem = i; ListView_InsertItem(list, &item); PathAddBackslash(valbuf); strncat(valbuf, FrhedLink, RTL_NUMBER_OF(valbuf) - strlen(valbuf)); - CreateLink(_pgmptr,valbuf); + CreateLink(_pgmptr, valbuf); } - if(ERROR_NO_MORE_ITEMS==ret)break; + if (ERROR_NO_MORE_ITEMS == ret) + break; } RegCloseKey(hk); } @@ -509,7 +523,8 @@ //HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\SendTo = C:\WINDOWS\SendTo on my computer //HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop = C:\WINDOWS\Desktop on my computer HKEY hk; - if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hk)){ + if (ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",&hk)) + { char szDir[_MAX_PATH + 1] = {0}; DWORD len = _MAX_PATH + 1; //Get the path from the registry @@ -536,7 +551,8 @@ char buf[_MAX_PATH + 1] = {0}; strncpy(path, szDir, RTL_NUMBER_OF(path)); _strupr(path); - for(int i=0;i<num;i++){//loop num times + for (int i = 0; i < num; i++) + {//loop num times ListView_GetItemText(list,i,0,buf,_MAX_PATH+1);//get the string _strupr(buf);//convert to upper since strcmp is case sensitive & Win32 is not if(!strcmp(buf,path)){ @@ -544,7 +560,7 @@ break; } }//end of the loop - if(done) + if (done) { MessageBox(hw,"There is already a link in that folder","Add",MB_OK); //Just in case @@ -560,12 +576,14 @@ item.iItem = num; ListView_InsertItem(list, &item); char valnam[_MAX_PATH + 1] = {0}; - if(ERROR_SUCCESS==RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\links",&hk)){ + if(ERROR_SUCCESS==RegCreateKey(HKEY_CURRENT_USER, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\links",&hk)) + { //Find a value name that does not exist - for(DWORD i = 0; ; i++) + for (DWORD i = 0; ; i++) { _snprintf(valnam, RTL_NUMBER_OF(valnam) - 1, "%d", i); - if(ERROR_FILE_NOT_FOUND==RegQueryValueEx(hk,valnam,0,NULL,NULL,NULL)){ + if(ERROR_FILE_NOT_FOUND==RegQueryValueEx(hk,valnam,0,NULL,NULL,NULL)) + { RegSetValueEx(hk,valnam,0,REG_SZ,(BYTE*)szDir,strlen(szDir)+1);//Add the value to the registry break; } Modified: trunk/FRHED/UpgradeDlg.cpp =================================================================== --- trunk/FRHED/UpgradeDlg.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/UpgradeDlg.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -50,7 +50,7 @@ item.mask = LVIF_TEXT ; item.pszText = subkeynam; - DWORD exstyle = LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_INFOTIP; + static const DWORD exstyle = LVS_EX_CHECKBOXES|LVS_EX_FULLROWSELECT|LVS_EX_INFOTIP; HWND list = GetDlgItem(hw,IDC_VERS); ListView_DeleteColumn(list,0); ListView_DeleteAllItems(list); @@ -58,12 +58,12 @@ //Add a column LVCOLUMN col; - ZeroMemory(&col,sizeof(col)); + ZeroMemory(&col, sizeof(col)); col.mask = LVCF_TEXT|LVCF_WIDTH ; col.fmt = LVCFMT_LEFT; col.pszText = "HKCU\\Software\\frhed"; col.cx = 165; - ListView_InsertColumn(list,0,&col); + ListView_InsertColumn(list, 0, &col); //Fill the vers list with the various versions if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\frhed", 0, KEY_ALL_ACCESS, &hk) == 0) @@ -138,7 +138,7 @@ HWND vers = GetDlgItem(hw,IDC_VERS); int i = ListView_GetNextItem(vers, (UINT)-1, LVNI_SELECTED); ListView_GetItemText(vers,i,0,&keynam[15],_MAX_PATH+1-15); - if(!strcmp(&keynam[15],"v"CURRENT_VERSION"."SUB_RELEASE_NO)){ + if(!strcmp(&keynam[15],"v"SHARPEN(FRHED_VERSION_3))){ //If that key was this version don't copy MessageBox(hw, "You can't copy the registry data of the selected version\n" @@ -148,7 +148,7 @@ //Open the reg key to load from if(ERROR_SUCCESS==RegOpenKey(HKEY_CURRENT_USER,keynam,&lk)){ - char cver[_MAX_PATH+1]="Software\\frhed\\v"CURRENT_VERSION"."SUB_RELEASE_NO"\\"; + char cver[_MAX_PATH+1]="Software\\frhed\\v"SHARPEN(FRHED_VERSION_3)"\\"; int i,numi=ListView_GetItemCount(insts),len,lenc=strlen(cver); strncat(keynam, "\\", RTL_NUMBER_OF(keynam) - strlen(keynam)); for(i=0;i<numi;i++) @@ -206,7 +206,7 @@ RegDeleteKey(HKEY_CURRENT_USER,keynam);//delete the key keynam[len-1]=0;//cut off the "\\<inst>" SHDeleteEmptyKey(HKEY_CURRENT_USER,keynam);//Delete an empty key - if (strcmp(&keynam[15],"v"CURRENT_VERSION"."SUB_RELEASE_NO) == 0) + if (strcmp(&keynam[15],"v"SHARPEN(FRHED_VERSION_3)) == 0) bSaveIni = 0;//If that key was this version don't save }//if cur inst checked }//loop insts @@ -282,11 +282,13 @@ //-------------Draw the status bar----------------------------------------- GetClientRect(hw,&rt); - rt.top = rt.bottom-18; + rt.top = rt.bottom - 18; DrawEdge (dc, &rt, BDR_SUNKENOUTER, BF_RECT); HFONT fon = (HFONT) SendMessage(GetParent(hw),WM_GETFONT,0,0); HFONT ofon = (HFONT) SelectObject(dc,fon); - char statusbuf[]="ANSI / READ";int i=0,len=11; + char statusbuf[]="ANSI / READ"; + int i = 0; + int len = 11; if(DispData.iCharacterSet!=ANSI_FIXED_FONT){ statusbuf[1]='O'; statusbuf[2]='E'; @@ -497,13 +499,13 @@ //init the insts list void UpgradeDlg::ChangeSelVer(HWND hw, char* text) { - HWND insts = GetDlgItem(hw,IDC_INSTS); - HWND instdata = GetDlgItem(hw,IDC_INSTDATA); - HWND links = GetDlgItem(hw,IDC_LINKS); - HWND mru = GetDlgItem(hw,IDC_MRU); + HWND insts = GetDlgItem(hw, IDC_INSTS); + HWND instdata = GetDlgItem(hw, IDC_INSTDATA); + HWND links = GetDlgItem(hw, IDC_LINKS); + HWND mru = GetDlgItem(hw, IDC_MRU); ListView_DeleteAllItems(insts); - ListView_DeleteColumn(insts,0); + ListView_DeleteColumn(insts, 0); ListView_DeleteAllItems(instdata); ListView_DeleteAllItems(links); ListView_DeleteAllItems(mru); @@ -515,7 +517,7 @@ col.fmt = LVCFMT_LEFT; col.pszText = text; col.cx = 120; - ListView_InsertColumn(insts,0,&col); + ListView_InsertColumn(insts, 0, &col); char keyname[100]; char subkeynam[_MAX_PATH+1]; @@ -532,11 +534,14 @@ //Fill the instance list with the various instances of the current selected version if(0==RegOpenKeyEx(HKEY_CURRENT_USER,keyname,0,KEY_ALL_ACCESS,&hk)){ for(int i=0;;i++){ - res = RegEnumKey(hk,i,subkeynam,_MAX_PATH+1); - if(res==ERROR_NO_MORE_ITEMS)break; - else{ + res = RegEnumKey(hk, i, subkeynam, _MAX_PATH + 1); + if(res == ERROR_NO_MORE_ITEMS) + break; + else + { int instno=0; - if(StrToIntEx(subkeynam,STIF_DEFAULT,&instno)){ + if(StrToIntEx(subkeynam,STIF_DEFAULT,&instno)) + { item.iItem = i; ListView_InsertItem(insts, &item); } @@ -553,12 +558,13 @@ item.pszText = valbuf; if(ERROR_SUCCESS==RegOpenKeyEx(HKEY_CURRENT_USER, keyname,0,KEY_ALL_ACCESS,&hk)){ //Load all the string values - for(DWORD i = 0;;i++){ - typ=0; + for(DWORD i = 0; ; i++){ + typ = 0; valnamsize = valbufsize = _MAX_PATH+1; - valbuf[0]=valnam[0]=0; + valbuf[0] = valnam[0] = 0; res = RegEnumValue(hk,i,valnam,&valnamsize,0,&typ,(BYTE*) valbuf,&valbufsize); - if(typ==REG_SZ && valbuf[0]!=0 ){ + if (typ==REG_SZ && valbuf[0]!=0 ) + { //Add the string item.iItem = i; ListView_InsertItem(links, &item); Modified: trunk/FRHED/dllmain.cpp =================================================================== --- trunk/FRHED/dllmain.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/dllmain.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -8,18 +8,9 @@ HINSTANCE hMainInstance; LRESULT CALLBACK HexWndProc(HWND, UINT, WPARAM, LPARAM); -static const char szHexClassA[] = "hekseditA_" - SHARPEN(A,FRHED_MAJOR_VERSION) "." - SHARPEN(A,FRHED_MINOR_VERSION) "." - SHARPEN(A,FRHED_SUB_RELEASE_NO) "." - SHARPEN(A,FRHED_BUILD_NO); +static const char szHexClassA[] = "hekseditA_" SHARPEN(FRHED_VERSION_4); +static const WCHAR szHexClassW[] = L"hekseditW_" SHARPEN_W(FRHED_VERSION_4); -static const WCHAR szHexClassW[] = L"hekseditW_" - SHARPEN(W,FRHED_MAJOR_VERSION) L"." - SHARPEN(W,FRHED_MINOR_VERSION) L"." - SHARPEN(W,FRHED_SUB_RELEASE_NO) L"." - SHARPEN(W,FRHED_BUILD_NO); - //-------------------------------------------------------------------------------------------- // WinMain: the starting point. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID) Modified: trunk/FRHED/heksedit.h =================================================================== --- trunk/FRHED/heksedit.h 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/heksedit.h 2008-12-31 10:53:47 UTC (rev 223) @@ -23,28 +23,25 @@ // ID line follows -- this is updated by SVN // $Id$ - #ifndef _HEKSEDIT_H_ #define _HEKSEDIT_H_ -// This is frhed vCURRENT_VERSION.SUB_RELEASE_NO -#include "version.h" - /** - * @brief Byte endians. - */ -enum BYTE_ENDIAN -{ - ENDIAN_LITTLE, /**< Little endian used e.g. in Intel processors. */ - ENDIAN_BIG /**< Big endian used e.g. in Motorola processors. */ -}; - -/** * @brief Interface for the Hexeditor window. + * @note This file is published to hosting applications. Do not add global declarations. */ class IHexEditorWindow { public: + /** + * @brief Byte endians. + */ + enum BYTE_ENDIAN + { + ENDIAN_LITTLE, /**< Little endian used e.g. in Intel processors. */ + ENDIAN_BIG /**< Big endian used e.g. in Motorola processors. */ + }; + struct Colors { COLORREF iTextColorValue, iBkColorValue, iSepColorValue; Modified: trunk/FRHED/hexwdlg.cpp =================================================================== --- trunk/FRHED/hexwdlg.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/hexwdlg.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -102,7 +102,7 @@ int i = iLoadInst + 1; const int num_size = 64; char num[num_size] = {0}; - _snprintf(num, num_size - 1, "Software\\frhed\\v"CURRENT_VERSION"." SUB_RELEASE_NO "\\%d", i); + _snprintf(num, num_size - 1, "Software\\frhed\\v"SHARPEN(FRHED_VERSION_3) "\\%d", i); if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_CURRENT_USER, num, 0, KEY_EXECUTE, &hk)) break; RegCloseKey(hk);//Close the key - just testing if it exists Modified: trunk/FRHED/hexwnd.cpp =================================================================== --- trunk/FRHED/hexwnd.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/hexwnd.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -3408,7 +3408,7 @@ char keyname[keyname_size] = {0}; LONG res; if (key == 0) - _snprintf(keyname, keyname_size - 1, "Software\\frhed\\v" CURRENT_VERSION "." SUB_RELEASE_NO "\\%d", + _snprintf(keyname, keyname_size - 1, "Software\\frhed\\v" SHARPEN(FRHED_VERSION_3) "\\%d", iInstCount); else _snprintf(keyname, keyname_size - 1, "Software\\frhed\\%s\\%d", key, iInstCount); @@ -3501,7 +3501,7 @@ const int keyname_size = 64; char keyname[keyname_size] = {0}; - _snprintf(keyname, keyname_size - 1, "Software\\frhed\\v" CURRENT_VERSION "." SUB_RELEASE_NO "\\%d", + _snprintf(keyname, keyname_size - 1, "Software\\frhed\\v" SHARPEN(FRHED_VERSION_3) "\\%d", iInstCount); LONG res = RegCreateKey(HKEY_CURRENT_USER, keyname, &key1); @@ -6192,7 +6192,7 @@ "}\n" // \colortbl //This is new for RTF 1.7, but it should be ignored by older readers so who cares (older than M$ Word XP = Word 2002??) - "{\\*\\generator frhed v"CURRENT_VERSION"."SUB_RELEASE_NO";}\n" + "{\\*\\generator frhed v"SHARPEN(FRHED_VERSION_3)";}\n" //Metadata here too? "{\\info\n" Modified: trunk/FRHED/hexwnd.h =================================================================== --- trunk/FRHED/hexwnd.h 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/hexwnd.h 2008-12-31 10:53:47 UTC (rev 223) @@ -30,6 +30,11 @@ #include "IDT.h" #include "heksedit.h" + +// This is frhed vCURRENT_VERSION.SUB_RELEASE_NO +// Its needed here even though nothing in this file uses macros! +#include "version.h" + #include "LangTools.h" #include "PhysicalDrive.h" Modified: trunk/FRHED/main.cpp =================================================================== --- trunk/FRHED/main.cpp 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/main.cpp 2008-12-31 10:53:47 UTC (rev 223) @@ -33,8 +33,8 @@ #include "toolbar.h" static const char szMainClass[] = "frhed wndclass"; -static const char szHexClassA[] = "hekseditA_" CURRENT_VERSION "." SUB_RELEASE_NO "." BUILD_NO; -static const char szHexClassW[] = "hekseditW_" CURRENT_VERSION "." SUB_RELEASE_NO "." BUILD_NO; +static const char szHexClassA[] = "hekseditA_" SHARPEN(FRHED_VERSION_4); +static const char szHexClassW[] = "hekseditW_" SHARPEN(FRHED_VERSION_4); HINSTANCE hMainInstance; Modified: trunk/FRHED/version.h =================================================================== --- trunk/FRHED/version.h 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/version.h 2008-12-31 10:53:47 UTC (rev 223) @@ -23,22 +23,26 @@ // ID line follows -- this is updated by SVN // $Id$ -#ifndef _FRHED_VERSION_H_ -#define _FRHED_VERSION_H_ - // These set Frhed release version number +// Note that for releases, these values are read from +// versions.ini file and set here by the SetVersions.py script #define FRHED_MAJOR_VERSION 1 #define FRHED_MINOR_VERSION 2 #define FRHED_SUB_RELEASE_NO 1 -#define FRHED_BUILD_NO 1 +#define FRHED_BUILD_NO 3 // Utility macros for formatting version number to string. #define SHARPEN_A(X) #X #define SHARPEN_W(X) L#X -#define SHARPEN(T,X) SHARPEN_##T(X) -#define CURRENT_VERSION SHARPEN(A,FRHED_MAJOR_VERSION) "." SHARPEN(A,FRHED_MINOR_VERSION) -#define SUB_RELEASE_NO SHARPEN(A,FRHED_SUB_RELEASE_NO) -#define BUILD_NO SHARPEN(A,FRHED_BUILD_NO) +#ifdef UNICODE +#define SHARPEN(X) SHARPEN_W(X) +#else +#define SHARPEN(X) SHARPEN_A(X) +#endif -#endif // _FRHED_VERSION_H_ +#define FRHED_VERSION_1 FRHED_MAJOR_VERSION +#define FRHED_VERSION_2 FRHED_MAJOR_VERSION.FRHED_MINOR_VERSION +#define FRHED_VERSION_3 FRHED_MAJOR_VERSION.FRHED_MINOR_VERSION.FRHED_SUB_RELEASE_NO +#define FRHED_VERSION_4 FRHED_MAJOR_VERSION.FRHED_MINOR_VERSION.FRHED_SUB_RELEASE_NO.FRHED_BUILD_NO + Modified: trunk/FRHED/version.rc =================================================================== --- trunk/FRHED/version.rc 2008-12-30 20:48:08 UTC (rev 222) +++ trunk/FRHED/version.rc 2008-12-31 10:53:47 UTC (rev 223) @@ -1,13 +1,5 @@ #include "version.h" -#define SHARPEN_A(X) #X -#define SHARPEN_W(X) L#X -#define SHARPEN(T,X) SHARPEN_##T(X) - -#define CURRENT_VERSION SHARPEN(A,FRHED_MAJOR_VERSION) "." SHARPEN(A,FRHED_MINOR_VERSION) -#define SUB_RELEASE_NO SHARPEN(A,FRHED_SUB_RELEASE_NO) -#define BUILD_NO SHARPEN(A,FRHED_BUILD_NO) - VS_VERSION_INFO VERSIONINFO FILEVERSION FRHED_MAJOR_VERSION,FRHED_MINOR_VERSION,FRHED_SUB_RELEASE_NO,FRHED_BUILD_NO PRODUCTVERSION FRHED_MAJOR_VERSION,FRHED_MINOR_VERSION,FRHED_SUB_RELEASE_NO,FRHED_BUILD_NO @@ -27,15 +19,15 @@ BEGIN VALUE "Comments", "Homepage: http://frhed.sourceforge.net\0" VALUE "CompanyName", "(c) Raihan Kibria 2000\0" - VALUE "FileDescription", "Frhed - Free hex editor " CURRENT_VERSION "." SUB_RELEASE_NO "." BUILD_NO - VALUE "FileVersion", CURRENT_VERSION "." SUB_RELEASE_NO "." BUILD_NO + VALUE "FileDescription", "Frhed - Free hex editor " SHARPEN(FRHED_VERSION_4) + VALUE "FileVersion", SHARPEN(FRHED_VERSION_4) VALUE "InternalName", "frhed\0" VALUE "LegalCopyright", "GNU General Public License v2.0\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "Frhed.exe\0" VALUE "PrivateBuild", "\0" VALUE "ProductName", "Frhed\0" - VALUE "ProductVersion", CURRENT_VERSION "." SUB_RELEASE_NO "." BUILD_NO + VALUE "ProductVersion", SHARPEN(FRHED_VERSION_4) VALUE "SpecialBuild", "\0" END END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |