ReactOS 0.4.15-dev-5863-g1fe3ab7
desk.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <wincon.h>
#include <commdlg.h>
#include <cpl.h>
#include <tchar.h>
#include <setupapi.h>
#include <shlobj.h>
#include <regstr.h>
#include <dll/desk/deskcplx.h>
#include <strsafe.h>
#include <gdiplus.h>
#include "appearance.h"
#include "preview.h"
#include "draw.h"
#include "monslctl.h"
#include "resource.h"
Include dependency graph for desk.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _APPLET
 
struct  _DIBITMAP
 
struct  HIDE_ICON
 
struct  _ICON_PATH
 
struct  _ICON_DATA
 
struct  _DESKTOP_DATA
 
struct  _RESOLUTION_INFO
 
struct  _SETTINGS_ENTRY
 
struct  _DISPLAY_DEVICE_ENTRY
 
struct  _GLOBAL_DATA
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define COBJMACROS
 
#define MONITOR_LEFT   20
 
#define MONITOR_TOP   8
 
#define MONITOR_RIGHT   140
 
#define MONITOR_BOTTOM   92
 
#define MONITOR_WIDTH   (MONITOR_RIGHT-MONITOR_LEFT)
 
#define MONITOR_HEIGHT   (MONITOR_BOTTOM-MONITOR_TOP)
 
#define MONITOR_ALPHA   0xFF00FF
 
#define MAX_DESK_PAGES   32
 
#define NUM_SPECTRUM_BITMAPS   3
 
#define NUM_DESKTOP_ICONS   4 /* DesktopIcons array size */
 
#define NUM_CHANGE_ICONS   5 /* IconChange array size */
 

Typedefs

typedef struct _APPLET APPLET
 
typedef struct _APPLETPAPPLET
 
typedef struct _DIBITMAP DIBITMAP
 
typedef struct _DIBITMAPPDIBITMAP
 
typedef struct _ICON_PATH ICON_PATH
 
typedef struct _ICON_DATA ICON_DATA
 
typedef struct _DESKTOP_DATA DESKTOP_DATA
 
typedef struct _DESKTOP_DATAPDESKTOP_DATA
 
typedef struct _RESOLUTION_INFO RESOLUTION_INFO
 
typedef struct _RESOLUTION_INFOPRESOLUTION_INFO
 
typedef struct _SETTINGS_ENTRY SETTINGS_ENTRY
 
typedef struct _SETTINGS_ENTRYPSETTINGS_ENTRY
 
typedef struct _DISPLAY_DEVICE_ENTRY DISPLAY_DEVICE_ENTRY
 
typedef struct _DISPLAY_DEVICE_ENTRYPDISPLAY_DEVICE_ENTRY
 
typedef struct _GLOBAL_DATA GLOBAL_DATA
 
typedef struct _GLOBAL_DATAPGLOBAL_DATA
 

Functions

HMENU LoadPopupMenu (IN HINSTANCE hInstance, IN LPCTSTR lpMenuName)
 
PDIBITMAP DibLoadImage (LPTSTR lpFilename)
 
VOID DibFreeImage (PDIBITMAP lpBitmap)
 
INT AllocAndLoadString (LPTSTR *lpTarget, HINSTANCE hInst, UINT uID)
 
ULONG __cdecl DbgPrint (PCCH Format,...)
 
BOOL DisplayAdvancedSettings (HWND hWndParent, PDISPLAY_DEVICE_ENTRY DisplayDevice)
 
