/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: base/system/servman/export.c
+ * FILE: base/applications/mscutils/servman/export.c
* PURPOSE: Save services to a file
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
*
#include "precomp.h"
-#include <commdlg.h>
#include <cderr.h>
static DWORD
GetTextFromListView(PMAIN_WND_INFO Info,
- TCHAR Text[500],
+ LPWSTR Text,
INT row,
INT col)
{
item.iSubItem = col;
item.pszText = Text;
item.cchTextMax = 500;
- NumChars = (INT)SendMessage(Info->hListView,
- LVM_GETITEMTEXT,
- row,
- (LPARAM)&item);
-
+ NumChars = (INT)SendMessageW(Info->hListView,
+ LVM_GETITEMTEXTW,
+ row,
+ (LPARAM)&item);
return NumChars;
}
static BOOL
SaveServicesToFile(PMAIN_WND_INFO Info,
- LPCTSTR pszFileName)
+ LPCWSTR pszFileName)
{
HANDLE hFile;
BOOL bSuccess = FALSE;
- hFile = CreateFile(pszFileName,
+ hFile = CreateFileW(pszFileName,
GENERIC_WRITE,
0,
NULL,
if(hFile != INVALID_HANDLE_VALUE)
{
- TCHAR LVText[500];
- TCHAR newl = _T('\n');
- TCHAR tab = _T('\t');
+ WCHAR LVText[500];
+ WCHAR newl[2] = {L'\r', L'\n'};
+ WCHAR tab = L'\t';
DWORD dwTextLength, dwWritten;
INT NumListedServ = 0;
INT i, k;
LVText,
i,
k);
- if (LVText != NULL)
+ if (dwTextLength != 0)
{
WriteFile(hFile,
LVText,
- sizeof(TCHAR) * dwTextLength,
+ sizeof(WCHAR) * dwTextLength,
&dwWritten,
NULL);
WriteFile(hFile,
&tab,
- sizeof(TCHAR),
+ sizeof(WCHAR),
&dwWritten,
NULL);
}
}
WriteFile(hFile,
- &newl,
- sizeof(TCHAR),
+ newl,
+ sizeof(newl),
&dwWritten,
NULL);
}
VOID ExportFile(PMAIN_WND_INFO Info)
{
- OPENFILENAME ofn;
- TCHAR szFileName[MAX_PATH] = _T("");
+ OPENFILENAMEW ofn;
+ WCHAR szFileName[MAX_PATH];
ZeroMemory(&ofn, sizeof(ofn));
+ szFileName[0] = UNICODE_NULL;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = Info->hMainWnd;
- ofn.lpstrFilter = _T("Text (Tab Delimited)(*.txt)\0*.txt\0Text (Comma Delimited)(*.csv)\0*.csv\0");
+ ofn.lpstrFilter = L"Text (Tab Delimited)(*.txt)\0*.txt\0Text (Comma Delimited)(*.csv)\0*.csv\0";
ofn.lpstrFile = szFileName;
ofn.nMaxFile = MAX_PATH;
- ofn.lpstrDefExt = _T("txt");
+ ofn.lpstrDefExt = L"txt";
ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
if(GetSaveFileName(&ofn))
}
if (CommDlgExtendedError() != CDERR_GENERALCODES)
- MessageBox(NULL, _T("Export to file failed"), NULL, 0);
+ MessageBoxW(NULL, L"Export to file failed", NULL, 0);
}