[UTILMAN] Move most of the code in a library (#2530)

Windows XP and Server 2003 Utility Manager has a dedicated library for the resources and other stuff. Utility Manager is just a simple process that loads it. Hence create a library for the program, UManDlg.dll, and move the resources and other stuff there.

In addition to that, use ExtractIconW to get the icon resource from the program (the DLL doesn't share icons by default) and remove the icon resource from the "About" dialog window. Also change the encoding type of other translation files to UTF-8 (which were previously set with UTF-8 with BOM).
This commit is contained in:
Bișoc George 2020-04-17 12:42:47 +02:00 committed by GitHub
parent 963d39bf66
commit 975d417b34
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 466 additions and 290 deletions

View file

@ -0,0 +1,68 @@
/*
* PROJECT: ReactOS Utility Manager (Accessibility)
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Main dialog code file
* COPYRIGHT: Copyright 2019-2020 Bișoc George (fraizeraust99 at gmail dot com)
*/
/* INCLUDES *******************************************************************/
#include "precomp.h"
/* FUNCTIONS ******************************************************************/
/**
* @wWinMain
*
* Application entry point.
*
* @param[in] hInstance
* Application instance.
*
* @param[in] hPrevInstance
* The previous instance of the application (not used).
*
* @param[in] pCmdLine
* Pointer to a command line argument (in wide string -- not used).
*
* @param[in] nCmdShow
* An integer served as a flag to note how the application will be shown (not used).
*
* @return
* Returns 0 to let the function terminating before it enters in the message loop.
*
*/
INT WINAPI wWinMain(IN HINSTANCE hInstance,
IN HINSTANCE hPrevInstance,
IN LPWSTR pCmdLine,
IN INT nCmdShow)
{
HMODULE hModule;
WCHAR wszFormat[MAX_BUFFER];
WCHAR wszFailLoad[MAX_BUFFER];
WCHAR wszTitle[MAX_BUFFER];
EXECDLGROUTINE UManStartDlg;
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(pCmdLine);
UNREFERENCED_PARAMETER(nCmdShow);
/* Load the main resources module of Utility Manager */
hModule = LoadLibraryW(L"UManDlg.dll");
if (!hModule)
{
LoadStringW(hInstance, IDS_FAIL_INIT, wszFormat, _countof(wszFormat));
LoadStringW(hInstance, IDS_FAIL_INIT_TITLE, wszTitle, _countof(wszTitle));
StringCchPrintfW(wszFailLoad, _countof(wszFailLoad), wszFormat, GetLastError());
MessageBoxW(GetDesktopWindow(), wszFailLoad, wszTitle, MB_ICONERROR | MB_OK);
return -1;
}
/* Get the function address and launch Utility Manager */
UManStartDlg = (EXECDLGROUTINE)GetProcAddress(hModule, "UManStartDlg");
UManStartDlg();
FreeLibrary(hModule);
return 0;
}