IDataObjectCreateDevSettings (PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
 
HPSXA WINAPI SHCreatePropSheetExtArrayEx (HKEY, LPCWSTR, UINT, IDataObject *)
 
INT_PTR CALLBACK AdvGeneralPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL SwitchDisplayMode (HWND hwndDlg, PWSTR DeviceName, PSETTINGS_ENTRY seInit, PSETTINGS_ENTRY seNew, OUT PLONG rc)
 
INT_PTR CALLBACK DesktopPageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID InitDesktopSettings (PDESKTOP_DATA pData)
 
BOOL SaveDesktopSettings (PDESKTOP_DATA pData)
 
VOID SetDesktopSettings (PDESKTOP_DATA pData)
 
LONG RegLoadMUIStringW (IN HKEY hKey, IN LPCWSTR pszValue OPTIONAL, OUT LPWSTR pszOutBuf, IN DWORD cbOutBuf, OUT LPDWORD pcbData OPTIONAL, IN DWORD Flags, IN LPCWSTR pszDirectory OPTIONAL)
 

Variables

HINSTANCE hApplet
 
GLOBAL_DATA g_GlobalData
 
HWND hCPLWindow
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 7 of file desk.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 10 of file desk.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 8 of file desk.h.

◆ MAX_DESK_PAGES

#define MAX_DESK_PAGES   32

Definition at line 81 of file desk.h.

◆ MONITOR_ALPHA

#define MONITOR_ALPHA   0xFF00FF

Definition at line 79 of file desk.h.

◆ MONITOR_BOTTOM

#define MONITOR_BOTTOM   92

Definition at line 74 of file desk.h.

◆ MONITOR_HEIGHT

#define MONITOR_HEIGHT   (MONITOR_BOTTOM-MONITOR_TOP)

Definition at line 77 of file desk.h.

◆ MONITOR_LEFT

#define MONITOR_LEFT   20

Definition at line 71 of file desk.h.

◆ MONITOR_RIGHT

#define MONITOR_RIGHT   140

Definition at line 73 of file desk.h.

◆ MONITOR_TOP

#define MONITOR_TOP   8

Definition at line 72 of file desk.h.

◆ MONITOR_WIDTH

#define MONITOR_WIDTH   (MONITOR_RIGHT-MONITOR_LEFT)

Definition at line 76 of file desk.h.

◆ NUM_CHANGE_ICONS

#define NUM_CHANGE_ICONS   5 /* IconChange array size */

Definition at line 85 of file desk.h.

◆ NUM_DESKTOP_ICONS

#define NUM_DESKTOP_ICONS   4 /* DesktopIcons array size */

Definition at line 84 of file desk.h.

◆ NUM_SPECTRUM_BITMAPS

#define NUM_SPECTRUM_BITMAPS   3

Definition at line 82 of file desk.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 6 of file desk.h.

Typedef Documentation

◆ APPLET

◆ DESKTOP_DATA

◆ DIBITMAP

◆ DISPLAY_DEVICE_ENTRY

◆ GLOBAL_DATA

◆ ICON_DATA

◆ ICON_PATH

◆ PAPPLET

typedef struct _APPLET * PAPPLET

◆ PDESKTOP_DATA

◆ PDIBITMAP

◆ PDISPLAY_DEVICE_ENTRY

◆ PGLOBAL_DATA

◆ PRESOLUTION_INFO

◆ PSETTINGS_ENTRY

◆ RESOLUTION_INFO

◆ SETTINGS_ENTRY

Function Documentation

◆ AdvGeneralPageProc()

INT_PTR CALLBACK AdvGeneralPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 115 of file general.c.

119{
120 PDISPLAY_DEVICE_ENTRY DispDevice = NULL;
121 INT_PTR Ret = 0;
122
123 if (uMsg != WM_INITDIALOG)
124 DispDevice = (PDISPLAY_DEVICE_ENTRY)GetWindowLongPtr(hwndDlg, DWLP_USER);
125
126 switch (uMsg)
127 {
128 case WM_INITDIALOG:
130 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)DispDevice);
131
132 InitFontSizeList(hwndDlg);
133 InitRadioButtons(hwndDlg);
134
135 Ret = TRUE;
136 break;
137 case WM_COMMAND:
138 switch (LOWORD(wParam))
139 {
142 {
143 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
144 }
145 break;
146 case IDC_RESTART_RB:
148 case IDC_ASKME_RB:
149 PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
150 break;
151 }
152 break;
153 }
154
155 return Ret;
156}
struct _DISPLAY_DEVICE_ENTRY * PDISPLAY_DEVICE_ENTRY
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static VOID InitRadioButtons(HWND hWnd)
Definition: general.c:78
static VOID InitFontSizeList(HWND hWnd)
Definition: general.c:11
#define IDC_RESTART_RB
Definition: resource.h:196
#define IDC_FONTSIZE_COMBO
Definition: resource.h:194
#define IDC_WITHOUTREBOOT_RB
Definition: resource.h:197
#define IDC_ASKME_RB
Definition: resource.h:198
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define LPPROPSHEETPAGE
Definition: prsht.h:390
Definition: precomp.h:68
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
#define HIWORD(l)
Definition: typedefs.h:247
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1730
#define WM_INITDIALOG
Definition: winuser.h:1729
#define CBN_SELCHANGE
Definition: winuser.h:1969
HWND WINAPI GetParent(_In_ HWND)

Referenced by DisplayAdvancedSettings().

◆ AllocAndLoadString()

INT AllocAndLoadString ( LPTSTR lpTarget,
HINSTANCE  hInst,
UINT  uID 
)

◆ CreateDevSettings()

IDataObject * CreateDevSettings ( PDISPLAY_DEVICE_ENTRY  DisplayDeviceInfo)

Definition at line 1045 of file devsett.c.

