ReactOS 0.4.16-dev-92-g0c2cdca
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)
 
BOOL ExpandInstallerPath (IN LPCTSTR lpInstallerName, OUT LPTSTR lpInstallerPath, IN SIZE_T PathSize)
 
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 752 of file welcome.c.

756{
758 WNDCLASSEX wndclass;
759 MSG msg;
760 HWND hWndFocus;
761 INT xPos, yPos;
762 INT xWidth, yHeight;
763 RECT rcWindow;
764 HICON hMainIcon;
765 HMENU hSystemMenu;
768
769 BITMAP BitmapInfo;
770 ULONG ulInnerWidth = TITLE_WIDTH;
771 ULONG ulInnerHeight = (TITLE_WIDTH * 3) / 4;
772 ULONG ulTitleHeight = TITLE_HEIGHT + 3;
773
774 UNREFERENCED_PARAMETER(hPrevInstance);
775 UNREFERENCED_PARAMETER(lpszCmdLine);
776
777 /* Ensure only one instance is running */
780 {
781 /* If already started, find its window */
783
784 /* Activate window */
787
788 /* Close the mutex handle and quit */
790 return 0;
791 }
792
793#if 0
794 /* Mirroring is enabled from within the resources */
795 switch (GetUserDefaultUILanguage())
796 {
799 break;
800
801 default:
802 break;
803 }
804#endif
805
807
808 /* Load icons */
810
811 /* Register the window class */
812 wndclass.cbSize = sizeof(wndclass);
813 wndclass.style = CS_HREDRAW | CS_VREDRAW;
814 wndclass.lpfnWndProc = (WNDPROC)MainWndProc;
815 wndclass.cbClsExtra = 0;
816 wndclass.cbWndExtra = 0;
817 wndclass.hInstance = hInstance;
818 wndclass.hIcon = hMainIcon;
819 wndclass.hIconSm = NULL;
820 wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
821 wndclass.hbrBackground = NULL;
822 wndclass.lpszMenuName = NULL;
823 wndclass.lpszClassName = szWindowClass;
824
825 RegisterClassEx(&wndclass);
826
827 /* Load the banner bitmap, and compute the window dimensions */
829 if (hTitleBitmap)
830 {
831 GetObject(hTitleBitmap, sizeof(BitmapInfo), &BitmapInfo);
832 ulInnerWidth = BitmapInfo.bmWidth;
833 ulInnerHeight = (ulInnerWidth * 3) / 4;
834 ulTitleHeight = BitmapInfo.bmHeight + 3;
836 }
837 ulInnerHeight -= GetSystemMetrics(SM_CYCAPTION);
838
839 rcWindow.top = 0;
840 rcWindow.bottom = ulInnerHeight - 1;
841 rcWindow.left = 0;
842 rcWindow.right = ulInnerWidth - 1;
843
844 AdjustWindowRect(&rcWindow, dwStyle, FALSE);
845 xWidth = rcWindow.right - rcWindow.left;
846 yHeight = rcWindow.bottom - rcWindow.top;
847
848 /* Compute the window position */
849 xPos = (GetSystemMetrics(SM_CXSCREEN) - xWidth) / 2;
850 yPos = (GetSystemMetrics(SM_CYSCREEN) - yHeight) / 2;
851
852 rcTitlePanel.top = 0;
853 rcTitlePanel.bottom = ulTitleHeight;
854 rcTitlePanel.left = 0;
855 rcTitlePanel.right = ulInnerWidth - 1;
856
858 rcLeftPanel.bottom = ulInnerHeight - 1;
859 rcLeftPanel.left = 0;
860 rcLeftPanel.right = ulInnerWidth / 3;
861
865 rcRightPanel.right = ulInnerWidth - 1;
866
867 /* Load the configuration and the resources */
869
870 /* Create main window */
873 dwStyle,
874 xPos,
875 yPos,
876 xWidth,
877 yHeight,
878 0,
879 0,
880 hInstance,
881 NULL);
882
883 hSystemMenu = GetSystemMenu(hWndMain, FALSE);
884 if (hSystemMenu)
885 {
886 RemoveMenu(hSystemMenu, SC_SIZE, MF_BYCOMMAND);
887 RemoveMenu(hSystemMenu, SC_MAXIMIZE, MF_BYCOMMAND);
888 }
889
890 ShowWindow(hWndMain, nCmdShow);
892
893 while (GetMessage(&msg, NULL, 0, 0) != FALSE)
894 {
895 /* Check for ENTER key presses */
896 if (msg.message == WM_KEYDOWN && msg.wParam == VK_RETURN)
897 {
898 /*
899 * The user pressed the ENTER key. Retrieve the handle to the
900 * child window that has the keyboard focus, and send it a
901 * WM_COMMAND message.
902 */
903 hWndFocus = GetFocus();
904 if (hWndFocus)
905 {
907 (WPARAM)GetDlgCtrlID(hWndFocus), (LPARAM)hWndFocus);
908 }
909 }
910 /* Allow using keyboard navigation */
911 else if (!IsDialogMessage(hWndMain, &msg))
912 {
915 }
916 }
917
918 /* Cleanup */
920
921 /* Close the mutex handle and quit */
923 return msg.wParam;
924}
#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:1374
HINSTANCE hInst
Definition: dxdiag.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
pKey DeleteObject()
#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:63
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#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
Definition: bl.h:1331
int cbClsExtra
Definition: winuser.h:3207
HINSTANCE hInstance
Definition: winuser.h:3209
HCURSOR hCursor
Definition: winuser.h:3211
LPCSTR lpszMenuName
Definition: winuser.h:3213
HICON hIconSm
Definition: winuser.h:3215
UINT style
Definition: winuser.h:3205
int cbWndExtra
Definition: winuser.h:3208
UINT cbSize
Definition: winuser.h:3204
WNDPROC lpfnWndProc
Definition: winuser.h:3206
LPCSTR lpszClassName
Definition: winuser.h:3214
HICON hIcon
Definition: winuser.h:3210
HBRUSH hbrBackground
Definition: winuser.h:3212
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
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:709
#define TITLE_HEIGHT
Definition: welcome.c:51
RECT rcRightPanel
Definition: welcome.c:118
static VOID LoadConfiguration(VOID)
Definition: welcome.c:637
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:1598
RECT rcTitlePanel
Definition: welcome.c:116
BOOL WINAPI SetProcessDefaultLayout(DWORD dwDefaultLayout)
Definition: window.c:1691
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define CreateMutex
Definition: winbase.h:3756
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define LAYOUT_RTL
Definition: wingdi.h:1371
#define GetObject
Definition: wingdi.h:4468
#define SW_SHOWNORMAL
Definition: winuser.h:773
HWND WINAPI GetFocus(void)
Definition: window.c:1865
#define CS_VREDRAW
Definition: winuser.h:658
#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:963
BOOL WINAPI AdjustWindowRect(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL)
#define IsDialogMessage
Definition: winuser.h:5821
#define FindWindow
Definition: winuser.h:5789
#define LoadBitmap
Definition: winuser.h:5823
#define WM_COMMAND
Definition: winuser.h:1743
#define CS_HREDRAW
Definition: winuser.h:653
BOOL WINAPI SetForegroundWindow(_In_ HWND)
#define IDC_ARROW
Definition: winuser.h:687
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
#define CreateWindow
Definition: winuser.h:5766
#define SC_SIZE
Definition: winuser.h:2587
#define GetMessage
Definition: winuser.h:5802
#define RegisterClassEx
Definition: winuser.h:5849
#define VK_RETURN
Definition: winuser.h:2204
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadIcon
Definition: winuser.h:5825
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SendMessage
Definition: winuser.h:5855
#define LoadCursor
Definition: winuser.h:5824
int WINAPI GetDlgCtrlID(_In_ HWND)
#define SM_CXSCREEN
Definition: winuser.h:962
#define WM_KEYDOWN
Definition: winuser.h:1718
#define DispatchMessage
Definition: winuser.h:5777
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2909
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define SM_CYCAPTION
Definition: winuser.h:966
int WINAPI GetSystemMetrics(_In_ int)
#define SC_MAXIMIZE
Definition: winuser.h:2591

