mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
Add version resource to .dlls; don't list them if it's missing or has
wrong value.
This commit is contained in:
parent
b0bf95ea8a
commit
d6f424dbce
6 changed files with 35 additions and 1 deletions
|
@ -189,6 +189,20 @@ copyWideStr( CEAppGlobals* globals, const wchar_t* str, wchar_t** loc )
|
||||||
wcscpy( *loc, str );
|
wcscpy( *loc, str );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static XP_U16
|
||||||
|
getDLLVersion( HINSTANCE hinst )
|
||||||
|
{
|
||||||
|
XP_U16 version = 0; /* illegal value */
|
||||||
|
HRSRC rsrcH = FindResource( hinst, MAKEINTRESOURCE(ID_DLLVERS_RES),
|
||||||
|
TEXT("DLLV") );
|
||||||
|
if ( !!rsrcH ) {
|
||||||
|
HGLOBAL globH = LoadResource( hinst, rsrcH );
|
||||||
|
version = *(XP_U16*)globH;
|
||||||
|
DeleteObject( globH );
|
||||||
|
}
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
/* Iterate through .dll files listing the name of any that has one. Pair with
|
/* Iterate through .dll files listing the name of any that has one. Pair with
|
||||||
* file from which it came since that's what we'll return.
|
* file from which it came since that's what we'll return.
|
||||||
*/
|
*/
|
||||||
|
@ -219,7 +233,9 @@ listDlls( DllSelState* state )
|
||||||
|
|
||||||
HINSTANCE hinst = LoadLibrary( data.cFileName );
|
HINSTANCE hinst = LoadLibrary( data.cFileName );
|
||||||
if ( !!hinst ) {
|
if ( !!hinst ) {
|
||||||
if ( LoadString( hinst, IDS_LANGUAGE_NAME,
|
if ( CUR_DLL_VERSION != getDLLVersion( hinst ) ) {
|
||||||
|
/* do nothing; wrong version (or just not our .dll) */
|
||||||
|
} else if ( LoadString( hinst, IDS_LANGUAGE_NAME,
|
||||||
name, VSIZE(name) ) ) {
|
name, VSIZE(name) ) ) {
|
||||||
(void)SendDlgItemMessage( hDlg, state->dllListID,
|
(void)SendDlgItemMessage( hDlg, state->dllListID,
|
||||||
ADDSTRING(globals), 0, (LPARAM)name );
|
ADDSTRING(globals), 0, (LPARAM)name );
|
||||||
|
|
|
@ -172,6 +172,8 @@ END
|
||||||
|
|
||||||
#include "../rc_incs.h"
|
#include "../rc_incs.h"
|
||||||
|
|
||||||
|
DLL_VERS_RESOURCE
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Dialog
|
// Dialog
|
||||||
|
|
|
@ -172,6 +172,8 @@ END
|
||||||
|
|
||||||
#include "../rc_incs.h"
|
#include "../rc_incs.h"
|
||||||
|
|
||||||
|
DLL_VERS_RESOURCE
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// Dialog
|
// Dialog
|
||||||
|
|
|
@ -23,3 +23,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ABOUT_VERSION "4.2.1 b1"
|
#define ABOUT_VERSION "4.2.1 b1"
|
||||||
|
|
||||||
|
#define DLL_VERS_RESOURCE \
|
||||||
|
ID_DLLVERS_RES DLLV MOVEABLE PURE \
|
||||||
|
BEGIN \
|
||||||
|
CUR_DLL_VERSION \
|
||||||
|
END
|
||||||
|
|
|
@ -249,6 +249,7 @@
|
||||||
|
|
||||||
#define ID_COLORS_RES 9999
|
#define ID_COLORS_RES 9999
|
||||||
#define ID_BONUS_RES 9998
|
#define ID_BONUS_RES 9998
|
||||||
|
#define ID_DLLVERS_RES 9997
|
||||||
|
|
||||||
#define IDM_MAIN_COMMAND1 40001
|
#define IDM_MAIN_COMMAND1 40001
|
||||||
#define IDS_DUMMY 40002
|
#define IDS_DUMMY 40002
|
||||||
|
|
|
@ -8,6 +8,13 @@
|
||||||
#ifndef _STRIDS_H_
|
#ifndef _STRIDS_H_
|
||||||
#define _STRIDS_H_
|
#define _STRIDS_H_
|
||||||
|
|
||||||
|
/* CUR_DLL_VERSION is included in all .dll resources and can be used to check
|
||||||
|
* whether a given resource can be trusted. Up it when changing the order of
|
||||||
|
* strings. Which do only when unavoidable.
|
||||||
|
*/
|
||||||
|
#define CUR_DLL_VERSION 0x0001
|
||||||
|
|
||||||
|
|
||||||
#define CE_FIRST_RES_ID 40002
|
#define CE_FIRST_RES_ID 40002
|
||||||
|
|
||||||
#define IDS_MENU CE_FIRST_RES_ID
|
#define IDS_MENU CE_FIRST_RES_ID
|
||||||
|
|
Loading…
Add table
Reference in a new issue