1046{
1048
1050 0,
1051 sizeof(*This));
1052 if (This != NULL)
1053 {
1054 This->lpIDataObjectVtbl = &vtblIDataObject;
1055 This->ref = 1;
1056
1058 DisplayDeviceInfo)))
1059 {
1061 }
1062
1064 }
1065
1066 return NULL;
1067}
static const struct IDataObjectVtbl vtblIDataObject
Definition: devsett.c:1029
#define impl_to_interface(impl, iface)
Definition: devsett.c:59
static ULONG STDMETHODCALLTYPE CDevSettings_Release(IDataObject *iface)
Definition: devsett.c:696
static HRESULT pCDevSettings_Initialize(PCDevSettings This, PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:493
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by DisplayAdvancedSettings().

◆ DbgPrint()

ULONG __cdecl DbgPrint ( PCCH  Format,
  ... 
)

Definition at line 427 of file debug.c.

428{
429 return 0;
430}

◆ DesktopPageProc()

INT_PTR CALLBACK DesktopPageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Referenced by OnCustomButton().

◆ DibFreeImage()

VOID DibFreeImage ( PDIBITMAP  lpBitmap)

Definition at line 90 of file dibitmap.c.

91{
92 if (lpBitmap == NULL)
93 return;
94
95 /* Free the image data */
96 if (lpBitmap->bits != NULL)
97 HeapFree(GetProcessHeap(), 0, lpBitmap->bits);
98
99 /* Free the bitmap info */
100 if (lpBitmap->info != NULL)
101 HeapFree(GetProcessHeap(), 0, lpBitmap->info);
102
103 /* Free the bitmap structure */
104 if (lpBitmap != NULL)
105 HeapFree(GetProcessHeap(), 0, lpBitmap);
106}
#define HeapFree(x, y, z)
Definition: compat.h:735
BYTE * bits
Definition: desk.h:46
BITMAPINFO * info
Definition: desk.h:45

Referenced by BackgroundPageProc(), and ListViewItemChanged().

◆ DibLoadImage()

PDIBITMAP DibLoadImage ( LPTSTR  lpFilename)

Definition at line 13 of file dibitmap.c.

14{
15 PDIBITMAP lpBitmap;
18
19 if (GdipCreateBitmapFromFile(lpFilename, &bitmap) != Ok)
20 {
21 return NULL;
22 }
23
24 lpBitmap = HeapAlloc(GetProcessHeap(), 0, sizeof(DIBITMAP));
25 if (lpBitmap == NULL)
26 {
28 return NULL;
29 }
30
31 lpBitmap->info = HeapAlloc(GetProcessHeap(), 0, sizeof(BITMAPINFO));
32 if (lpBitmap->info == NULL)
33 {
34 HeapFree(GetProcessHeap(), 0, lpBitmap);
36 return NULL;
37 }
38
39 if (GdipGetImageWidth((GpImage*)bitmap, &lpBitmap->width) != Ok ||
40 GdipGetImageHeight((GpImage*)bitmap, &lpBitmap->height) != Ok)
41 {
42 HeapFree(GetProcessHeap(), 0, lpBitmap->info);
43 HeapFree(GetProcessHeap(), 0, lpBitmap);
45 return NULL;
46 }
47
48 lpBitmap->bits = HeapAlloc(GetProcessHeap(), 0, lpBitmap->width * lpBitmap->height * 4);
49 if (!lpBitmap->bits)
50 {
51 HeapFree(GetProcessHeap(), 0, lpBitmap->info);
52 HeapFree(GetProcessHeap(), 0, lpBitmap);
54 return NULL;
55 }
56
57 ZeroMemory(lpBitmap->info, sizeof(BITMAPINFO));
58 lpBitmap->info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
59 lpBitmap->info->bmiHeader.biWidth = lpBitmap->width;
60 lpBitmap->info->bmiHeader.biHeight = -(INT)lpBitmap->height;
61 lpBitmap->info->bmiHeader.biPlanes = 1;
62 lpBitmap->info->bmiHeader.biBitCount = 32;
64 lpBitmap->info->bmiHeader.biSizeImage = lpBitmap->width * lpBitmap->height * 4;
65
66 lock.Width = lpBitmap->width;
67 lock.Height = lpBitmap->height;
68 lock.Stride = lpBitmap->width * 4;
69 lock.PixelFormat = PixelFormat32bppPARGB;
70 lock.Scan0 = lpBitmap->bits;
71 lock.Reserved = 0;
72
74 {
75 HeapFree(GetProcessHeap(), 0, lpBitmap->bits);
76 HeapFree(GetProcessHeap(), 0, lpBitmap->info);
77 HeapFree(GetProcessHeap(), 0, lpBitmap);
79 return NULL;
80 }
81
84
85 return lpBitmap;
86}
GpStatus WINGDIPAPI GdipCreateBitmapFromFile(GDIPCONST WCHAR *filename, GpBitmap **bitmap)
Definition: image.c:1360
GpStatus WINGDIPAPI GdipGetImageWidth(GpImage *image, UINT *width)
Definition: image.c:2390
GpStatus WINGDIPAPI GdipGetImageHeight(GpImage *image, UINT *height)
Definition: image.c:2287
GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap *bitmap, GDIPCONST GpRect *rect, UINT flags, PixelFormat format, BitmapData *lockeddata)
Definition: image.c:1030
GpStatus WINGDIPAPI GdipDisposeImage(GpImage *image)
Definition: image.c:2155
GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap *bitmap, BitmapData *lockeddata)
Definition: image.c:1176
#define BI_RGB
Definition: precomp.h:47
@ ImageLockModeUserInputBuf
@ ImageLockModeRead
#define PixelFormat32bppPARGB
@ Ok
Definition: gdiplustypes.h:26
if(dx< 0)
Definition: linetemp.h:194
#define INT
Definition: polytest.cpp:20
Definition: desk.h:44
UINT height
Definition: desk.h:48
UINT width
Definition: desk.h:47
Definition: uimain.c:89
USHORT biBitCount
Definition: precomp.h:37
ULONG biCompression
Definition: precomp.h:38
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1476
rwlock_t lock
Definition: tcpcore.h:0
#define ZeroMemory
Definition: winbase.h:1670

