- write services to file
- added a roadmap for fun
Modified: trunk/reactos/base/system/servman/export.c
Added: trunk/reactos/base/system/servman/roadmap.txt
  _____
Modified: trunk/reactos/base/system/servman/export.c
--- trunk/reactos/base/system/servman/export.c  2006-01-31 19:25:52 UTC
(rev 67)
+++ trunk/reactos/base/system/servman/export.c  2006-01-31 20:43:06 UTC
(rev 68)
@@ -3,24 +3,64 @@
  * LICENSE:     GPL - See COPYING in the top level directory
  * FILE:        base/system/servman/export.c
  * PURPOSE:     Save services to a file
- * COPYRIGHT:   Copyright 2005 Ged Murphy <gedmurphy(a)gmail.com>
+ * COPYRIGHT:   Copyright 2006 Ged Murphy <gedmurphy(a)gmail.com>
  *
  */
 #include "servman.h"
+extern HWND hListView;
-BOOL SaveServicesToFile(HWND hListView, LPCTSTR pszFileName)
+
+DWORD GetTextFromListView(TCHAR Text[500], INT row, INT col)
 {
+    LVITEM item;
+    DWORD NumChars;
+
+    ZeroMemory(&item, sizeof(item));
+    item.mask = LVIF_TEXT;
+    item.iSubItem = col;
+    item.pszText = Text;
+    item.cchTextMax = 500;
+    NumChars = (INT)SendMessage(hListView, LVM_GETITEMTEXT, row,
(LPARAM)&item);
+
+    return NumChars;
+}
+
+
+BOOL SaveServicesToFile(LPCTSTR pszFileName)
+{
        HANDLE hFile;
        BOOL bSuccess = FALSE;
        hFile = CreateFile(pszFileName, GENERIC_WRITE, 0, NULL,
-               CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+                       CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        if(hFile != INVALID_HANDLE_VALUE)
        {
+        TCHAR LVText[500];
+        TCHAR newl = _T('\n');
+        TCHAR tab = _T('\t');
+               DWORD dwTextLength, dwWritten;
+               INT NumListedServ = 0;
+               INT i, k;
+               NumListedServ = ListView_GetItemCount(hListView);
+
+               for (i=0; i < NumListedServ; i++)
+               {
+                   for (k=0; k<5; k++)
+                   {
+                dwTextLength = GetTextFromListView(LVText, i, k);
+                if (LVText != NULL)
+                {
+                    WriteFile(hFile, LVText, dwTextLength, &dwWritten,
NULL);
+                    WriteFile(hFile, &tab, 1, &dwWritten, NULL);
+                }
+                   }
+                   WriteFile(hFile, &newl, 1, &dwWritten, NULL);
+               }
                CloseHandle(hFile);
+               bSuccess = TRUE;
        }
        return bSuccess;
 }
@@ -35,7 +75,7 @@
        ofn.lStructSize = sizeof(OPENFILENAME);
        ofn.hwndOwner = hwnd;
-       ofn.lpstrFilter = _T("Text Files (*.txt)\0*.txt\0All Files
(*.*)\0*.*\0");
+       ofn.lpstrFilter = _T("Text (Tab Delimited)(*.txt)\0*.txt\0Text
(Comma Delimited)(*.csv)\0*.csv\0");
        ofn.lpstrFile = szFileName;
        ofn.nMaxFile = MAX_PATH;
        ofn.lpstrDefExt = _T("txt");
@@ -43,8 +83,11 @@
        if(GetSaveFileName(&ofn))
        {
-               SaveServicesToFile(hwnd, szFileName);
+               if (SaveServicesToFile(szFileName))
+            return;
        }
+
+       MessageBox(NULL, _T("Export to file failed"), NULL, 0);
 }
  _____
Added: trunk/reactos/base/system/servman/roadmap.txt
--- trunk/reactos/base/system/servman/roadmap.txt       2006-01-31
19:25:52 UTC (rev 67)
+++ trunk/reactos/base/system/servman/roadmap.txt       2006-01-31
20:43:06 UTC (rev 68)
@@ -0,0 +1,13 @@
+Release        Criteria
+-------        --------
+ 0.1   list all services. Provide basic starting and stopping of
services (complete 12/05)
+ 0.2   Working properties dialog (complete 01/06)
+ 0.3   Export services to a text file (complete 01/06)
+ 0.4   Creation of new services
+ 0.5   Safe deletion of existing services
+ 0.6   Sort all services by column
+ 0.7   Show services in all 4 views, not just report view. Needs
toolbar additions
+ 0.8   Complete dependancy dialog
+
+ 1.0   Security audited & bug tested
+ 1.1   Write help file
\ No newline at end of file
    
    
    
    
    
 
                    
                    
                        
                        Show replies by date