Jump to content

Pull revision from exe?


Recommended Posts

Posted
Is there any method for an external application to pull the revision number out of the Mangos binary (specifically Windows, here)?

when you run mangosd.exe the log output has the rev number at the top

Posted

yes he could parse the log file for the rev number but i think he meant if there was a way to do it by calling a function directly from mangos. am i correct?

if so i don't believe there is any way of doing it as that code is in the .exe if i'm not mistaken.

Posted
You could just read the src/shared/revision_nr.h file ..

not if the program is already compiled...

and you are assuming that the src is readily available to the app which is looking for the rev

Posted
You could just read the src/shared/revision_nr.h file ..

Yep, this would be a web app extracting the revision information, so there would need to be some interface hook into doing so.

Posted

Would it be possible for each exe, on startup, to insert a value into a table within the world db (a new table would be required)? Could just make an UPDATE statement upon startup that would fill in the revision number which is stored in the exe (as we can see from the log file).

Posted
Would it be possible for each exe, on startup, to insert a value into a table within the world db (a new table would be required)? Could just make an UPDATE statement upon startup that would fill in the revision number which is stored in the exe (as we can see from the log file).

ÿou can extract the number from src/shared/revision_nr.h and update DB from within your restarter script for example.

Posted

For windows exe, we could also automatically generate exe version info file (mangosd.rc) before exe linking, then version is available in exe properties then accessible by any language.

Example of content to display version 0.12.6968.0 (pure example)

mangosd.rc

/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_APPICON             ICON                    "mangosd.ico"

/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
#pragma code_page(1252)
#endif //_WIN32

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,12,6968,0
PRODUCTVERSION 0,12,6968,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x0L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
   BLOCK "StringFileInfo"
   BEGIN
       BLOCK "080004b0"
       BEGIN
           VALUE "FileDescription", "MaNGOS World daemon"
           VALUE "FileVersion", "0, 12, 6968, 0"
           VALUE "InternalName", "Mangosd"
           VALUE "LegalCopyright", "Copyright (C) 2008"
           VALUE "OriginalFilename", "mangosd.exe"
           VALUE "ProductName", "MaNGOS"
           VALUE "ProductVersion", "0, 12, 6968, 0"
       END
   END
   BLOCK "VarFileInfo"
   BEGIN
       VALUE "Translation", 0x800, 1200
   END
END
#endif

for this to work with VC express edition which is a bit castrated, replace #include "afxres.h" by #include "windows.h"

resource.h

//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by mangosd.rc
//

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        101
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use