Referenced by ListViewItemChanged().

◆ DisplayAdvancedSettings()

BOOL DisplayAdvancedSettings ( HWND  hWndParent,
PDISPLAY_DEVICE_ENTRY  DisplayDevice 
)

Definition at line 81 of file advmon.c.

82{
83 TCHAR szCaption[128];
86 HPSXA hpsxaDev, hpsxaDisp;
87 BOOL Ret;
88 IDataObject *pdo;
89#ifdef _MSC_VER
91 CPSEAE msvc_SHCreatePropSheetExtArrayEx;
92#endif
93
94 /* FIXME: Build the "%s and %s" caption string for the monitor and adapter name */
95 szCaption[0] = _T('\0');
96
97 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
98 psh.dwSize = sizeof(PROPSHEETHEADER);
99 psh.dwFlags = PSH_PROPTITLE;
100 psh.hwndParent = hWndParent;
101 psh.hInstance = hApplet;
102 psh.pszCaption = szCaption;
103 psh.phpage = hpsp;
104
106
107 pdo = CreateDevSettings(DisplayDevice);
108
109 if (pdo != NULL)
110 BuildAdvPropTitle(pdo, szCaption, sizeof(szCaption) / sizeof(szCaption[0]));
111
112#ifdef _MSC_VER
113 hShell32 = LoadLibrary(_T("shell32.dll"));
114 if (hShell32 == NULL)
115 return FALSE;
116 msvc_SHCreatePropSheetExtArrayEx = (CPSEAE)GetProcAddress(hShell32, (LPCSTR)194);
117 hpsxaDev = msvc_SHCreatePropSheetExtArrayEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Device"), MAX_ADVANCED_PAGES - psh.nPages, pdo);
118#else
120#endif
121 if (hpsxaDev != NULL)
123
124#ifdef _MSC_VER
125 hpsxaDisp = msvc_SHCreatePropSheetExtArrayEx(HKEY_LOCAL_MACHINE, REGSTR_PATH_CONTROLSFOLDER TEXT("\\Display"), MAX_ADVANCED_PAGES - psh.nPages, pdo);
126#else
128#endif
129 if (hpsxaDisp != NULL)
131
132 Ret = (LONG)(PropertySheet(&psh) != -1);
133
134 if (hpsxaDisp != NULL)
136
137 if (hpsxaDev != NULL)
139
140 IDataObject_Release(pdo);
141
142#ifdef _MSC_VER
144#endif
145
146 return Ret;
147}
static BOOL CALLBACK PropSheetAddPage(HPROPSHEETPAGE hpage, LPARAM lParam)
Definition: advmon.c:13
static BOOL DisplayAdvancedSettingsInitPropSheetPage(PROPSHEETHEADER *ppsh, WORD idDlg, DLGPROC DlgProc, LPARAM lParam)
Definition: advmon.c:26
#define MAX_ADVANCED_PAGES
Definition: advmon.c:10
HPSXA(WINAPI * CPSEAE)(HKEY, LPCWSTR, UINT, IDataObject *)
Definition: advmon.c:78
static VOID BuildAdvPropTitle(IDataObject *pdo, LPTSTR lpBuffer, DWORD dwBufferLen)
Definition: advmon.c:52
INT_PTR CALLBACK AdvGeneralPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: general.c:115
HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY, LPCWSTR, UINT, IDataObject *)
IDataObject * CreateDevSettings(PDISPLAY_DEVICE_ENTRY DisplayDeviceInfo)
Definition: devsett.c:1045
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDD_ADVANCED_GENERAL
Definition: resource.h:18
#define GetProcAddress(x, y)
Definition: compat.h:753
#define FreeLibrary(x)
Definition: compat.h:748
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TEXT(s)
Definition: k32.h:26
static HMODULE hShell32
Definition: string.c:34
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
long LONG
Definition: pedump.c:60
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define PropertySheet
Definition: prsht.h:400
#define REGSTR_PATH_CONTROLSFOLDER
Definition: regstr.h:76
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2150
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:1973
#define _T(x)
Definition: vfdio.h:22
#define LoadLibrary
Definition: winbase.h:3733
LONG_PTR LPARAM
Definition: windef.h:208
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
char TCHAR
Definition: xmlstorage.h:189
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by SettingsPageProc().

