ReactOS  0.4.15-dev-4916-gd519b11
control.c File Reference
#include <assert.h>
#include <windef.h>
#include <winbase.h>
#include <shlwapi.h>
#include <shellapi.h>
#include <shobjidl.h>
#include <wine/debug.h>
#include <strsafe.h>
#include "cpanel.h"
#include "wine/unicode.h"
Include dependency graph for control.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define NO_SHLWAPI_REG
 
#define COBJMACROS
 
#define IDC_LISTVIEW   1000
 
#define IDC_STATUSBAR   1001
 
#define NUM_COLUMNS   2
 
#define LISTVIEW_DEFSTYLE
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shlctrl)
 
void Control_UnloadApplet (CPlApplet *applet)
 
CPlAppletControl_LoadApplet (HWND hWnd, LPCWSTR cmd, CPanel *panel)
 
static BOOL Control_CreateListView (CPanel *panel)
 
static void Control_WndProc_Create (HWND hWnd, const CREATESTRUCTW *cs)
 
static void Control_FreeCPlItems (HWND hWnd, CPanel *panel)
 
static void Control_UpdateListViewStyle (CPanel *panel, UINT style, UINT id)
 
static CPlItemControl_GetCPlItem_From_MenuID (HWND hWnd, UINT id)
 
static CPlItemControl_GetCPlItem_From_ListView (CPanel *panel)
 
static void Control_StartApplet (HWND hWnd, CPlItem *item)
 
static LRESULT WINAPI Control_WndProc (HWND hWnd, UINT wMsg, WPARAM lParam1, LPARAM lParam2)
 
static void Control_DoInterface (CPanel *panel, HWND hWnd, HINSTANCE hInst)
 
static void Control_RegisterRegistryApplets (HWND hWnd, CPanel *panel, HKEY hkey_root, LPCWSTR szRepPath)
 
static void Control_DoWindow (CPanel *panel, HWND hWnd, HINSTANCE hInst)
 
static void Control_DoLaunch (CPanel *panel, HWND hWnd, LPCWSTR wszCmd)
 
void WINAPI Control_RunDLLW (HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
 
void WINAPI Control_RunDLLA (HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdShow)
 
HRESULT WINAPI Control_FillCache_RunDLLW (HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
 
HRESULT WINAPI Control_FillCache_RunDLLA (HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
 
DWORD WINAPI CallCPLEntry16 (HMODULE hMod, FARPROC pFunc, DWORD dw3, DWORD dw4, DWORD dw5, DWORD dw6)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 25 of file control.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 32 of file control.c.

◆ IDC_LISTVIEW

#define IDC_LISTVIEW   1000

Definition at line 215 of file control.c.

◆ IDC_STATUSBAR

#define IDC_STATUSBAR   1001

Definition at line 216 of file control.c.

◆ LISTVIEW_DEFSTYLE

#define LISTVIEW_DEFSTYLE
Value:
LVS_SORTASCENDING | LVS_AUTOARRANGE | LVS_SINGLESEL)
#define WS_CHILD
Definition: pedump.c:617
#define LVS_AUTOARRANGE
Definition: commctrl.h:2272
#define LVS_SINGLESEL
Definition: commctrl.h:2266
#define WS_TABSTOP
Definition: pedump.c:634
#define WS_VISIBLE
Definition: pedump.c:620

Definition at line 219 of file control.c.

◆ NO_SHLWAPI_REG

#define NO_SHLWAPI_REG

Definition at line 29 of file control.c.

◆ NUM_COLUMNS

#define NUM_COLUMNS   2

Definition at line 218 of file control.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 24 of file control.c.

Function Documentation

◆ CallCPLEntry16()

DWORD WINAPI CallCPLEntry16 ( HMODULE  hMod,
FARPROC  pFunc,
DWORD  dw3,
DWORD  dw4,
DWORD  dw5,
DWORD  dw6 
)

Definition at line 1125 of file control.c.

1130 {
1131  FIXME("(%p, %p, %08x, %08x, %08x, %08x): stub.\n", hMod, pFunc, dw3, dw4, dw5, dw6);
1132  return 0x0deadbee;
1133 }
#define FIXME(fmt,...)
Definition: debug.h:111

◆ Control_CreateListView()

static BOOL Control_CreateListView ( CPanel panel)
static

Definition at line 222 of file control.c.

223 {
224  RECT ws, sb;
225  WCHAR empty_string[] = {0};
227  LVCOLUMNW lvc;
228 
229  /* Create list view */
230  GetClientRect(panel->hWndStatusBar, &sb);
231  GetClientRect(panel->hWnd, &ws);
232 
234  empty_string, LISTVIEW_DEFSTYLE | LVS_ICON,
235  0, 0, ws.right - ws.left, ws.bottom - ws.top -
236  (sb.bottom - sb.top), panel->hWnd,
237  (HMENU) IDC_LISTVIEW, panel->hInst, NULL);
238 
239  if (!panel->hWndListView)
240  return FALSE;
241 
242  /* Create image lists for list view */
247 
250 
251  /* Create columns for list view */
253  lvc.pszText = buf;
254  lvc.fmt = LVCFMT_LEFT;
255 
256  /* Name column */
257  lvc.iSubItem = 0;
258  lvc.cx = (ws.right - ws.left) / 3;
259  LoadStringW(shell32_hInstance, IDS_CPANEL_NAME, buf, sizeof(buf) / sizeof(buf[0]));
260 
261  if (ListView_InsertColumnW(panel->hWndListView, 0, &lvc) == -1)
262  return FALSE;
263 
264  /* Description column */
265  lvc.iSubItem = 1;
266  lvc.cx = ((ws.right - ws.left) / 3) * 2;
267  LoadStringW(shell32_hInstance, IDS_CPANEL_DESCRIPTION, buf, sizeof(buf) /
268  sizeof(buf[0]));
269 
270  if (ListView_InsertColumnW(panel->hWndListView, 1, &lvc) == -1)
271  return FALSE;
272 
273  return(TRUE);
274 }
HWND hWndListView
Definition: cpanel.h:61
const char * ws
Definition: skip_ws.cpp:7
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVSIL_SMALL
Definition: commctrl.h:2299
#define LVCF_TEXT
Definition: commctrl.h:2588
HWND hWnd
Definition: cpanel.h:58
#define TRUE
Definition: types.h:120
superblock * sb
Definition: btrfs.c:4230
HIMAGELIST hImageListSmall
Definition: cpanel.h:63
#define WC_LISTVIEWW
Definition: commctrl.h:2257
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define SM_CYSMICON
Definition: winuser.h:1007
HINSTANCE hInst
Definition: cpanel.h:59
#define MAX_STRING_LEN
Definition: precomp.h:36
#define LISTVIEW_DEFSTYLE
Definition: control.c:219
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define ILC_COLOR32
Definition: commctrl.h:358
#define LVCF_SUBITEM
Definition: commctrl.h:2589
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
Definition: imagelist.c:804
HWND hWndStatusBar
Definition: cpanel.h:64
#define FALSE
Definition: types.h:117
#define SM_CXICON
Definition: winuser.h:966
LONG_PTR LPARAM
Definition: windef.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR pszText
Definition: commctrl.h:2567
int WINAPI GetSystemMetrics(_In_ int)
#define LVS_ICON
Definition: commctrl.h:2261
#define SM_CXSMICON
Definition: winuser.h:1006
#define SM_CYICON
Definition: winuser.h:967
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define ILC_MASK
Definition: commctrl.h:351
#define LVSIL_NORMAL
Definition: commctrl.h:2298
#define LVM_SETIMAGELIST
Definition: commctrl.h:2303
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2586
#define shell32_hInstance
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HIMAGELIST hImageListLarge
Definition: cpanel.h:62
#define NULL
Definition: types.h:112
#define IDC_LISTVIEW
Definition: control.c:215
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by Control_WndProc_Create().

◆ Control_DoInterface()

static void Control_DoInterface ( CPanel panel,
HWND  hWnd,
HINSTANCE  hInst 
)
static

Definition at line 638 of file control.c.

639 {
640  WNDCLASSEXW wc;
641  MSG msg;
643  const WCHAR className[] = {'S','h','e','l','l','_','C','o','n','t','r','o',
644  'l','_','W','n','d','C','l','a','s','s',0};
645 
646  LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName, sizeof(appName) / sizeof(appName[0]));
647 
648  wc.cbSize = sizeof(wc);
651  wc.cbClsExtra = 0;
652  wc.cbWndExtra = sizeof(CPlApplet*);
653  wc.hInstance = panel->hInst = hInst;
655  wc.hCursor = LoadCursorW( 0, (LPWSTR)IDC_ARROW );
657  wc.lpszMenuName = NULL;
658  wc.lpszClassName = className;
661 
662  if (!RegisterClassExW(&wc)) return;
663 
668  hWnd, NULL, hInst, panel);
669  if (!panel->hWnd) return;
670 
671  while (GetMessageW(&msg, panel->hWnd, 0, 0)) {
674  }
675 }
HGDIOBJ WINAPI GetStockObject(_In_ int)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
int cbWndExtra
Definition: winuser.h:3200
HWND hWnd
Definition: cpanel.h:58
#define IDI_SHELL_CONTROL_PANEL
Definition: shresdef.h:545
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
HWND hWnd
Definition: settings.c:17
#define CS_HREDRAW
Definition: winuser.h:648
#define SM_CYSMICON
Definition: winuser.h:1007
HICON hIcon
Definition: winuser.h:3202
HINSTANCE hInst
Definition: cpanel.h:59
#define WHITE_BRUSH
Definition: wingdi.h:902
#define MAX_STRING_LEN
Definition: precomp.h:36
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
LPCWSTR lpszMenuName
Definition: winuser.h:3205
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
#define CW_USEDEFAULT
Definition: winuser.h:225
int cbClsExtra
Definition: winuser.h:3199
LPCWSTR lpszClassName
Definition: winuser.h:3206
#define CS_VREDRAW
Definition: winuser.h:653
__wchar_t WCHAR
Definition: xmlstorage.h:180
HBRUSH hbrBackground
Definition: winuser.h:3204
UINT cbSize
Definition: winuser.h:3196
int WINAPI GetSystemMetrics(_In_ int)
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HINSTANCE hInstance
Definition: winuser.h:3201
#define SM_CXSMICON
Definition: winuser.h:1006
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
HCURSOR hCursor
Definition: winuser.h:3203
UINT style
Definition: winuser.h:3197
WNDPROC lpfnWndProc
Definition: winuser.h:3198
static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg, WPARAM lParam1, LPARAM lParam2)
Definition: control.c:473
HINSTANCE hInst
Definition: dxdiag.c:13
#define shell32_hInstance
#define NULL
Definition: types.h:112
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
HICON hIconSm
Definition: winuser.h:3207
#define msg(x)
Definition: auth_time.c:54
#define IDC_ARROW
Definition: winuser.h:682
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
const char * appName(const char *argv0)
Definition: loadlib.c:89
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by Control_DoWindow().

