ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

systempage.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:     ReactOS Applications
00003  * LICENSE:     LGPL - See COPYING in the top level directory
00004  * FILE:        base/applications/msconfig/systempage.c
00005  * PURPOSE:     System page message handler
00006  * COPYRIGHT:   Copyright 2005-2006 Christoph von Wittich <Christoph@ApiViewer.de>
00007  *                        2011      Gregor Schneider <Gregor.Schneider@reactos.org>
00008  */
00009 #include <precomp.h>
00010 
00011 HWND hSystemPage;
00012 HWND hSystemDialog;
00013 
00014 #define BUFFER_SIZE 512
00015 
00016 static BOOL
00017 LoadSystemIni(WCHAR * szPath, HWND hDlg)
00018 {
00019     WCHAR szBuffer[BUFFER_SIZE];
00020     HWND hDlgCtrl;
00021     HTREEITEM parent = NULL;
00022     FILE* file;
00023     UINT length;
00024     TVINSERTSTRUCT insert;
00025 
00026     wcscpy(szBuffer, szPath);
00027     wcscat(szBuffer, L"\\system.ini");
00028 
00029     file = _wfopen(szBuffer, L"rt");
00030     if (!file)
00031        return FALSE;
00032 
00033     hDlgCtrl = GetDlgItem(hDlg, IDC_SYSTEM_TREE);
00034 
00035     while(!feof(file))
00036     {
00037         if (fgetws(szBuffer, BUFFER_SIZE, file))
00038         {
00039             length = wcslen(szBuffer);
00040             if (length > 1)
00041             {
00042                 szBuffer[length] = L'\0';
00043                 szBuffer[length - 1] = L'\0';
00044                 insert.hInsertAfter = TVI_LAST;
00045                 insert.item.mask = TVIF_TEXT;
00046                 insert.item.pszText = szBuffer;
00047 
00048                 if (szBuffer[0] == L';' || szBuffer[0] == L'[')
00049                 {
00050                     /* Parent */
00051                     insert.hParent = NULL;
00052                     parent = TreeView_InsertItem(hDlgCtrl, &insert);
00053                 }
00054                 else
00055                 {
00056                     /* Child */
00057                     insert.hParent = parent;
00058                     TreeView_InsertItem(hDlgCtrl, &insert);
00059                 }
00060             }
00061         }
00062     }
00063 
00064     fclose(file);
00065 
00066     return TRUE;
00067 }
00068 
00069 static BOOL
00070 InitializeSystemDialog(HWND hDlg)
00071 {
00072     WCHAR winDir[PATH_MAX];
00073 
00074     GetWindowsDirectoryW(winDir, PATH_MAX);
00075     return LoadSystemIni(winDir, hDlg);
00076 }
00077 
00078 
00079 INT_PTR CALLBACK
00080 SystemPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
00081 {
00082     UNREFERENCED_PARAMETER(lParam);
00083     UNREFERENCED_PARAMETER(wParam);
00084     switch (message) {
00085         case WM_INITDIALOG:
00086         {
00087             hSystemDialog = hDlg;
00088             SetWindowPos(hDlg, NULL, 10, 32, 0, 0, SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSIZE | SWP_NOZORDER);
00089             InitializeSystemDialog(hDlg);
00090             return TRUE;
00091         }
00092     }
00093 
00094     return 0;
00095 }

Generated on Sat May 26 2012 04:15:51 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.