◆ InitDesktopSettings()

VOID InitDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 63 of file desktop.c.

64{
65 UINT i;
66 TCHAR regPath[MAX_PATH];
67
68 /* Load desktop icon settings from the registry */
69 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
70 StringCchCat(regPath, _countof(regPath), szClassicStartMenu);
71
72 for (i = 0; i < _countof(pData->optIcons); i++)
73 {
74 pData->optIcons[i].bHideClassic = SHRegGetBoolUSValue(regPath, DesktopIcons[i].CLSID, FALSE, FALSE);
75 }
76
77 StringCchCopy(regPath, _countof(regPath), szHideDesktopIcons);
78 StringCchCat(regPath, _countof(regPath), szNewStartPanel);
79
80 for (i = 0; i < _countof(pData->optIcons); i++)
81 {
82 pData->optIcons[i].bHideNewStart = SHRegGetBoolUSValue(regPath, DesktopIcons[i].CLSID, FALSE, TRUE);
83 }
84
85 for (i = 0; i < _countof(IconChange); i++)
86 {
87 DWORD cbData, dwType;
88 TCHAR szData[MAX_PATH];
89
90 /* Current icons */
91 StringCchCopy(regPath, _countof(regPath), szUserClass);
92 StringCchCat(regPath, _countof(regPath), IconChange[i].CLSID);
93 StringCchCat(regPath, _countof(regPath), szDefaultIcon);
94 cbData = sizeof(szData);
95
96 if (SHGetValue(HKEY_CURRENT_USER, regPath, IconChange[i].IconName, &dwType,
97 &szData, &cbData) == ERROR_SUCCESS &&
98 (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
99 {
100 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), szData);
101 }
102
103 /* Default icons */
104 /* FIXME: Get default icons from theme data, fallback to CLSID data on error. */
105 StringCchCopy(regPath, _countof(regPath), szSysClass);
106 StringCchCat(regPath, _countof(regPath), IconChange[i].CLSID);
107 StringCchCat(regPath, _countof(regPath), szDefaultIcon);
108 cbData = sizeof(szData);
109
110 if (SHGetValue(HKEY_CLASSES_ROOT, regPath, IconChange[i].IconName, &dwType,
111 &szData, &cbData) == ERROR_SUCCESS &&
112 (dwType == REG_SZ || dwType == REG_EXPAND_SZ))
113 {
114 StringCchCopy(pData->DefIcon[i].szPath, _countof(pData->DefIcon[i].szPath), szData);
115 }
116
117 /* Emergency fallback */
118 if (lstrlen(pData->DefIcon[i].szPath) == 0)
119 StringCchCopy(pData->DefIcon[i].szPath, _countof(pData->DefIcon[i].szPath), szFallbackIcon);
120
121 if (lstrlen(pData->Icon[i].szPath) == 0)
122 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), pData->DefIcon[i].szPath);
123 }
124}
#define ERROR_SUCCESS
Definition: deptool.c:10
static const TCHAR szDefaultIcon[]
Definition: desktop.c:46
struct @208 DesktopIcons[NUM_DESKTOP_ICONS]
LPCTSTR IconName
Definition: desktop.c:53
struct @209 IconChange[NUM_CHANGE_ICONS]
static const TCHAR szClassicStartMenu[]
Definition: desktop.c:30
static const TCHAR szSysClass[]
Definition: desktop.c:45
static const TCHAR szNewStartPanel[]
Definition: desktop.c:31
static const TCHAR szFallbackIcon[]
Definition: desktop.c:47
static const TCHAR szHideDesktopIcons[]
Definition: desktop.c:29
static const TCHAR szUserClass[]
Definition: desktop.c:44
#define MAX_PATH
Definition: compat.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95
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 REG_SZ
Definition: layer.c:22
unsigned int UINT
Definition: ndis.h:50
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define SHRegGetBoolUSValue
Definition: shlwapi.h:574
#define SHGetValue
Definition: shlwapi.h:70
#define _countof(array)
Definition: sndvol32.h:68
#define StringCchCopy
Definition: strsafe.h:139
#define StringCchCat
Definition: strsafe.h:317
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
#define lstrlen
Definition: winbase.h:3747
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10

