ReactOS 0.4.17-dev-573-g8315b8c
welcome.c File Reference
#include <stdarg.h>
#include <tchar.h>
#include <windef.h>
#include <winbase.h>
#include <wingdi.h>
#include <winnls.h>
#include <winuser.h>
#include <shellapi.h>
#include <strsafe.h>
#include <reactos/buildno.h>
#include "resource.h"
Include dependency graph for welcome.c:

Go to the source code of this file.

Classes

struct  _TOPIC
 

Macros

#define LIGHT_BLUE   RGB(214, 239, 247)
 
#define DARK_BLUE   RGB(107, 123, 140)
 
#define TITLE_WIDTH   480
 
#define TITLE_HEIGHT   93
 
#define BUFFER_SIZE   1024
 
#define TOPIC_TITLE_LENGTH   80
 
#define TOPIC_DESC_LENGTH   1024
 
#define TOPIC_BTN_ID_BASE   100
 
#define MAX_NUMBER_INTERNAL_TOPICS   3
 

Typedefs

typedef struct _TOPIC TOPIC
 
typedef struct _TOPICPTOPIC
 

Functions

INT_PTR CALLBACK MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT GetLocaleName (IN LCID Locale, OUT LPTSTR lpLCData, IN SIZE_T cchData)
 
VOID TranslateEscapes (IN OUT LPTSTR lpString)
 
static BOOL ExpandInstallerPath (_In_ PCTSTR pInstallerName, _Out_writes_z_(PathSize) PTSTR pInstallerPath, _In_ SIZE_T PathSize)
 Expands the path for the ReactOS Installer "reactos.exe". See also base/system/userinit/livecd.c!ExpandInstallerPath()
 
VOID InitializeTopicList (VOID)
 
PTOPIC AddNewTopic (VOID)
 
PTOPIC AddNewTopicEx (IN LPTSTR szText OPTIONAL, IN LPTSTR szTitle OPTIONAL, IN LPTSTR szDesc OPTIONAL, IN LPTSTR szCommand OPTIONAL, IN LPTSTR szArgs OPTIONAL, IN LPTSTR szAction OPTIONAL)
 
static VOID LoadLocalizedResourcesInternal (VOID)
 
static BOOL LoadLocalizedResourcesFromINI (LCID Locale, LPTSTR lpResPath)
 
static VOID LoadConfiguration (VOID)
 
static VOID FreeResources (VOID)
 
int WINAPI _tWinMain (HINSTANCE hInst, HINSTANCE hPrevInstance, LPTSTR lpszCmdLine, int nCmdShow)
 
INT_PTR CALLBACK ButtonSubclassWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static BOOL RunAction (INT nTopic)
 
static DWORD GetButtonHeight (HDC hDC, HFONT hFont, LPCTSTR szText, DWORD dwWidth)
 
