From 060c79fc208fdd3dd25f1d0f9219806b9afdb749 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Thu, 5 Jan 2023 10:27:16 +0300 Subject: [PATCH] Remove electronic registration --- CMakeLists.txt | 2 -- src/electronic_registration.cc | 50 ---------------------------------- src/electronic_registration.h | 10 ------- src/game.cc | 2 -- 4 files changed, 64 deletions(-) delete mode 100644 src/electronic_registration.cc delete mode 100644 src/electronic_registration.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ca89118..0ea1be8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,8 +83,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC "src/display_monitor.h" "src/draw.cc" "src/draw.h" - "src/electronic_registration.cc" - "src/electronic_registration.h" "src/elevator.cc" "src/elevator.h" "src/endgame.cc" diff --git a/src/electronic_registration.cc b/src/electronic_registration.cc deleted file mode 100644 index 9584db6..0000000 --- a/src/electronic_registration.cc +++ /dev/null @@ -1,50 +0,0 @@ -#include "electronic_registration.h" - -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#include "platform_compat.h" -#include "settings.h" - -namespace fallout { - -// 0x440DD0 -void runElectronicRegistration() -{ - int timesRun = settings.system.times_run; - if (timesRun > 0 && timesRun < 5) { -#ifdef _WIN32 - char path[COMPAT_MAX_PATH]; - if (GetModuleFileNameA(NULL, path, sizeof(path)) != 0) { - char* pch = strrchr(path, '\\'); - if (pch == NULL) { - pch = path; - } - - strcpy(pch, "\\ereg"); - - STARTUPINFOA startupInfo; - memset(&startupInfo, 0, sizeof(startupInfo)); - startupInfo.cb = sizeof(startupInfo); - - PROCESS_INFORMATION processInfo; - - // FIXME: Leaking processInfo.hProcess and processInfo.hThread: - // https://docs.microsoft.com/en-us/cpp/code-quality/c6335. - if (CreateProcessA("ereg\\reg32a.exe", NULL, NULL, NULL, FALSE, 0, NULL, path, &startupInfo, &processInfo)) { - WaitForSingleObject(processInfo.hProcess, INFINITE); - } - } -#endif - - settings.system.times_run = timesRun + 1; - } else { - if (timesRun == 0) { - settings.system.times_run = 1; - } - } -} - -} // namespace fallout diff --git a/src/electronic_registration.h b/src/electronic_registration.h deleted file mode 100644 index 90dd5bc..0000000 --- a/src/electronic_registration.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef ELECTRONIC_REGISTRATION_H -#define ELECTRONIC_REGISTRATION_H - -namespace fallout { - -void runElectronicRegistration(); - -} // namespace fallout - -#endif /* ELECTRONIC_REGISTRATION_H */ diff --git a/src/game.cc b/src/game.cc index 60099ac..9fca014 100644 --- a/src/game.cc +++ b/src/game.cc @@ -25,7 +25,6 @@ #include "debug.h" #include "display_monitor.h" #include "draw.h" -#include "electronic_registration.h" #include "endgame.h" #include "font_manager.h" #include "game_dialog.h" @@ -155,7 +154,6 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4 // it should be initialized early in the process. messageListRepositoryInit(); - runElectronicRegistration(); programWindowSetTitle(windowTitle); _initWindow(1, a4); paletteInit();