Referenced by BackgroundPageProc().

◆ LoadPopupMenu()

HMENU LoadPopupMenu ( IN HINSTANCE  hInstance,
IN LPCTSTR  lpMenuName 
)

Definition at line 41 of file desk.c.

43{
44 HMENU hMenu, hSubMenu = NULL;
45
46 hMenu = LoadMenu(hInstance,
47 lpMenuName);
48
49 if (hMenu != NULL)
50 {
51 hSubMenu = GetSubMenu(hMenu,
52 0);
53 if (hSubMenu != NULL &&
54 !RemoveMenu(hMenu,
55 0,
57 {
58 hSubMenu = NULL;
59 }
60
61 DestroyMenu(hMenu);
62 }
63
64 return hSubMenu;
65}
HINSTANCE hInstance
Definition: charmap.c:19
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define MF_BYPOSITION
Definition: winuser.h:203
BOOL WINAPI RemoveMenu(_In_ HMENU, _In_ UINT, _In_ UINT)
#define LoadMenu
Definition: winuser.h:5807
BOOL WINAPI DestroyMenu(_In_ HMENU)

◆ RegLoadMUIStringW()

LONG RegLoadMUIStringW ( IN HKEY  hKey,
IN LPCWSTR pszValue  OPTIONAL,
OUT LPWSTR  pszOutBuf,
IN DWORD  cbOutBuf,
OUT LPDWORD pcbData  OPTIONAL,
IN DWORD  Flags,
IN LPCWSTR pszDirectory  OPTIONAL 
)

Definition at line 53 of file muireg.c.

60{
61 DWORD dwValueType, cbData;
62 LPWSTR pwszTempBuffer = NULL, pwszExpandedBuffer = NULL;
64
65 /* Parameter sanity checks. */
66 if (!hKey || !pszOutBuf)
68
69 if (pszDirectory && *pszDirectory)
70 {
71 //FIXME("BaseDir parameter not yet supported!\n");
73 }
74
75 /* Check for value existence and correctness of it's type, allocate a buffer and load it. */
76 result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, NULL, &cbData);
77 if (result != ERROR_SUCCESS) goto cleanup;
78 if (!(dwValueType == REG_SZ || dwValueType == REG_EXPAND_SZ) || !cbData)
79 {
81 goto cleanup;
82 }
83 pwszTempBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
84 if (!pwszTempBuffer)
85 {
87 goto cleanup;
88 }
89 result = RegQueryValueExW(hKey, pszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData);
90 if (result != ERROR_SUCCESS) goto cleanup;
91
92 /* Expand environment variables, if appropriate, or copy the original string over. */
93 if (dwValueType == REG_EXPAND_SZ)
94 {
95 cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
96 if (!cbData) goto cleanup;
97 pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
98 if (!pwszExpandedBuffer)
99 {
101 goto cleanup;
102 }
103 ExpandEnvironmentStringsW(pwszTempBuffer, pwszExpandedBuffer, cbData);
104 }
105 else
106 {
107 pwszExpandedBuffer = HeapAlloc(GetProcessHeap(), 0, cbData);
108 memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
109 }
110
111 /* If the value references a resource based string, parse the value and load the string.
112 * Else just copy over the original value. */
114 if (*pwszExpandedBuffer != L'@') /* '@' is the prefix for resource based string entries. */
115 {
116 lstrcpynW(pszOutBuf, pwszExpandedBuffer, cbOutBuf / sizeof(WCHAR));
117 }
118 else
119 {
120 WCHAR *pComma = wcsrchr(pwszExpandedBuffer, L',');
121 UINT uiStringId;
123
124 /* Format of the expanded value is 'path_to_dll,-resId' */
125 if (!pComma || pComma[1] != L'-')
126 {
128 goto cleanup;
129 }
130
131 uiStringId = _wtoi(pComma+2);
132 *pComma = L'\0';
133
134 hModule = LoadLibraryExW(pwszExpandedBuffer + 1, NULL, LOAD_LIBRARY_AS_DATAFILE);
135 if (!hModule || !load_string(hModule, uiStringId, pszOutBuf, cbOutBuf / sizeof(WCHAR)))
138 }
139
140cleanup:
141 HeapFree(GetProcessHeap(), 0, pwszTempBuffer);
142 HeapFree(GetProcessHeap(), 0, pwszExpandedBuffer);
143 return result;
144}
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
HMODULE hModule
Definition: animate.c:44
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define wcsrchr
Definition: compat.h:16
#define lstrcpynW
Definition: compat.h:738
static void cleanup(void)
Definition: main.c:1335
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
Definition: loader.c:288
FxAutoRegKey hKey
GLuint64EXT * result
Definition: glext.h:11304
_Check_return_ _CRTIMP int __cdecl _wtoi(_In_z_ const wchar_t *_Str)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
static int load_string(HINSTANCE hModule, UINT resId, LPWSTR pwszBuffer, INT cMaxChars)
Definition: muireg.c:10
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define LOAD_LIBRARY_AS_DATAFILE
Definition: winbase.h:342
#define ERROR_BADKEY
Definition: winerror.h:589
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by CDefaultContextMenu::AddStaticContextMenusToMenu(), FileTypesDlg_InsertToLV(), HCR_GetClassNameW(), HCR_MapTypeToValueW(), LoadClassicColorSchemes(), LoadSchemeSizes(), and RegLoadMUIStringA().

◆ SaveDesktopSettings()

BOOL SaveDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 127 of file desktop.c.

128{
129 UINT i;
130
131 if (!pData->bLocalSettingsChanged)
132 return FALSE;
133
134 for (i = 0; i < _countof(DesktopIcons); i++)
135 {
136 if (!pData->bLocalHideChanged[i])
137 continue;
138
139 pData->optIcons[i].bHideClassic =
140 pData->optIcons[i].bHideNewStart = pData->bLocalHideIcon[i];
141 pData->bHideChanged[i] = TRUE;
142 }
143
144 for (i = 0; i < _countof(IconChange); i++)
145 {
146 if (!pData->bLocalIconChanged[i])
147 continue;
148
149 StringCchCopy(pData->Icon[i].szPath, _countof(pData->Icon[i].szPath), pData->LocalIcon[i].szPath);
150 pData->bIconChanged[i] = TRUE;
151 }
152
153 pData->bSettingsChanged = TRUE;
154 return TRUE;
155}

Referenced by OnCustomButton().

◆ SetDesktopSettings()

VOID SetDesktopSettings ( PDESKTOP_DATA  pData)

Definition at line 181 of file desktop.c.

182{
183 UINT i;
184
185 for (i = 0; i < _countof(DesktopIcons); i++)
186 {
187 if (!pData->bHideChanged[i])
188 continue;
189
190 if (GetCurrentValue(i, FALSE) != pData->optIcons[i].bHideClassic)
191 SetCurrentValue(i, FALSE, pData->optIcons[i].bHideClassic);
192
193 if (GetCurrentValue(i, TRUE) != pData->optIcons[i].bHideNewStart)
194 SetCurrentValue(i, TRUE, pData->optIcons[i].bHideNewStart);
195
196 pData->bHideChanged[i] = FALSE;
197 }
198
199 for (i = 0; i < _countof(IconChange); i++)
200 {
201 TCHAR iconPath[MAX_PATH];
202 DWORD dwType = (pData->Icon[i].szPath[0] == TEXT('%') ? REG_EXPAND_SZ : REG_SZ);
203
204 if (!pData->bIconChanged[i])
205 continue;
206
207 StringCchCopy(iconPath, _countof(iconPath), szUserClass);
208 StringCchCat(iconPath, _countof(iconPath), IconChange[i].CLSID);
209 StringCchCat(iconPath, _countof(iconPath), szDefaultIcon);
210
212 pData->Icon[i].szPath, sizeof(pData->Icon[i].szPath));
214 {
215 /* Also apply to the root value */
216 SHSetValue(HKEY_CURRENT_USER, iconPath, NULL, dwType,
217 pData->Icon[i].szPath, sizeof(pData->Icon[i].szPath));
218 }
219 pData->bIconChanged[i] = FALSE;
220 }
221
222 pData->bSettingsChanged = FALSE;
223
224 /* Refresh the desktop */
226}
static VOID SetCurrentValue(UINT i, BOOL bNewStart, BOOL bValue)
Definition: desktop.c:169
#define IDS_TITLE_BIN_0
Definition: desktop.c:19
static BOOL GetCurrentValue(UINT i, BOOL bNewStart)
Definition: desktop.c:158
#define FCIDM_DESKBROWSER_REFRESH
Definition: desktop.c:14
UINT TitleId
Definition: desktop.c:52
#define SHSetValue
Definition: shlwapi.h:92
HWND WINAPI GetShellWindow(VOID)
Definition: desktop.c:651
#define PostMessage
Definition: winuser.h:5822