◆ AddNewTopic()

PTOPIC AddNewTopic ( VOID  )

Definition at line 337 of file welcome.c.

338{
339 PTOPIC pTopic, *pTopicsTmp;
340
341 /* Allocate (or reallocate) the list of topics */
342 if (!pTopics)
343 pTopicsTmp = HeapAlloc(GetProcessHeap(), 0, (dwNumberTopics + 1) * sizeof(*pTopics));
344 else
345 pTopicsTmp = HeapReAlloc(GetProcessHeap(), 0, pTopics, (dwNumberTopics + 1) * sizeof(*pTopics));
346 if (!pTopicsTmp)
347 return NULL; // Cannot reallocate more
348 pTopics = pTopicsTmp;
349
350 /* Allocate a new topic entry */
351 pTopic = HeapAlloc(GetProcessHeap(), 0, sizeof(*pTopic));
352 if (!pTopic)
353 return NULL; // Cannot reallocate more
354 pTopics[dwNumberTopics++] = pTopic;
355
356 /* Return the allocated topic entry */
357 return pTopic;
358}
#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 361 of file welcome.c.

368{
369 PTOPIC pTopic = AddNewTopic();
370 if (!pTopic)
371 return NULL;
372
373 if (szText && *szText)
374 StringCchCopy(pTopic->szText, ARRAYSIZE(pTopic->szText), szText);
375 else
376 *pTopic->szText = 0;
377
378 if (szTitle && *szTitle)
379 StringCchCopy(pTopic->szTitle, ARRAYSIZE(pTopic->szTitle), szTitle);
380 else
381 *pTopic->szTitle = 0;
382
383 if (szDesc && *szDesc)
384 {
385 StringCchCopy(pTopic->szDesc, ARRAYSIZE(pTopic->szDesc), szDesc);
386 TranslateEscapes(pTopic->szDesc);
387 }
388 else
389 {
390 *pTopic->szDesc = 0;
391 }
392
393 if (szCommand && *szCommand)
394 {
395 pTopic->bIsCommand = TRUE;
396
397 /* Check for special applications: ReactOS Installer */
398 if (_tcsicmp(szCommand, TEXT("reactos.exe")) == 0)
399 {
400 ExpandInstallerPath(szCommand, pTopic->szCommand, ARRAYSIZE(pTopic->szCommand));
401 }
402 else
403 {
404 /* Expand any environment string in the command line */
406 if (dwSize <= ARRAYSIZE(pTopic->szCommand))
407 ExpandEnvironmentStringsW(szCommand, pTopic->szCommand, ARRAYSIZE(pTopic->szCommand));
408 else
409 StringCchCopy(pTopic->szCommand, ARRAYSIZE(pTopic->szCommand), szCommand);
410 }
411 }
412 else
413 {
414 pTopic->bIsCommand = FALSE;
415 *pTopic->szCommand = 0;
416 }
417
418 /* Only care about command arguments if we actually have a command */
419 if (*pTopic->szCommand)
420 {
421 if (szArgs && *szArgs)
422 {
423 StringCchCopy(pTopic->szArgs, ARRAYSIZE(pTopic->szArgs), szArgs);
424 }
425 else
426 {
427 /* Check for special applications: ReactOS Shell */
428 if (/* pTopic->szCommand && */ *pTopic->szCommand &&
429 _tcsicmp(pTopic->szCommand, TEXT("explorer.exe")) == 0)
430 {
431#if 0
432 TCHAR CurrentDir[MAX_PATH];
433 GetCurrentDirectory(ARRAYSIZE(CurrentDir), CurrentDir);
434#endif
435 StringCchCopy(pTopic->szArgs, ARRAYSIZE(pTopic->szArgs), TEXT("\\"));
436 }
437 else
438 {
439 *pTopic->szArgs = 0;
440 }
441 }
442 }
443 else
444 {
445 *pTopic->szArgs = 0;
446 }
447
448 /* Only care about custom actions if we actually don't have a command */
449 if (!*pTopic->szCommand && szAction && *szAction)
450 {
451 /*
452 * Re-use the pTopic->szCommand member. We distinguish with respect to
453 * a regular command by using the pTopic->bIsCommand flag.
454 */
455 pTopic->bIsCommand = FALSE;
456 StringCchCopy(pTopic->szCommand, ARRAYSIZE(pTopic->szCommand), szAction);
458 }
459
460 return pTopic;
461}
#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:519
#define TEXT(s)
Definition: k32.h:26
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:337
BOOL ExpandInstallerPath(IN LPCTSTR lpInstallerName, OUT LPTSTR lpInstallerPath, IN SIZE_T PathSize)
Definition: welcome.c:218
VOID TranslateEscapes(IN OUT LPTSTR lpString)
Definition: welcome.c:160
#define GetCurrentDirectory
Definition: winbase.h:3805
char TCHAR
Definition: xmlstorage.h:189
#define _tcsicmp
Definition: xmlstorage.h:205