◆ Control_DoLaunch()

static void Control_DoLaunch ( CPanel panel,
HWND  hWnd,
LPCWSTR  wszCmd 
)
static

Definition at line 873 of file control.c.

882 {
883  LPWSTR buffer;
884  LPWSTR beg = NULL;
885  LPWSTR end;
886  WCHAR ch;
887  LPWSTR ptr;
888  signed sp = -1;
889  LPWSTR extraPmtsBuf = NULL;
890  LPWSTR extraPmts = NULL;
891  BOOL quoted = FALSE;
892  CPlApplet *applet;
893 
894  buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
895  if (!buffer) return;
896 
897  end = lstrcpyW(buffer, wszCmd);
898 
899  for (;;) {
900  ch = *end;
901  if (ch == '"') quoted = !quoted;
902  if (!quoted && (ch == ' ' || ch == ',' || ch == '\0')) {
903  *end = '\0';
904  if (beg) {
905  if (*beg == '@') {
906  sp = atoiW(beg + 1);
907  } else if (*beg == '\0') {
908  sp = -1;
909  } else {
910  extraPmtsBuf = beg;
911  }
912  }
913  if (ch == '\0') break;
914  beg = end + 1;
915  if (ch == ' ') while (end[1] == ' ') end++;
916  }
917  end++;
918  }
919  while ((ptr = StrChrW(buffer, '"')))
920  memmove(ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
921 
922  /* now check for any quotes in extraPmtsBuf and remove */
923  if (extraPmtsBuf != NULL)
924  {
925  beg = end = extraPmtsBuf;
926  quoted = FALSE;
927 
928  for (;;) {
929  ch = *end;
930  if (ch == '"') quoted = !quoted;
931  if (!quoted && (ch == ' ' || ch == ',' || ch == '\0')) {
932  *end = '\0';
933  if (beg) {
934  if (*beg != '\0') {
935  extraPmts = beg;
936  }
937  }
938  if (ch == '\0') break;
939  beg = end + 1;
940  if (ch == ' ') while (end[1] == ' ') end++;
941  }
942  end++;
943  }
944 
945  while ((ptr = StrChrW(extraPmts, '"')))
946  memmove(ptr, ptr+1, lstrlenW(ptr)*sizeof(WCHAR));
947 
948  if (extraPmts == NULL)
949  extraPmts = extraPmtsBuf;
950  }
951 
952  /* Now check if there had been a numerical value in the extra params */
953  if ((extraPmts) && (*extraPmts == '@') && (sp == -1)) {
954  sp = atoiW(extraPmts + 1);
955  }
956 
957  TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer), debugstr_w(extraPmts), sp);
958 
959  applet = Control_LoadApplet(hWnd, buffer, panel);
960  if (applet)
961  {
962 #ifdef __REACTOS__
964  BOOL bActivated;
965  ATOM aCPLName;
966  ATOM aCPLFlags;
967  ATOM aCPLPath;
968  AppDlgFindData findData;
969 #endif
970  /* we've been given a textual parameter (or none at all) */
971  if (sp == -1) {
972  while ((++sp) != applet->count) {
973  TRACE("sp %d, name %s\n", sp, debugstr_w(applet->info[sp].name));
974 
975  if (StrCmpIW(extraPmts, applet->info[sp].name) == 0)
976  break;
977  }
978  }
979 
980  if (sp >= applet->count) {
981  WARN("Out of bounds (%u >= %u), setting to 0\n", sp, applet->count);
982  sp = 0;
983  }
984 
985 #ifdef __REACTOS__
986  bActivated = (applet->hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(applet->hActCtx, &cookie) : FALSE);
987 
988  aCPLPath = GlobalFindAtomW(applet->cmd);
989  if (!aCPLPath)
990  {
991  aCPLPath = GlobalAddAtomW(applet->cmd);
992  }
993 
994  aCPLName = GlobalFindAtomW(L"CPLName");
995  if (!aCPLName)
996  {
997  aCPLName = GlobalAddAtomW(L"CPLName");
998  }
999 
1000  aCPLFlags = GlobalFindAtomW(L"CPLFlags");
1001  if (!aCPLFlags)
1002  {
1003  aCPLFlags = GlobalAddAtomW(L"CPLFlags");
1004  }
1005 
1006  findData.szAppFile = applet->cmd;
1007  findData.sAppletNo = (UINT_PTR)(sp + 1);
1008  findData.aCPLName = aCPLName;
1009  findData.aCPLFlags = aCPLFlags;
1010  findData.hRunDLL = applet->hWnd;
1011  findData.hDlgResult = NULL;
1012  // Find the dialog of this applet in the first instance.
1013  // Note: The simpler functions "FindWindow" or "FindWindowEx" does not find this type of dialogs.
1014  EnumWindows(Control_EnumWinProc, (LPARAM)&findData);
1015  if (findData.hDlgResult)
1016  {
1017  BringWindowToTop(findData.hDlgResult);
1018  }
1019  else
1020  {
1021  SetPropW(applet->hWnd, (LPTSTR)MAKEINTATOM(aCPLName), (HANDLE)MAKEINTATOM(aCPLPath));
1022  SetPropW(applet->hWnd, (LPTSTR)MAKEINTATOM(aCPLFlags), UlongToHandle(sp + 1));
1023  Control_ShowAppletInTaskbar(applet, sp);
1024 #endif
1025 
1026  if (!applet->proc(applet->hWnd, CPL_STARTWPARMSW, sp, (LPARAM)extraPmts))
1027  applet->proc(applet->hWnd, CPL_DBLCLK, sp, applet->info[sp].data);
1028 #ifdef __REACTOS__
1029  RemovePropW(applet->hWnd, applet->cmd);
1030  GlobalDeleteAtom(aCPLPath);
1031  }
1032 #endif
1033 
1034  Control_UnloadApplet(applet);
1035 
1036 #ifdef __REACTOS__
1037  if (bActivated)
1039 #endif
1040 
1041  }
1042 
1044 }
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
ATOM WINAPI GlobalDeleteAtom(ATOM nAtom)
Definition: atom.c:454
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
struct applet_info info[1]
Definition: cpanel.h:52
WORD ATOM
Definition: dimm.idl:113
#define WARN(fmt,...)
Definition: debug.h:112
HWND hWnd
Definition: settings.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
GLuint buffer
Definition: glext.h:5915
ATOM WINAPI GlobalFindAtomW(LPCWSTR lpString)
Definition: atom.c:474
#define lstrlenW
Definition: compat.h:609
CHAR * LPTSTR
Definition: xmlstorage.h:192
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define CPL_DBLCLK
Definition: cpl.h:16
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
APPLET_PROC proc
Definition: cpanel.h:51
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
static PVOID ptr
Definition: dispmode.c:27
BOOL WINAPI BringWindowToTop(_In_ HWND)
LONG_PTR LPARAM
Definition: windef.h:208
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR cmd
Definition: cpanel.h:48
#define UlongToHandle(ul)
Definition: basetsd.h:97
unsigned count
Definition: cpanel.h:49
void Control_UnloadApplet(CPlApplet *applet)
Definition: control.c:43
#define CPL_STARTWPARMSW
Definition: cpl.h:21
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
GLuint GLuint end
Definition: gl.h:1545
HWND hWnd
Definition: cpanel.h:47
#define lstrcpyW
Definition: compat.h:608
Definition: cookie.c:33
LPWSTR WINAPI StrChrW(LPCWSTR lpszStr, WCHAR ch)
Definition: string.c:468
#define NULL
Definition: types.h:112
CPlApplet * Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel *panel)
Definition: control.c:59
ATOM WINAPI GlobalAddAtomW(LPCWSTR lpString)
Definition: atom.c:444
static const WCHAR sp[]
Definition: suminfo.c:287
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594
int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:353
#define MAKEINTATOM(i)
Definition: winbase.h:1448
WINE_UNICODE_INLINE int atoiW(const WCHAR *str)
Definition: unicode.h:315