Referenced by BackgroundPageProc().

◆ SHCreatePropSheetExtArrayEx()

HPSXA WINAPI SHCreatePropSheetExtArrayEx ( HKEY  ,
LPCWSTR  ,
UINT  ,
IDataObject  
)

Referenced by DisplayAdvancedSettings().

◆ SwitchDisplayMode()

BOOL SwitchDisplayMode ( HWND  hwndDlg,
PWSTR  DeviceName,
PSETTINGS_ENTRY  seInit,
PSETTINGS_ENTRY  seNew,
OUT PLONG  rc 
)

Definition at line 771 of file settings.c.

772{
773 TCHAR Message[1024], Title[256];
775
776 RtlZeroMemory(&devmode, sizeof(devmode));
777 devmode.dmSize = (WORD)sizeof(devmode);
783
784 *rc = ChangeDisplaySettingsEx(DeviceName,
785 &devmode,
786 NULL,
788 NULL);
789 switch (*rc)
790 {
792 break;
793
798 return FALSE;
799
801 default:
805 return FALSE;
806 }
807
809 {
810 return TRUE;
811 }
812 else
813 {
818
819 *rc = ChangeDisplaySettingsEx(DeviceName,
820 &devmode,
821 NULL,
823 NULL);
824 switch (*rc)
825 {
827 return FALSE;
828
833 return FALSE;
834
836 default:
840 return FALSE;
841 }
842 }
843}
DEVMODEW devmode
#define IDS_DISPLAY_SETTINGS
Definition: resource.h:161
#define IDS_APPLY_NEEDS_RESTART
Definition: resource.h:164
#define IDD_CONFIRMSETTINGS
Definition: resource.h:19
#define IDS_APPLY_FAILED
Definition: resource.h:163
static INT_PTR CALLBACK ConfirmDlgProc(IN HWND hwndDlg, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: settings.c:708
static const WCHAR Title[]
Definition: oid.c:1259
static const WCHAR Message[]
Definition: register.c:74
unsigned short WORD
Definition: ntddk_ex.h:93
DWORD dmPelsHeight
Definition: precomp.h:64
DWORD dmDisplayFrequency
Definition: desk.h:138
DWORD dmBitsPerPel
Definition: precomp.h:62
DWORD dmPelsWidth
Definition: precomp.h:63
DWORD dmBitsPerPel
Definition: wingdi.h:1647
DWORD dmFields
Definition: wingdi.h:1622
DWORD dmPelsWidth
Definition: wingdi.h:1648
DWORD dmPelsHeight
Definition: wingdi.h:1649
DWORD dmDisplayFrequency
Definition: wingdi.h:1654
WORD dmSize
Definition: wingdi.h:1620
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
_Must_inspect_result_ _In_ PWDFDEVICE_INIT _In_opt_ PCUNICODE_STRING DeviceName
Definition: wdfdevice.h:3275
#define DM_DISPLAYFREQUENCY
Definition: wingdi.h:1272
#define DM_PELSWIDTH
Definition: wingdi.h:1269
#define DM_BITSPERPEL
Definition: wingdi.h:1268
#define DM_PELSHEIGHT
Definition: wingdi.h:1270
#define DISP_CHANGE_SUCCESSFUL
Definition: winuser.h:190
#define CDS_UPDATEREGISTRY
Definition: winuser.h:181
#define DISP_CHANGE_FAILED
Definition: winuser.h:194
#define MB_OK
Definition: winuser.h:784
#define LoadString
Definition: winuser.h:5809
#define MessageBox
Definition: winuser.h:5812
#define MB_ICONINFORMATION
Definition: winuser.h:796
#define MB_ICONSTOP
Definition: winuser.h:797
#define IDYES
Definition: winuser.h:829
#define DISP_CHANGE_RESTART
Definition: winuser.h:191
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define DialogBox
Definition: winuser.h:5751

Referenced by ApplyDisplaySettings(), and DisplaySaveSettings().

Variable Documentation

◆ g_GlobalData

◆ hApplet

HINSTANCE hApplet
extern

Definition at line 17 of file access.c.

◆ hCPLWindow

HWND hCPLWindow
extern

Definition at line 27 of file desk.c.

Referenced by DisplayApplet(), and LoadSchemeFromTheme().