ReactOS  0.4.15-dev-5487-ge7bbbf0
licence.c File Reference
#include "precomp.h"
Include dependency graph for licence.c:

Go to the source code of this file.

Classes

struct  _LIC_CONTEXT
 

Typedefs

typedef struct _LIC_CONTEXT LIC_CONTEXT
 
typedef struct _LIC_CONTEXTPLIC_CONTEXT
 

Functions

static BOOL OnInitDialog (HWND hDlg, PLIC_CONTEXT pLicInfo)
 
INT_PTR CALLBACK LicenceDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Typedef Documentation

◆ LIC_CONTEXT

◆ PLIC_CONTEXT

Function Documentation

◆ LicenceDlgProc()

INT_PTR CALLBACK LicenceDlgProc ( HWND  hDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 68 of file licence.c.

72 {
73  PLIC_CONTEXT pLicInfo;
74 
76 
77  pLicInfo = (PLIC_CONTEXT)GetWindowLongPtr(hDlg, DWLP_USER);
78 
79  switch (uMsg)
80  {
81  case WM_INITDIALOG:
82  pLicInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LIC_CONTEXT));
83  if (pLicInfo == NULL)
84  {
85  EndDialog(hDlg, 0);
86  return FALSE;
87  }
88  SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pLicInfo);
89  return OnInitDialog(hDlg, pLicInfo);
90 
91  case WM_DESTROY:
92  if (pLicInfo)
93  {
94  if (pLicInfo->hIconSm)
95  DestroyIcon(pLicInfo->hIconSm);
96 
97  if (pLicInfo->hIcon)
98  DestroyIcon(pLicInfo->hIcon);
99 
100  HeapFree(GetProcessHeap(), 0, pLicInfo);
101  }
102  break;
103 
104  case WM_COMMAND:
105  if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
106  {
107  EndDialog(hDlg,
108  LOWORD(wParam));
109  return TRUE;
110  }
111  break;
112  }
113 
114  return FALSE;
115 }
#define IDOK
Definition: winuser.h:824
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
HICON hIconSm
Definition: licence.c:15
#define SetWindowLongPtr
Definition: treelist.c:70
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
static BOOL OnInitDialog(HWND hDlg, PLIC_CONTEXT pLicInfo)
Definition: licence.c:20
#define FALSE
Definition: types.h:117
#define WM_DESTROY
Definition: winuser.h:1599
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1730
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
struct _LIC_CONTEXT * PLIC_CONTEXT
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:735
HICON hIcon
Definition: licence.c:14

Referenced by GeneralPageProc().

◆ OnInitDialog()

static BOOL OnInitDialog ( HWND  hDlg,
PLIC_CONTEXT  pLicInfo 
)
static

Definition at line 20 of file licence.c.

21 {
22  HRSRC hResInfo;
23  HGLOBAL hResMem;
24  PCSTR LicenseText;
25 
26  pLicInfo->hIcon = LoadImage(hApplet,
28  IMAGE_ICON,
32  pLicInfo->hIconSm = LoadImage(hApplet,
34  IMAGE_ICON,
38 
39  SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pLicInfo->hIcon);
40  SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)pLicInfo->hIconSm);
41 
42  /* Load license from resource */
43  if (!(hResInfo = FindResource(hApplet,
46  !(hResMem = LoadResource(hApplet, hResInfo)) ||
47  !(LicenseText = LockResource(hResMem)))
48  {
49  ShowLastWin32Error(hDlg);
50  return FALSE;
51  }
52 
53  /* Insert the license into the edit control */
54  SetDlgItemTextA(hDlg,
56  LicenseText);
57 
59  EM_SETSEL,
60  -1,
61  0);
63  return TRUE;
64 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IMAGE_ICON
Definition: winuser.h:212
#define FindResource
Definition: winbase.h:3664
#define TRUE
Definition: types.h:120
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
HICON hIconSm
Definition: licence.c:15
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
#define SM_CYSMICON
Definition: winuser.h:1007
HINSTANCE hApplet
Definition: access.c:17
#define ICON_SMALL
Definition: tnclass.cpp:48
#define IDC_LICENCEEDIT
Definition: resource.h:226
void ShowLastWin32Error(HWND hwndParent)
Definition: winutils.c:11
#define FALSE
Definition: types.h:117
#define RTDATA
Definition: resource.h:228
#define SM_CXICON
Definition: winuser.h:966
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
LONG_PTR LPARAM
Definition: windef.h:208
#define PostMessage
Definition: winuser.h:5822
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SETSEL
Definition: winuser.h:2008
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CXSMICON
Definition: winuser.h:1006
#define RC_LICENSE
Definition: resource.h:227
#define IDI_LICENSE
Definition: resource.h:9
#define SM_CYICON
Definition: winuser.h:967
#define SB_TOP
Definition: winuser.h:578
#define SendMessage
Definition: winuser.h:5833
#define LoadImage
Definition: winuser.h:5805
const char * PCSTR
Definition: typedefs.h:52
#define LR_DEFAULTCOLOR
Definition: winuser.h:1081
HICON hIcon
Definition: licence.c:14
#define ICON_BIG
Definition: tnclass.cpp:51
#define WM_VSCROLL
Definition: winuser.h:1734

Referenced by LicenceDlgProc().