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 18 HWND hMainWnd; 19 HINSTANCE hInst; 20 SETTINGS_INFO SettingsInfo; 21 22 BEGIN_OBJECT_MAP(ObjectMap) 23 END_OBJECT_MAP() 24 25 CComModule gModule; 26 CAtlWinModule gWinModule; 27 28 INT WINAPI 29 wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nShowCmd) 30 { 31 Gdiplus::GdiplusStartupInput gdiplusStartupInput; 32 ULONG_PTR gdiplusToken; 33 34 gModule.Init(ObjectMap, hInstance, NULL); 35 Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); 36 37 if (GetUserDefaultUILanguage() == MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT)) 38 { 39 SetProcessDefaultLayout(LAYOUT_RTL); 40 } 41 42 hInst = hInstance; 43 44 BOOL bIsFirstLaunch = !LoadSettings(&SettingsInfo); 45 if (bIsFirstLaunch) 46 { 47 FillDefaultSettings(&SettingsInfo); 48 } 49 50 InitLogs(); 51 InitCommonControls(); 52 53 // parse cmd-line and perform the corresponding operation 54 BOOL bSuccess = ParseCmdAndExecute(GetCommandLineW(), bIsFirstLaunch, SW_SHOWNORMAL); 55 56 Gdiplus::GdiplusShutdown(gdiplusToken); 57 gModule.Term(); 58 59 return bSuccess ? 0 : 1; 60 } 61