ReactOS 0.4.15-dev-7674-gc0b4db1
systempage.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Applications
3 * LICENSE: LGPL - See COPYING in the top level directory
4 * FILE: base/applications/msconfig/systempage.c
5 * PURPOSE: System page message handler
6 * COPYRIGHT: Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
7 * 2011 Gregor Schneider <Gregor.Schneider@reactos.org>
8 */
9
10#include "precomp.h"
11
14
15#define BUFFER_SIZE 512
16
17static BOOL
19{
20 WCHAR szBuffer[BUFFER_SIZE];
21 HWND hDlgCtrl;
23 FILE* file;
26 HRESULT hr;
27
28 hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szPath);
29 if (FAILED(hr))
30 return FALSE;
31
32 hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"\\system.ini");
33 if (FAILED(hr))
34 return FALSE;
35
36 file = _wfopen(szBuffer, L"rt");
37 if (!file)
38 return FALSE;
39
40 hDlgCtrl = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
41
42 while(!feof(file))
43 {
44 if (fgetws(szBuffer, BUFFER_SIZE, file))
45 {
46 length = wcslen(szBuffer);
47 if (length > 1)
48 {
49 szBuffer[length] = L'\0';
50 szBuffer[length - 1] = L'\0';
51 insert.hInsertAfter = TVI_LAST;
52 insert.item.mask = TVIF_TEXT;
53 insert.item.pszText = szBuffer;
54
55 if (szBuffer[0] == L';' || szBuffer[0] == L'[')
56 {
57 /* Parent */
58 insert.hParent = NULL;
59 parent = TreeView_InsertItem(hDlgCtrl, &insert);
60 }
61 else
62 {
63 /* Child */
64 insert.hParent = parent;
65 TreeView_InsertItem(hDlgCtrl, &insert);
66 }
67 }
68 }
69 }
70
71 fclose(file);
72
73 return TRUE;
74}
75
76static BOOL
78{
79 WCHAR winDir[PATH_MAX];
80
82 return LoadSystemIni(winDir, hDlg);
83}
84
85
88{
91 switch (message) {
92 case WM_INITDIALOG:
93 {
94 hSystemDialog = hDlg;
97 return TRUE;
98 }
99 }
100
101 return 0;
102}
#define IDC_SYSTEM_TREE
Definition: resource.h:68
#define PATH_MAX
Definition: types.h:280
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CALLBACK
Definition: compat.h:35
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2352
r parent
Definition: btrfs.c:3010
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
_Check_return_ _CRTIMP int __cdecl feof(_In_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl _wfopen(_In_z_ const wchar_t *_Filename, _In_z_ const wchar_t *_Mode)
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define FAILED(hr)
Definition: intsafe.h:51
LPCWSTR szPath
Definition: env.c:37
static BOOL LoadSystemIni(WCHAR *szPath, HWND hDlg)
Definition: systempage.c:18
static BOOL InitializeSystemDialog(HWND hDlg)
Definition: systempage.c:77
HWND hSystemDialog
Definition: systempage.c:13
INT_PTR CALLBACK SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
Definition: systempage.c:87
#define BUFFER_SIZE
Definition: systempage.c:15
HWND hSystemPage
Definition: systempage.c:12
unsigned int UINT
Definition: ndis.h:50
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define TVI_LAST
Definition: commctrl.h:3370
#define TVIF_TEXT
Definition: commctrl.h:3266
#define TVINSERTSTRUCT
Definition: commctrl.h:3402
#define TreeView_InsertItem(hwnd, lpis)
Definition: commctrl.h:3412
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
STRSAFEAPI StringCbCatW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:342
Definition: fci.c:127
Definition: tftpd.h:60
int32_t INT_PTR
Definition: typedefs.h:64
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define SWP_NOACTIVATE
Definition: winuser.h:1241
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOSIZE
Definition: winuser.h:1244
#define WM_INITDIALOG
Definition: winuser.h:1738
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define SWP_NOOWNERZORDER
Definition: winuser.h:1248
#define SWP_NOZORDER
Definition: winuser.h:1246
wchar_t * fgetws(wchar_t *buf, int bufsize, FILE *file)
Definition: wmain.c:22
static int insert
Definition: xmllint.c:138
__wchar_t WCHAR
Definition: xmlstorage.h:180