Referenced by Control_RunDLLW().

◆ Control_DoWindow()

static void Control_DoWindow ( CPanel panel,
HWND  hWnd,
HINSTANCE  hInst 
)
static

Definition at line 701 of file control.c.

702 {
703  static const WCHAR wszRegPath[] = L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Control Panel\\Cpls";
704  HANDLE h;
707  WCHAR *p;
708 
709  /* first add .cpl files in the system directory */
711  p = buffer + strlenW(buffer);
712  *p++ = '\\';
713  lstrcpyW(p, L"*.cpl");
714 
716  do {
717  lstrcpyW(p, fd.cFileName);
718  Control_LoadApplet(hWnd, buffer, panel);
719  } while (FindNextFileW(h, &fd));
720  FindClose(h);
721  }
722 
723  /* now check for cpls in the registry */
726 
727  Control_DoInterface(panel, hWnd, hInst);
728 }
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:382
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define HKEY_CURRENT_USER
Definition: winreg.h:11
HWND hWnd
Definition: settings.c:17
static void Control_DoInterface(CPanel *panel, HWND hWnd, HINSTANCE hInst)
Definition: control.c:638
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
GLuint buffer
Definition: glext.h:5915
static int fd
Definition: io.c:51
static void Control_RegisterRegistryApplets(HWND hWnd, CPanel *panel, HKEY hkey_root, LPCWSTR szRepPath)
Definition: control.c:677
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define L(x)
Definition: ntvdm.h:50
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
HINSTANCE hInst
Definition: dxdiag.c:13
#define lstrcpyW
Definition: compat.h:608
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2313
CPlApplet * Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel *panel)
Definition: control.c:59
GLfloat GLfloat p
Definition: glext.h:8902
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by Control_RunDLLW().

◆ Control_FillCache_RunDLLA()

HRESULT WINAPI Control_FillCache_RunDLLA ( HWND  hWnd,
HANDLE  hModule,
DWORD  w,
DWORD  x 
)

Definition at line 1098 of file control.c.

