ReactOS  0.4.15-dev-499-g1f31905
general.c File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winuser.h>
#include <wininet.h>
#include <winreg.h>
#include <shlwapi.h>
#include <prsht.h>
#include <shlobj.h>
#include "inetcpl.h"
#include "wine/debug.h"
Include dependency graph for general.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (inetcpl)
 
static INT_PTR delhist_on_command (HWND hdlg, WPARAM wparam)
 
static INT_PTR CALLBACK delhist_dlgproc (HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
 
static DWORD parse_url_from_outside (LPCWSTR url, LPWSTR out, DWORD maxlen)
 
static INT_PTR general_on_command (HWND hwnd, WPARAM wparam)
 
static VOID general_on_initdialog (HWND hwnd)
 
static INT_PTR general_on_notify (HWND hwnd, WPARAM wparam, LPARAM lparam)
 
INT_PTR CALLBACK general_dlgproc (HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 

Variables

static const WCHAR about_blank [] = {'a','b','o','u','t',':','b','l','a','n','k',0}
 
static const WCHAR start_page [] = {'S','t','a','r','t',' ','P','a','g','e',0}
 
static const WCHAR default_page [] = {'D','e','f','a','u','l','t','_','P','a','g','e','_','U','R','L',0}
 
static const WCHAR reg_ie_main []
 
static DWORD disabled_general_buttons []
 
static DWORD disabled_delhist_buttons []
 

Function Documentation

◆ delhist_dlgproc()

static INT_PTR CALLBACK delhist_dlgproc ( HWND  hdlg,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 118 of file general.c.

119 {
120  switch (msg)
121  {
122  case WM_COMMAND:
123  return delhist_on_command(hdlg, wparam);
124 
125  case WM_INITDIALOG:
126  {
128  while (*ptr)
129  {
130  EnableWindow(GetDlgItem(hdlg, *ptr), FALSE);
131  ptr++;
132  }
134  break;
135  }
136 
137  default:
138  break;
139  }
140  return FALSE;
141 }
#define IDC_DELETE_TEMP_FILES
Definition: inetcpl.h:77
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
static PVOID ptr
Definition: dispmode.c:27
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
static INT_PTR delhist_on_command(HWND hdlg, WPARAM wparam)
Definition: general.c:59
#define WM_COMMAND
Definition: winuser.h:1722
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define BST_CHECKED
Definition: winuser.h:197
#define msg(x)
Definition: auth_time.c:54
static DWORD disabled_delhist_buttons[]
Definition: general.c:49
#define WM_INITDIALOG
Definition: winuser.h:1721
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by general_on_command().

◆ delhist_on_command()

static INT_PTR delhist_on_command ( HWND  hdlg,
WPARAM  wparam 
)
static

Definition at line 59 of file general.c.

60 {
61  switch (wparam)
62  {
63  case MAKEWPARAM(IDOK, BN_CLICKED):
65  FreeUrlCacheSpaceW(NULL, 100, 0);
66 
68  {
69  WCHAR pathW[MAX_PATH];
70 
72  FreeUrlCacheSpaceW(pathW, 100, 0);
73  }
74 
76  {
77  WCHAR pathW[MAX_PATH];
78 
80  FreeUrlCacheSpaceW(pathW, 100, 0);
81  }
82 
83  EndDialog(hdlg, IDOK);
84  return TRUE;
85 
87  EndDialog(hdlg, IDCANCEL);
88  return TRUE;
89 
95  {
101  EnableWindow(GetDlgItem(hdlg, IDOK), any);
102  break;
103  }
104 
105  default:
106  break;
107  }
108  return FALSE;
109 }
#define IDC_DELETE_TEMP_FILES
Definition: inetcpl.h:77
#define CSIDL_COOKIES
Definition: shlobj.h:2044
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
#define IDOK
Definition: winuser.h:824
#define IDC_DELETE_HISTORY
Definition: inetcpl.h:79
#define CSIDL_HISTORY
Definition: shlobj.h:2045
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR cache_path, DWORD size, DWORD filter)
Definition: urlcache.c:2384
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDC_DELETE_PASSWORDS
Definition: inetcpl.h:81
#define MAX_PATH
Definition: compat.h:26
#define BN_CLICKED
Definition: winuser.h:1907
#define IDC_DELETE_FORM_DATA
Definition: inetcpl.h:80
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
BOOL WINAPI SHGetSpecialFolderPathW(HWND hwndOwner, LPWSTR szPath, int nFolder, BOOL bCreate)
Definition: shellpath.c:2709
#define IDC_DELETE_COOKIES
Definition: inetcpl.h:78
#define IDCANCEL
Definition: winuser.h:825
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by delhist_dlgproc().

◆ general_dlgproc()

INT_PTR CALLBACK general_dlgproc ( HWND  hwnd,
UINT  msg,
WPARAM  wparam,
LPARAM  lparam 
)

Definition at line 298 of file general.c.

299 {
300 
301  switch (msg)
302  {
303  case WM_INITDIALOG:
305  return TRUE;
306 
307  case WM_COMMAND:
308  return general_on_command(hwnd, wparam);
309 
310  case WM_NOTIFY:
312 
313  default:
314  /* do not flood the log */
315  if ((msg == WM_SETCURSOR) || (msg == WM_NCHITTEST) || (msg == WM_MOUSEMOVE))
316  return FALSE;
317 
318  TRACE("(%p, 0x%08x/%d, 0x%lx, 0x%lx)\n", hwnd, msg, msg, wparam, lparam);
319 
320  }
321  return FALSE;
322 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define WM_NCHITTEST
Definition: winuser.h:1668
static INT_PTR general_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
Definition: general.c:252
static INT_PTR general_on_command(HWND hwnd, WPARAM wparam)
Definition: general.c:176
#define WM_SETCURSOR
Definition: winuser.h:1618
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_COMMAND
Definition: winuser.h:1722
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define msg(x)
Definition: auth_time.c:54
static VOID general_on_initdialog(HWND hwnd)
Definition: general.c:219
#define WM_INITDIALOG
Definition: winuser.h:1721
#define WM_NOTIFY
Definition: richedit.h:61
static UINT WPARAM wparam
Definition: combo.c:716

Referenced by display_cpl_sheets().

◆ general_on_command()

static INT_PTR general_on_command ( HWND  hwnd,
WPARAM  wparam 
)
static

Definition at line 176 of file general.c.

177 {
179  DWORD len;
180  DWORD type;
181  LONG res;
182 
183  switch (wparam)
184  {
186  /* enable apply button */
188  break;
189 
192  break;
193 
195  len = sizeof(buffer);
196  type = REG_SZ;
199  break;
200 
204  break;
205 
206  default:
207  TRACE("not implemented for command: %d/%d\n", HIWORD(wparam), LOWORD(wparam));
208  return FALSE;
209  }
210  return TRUE;
211 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define MAKEWPARAM(l, h)
Definition: winuser.h:3984
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList
#define IDC_HISTORY_DELETE
Definition: inetcpl.h:73
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
static INT_PTR CALLBACK delhist_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam)
Definition: general.c:118
UINT_PTR WPARAM
Definition: windef.h:207
#define IDC_HOME_EDIT
Definition: inetcpl.h:69
#define IDD_DELETE_HISTORY
Definition: inetcpl.h:76
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4374
#define TRACE(s)
Definition: solgame.cpp:4
static const WCHAR about_blank[]
Definition: general.c:37
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDC_HOME_BLANK
Definition: inetcpl.h:72
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR reg_ie_main[]
Definition: general.c:40
HWND WINAPI GetParent(_In_ HWND)
#define IDC_HOME_DEFAULT
Definition: inetcpl.h:71
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define PSM_CHANGED
Definition: prsht.h:164
GLuint res
Definition: glext.h:9613
static const WCHAR default_page[]
Definition: general.c:39
#define HIWORD(l)
Definition: typedefs.h:246
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
LONG WINAPI SHRegGetUSValueW(LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:594
#define LOWORD(l)
Definition: pedump.c:82
static UINT WPARAM wparam
Definition: combo.c:716
DECLSPEC_HIDDEN HMODULE hcpl
Definition: inetcpl.c:42
#define REG_SZ
Definition: layer.c:22
#define EN_CHANGE
Definition: winuser.h:2004

Referenced by general_dlgproc().

◆ general_on_initdialog()

static VOID general_on_initdialog ( HWND  hwnd)
static

Definition at line 219 of file general.c.

220 {
222  DWORD len;
223  DWORD type;
224  LONG res;
226 
227  /* disable unimplemented buttons */
228  while (*ptr)
229  {
231  ptr++;
232  }
233 
234  /* read current homepage from the registry. Try HCU first, then HKLM */
235  *buffer = 0;
236  len = sizeof(buffer);
237  type = REG_SZ;
239 
240  if (!res && (type == REG_SZ))
241  {
243  }
244 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define IDC_HOME_EDIT
Definition: inetcpl.h:69
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
unsigned char * LPBYTE
Definition: typedefs.h:53
long LONG
Definition: pedump.c:60
static PVOID ptr
Definition: dispmode.c:27
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
static const WCHAR start_page[]
Definition: general.c:38
static const WCHAR about_blank[]
Definition: general.c:37
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static const WCHAR reg_ie_main[]
Definition: general.c:40
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
GLuint res
Definition: glext.h:9613
LONG WINAPI SHRegGetUSValueW(LPCWSTR pSubKey, LPCWSTR pValue, LPDWORD pwType, LPVOID pvData, LPDWORD pcbData, BOOL flagIgnoreHKCU, LPVOID pDefaultData, DWORD wDefaultDataSize)
Definition: reg.c:594
static DWORD disabled_general_buttons[]
Definition: general.c:46
#define REG_SZ
Definition: layer.c:22

Referenced by general_dlgproc().

◆ general_on_notify()

static INT_PTR general_on_notify ( HWND  hwnd,
WPARAM  wparam,
LPARAM  lparam 
)
static

Definition at line 252 of file general.c.

253 {
254  PSHNOTIFY *psn;
257  LONG res;
258 
259  psn = (PSHNOTIFY *) lparam;
260  TRACE("WM_NOTIFY (%p, 0x%lx, 0x%lx) from %p with code: %d\n", hwnd, wparam, lparam,
261  psn->hdr.hwndFrom, psn->hdr.code);
262 
263  if (psn->hdr.code == PSN_APPLY)
264  {
265  *buffer = 0;
267  TRACE("EDITTEXT has %s\n", debugstr_w(buffer));
268 
269  res = parse_url_from_outside(buffer, parsed, ARRAY_SIZE(parsed));
270  TRACE("got %d with %s\n", res, debugstr_w(parsed));
271 
272  if (res)
273  {
274  HKEY hkey;
275 
276  /* update the dialog, when needed */
277  if (lstrcmpW(buffer, parsed))
279 
280  /* update the registry */
282  if (!res)
283  {
284  res = RegSetValueExW(hkey, start_page, 0, REG_SZ, (const BYTE *)parsed,
285  (lstrlenW(parsed) + 1) * sizeof(WCHAR));
286  RegCloseKey(hkey);
287  return !res;
288  }
289  }
290  }
291  return FALSE;
292 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
Definition: dialog.c:2271
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint buffer
Definition: glext.h:5915
#define PSN_APPLY
Definition: prsht.h:117
#define IDC_HOME_EDIT
Definition: inetcpl.h:69
#define lstrlenW
Definition: compat.h:416
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
UINT code
Definition: winuser.h:3134
NMHDR hdr
Definition: prsht.h:330
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
#define debugstr_w
Definition: kernel32.h:32
#define INTERNET_MAX_URL_LENGTH
Definition: session.c:1418
static const WCHAR start_page[]
Definition: general.c:38
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
HWND hwndFrom
Definition: winuser.h:3132
unsigned char BYTE
Definition: xxhash.c:193
static const WCHAR reg_ie_main[]
Definition: general.c:40
#define ARRAY_SIZE(a)
Definition: main.h:24
GLuint res
Definition: glext.h:9613
static DWORD parse_url_from_outside(LPCWSTR url, LPWSTR out, DWORD maxlen)
Definition: general.c:149
static UINT WPARAM wparam
Definition: combo.c:716
#define REG_SZ
Definition: layer.c:22

Referenced by general_dlgproc().

◆ parse_url_from_outside()

static DWORD parse_url_from_outside ( LPCWSTR  url,
LPWSTR  out,
DWORD  maxlen 
)
static

Definition at line 149 of file general.c.

150 {
151  HMODULE hdll;
152  DWORD (WINAPI *pParseURLFromOutsideSourceW)(LPCWSTR, LPWSTR, LPDWORD, LPDWORD);
153  DWORD res;
154 
155  hdll = LoadLibraryA("shdocvw.dll");
156  pParseURLFromOutsideSourceW = (void *) GetProcAddress(hdll, (LPSTR) 170);
157 
158  if (pParseURLFromOutsideSourceW)
159  {
160  res = pParseURLFromOutsideSourceW(url, out, &maxlen, NULL);
161  FreeLibrary(hdll);
162  return res;
163  }
164 
165  ERR("failed to get ordinal 170: %d\n", GetLastError());
166  FreeLibrary(hdll);
167  return 0;
168 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
char * LPSTR
Definition: xmlstorage.h:182
#define DWORD
Definition: nt_native.h:44
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
smooth NULL
Definition: ftsmooth.c:416
#define FreeLibrary(x)
Definition: compat.h:414
static const WCHAR url[]
Definition: encode.c:1432
#define WINAPI
Definition: msvc.h:6
static FILE * out
Definition: regtests2xml.c:44
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LPDWORD
Definition: nt_native.h:46
#define ERR(fmt,...)
Definition: debug.h:110
static PVOID hdll
Definition: shimdbg.c:126
GLuint res
Definition: glext.h:9613
#define GetProcAddress(x, y)
Definition: compat.h:419
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by general_on_notify().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( inetcpl  )

Variable Documentation

◆ about_blank

const WCHAR about_blank[] = {'a','b','o','u','t',':','b','l','a','n','k',0}
static

Definition at line 37 of file general.c.

Referenced by general_on_command(), and general_on_initdialog().

◆ default_page

const WCHAR default_page[] = {'D','e','f','a','u','l','t','_','P','a','g','e','_','U','R','L',0}
static

Definition at line 39 of file general.c.

Referenced by general_on_command().

◆ disabled_delhist_buttons

DWORD disabled_delhist_buttons[]
static
Initial value:
0}
#define IDC_DELETE_PASSWORDS
Definition: inetcpl.h:81
#define IDC_DELETE_FORM_DATA
Definition: inetcpl.h:80

Definition at line 49 of file general.c.

Referenced by delhist_dlgproc().

◆ disabled_general_buttons

DWORD disabled_general_buttons[]
static
Initial value:
0}
#define IDC_HISTORY_SETTINGS
Definition: inetcpl.h:74
#define IDC_HOME_CURRENT
Definition: inetcpl.h:70

Definition at line 46 of file general.c.

Referenced by general_on_initdialog().

◆ reg_ie_main

const WCHAR reg_ie_main[]
static
Initial value:
= {'S','o','f','t','w','a','r','e','\\',
'M','i','c','r','o','s','o','f','t','\\',
'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\',
'M','a','i','n',0}

Definition at line 40 of file general.c.

Referenced by general_on_command(), general_on_initdialog(), and general_on_notify().

◆ start_page

const WCHAR start_page[] = {'S','t','a','r','t',' ','P','a','g','e',0}
static