Referenced by LoadLocalizedResourcesFromINI(), and LoadLocalizedResourcesInternal().

◆ ButtonSubclassWndProc()

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

Definition at line 928 of file welcome.c.

929{
930 static WPARAM wParamOld = 0;
931 static LPARAM lParamOld = 0;
932
933 LONG i;
934
935 if (uMsg == WM_MOUSEMOVE)
936 {
937 /* Ignore mouse-move messages on the same point */
938 if ((wParam == wParamOld) && (lParam == lParamOld))
939 return 0;
940
941 /* Retrieve the topic index of this button */
943
944 /*
945 * Change the focus to this button if the current topic index differs
946 * (we will receive WM_SETFOCUS afterwards).
947 */
948 if (nTopic != i)
949 SetFocus(hWnd);
950
951 wParamOld = wParam;
952 lParamOld = lParam;
953 }
954 else if (uMsg == WM_SETFOCUS)
955 {
956 /* Retrieve the topic index of this button */
958
959 /* Change the current topic index and repaint the description panel */
960 if (nTopic != i)
961 {
962 nTopic = i;
964 }
965 }
966 else if (uMsg == WM_KILLFOCUS)
967 {
968 /*
969 * We lost focus, either because the user changed button focus,
970 * or because the main window to which we belong went inactivated.
971 * If we are in the latter case, we ignore the focus change.
972 * If we are in the former case, we reset to the default topic.
973 */
975 {
976 nTopic = -1;
978 }
979 }
980
981 return CallWindowProc(fnOldBtn, hWnd, uMsg, wParam, lParam);
982}
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:5747
#define WM_SETFOCUS
Definition: winuser.h:1616
#define WM_MOUSEMOVE
Definition: winuser.h:1778
HWND WINAPI SetFocus(_In_opt_ HWND)
HWND WINAPI GetParent(_In_ HWND)
#define GWLP_ID
Definition: winuser.h:863
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define WM_KILLFOCUS
Definition: winuser.h:1617

Referenced by OnCreate().

◆ ExpandInstallerPath()

BOOL ExpandInstallerPath ( IN LPCTSTR  lpInstallerName,
OUT LPTSTR  lpInstallerPath,
IN SIZE_T  PathSize 
)

Definition at line 218 of file welcome.c.

