From 1fc8e65dd319abf0bac6ce753bb87ecbabd8b177 Mon Sep 17 00:00:00 2001 From: Mataes Date: Wed, 16 May 2018 21:12:31 +0300 Subject: Flags, CrashDumper, CryptoPP, CSList, Db_autobackups, DbEditorPP: cmplugin adaptation --- plugins/CountryFlags/src/icons.cpp | 86 +++++++------- plugins/CountryFlags/src/ip2country.cpp | 195 ++++++++++++++++---------------- plugins/CountryFlags/src/main.cpp | 16 +-- plugins/CountryFlags/src/options.cpp | 36 +++--- plugins/CountryFlags/src/stdafx.h | 9 +- 5 files changed, 170 insertions(+), 172 deletions(-) (limited to 'plugins/CountryFlags/src') diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp index e0d145dfe7..c295ddebb1 100644 --- a/plugins/CountryFlags/src/icons.cpp +++ b/plugins/CountryFlags/src/icons.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static HANDLE *phIconHandles; /* country number indices (same order as in flags.bmp) */ -const int BitmapIndexMap[232]={ +const int BitmapIndexMap[232] = { 0, 1, 7, 20, 27, 30, 31, 32, 33, 34, 36, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 81, 82, 84, 86, 90, 91, 92, 93, 94, 95, 98, 101, 102, 103, 104, 105, 106, 107, 178, 108, 109, 110, 111, 112, @@ -42,7 +42,7 @@ const int BitmapIndexMap[232]={ static int __fastcall CountryNumberToBitmapIndex(int countryNumber) { /* shared flags by multiple countries */ - switch(countryNumber) { + switch (countryNumber) { case 262: /* Reunion Island */ case 594: /* French Guiana */ case 5901: /* French Antilles */ @@ -70,17 +70,17 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber) } /* binary search in index array */ - int low = 0, i, high = _countof(BitmapIndexMap)-1; + int low = 0, i, high = _countof(BitmapIndexMap) - 1; if (countryNumber <= BitmapIndexMap[high]) while (low <= high) { - i = low+((high-low)/2); + i = low + ((high - low) / 2); if (BitmapIndexMap[i] == countryNumber) return i; - if (countryNumber >BitmapIndexMap[i]) - low=i+1; + if (countryNumber > BitmapIndexMap[i]) + low = i + 1; else - high=i-1; + high = i - 1; } /* Other,Unknown,Unspecified */ @@ -89,43 +89,43 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber) // return value needs to be released using DestroyIcon() // only operates on color icons, which isn't a problem here -static HICON __fastcall ResizeIconCentered(HICON hIcon,int cx,int cy) +static HICON __fastcall ResizeIconCentered(HICON hIcon, int cx, int cy) { HICON hResIcon = nullptr; HDC hdc = CreateCompatibleDC(nullptr); if (hdc != nullptr) { ICONINFO icoi; - if ( GetIconInfo(hIcon,&icoi)) { + if (GetIconInfo(hIcon, &icoi)) { BITMAP bm; - if (GetObject(icoi.hbmColor,sizeof(bm),&bm) && bm.bmWidth<=cx && bm.bmHeight<=cy) { + if (GetObject(icoi.hbmColor, sizeof(bm), &bm) && bm.bmWidth <= cx && bm.bmHeight <= cy) { POINT pt; - pt.x = (cx-bm.bmWidth)/2; - pt.y = (cy-bm.bmHeight)/2; + pt.x = (cx - bm.bmWidth) / 2; + pt.y = (cy - bm.bmHeight) / 2; HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor); if (hbmPrev != nullptr) { /* error on select? */ HBITMAP hbm = icoi.hbmColor; - icoi.hbmColor = CreateCompatibleBitmap(hdc,cx,cy); + icoi.hbmColor = CreateCompatibleBitmap(hdc, cx, cy); if (icoi.hbmColor != nullptr) - if (SelectObject(hdc,icoi.hbmColor) != nullptr) { /* error on select? */ + if (SelectObject(hdc, icoi.hbmColor) != nullptr) { /* error on select? */ DeleteObject(hbm); /* delete prev color (XOR) */ - if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,BLACKNESS)) /* transparency: AND=0, XOR=1 */ - if (DrawIconEx(hdc,pt.x,pt.y,hIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_IMAGE|DI_NOMIRROR)) { - if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */ + if (BitBlt(hdc, 0, 0, cx, cy, nullptr, 0, 0, BLACKNESS)) /* transparency: AND=0, XOR=1 */ + if (DrawIconEx(hdc, pt.x, pt.y, hIcon, bm.bmWidth, bm.bmHeight, 0, nullptr, DI_IMAGE | DI_NOMIRROR)) { + if (SelectObject(hdc, icoi.hbmMask) != nullptr) { /* error on select? */ hbm = icoi.hbmMask; - icoi.hbmMask = CreateBitmap(cx,cy,1,1,nullptr); /* mono */ + icoi.hbmMask = CreateBitmap(cx, cy, 1, 1, nullptr); /* mono */ if (icoi.hbmMask != nullptr) - if (SelectObject(hdc,icoi.hbmMask) != nullptr) { /* error on select? */ + if (SelectObject(hdc, icoi.hbmMask) != nullptr) { /* error on select? */ DeleteObject(hbm); /* delete prev mask (AND) */ - if (BitBlt(hdc,0,0,cx,cy,nullptr,0,0,WHITENESS)) /* transparency: AND=0, XOR=1 */ - if (DrawIconEx(hdc,pt.x,pt.y,hIcon,0,0,0,nullptr,DI_MASK|DI_NOMIRROR)) { - SelectObject(hdc,hbmPrev); + if (BitBlt(hdc, 0, 0, cx, cy, nullptr, 0, 0, WHITENESS)) /* transparency: AND=0, XOR=1 */ + if (DrawIconEx(hdc, pt.x, pt.y, hIcon, 0, 0, 0, nullptr, DI_MASK | DI_NOMIRROR)) { + SelectObject(hdc, hbmPrev); hResIcon = CreateIconIndirect(&icoi); /* bitmaps must not be selected */ } } } } } - SelectObject(hdc,hbmPrev); + SelectObject(hdc, hbmPrev); } } DeleteObject(icoi.hbmColor); @@ -152,8 +152,8 @@ HICON __fastcall LoadFlagIcon(int countryNumber) int __fastcall CountryNumberToIndex(int countryNumber) { - int nf=0; - for(int i=0; i < nCountriesCount; ++i) { + int nf = 0; + for (int i = 0; i < nCountriesCount; ++i) { if (countries[i].id == countryNumber) return i; if (countries[i].id == 0xFFFF) @@ -164,7 +164,7 @@ int __fastcall CountryNumberToIndex(int countryNumber) /************************* Services *******************************/ -static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) +static INT_PTR ServiceLoadFlagIcon(WPARAM wParam, LPARAM lParam) { /* return handle */ if ((BOOL)lParam) { @@ -177,15 +177,15 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) return (INT_PTR)LoadFlagIcon(wParam); } -static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) +static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam, LPARAM lParam) { HICON hIcon = nullptr; /* load both icons */ - HICON hLowerIcon = (HICON)ServiceLoadFlagIcon((WPARAM)lParam,0); + HICON hLowerIcon = (HICON)ServiceLoadFlagIcon((WPARAM)lParam, 0); if (hLowerIcon == nullptr) return 0; - HICON hUpperIcon = (HICON)ServiceLoadFlagIcon(wParam,0); + HICON hUpperIcon = (HICON)ServiceLoadFlagIcon(wParam, 0); /* merge them */ ICONINFO icoi; @@ -195,18 +195,18 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) HDC hdc = CreateCompatibleDC(nullptr); if (hdc != nullptr) { POINT aptTriangle[3] = { 0 }; - aptTriangle[1].y = bm.bmHeight-1; - aptTriangle[2].x = bm.bmWidth-1; - HRGN hrgn = CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING); + aptTriangle[1].y = bm.bmHeight - 1; + aptTriangle[2].x = bm.bmWidth - 1; + HRGN hrgn = CreatePolygonRgn(aptTriangle, _countof(aptTriangle), WINDING); if (hrgn != nullptr) { - SelectClipRgn(hdc,hrgn); + SelectClipRgn(hdc, hrgn); DeleteObject(hrgn); HBITMAP hbmPrev = (HBITMAP)SelectObject(hdc, icoi.hbmColor); if (hbmPrev != nullptr) { /* error on select? */ - if ( DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_IMAGE)) - if ( SelectObject(hdc,icoi.hbmMask) != nullptr) /* error on select? */ - DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,nullptr,DI_NOMIRROR|DI_MASK); - SelectObject(hdc,hbmPrev); + if (DrawIconEx(hdc, 0, 0, hUpperIcon, bm.bmWidth, bm.bmHeight, 0, nullptr, DI_NOMIRROR | DI_IMAGE)) + if (SelectObject(hdc, icoi.hbmMask) != nullptr) /* error on select? */ + DrawIconEx(hdc, 0, 0, hUpperIcon, bm.bmWidth, bm.bmHeight, 0, nullptr, DI_NOMIRROR | DI_MASK); + SelectObject(hdc, hbmPrev); } } DeleteDC(hdc); @@ -236,20 +236,20 @@ void InitIcons(void) /* all those flag icons do not need any transparency mask (flags are always opaque), * storing them in a large bitmap to reduce file size */ - HIMAGELIST himl = ImageList_LoadImage(hInst,MAKEINTRESOURCE(IDB_FLAGS),sid.cx,0,CLR_NONE,IMAGE_BITMAP,LR_CREATEDIBSECTION); + HIMAGELIST himl = ImageList_LoadImage(g_plugin.getInst(), MAKEINTRESOURCE(IDB_FLAGS), sid.cx, 0, CLR_NONE, IMAGE_BITMAP, LR_CREATEDIBSECTION); if (himl != nullptr) { - phIconHandles = (HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE)); + phIconHandles = (HANDLE*)mir_alloc(nCountriesCount * sizeof(HANDLE)); if (phIconHandles != nullptr) { - for (int i=0; i < nCountriesCount; ++i) { + for (int i = 0; i < nCountriesCount; ++i) { sid.description.a = (char*)countries[i].szName; /* create identifier */ - mir_snprintf(szId, (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */ + mir_snprintf(szId, (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countries[i].id); /* buffer safe */ int index = CountryNumberToBitmapIndex(countries[i].id); /* create icon */ - HICON hIcon = ImageList_GetIcon(himl,index,ILD_NORMAL); + HICON hIcon = ImageList_GetIcon(himl, index, ILD_NORMAL); if (hIcon) { - sid.hDefaultIcon = ResizeIconCentered(hIcon,sid.cx,sid.cy); + sid.hDefaultIcon = ResizeIconCentered(hIcon, sid.cx, sid.cy); DestroyIcon(hIcon); } else sid.hDefaultIcon = nullptr; diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp index ce4c45e020..2e8bae93db 100644 --- a/plugins/CountryFlags/src/ip2country.cpp +++ b/plugins/CountryFlags/src/ip2country.cpp @@ -19,7 +19,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -extern HINSTANCE hInst; extern int nCountriesCount; extern struct CountryListEntry *countries; @@ -28,24 +27,24 @@ extern struct CountryListEntry *countries; #define DATARECORD_SIZE (sizeof(DWORD)+sizeof(DWORD)+sizeof(WORD)) // mir_free() the return value -static BYTE* GetDataHeader(BYTE *data,DWORD cbDataSize,DWORD *pnDataRecordCount) +static BYTE* GetDataHeader(BYTE *data, DWORD cbDataSize, DWORD *pnDataRecordCount) { BYTE *recordData; /* uncompressed size stored in first DWORD */ - *pnDataRecordCount=(*(DWORD*)data)/DATARECORD_SIZE; - recordData=(BYTE*)mir_alloc(*(DWORD*)data); + *pnDataRecordCount = (*(DWORD*)data) / DATARECORD_SIZE; + recordData = (BYTE*)mir_alloc(*(DWORD*)data); if (recordData != nullptr) - Huffman_Uncompress(data+sizeof(DWORD),recordData,cbDataSize-sizeof(DWORD),*(DWORD*)data); + Huffman_Uncompress(data + sizeof(DWORD), recordData, cbDataSize - sizeof(DWORD), *(DWORD*)data); return recordData; } -static int GetDataRecord(BYTE *data,DWORD index,DWORD *pdwFrom,DWORD *pdwTo) +static int GetDataRecord(BYTE *data, DWORD index, DWORD *pdwFrom, DWORD *pdwTo) { - data+=index*DATARECORD_SIZE; - *pdwFrom=*(DWORD*)data; - data+=sizeof(DWORD); - if (pdwTo != nullptr) *pdwTo=*(DWORD*)data; - data+=sizeof(DWORD); + data += index * DATARECORD_SIZE; + *pdwFrom = *(DWORD*)data; + data += sizeof(DWORD); + if (pdwTo != nullptr) *pdwTo = *(DWORD*)data; + data += sizeof(DWORD); return (int)*(WORD*)data; } @@ -61,36 +60,36 @@ static void CALLBACK UnloadRecordCache(LPARAM) { mir_cslock lck(csRecordCache); mir_free(dataRecords); - dataRecords=nullptr; + dataRecords = nullptr; } // function assumes it has got the csRecordCache mutex -static BOOL EnsureRecordCacheLoaded(BYTE **pdata,DWORD *pcount) +static BOOL EnsureRecordCacheLoaded(BYTE **pdata, DWORD *pcount) { HRSRC hrsrc; DWORD cb; mir_cslock lck(csRecordCache); if (dataRecords == nullptr) { /* load record data list from resources */ - hrsrc=FindResource(hInst,MAKEINTRESOURCE(IDR_IPTOCOUNTRY),L"BIN"); - cb=SizeofResource(hInst,hrsrc); - dataRecords=(BYTE*)LockResource(LoadResource(hInst,hrsrc)); - if (cb<=sizeof(DWORD) || dataRecords == nullptr) + hrsrc = FindResource(g_plugin.getInst(), MAKEINTRESOURCE(IDR_IPTOCOUNTRY), L"BIN"); + cb = SizeofResource(g_plugin.getInst(), hrsrc); + dataRecords = (BYTE*)LockResource(LoadResource(g_plugin.getInst(), hrsrc)); + if (cb <= sizeof(DWORD) || dataRecords == nullptr) return FALSE; /* uncompress record data */ - dataRecords=GetDataHeader(dataRecords,cb,&nDataRecordsCount); + dataRecords = GetDataHeader(dataRecords, cb, &nDataRecordsCount); if (dataRecords == nullptr || !nDataRecordsCount) return FALSE; } - *pdata=dataRecords; - *pcount=nDataRecordsCount; + *pdata = dataRecords; + *pcount = nDataRecordsCount; return TRUE; } static void LeaveRecordCache(void) { /* mark for unload */ - CallFunctionBuffered(UnloadRecordCache,0,FALSE,UNLOADDELAY); + CallFunctionBuffered(UnloadRecordCache, 0, FALSE, UNLOADDELAY); } /************************* Services *******************************/ @@ -99,21 +98,21 @@ static void LeaveRecordCache(void) INT_PTR ServiceIpToCountry(WPARAM wParam, LPARAM) { BYTE *data; - DWORD dwFrom,dwTo; - DWORD low=0,i,high; + DWORD dwFrom, dwTo; + DWORD low = 0, i, high; int id; - if (EnsureRecordCacheLoaded(&data,&high)) { + if (EnsureRecordCacheLoaded(&data, &high)) { /* binary search in record data */ - GetDataRecord(data,low,&dwFrom,nullptr); + GetDataRecord(data, low, &dwFrom, nullptr); --high; - if (wParam>=dwFrom) /* only search if wParam valid */ - while (low<=high) { - i=low+((high-low)/2); - /* analyze record */ - id=GetDataRecord(data,i,&dwFrom,&dwTo); - if (dwFrom<=wParam && dwTo>=wParam) { LeaveRecordCache(); return id; } - if (wParam>dwTo) low=i+1; - else high=i-1; + if (wParam >= dwFrom) /* only search if wParam valid */ + while (low <= high) { + i = low + ((high - low) / 2); + /* analyze record */ + id = GetDataRecord(data, i, &dwFrom, &dwTo); + if (dwFrom <= wParam && dwTo >= wParam) { LeaveRecordCache(); return id; } + if (wParam > dwTo) low = i + 1; + else high = i - 1; } LeaveRecordCache(); } @@ -129,7 +128,7 @@ INT_PTR ServiceIpToCountry(WPARAM wParam, LPARAM) struct { const char *szMir; const char *szCSV; -} static const differentCountryNames[]={ +} static const differentCountryNames[] = { {"British Virgin Islands","VIRGIN ISLANDS, BRITISH"}, {"Brunei","BRUNEI DARUSSALAM"}, {"Cape Verde Islands","CAPE VERDE"}, @@ -164,82 +163,82 @@ struct { struct ResizableByteBuffer { BYTE *buf; - DWORD cbLength,cbAlloced; + DWORD cbLength, cbAlloced; }; -static void AppendToByteBuffer(struct ResizableByteBuffer *buffer,const void *append,DWORD cbAppendSize) +static void AppendToByteBuffer(struct ResizableByteBuffer *buffer, const void *append, DWORD cbAppendSize) { - if (buffer->cbAlloced<=buffer->cbLength+cbAppendSize) { - BYTE* buf=(BYTE*)mir_realloc(buffer->buf,buffer->cbAlloced+ALLOC_STEP+cbAppendSize); + if (buffer->cbAlloced <= buffer->cbLength + cbAppendSize) { + BYTE* buf = (BYTE*)mir_realloc(buffer->buf, buffer->cbAlloced + ALLOC_STEP + cbAppendSize); if (buf == NULL) return; - buffer->buf=buf; - buffer->cbAlloced+=ALLOC_STEP+cbAppendSize; + buffer->buf = buf; + buffer->cbAlloced += ALLOC_STEP + cbAppendSize; OutputDebugStringA("reallocating memory...\n"); /* all ascii */ } - memcpy(&buffer->buf[buffer->cbLength],append,cbAppendSize); - buffer->cbLength+=cbAppendSize; + memcpy(&buffer->buf[buffer->cbLength], append, cbAppendSize); + buffer->cbLength += cbAppendSize; } -static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut) +static int EnumIpDataLines(const char *pszFileCSV, const char *pszFileOut) { FILE *fp; - char line[1024],out[512],*pszFrom,*pszTo,*pszTwo,*pszCountry,*buf; - int i,j; + char line[1024], out[512], *pszFrom, *pszTo, *pszTwo, *pszCountry, *buf; + int i, j; DWORD dwOut; WORD wOut; struct ResizableByteBuffer buffer; memset(&buffer, 0, sizeof(buffer)); - fp=fopen(pszFileCSV,"rt"); + fp = fopen(pszFileCSV, "rt"); if (fp != NULL) { OutputDebugStringA("Running IP data convert...\n"); /* all ascii */ while (!feof(fp)) { - if (fgets(line,sizeof(line),fp) == NULL) break; + if (fgets(line, sizeof(line), fp) == NULL) break; /* get line data */ - pszFrom=line+1; - pszTo=strchr(pszFrom,','); - *(pszTo-1)='\0'; pszTo+=2; - pszTwo=strchr(pszTo,','); - *(pszTwo-1)='\0'; pszTwo+=2; - pszCountry=strchr(pszTwo,',')+1; - pszCountry=strchr(pszCountry,',')+2; - buf=strchr(pszCountry,'"'); - *buf=pszTwo[2]='\0'; + pszFrom = line + 1; + pszTo = strchr(pszFrom, ','); + *(pszTo - 1) = '\0'; pszTo += 2; + pszTwo = strchr(pszTo, ','); + *(pszTwo - 1) = '\0'; pszTwo += 2; + pszCountry = strchr(pszTwo, ',') + 1; + pszCountry = strchr(pszCountry, ',') + 2; + buf = strchr(pszCountry, '"'); + *buf = pszTwo[2] = '\0'; /* corrections */ - if (!mir_wstrcmpi(pszCountry,"ANTARCTICA")) continue; - if (!mir_wstrcmpi(pszCountry,"TIMOR-LESTE")) continue; - if (!mir_wstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED")) - mir_wstrcpy(pszCountry,"ISRAEL"); - else if (!mir_wstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS")) - mir_wstrcpy(pszCountry,"UNITED STATES"); - else if (!mir_wstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS")) - mir_wstrcpy(pszCountry,"UNITED KINGDOM"); - else if (!mir_wstrcmpi(pszTwo,"JE")) /* map error */ - mir_wstrcpy(pszCountry,"UNITED KINGDOM"); - else if (!mir_wstrcmpi(pszTwo,"AX")) /* Еland Island belongs to Finland */ - mir_wstrcpy(pszCountry,"FINLAND"); - else if (!mir_wstrcmpi(pszTwo,"ME")) - mir_wstrcpy(pszCountry,"MONTENEGRO"); - else if (!mir_wstrcmpi(pszTwo,"RS") || !mir_wstrcmpi(pszTwo,"CS")) - mir_wstrcpy(pszCountry,"SERBIA"); + if (!mir_wstrcmpi(pszCountry, "ANTARCTICA")) continue; + if (!mir_wstrcmpi(pszCountry, "TIMOR-LESTE")) continue; + if (!mir_wstrcmpi(pszCountry, "PALESTINIAN TERRITORY, OCCUPIED")) + mir_wstrcpy(pszCountry, "ISRAEL"); + else if (!mir_wstrcmpi(pszCountry, "UNITED STATES MINOR OUTLYING ISLANDS")) + mir_wstrcpy(pszCountry, "UNITED STATES"); + else if (!mir_wstrcmpi(pszCountry, "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS")) + mir_wstrcpy(pszCountry, "UNITED KINGDOM"); + else if (!mir_wstrcmpi(pszTwo, "JE")) /* map error */ + mir_wstrcpy(pszCountry, "UNITED KINGDOM"); + else if (!mir_wstrcmpi(pszTwo, "AX")) /* Еland Island belongs to Finland */ + mir_wstrcpy(pszCountry, "FINLAND"); + else if (!mir_wstrcmpi(pszTwo, "ME")) + mir_wstrcpy(pszCountry, "MONTENEGRO"); + else if (!mir_wstrcmpi(pszTwo, "RS") || !mir_wstrcmpi(pszTwo, "CS")) + mir_wstrcpy(pszCountry, "SERBIA"); /* convert */ - for(i=0;icode) { + switch (((NMHDR*)lParam)->code) { case PSN_APPLY: /* setting change hook will pick these up */ bool bChanged = false, bTemp; @@ -83,7 +83,7 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM,LPARAM l int OnOptionsInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; - odp.hInstance = hInst; + odp.hInstance = g_plugin.getInst(); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXTRAIMG); odp.position = 900000002; odp.szGroup.a = LPGEN("Icons"); /* autotranslated */ diff --git a/plugins/CountryFlags/src/stdafx.h b/plugins/CountryFlags/src/stdafx.h index 5ca2c565f3..894510b513 100644 --- a/plugins/CountryFlags/src/stdafx.h +++ b/plugins/CountryFlags/src/stdafx.h @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -#define __NO_CMPLUGIN_NEEDED #include #include #include @@ -44,7 +43,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h" #include "version.h" -extern HINSTANCE hInst; +struct CMPlugin : public PLUGIN +{ + CMPlugin() : + PLUGIN(MODULENAME) + {} +}; + extern int nCountriesCount; extern CountryListEntry *countries; -- cgit v1.2.3