static LRESULT OnCreate (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnCommand (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static VOID PaintBanner (HDC hdc, LPRECT rcPanel)
 
static LRESULT OnPaint (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnDrawItem (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnMouseMove (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnCtlColorStatic (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnActivate (HWND hWnd, WPARAM wParam, LPARAM lParam)
 
static LRESULT OnDestroy (HWND hWnd, WPARAM wParam, LPARAM lParam)
 

Variables

TCHAR szWindowClass [] = TEXT("WelcomeWindowClass")
 
TCHAR szAppTitle [80]
 
HINSTANCE hInstance
 
HWND hWndMain = NULL
 
HWND hWndCheckButton = NULL
 
HWND hWndCloseButton = NULL
 
BOOL bDisplayCheckBox = FALSE
 
BOOL bDisplayExitBtn = TRUE
 
DWORD dwNumberTopics = 0
 
PTOPICpTopics = NULL
 
WNDPROC fnOldBtn
 
TCHAR szDefaultTitle [TOPIC_TITLE_LENGTH]
 
TCHAR szDefaultDesc [TOPIC_DESC_LENGTH]
 
INT nTopic = -1
 
INT nDefaultTopic = -1
 
HDC hdcMem = NULL
 
HBITMAP hTitleBitmap = NULL
 
HBITMAP hDefaultTopicBitmap = NULL
 
HFONT hFontTopicButton
 
HFONT hFontTopicTitle
 
HFONT hFontTopicDescription
 
HFONT hFontCheckButton
 
HBRUSH hbrLightBlue
 
HBRUSH hbrDarkBlue
 
RECT rcTitlePanel
 
RECT rcLeftPanel
 
RECT rcRightPanel
 

Macro Definition Documentation

◆ BUFFER_SIZE

#define BUFFER_SIZE   1024

Definition at line 68 of file welcome.c.

◆ DARK_BLUE

#define DARK_BLUE   RGB(107, 123, 140)

Definition at line 48 of file welcome.c.

◆ LIGHT_BLUE

#define LIGHT_BLUE   RGB(214, 239, 247)

Definition at line 47 of file welcome.c.

◆ MAX_NUMBER_INTERNAL_TOPICS

#define MAX_NUMBER_INTERNAL_TOPICS   3

◆ TITLE_HEIGHT

#define TITLE_HEIGHT   93

Definition at line 51 of file welcome.c.

◆ TITLE_WIDTH

#define TITLE_WIDTH   480

Definition at line 50 of file welcome.c.

◆ TOPIC_BTN_ID_BASE

#define TOPIC_BTN_ID_BASE   100

Definition at line 99 of file welcome.c.

◆ TOPIC_DESC_LENGTH

#define TOPIC_DESC_LENGTH   1024

Definition at line 71 of file welcome.c.

◆ TOPIC_TITLE_LENGTH

#define TOPIC_TITLE_LENGTH   80

Definition at line 70 of file welcome.c.

Typedef Documentation

◆ PTOPIC

typedef struct _TOPIC * PTOPIC

◆ TOPIC

typedef struct _TOPIC TOPIC

Function Documentation

◆ _tWinMain()

int WINAPI _tWinMain ( HINSTANCE  hInst,
HINSTANCE  hPrevInstance,
LPTSTR  lpszCmdLine,
int  nCmdShow 
)

Definition at line 753 of file welcome.c.

757{
759 WNDCLASSEX wndclass;
760 MSG msg;
761 HWND hWndFocus;
762 INT xPos, yPos;
763 INT xWidth, yHeight;
764 RECT rcWindow;
765 HICON hMainIcon;
766 HMENU hSystemMenu;
769
770 BITMAP BitmapInfo;
771 ULONG ulInnerWidth = TITLE_WIDTH;
772 ULONG ulInnerHeight = (TITLE_WIDTH * 3) / 4;
773 ULONG ulTitleHeight = TITLE_HEIGHT + 3;
774
775 UNREFERENCED_PARAMETER(hPrevInstance);
776 UNREFERENCED_PARAMETER(lpszCmdLine);
777
778 /* Ensure only one instance is running */
781 {
782 /* If already started, find its window */
784
785 /* Activate window */
788
789 /* Close the mutex handle and quit */
791 return 0;
792 }
793
794#if 0
795 /* Mirroring is enabled from within the resources */
796 switch (GetUserDefaultUILanguage())
797 {
800 break;
801
802 default:
803 break;
804 }
805#endif
806
808
809 /* Load icons */
811
812 /* Register the window class */
813 wndclass.cbSize = sizeof(wndclass);
814 wndclass.style = CS_HREDRAW | CS_VREDRAW;
815 wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
816 wndclass.cbClsExtra = 0;
817 wndclass.cbWndExtra = 0;
818 wndclass.hInstance = hInstance;
819 wndclass.hIcon = hMainIcon;
820 wndclass.hIconSm = NULL;
821 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
822 wndclass.hbrBackground = NULL;
823 wndclass.lpszMenuName = NULL;
824 wndclass.lpszClassName = szWindowClass;
825
826 RegisterClassEx(&wndclass);
827
828 /* Load the banner bitmap, and compute the window dimensions */
830 if (hTitleBitmap)
831 {
832 GetObject(hTitleBitmap, sizeof(BitmapInfo), &BitmapInfo);
833 ulInnerWidth = BitmapInfo.bmWidth;
834 ulInnerHeight = (ulInnerWidth * 3) / 4;
835 ulTitleHeight = BitmapInfo.bmHeight + 3;
837 }
838 ulInnerHeight -= GetSystemMetrics(SM_CYCAPTION);
839
840 rcWindow.top = 0;
841 rcWindow.bottom = ulInnerHeight - 1;
842 rcWindow.left = 0;
843 rcWindow.right = ulInnerWidth - 1;
844
845 AdjustWindowRect(&rcWindow, dwStyle, FALSE);
846 xWidth = rcWindow.right - rcWindow.left;
847 yHeight = rcWindow.bottom - rcWindow.top;
848
849 /* Compute the window position */
850 xPos = (GetSystemMetrics(SM_CXSCREEN) - xWidth) / 2;
851 yPos = (GetSystemMetrics(SM_CYSCREEN) - yHeight) / 2;
852
853 rcTitlePanel.top = 0;
854 rcTitlePanel.bottom = ulTitleHeight;
855 rcTitlePanel.left = 0;
856 rcTitlePanel.right = ulInnerWidth - 1;
857
859 rcLeftPanel.bottom = ulInnerHeight - 1;
860 rcLeftPanel.left = 0;
861 rcLeftPanel.right = ulInnerWidth / 3;
862
866 rcRightPanel.right = ulInnerWidth - 1;
867
868 /* Load the configuration and the resources */
870
871 /* Create main window */
874 dwStyle,
875 xPos,
876 yPos,
877 xWidth,
878 yHeight,
879 0,
880 0,
881 hInstance,
882 NULL);
883
884 hSystemMenu = GetSystemMenu(hWndMain, FALSE);
885 if (hSystemMenu)
886 {
887 RemoveMenu(hSystemMenu, SC_SIZE, MF_BYCOMMAND);
888 RemoveMenu(hSystemMenu, SC_MAXIMIZE, MF_BYCOMMAND);
889 }
890
891 ShowWindow(hWndMain, nCmdShow);
893
894 while (GetMessage(&msg, NULL, 0, 0) != FALSE)
895 {
896 /* Check for ENTER key presses */
897 if (msg.message == WM_KEYDOWN && msg.wParam == VK_RETURN)
898 {
899 /*
900 * The user pressed the ENTER key. Retrieve the handle to the
901 * child window that has the keyboard focus, and send it a
902 * WM_COMMAND message.
903 */
904 hWndFocus = GetFocus();
905 if (hWndFocus)
906 {
908 (WPARAM)GetDlgCtrlID(hWndFocus), (LPARAM)hWndFocus);
909 }
910 }
911 /* Allow using keyboard navigation */
912 else if (!IsDialogMessage(hWndMain, &msg))
913 {
916 }
917 }
918
919 /* Cleanup */
921
922 /* Close the mutex handle and quit */
924 return msg.wParam;
925}
#define msg(x)
Definition: auth_time.c:54
#define IDI_MAIN
Definition: resource.h:4
#define IDB_TITLE_BITMAP
Definition: resource.h:40
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
LANGID WINAPI GetUserDefaultUILanguage(void)
Definition: locale.c:1380
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
HANDLE hMutex
Definition: mutex.c:11
static HICON
Definition: imagelist.c:80
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329
#define MAKEINTRESOURCE(i)
Definition: ntverrsrc.c:25
#define WS_CAPTION
Definition: pedump.c:624
#define WS_OVERLAPPED
Definition: pedump.c:615
#define WS_SYSMENU
Definition: pedump.c:629
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WS_CLIPCHILDREN
Definition: pedump.c:619
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define MAKELANGID(p, s)
Definition: nls.h:15
#define LANG_HEBREW
Definition: nls.h:67
#define SUBLANG_DEFAULT
Definition: nls.h:168
int cbClsExtra
Definition: winuser.h:3312
HINSTANCE hInstance
Definition: winuser.h:3314
HCURSOR hCursor
Definition: winuser.h:3316
LPCSTR lpszMenuName
Definition: winuser.h:3318
HICON hIconSm
Definition: winuser.h:3320
UINT style
Definition: winuser.h:3310
int cbWndExtra
Definition: winuser.h:3313
UINT cbSize
Definition: winuser.h:3309
WNDPROC lpfnWndProc
Definition: winuser.h:3311
LPCSTR lpszClassName
Definition: winuser.h:3319
HICON hIcon
Definition: winuser.h:3315
HBRUSH hbrBackground
Definition: winuser.h:3317
LONG bmHeight
Definition: wingdi.h:1869
LONG bmWidth
Definition: wingdi.h:1868
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
HWND hWndMain
Definition: welcome.c:60
TCHAR szWindowClass[]
Definition: welcome.c:55
RECT rcLeftPanel
Definition: welcome.c:117
HINSTANCE hInstance
Definition: welcome.c:58
#define TITLE_WIDTH
Definition: welcome.c:50
static VOID FreeResources(VOID)
Definition: welcome.c:710
#define TITLE_HEIGHT
Definition: welcome.c:51
RECT rcRightPanel
Definition: welcome.c:118
static VOID LoadConfiguration(VOID)
Definition: welcome.c:638
HBITMAP hTitleBitmap
Definition: welcome.c:105
TCHAR szAppTitle[80]
Definition: welcome.c:56
INT_PTR CALLBACK MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1599
RECT rcTitlePanel
Definition: welcome.c:116
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1713
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateMutex
Definition: winbase.h:3477
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define GetObject
Definition: wingdi.h:4914
#define SW_SHOWNORMAL
Definition: winuser.h:781
HWND WINAPI GetFocus(void)
Definition: window.c:1887
#define CS_VREDRAW
Definition: winuser.h:666
#define MF_BYCOMMAND
Definition: winuser.h:202
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define SM_CYSCREEN
Definition: winuser.h:971
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define IsDialogMessage
Definition: winuser.h:5975
#define FindWindow
Definition: winuser.h:5943
#define LoadBitmap
Definition: winuser.h:5977
#define WM_COMMAND
Definition: winuser.h:1768
#define CS_HREDRAW
Definition: winuser.h:661
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define IDC_ARROW
Definition: winuser.h:695
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
#define CreateWindow
Definition: winuser.h:5920
#define SC_SIZE
Definition: winuser.h:2620
#define GetMessage
Definition: winuser.h:5956
#define RegisterClassEx
Definition: winuser.h:6003
#define VK_RETURN
Definition: winuser.h:2237
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadIcon
Definition: winuser.h:5979
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SendMessage
Definition: winuser.h:6009
#define LoadCursor
Definition: winuser.h:5978
int WINAPI GetDlgCtrlID(_In_ HWND)
#define SM_CXSCREEN
Definition: winuser.h:970
#define WM_KEYDOWN
Definition: winuser.h:1743
#define DispatchMessage
Definition: winuser.h:5931
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:3014
#define SM_CYCAPTION
Definition: winuser.h:974
int WINAPI GetSystemMetrics(_In_ int)
#define SC_MAXIMIZE
Definition: winuser.h:2624

◆ AddNewTopic()

PTOPIC AddNewTopic ( VOID  )

Definition at line 338 of file welcome.c.

339{
340 PTOPIC pTopic, *pTopicsTmp;
341
342 /* Allocate (or reallocate) the list of topics */
343 if (!pTopics)
344 pTopicsTmp = HeapAlloc(GetProcessHeap(), 0, (dwNumberTopics + 1) * sizeof(*pTopics));
345 else
346 pTopicsTmp = HeapReAlloc(GetProcessHeap(), 0, pTopics, (dwNumberTopics + 1) * sizeof(*pTopics));
347 if (!pTopicsTmp)
348 return NULL; // Cannot reallocate more
349 pTopics = pTopicsTmp;
350
351 /* Allocate a new topic entry */
352 pTopic = HeapAlloc(GetProcessHeap(), 0, sizeof(*pTopic));
353 if (!pTopic)
354 return NULL; // Cannot reallocate more
355 pTopics[dwNumberTopics++] = pTopic;
356
357 /* Return the allocated topic entry */
358 return pTopic;
359}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
Definition: welcome.c:74
PTOPIC * pTopics
Definition: welcome.c:92
DWORD dwNumberTopics
Definition: welcome.c:91

Referenced by AddNewTopicEx().

◆ AddNewTopicEx()

PTOPIC AddNewTopicEx ( IN LPTSTR szText  OPTIONAL,
IN LPTSTR szTitle  OPTIONAL,
IN LPTSTR szDesc  OPTIONAL,
IN LPTSTR szCommand  OPTIONAL,
IN LPTSTR szArgs  OPTIONAL,
IN LPTSTR szAction  OPTIONAL 
)

Definition at line 362 of file welcome.c.

369{
370 PTOPIC pTopic = AddNewTopic();
371 if (!pTopic)
372 return NULL;
373
374 if (szText && *szText)
375 StringCchCopy(pTopic->szText, ARRAYSIZE(pTopic->szText), szText);
376 else
377 *pTopic->szText = 0;
378
379 if (szTitle && *szTitle)
380 StringCchCopy(pTopic->szTitle, ARRAYSIZE(pTopic->szTitle), szTitle);
381 else
382 *pTopic->szTitle = 0;
383
384 if (szDesc && *szDesc)
385 {
386 StringCchCopy(pTopic->szDesc, ARRAYSIZE(pTopic->szDesc), szDesc);
387 TranslateEscapes(pTopic->szDesc);
388 }
389 else
390 {
391 *pTopic->szDesc = 0;
392 }
393
394 if (szCommand && *szCommand)
395 {
396 pTopic->bIsCommand = TRUE;
397
398 /* Check for special applications: ReactOS Installer */
399 if (_tcsicmp(szCommand, TEXT("reactos.exe")) == 0)
400 {
401 ExpandInstallerPath(szCommand, pTopic->szCommand, ARRAYSIZE(pTopic->szCommand));
402 }
403 else
404 {
405 /* Expand any environment string in the command line */
407 if (dwSize <= ARRAYSIZE(pTopic->szCommand))
408 ExpandEnvironmentStringsW(szCommand, pTopic->szCommand, ARRAYSIZE(pTopic->szCommand));
409 else
410 StringCchCopy(pTopic->szCommand, ARRAYSIZE(pTopic->szCommand), szCommand);
411 }
412 }
413 else
414 {
415 pTopic->bIsCommand = FALSE;
416 *pTopic->szCommand = 0;
417 }
418
419 /* Only care about command arguments if we actually have a command */
420 if (*pTopic->szCommand)
421 {
422 if (szArgs && *szArgs)
423 {
424 StringCchCopy(pTopic->szArgs, ARRAYSIZE(pTopic->szArgs), szArgs);
425 }
426 else
427 {
428 /* Check for special applications: ReactOS Shell */
429 if (/* pTopic->szCommand && */ *pTopic->szCommand &&
430 _tcsicmp(pTopic->szCommand, TEXT("explorer.exe")) == 0)
431 {
432#if 0
433 TCHAR CurrentDir[MAX_PATH];
434 GetCurrentDirectory(ARRAYSIZE(CurrentDir), CurrentDir);
435#endif
436 StringCchCopy(pTopic->szArgs, ARRAYSIZE(pTopic->szArgs), TEXT("\\"));
437 }
438 else
439 {
440 *pTopic->szArgs = 0;
441 }
442 }
443 }
444 else
445 {
446 *pTopic->szArgs = 0;
447 }
448
449 /* Only care about custom actions if we actually don't have a command */
450 if (!*pTopic->szCommand && szAction && *szAction)
451 {
452 /*
453 * Re-use the pTopic->szCommand member. We distinguish with respect to
454 * a regular command by using the pTopic->bIsCommand flag.
455 */
456 pTopic->bIsCommand = FALSE;
457 StringCchCopy(pTopic->szCommand, ARRAYSIZE(pTopic->szCommand), szAction);
459 }
460
461 return pTopic;
462}
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:492
char TCHAR
Definition: tchar.h:1402
#define _tcsicmp
Definition: tchar.h:1425
#define TEXT(s)
Definition: k32.h:28
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define StringCchCopy
Definition: strsafe.h:139
TCHAR szArgs[512]
Definition: welcome.c:88
TCHAR szTitle[TOPIC_TITLE_LENGTH]
Definition: welcome.c:85
TCHAR szCommand[512]
Definition: welcome.c:87
TCHAR szText[80]
Definition: welcome.c:84
BOOL bIsCommand
Definition: welcome.c:82
TCHAR szDesc[TOPIC_DESC_LENGTH]
Definition: welcome.c:86
PTOPIC AddNewTopic(VOID)
Definition: welcome.c:338
VOID TranslateEscapes(IN OUT LPTSTR lpString)
Definition: welcome.c:160
static BOOL ExpandInstallerPath(_In_ PCTSTR pInstallerName, _Out_writes_z_(PathSize) PTSTR pInstallerPath, _In_ SIZE_T PathSize)
Expands the path for the ReactOS Installer "reactos.exe". See also base/system/userinit/livecd....
Definition: welcome.c:219
#define GetCurrentDirectory
Definition: winbase.h:3526

Referenced by LoadLocalizedResourcesFromINI(), and LoadLocalizedResourcesInternal().

◆ ButtonSubclassWndProc()

INT_PTR CALLBACK ButtonSubclassWndProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 929 of file welcome.c.

930{
931 static WPARAM wParamOld = 0;
932 static LPARAM lParamOld = 0;
933
934 LONG i;
935
936 if (uMsg == WM_MOUSEMOVE)
937 {
938 /* Ignore mouse-move messages on the same point */
939 if ((wParam == wParamOld) && (lParam == lParamOld))
940 return 0;
941
942 /* Retrieve the topic index of this button */
944
945 /*
946 * Change the focus to this button if the current topic index differs
947 * (we will receive WM_SETFOCUS afterwards).
948 */
949 if (nTopic != i)
950 SetFocus(hWnd);
951
952 wParamOld = wParam;
953 lParamOld = lParam;
954 }
955 else if (uMsg == WM_SETFOCUS)
956 {
957 /* Retrieve the topic index of this button */
959
960 /* Change the current topic index and repaint the description panel */
961 if (nTopic != i)
962 {
963 nTopic = i;
965 }
966 }
967 else if (uMsg == WM_KILLFOCUS)
968 {
969 /*
970 * We lost focus, either because the user changed button focus,
971 * or because the main window to which we belong went inactivated.
972 * If we are in the latter case, we ignore the focus change.
973 * If we are in the former case, we reset to the default topic.
974 */
976 {
977 nTopic = -1;
979 }
980 }
981
982 return CallWindowProc(fnOldBtn, hWnd, uMsg, wParam, lParam);
983}
HWND hWnd
Definition: settings.c:17
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
#define GetWindowLongPtr
Definition: treelist.c:73
INT nTopic
Definition: welcome.c:101
#define TOPIC_BTN_ID_BASE
Definition: welcome.c:99
WNDPROC fnOldBtn
Definition: welcome.c:94
HWND WINAPI GetForegroundWindow(void)
Definition: ntwrapper.h:392
#define CallWindowProc
Definition: winuser.h:5901
#define WM_SETFOCUS
Definition: winuser.h:1641
#define WM_MOUSEMOVE
Definition: winuser.h:1803
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:871
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define WM_KILLFOCUS
Definition: winuser.h:1642

Referenced by OnCreate().

◆ ExpandInstallerPath()

static BOOL ExpandInstallerPath ( _In_ PCTSTR  pInstallerName,
_Out_writes_z_(PathSize) PTSTR  pInstallerPath,
_In_ SIZE_T  PathSize 
)
static

Expands the path for the ReactOS Installer "reactos.exe". See also base/system/userinit/livecd.c!ExpandInstallerPath()

Definition at line 219 of file welcome.c.

223{
224 SYSTEM_INFO SystemInfo;
225 SIZE_T cchInstallerNameLen;
226 PTSTR ptr;
227 DWORD dwAttribs;
228
229 cchInstallerNameLen = _tcslen(pInstallerName);
230 if (PathSize < cchInstallerNameLen)
231 {
232 /* The buffer is not large enough to contain the installer file name */
233 *pInstallerPath = 0;
234 return FALSE;
235 }
236
237 /*
238 * First, try to find the installer using the default drive, under
239 * the directory whose name corresponds to the currently-running
240 * CPU architecture.
241 */
242 GetSystemInfo(&SystemInfo);
243
244 *pInstallerPath = 0;
245 GetModuleFileName(NULL, pInstallerPath, PathSize - cchInstallerNameLen - 1);
246 ptr = _tcschr(pInstallerPath, _T('\\'));
247 if (ptr)
248 *++ptr = 0;
249 else
250 *pInstallerPath = 0;
251
252 /* Append the corresponding CPU architecture */
253 switch (SystemInfo.wProcessorArchitecture)
254 {
256 StringCchCat(pInstallerPath, PathSize, TEXT("I386"));
257 break;
258
260 StringCchCat(pInstallerPath, PathSize, TEXT("MIPS"));
261 break;
262
264 StringCchCat(pInstallerPath, PathSize, TEXT("ALPHA"));
265 break;
266
268 StringCchCat(pInstallerPath, PathSize, TEXT("PPC"));
269 break;
270
272 StringCchCat(pInstallerPath, PathSize, TEXT("SHX"));
273 break;
274
276 StringCchCat(pInstallerPath, PathSize, TEXT("ARM"));
277 break;
278
280 StringCchCat(pInstallerPath, PathSize, TEXT("IA64"));
281 break;
282
284 StringCchCat(pInstallerPath, PathSize, TEXT("ALPHA64"));
285 break;
286
288 StringCchCat(pInstallerPath, PathSize, TEXT("AMD64"));
289 break;
290
291 // case PROCESSOR_ARCHITECTURE_MSIL: /* .NET CPU-independent code */
293 default:
295 break;
296 }
297
299 StringCchCat(pInstallerPath, PathSize, TEXT("\\"));
300 StringCchCat(pInstallerPath, PathSize, pInstallerName);
301
302 dwAttribs = GetFileAttributes(pInstallerPath);
303 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
304 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
305 {
306 /* We have found the installer */
307 return TRUE;
308 }
309
310 /*
311 * We failed. Try to find the installer from either the current
312 * ReactOS installation directory, or from our current directory.
313 */
314 *pInstallerPath = 0;
315 if (GetWindowsDirectory(pInstallerPath, PathSize - cchInstallerNameLen - 1))
316 StringCchCat(pInstallerPath, PathSize, TEXT("\\"));
317 StringCchCat(pInstallerPath, PathSize, pInstallerName);
318
319 dwAttribs = GetFileAttributes(pInstallerPath);
320 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
321 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
322 {
323 /* We have found the installer */
324 return TRUE;
325 }
326
327 /* Installer not found */
328 *pInstallerPath = 0;
329 return FALSE;
330}
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
#define _tcslen
Definition: tchar.h:626
#define _tcschr
Definition: tchar.h:1406
static PVOID ptr
Definition: dispmode.c:27
#define PROCESSOR_ARCHITECTURE_IA64
Definition: ketypes.h:111
#define PROCESSOR_ARCHITECTURE_ALPHA64
Definition: ketypes.h:112
#define PROCESSOR_ARCHITECTURE_ALPHA
Definition: ketypes.h:107
#define PROCESSOR_ARCHITECTURE_ARM
Definition: ketypes.h:110
#define PROCESSOR_ARCHITECTURE_UNKNOWN
Definition: ketypes.h:115
#define PROCESSOR_ARCHITECTURE_SHX
Definition: ketypes.h:109
#define PROCESSOR_ARCHITECTURE_MIPS
Definition: ketypes.h:106
#define PROCESSOR_ARCHITECTURE_PPC
Definition: ketypes.h:108
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
LPSTR PTSTR
Definition: ntbasedef.h:499
#define StringCchCat
Definition: strsafe.h:317
WORD wProcessorArchitecture
Definition: winbase.h:894
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define INVALID_FILE_ATTRIBUTES
Definition: vfdcmd.c:23
#define _T(x)
Definition: vfdio.h:22
#define GetWindowsDirectory
Definition: winbase.h:3578
#define GetFileAttributes
Definition: winbase.h:3536
#define GetModuleFileName
Definition: winbase.h:3552

Referenced by AddNewTopicEx().

◆ FreeResources()

static VOID FreeResources ( VOID  )
static

Definition at line 710 of file welcome.c.

711{
712 if (!pTopics)
713 return;
714
715 while (dwNumberTopics--)
716 {
719 }
721 pTopics = NULL;
722 dwNumberTopics = 0;
723}
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by _tWinMain().

◆ GetButtonHeight()

static DWORD GetButtonHeight ( HDC  hDC,
HFONT  hFont,
LPCTSTR  szText,
DWORD  dwWidth 
)
static

Definition at line 1025 of file welcome.c.

1029{
1030 HFONT hOldFont;
1031 RECT rect;
1032
1033 rect.left = 0;
1034 rect.right = dwWidth - 20;
1035 rect.top = 0;
1036 rect.bottom = 25;
1037
1038 hOldFont = (HFONT)SelectObject(hDC, hFont);
1039 DrawText(hDC, szText, -1, &rect, DT_TOP | DT_CALCRECT | DT_WORDBREAK);
1040 SelectObject(hDC, hOldFont);
1041
1042 return (rect.bottom-rect.top + 14);
1043}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
RECT rect
Definition: combotst.c:67
static const WCHAR dwWidth[]
Definition: provider.c:62
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DrawText
Definition: winuser.h:5937
#define DT_TOP
Definition: winuser.h:542
#define DT_WORDBREAK
Definition: winuser.h:544
#define DT_CALCRECT
Definition: winuser.h:526

Referenced by OnCreate().

◆ GetLocaleName()

INT GetLocaleName ( IN LCID  Locale,
OUT LPTSTR  lpLCData,
IN SIZE_T  cchData 
)

Definition at line 127 of file welcome.c.

128{
129 INT cchRet, cchRet2;
130
131 /* Try to retrieve the locale language name (LOCALE_SNAME is supported on Vista+) */
132 cchRet = GetLocaleInfo(Locale, LOCALE_SNAME, lpLCData, cchData);
133 if (cchRet || (GetLastError() != ERROR_INVALID_FLAGS))
134 return cchRet;
135
136 /*
137 * We failed because LOCALE_SNAME was unrecognized, so try to manually build
138 * a language name in the form xx-YY (WARNING: this method has its limitations).
139 */
140 cchRet = GetLocaleInfo(Locale, LOCALE_SISO639LANGNAME, lpLCData, cchData);
141 if (cchRet <= 1)
142 return cchRet;
143
144 lpLCData += (cchRet - 1);
145 cchData -= (cchRet - 1);
146 if (cchData <= 1)
147 return cchRet;
148
149 /* Try to get the second part; we add the '-' separator only if we succeed */
150 cchRet2 = GetLocaleInfo(Locale, LOCALE_SISO3166CTRYNAME, lpLCData + 1, cchData - 1);
151 if (cchRet2 <= 1)
152 return cchRet;
153 cchRet += cchRet2; // 'cchRet' already counts '-'.
154
155 *lpLCData = _T('-');
156
157 return cchRet;
158}
#define ERROR_INVALID_FLAGS
Definition: winerror.h:907
#define GetLocaleInfo
Definition: winnls.h:1369
#define LOCALE_SNAME
Definition: winnls.h:140
#define LOCALE_SISO639LANGNAME
Definition: winnls.h:136
#define LOCALE_SISO3166CTRYNAME
Definition: winnls.h:137

Referenced by LoadLocalizedResourcesFromINI().

◆ InitializeTopicList()

VOID InitializeTopicList ( VOID  )

Definition at line 332 of file welcome.c.

333{
334 dwNumberTopics = 0;
335 pTopics = NULL;
336}

Referenced by LoadConfiguration().

◆ LoadConfiguration()

static VOID LoadConfiguration ( VOID  )
static

Definition at line 638 of file welcome.c.

639{
640 DWORD dwAttribs;
641 BOOL bLoadDefaultResources;
642 TCHAR szAppPath[MAX_PATH];
643 TCHAR szIniPath[MAX_PATH];
644 TCHAR szResPath[MAX_PATH];
645
646 /* Initialize the topic list */
648
649 /*
650 * First, try to load the default internal (localized) strings.
651 * They can be redefined by the localized INI files.
652 */
654 StringCchCopy(szAppTitle, ARRAYSIZE(szAppTitle), TEXT("ReactOS - Welcome"));
656 *szDefaultTitle = 0;
658 *szDefaultDesc = 0;
659
660 /* Retrieve the full path to this application */
661 GetModuleFileName(NULL, szAppPath, ARRAYSIZE(szAppPath));
662 if (*szAppPath)
663 {
664 LPTSTR lpFileName = _tcsrchr(szAppPath, _T('\\'));
665 if (lpFileName)
666 *lpFileName = 0;
667 else
668 *szAppPath = 0;
669 }
670
671 /* Build the full INI file path name */
672 StringCchPrintf(szIniPath, ARRAYSIZE(szIniPath), TEXT("%s\\welcome.ini"), szAppPath);
673
674 /* Verify that the file exists, otherwise use the default configuration */
675 dwAttribs = GetFileAttributes(szIniPath);
676 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
677 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
678 {
679 /* Use the default internal (localized) resources */
681 return;
682 }
683
684 /* Load the settings from the INI configuration file */
685 bDisplayCheckBox = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayCheckBox"), FALSE /* default */, szIniPath);
686 bDisplayExitBtn = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayExitButton"), TRUE /* default */, szIniPath);
687
688 /* Load the default internal (localized) resources if needed */
689 bLoadDefaultResources = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("LoadDefaultResources"), FALSE /* default */, szIniPath);
690 if (bLoadDefaultResources)
692
693 GetPrivateProfileString(TEXT("Welcome"), TEXT("ResourceDir"), TEXT("") /* default */,
694 szResPath, ARRAYSIZE(szResPath), szIniPath);
695
696 /* Set the current directory to the one of this application, and retrieve the resources */
697 SetCurrentDirectory(szAppPath);
699 {
700 /*
701 * Loading localized resources from INI file failed, try to load the
702 * internal resources only if they were not already loaded earlier.
703 */
704 if (!bLoadDefaultResources)
706 }
707}
#define IDS_APPTITLE
Definition: resource.h:3
#define IDS_DEFAULT_TOPIC_DESC
Definition: resource.h:10
#define IDS_DEFAULT_TOPIC_TITLE
Definition: resource.h:9
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _tcsrchr
Definition: tchar.h:1413
LPSTR LPTSTR
Definition: ms-dtyp.idl:131
#define LOCALE_USER_DEFAULT
#define StringCchPrintf
Definition: strsafe.h:517
VOID InitializeTopicList(VOID)
Definition: welcome.c:332
static VOID LoadLocalizedResourcesInternal(VOID)
Definition: welcome.c:465
BOOL bDisplayExitBtn
Definition: welcome.c:66
TCHAR szDefaultDesc[TOPIC_DESC_LENGTH]
Definition: welcome.c:97
static BOOL LoadLocalizedResourcesFromINI(LCID Locale, LPTSTR lpResPath)
Definition: welcome.c:516
BOOL bDisplayCheckBox
Definition: welcome.c:65
TCHAR szDefaultTitle[TOPIC_TITLE_LENGTH]
Definition: welcome.c:96
_In_ LPCSTR lpFileName
Definition: winbase.h:2800
#define SetCurrentDirectory
Definition: winbase.h:3624
#define GetPrivateProfileInt
Definition: winbase.h:3553
#define GetPrivateProfileString
Definition: winbase.h:3556
#define LoadString
Definition: winuser.h:5985

Referenced by _tWinMain().

◆ LoadLocalizedResourcesFromINI()

static BOOL LoadLocalizedResourcesFromINI ( LCID  Locale,
LPTSTR  lpResPath 
)
static

Definition at line 516 of file welcome.c.

517{
518 DWORD dwRet;
519 DWORD dwAttribs;
522 TCHAR szIniPath[MAX_PATH];
523 LPTSTR lpszSections = NULL, lpszSection = NULL;
524 LPTSTR lpszCommand, lpszAction;
525 TOPIC newTopic, *pTopic;
526
527 /* Retrieve the locale name (on which the INI file name is based) */
528 dwRet = (DWORD)GetLocaleName(Locale, szBuffer, ARRAYSIZE(szBuffer));
529 if (!dwRet)
530 {
531 /* Fall back to english (US) */
532 StringCchCopy(szBuffer, ARRAYSIZE(szBuffer), TEXT("en-US"));
533 }
534
535 /* Build the INI file name */
536 StringCchPrintf(szIniPath, ARRAYSIZE(szIniPath),
537 TEXT("%s\\%s.ini"), lpResPath, szBuffer);
538
539 /* Verify that the file exists, otherwise fall back to english (US) */
540 dwAttribs = GetFileAttributes(szIniPath);
541 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
542 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
543 {
544 StringCchCopy(szBuffer, ARRAYSIZE(szBuffer), TEXT("en-US"));
545
546 StringCchPrintf(szIniPath, ARRAYSIZE(szIniPath),
547 TEXT("%s\\%s.ini"), lpResPath, szBuffer);
548 }
549
550 /* Verify that the file exists, otherwise fall back to internal (localized) resource */
551 dwAttribs = GetFileAttributes(szIniPath);
552 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
553 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
554 {
555 return FALSE; // For localized resources, see the general function.
556 }
557
558 /* Try to load the default localized strings */
559 GetPrivateProfileString(TEXT("Defaults"), TEXT("AppTitle"), TEXT("ReactOS - Welcome") /* default */,
560 szAppTitle, ARRAYSIZE(szAppTitle), szIniPath);
561 GetPrivateProfileString(TEXT("Defaults"), TEXT("DefaultTopicTitle"), TEXT("") /* default */,
563 if (!GetPrivateProfileString(TEXT("Defaults"), TEXT("DefaultTopicDescription"), TEXT("") /* default */,
565 {
566 *szDefaultDesc = 0;
567 }
568 else
569 {
571 }
572
573 /* Allocate a buffer big enough to hold all the section names */
575 {
576 lpszSections = HeapAlloc(GetProcessHeap(), 0, dwSize * sizeof(TCHAR));
577 if (!lpszSections)
578 return TRUE; // FIXME!
579 dwRet = GetPrivateProfileSectionNames(lpszSections, dwSize, szIniPath);
580 if (dwRet < dwSize - 2)
581 break;
582 HeapFree(GetProcessHeap(), 0, lpszSections);
583 }
584
585 /* Loop over the sections and load the topics */
586 lpszSection = lpszSections;
587 for (; lpszSection && *lpszSection; lpszSection += (_tcslen(lpszSection) + 1))
588 {
589 /* Ignore everything that is not a topic */
590 if (_tcsnicmp(lpszSection, TEXT("Topic"), 5) != 0)
591 continue;
592
593 lpszCommand = NULL, lpszAction = NULL;
594
595 /* Retrieve the information */
596 GetPrivateProfileString(lpszSection, TEXT("MenuText"), TEXT("") /* default */,
597 newTopic.szText, ARRAYSIZE(newTopic.szText), szIniPath);
598 GetPrivateProfileString(lpszSection, TEXT("Title"), TEXT("") /* default */,
599 newTopic.szTitle, ARRAYSIZE(newTopic.szTitle), szIniPath);
600 GetPrivateProfileString(lpszSection, TEXT("Description"), TEXT("") /* default */,
601 newTopic.szDesc, ARRAYSIZE(newTopic.szDesc), szIniPath);
602
603 GetPrivateProfileString(lpszSection, TEXT("ConfigCommand"), TEXT("") /* default */,
604 newTopic.szCommand, ARRAYSIZE(newTopic.szCommand), szIniPath);
605
606 /* Only care about command arguments if we actually have a command */
607 if (*newTopic.szCommand)
608 {
609 lpszCommand = newTopic.szCommand;
610 GetPrivateProfileString(lpszSection, TEXT("ConfigArgs"), TEXT("") /* default */,
611 newTopic.szArgs, ARRAYSIZE(newTopic.szArgs), szIniPath);
612 }
613 /* Only care about custom actions if we actually don't have a command */
614 else // if (!*newTopic.szCommand)
615 {
616 lpszAction = newTopic.szCommand;
617 GetPrivateProfileString(lpszSection, TEXT("Action"), TEXT("") /* default */,
618 newTopic.szCommand, ARRAYSIZE(newTopic.szCommand), szIniPath);
619 }
620
621 /* Allocate a new topic */
622 pTopic = AddNewTopicEx(newTopic.szText,
623 newTopic.szTitle,
624 newTopic.szDesc,
625 lpszCommand,
626 newTopic.szArgs,
627 lpszAction);
628 if (!pTopic)
629 break; // Cannot reallocate more
630 }
631
632 HeapFree(GetProcessHeap(), 0, lpszSections);
633
634 return TRUE;
635}
#define _tcsnicmp
Definition: tchar.h:1431
#define DWORD
Definition: nt_native.h:44
#define LOCALE_NAME_MAX_LENGTH
INT GetLocaleName(IN LCID Locale, OUT LPTSTR lpLCData, IN SIZE_T cchData)
Definition: welcome.c:127
PTOPIC AddNewTopicEx(IN LPTSTR szText OPTIONAL, IN LPTSTR szTitle OPTIONAL, IN LPTSTR szDesc OPTIONAL, IN LPTSTR szCommand OPTIONAL, IN LPTSTR szArgs OPTIONAL, IN LPTSTR szAction OPTIONAL)
Definition: welcome.c:362
#define BUFFER_SIZE
Definition: welcome.c:68
#define GetPrivateProfileSectionNames
Definition: winbase.h:3555

Referenced by LoadConfiguration().

◆ LoadLocalizedResourcesInternal()

static VOID LoadLocalizedResourcesInternal ( VOID  )
static

Definition at line 465 of file welcome.c.

466{
467#define MAX_NUMBER_INTERNAL_TOPICS 3
468
469 UINT i;
470 LPTSTR lpszCommand, lpszAction;
471 TOPIC newTopic, *pTopic;
472
473 for (i = 0; i < MAX_NUMBER_INTERNAL_TOPICS; ++i)
474 {
475 lpszCommand = NULL, lpszAction = NULL;
476
477 /* Retrieve the information */
478 if (!LoadString(hInstance, IDS_TOPIC_BUTTON0 + i, newTopic.szText, ARRAYSIZE(newTopic.szText)))
479 *newTopic.szText = 0;
480 if (!LoadString(hInstance, IDS_TOPIC_TITLE0 + i, newTopic.szTitle, ARRAYSIZE(newTopic.szTitle)))
481 *newTopic.szTitle = 0;
482 if (!LoadString(hInstance, IDS_TOPIC_DESC0 + i, newTopic.szDesc, ARRAYSIZE(newTopic.szDesc)))
483 *newTopic.szDesc = 0;
484
486 *newTopic.szCommand = 0;
487
488 /* Only care about command arguments if we actually have a command */
489 if (*newTopic.szCommand)
490 {
491 lpszCommand = newTopic.szCommand;
492 if (!LoadString(hInstance, IDS_TOPIC_CMD_ARGS0 + i, newTopic.szArgs, ARRAYSIZE(newTopic.szArgs)))
493 *newTopic.szArgs = 0;
494 }
495 /* Only care about custom actions if we actually don't have a command */
496 else // if (!*newTopic.szCommand)
497 {
498 lpszAction = newTopic.szCommand;
500 *newTopic.szCommand = 0;
501 }
502
503 /* Allocate a new topic */
504 pTopic = AddNewTopicEx(newTopic.szText,
505 newTopic.szTitle,
506 newTopic.szDesc,
507 lpszCommand,
508 newTopic.szArgs,
509 lpszAction);
510 if (!pTopic)
511 break; // Cannot reallocate more
512 }
513}
#define IDS_TOPIC_COMMAND0
Definition: resource.h:27
#define IDS_TOPIC_ACTION0
Definition: resource.h:35
#define IDS_TOPIC_CMD_ARGS0
Definition: resource.h:31
#define IDS_TOPIC_TITLE0
Definition: resource.h:19
#define IDS_TOPIC_DESC0
Definition: resource.h:23
#define IDS_TOPIC_BUTTON0
Definition: resource.h:15
unsigned int UINT
Definition: sysinfo.c:13
#define MAX_NUMBER_INTERNAL_TOPICS

Referenced by LoadConfiguration().

◆ MainWndProc()

INT_PTR CALLBACK MainWndProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 1599 of file welcome.c.

1603{
1604 switch (uMsg)
1605 {
1606 case WM_CREATE:
1607 return OnCreate(hWnd, wParam, lParam);
1608
1609 case WM_COMMAND:
1610 return OnCommand(hWnd, wParam, lParam);
1611
1612 case WM_ACTIVATE:
1613 return OnActivate(hWnd, wParam, lParam);
1614
1615 case WM_PAINT:
1616 return OnPaint(hWnd, wParam, lParam);
1617
1618 case WM_DRAWITEM:
1619 return OnDrawItem(hWnd, wParam, lParam);
1620
1621 case WM_CTLCOLORSTATIC:
1623
1624 case WM_MOUSEMOVE:
1625 return OnMouseMove(hWnd, wParam, lParam);
1626
1627 case WM_DESTROY:
1629 PostQuitMessage(0);
1630 return 0;
1631 }
1632
1633 return DefWindowProc(hWnd, uMsg, wParam, lParam);
1634}
#define DefWindowProc
Definition: ros2win.h:31
static LRESULT OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1047
static LRESULT OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1553
static LRESULT OnActivate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1527
static LRESULT OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1210
static LRESULT OnDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1412
static LRESULT OnCtlColorStatic(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1512
static LRESULT OnMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1471
static LRESULT OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1261
#define WM_PAINT
Definition: winuser.h:1648
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define WM_CREATE
Definition: winuser.h:1636
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1673
#define WM_ACTIVATE
Definition: winuser.h:1640
#define WM_DESTROY
Definition: winuser.h:1637

Referenced by _tWinMain().

◆ OnActivate()

static LRESULT OnActivate ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1527 of file welcome.c.

1528{
1531
1532 if (wParam != WA_INACTIVE)
1533 {
1534 /*
1535 * The main window is re-activated, set the focus back to
1536 * either the current topic or a default button.
1537 */
1538 if (nTopic != -1)
1539 SetFocus(pTopics[nTopic]->hWndButton);
1540 else if (hWndCheckButton)
1542 else if (hWndCloseButton)
1544
1545 // InvalidateRect(hWndMain, &rcRightPanel, TRUE);
1546 }
1547
1548 return 0;
1549}
HWND hWndCheckButton
Definition: welcome.c:62
HWND hWndCloseButton
Definition: welcome.c:63
#define WA_INACTIVE
Definition: winuser.h:2664

Referenced by MainWndProc().

◆ OnCommand()

static LRESULT OnCommand ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1210 of file welcome.c.

1211{
1213
1214 /* Retrieve the low-word from wParam */
1215 wParam = LOWORD(wParam);
1216
1217 /* Execute action */
1218 if (wParam == IDC_CLOSEBUTTON)
1219 {
1221 }
1223 {
1225 DestroyWindow(hWnd); // Corresponds to a <exit> action.
1226 }
1227
1228 return 0;
1229}
#define IDC_CLOSEBUTTON
Definition: resource.h:5
#define LOWORD(l)
Definition: pedump.c:82
static BOOL RunAction(INT nTopic)
Definition: welcome.c:987
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by MainWndProc().

◆ OnCreate()

static LRESULT OnCreate ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1047 of file welcome.c.

1048{
1049 UINT i;
1050 INT nLength;
1051 HDC ScreenDC;
1052 LOGFONT lf;
1053 DWORD dwTop;
1054 DWORD dwHeight = 0;
1055 TCHAR szText[80];
1056
1059
1062
1063 ZeroMemory(&lf, sizeof(lf));
1064
1065 lf.lfEscapement = 0;
1066 lf.lfOrientation = 0; // TA_BASELINE;
1067 // lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE;
1074 StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), TEXT("Tahoma"));
1075
1076 /* Topic title font */
1077 lf.lfHeight = -18;
1078 lf.lfWidth = 0;
1079 lf.lfWeight = FW_NORMAL;
1081
1082 /* Topic description font */
1083 lf.lfHeight = -11;
1084 lf.lfWidth = 0;
1085 lf.lfWeight = FW_THIN;
1087
1088 /* Topic button font */
1089 lf.lfHeight = -11;
1090 lf.lfWidth = 0;
1091 lf.lfWeight = FW_BOLD;
1093
1094 /* Load title bitmap */
1095 if (hTitleBitmap)
1097
1098 /* Load topic bitmaps */
1100 for (i = 0; i < dwNumberTopics; i++)
1101 {
1102 // FIXME: Not implemented yet!
1103 // pTopics[i]->hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TOPIC_BITMAP0 + i));
1104 pTopics[i]->hBitmap = NULL;
1105 }
1106
1107 ScreenDC = GetWindowDC(hWnd);
1108 hdcMem = CreateCompatibleDC(ScreenDC);
1109 ReleaseDC(hWnd, ScreenDC);
1110
1111 /* Load and create the menu buttons */
1112 dwTop = rcLeftPanel.top;
1113 for (i = 0; i < dwNumberTopics; i++)
1114 {
1115 if (*pTopics[i]->szText)
1116 {
1119 pTopics[i]->szText,
1121
1122 pTopics[i]->hWndButton = CreateWindow(TEXT("BUTTON"),
1123 pTopics[i]->szText,
1124 (*pTopics[i]->szCommand ? 0 : WS_DISABLED) |
1128 dwTop,
1130 dwHeight,
1131 hWnd,
1132 (HMENU)IntToPtr(TOPIC_BTN_ID_BASE + i), // Similar to SetWindowLongPtr(GWLP_ID)
1133 hInstance,
1134 NULL);
1135 nDefaultTopic = i;
1138 }
1139 else
1140 {
1142 }
1143
1144 dwTop += dwHeight;
1145 }
1146
1147 /* Create the checkbox */
1148 if (bDisplayCheckBox)
1149 {
1150 nLength = LoadString(hInstance, IDS_CHECKTEXT, szText, ARRAYSIZE(szText));
1151 if (nLength > 0)
1152 {
1153 lf.lfHeight = -10;
1154 lf.lfWidth = 0;
1155 lf.lfWeight = FW_THIN;
1157
1158 hWndCheckButton = CreateWindow(TEXT("BUTTON"),
1159 szText,
1162 rcLeftPanel.left + 8,
1163 rcLeftPanel.bottom - 8 - 13,
1165 13,
1166 hWnd,
1168 hInstance,
1169 NULL);
1171 }
1172 else
1173 {
1176 }
1177 }
1178
1179 /* Create the "Exit" button */
1180 if (bDisplayExitBtn)
1181 {
1182 nLength = LoadString(hInstance, IDS_CLOSETEXT, szText, ARRAYSIZE(szText));
1183 if (nLength > 0)
1184 {
1185 hWndCloseButton = CreateWindow(TEXT("BUTTON"),
1186 szText,
1188 rcRightPanel.right - 8 - 57,
1189 rcRightPanel.bottom - 8 - 21,
1190 57,
1191 21,
1192 hWnd,
1194 hInstance,
1195 NULL);
1196 nDefaultTopic = -1;
1198 }
1199 else
1200 {
1202 }
1203 }
1204
1205 return 0;
1206}
#define IDB_DEFAULT_TOPIC_BITMAP
Definition: resource.h:41
#define IDS_CLOSETEXT
Definition: resource.h:13
#define IDC_CHECKBUTTON
Definition: resource.h:4
#define IDS_CHECKTEXT
Definition: resource.h:12
#define IDS_FONTNAME
Definition: resource.h:11
#define IntToPtr(i)
Definition: basetsd.h:83
static const WCHAR dwHeight[]
Definition: provider.c:63
#define ZeroMemory
Definition: minwinbase.h:31
static HDC
Definition: imagelist.c:88
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_AUTOCHECKBOX
Definition: pedump.c:654
#define BS_OWNERDRAW
Definition: pedump.c:661
#define WS_CHILDWINDOW
Definition: pedump.c:639
#define WS_DISABLED
Definition: pedump.c:621
BYTE lfClipPrecision
Definition: dimm.idl:52
BYTE lfQuality
Definition: dimm.idl:53
BYTE lfOutPrecision
Definition: dimm.idl:51
LONG lfOrientation
Definition: dimm.idl:45
BYTE lfPitchAndFamily
Definition: dimm.idl:54
LONG lfHeight
Definition: dimm.idl:42
LONG lfEscapement
Definition: dimm.idl:44
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
LONG lfWidth
Definition: dimm.idl:43
HWND hWndButton
Definition: welcome.c:76
HBITMAP hBitmap
Definition: welcome.c:75
#define SetWindowLongPtr
Definition: treelist.c:70
#define GWLP_WNDPROC
Definition: treelist.c:66
uint32_t DWORD_PTR
Definition: typedefs.h:65
HFONT hFontTopicTitle
Definition: welcome.c:109
HBRUSH hbrLightBlue
Definition: welcome.c:113
HFONT hFontTopicButton
Definition: welcome.c:108
HFONT hFontTopicDescription
Definition: welcome.c:110
HFONT hFontCheckButton
Definition: welcome.c:111
HBITMAP hDefaultTopicBitmap
Definition: welcome.c:106
#define LIGHT_BLUE
Definition: welcome.c:47
HDC hdcMem
Definition: welcome.c:104
HBRUSH hbrDarkBlue
Definition: welcome.c:114
#define DARK_BLUE
Definition: welcome.c:48
static DWORD GetButtonHeight(HDC hDC, HFONT hFont, LPCTSTR szText, DWORD dwWidth)
Definition: welcome.c:1025
INT_PTR CALLBACK ButtonSubclassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:929
INT nDefaultTopic
Definition: welcome.c:102
WINBASEAPI _In_ DWORD nLength
Definition: wincon.h:682
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FW_BOLD
Definition: wingdi.h:378
#define FF_DONTCARE
Definition: wingdi.h:448
#define FW_THIN
Definition: wingdi.h:369
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define ANSI_CHARSET
Definition: wingdi.h:383
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_NORMAL
Definition: wingdi.h:373
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define CreateFontIndirect
Definition: wingdi.h:4890
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define BS_MULTILINE
Definition: winuser.h:267
#define BS_FLAT
Definition: winuser.h:280
#define WM_SETFONT
Definition: winuser.h:1678

Referenced by MainWndProc().

◆ OnCtlColorStatic()

static LRESULT OnCtlColorStatic ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1512 of file welcome.c.

1513{
1515
1516 if ((HWND)lParam == hWndCheckButton)
1517 {
1519 return (LRESULT)hbrLightBlue;
1520 }
1521
1522 return 0;
1523}
LONG_PTR LRESULT
Definition: minwindef.h:176
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056

Referenced by MainWndProc().

◆ OnDestroy()

static LRESULT OnDestroy ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1553 of file welcome.c.

1554{
1555 UINT i;
1556
1560
1561 for (i = 0; i < dwNumberTopics; i++)
1562 {
1563 if (pTopics[i]->hWndButton)
1564 DestroyWindow(pTopics[i]->hWndButton);
1565 }
1566
1567 if (hWndCloseButton)
1569
1570 if (hWndCheckButton)
1572
1574
1575 /* Delete bitmaps */
1578 for (i = 0; i < dwNumberTopics; i++)
1579 {
1580 if (pTopics[i]->hBitmap)
1582 }
1583
1587
1588 if (hFontCheckButton)
1590
1593
1594 return 0;
1595}
static HBITMAP hBitmap
Definition: timezone.c:26
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by MainWndProc().

◆ OnDrawItem()

static LRESULT OnDrawItem ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1412 of file welcome.c.

1413{
1415 HPEN hPen, hOldPen;
1416 HBRUSH hOldBrush;
1417 INT iBkMode;
1418 TCHAR szText[80];
1419
1422
1423#if 0
1424 /* Neither the checkbox button nor the close button implement owner-drawing */
1425 if (lpDis->hwndItem == hWndCheckButton)
1426 return 0;
1427 if (lpDis->hwndItem == hWndCloseButton)
1428 {
1429 DrawFrameControl(lpDis->hDC,
1430 &lpDis->rcItem,
1431 DFC_BUTTON,
1433 return TRUE;
1434 }
1435#endif
1436
1437 if (lpDis->CtlID == (ULONG)(TOPIC_BTN_ID_BASE + nTopic))
1438 hOldBrush = (HBRUSH)SelectObject(lpDis->hDC, GetStockObject(WHITE_BRUSH));
1439 else
1440 hOldBrush = (HBRUSH)SelectObject(lpDis->hDC, hbrLightBlue);
1441
1442 PatBlt(lpDis->hDC,
1443 lpDis->rcItem.left,
1444 lpDis->rcItem.top,
1445 lpDis->rcItem.right,
1446 lpDis->rcItem.bottom,
1447 PATCOPY);
1448 SelectObject(lpDis->hDC, hOldBrush);
1449
1450 hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
1451 hOldPen = (HPEN)SelectObject(lpDis->hDC, hPen);
1452 MoveToEx(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.bottom - 1, NULL);
1453 LineTo(lpDis->hDC, lpDis->rcItem.right, lpDis->rcItem.bottom - 1);
1454 SelectObject(lpDis->hDC, hOldPen);
1455 DeleteObject(hPen);
1456
1457 InflateRect(&lpDis->rcItem, -10, -4);
1458 OffsetRect(&lpDis->rcItem, 0, 1);
1459 GetWindowText(lpDis->hwndItem, szText, ARRAYSIZE(szText));
1462 iBkMode = SetBkMode(lpDis->hDC, TRANSPARENT);
1463 DrawText(lpDis->hDC, szText, -1, &lpDis->rcItem, DT_TOP | DT_LEFT | DT_WORDBREAK);
1464 SetBkMode(lpDis->hDC, iBkMode);
1465
1466 return TRUE;
1467}
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define WHITE_BRUSH
Definition: wingdi.h:902
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:917
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_GRAYTEXT
Definition: winuser.h:943
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
BOOL WINAPI DrawFrameControl(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
#define DFCS_FLAT
Definition: winuser.h:510
#define DFC_BUTTON
Definition: winuser.h:476
#define DT_LEFT
Definition: winuser.h:534
#define GetWindowText
Definition: winuser.h:5964
BOOL WINAPI IsWindowEnabled(_In_ HWND)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)

Referenced by MainWndProc().

◆ OnMouseMove()

static LRESULT OnMouseMove ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1471 of file welcome.c.

1472{
1473 static WPARAM wParamOld = 0;
1474 static LPARAM lParamOld = 0;
1475
1476 /* Ignore mouse-move messages on the same point */
1477 if ((wParam == wParamOld) && (lParam == lParamOld))
1478 return 0;
1479
1480 /*
1481 * If the user moves the mouse over the main window, outside of the
1482 * topic buttons, reset the current topic to the default one and
1483 * change the focus to some other default button (to keep keyboard
1484 * navigation possible).
1485 */
1486 if (nTopic != -1)
1487 {
1488 INT nOldTopic = nTopic;
1489 nTopic = -1;
1490 /* Also repaint the buttons, otherwise nothing repaints... */
1491 InvalidateRect(pTopics[nOldTopic]->hWndButton, NULL, TRUE);
1492
1493 /* Set the focus to some other default button */
1494 if (hWndCheckButton)
1496 else if (hWndCloseButton)
1498 // SetFocus(hWnd);
1499
1500 /* Repaint the description panel */
1502 }
1503
1504 wParamOld = wParam;
1505 lParamOld = lParam;
1506
1507 return 0;
1508}

Referenced by MainWndProc().

◆ OnPaint()

static LRESULT OnPaint ( HWND  hWnd,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1261 of file welcome.c.

1262{
1263 HPEN hPen;
1264 HPEN hOldPen;
1265 HDC hdc;
1266 PAINTSTRUCT ps;
1267 HBITMAP hOldBitmap = NULL;
1268 HBRUSH hOldBrush;
1269 HFONT hOldFont;
1270 RECT rcTitle, rcDescription;
1271 BITMAP bmpInfo;
1272 TCHAR szVersion[50];
1273 LPTSTR lpTitle = NULL, lpDesc = NULL;
1274
1277
1278 hdc = BeginPaint(hWnd, &ps);
1279
1280 /* Banner panel */
1282
1283 /* Left panel */
1284 hOldBrush = (HBRUSH)SelectObject(hdc, hbrLightBlue);
1285 PatBlt(hdc,
1290 PATCOPY);
1291 SelectObject(hdc, hOldBrush);
1292
1293 /* Right panel */
1294 hOldBrush = (HBRUSH)SelectObject(hdc, GetStockObject(WHITE_BRUSH));
1295 PatBlt(hdc,
1300 PATCOPY);
1301 SelectObject(hdc, hOldBrush);
1302
1303 /* Draw dark vertical line */
1304 hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
1305 hOldPen = (HPEN)SelectObject(hdc, hPen);
1308 SelectObject(hdc, hOldPen);
1309 DeleteObject(hPen);
1310
1311 /* Draw topic bitmap */
1312 if ((nTopic == -1) && (hDefaultTopicBitmap))
1313 {
1314 GetObject(hDefaultTopicBitmap, sizeof(bmpInfo), &bmpInfo);
1316 BitBlt(hdc,
1317 rcRightPanel.right - bmpInfo.bmWidth,
1318 rcRightPanel.bottom - bmpInfo.bmHeight,
1319 bmpInfo.bmWidth,
1320 bmpInfo.bmHeight,
1321 hdcMem,
1322 0,
1323 0,
1324 SRCCOPY);
1325 }
1326 else if ((nTopic != -1) && (pTopics[nTopic]->hBitmap))
1327 {
1328 GetObject(pTopics[nTopic]->hBitmap, sizeof(bmpInfo), &bmpInfo);
1329 hOldBitmap = (HBITMAP)SelectObject(hdcMem, pTopics[nTopic]->hBitmap);
1330 BitBlt(hdc,
1331 rcRightPanel.right - bmpInfo.bmWidth,
1332 rcRightPanel.bottom - bmpInfo.bmHeight,
1333 bmpInfo.bmWidth,
1334 bmpInfo.bmHeight,
1335 hdcMem,
1336 0,
1337 0,
1338 SRCCOPY);
1339 }
1340
1341 if (nTopic == -1)
1342 {
1344 lpDesc = szDefaultDesc;
1345 }
1346 else
1347 {
1349 lpDesc = pTopics[nTopic]->szDesc;
1350 }
1351
1353
1354 /* Draw version information */
1356 TEXT("ReactOS ") TEXT(KERNEL_VERSION_STR));
1357
1358 /*
1359 * Compute the original rect (position & size) of the version info,
1360 * depending whether the checkbox is displayed (version info in the
1361 * right panel) or not (version info in the left panel).
1362 */
1363 if (bDisplayCheckBox)
1364 rcTitle = rcRightPanel;
1365 else
1366 rcTitle = rcLeftPanel;
1367
1368 rcTitle.left = rcTitle.left + 8;
1369 rcTitle.right = rcTitle.right - 5;
1370 rcTitle.top = rcTitle.bottom - 43;
1371 rcTitle.bottom = rcTitle.bottom - 8;
1372
1373 hOldFont = (HFONT)SelectObject(hdc, hFontTopicDescription);
1376 DrawText(hdc, szVersion, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE);
1377 SelectObject(hdc, hOldFont);
1378
1379 /* Draw topic title */
1380 rcTitle.left = rcRightPanel.left + 12;
1381 rcTitle.right = rcRightPanel.right - 8;
1382 rcTitle.top = rcRightPanel.top + 8;
1383 rcTitle.bottom = rcTitle.top + 57;
1384 hOldFont = (HFONT)SelectObject(hdc, hFontTopicTitle);
1385 DrawText(hdc, lpTitle, -1, &rcTitle, DT_TOP | DT_CALCRECT);
1387 DrawText(hdc, lpTitle, -1, &rcTitle, DT_TOP);
1388 SelectObject(hdc, hOldFont);
1389
1390 /* Draw topic description */
1391 rcDescription.left = rcRightPanel.left + 12;
1392 rcDescription.right = rcRightPanel.right - 8;
1393 rcDescription.top = rcTitle.bottom + 8;
1394 rcDescription.bottom = rcRightPanel.bottom - 20;
1395 hOldFont = (HFONT)SelectObject(hdc, hFontTopicDescription);
1397 DrawText(hdc, lpDesc, -1, &rcDescription, DT_TOP | DT_WORDBREAK);
1398 SelectObject(hdc, hOldFont);
1399
1401
1402 SelectObject(hdcMem, hOldBrush);
1403 SelectObject(hdcMem, hOldBitmap);
1404
1405 EndPaint(hWnd, &ps);
1406
1407 return 0;
1408}
TCHAR lpTitle[80]
Definition: ctm.c:69
static VOID BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Height *Stride) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Stride)
Definition: common.c:42
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static LPCWSTR szVersion
Definition: asmcache.c:748
static VOID PaintBanner(HDC hdc, LPRECT rcPanel)
Definition: welcome.c:1233
#define SRCCOPY
Definition: wingdi.h:333
#define OPAQUE
Definition: wingdi.h:949
#define DT_SINGLELINE
Definition: winuser.h:540
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
#define DT_BOTTOM
Definition: winuser.h:525
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by MainWndProc().

◆ PaintBanner()

static VOID PaintBanner ( HDC  hdc,
LPRECT  rcPanel 
)
static

Definition at line 1233 of file welcome.c.

1234{
1235 HBITMAP hOldBitmap;
1236 HBRUSH hOldBrush;
1237
1238 /* Title bitmap */
1239 hOldBitmap = (HBITMAP)SelectObject(hdcMem, hTitleBitmap);
1240 BitBlt(hdc,
1241 rcPanel->left,
1242 rcPanel->top,
1243 rcPanel->right - rcPanel->left,
1244 rcPanel->bottom - 3,
1245 hdcMem, 0, 0, SRCCOPY);
1246 SelectObject(hdcMem, hOldBitmap);
1247
1248 /* Dark blue line */
1249 hOldBrush = (HBRUSH)SelectObject(hdc, hbrDarkBlue);
1250 PatBlt(hdc,
1251 rcPanel->left,
1252 rcPanel->bottom - 3,
1253 rcPanel->right - rcPanel->left,
1254 3,
1255 PATCOPY);
1256 SelectObject(hdc, hOldBrush);
1257}

Referenced by OnPaint().

◆ RunAction()

static BOOL RunAction ( INT  nTopic)
static

Definition at line 987 of file welcome.c.

988{
990
991 if (nTopic < 0)
992 return TRUE;
993
995 if (/* !Command && */ !*Command)
996 return TRUE;
997
998 /* Check for known actions */
999 if (!pTopics[nTopic]->bIsCommand)
1000 {
1001 if (!_tcsicmp(Command, TEXT("<exit>")))
1002 return FALSE;
1003
1004 if (!_tcsnicmp(Command, TEXT("<msg>"), 5))
1005 {
1006 MessageBox(hWndMain, Command + 5, TEXT("ReactOS"), MB_OK | MB_TASKMODAL);
1007 return TRUE;
1008 }
1009 }
1010 else
1011 /* Run the command */
1012 {
1014 if (!*Args) Args = NULL;
1016 Command, Args,
1018 }
1019
1020 return TRUE;
1021}
char ** Args
Definition: acdebug.h:353
#define ShellExecute
Definition: shellapi.h:746
Definition: shell.h:41
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define MB_TASKMODAL
Definition: winuser.h:827
#define SW_SHOWDEFAULT
Definition: winuser.h:791
#define MB_OK
Definition: winuser.h:801
#define MessageBox
Definition: winuser.h:5988

Referenced by OnCommand().

◆ TranslateEscapes()

VOID TranslateEscapes ( IN OUT LPTSTR  lpString)

Definition at line 160 of file welcome.c.

161{
162 LPTSTR pEscape = NULL; // Next backslash escape sequence.
163
164 while (lpString && *lpString)
165 {
166 /* Find the next backslash escape sequence */
167 pEscape = _tcschr(lpString, _T('\\'));
168 if (!pEscape)
169 break;
170
171 /* Go past the escape backslash */
172 lpString = pEscape + 1;
173
174 /* Find which sequence it is */
175 switch (*lpString)
176 {
177 case _T('\0'):
178 // *pEscape = _T('\0'); // Enable if one wants to convert <NULL> into <NULL>.
179 // lpString = pEscape + 1; // Loop will stop at the next iteration.
180 break;
181
182 /* New-line and carriage return */
183 case _T('n'): case _T('r'):
184 // case _T('\\'): // others?
185 // So far we only need to deal with the newlines.
186 {
187 if (*lpString == _T('n'))
188 *pEscape = _T('\n');
189 else if (*lpString == _T('r'))
190 *pEscape = _T('\r');
191
192 memmove(lpString, lpString + 1, (_tcslen(lpString + 1) + 1) * sizeof(TCHAR));
193 break;
194 }
195
196 /* \xhhhh hexadecimal character specification */
197 case _T('x'):
198 {
199 LPTSTR lpStringNew;
200 *pEscape = (WCHAR)_tcstoul(lpString + 1, &lpStringNew, 16);
201 memmove(lpString, lpStringNew, (_tcslen(lpStringNew) + 1) * sizeof(TCHAR));
202 break;
203 }
204
205 /* Unknown escape sequence, ignore it */
206 default:
207 lpString++;
208 break;
209 }
210 }
211}
#define _tcstoul
Definition: tchar.h:595
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
short WCHAR
Definition: pedump.c:58

Referenced by AddNewTopicEx(), and LoadLocalizedResourcesFromINI().

Variable Documentation

◆ bDisplayCheckBox

BOOL bDisplayCheckBox = FALSE

Definition at line 65 of file welcome.c.

Referenced by LoadConfiguration(), OnCreate(), and OnPaint().

◆ bDisplayExitBtn

BOOL bDisplayExitBtn = TRUE

Definition at line 66 of file welcome.c.

Referenced by LoadConfiguration(), and OnCreate().

◆ dwNumberTopics

DWORD dwNumberTopics = 0

◆ fnOldBtn

WNDPROC fnOldBtn

Definition at line 94 of file welcome.c.

Referenced by ButtonSubclassWndProc(), and OnCreate().

◆ hbrDarkBlue

HBRUSH hbrDarkBlue

Definition at line 114 of file welcome.c.

Referenced by OnCreate(), OnDestroy(), and PaintBanner().

◆ hbrLightBlue

HBRUSH hbrLightBlue

Definition at line 113 of file welcome.c.

Referenced by OnCreate(), OnCtlColorStatic(), OnDestroy(), OnDrawItem(), and OnPaint().

◆ hdcMem

◆ hDefaultTopicBitmap

HBITMAP hDefaultTopicBitmap = NULL

Definition at line 106 of file welcome.c.

Referenced by OnCreate(), OnDestroy(), and OnPaint().

◆ hFontCheckButton

HFONT hFontCheckButton

Definition at line 111 of file welcome.c.

Referenced by OnCreate(), and OnDestroy().

◆ hFontTopicButton

HFONT hFontTopicButton

Definition at line 108 of file welcome.c.

Referenced by OnCreate(), and OnDestroy().

◆ hFontTopicDescription

HFONT hFontTopicDescription

Definition at line 110 of file welcome.c.

Referenced by OnCreate(), OnDestroy(), and OnPaint().

◆ hFontTopicTitle

HFONT hFontTopicTitle

Definition at line 109 of file welcome.c.

Referenced by OnCreate(), OnDestroy(), and OnPaint().

◆ hInstance

HINSTANCE hInstance

Definition at line 58 of file welcome.c.

Referenced by _tWinMain(), LoadConfiguration(), LoadLocalizedResourcesInternal(), and OnCreate().

◆ hTitleBitmap

HBITMAP hTitleBitmap = NULL

Definition at line 105 of file welcome.c.

Referenced by _tWinMain(), OnCreate(), OnDestroy(), and PaintBanner().

◆ hWndCheckButton

HWND hWndCheckButton = NULL

Definition at line 62 of file welcome.c.

Referenced by OnActivate(), OnCreate(), OnCtlColorStatic(), OnDestroy(), OnDrawItem(), and OnMouseMove().

◆ hWndCloseButton

HWND hWndCloseButton = NULL

Definition at line 63 of file welcome.c.

Referenced by OnActivate(), OnCreate(), OnDestroy(), OnDrawItem(), and OnMouseMove().

◆ hWndMain

◆ nDefaultTopic

INT nDefaultTopic = -1

Definition at line 102 of file welcome.c.

Referenced by OnCreate().

◆ nTopic

INT nTopic = -1

◆ pTopics

◆ rcLeftPanel

RECT rcLeftPanel

Definition at line 117 of file welcome.c.

Referenced by _tWinMain(), OnCreate(), and OnPaint().

◆ rcRightPanel

RECT rcRightPanel

Definition at line 118 of file welcome.c.

Referenced by _tWinMain(), ButtonSubclassWndProc(), OnCreate(), OnMouseMove(), and OnPaint().

◆ rcTitlePanel

RECT rcTitlePanel

Definition at line 116 of file welcome.c.

Referenced by _tWinMain(), and OnPaint().

◆ szAppTitle

TCHAR szAppTitle[80]

Definition at line 56 of file welcome.c.

Referenced by _tWinMain(), LoadConfiguration(), and LoadLocalizedResourcesFromINI().

◆ szDefaultDesc

TCHAR szDefaultDesc[TOPIC_DESC_LENGTH]

Definition at line 97 of file welcome.c.

Referenced by LoadConfiguration(), LoadLocalizedResourcesFromINI(), and OnPaint().

◆ szDefaultTitle

TCHAR szDefaultTitle[TOPIC_TITLE_LENGTH]

Definition at line 96 of file welcome.c.

Referenced by LoadConfiguration(), LoadLocalizedResourcesFromINI(), and OnPaint().

◆ szWindowClass

TCHAR szWindowClass[] = TEXT("WelcomeWindowClass")

Definition at line 55 of file welcome.c.

Referenced by _tWinMain().