1099 {
1101 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HRESULT WINAPI Control_FillCache_RunDLLW(HWND hWnd, HANDLE hModule, DWORD w, DWORD x)
Definition: control.c:1088
HMODULE hModule
Definition: animate.c:44

◆ Control_FillCache_RunDLLW()

HRESULT WINAPI Control_FillCache_RunDLLW ( HWND  hWnd,
HANDLE  hModule,
DWORD  w,
DWORD  x 
)

Definition at line 1088 of file control.c.

1089 {
1090  FIXME("%p %p 0x%08x 0x%08x stub\n", hWnd, hModule, w, x);
1091  return S_OK;
1092 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
HWND hWnd
Definition: settings.c:17
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:52
HMODULE hModule
Definition: animate.c:44

Referenced by Control_FillCache_RunDLLA().

◆ Control_FreeCPlItems()

static void Control_FreeCPlItems ( HWND  hWnd,
CPanel panel 
)
static

Definition at line 370 of file control.c.

371 {
372  HMENU hMenu, hSubMenu;
373  MENUITEMINFOW mii;
374  unsigned int i;
375 
376  /* get the File menu */
377  hMenu = GetMenu(hWnd);
378 
379  if (!hMenu)
380  return;
381 
382  hSubMenu = GetSubMenu(hMenu, 0);
383 
384  if (!hSubMenu)
385  return;
386 
387  /* loop and free the item data */
388  for (i = IDM_CPANEL_APPLET_BASE; i <= IDM_CPANEL_APPLET_BASE + panel->total_subprogs; i++)
389  {
390  mii.cbSize = sizeof(MENUITEMINFOW);
391  mii.fMask = MIIM_DATA;
392 
393  if (!GetMenuItemInfoW(hSubMenu, i, FALSE, &mii))
394  continue;
395 
397  }
398 }
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
#define GetProcessHeap()
Definition: compat.h:595
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
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
unsigned total_subprogs
Definition: cpanel.h:60
#define MIIM_DATA
Definition: winuser.h:721
HMENU WINAPI GetMenu(_In_ HWND)
ULONG_PTR dwItemData
Definition: winuser.h:3248
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
struct tagMENUITEMINFOW MENUITEMINFOW
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by Control_WndProc().

◆ Control_GetCPlItem_From_ListView()

static CPlItem* Control_GetCPlItem_From_ListView ( CPanel panel)
static

Definition at line 439 of file control.c.

440 {
441  LVITEMW lvItem;
442  int selitem;
443 
445  | LVNI_SELECTED);
446 
447  if (selitem != -1)
448  {
449  lvItem.iItem = selitem;
450  lvItem.mask = LVIF_PARAM;
451 
452  if (SendMessageW(panel->hWndListView, LVM_GETITEMW, 0, (LPARAM) &lvItem))
453  return (CPlItem *) lvItem.lParam;
454  }
455 
456  return NULL;
457 }
HWND hWndListView
Definition: cpanel.h:61
#define LVNI_SELECTED
Definition: commctrl.h:2424
LONG_PTR LPARAM
Definition: windef.h:208
#define LVNI_FOCUSED
Definition: commctrl.h:2423
UINT mask
Definition: commctrl.h:2360
Definition: cpanel.h:68
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define LVM_GETITEMW
Definition: commctrl.h:2390
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVM_GETNEXTITEM
Definition: commctrl.h:2433

Referenced by Control_WndProc().

◆ Control_GetCPlItem_From_MenuID()

static CPlItem* Control_GetCPlItem_From_MenuID ( HWND  hWnd,
UINT  id 
)
static

Definition at line 414 of file control.c.

415 {
416  HMENU hMenu, hSubMenu;
417  MENUITEMINFOW mii;
418 
419  /* retrieve the CPlItem structure from the menu item data */
420  hMenu = GetMenu(hWnd);
421 
422  if (!hMenu)
423  return NULL;
424 
425  hSubMenu = GetSubMenu(hMenu, 0);
426 
427  if (!hSubMenu)
428  return NULL;
429 
430  mii.cbSize = sizeof(MENUITEMINFOW);
431  mii.fMask = MIIM_DATA;
432 
433  if (!GetMenuItemInfoW(hSubMenu, id, FALSE, &mii))
434  return NULL;
435 
436  return (CPlItem *) mii.dwItemData;
437 }
HWND hWnd
Definition: settings.c:17
#define FALSE
Definition: types.h:117
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
Definition: cpanel.h:68
#define NULL
Definition: types.h:112
#define MIIM_DATA
Definition: winuser.h:721
HMENU WINAPI GetMenu(_In_ HWND)
ULONG_PTR dwItemData
Definition: winuser.h:3248
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
struct tagMENUITEMINFOW MENUITEMINFOW

Referenced by Control_WndProc().

◆ Control_LoadApplet()

CPlApplet* Control_LoadApplet ( HWND  hWnd,
LPCWSTR  cmd,
CPanel panel 
)

Definition at line 59 of file control.c.

60 {
61 #ifdef __REACTOS__
62  ACTCTXW ActCtx = {sizeof(ACTCTX), ACTCTX_FLAG_RESOURCE_NAME_VALID};
64  BOOL bActivated;
65  WCHAR fileBuffer[MAX_PATH];
66 #endif
67  CPlApplet* applet;
68  DWORD len;
69  unsigned i;
70  CPLINFO info;
71  NEWCPLINFOW newinfo;
72 
73  if (!(applet = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*applet))))
74  return applet;
75 
77  if (len > 0)
78  {
79  if (!(applet->cmd = HeapAlloc(GetProcessHeap(), 0, (len+1) * sizeof(WCHAR))))
80  {
81  WARN("Cannot allocate memory for applet path\n");
82  goto theError;
83  }
84  ExpandEnvironmentStringsW(cmd, applet->cmd, len+1);
85  }
86  else
87  {
88  WARN("Cannot expand applet path\n");
89  goto theError;
90  }
91 
92  applet->hWnd = hWnd;
93 
94 #ifdef __REACTOS__
95  StringCchCopy(fileBuffer, MAX_PATH, applet->cmd);
96  if (PathIsFileSpecW(fileBuffer))
97  SearchPath(NULL, fileBuffer, NULL, MAX_PATH, fileBuffer, NULL);
98  ActCtx.lpSource = fileBuffer;
99  ActCtx.lpResourceName = (LPCWSTR)123;
100  applet->hActCtx = CreateActCtx(&ActCtx);
101  bActivated = (applet->hActCtx != INVALID_HANDLE_VALUE ? ActivateActCtx(applet->hActCtx, &cookie) : FALSE);
102 #endif
103 
104  if (!(applet->hModule = LoadLibraryW(applet->cmd))) {
105  WARN("Cannot load control panel applet %s\n", debugstr_w(applet->cmd));
106  goto theError;
107  }
108  if (!(applet->proc = (APPLET_PROC)GetProcAddress(applet->hModule, "CPlApplet"))) {
109  WARN("Not a valid control panel applet %s\n", debugstr_w(applet->cmd));
110  goto theError;
111  }
112  if (!applet->proc(hWnd, CPL_INIT, 0L, 0L)) {
113  WARN("Init of applet has failed\n");
114  goto theError;
115  }
116  if ((applet->count = applet->proc(hWnd, CPL_GETCOUNT, 0L, 0L)) == 0) {
117  WARN("No subprogram in applet\n");
118  applet->proc(applet->hWnd, CPL_EXIT, 0, 0);
119  goto theError;
120  }
121 
122  applet = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, applet,
123  FIELD_OFFSET( CPlApplet, info[applet->count] ));
124 
125  for (i = 0; i < applet->count; i++) {
126  ZeroMemory(&newinfo, sizeof(newinfo));
127  newinfo.dwSize = sizeof(NEWCPLINFOA);
128  applet->info[i].helpfile[0] = 0;
129  /* proc is supposed to return a null value upon success for
130  * CPL_INQUIRE and CPL_NEWINQUIRE
131  * However, real drivers don't seem to behave like this
132  * So, use introspection rather than return value
133  */
134  applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info);
135  applet->info[i].data = info.lData;
136 #ifdef __REACTOS__
137  applet->info[i].idIcon = info.idIcon;
138 #endif
139 
140  if (info.idIcon != CPL_DYNAMIC_RES)
141  applet->info[i].icon = LoadIconW(applet->hModule, MAKEINTRESOURCEW(info.idIcon));
142  if (info.idName != CPL_DYNAMIC_RES)
143  LoadStringW(applet->hModule, info.idName,
144  applet->info[i].name, sizeof(applet->info[i].name) / sizeof(WCHAR));
145  if (info.idInfo != CPL_DYNAMIC_RES)
146  LoadStringW(applet->hModule, info.idInfo,
147  applet->info[i].info, sizeof(applet->info[i].info) / sizeof(WCHAR));
148 
149  /* some broken control panels seem to return incorrect values in CPL_INQUIRE,
150  but proper data in CPL_NEWINQUIRE. if we get an empty string or a null
151  icon, see what we can get from CPL_NEWINQUIRE */
152 
153  if (!applet->info[i].name[0]) info.idName = CPL_DYNAMIC_RES;
154 
155  /* zero-length szInfo may not be a buggy applet, but it doesn't hurt for us
156  to check anyway */
157 
158  if (!applet->info[i].info[0]) info.idInfo = CPL_DYNAMIC_RES;
159 
160  if (applet->info[i].icon == NULL)
161  info.idIcon = CPL_DYNAMIC_RES;
162 
163  if ((info.idIcon == CPL_DYNAMIC_RES) || (info.idName == CPL_DYNAMIC_RES) ||
164  (info.idInfo == CPL_DYNAMIC_RES)) {
165  applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&newinfo);
166 
167  applet->info[i].data = newinfo.lData;
168  if (info.idIcon == CPL_DYNAMIC_RES) {
169  if (!newinfo.hIcon) WARN("couldn't get icon for applet %u\n", i);
170  applet->info[i].icon = newinfo.hIcon;
171  }
172  if (newinfo.dwSize == sizeof(NEWCPLINFOW)) {
173  if (info.idName == CPL_DYNAMIC_RES)
174  memcpy(applet->info[i].name, newinfo.szName, sizeof(newinfo.szName));
175  if (info.idInfo == CPL_DYNAMIC_RES)
176  memcpy(applet->info[i].info, newinfo.szInfo, sizeof(newinfo.szInfo));
177  memcpy(applet->info[i].helpfile, newinfo.szHelpFile, sizeof(newinfo.szHelpFile));
178  } else {
179  if (info.idName == CPL_DYNAMIC_RES)
181  sizeof(((LPNEWCPLINFOA)&newinfo)->szName) / sizeof(CHAR),
182  applet->info[i].name, sizeof(applet->info[i].name) / sizeof(WCHAR));
183  if (info.idInfo == CPL_DYNAMIC_RES)
184  MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szInfo,
185  sizeof(((LPNEWCPLINFOA)&newinfo)->szInfo) / sizeof(CHAR),
186  applet->info[i].info, sizeof(applet->info[i].info) / sizeof(WCHAR));
188  sizeof(((LPNEWCPLINFOA)&newinfo)->szHelpFile) / sizeof(CHAR),
189  applet->info[i].helpfile,
190  sizeof(applet->info[i].helpfile) / sizeof(WCHAR));
191  }
192  }
193  }
194 
195 #ifdef __REACTOS__
196  if (bActivated)
198 #endif
199 
200 #ifndef __REACTOS__
201  list_add_head( &panel->applets, &applet->entry );
202 #endif
203 
204  return applet;
205 
206  theError:
207  FreeLibrary(applet->hModule);
208  HeapFree(GetProcessHeap(), 0, applet->cmd);
209  HeapFree(GetProcessHeap(), 0, applet);
210  return NULL;
211 }
BOOL WINAPI ActivateActCtx(IN HANDLE hActCtx, OUT PULONG_PTR ulCookie)
Definition: actctx.c:237
static const WCHAR szName[]
Definition: powrprof.c:45
struct applet_info info[1]
Definition: cpanel.h:52
Definition: cpl.h:24
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
Definition: ftp_var.h:139
#define CP_ACP
Definition: compat.h:109
char CHAR
Definition: xmlstorage.h:175
LONG(APIENTRY * APPLET_PROC)(HWND, UINT, LPARAM, LPARAM)
Definition: cpl.h:23
#define WARN(fmt,...)
Definition: debug.h:112
struct list entry
Definition: cpanel.h:43
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
HWND hWnd
Definition: settings.c:17
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define ZeroMemory
Definition: winbase.h:1667
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define SearchPath
Definition: winbase.h:3761
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOL WINAPI DeactivateActCtx(IN DWORD dwFlags, IN ULONG_PTR ulCookie)
Definition: actctx.c:268
APPLET_PROC proc
Definition: cpanel.h:51
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define CPL_DYNAMIC_RES
Definition: cpl.h:11
static struct _test_info info[]
Definition: SetCursorPos.c:19
#define debugstr_w
Definition: kernel32.h:32
#define CPL_NEWINQUIRE
Definition: cpl.h:19
BOOL WINAPI PathIsFileSpecW(LPCWSTR lpszPath)
Definition: path.c:2132
#define LoadLibraryW(x)
Definition: compat.h:606
LONG_PTR LPARAM
Definition: windef.h:208
#define FreeLibrary(x)
Definition: compat.h:607
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define CPL_EXIT
Definition: cpl.h:18
__wchar_t WCHAR
Definition: xmlstorage.h:180
LPWSTR cmd
Definition: cpanel.h:48
#define MAX_PATH
Definition: compat.h:34
unsigned count
Definition: cpanel.h:49
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD dwSize
Definition: cpl.h:41
_In_ PCWSTR _Out_ PVOID * ActCtx
Definition: ldrtypes.h:247
#define CPL_INIT
Definition: cpl.h:12
TCHAR szHelpFile[]
Definition: scrnsave.c:30
#define CPL_INQUIRE
Definition: cpl.h:14
#define StringCchCopy
Definition: strsafe.h:139
struct tagNEWCPLINFOA NEWCPLINFOA
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
struct list applets
Definition: cpanel.h:57
HWND hWnd
Definition: cpanel.h:47
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
#define HeapReAlloc
Definition: compat.h:593
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
Definition: cookie.c:33
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define MultiByteToWideChar
Definition: compat.h:110
HMODULE hModule
Definition: cpanel.h:50
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define GetProcAddress(x, y)
Definition: compat.h:612
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define HeapFree(x, y, z)
Definition: compat.h:594
#define CPL_GETCOUNT
Definition: cpl.h:13