222{
223 SYSTEM_INFO SystemInfo;
224 SIZE_T cchInstallerNameLen;
225 PTSTR ptr;
226 DWORD dwAttribs;
227
228 cchInstallerNameLen = _tcslen(lpInstallerName);
229 if (PathSize < cchInstallerNameLen)
230 {
231 /* The buffer is not large enough to contain the installer file name */
232 *lpInstallerPath = 0;
233 return FALSE;
234 }
235
236 /*
237 * First, try to find the installer using the default drive, under
238 * the directory whose name corresponds to the currently-running
239 * CPU architecture.
240 */
241 GetSystemInfo(&SystemInfo);
242
243 *lpInstallerPath = 0;
244 GetModuleFileName(NULL, lpInstallerPath, PathSize - cchInstallerNameLen - 1);
245 ptr = _tcschr(lpInstallerPath, _T('\\'));
246 if (ptr)
247 *++ptr = 0;
248 else
249 *lpInstallerPath = 0;
250
251 /* Append the corresponding CPU architecture */
252 switch (SystemInfo.wProcessorArchitecture)
253 {
255 StringCchCat(lpInstallerPath, PathSize, TEXT("I386"));
256 break;
257
259 StringCchCat(lpInstallerPath, PathSize, TEXT("MIPS"));
260 break;
261
263 StringCchCat(lpInstallerPath, PathSize, TEXT("ALPHA"));
264 break;
265
267 StringCchCat(lpInstallerPath, PathSize, TEXT("PPC"));
268 break;
269
271 StringCchCat(lpInstallerPath, PathSize, TEXT("SHX"));
272 break;
273
275 StringCchCat(lpInstallerPath, PathSize, TEXT("ARM"));
276 break;
277
279 StringCchCat(lpInstallerPath, PathSize, TEXT("IA64"));
280 break;
281
283 StringCchCat(lpInstallerPath, PathSize, TEXT("ALPHA64"));
284 break;
285
287 StringCchCat(lpInstallerPath, PathSize, TEXT("AMD64"));
288 break;
289
290 // case PROCESSOR_ARCHITECTURE_MSIL: /* .NET CPU-independent code */
292 default:
294 break;
295 }
296
298 StringCchCat(lpInstallerPath, PathSize, TEXT("\\"));
299 StringCchCat(lpInstallerPath, PathSize, lpInstallerName);
300
301 dwAttribs = GetFileAttributes(lpInstallerPath);
302 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
303 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
304 {
305 /* We have found the installer */
306 return TRUE;
307 }
308
309 /*
310 * We failed. Try to find the installer from either the current
311 * ReactOS installation directory, or from our current directory.
312 */
313 *lpInstallerPath = 0;
314 if (GetWindowsDirectory(lpInstallerPath, PathSize - cchInstallerNameLen - 1))
315 StringCchCat(lpInstallerPath, PathSize, TEXT("\\"));
316 StringCchCat(lpInstallerPath, PathSize, lpInstallerName);
317
318 dwAttribs = GetFileAttributes(lpInstallerPath);
319 if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
320 !(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
321 {
322 /* We have found the installer */
323 return TRUE;
324 }
325
326 /* Installer not found */
327 *lpInstallerPath = 0;
328 return FALSE;
329}
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
#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
#define StringCchCat
Definition: strsafe.h:317
WORD wProcessorArchitecture
Definition: winbase.h:1169
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:3857
#define GetFileAttributes
Definition: winbase.h:3815
#define GetModuleFileName
Definition: winbase.h:3831
CHAR * PTSTR
Definition: xmlstorage.h:191
#define _tcslen
Definition: xmlstorage.h:198

Referenced by AddNewTopicEx().

◆ FreeResources()

static VOID FreeResources ( VOID  )
static

Definition at line 709 of file welcome.c.

710{
711 if (!pTopics)
712 return;
713
714 while (dwNumberTopics--)
715 {
718 }
720 pTopics = NULL;
721 dwNumberTopics = 0;
722}
#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 1024 of file welcome.c.

1028{
1029 HFONT hOldFont;
1030 RECT rect;
1031
1032 rect.left = 0;
1033 rect.right = dwWidth - 20;
1034 rect.top = 0;
1035 rect.bottom = 25;
1036
1037 hOldFont = (HFONT)SelectObject(hDC, hFont);
1038 DrawText(hDC, szText, -1, &rect, DT_TOP | DT_CALCRECT | DT_WORDBREAK);
1039 SelectObject(hDC, hOldFont);
1040
1041 return (rect.bottom-rect.top + 14);
1042}
static HDC hDC
Definition: 3dtext.c:33
HFONT hFont
Definition: main.c:53
static const WCHAR dwWidth[]
Definition: provider.c:62
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
& rect
Definition: startmenu.cpp:1413
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define DrawText
Definition: winuser.h:5783
#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:583
#define GetLocaleInfo
Definition: winnls.h:1186
#define LOCALE_SNAME
Definition: winnls.h:130
#define LOCALE_SISO639LANGNAME
Definition: winnls.h:126
#define LOCALE_SISO3166CTRYNAME
Definition: winnls.h:127

Referenced by LoadLocalizedResourcesFromINI().

◆ InitializeTopicList()

VOID InitializeTopicList ( VOID  )

Definition at line 331 of file welcome.c.

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

Referenced by LoadConfiguration().

◆ LoadConfiguration()

static VOID LoadConfiguration ( VOID  )
static

Definition at line 637 of file welcome.c.

638{
639 DWORD dwAttribs;
640 BOOL bLoadDefaultResources;
641 TCHAR szAppPath[MAX_PATH];
642 TCHAR szIniPath[MAX_PATH];
643 TCHAR szResPath[MAX_PATH];
644
645 /* Initialize the topic list */
647
648 /*
649 * First, try to load the default internal (localized) strings.
650 * They can be redefined by the localized INI files.
651 */
653 StringCchCopy(szAppTitle, ARRAYSIZE(szAppTitle), TEXT("ReactOS - Welcome"));
655 *szDefaultTitle = 0;
657 *szDefaultDesc = 0;
658
659 /* Retrieve the full path to this application */
660 GetModuleFileName(NULL, szAppPath, ARRAYSIZE(szAppPath));
661 if (*szAppPath)
662 {
663 LPTSTR lpFileName = _tcsrchr(szAppPath, _T('\\'));
664 if (lpFileName)
665 *lpFileName = 0;
666 else
667 *szAppPath = 0;
668 }
669
670 /* Build the full INI file path name */
671 StringCchPrintf(szIniPath, ARRAYSIZE(szIniPath), TEXT("%s\\welcome.ini"), szAppPath);
672
673 /* Verify that the file exists, otherwise use the default configuration */
674 dwAttribs = GetFileAttributes(szIniPath);
675 if ((dwAttribs == INVALID_FILE_ATTRIBUTES) ||
676 (dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
677 {
678 /* Use the default internal (localized) resources */
680 return;
681 }
682
683 /* Load the settings from the INI configuration file */
684 bDisplayCheckBox = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayCheckBox"), FALSE /* default */, szIniPath);
685 bDisplayExitBtn = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("DisplayExitButton"), TRUE /* default */, szIniPath);
686
687 /* Load the default internal (localized) resources if needed */
688 bLoadDefaultResources = !!GetPrivateProfileInt(TEXT("Welcome"), TEXT("LoadDefaultResources"), FALSE /* default */, szIniPath);
689 if (bLoadDefaultResources)
691
692 GetPrivateProfileString(TEXT("Welcome"), TEXT("ResourceDir"), TEXT("") /* default */,
693 szResPath, ARRAYSIZE(szResPath), szIniPath);
694
695 /* Set the current directory to the one of this application, and retrieve the resources */
696 SetCurrentDirectory(szAppPath);
698 {
699 /*
700 * Loading localized resources from INI file failed, try to load the
701 * internal resources only if they were not already loaded earlier.
702 */
703 if (!bLoadDefaultResources)
705 }
706}
#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: utility.h:116
#define LOCALE_USER_DEFAULT
#define StringCchPrintf
Definition: strsafe.h:517
VOID InitializeTopicList(VOID)
Definition: welcome.c:331
static VOID LoadLocalizedResourcesInternal(VOID)
Definition: welcome.c:464
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:515
BOOL bDisplayCheckBox
Definition: welcome.c:65
TCHAR szDefaultTitle[TOPIC_TITLE_LENGTH]
Definition: welcome.c:96
_In_ LPCSTR lpFileName
Definition: winbase.h:3071
#define SetCurrentDirectory
Definition: winbase.h:3903
#define GetPrivateProfileInt
Definition: winbase.h:3832
#define GetPrivateProfileString
Definition: winbase.h:3835
#define LoadString
Definition: winuser.h:5831
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by _tWinMain().

◆ LoadLocalizedResourcesFromINI()

static BOOL LoadLocalizedResourcesFromINI ( LCID  Locale,
LPTSTR  lpResPath 
)
static

Definition at line 515 of file welcome.c.

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

Referenced by LoadConfiguration().

◆ LoadLocalizedResourcesInternal()

static VOID LoadLocalizedResourcesInternal ( VOID  )
static

Definition at line 464 of file welcome.c.

465{
466#define MAX_NUMBER_INTERNAL_TOPICS 3
467
468 UINT i;
469 LPTSTR lpszCommand, lpszAction;
470 TOPIC newTopic, *pTopic;
471
472 for (i = 0; i < MAX_NUMBER_INTERNAL_TOPICS; ++i)
473 {
474 lpszCommand = NULL, lpszAction = NULL;
475
476 /* Retrieve the information */
477 if (!LoadString(hInstance, IDS_TOPIC_BUTTON0 + i, newTopic.szText, ARRAYSIZE(newTopic.szText)))
478 *newTopic.szText = 0;
479 if (!LoadString(hInstance, IDS_TOPIC_TITLE0 + i, newTopic.szTitle, ARRAYSIZE(newTopic.szTitle)))
480 *newTopic.szTitle = 0;
481 if (!LoadString(hInstance, IDS_TOPIC_DESC0 + i, newTopic.szDesc, ARRAYSIZE(newTopic.szDesc)))
482 *newTopic.szDesc = 0;
483
485 *newTopic.szCommand = 0;
486
487 /* Only care about command arguments if we actually have a command */
488 if (*newTopic.szCommand)
489 {
490 lpszCommand = newTopic.szCommand;
491 if (!LoadString(hInstance, IDS_TOPIC_CMD_ARGS0 + i, newTopic.szArgs, ARRAYSIZE(newTopic.szArgs)))
492 *newTopic.szArgs = 0;
493 }
494 /* Only care about custom actions if we actually don't have a command */
495 else // if (!*newTopic.szCommand)
496 {
497 lpszAction = newTopic.szCommand;
499 *newTopic.szCommand = 0;
500 }
501
502 /* Allocate a new topic */
503 pTopic = AddNewTopicEx(newTopic.szText,
504 newTopic.szTitle,
505 newTopic.szDesc,
506 lpszCommand,
507 newTopic.szArgs,
508 lpszAction);
509 if (!pTopic)
510 break; // Cannot reallocate more
511 }
512}
#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: ndis.h:50
#define MAX_NUMBER_INTERNAL_TOPICS

Referenced by LoadConfiguration().

◆ MainWndProc()

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

Definition at line 1598 of file welcome.c.

1602{
1603 switch (uMsg)
1604 {
1605 case WM_CREATE:
1606 return OnCreate(hWnd, wParam, lParam);
1607
1608 case WM_COMMAND:
1609 return OnCommand(hWnd, wParam, lParam);
1610
1611 case WM_ACTIVATE:
1612 return OnActivate(hWnd, wParam, lParam);
1613
1614 case WM_PAINT:
1615 return OnPaint(hWnd, wParam, lParam);
1616
1617 case WM_DRAWITEM:
1618 return OnDrawItem(hWnd, wParam, lParam);
1619
1620 case WM_CTLCOLORSTATIC:
1622
1623 case WM_MOUSEMOVE:
1624 return OnMouseMove(hWnd, wParam, lParam);
1625
1626 case WM_DESTROY:
1628 PostQuitMessage(0);
1629 return 0;
1630 }
1631
1632 return DefWindowProc(hWnd, uMsg, wParam, lParam);
1633}
#define DefWindowProc
Definition: ros2win.h:31
static LRESULT OnCreate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1046
static LRESULT OnDestroy(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1552
static LRESULT OnActivate(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1526
static LRESULT OnCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1209
static LRESULT OnDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1411
static LRESULT OnCtlColorStatic(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1511
static LRESULT OnMouseMove(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1470
static LRESULT OnPaint(HWND hWnd, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:1260
#define WM_PAINT
Definition: winuser.h:1623
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1775
#define WM_CREATE
Definition: winuser.h:1611
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DRAWITEM
Definition: winuser.h:1648
#define WM_ACTIVATE
Definition: winuser.h:1615
#define WM_DESTROY
Definition: winuser.h:1612

Referenced by _tWinMain().

◆ OnActivate()

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

Definition at line 1526 of file welcome.c.

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

Referenced by MainWndProc().

◆ OnCommand()

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

Definition at line 1209 of file welcome.c.

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

Referenced by MainWndProc().

◆ OnCreate()

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

Definition at line 1046 of file welcome.c.

1047{
1048 UINT i;
1049 INT nLength;
1050 HDC ScreenDC;
1051 LOGFONT lf;
1052 DWORD dwTop;
1053 DWORD dwHeight = 0;
1054 TCHAR szText[80];
1055
1058
1061
1062 ZeroMemory(&lf, sizeof(lf));
1063
1064 lf.lfEscapement = 0;
1065 lf.lfOrientation = 0; // TA_BASELINE;
1066 // lf.lfItalic = lf.lfUnderline = lf.lfStrikeOut = FALSE;
1073 StringCchCopy(lf.lfFaceName, ARRAYSIZE(lf.lfFaceName), TEXT("Tahoma"));
1074
1075 /* Topic title font */
1076 lf.lfHeight = -18;
1077 lf.lfWidth = 0;
1078 lf.lfWeight = FW_NORMAL;
1080
1081 /* Topic description font */
1082 lf.lfHeight = -11;
1083 lf.lfWidth = 0;
1084 lf.lfWeight = FW_THIN;
1086
1087 /* Topic button font */
1088 lf.lfHeight = -11;
1089 lf.lfWidth = 0;
1090 lf.lfWeight = FW_BOLD;
1092
1093 /* Load title bitmap */
1094 if (hTitleBitmap)
1096
1097 /* Load topic bitmaps */
1099 for (i = 0; i < dwNumberTopics; i++)
1100 {
1101 // FIXME: Not implemented yet!
1102 // pTopics[i]->hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TOPIC_BITMAP0 + i));
1103 pTopics[i]->hBitmap = NULL;
1104 }
1105
1106 ScreenDC = GetWindowDC(hWnd);
1107 hdcMem = CreateCompatibleDC(ScreenDC);
1108 ReleaseDC(hWnd, ScreenDC);
1109
1110 /* Load and create the menu buttons */
1111 dwTop = rcLeftPanel.top;
1112 for (i = 0; i < dwNumberTopics; i++)
1113 {
1114 if (*pTopics[i]->szText)
1115 {
1118 pTopics[i]->szText,
1120
1121 pTopics[i]->hWndButton = CreateWindow(TEXT("BUTTON"),
1122 pTopics[i]->szText,
1123 (*pTopics[i]->szCommand ? 0 : WS_DISABLED) |
1127 dwTop,
1129 dwHeight,
1130 hWnd,
1131 (HMENU)IntToPtr(TOPIC_BTN_ID_BASE + i), // Similar to SetWindowLongPtr(GWLP_ID)
1132 hInstance,
1133 NULL);
1134 nDefaultTopic = i;
1137 }
1138 else
1139 {
1141 }
1142
1143 dwTop += dwHeight;
1144 }
1145
1146 /* Create the checkbox */
1147 if (bDisplayCheckBox)
1148 {
1149 nLength = LoadString(hInstance, IDS_CHECKTEXT, szText, ARRAYSIZE(szText));
1150 if (nLength > 0)
1151 {
1152 lf.lfHeight = -10;
1153 lf.lfWidth = 0;
1154 lf.lfWeight = FW_THIN;
1156
1157 hWndCheckButton = CreateWindow(TEXT("BUTTON"),
1158 szText,
1161 rcLeftPanel.left + 8,
1162 rcLeftPanel.bottom - 8 - 13,
1164 13,
1165 hWnd,
1167 hInstance,
1168 NULL);
1170 }
1171 else
1172 {
1175 }
1176 }
1177
1178 /* Create the "Exit" button */
1179 if (bDisplayExitBtn)
1180 {
1181 nLength = LoadString(hInstance, IDS_CLOSETEXT, szText, ARRAYSIZE(szText));
1182 if (nLength > 0)
1183 {
1184 hWndCloseButton = CreateWindow(TEXT("BUTTON"),
1185 szText,
1187 rcRightPanel.right - 8 - 57,
1188 rcRightPanel.bottom - 8 - 21,
1189 57,
1190 21,
1191 hWnd,
1193 hInstance,
1194 NULL);
1195 nDefaultTopic = -1;
1197 }
1198 else
1199 {
1201 }
1202 }
1203
1204 return 0;
1205}
#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:89
static const WCHAR dwHeight[]
Definition: provider.c:63
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:1024
INT_PTR CALLBACK ButtonSubclassWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: welcome.c:928
INT nDefaultTopic
Definition: welcome.c:102
#define ZeroMemory
Definition: winbase.h:1712
_In_ DWORD nLength
Definition: wincon.h:473
#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:4444
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetWindowDC(_In_opt_ HWND)
#define MAKELPARAM(l, h)
Definition: winuser.h:4011
#define BS_MULTILINE
Definition: winuser.h:267
#define BS_FLAT
Definition: winuser.h:280
#define WM_SETFONT
Definition: winuser.h:1653

Referenced by MainWndProc().

◆ OnCtlColorStatic()

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

Definition at line 1511 of file welcome.c.

1512{
1514
1515 if ((HWND)lParam == hWndCheckButton)
1516 {
1518 return (LRESULT)hbrLightBlue;
1519 }
1520
1521 return 0;
1522}
LONG_PTR LRESULT
Definition: windef.h:209
#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 1552 of file welcome.c.

1553{
1554 UINT i;
1555
1559
1560 for (i = 0; i < dwNumberTopics; i++)
1561 {
1562 if (pTopics[i]->hWndButton)
1563 DestroyWindow(pTopics[i]->hWndButton);
1564 }
1565
1566 if (hWndCloseButton)
1568
1569 if (hWndCheckButton)
1571
1573
1574 /* Delete bitmaps */
1577 for (i = 0; i < dwNumberTopics; i++)
1578 {
1579 if (pTopics[i]->hBitmap)
1581 }
1582
1586
1587 if (hFontCheckButton)
1589
1592
1593 return 0;
1594}
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 1411 of file welcome.c.

1412{
1414 HPEN hPen, hOldPen;
1415 HBRUSH hOldBrush;
1416 INT iBkMode;
1417 TCHAR szText[80];
1418
1421
1422#if 0
1423 /* Neither the checkbox button nor the close button implement owner-drawing */
1424 if (lpDis->hwndItem == hWndCheckButton)
1425 return 0;
1426 if (lpDis->hwndItem == hWndCloseButton)
1427 {
1428 DrawFrameControl(lpDis->hDC,
1429 &lpDis->rcItem,
1430 DFC_BUTTON,
1432 return TRUE;
1433 }
1434#endif
1435
1436 if (lpDis->CtlID == (ULONG)(TOPIC_BTN_ID_BASE + nTopic))
1437 hOldBrush = (HBRUSH)SelectObject(lpDis->hDC, GetStockObject(WHITE_BRUSH));
1438 else
1439 hOldBrush = (HBRUSH)SelectObject(lpDis->hDC, hbrLightBlue);
1440
1441 PatBlt(lpDis->hDC,
1442 lpDis->rcItem.left,
1443 lpDis->rcItem.top,
1444 lpDis->rcItem.right,
1445 lpDis->rcItem.bottom,
1446 PATCOPY);
1447 SelectObject(lpDis->hDC, hOldBrush);
1448
1449 hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
1450 hOldPen = (HPEN)SelectObject(lpDis->hDC, hPen);
1451 MoveToEx(lpDis->hDC, lpDis->rcItem.left, lpDis->rcItem.bottom - 1, NULL);
1452 LineTo(lpDis->hDC, lpDis->rcItem.right, lpDis->rcItem.bottom - 1);
1453 SelectObject(lpDis->hDC, hOldPen);
1454 DeleteObject(hPen);
1455
1456 InflateRect(&lpDis->rcItem, -10, -4);
1457 OffsetRect(&lpDis->rcItem, 0, 1);
1458 GetWindowText(lpDis->hwndItem, szText, ARRAYSIZE(szText));
1461 iBkMode = SetBkMode(lpDis->hDC, TRANSPARENT);
1462 DrawText(lpDis->hDC, szText, -1, &lpDis->rcItem, DT_TOP | DT_LEFT | DT_WORDBREAK);
1463 SetBkMode(lpDis->hDC, iBkMode);
1464
1465 return TRUE;
1466}
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:918
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:935
#define DFCS_BUTTONPUSH
Definition: winuser.h:501
#define COLOR_WINDOWTEXT
Definition: winuser.h:924
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:5810
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 1470 of file welcome.c.

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

Referenced by MainWndProc().

◆ OnPaint()

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

Definition at line 1260 of file welcome.c.

1261{
1262 HPEN hPen;
1263 HPEN hOldPen;
1264 HDC hdc;
1265 PAINTSTRUCT ps;
1266 HBITMAP hOldBitmap = NULL;
1267 HBRUSH hOldBrush;
1268 HFONT hOldFont;
1269 RECT rcTitle, rcDescription;
1270 BITMAP bmpInfo;
1271 TCHAR szVersion[50];
1272 LPTSTR lpTitle = NULL, lpDesc = NULL;
1273
1276
1277 hdc = BeginPaint(hWnd, &ps);
1278
1279 /* Banner panel */
1281
1282 /* Left panel */
1283 hOldBrush = (HBRUSH)SelectObject(hdc, hbrLightBlue);
1284 PatBlt(hdc,
1289 PATCOPY);
1290 SelectObject(hdc, hOldBrush);
1291
1292 /* Right panel */
1293 hOldBrush = (HBRUSH)SelectObject(hdc, GetStockObject(WHITE_BRUSH));
1294 PatBlt(hdc,
1299 PATCOPY);
1300 SelectObject(hdc, hOldBrush);
1301
1302 /* Draw dark vertical line */
1303 hPen = CreatePen(PS_SOLID, 0, DARK_BLUE);
1304 hOldPen = (HPEN)SelectObject(hdc, hPen);
1307 SelectObject(hdc, hOldPen);
1308 DeleteObject(hPen);
1309
1310 /* Draw topic bitmap */
1311 if ((nTopic == -1) && (hDefaultTopicBitmap))
1312 {
1313 GetObject(hDefaultTopicBitmap, sizeof(bmpInfo), &bmpInfo);
1315 BitBlt(hdc,
1316 rcRightPanel.right - bmpInfo.bmWidth,
1317 rcRightPanel.bottom - bmpInfo.bmHeight,
1318 bmpInfo.bmWidth,
1319 bmpInfo.bmHeight,
1320 hdcMem,
1321 0,
1322 0,
1323 SRCCOPY);
1324 }
1325 else if ((nTopic != -1) && (pTopics[nTopic]->hBitmap))
1326 {
1327 GetObject(pTopics[nTopic]->hBitmap, sizeof(bmpInfo), &bmpInfo);
1328 hOldBitmap = (HBITMAP)SelectObject(hdcMem, pTopics[nTopic]->hBitmap);
1329 BitBlt(hdc,
1330 rcRightPanel.right - bmpInfo.bmWidth,
1331 rcRightPanel.bottom - bmpInfo.bmHeight,
1332 bmpInfo.bmWidth,
1333 bmpInfo.bmHeight,
1334 hdcMem,
1335 0,
1336 0,
1337 SRCCOPY);
1338 }
1339
1340 if (nTopic == -1)
1341 {
1343 lpDesc = szDefaultDesc;
1344 }
1345 else
1346 {
1348 lpDesc = pTopics[nTopic]->szDesc;
1349 }
1350
1352
1353 /* Draw version information */
1355 TEXT("ReactOS ") TEXT(KERNEL_VERSION_STR));
1356
1357 /*
1358 * Compute the original rect (position & size) of the version info,
1359 * depending whether the checkbox is displayed (version info in the
1360 * right panel) or not (version info in the left panel).
1361 */
1362 if (bDisplayCheckBox)
1363 rcTitle = rcRightPanel;
1364 else
1365 rcTitle = rcLeftPanel;
1366
1367 rcTitle.left = rcTitle.left + 8;
1368 rcTitle.right = rcTitle.right - 5;
1369 rcTitle.top = rcTitle.bottom - 43;
1370 rcTitle.bottom = rcTitle.bottom - 8;
1371
1375 DrawText(hdc, szVersion, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE);
1376 SelectObject(hdc, hOldFont);
1377
1378 /* Draw topic title */
1379 rcTitle.left = rcRightPanel.left + 12;
1380 rcTitle.right = rcRightPanel.right - 8;
1381 rcTitle.top = rcRightPanel.top + 8;
1382 rcTitle.bottom = rcTitle.top + 57;
1383 hOldFont = (HFONT)SelectObject(hdc, hFontTopicTitle);
1384 DrawText(hdc, lpTitle, -1, &rcTitle, DT_TOP | DT_CALCRECT);
1386 DrawText(hdc, lpTitle, -1, &rcTitle, DT_TOP);
1387 SelectObject(hdc, hOldFont);
1388
1389 /* Draw topic description */
1390 rcDescription.left = rcRightPanel.left + 12;
1391 rcDescription.right = rcRightPanel.right - 8;
1392 rcDescription.top = rcTitle.bottom + 8;
1393 rcDescription.bottom = rcRightPanel.bottom - 20;
1396 DrawText(hdc, lpDesc, -1, &rcDescription, DT_TOP | DT_WORDBREAK);
1397 SelectObject(hdc, hOldFont);
1398
1400
1401 SelectObject(hdcMem, hOldBrush);
1402 SelectObject(hdcMem, hOldBitmap);
1403
1404 EndPaint(hWnd, &ps);
1405
1406 return 0;
1407}
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_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:57
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:1232
#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 1232 of file welcome.c.

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

Referenced by OnPaint().

◆ RunAction()

static BOOL RunAction ( INT  nTopic)
static

Definition at line 986 of file welcome.c.

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

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
__wchar_t WCHAR
Definition: xmlstorage.h:180

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().