ReactOS 0.4.15-dev-8339-g4028de8
winmain.cpp
Go to the documentation of this file.
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
16LPCWSTR szWindowClass = L"ROSAPPMGR2";
17
21
22BEGIN_OBJECT_MAP(ObjectMap)
24
27
29wWinMain(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
38 {
40 }
41
43
44 BOOL bIsFirstLaunch = !LoadSettings(&SettingsInfo);
45 if (bIsFirstLaunch)
46 {
48 }
49
50 InitLogs();
52 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); // Give UI higher priority than background threads
53
54 // parse cmd-line and perform the corresponding operation
56
57 Gdiplus::GdiplusShutdown(gdiplusToken);
58 gModule.Term();
59
60 return bSuccess ? 0 : 1;
61}
void LoadSettings(void)
Definition: settings.c:53
VOID InitLogs()
Definition: misc.cpp:177
VOID FillDefaultSettings(PSETTINGS_INFO pSettingsInfo)
Definition: settings.cpp:179
HINSTANCE hInstance
Definition: charmap.c:19
void Term()
Definition: atlbase.h:916
HRESULT Init(_ATL_OBJMAP_ENTRY *p, HINSTANCE, const GUID *plibid)
Definition: atlbase.h:886
VOID WINAPI InitCommonControls(void)
Definition: commctrl.c:863
#define NULL
Definition: types.h:112
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
BOOL WINAPI SetThreadPriority(IN HANDLE hThread, IN int nPriority)
Definition: thread.c:700
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1374
static BOOLEAN bSuccess
Definition: drive.cpp:477
unsigned int BOOL
Definition: ntddk_ex.h:94
#define END_OBJECT_MAP()
Definition: atlcom.h:691
#define BEGIN_OBJECT_MAP(x)
Definition: atlcom.h:689
#define L(x)
Definition: ntvdm.h:50
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_HEBREW
Definition: nls.h:67
#define SUBLANG_DEFAULT
Definition: nls.h:168
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOL ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
Definition: unattended.cpp:327
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1691
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1148
#define THREAD_PRIORITY_ABOVE_NORMAL
Definition: winbase.h:275
#define WINAPI
Definition: msvc.h:6
#define LAYOUT_RTL
Definition: wingdi.h:1371
CAtlWinModule gWinModule
Definition: winmain.cpp:26
HINSTANCE hInst
Definition: winmain.cpp:19
HWND hMainWnd
Definition: winmain.cpp:18
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nShowCmd)
Definition: winmain.cpp:29
CComModule gModule
Definition: winmain.cpp:25
LPCWSTR szWindowClass
Definition: winmain.cpp:16
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:20
#define SW_SHOWNORMAL
Definition: winuser.h:770
WCHAR * LPWSTR
Definition: xmlstorage.h:184
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185