Referenced by Control_DoLaunch(), Control_DoWindow(), Control_RegisterRegistryApplets(), and CControlPanelEnum::RegisterCPanelApp().

◆ Control_RegisterRegistryApplets()

static void Control_RegisterRegistryApplets ( HWND  hWnd,
CPanel panel,
HKEY  hkey_root,
LPCWSTR  szRepPath 
)
static

Definition at line 677 of file control.c.

678 {
681  HKEY hkey;
682 
683  if (RegOpenKeyW(hkey_root, szRepPath, &hkey) == ERROR_SUCCESS)
684  {
685  int idx = 0;
686 
687  for(;; ++idx)
688  {
689  DWORD nameLen = MAX_PATH;
690  DWORD valueLen = MAX_PATH;
691 
692  if (RegEnumValueW(hkey, idx, name, &nameLen, NULL, NULL, (LPBYTE)value, &valueLen) != ERROR_SUCCESS)
693  break;
694 
695  Control_LoadApplet(hWnd, value, panel);
696  }
697  RegCloseKey(hkey);
698  }
699 }
Definition: pdh_main.c:93
#define ERROR_SUCCESS
Definition: deptool.c:10
HWND hWnd
Definition: settings.c:17
unsigned char * LPBYTE
Definition: typedefs.h:53
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3291
unsigned int idx
Definition: utils.c:41
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
CPlApplet * Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel *panel)
Definition: control.c:59
Definition: name.c:38
#define RegCloseKey(hKey)
Definition: registry.h:47

