diff options
author | Eugene Sandulenko | 2010-07-31 11:09:10 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2010-10-12 22:14:14 +0000 |
commit | 11b485122c9a64b68fc7073cb2fb3c18b19148b7 (patch) | |
tree | 91f8e7b955e559f6640712ce1cfc009231b5e80d /engines/sword25/kernel/wincodegenerator_win32.cpp | |
parent | cb35fc3497b0b6999b219badf83f3511f4ec5edc (diff) | |
download | scummvm-rg350-11b485122c9a64b68fc7073cb2fb3c18b19148b7.tar.gz scummvm-rg350-11b485122c9a64b68fc7073cb2fb3c18b19148b7.tar.bz2 scummvm-rg350-11b485122c9a64b68fc7073cb2fb3c18b19148b7.zip |
SWORD25: get rid of custom md5.cpp and Windows-specific debug stuff
All version ID generation is useless for ScummVM as we have our own clear
versions. Thus removing all of that.
svn-id: r53191
Diffstat (limited to 'engines/sword25/kernel/wincodegenerator_win32.cpp')
-rw-r--r-- | engines/sword25/kernel/wincodegenerator_win32.cpp | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/engines/sword25/kernel/wincodegenerator_win32.cpp b/engines/sword25/kernel/wincodegenerator_win32.cpp deleted file mode 100644 index 7897fb4367..0000000000 --- a/engines/sword25/kernel/wincodegenerator_win32.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on Broken Sword 2.5 engine - * - * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer - * - * Licensed under GNU GPL v2 - * - */ - -// ----------------------------------------------------------------------------- -// Includes -// ----------------------------------------------------------------------------- - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <LMCons.h> - -#include <vector> -using namespace std; - -#include "sword25/kernel/md5.h" -#include "sword25/kernel/wincodegenerator.h" - -// ----------------------------------------------------------------------------- -// Hilfsfunktionen -// ----------------------------------------------------------------------------- - -namespace -{ - void AddedFixedDrivesEntropy(BS_MD5 & md5) - { - if (DWORD LogicalDrivesMask = ::GetLogicalDrives()) - { - // Über alle Laufwerke iterieren. - char CurrentDriveLetter[] = "A:\\"; - while (LogicalDrivesMask && CurrentDriveLetter[0] <= 'Z') - { - if (LogicalDrivesMask & 1) - { - // Nur feste Laufwerke werden betrachtet, ansonsten würde sich die System-ID ändern, wenn jemand einen USB-Stick ansteckt oder - // eine CD einlegt. - if (::GetDriveTypeA(CurrentDriveLetter) == DRIVE_FIXED) - { - // Laufwerksinformationen auslesen. - CHAR VolumeNameBuffer[MAX_PATH + 1]; - DWORD SerialNumber; - DWORD MaximumComponentLength; - DWORD FileSystemFlags; - CHAR FileSystemNameBuffer[MAX_PATH + 1]; - if (::GetVolumeInformationA(CurrentDriveLetter, - VolumeNameBuffer, sizeof(VolumeNameBuffer), - &SerialNumber, - &MaximumComponentLength, - &FileSystemFlags, - FileSystemNameBuffer, sizeof(FileSystemNameBuffer))) - { - // Als Entropie werden genutzt: Laufwerksbuchstabe, Laufwerksbezeichnung, Seriennummer und Dateisystemname. - md5.Update(reinterpret_cast<const unsigned char *>(CurrentDriveLetter), strlen(CurrentDriveLetter)); - md5.Update(reinterpret_cast<const unsigned char *>(VolumeNameBuffer), strlen(VolumeNameBuffer)); - md5.Update(reinterpret_cast<const unsigned char *>(&SerialNumber), sizeof(SerialNumber)); - md5.Update(reinterpret_cast<const unsigned char *>(FileSystemNameBuffer), strlen(FileSystemNameBuffer)); - } - } - } - - LogicalDrivesMask >>= 1; - ++CurrentDriveLetter[0]; - } - } - } - - // ------------------------------------------------------------------------- - - void AddUserNameEntropy(BS_MD5 & md5) - { - // Benutzernamen auslesen und als Entropie nutzen. - DWORD UserNameLength = UNLEN + 1; - CHAR UserName[UNLEN + 1]; - if (::GetUserNameA(UserName, &UserNameLength)) - { - md5.Update(reinterpret_cast<const unsigned char *>(&UserName[0]), strlen(UserName)); - } - } - - // ------------------------------------------------------------------------- - - void AddOSVersionEntropy(BS_MD5 & md5) - { - // Windows-Version auslesen und in die Einzelkomponenten MajorVersion, MinorVersion und Build aufspalten. - DWORD VersionInfo = ::GetVersion(); - - DWORD MajorVersion = (DWORD)(LOBYTE(LOWORD(VersionInfo))); - DWORD MinorVersion = (DWORD)(HIBYTE(LOWORD(VersionInfo))); - DWORD Build = 0; - if (VersionInfo < 0x80000000) Build = (DWORD)(HIWORD(VersionInfo)); - - // Diese drei Informationen als Entropie nutzen. - md5.Update(reinterpret_cast<const unsigned char *>(&MajorVersion), sizeof(DWORD)); - md5.Update(reinterpret_cast<const unsigned char *>(&MinorVersion), sizeof(DWORD)); - md5.Update(reinterpret_cast<const unsigned char *>(&Build), sizeof(DWORD)); - } -} - -// ----------------------------------------------------------------------------- - -unsigned int BS_WinCodeGenerator::GetSystemID() -{ - BS_MD5 md5; - - AddedFixedDrivesEntropy(md5); - AddUserNameEntropy(md5); - AddOSVersionEntropy(md5); - - unsigned char Digest[16]; - md5.GetDigest(Digest); - - return (Digest[3] << 24) + (Digest[2] << 16) + (Digest[1] << 8) + Digest[0]; -} |