1 /* 2 * PROJECT: ReactOS Applications Manager 3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later) 4 * PURPOSE: Main program 5 * COPYRIGHT: Copyright 2009 Dmitry Chapyshev (dmitry@reactos.org) 6 * Copyright 2015 Ismael Ferreras Morezuelas (swyterzone+ros@gmail.com) 7 * Copyright 2017 Alexander Shaposhnikov (sanchaez@reactos.org) 8 */ 9 #include "rapps.h" 10 #include "unattended.h" 11 #include "winmain.h" 12 #include <atlcom.h> 13 #include <gdiplus.h> 14 #include <conutils.h> 15 16 LPCWSTR szWindowClass = L"ROSAPPMGR2"; 17 LONG g_Busy = 0; 18 19 HWND hMainWnd; 20 HINSTANCE hInst; 21 SETTINGS_INFO SettingsInfo; 22 23 BEGIN_OBJECT_MAP(ObjectMap) 24 END_OBJECT_MAP() 25 26 CComModule gModule; 27 CAtlWinModule gWinModule; 28 29 INT WINAPI 30 wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nShowCmd) 31 { 32 Gdiplus::GdiplusStartupInput gdiplusStartupInput; 33 ULONG_PTR gdiplusToken; 34 35 gModule.Init(ObjectMap, hInstance, NULL); 36 Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); 37 38 if (GetUserDefaultUILanguage() == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT)) 39 { 40 SetProcessDefaultLayout(LAYOUT_RTL); 41 } 42 43 hInst = hInstance; 44 BOOL bIsFirstLaunch = !LoadSettings(&SettingsInfo); 45 46 InitLogs(); 47 InitCommonControls(); 48 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); // Give UI higher priority than background threads 49 50 // parse cmd-line and perform the corresponding operation 51 BOOL bSuccess = ParseCmdAndExecute(GetCommandLineW(), bIsFirstLaunch, SW_SHOWNORMAL); 52 53 Gdiplus::GdiplusShutdown(gdiplusToken); 54 gModule.Term(); 55 56 return bSuccess ? 0 : 1; 57 } 58