Referenced by Control_DoWindow().

◆ Control_RunDLLA()

void WINAPI Control_RunDLLA ( HWND  hWnd,
HINSTANCE  hInst,
LPCSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 1073 of file control.c.

1074 {
1075  DWORD len = MultiByteToWideChar(CP_ACP, 0, cmd, -1, NULL, 0 );
1076  LPWSTR wszCmd = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1077  if (wszCmd && MultiByteToWideChar(CP_ACP, 0, cmd, -1, wszCmd, len ))
1078  {
1079  Control_RunDLLW(hWnd, hInst, wszCmd, nCmdShow);
1080  }
1081  HeapFree(GetProcessHeap(), 0, wszCmd);
1082 }
Definition: ftp_var.h:139
#define CP_ACP
Definition: compat.h:109
HWND hWnd
Definition: settings.c:17
VOID WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdShow)
Definition: control.c:1050
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
HINSTANCE hInst
Definition: dxdiag.c:13
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ Control_RunDLLW()

void WINAPI Control_RunDLLW ( HWND  hWnd,
HINSTANCE  hInst,
LPCWSTR  cmd,
DWORD  nCmdShow 
)

Definition at line 1050 of file control.c.

1051 {
1052  CPanel panel;
1053 
1054  TRACE("(%p, %p, %s, 0x%08x)\n",
1055  hWnd, hInst, debugstr_w(cmd), nCmdShow);
1056 
1057 #ifndef __REACTOS__
1058  memset(&panel, 0, sizeof(panel));
1059  list_init( &panel.applets );
1060 #endif
1061 
1062  if (!cmd || !*cmd) {
1063  Control_DoWindow(&panel, hWnd, hInst);
1064  } else {
1065  Control_DoLaunch(&panel, hWnd, cmd);
1066  }
1067 }
Definition: ftp_var.h:139
HWND hWnd
Definition: settings.c:17
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static void Control_DoLaunch(CPanel *panel, HWND hWnd, LPCWSTR wszCmd)
Definition: control.c:873
struct list applets
Definition: cpanel.h:57
Definition: cpanel.h:56
HINSTANCE hInst
Definition: dxdiag.c:13
static void Control_DoWindow(CPanel *panel, HWND hWnd, HINSTANCE hInst)
Definition: control.c:701
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define memset(x, y, z)
Definition: compat.h:39

Referenced by Control_RunDLLA(), FinishDlgProc(), and START_TEST().

◆ Control_StartApplet()

static void Control_StartApplet ( HWND  hWnd,
CPlItem item 
)
static

Definition at line 459 of file control.c.

460 {
461  WCHAR verbOpen[] = {'c','p','l','o','p','e','n',0};
462  WCHAR format[] = {'@','%','d',0};
464 
465  /* execute the applet if item is valid */
466  if (item)
467  {
468  wsprintfW(param, format, item->id);
469  ShellExecuteW(hWnd, verbOpen, item->applet->cmd, param, NULL, SW_SHOW);
470  }
471 }
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
HWND hWnd
Definition: settings.c:17
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define SW_SHOW
Definition: winuser.h:769
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLfloat param
Definition: glext.h:5796
#define MAX_PATH
Definition: compat.h:34
static ATOM item
Definition: dde.c:856
#define NULL
Definition: types.h:112
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2354

Referenced by Control_WndProc().

◆ Control_UnloadApplet()

void Control_UnloadApplet ( CPlApplet applet)

Definition at line 43 of file control.c.

44 {
45  unsigned i;
46 
47  for (i = 0; i < applet->count; i++)
48  applet->proc(applet->hWnd, CPL_STOP, i, applet->info[i].data);
49 
50  if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
51  FreeLibrary(applet->hModule);
52 #ifndef __REACTOS__
53  list_remove( &applet->entry );
54 #endif
55  HeapFree(GetProcessHeap(), 0, applet->cmd);
56  HeapFree(GetProcessHeap(), 0, applet);
57 }
struct applet_info info[1]
Definition: cpanel.h:52
#define CPL_STOP
Definition: cpl.h:17
struct list entry
Definition: cpanel.h:43
APPLET_PROC proc
Definition: cpanel.h:51
#define L(x)
Definition: ntvdm.h:50
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define FreeLibrary(x)
Definition: compat.h:607
#define GetProcessHeap()
Definition: compat.h:595
#define CPL_EXIT
Definition: cpl.h:18
LPWSTR cmd
Definition: cpanel.h:48
unsigned count
Definition: cpanel.h:49
HWND hWnd
Definition: cpanel.h:47
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
HMODULE hModule
Definition: cpanel.h:50
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by Control_DoLaunch(), Control_WndProc(), and CControlPanelEnum::RegisterCPanelApp().

◆ Control_UpdateListViewStyle()

static void Control_UpdateListViewStyle ( CPanel panel,
UINT  style,
UINT  id 
)
static

Definition at line 400 of file control.c.

401 {
402  HMENU hMenu, hSubMenu;
403 
405 
406  /* update the menu */
407  hMenu = GetMenu(panel->hWnd);
408  hSubMenu = GetSubMenu(hMenu, 1);
409 
411  id, MF_BYCOMMAND);
412 }
HWND hWndListView
Definition: cpanel.h:61
#define MF_BYCOMMAND
Definition: winuser.h:202
HWND hWnd
Definition: cpanel.h:58
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
#define LISTVIEW_DEFSTYLE
Definition: control.c:219
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:808
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define FCIDM_SHVIEW_BIGICON
Definition: shresdef.h:805
#define GWL_STYLE
Definition: winuser.h:846
Arabic default style
Definition: afstyles.h:93
HMENU WINAPI GetMenu(_In_ HWND)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by Control_WndProc().

◆ Control_WndProc()

static LRESULT WINAPI Control_WndProc ( HWND  hWnd,
UINT  wMsg,
WPARAM  lParam1,
LPARAM  lParam2 
)
static

Definition at line 473 of file control.c.

