ReactOS  0.4.13-dev-479-gec9c8fd
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 63 of file licence.c.

67 {
68  PLIC_CONTEXT pLicInfo;
69 
71 
72  pLicInfo = (PLIC_CONTEXT)GetWindowLongPtr(hDlg, DWLP_USER);
73 
74  switch (uMsg)
75  {
76  case WM_INITDIALOG:
77  pLicInfo = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(LIC_CONTEXT));
78  if (pLicInfo == NULL)
79  {
80  EndDialog(hDlg, 0);
81  return FALSE;
82  }
83  SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pLicInfo);
84  return OnInitDialog(hDlg, pLicInfo);
85 
86  case WM_DESTROY:
87  if (pLicInfo)
88  {
89  DestroyIcon(pLicInfo->hIcon);
90  HeapFree(GetProcessHeap(), 0, pLicInfo);
91  }
92  break;
93 
94  case WM_COMMAND:
95  if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
96  {
97  EndDialog(hDlg,
98  LOWORD(wParam));
99  return TRUE;
100  }
101  break;
102  }
103 
104  return FALSE;
105 }
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#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:19
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1716
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
struct _LIC_CONTEXT * PLIC_CONTEXT
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
HICON hIcon
Definition: licence.c:14

Referenced by GeneralPageProc().

◆ OnInitDialog()

static BOOL OnInitDialog ( HWND  hDlg,
PLIC_CONTEXT  pLicInfo 
)
static

Definition at line 19 of file licence.c.

20 {
21  HRSRC hResInfo;
22  HGLOBAL hResMem;
23  PCSTR LicenseText;
24 
25  pLicInfo->hIcon = LoadImage(hApplet,
27  IMAGE_ICON,
28  16,
29  16,
30  0);
31 
32  SendMessage(hDlg,
33  WM_SETICON,
34  ICON_SMALL,
35  (LPARAM)pLicInfo->hIcon);
36 
37  /* Load license from resource */
38  if (!(hResInfo = FindResource(hApplet,
41  !(hResMem = LoadResource(hApplet, hResInfo)) ||
42  !(LicenseText = LockResource(hResMem)))
43  {
44  ShowLastWin32Error(hDlg);
45  return FALSE;
46  }
47 
48  /* Insert the license into the edit control */
49  SetDlgItemTextA(hDlg,
51  LicenseText);
52 
54  EM_SETSEL,
55  -1,
56  0);
58  return TRUE;
59 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
#define FindResource
Definition: winbase.h:3607
#define IDI_CPLSYSTEM
Definition: resource.h:4
BOOL WINAPI SetDlgItemTextA(_In_ HWND, _In_ int, _In_ LPCSTR)
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HINSTANCE hApplet
Definition: access.c:17
#define ICON_SMALL
Definition: tnclass.cpp:48
#define IDC_LICENCEEDIT
Definition: resource.h:208
void ShowLastWin32Error(HWND hwndParent)
Definition: winutils.c:11
#define RTDATA
Definition: resource.h:210
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
LONG_PTR LPARAM
Definition: windef.h:208
#define PostMessage
Definition: winuser.h:5698
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define EM_SETSEL
Definition: winuser.h:1979
#define RC_LICENSE
Definition: resource.h:209
#define SB_TOP
Definition: winuser.h:578
#define SendMessage
Definition: winuser.h:5709
#define LoadImage
Definition: winuser.h:5681
const char * PCSTR
Definition: typedefs.h:51
HICON hIcon
Definition: licence.c:14
#define WM_VSCROLL
Definition: winuser.h:1720

Referenced by LicenceDlgProc().