475 {
476  CPanel* panel = (CPanel*)GetWindowLongPtrW(hWnd, 0);
477 
478  if (panel || wMsg == WM_CREATE) {
479  switch (wMsg) {
480  case WM_CREATE:
482  return 0;
483  case WM_DESTROY:
484  {
485  CPlApplet *applet, *next;
486  LIST_FOR_EACH_ENTRY_SAFE( applet, next, &panel->applets, CPlApplet, entry )
487  Control_UnloadApplet(applet);
488  }
489  Control_FreeCPlItems(hWnd, panel);
490  PostQuitMessage(0);
491  break;
492  case WM_COMMAND:
493  switch (LOWORD(lParam1))
494  {
495  case IDM_CPANEL_EXIT:
496  SendMessageW(hWnd, WM_CLOSE, 0, 0);
497  return 0;
498 
499  case IDM_CPANEL_ABOUT:
500  {
503  IMAGE_ICON, 48, 48, LR_SHARED);
504 
505  LoadStringW(shell32_hInstance, IDS_CPANEL_TITLE, appName,
506  sizeof(appName) / sizeof(appName[0]));
507  ShellAboutW(hWnd, appName, NULL, icon);
508 
509  return 0;
510  }
511 
514  return 0;
515 
518  return 0;
519 
522  return 0;
523 
526  return 0;
527 
528  default:
529  /* check if this is an applet */
530  if ((LOWORD(lParam1) >= IDM_CPANEL_APPLET_BASE) &&
531  (LOWORD(lParam1) <= IDM_CPANEL_APPLET_BASE + panel->total_subprogs))
532  {
534  return 0;
535  }
536 
537  break;
538  }
539 
540  break;
541 
542  case WM_NOTIFY:
543  {
544  LPNMHDR nmh = (LPNMHDR) lParam2;
545 
546  switch (nmh->idFrom)
547  {
548  case IDC_LISTVIEW:
549  switch (nmh->code)
550  {
551  case NM_RETURN:
552  case NM_DBLCLK:
553  {
555  return 0;
556  }
557  case LVN_ITEMCHANGED:
558  {
560 
561  /* update the status bar if item is valid */
562  if (item)
563  SetWindowTextW(panel->hWndStatusBar, item->applet->info[item->id].info);
564  else
566 
567  return 0;
568  }
569  }
570 
571  break;
572  }
573 
574  break;
575  }
576 
577  case WM_MENUSELECT:
578  /* check if this is an applet */
579  if ((LOWORD(lParam1) >= IDM_CPANEL_APPLET_BASE) &&
580  (LOWORD(lParam1) <= IDM_CPANEL_APPLET_BASE + panel->total_subprogs))
581  {
583 
584  /* update the status bar if item is valid */
585  if (item)
586  SetWindowTextW(panel->hWndStatusBar, item->applet->info[item->id].info);
587  }
588  else if ((HIWORD(lParam1) == 0xFFFF) && (lParam2 == 0))
589  {
590  /* reset status bar description to that of the selected icon */
592 
593  if (item)
594  SetWindowTextW(panel->hWndStatusBar, item->applet->info[item->id].info);
595  else
597 
598  return 0;
599  }
600  else
602 
603  return 0;
604 
605  case WM_SIZE:
606  {
607  HDWP hdwp;
608  RECT sb;
609 
610  hdwp = BeginDeferWindowPos(2);
611 
612  if (hdwp == NULL)
613  break;
614 
615  GetClientRect(panel->hWndStatusBar, &sb);
616 
617  hdwp = DeferWindowPos(hdwp, panel->hWndListView, NULL, 0, 0,
618  LOWORD(lParam2), HIWORD(lParam2) - (sb.bottom - sb.top),
620 
621  if (hdwp == NULL)
622  break;
623 
624  hdwp = DeferWindowPos(hdwp, panel->hWndStatusBar, NULL, 0, 0,
625  LOWORD(lParam2), LOWORD(lParam1), SWP_NOZORDER | SWP_NOMOVE);
626 
627  if (hdwp != NULL)
628  EndDeferWindowPos(hdwp);
629 
630  return 0;
631  }
632  }
633  }
634 
635  return DefWindowProcW(hWnd, wMsg, lParam1, lParam2);
636 }
HWND hWndListView
Definition: cpanel.h:61
static HICON
Definition: imagelist.c:84
HDWP WINAPI BeginDeferWindowPos(_In_ int)
#define FCIDM_SHVIEW_LISTVIEW
Definition: shresdef.h:807
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
#define IDI_SHELL_CONTROL_PANEL
Definition: shresdef.h:545
superblock * sb
Definition: btrfs.c:4230
#define LVS_REPORT
Definition: commctrl.h:2262
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
HWND hWnd
Definition: settings.c:17
#define MAX_STRING_LEN
Definition: precomp.h:36
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
static void Control_StartApplet(HWND hWnd, CPlItem *item)
Definition: control.c:459
#define GetWindowLongPtrW
Definition: winuser.h:4809
static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW *cs)
Definition: control.c:276
#define SWP_NOZORDER
Definition: winuser.h:1237
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
struct tagNMHDR * LPNMHDR
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
UINT code
Definition: winuser.h:3139
HWND hWndStatusBar
Definition: cpanel.h:64
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
static void Control_FreeCPlItems(HWND hWnd, CPanel *panel)
Definition: control.c:370
UINT_PTR idFrom
Definition: winuser.h:3138
BOOL WINAPI EndDeferWindowPos(_In_ HDWP)
#define WM_MENUSELECT
Definition: winuser.h:1734
#define LVS_LIST
Definition: commctrl.h:2264
#define WM_DESTROY
Definition: winuser.h:1596
HDWP WINAPI DeferWindowPos(_In_ HDWP, _In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_SIZE
Definition: winuser.h:1598
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:808
#define WM_CLOSE
Definition: winuser.h:1608
void Control_UnloadApplet(CPlApplet *applet)
Definition: control.c:43
#define LVS_ICON
Definition: commctrl.h:2261
static CPlItem * Control_GetCPlItem_From_ListView(CPanel *panel)
Definition: control.c:439
uint32_t entry
Definition: isohybrid.c:63
BOOL WINAPI ShellAboutW(HWND hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff, HICON hIcon)
Definition: cpanel.h:68
#define WM_COMMAND
Definition: winuser.h:1727
struct list applets
Definition: cpanel.h:57
#define FCIDM_SHVIEW_BIGICON
Definition: shresdef.h:805
Definition: cpanel.h:56
#define NM_RETURN
Definition: commctrl.h:132
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define shell32_hInstance
static unsigned __int64 next
Definition: rand_nt.c:6
static void Control_UpdateListViewStyle(CPanel *panel, UINT style, UINT id)
Definition: control.c:400
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
static ATOM item
Definition: dde.c:856
#define NM_DBLCLK
Definition: commctrl.h:131
unsigned total_subprogs
Definition: cpanel.h:60
static CPlItem * Control_GetCPlItem_From_MenuID(HWND hWnd, UINT id)
Definition: control.c:414
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define NULL
Definition: types.h:112
#define IDC_LISTVIEW
Definition: control.c:215
#define WM_CREATE
Definition: winuser.h:1595
#define HIWORD(l)
Definition: typedefs.h:247
const char * appName(const char *argv0)
Definition: loadlib.c:89
#define SWP_NOMOVE
Definition: winuser.h:1234
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define FCIDM_SHVIEW_SMALLICON
Definition: shresdef.h:806
#define LOWORD(l)
Definition: pedump.c:82
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_NOTIFY
Definition: richedit.h:61
#define LVS_SMALLICON
Definition: commctrl.h:2263

Referenced by Control_DoInterface().

◆ Control_WndProc_Create()

static void Control_WndProc_Create ( HWND  hWnd,
const CREATESTRUCTW cs 
)
static

Definition at line 276 of file control.c.

277 {
278  CPanel* panel = cs->lpCreateParams;
279  HMENU hMenu, hSubMenu;
280  CPlApplet* applet;
281  MENUITEMINFOW mii;
282  unsigned int i;
283  int menucount, index;
284  CPlItem *item;
285  LVITEMW lvItem;
287  INT sb_parts;
288  int itemidx;
289 
290  SetWindowLongPtrW(hWnd, 0, (LONG_PTR)panel);
291  panel->hWnd = hWnd;
292 
293  /* Initialise common control DLL */
294  icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
296  InitCommonControlsEx(&icex);
297 
298  /* create the status bar */
300  return;
301 
302  sb_parts = -1;
303  SendMessageW(panel->hWndStatusBar, SB_SETPARTS, 1, (LPARAM) &sb_parts);
304 
305  /* create the list view */
306  if (!Control_CreateListView(panel))
307  return;
308 
309  hMenu = LoadMenuW(shell32_hInstance, MAKEINTRESOURCEW(MENU_CPANEL));
310 
311  /* insert menu items for applets */
312  hSubMenu = GetSubMenu(hMenu, 0);
313  menucount = 0;
314 
315  LIST_FOR_EACH_ENTRY( applet, &panel->applets, CPlApplet, entry )
316  {
317  for (i = 0; i < applet->count; i++) {
318  /* set up a CPlItem for this particular subprogram */
319  item = HeapAlloc(GetProcessHeap(), 0, sizeof(CPlItem));
320 
321  if (!item)
322  continue;
323 
324  item->applet = applet;
325  item->id = i;
326 
327  mii.cbSize = sizeof(MENUITEMINFOW);
329  mii.dwTypeData = applet->info[i].name;
330  mii.cch = sizeof(applet->info[i].name) / sizeof(WCHAR);
331  mii.wID = IDM_CPANEL_APPLET_BASE + menucount;
332  mii.dwItemData = (ULONG_PTR)item;
333 
334  if (InsertMenuItemW(hSubMenu, menucount, TRUE, &mii)) {
335  /* add the list view item */
336  HICON icon = applet->info[i].icon;
337  if (!icon) icon = LoadImageW( 0, (LPCWSTR)IDI_WINLOGO, IMAGE_ICON, 0, 0, LR_SHARED );
338  index = ImageList_AddIcon(panel->hImageListLarge, icon);
339  ImageList_AddIcon(panel->hImageListSmall, icon);
340 
341  lvItem.mask = LVIF_IMAGE | LVIF_TEXT | LVIF_PARAM;
342  lvItem.iItem = menucount;
343  lvItem.iSubItem = 0;
344  lvItem.pszText = applet->info[i].name;
345  lvItem.iImage = index;
346  lvItem.lParam = (LPARAM) item;
347 
348  itemidx = ListView_InsertItemW(panel->hWndListView, &lvItem);
349 
350  /* add the description */
351  ListView_SetItemTextW(panel->hWndListView, itemidx, 1, applet->info[i].info);
352 
353  /* update menu bar, increment count */
354  DrawMenuBar(hWnd);
355  menucount++;
356  }
357  }
358  }
359 
360  panel->total_subprogs = menucount;
361 
362  /* check the "large items" icon in the View menu */
363  hSubMenu = GetSubMenu(hMenu, 1);
366 
367  SetMenu(hWnd, hMenu);
368 }
HWND hWndListView
Definition: cpanel.h:61
static HICON
Definition: imagelist.c:84
int iImage
Definition: commctrl.h:2367
struct applet_info info[1]
Definition: cpanel.h:52
#define LR_SHARED
Definition: winuser.h:1094
#define IMAGE_ICON
Definition: winuser.h:212
BOOL WINAPI DrawMenuBar(_In_ HWND)
#define MF_BYCOMMAND
Definition: winuser.h:202
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
HWND hWnd
Definition: cpanel.h:58
#define TRUE
Definition: types.h:120
HIMAGELIST hImageListSmall
Definition: cpanel.h:63
BOOL WINAPI CheckMenuRadioItem(_In_ HMENU, _In_ UINT, _In_ UINT, _In_ UINT, _In_ UINT)
HWND hWnd
Definition: settings.c:17
LPWSTR dwTypeData
Definition: winuser.h:3249
#define WS_CHILD
Definition: pedump.c:617
struct tagINITCOMMONCONTROLSEX INITCOMMONCONTROLSEX
int32_t INT
Definition: typedefs.h:58
#define LVIF_TEXT
Definition: commctrl.h:2309
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
uint32_t cs
Definition: isohybrid.c:75
HWND hWndStatusBar
Definition: cpanel.h:64
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
int iSubItem
Definition: commctrl.h:2362
HWND WINAPI CreateStatusWindowW(LONG style, LPCWSTR text, HWND parent, UINT wid)
Definition: commctrl.c:795
LPARAM lParam
Definition: commctrl.h:2368
#define IDC_STATUSBAR
Definition: control.c:216
LONG_PTR LPARAM
Definition: windef.h:208
static BOOL Control_CreateListView(CPanel *panel)
Definition: control.c:222
GLuint index
Definition: glext.h:6031
#define MIIM_ID
Definition: winuser.h:717
#define CCS_BOTTOM
Definition: commctrl.h:2244
#define ICC_BAR_CLASSES
Definition: commctrl.h:60
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SBARS_SIZEGRIP
Definition: commctrl.h:1923
BOOL WINAPI SetMenu(_In_ HWND, _In_opt_ HMENU)
#define FCIDM_SHVIEW_REPORTVIEW
Definition: shresdef.h:808
LPWSTR pszText
Definition: commctrl.h:2365
#define LVIF_IMAGE
Definition: commctrl.h:2310
unsigned count
Definition: cpanel.h:49
#define IDI_WINLOGO
Definition: winuser.h:704
INT WINAPI ImageList_AddIcon(HIMAGELIST himl, HICON hIcon)
Definition: imagelist.c:540
UINT mask
Definition: commctrl.h:2360
#define index(s, c)
Definition: various.h:29
BOOL WINAPI InitCommonControlsEx(const INITCOMMONCONTROLSEX *lpInitCtrls)
Definition: commctrl.c:893
uint32_t entry
Definition: isohybrid.c:63
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
Definition: cpanel.h:68
struct list applets
Definition: cpanel.h:57
#define FCIDM_SHVIEW_BIGICON
Definition: shresdef.h:805
Definition: cpanel.h:56
#define MIIM_STRING
Definition: winuser.h:722
#define ICC_LISTVIEW_CLASSES
Definition: commctrl.h:58
#define shell32_hInstance
static ATOM item
Definition: dde.c:856
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
unsigned total_subprogs
Definition: cpanel.h:60
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HIMAGELIST hImageListLarge
Definition: cpanel.h:62
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
#define NULL
Definition: types.h:112
#define SB_SETPARTS
Definition: commctrl.h:1954
#define LVIF_PARAM
Definition: commctrl.h:2311
HMENU WINAPI LoadMenuW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
#define ULONG_PTR
Definition: config.h:101
#define SetWindowLongPtrW
Definition: winuser.h:5326
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define MIIM_DATA
Definition: winuser.h:721
#define WS_VISIBLE
Definition: pedump.c:620
#define ListView_InsertItemW(hwnd, pitem)
Definition: commctrl.h:33
ULONG_PTR dwItemData
Definition: winuser.h:3248
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
struct tagMENUITEMINFOW MENUITEMINFOW

Referenced by Control_WndProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shlctrl  )