From 4fe24fa539a4c359e73b2fccddb6ec734b9a1cc1 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Wed, 8 Apr 2015 17:30:38 +0000 Subject: [PATCH] [SERVMAN] - TCHAR -> WCHAR svn path=/trunk/; revision=67095 --- .../applications/mscutils/servman/about.c | 6 +- .../applications/mscutils/servman/create.c | 93 ++++++----- .../applications/mscutils/servman/delete.c | 50 +++--- .../mscutils/servman/dependencies_tv1.c | 46 +++--- .../mscutils/servman/dependencies_tv2.c | 6 +- .../applications/mscutils/servman/export.c | 40 ++--- .../applications/mscutils/servman/listview.c | 144 +++++++++--------- .../base/applications/mscutils/servman/misc.c | 110 ++++++------- .../mscutils/servman/propsheet_depends.c | 26 ++-- .../mscutils/servman/propsheet_general.c | 134 ++++++++-------- .../applications/mscutils/servman/query.c | 136 ++++++++--------- .../applications/mscutils/servman/servman.c | 32 ++-- 12 files changed, 419 insertions(+), 404 deletions(-) diff --git a/reactos/base/applications/mscutils/servman/about.c b/reactos/base/applications/mscutils/servman/about.c index c45e456fd1b..2f23db343f3 100644 --- a/reactos/base/applications/mscutils/servman/about.c +++ b/reactos/base/applications/mscutils/servman/about.c @@ -22,14 +22,14 @@ AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) IDC_LICENSE_EDIT); if (hLicenseEditWnd) { - LPTSTR lpString; + LPWSTR lpString; if (AllocAndLoadString(&lpString, hInstance, IDS_LICENSE)) { - SetWindowText(hLicenseEditWnd, - lpString); + SetWindowTextW(hLicenseEditWnd, + lpString); LocalFree(lpString); } diff --git a/reactos/base/applications/mscutils/servman/create.c b/reactos/base/applications/mscutils/servman/create.c index 2042901d62a..dd9dc524dbb 100644 --- a/reactos/base/applications/mscutils/servman/create.c +++ b/reactos/base/applications/mscutils/servman/create.c @@ -12,11 +12,11 @@ typedef struct _CREATE_DATA { HWND hSelf; - LPTSTR ServiceName; - LPTSTR DisplayName; - LPTSTR BinPath; - LPTSTR Description; - LPTSTR Options; + LPWSTR ServiceName; + LPWSTR DisplayName; + LPWSTR BinPath; + LPWSTR Description; + LPWSTR Options; } CREATE_DATA, *PCREATE_DATA; @@ -30,28 +30,28 @@ DoCreate(PCREATE_DATA Data) BOOL bRet = FALSE; /* open handle to the SCM */ - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_ALL_ACCESS); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_ALL_ACCESS); if (hSCManager) { - hSc = CreateService(hSCManager, - Data->ServiceName, - Data->DisplayName, - SERVICE_ALL_ACCESS, - SERVICE_WIN32_OWN_PROCESS, - SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, - Data->BinPath, - NULL, - NULL, - NULL, - NULL, - NULL); + hSc = CreateServiceW(hSCManager, + Data->ServiceName, + Data->DisplayName, + SERVICE_ALL_ACCESS, + SERVICE_WIN32_OWN_PROCESS, + SERVICE_DEMAND_START, + SERVICE_ERROR_NORMAL, + Data->BinPath, + NULL, + NULL, + NULL, + NULL, + NULL); if (hSc) { - LPTSTR lpSuccess; + LPWSTR lpSuccess; /* Set the service description as CreateService does not do this for us */ @@ -78,29 +78,29 @@ DoCreate(PCREATE_DATA Data) return bRet; } -static LPTSTR +static LPWSTR GetStringFromDialog(PCREATE_DATA Data, UINT id) { HWND hwnd; - LPTSTR lpString = NULL; + LPWSTR lpString = NULL; INT iLen = 0; hwnd = GetDlgItem(Data->hSelf, id); if (hwnd) { - iLen = GetWindowTextLength(hwnd); + iLen = GetWindowTextLengthW(hwnd); if (iLen) { - lpString = (LPTSTR)HeapAlloc(ProcessHeap, + lpString = (LPWSTR)HeapAlloc(ProcessHeap, 0, - (iLen + 1) * sizeof(TCHAR)); + (iLen + 1) * sizeof(WCHAR)); if (lpString) { - GetWindowText(hwnd, - lpString, - iLen + 1); + GetWindowTextW(hwnd, + lpString, + iLen + 1); } } } @@ -167,34 +167,33 @@ CreateHelpDialogProc(HWND hDlg, { HWND hHelp; HICON hIcon = NULL; - TCHAR Buf[1000]; + WCHAR Buf[1000]; switch (message) { case WM_INITDIALOG: { - hIcon = (HICON) LoadImage(hInstance, - MAKEINTRESOURCE(IDI_SM_ICON), - IMAGE_ICON, - 16, - 16, - 0); + hIcon = (HICON) LoadImageW(hInstance, + MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, + 16, + 16, + 0); - SendMessage(hDlg, - WM_SETICON, - ICON_SMALL, - (LPARAM)hIcon); + SendMessageW(hDlg, + WM_SETICON, + ICON_SMALL, + (LPARAM)hIcon); hHelp = GetDlgItem(hDlg, IDC_CREATE_HELP); - LoadString(hInstance, - IDS_HELP_OPTIONS, - Buf, - sizeof(Buf) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_HELP_OPTIONS, + Buf, + sizeof(Buf) / sizeof(WCHAR)); - SetWindowText(hHelp, - Buf); + SetWindowTextW(hHelp, Buf); return TRUE; } diff --git a/reactos/base/applications/mscutils/servman/delete.c b/reactos/base/applications/mscutils/servman/delete.c index b041c15b73e..6c60c01067d 100644 --- a/reactos/base/applications/mscutils/servman/delete.c +++ b/reactos/base/applications/mscutils/servman/delete.c @@ -29,7 +29,7 @@ DoDeleteService(PMAIN_WND_INFO Info, { if (DeleteService(hSc)) { - LPTSTR lpSuccess; + LPWSTR lpSuccess; /* report success to user */ if (AllocAndLoadString(&lpSuccess, @@ -74,44 +74,44 @@ DeleteDialogProc(HWND hDlg, { case WM_INITDIALOG: { - LPTSTR lpDescription; + LPWSTR lpDescription; Info = (PMAIN_WND_INFO)lParam; if (Info != NULL) { - SetWindowLongPtr(hDlg, - GWLP_USERDATA, - (LONG_PTR)Info); + SetWindowLongPtrW(hDlg, + GWLP_USERDATA, + (LONG_PTR)Info); - hIcon = (HICON)LoadImage(hInstance, - MAKEINTRESOURCE(IDI_SM_ICON), - IMAGE_ICON, - 16, - 16, - 0); + hIcon = (HICON)LoadImageW(hInstance, + MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, + 16, + 16, + 0); if (hIcon) { - SendMessage(hDlg, - WM_SETICON, - ICON_SMALL, - (LPARAM)hIcon); + SendMessageW(hDlg, + WM_SETICON, + ICON_SMALL, + (LPARAM)hIcon); DestroyIcon(hIcon); } - SendDlgItemMessage(hDlg, - IDC_DEL_NAME, - WM_SETTEXT, - 0, - (LPARAM)Info->pCurrentService->lpDisplayName); + SendDlgItemMessageW(hDlg, + IDC_DEL_NAME, + WM_SETTEXT, + 0, + (LPARAM)Info->pCurrentService->lpDisplayName); lpDescription = GetServiceDescription(Info->pCurrentService->lpServiceName); if (lpDescription) { - SendDlgItemMessage(hDlg, - IDC_DEL_DESC, - WM_SETTEXT, - 0, - (LPARAM)lpDescription); + SendDlgItemMessageW(hDlg, + IDC_DEL_DESC, + WM_SETTEXT, + 0, + (LPARAM)lpDescription); HeapFree(ProcessHeap, 0, lpDescription); diff --git a/reactos/base/applications/mscutils/servman/dependencies_tv1.c b/reactos/base/applications/mscutils/servman/dependencies_tv1.c index 1c6918a36b9..116700dd153 100644 --- a/reactos/base/applications/mscutils/servman/dependencies_tv1.c +++ b/reactos/base/applications/mscutils/servman/dependencies_tv1.c @@ -9,20 +9,20 @@ #include "precomp.h" -LPTSTR +LPWSTR TV1_GetDependants(PSERVICEPROPSHEET pDlgInfo, SC_HANDLE hService) { LPQUERY_SERVICE_CONFIG lpServiceConfig; - LPTSTR lpStr = NULL; + LPWSTR lpStr = NULL; DWORD bytesNeeded; DWORD bytes; /* Get the info for this service */ - if (!QueryServiceConfig(hService, - NULL, - 0, - &bytesNeeded) && + if (!QueryServiceConfigW(hService, + NULL, + 0, + &bytesNeeded) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { lpServiceConfig = HeapAlloc(ProcessHeap, @@ -30,10 +30,10 @@ TV1_GetDependants(PSERVICEPROPSHEET pDlgInfo, bytesNeeded); if (lpServiceConfig) { - if (QueryServiceConfig(hService, - lpServiceConfig, - bytesNeeded, - &bytesNeeded)) + if (QueryServiceConfigW(hService, + lpServiceConfig, + bytesNeeded, + &bytesNeeded)) { /* Does this service have any dependencies? */ if (lpServiceConfig->lpDependencies && @@ -43,7 +43,7 @@ TV1_GetDependants(PSERVICEPROPSHEET pDlgInfo, bytes = 0; /* Work out how many bytes we need to hold the list */ - while (TRUE) + for (;;) { bytes++; @@ -57,7 +57,7 @@ TV1_GetDependants(PSERVICEPROPSHEET pDlgInfo, } /* Allocate and copy the list */ - bytes *= sizeof(TCHAR); + bytes *= sizeof(WCHAR); lpStr = HeapAlloc(ProcessHeap, 0, bytes); @@ -82,24 +82,24 @@ TV1_GetDependants(PSERVICEPROPSHEET pDlgInfo, VOID TV1_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, - LPTSTR lpServiceName) + LPWSTR lpServiceName) { SC_HANDLE hSCManager; SC_HANDLE hService; LPQUERY_SERVICE_CONFIG lpServiceConfig; - LPTSTR lpDependants; - LPTSTR lpStr; - LPTSTR lpNoDepends; + LPWSTR lpDependants; + LPWSTR lpStr; + LPWSTR lpNoDepends; BOOL bHasChildren; - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_ALL_ACCESS); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_ALL_ACCESS); if (hSCManager) { - hService = OpenService(hSCManager, - lpServiceName, - SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_QUERY_CONFIG); + hService = OpenServiceW(hSCManager, + lpServiceName, + SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_QUERY_CONFIG); if (hService) { /* Get a list of service dependents */ @@ -179,7 +179,7 @@ TV1_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, BOOL TV1_Initialize(PSERVICEPROPSHEET pDlgInfo, - LPTSTR lpServiceName) + LPWSTR lpServiceName) { BOOL bRet = FALSE; diff --git a/reactos/base/applications/mscutils/servman/dependencies_tv2.c b/reactos/base/applications/mscutils/servman/dependencies_tv2.c index 3e2351eb779..55e0582f52d 100644 --- a/reactos/base/applications/mscutils/servman/dependencies_tv2.c +++ b/reactos/base/applications/mscutils/servman/dependencies_tv2.c @@ -120,11 +120,11 @@ TV2_GetDependants(LPWSTR lpServiceName, VOID TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, HTREEITEM hParent, - LPTSTR lpServiceName) + LPWSTR lpServiceName) { LPENUM_SERVICE_STATUSW lpServiceStatus; - LPTSTR lpNoDepends; + LPWSTR lpNoDepends; DWORD count, i; BOOL bHasChildren; @@ -175,7 +175,7 @@ TV2_AddDependantsToTree(PSERVICEPROPSHEET pDlgInfo, BOOL TV2_Initialize(PSERVICEPROPSHEET pDlgInfo, - LPTSTR lpServiceName) + LPWSTR lpServiceName) { BOOL bRet = FALSE; diff --git a/reactos/base/applications/mscutils/servman/export.c b/reactos/base/applications/mscutils/servman/export.c index 4abb2796019..a7e45160a5a 100644 --- a/reactos/base/applications/mscutils/servman/export.c +++ b/reactos/base/applications/mscutils/servman/export.c @@ -9,12 +9,12 @@ #include "precomp.h" -#include -#include +//#include +//#include static DWORD GetTextFromListView(PMAIN_WND_INFO Info, - TCHAR Text[500], + LPWSTR Text, INT row, INT col) { @@ -26,22 +26,21 @@ GetTextFromListView(PMAIN_WND_INFO Info, 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, @@ -51,9 +50,9 @@ SaveServicesToFile(PMAIN_WND_INFO Info, if(hFile != INVALID_HANDLE_VALUE) { - TCHAR LVText[500]; - TCHAR newl[2] = {_T('\r'), _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; @@ -72,13 +71,13 @@ SaveServicesToFile(PMAIN_WND_INFO Info, { WriteFile(hFile, LVText, - sizeof(TCHAR) * dwTextLength, + sizeof(WCHAR) * dwTextLength, &dwWritten, NULL); WriteFile(hFile, &tab, - sizeof(TCHAR), + sizeof(WCHAR), &dwWritten, NULL); } @@ -99,17 +98,18 @@ SaveServicesToFile(PMAIN_WND_INFO Info, 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)) @@ -119,5 +119,5 @@ VOID ExportFile(PMAIN_WND_INFO Info) } if (CommDlgExtendedError() != CDERR_GENERALCODES) - MessageBox(NULL, _T("Export to file failed"), NULL, 0); + MessageBoxW(NULL, L"Export to file failed", NULL, 0); } diff --git a/reactos/base/applications/mscutils/servman/listview.c b/reactos/base/applications/mscutils/servman/listview.c index 48f4c130677..25c4e106e38 100644 --- a/reactos/base/applications/mscutils/servman/listview.c +++ b/reactos/base/applications/mscutils/servman/listview.c @@ -123,13 +123,13 @@ ChangeListViewText(PMAIN_WND_INFO Info, case LVDESC: { - LPTSTR lpDescription; + LPWSTR lpDescription; lpDescription = GetServiceDescription(pService->lpServiceName); lvItem.pszText = lpDescription; SendMessage(Info->hListView, - LVM_SETITEMTEXT, + LVM_SETITEMTEXTW, lvItem.iItem, (LPARAM) &lvItem); @@ -141,14 +141,14 @@ ChangeListViewText(PMAIN_WND_INFO Info, case LVSTATUS: { - TCHAR szStatus[64]; + WCHAR szStatus[64]; if (pService->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING) { - LoadString(hInstance, - IDS_SERVICES_STARTED, - szStatus, - sizeof(szStatus) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_SERVICES_STARTED, + szStatus, + sizeof(szStatus) / sizeof(WCHAR)); } else { @@ -156,17 +156,17 @@ ChangeListViewText(PMAIN_WND_INFO Info, } lvItem.pszText = szStatus; - SendMessage(Info->hListView, - LVM_SETITEMTEXT, - lvItem.iItem, - (LPARAM) &lvItem); + SendMessageW(Info->hListView, + LVM_SETITEMTEXT, + lvItem.iItem, + (LPARAM) &lvItem); } break; case LVSTARTUP: { - LPQUERY_SERVICE_CONFIG lpServiceConfig; - LPTSTR lpStartup = NULL; + LPQUERY_SERVICE_CONFIGW lpServiceConfig; + LPWSTR lpStartup = NULL; DWORD StringId = 0; lpServiceConfig = GetServiceConfig(pService->lpServiceName); @@ -187,10 +187,10 @@ ChangeListViewText(PMAIN_WND_INFO Info, StringId); lvItem.pszText = lpStartup; - SendMessage(Info->hListView, - LVM_SETITEMTEXT, - lvItem.iItem, - (LPARAM)&lvItem); + SendMessageW(Info->hListView, + LVM_SETITEMTEXTW, + lvItem.iItem, + (LPARAM)&lvItem); LocalFree(lpStartup); HeapFree(ProcessHeap, @@ -207,10 +207,10 @@ ChangeListViewText(PMAIN_WND_INFO Info, if (lpServiceConfig) { lvItem.pszText = lpServiceConfig->lpServiceStartName; - SendMessage(Info->hListView, - LVM_SETITEMTEXT, - lvItem.iItem, - (LPARAM)&lvItem); + SendMessageW(Info->hListView, + LVM_SETITEMTEXT, + lvItem.iItem, + (LPARAM)&lvItem); HeapFree(ProcessHeap, 0, @@ -226,7 +226,7 @@ BOOL RefreshServiceList(PMAIN_WND_INFO Info) { ENUM_SERVICE_STATUS_PROCESS *pService; - LVITEM lvItem; + LVITEMW lvItem; DWORD NumServices; DWORD Index; @@ -246,7 +246,7 @@ RefreshServiceList(PMAIN_WND_INFO Info) pService = &Info->pAllServices[Index]; /* set the display name */ - ZeroMemory(&lvItem, sizeof(LVITEM)); + ZeroMemory(&lvItem, sizeof(LVITEMW)); lvItem.mask = LVIF_TEXT | LVIF_PARAM; lvItem.pszText = pService->lpDisplayName; @@ -267,7 +267,7 @@ RefreshServiceList(PMAIN_WND_INFO Info) } /* turn redraw flag on. */ - SendMessage (Info->hListView, + SendMessageW(Info->hListView, WM_SETREDRAW, TRUE, 0); @@ -288,12 +288,12 @@ InitListViewImage(PMAIN_WND_INFO Info) 1); if (hSmall) { - hSmIconItem = LoadImage(hInstance, - MAKEINTRESOURCE(IDI_SM_ICON), - IMAGE_ICON, - 16, - 16, - 0); + hSmIconItem = LoadImageW(hInstance, + MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, + 16, + 16, + 0); if (hSmIconItem) { ImageList_AddIcon(hSmall, @@ -313,12 +313,12 @@ InitListViewImage(PMAIN_WND_INFO Info) 1); if (hLarge) { - hLgIconItem = LoadImage(hInstance, - MAKEINTRESOURCE(IDI_SM_ICON), - IMAGE_ICON, - 32, - 32, - 0); + hLgIconItem = LoadImageW(hInstance, + MAKEINTRESOURCE(IDI_SM_ICON), + IMAGE_ICON, + 32, + 32, + 0); if (hLgIconItem) { ImageList_AddIcon(hLarge, @@ -334,25 +334,25 @@ InitListViewImage(PMAIN_WND_INFO Info) BOOL CreateListView(PMAIN_WND_INFO Info) { - LVCOLUMN lvc = { 0 }; - TCHAR szTemp[256]; + LVCOLUMNW lvc = { 0 }; + WCHAR szTemp[256]; - Info->hListView = CreateWindowEx(WS_EX_CLIENTEDGE, - WC_LISTVIEW, - NULL, - WS_CHILD | WS_VISIBLE | LVS_REPORT | WS_BORDER | - LBS_NOTIFY | LVS_SORTASCENDING | LBS_NOREDRAW, - 0, 0, 0, 0, - Info->hMainWnd, - (HMENU) IDC_SERVLIST, - hInstance, - NULL); + Info->hListView = CreateWindowExW(WS_EX_CLIENTEDGE, + WC_LISTVIEWW, + NULL, + WS_CHILD | WS_VISIBLE | LVS_REPORT | WS_BORDER | + LBS_NOTIFY | LVS_SORTASCENDING | LBS_NOREDRAW, + 0, 0, 0, 0, + Info->hMainWnd, + (HMENU) IDC_SERVLIST, + hInstance, + NULL); if (Info->hListView == NULL) { - MessageBox(Info->hMainWnd, - _T("Could not create List View."), - _T("Error"), - MB_OK | MB_ICONERROR); + MessageBoxW(Info->hMainWnd, + L"Could not create List View.", + L"Error", + MB_OK | MB_ICONERROR); return FALSE; } @@ -366,10 +366,10 @@ CreateListView(PMAIN_WND_INFO Info) /* name */ lvc.iSubItem = LVNAME; lvc.cx = 150; - LoadString(hInstance, - IDS_FIRSTCOLUMN, - szTemp, - sizeof(szTemp) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_FIRSTCOLUMN, + szTemp, + sizeof(szTemp) / sizeof(WCHAR)); lvc.pszText = szTemp; (void)ListView_InsertColumn(Info->hListView, 0, @@ -378,10 +378,10 @@ CreateListView(PMAIN_WND_INFO Info) /* description */ lvc.iSubItem = LVDESC; lvc.cx = 240; - LoadString(hInstance, - IDS_SECONDCOLUMN, - szTemp, - sizeof(szTemp) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_SECONDCOLUMN, + szTemp, + sizeof(szTemp) / sizeof(WCHAR)); lvc.pszText = szTemp; (void)ListView_InsertColumn(Info->hListView, 1, @@ -390,10 +390,10 @@ CreateListView(PMAIN_WND_INFO Info) /* status */ lvc.iSubItem = LVSTATUS; lvc.cx = 55; - LoadString(hInstance, - IDS_THIRDCOLUMN, - szTemp, - sizeof(szTemp) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_THIRDCOLUMN, + szTemp, + sizeof(szTemp) / sizeof(WCHAR)); lvc.pszText = szTemp; (void)ListView_InsertColumn(Info->hListView, 2, @@ -402,10 +402,10 @@ CreateListView(PMAIN_WND_INFO Info) /* startup type */ lvc.iSubItem = LVSTARTUP; lvc.cx = 80; - LoadString(hInstance, - IDS_FOURTHCOLUMN, - szTemp, - sizeof(szTemp) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_FOURTHCOLUMN, + szTemp, + sizeof(szTemp) / sizeof(WCHAR)); lvc.pszText = szTemp; (void)ListView_InsertColumn(Info->hListView, 3, @@ -414,10 +414,10 @@ CreateListView(PMAIN_WND_INFO Info) /* logon as */ lvc.iSubItem = LVLOGONAS; lvc.cx = 100; - LoadString(hInstance, - IDS_FITHCOLUMN, - szTemp, - sizeof(szTemp) / sizeof(TCHAR)); + LoadStringW(hInstance, + IDS_FITHCOLUMN, + szTemp, + sizeof(szTemp) / sizeof(WCHAR)); lvc.pszText = szTemp; (void)ListView_InsertColumn(Info->hListView, 4, diff --git a/reactos/base/applications/mscutils/servman/misc.c b/reactos/base/applications/mscutils/servman/misc.c index 3735eb76c9b..a50fe954a16 100644 --- a/reactos/base/applications/mscutils/servman/misc.c +++ b/reactos/base/applications/mscutils/servman/misc.c @@ -47,7 +47,7 @@ LengthOfStrResource(IN HINSTANCE hInst, } INT -AllocAndLoadString(OUT LPTSTR *lpTarget, +AllocAndLoadString(OUT LPWSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID) { @@ -57,12 +57,12 @@ AllocAndLoadString(OUT LPTSTR *lpTarget, uID); if (ln++ > 0) { - (*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED, - ln * sizeof(TCHAR)); + (*lpTarget) = (LPWSTR)LocalAlloc(LMEM_FIXED, + ln * sizeof(WCHAR)); if ((*lpTarget) != NULL) { INT Ret; - if (!(Ret = LoadString(hInst, uID, *lpTarget, ln))) + if (!(Ret = LoadStringW(hInst, uID, *lpTarget, ln))) { LocalFree((HLOCAL)(*lpTarget)); } @@ -75,11 +75,11 @@ AllocAndLoadString(OUT LPTSTR *lpTarget, DWORD LoadAndFormatString(IN HINSTANCE hInstance, IN UINT uID, - OUT LPTSTR *lpTarget, + OUT LPWSTR *lpTarget, ...) { DWORD Ret = 0; - LPTSTR lpFormat; + LPWSTR lpFormat; va_list lArgs; if (AllocAndLoadString(&lpFormat, @@ -89,13 +89,13 @@ LoadAndFormatString(IN HINSTANCE hInstance, va_start(lArgs, lpTarget); /* let's use Format to format it because it has the ability to allocate memory automatically */ - Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - lpFormat, - 0, - 0, - (LPTSTR)lpTarget, - 0, - &lArgs); + Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (LPWSTR)lpTarget, + 0, + &lArgs); va_end(lArgs); LocalFree((HLOCAL)lpFormat); @@ -112,7 +112,7 @@ StatusBarLoadAndFormatString(IN HWND hStatusBar, ...) { BOOL Ret = FALSE; - LPTSTR lpFormat, lpStr; + LPWSTR lpFormat, lpStr; va_list lArgs; if (AllocAndLoadString(&lpFormat, @@ -122,21 +122,21 @@ StatusBarLoadAndFormatString(IN HWND hStatusBar, va_start(lArgs, uID); /* let's use FormatMessage to format it because it has the ability to allocate memory automatically */ - Ret = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, - lpFormat, - 0, - 0, - (VOID*)&lpStr, - 0, - &lArgs); + Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING, + lpFormat, + 0, + 0, + (VOID*)&lpStr, + 0, + &lArgs); va_end(lArgs); if (lpStr != NULL) { - Ret = (BOOL)SendMessage(hStatusBar, - SB_SETTEXT, - (WPARAM)PartId, - (LPARAM)lpStr); + Ret = (BOOL)SendMessageW(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); LocalFree((HLOCAL)lpStr); } @@ -153,16 +153,16 @@ StatusBarLoadString(IN HWND hStatusBar, IN UINT uID) { BOOL Ret = FALSE; - LPTSTR lpStr; + LPWSTR lpStr; if (AllocAndLoadString(&lpStr, hInstance, uID) > 0) { - Ret = (BOOL)SendMessage(hStatusBar, - SB_SETTEXT, - (WPARAM)PartId, - (LPARAM)lpStr); + Ret = (BOOL)SendMessageW(hStatusBar, + SB_SETTEXT, + (WPARAM)PartId, + (LPARAM)lpStr); LocalFree((HLOCAL)lpStr); } @@ -171,17 +171,17 @@ StatusBarLoadString(IN HWND hStatusBar, INT -GetTextFromEdit(OUT LPTSTR lpString, +GetTextFromEdit(OUT LPWSTR lpString, IN HWND hDlg, IN UINT Res) { - INT len = GetWindowTextLength(GetDlgItem(hDlg, Res)); + INT len = GetWindowTextLengthW(GetDlgItem(hDlg, Res)); if(len > 0) { - GetDlgItemText(hDlg, - Res, - lpString, - len + 1); + GetDlgItemTextW(hDlg, + Res, + lpString, + len + 1); } else lpString = NULL; @@ -191,26 +191,26 @@ GetTextFromEdit(OUT LPTSTR lpString, VOID GetError(VOID) { - LPTSTR lpMsgBuf = NULL; + LPWSTR lpMsgBuf = NULL; - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (VOID*)&lpMsgBuf, - 0, - NULL ); + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + GetLastError(), + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (VOID*)&lpMsgBuf, + 0, + NULL ); - MessageBox(NULL, lpMsgBuf, _T("Error!"), MB_OK | MB_ICONERROR); + MessageBoxW(NULL, lpMsgBuf, L"Error!", MB_OK | MB_ICONERROR); LocalFree(lpMsgBuf); } -VOID DisplayString(PTCHAR Msg) +VOID DisplayString(LPWSTR Msg) { - MessageBox(NULL, Msg, _T("Note!"), MB_ICONEXCLAMATION|MB_OK); + MessageBoxW(NULL, Msg, L"Note!", MB_ICONEXCLAMATION|MB_OK); } @@ -239,12 +239,12 @@ InitImageList(UINT StartResource, ret = 0; for (i = StartResource; i <= EndResource && ret != -1; i++) { - hImage = LoadImage(hInstance, - MAKEINTRESOURCE(i), - type, - Width, - Height, - LR_LOADTRANSPARENT); + hImage = LoadImageW(hInstance, + MAKEINTRESOURCEW(i), + type, + Width, + Height, + LR_LOADTRANSPARENT); if (hImage == NULL) { ImageList_Destroy(himl); diff --git a/reactos/base/applications/mscutils/servman/propsheet_depends.c b/reactos/base/applications/mscutils/servman/propsheet_depends.c index 52afc515330..b32111700e4 100644 --- a/reactos/base/applications/mscutils/servman/propsheet_depends.c +++ b/reactos/base/applications/mscutils/servman/propsheet_depends.c @@ -12,14 +12,14 @@ HTREEITEM AddItemToTreeView(HWND hTreeView, HTREEITEM hParent, - LPTSTR lpDisplayName, - LPTSTR lpServiceName, + LPWSTR lpDisplayName, + LPWSTR lpServiceName, ULONG ServiceType, BOOL bHasChildren) { TV_ITEM tvi; TV_INSERTSTRUCT tvins; - LPTSTR lpName; + LPWSTR lpName; DWORD dwSize; ZeroMemory(&tvi, sizeof(tvi)); @@ -27,7 +27,7 @@ AddItemToTreeView(HWND hTreeView, tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_SELECTEDIMAGE | TVIF_IMAGE | TVIF_CHILDREN; tvi.pszText = lpDisplayName; - tvi.cchTextMax = _tcslen(lpDisplayName); + tvi.cchTextMax = wcslen(lpDisplayName); tvi.cChildren = bHasChildren; /* Select the image for this service */ @@ -53,14 +53,14 @@ AddItemToTreeView(HWND hTreeView, if (lpServiceName) { - dwSize = _tcslen(lpServiceName) + 1; + dwSize = wcslen(lpServiceName) + 1; /* Attach the service name */ - lpName = (LPTSTR)HeapAlloc(GetProcessHeap(), + lpName = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, - dwSize * sizeof(TCHAR)); + dwSize * sizeof(WCHAR)); if (lpName) { - StringCchCopy(lpName, dwSize, lpServiceName); + StringCchCopyW(lpName, dwSize, lpServiceName); tvi.lParam = (LPARAM)lpName; } } @@ -76,7 +76,7 @@ TreeView_GetItemParam(HWND hTreeView, HTREEITEM hItem) { LPARAM lParam = 0; - TVITEM tv = {0}; + TVITEMW tv = {0}; tv.mask = TVIF_PARAM | TVIF_HANDLE; tv.hItem = hItem; @@ -94,7 +94,7 @@ DestroyItem(HWND hTreeView, HTREEITEM hItem) { HTREEITEM hChildItem; - LPTSTR lpServiceName; + LPWSTR lpServiceName; /* Does this item have any children */ hChildItem = TreeView_GetChild(hTreeView, hItem); @@ -105,7 +105,7 @@ DestroyItem(HWND hTreeView, } /* Get the string and free it */ - lpServiceName = (LPTSTR)TreeView_GetItemParam(hTreeView, hItem); + lpServiceName = (LPWSTR)TreeView_GetItemParam(hTreeView, hItem); if (lpServiceName) { HeapFree(GetProcessHeap(), @@ -229,7 +229,7 @@ DependenciesPageProc(HWND hwndDlg, if (!TreeView_GetChild(pDlgInfo->hDependsTreeView1, lpnmtv->itemNew.hItem)) { /* It's not, add the children */ - TV1_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPTSTR)lpnmtv->itemNew.lParam); + TV1_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam); } } else if (lpnmtv->hdr.idFrom == IDC_DEPEND_TREE2) @@ -238,7 +238,7 @@ DependenciesPageProc(HWND hwndDlg, if (!TreeView_GetChild(pDlgInfo->hDependsTreeView2, lpnmtv->itemNew.hItem)) { /* It's not, add the children */ - TV2_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPTSTR)lpnmtv->itemNew.lParam); + TV2_AddDependantsToTree(pDlgInfo, lpnmtv->itemNew.hItem, (LPWSTR)lpnmtv->itemNew.lParam); } } } diff --git a/reactos/base/applications/mscutils/servman/propsheet_general.c b/reactos/base/applications/mscutils/servman/propsheet_general.c index 6bac4cdfb12..fe8029a48ea 100644 --- a/reactos/base/applications/mscutils/servman/propsheet_general.c +++ b/reactos/base/applications/mscutils/servman/propsheet_general.c @@ -59,7 +59,7 @@ static VOID SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg) { - LPTSTR lpStatus; + LPWSTR lpStatus; UINT id; if (dlgInfo->pService->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING) @@ -75,11 +75,11 @@ SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, hInstance, id)) { - SendDlgItemMessage(hwndDlg, - IDC_SERV_STATUS, - WM_SETTEXT, - 0, - (LPARAM)lpStatus); + SendDlgItemMessageW(hwndDlg, + IDC_SERV_STATUS, + WM_SETTEXT, + 0, + (LPARAM)lpStatus); LocalFree(lpStatus); } } @@ -89,12 +89,12 @@ SetServiceStatusText(PSERVICEPROPSHEET dlgInfo, * values and sets it to value of the selected item */ static VOID -SetStartupType(LPTSTR lpServiceName, +SetStartupType(LPWSTR lpServiceName, HWND hwndDlg) { HWND hList; LPQUERY_SERVICE_CONFIG pServiceConfig; - LPTSTR lpBuf; + LPWSTR lpBuf; DWORD StartUp = 0; UINT i; @@ -106,10 +106,10 @@ SetStartupType(LPTSTR lpServiceName, hInstance, i)) { - SendMessage(hList, - CB_ADDSTRING, - 0, - (LPARAM)lpBuf); + SendMessageW(hList, + CB_ADDSTRING, + 0, + (LPARAM)lpBuf); LocalFree(lpBuf); } } @@ -125,10 +125,10 @@ SetStartupType(LPTSTR lpServiceName, case SERVICE_DISABLED: StartUp = 2; break; } - SendMessage(hList, - CB_SETCURSEL, - StartUp, - 0); + SendMessageW(hList, + CB_SETCURSEL, + StartUp, + 0); HeapFree(ProcessHeap, 0, @@ -145,30 +145,30 @@ InitGeneralPage(PSERVICEPROPSHEET dlgInfo, HWND hwndDlg) { LPQUERY_SERVICE_CONFIG pServiceConfig; - LPTSTR lpDescription; + LPWSTR lpDescription; /* set the service name */ - SendDlgItemMessage(hwndDlg, - IDC_SERV_NAME, - WM_SETTEXT, - 0, - (LPARAM)dlgInfo->pService->lpServiceName); + SendDlgItemMessageW(hwndDlg, + IDC_SERV_NAME, + WM_SETTEXT, + 0, + (LPARAM)dlgInfo->pService->lpServiceName); /* set the display name */ - SendDlgItemMessage(hwndDlg, - IDC_DISP_NAME, - WM_SETTEXT, - 0, - (LPARAM)dlgInfo->pService->lpDisplayName); + SendDlgItemMessageW(hwndDlg, + IDC_DISP_NAME, + WM_SETTEXT, + 0, + (LPARAM)dlgInfo->pService->lpDisplayName); /* set the description */ if ((lpDescription = GetServiceDescription(dlgInfo->pService->lpServiceName))) { - SendDlgItemMessage(hwndDlg, - IDC_DESCRIPTION, - WM_SETTEXT, - 0, - (LPARAM)lpDescription); + SendDlgItemMessageW(hwndDlg, + IDC_DESCRIPTION, + WM_SETTEXT, + 0, + (LPARAM)lpDescription); HeapFree(ProcessHeap, 0, @@ -178,11 +178,11 @@ InitGeneralPage(PSERVICEPROPSHEET dlgInfo, pServiceConfig = GetServiceConfig(dlgInfo->pService->lpServiceName); if (pServiceConfig) { - SendDlgItemMessage(hwndDlg, - IDC_EXEPATH, - WM_SETTEXT, - 0, - (LPARAM)pServiceConfig->lpBinaryPathName); + SendDlgItemMessageW(hwndDlg, + IDC_EXEPATH, + WM_SETTEXT, + 0, + (LPARAM)pServiceConfig->lpBinaryPathName); HeapFree(ProcessHeap, 0, pServiceConfig); @@ -258,7 +258,7 @@ OnStart(HWND hwndDlg, if (GetDlgItemText(hwndDlg, IDC_START_PARAM, szStartParams, 256) > 0) lpStartParams = szStartParams; - if (DoStart(dlgInfo->Info, lpStartParams)) + //if (DoStart(dlgInfo->Info, lpStartParams)) { UpdateServiceStatus(dlgInfo->pService); ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); @@ -312,37 +312,51 @@ GeneralPageProc(HWND hwndDlg, break; case IDC_START: - OnStart(hwndDlg, dlgInfo); + RunActionWithProgress(hwndDlg, + dlgInfo->pService->lpServiceName, + dlgInfo->pService->lpDisplayName, + ACTION_START); + + UpdateServiceStatus(dlgInfo->pService); + ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); + SetButtonStates(dlgInfo, hwndDlg); + SetServiceStatusText(dlgInfo, hwndDlg); break; case IDC_STOP: - if (DoStop(dlgInfo->Info)) - { - UpdateServiceStatus(dlgInfo->pService); - ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); - SetButtonStates(dlgInfo, hwndDlg); - SetServiceStatusText(dlgInfo, hwndDlg); - } + RunActionWithProgress(hwndDlg, + dlgInfo->pService->lpServiceName, + dlgInfo->pService->lpDisplayName, + ACTION_STOP); + + UpdateServiceStatus(dlgInfo->pService); + ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); + SetButtonStates(dlgInfo, hwndDlg); + SetServiceStatusText(dlgInfo, hwndDlg); break; case IDC_PAUSE: - if (DoPause(dlgInfo->Info)) - { - UpdateServiceStatus(dlgInfo->pService); - ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); - SetButtonStates(dlgInfo, hwndDlg); - SetServiceStatusText(dlgInfo, hwndDlg); - } + RunActionWithProgress(hwndDlg, + dlgInfo->pService->lpServiceName, + dlgInfo->pService->lpDisplayName, + ACTION_PAUSE); + + UpdateServiceStatus(dlgInfo->pService); + ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); + SetButtonStates(dlgInfo, hwndDlg); + SetServiceStatusText(dlgInfo, hwndDlg); break; case IDC_RESUME: - if (DoResume(dlgInfo->Info)) - { - UpdateServiceStatus(dlgInfo->pService); - ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); - SetButtonStates(dlgInfo, hwndDlg); - SetServiceStatusText(dlgInfo, hwndDlg); - } + RunActionWithProgress(hwndDlg, + dlgInfo->pService->lpServiceName, + dlgInfo->pService->lpDisplayName, + ACTION_RESUME); + + UpdateServiceStatus(dlgInfo->pService); + ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); + SetButtonStates(dlgInfo, hwndDlg); + SetServiceStatusText(dlgInfo, hwndDlg); break; case IDC_EDIT: diff --git a/reactos/base/applications/mscutils/servman/query.c b/reactos/base/applications/mscutils/servman/query.c index 3a5e82ce612..149150f52aa 100644 --- a/reactos/base/applications/mscutils/servman/query.c +++ b/reactos/base/applications/mscutils/servman/query.c @@ -26,27 +26,27 @@ GetSelectedService(PMAIN_WND_INFO Info) } LPQUERY_SERVICE_CONFIG -GetServiceConfig(LPTSTR lpServiceName) +GetServiceConfig(LPWSTR lpServiceName) { - LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL; + LPQUERY_SERVICE_CONFIGW lpServiceConfig = NULL; SC_HANDLE hSCManager; SC_HANDLE hService; DWORD dwBytesNeeded; - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_ALL_ACCESS); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_ALL_ACCESS); if (hSCManager) { - hService = OpenService(hSCManager, - lpServiceName, - SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_QUERY_CONFIG); + hService = OpenServiceW(hSCManager, + lpServiceName, + SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_QUERY_CONFIG); if (hService) { - if (!QueryServiceConfig(hService, - NULL, - 0, - &dwBytesNeeded)) + if (!QueryServiceConfigW(hService, + NULL, + 0, + &dwBytesNeeded)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { @@ -55,7 +55,7 @@ GetServiceConfig(LPTSTR lpServiceName) dwBytesNeeded); if (lpServiceConfig) { - if (!QueryServiceConfig(hService, + if (!QueryServiceConfigW(hService, lpServiceConfig, dwBytesNeeded, &dwBytesNeeded)) @@ -80,38 +80,38 @@ GetServiceConfig(LPTSTR lpServiceName) BOOL SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, - LPTSTR lpServiceName, - LPTSTR lpPassword) + LPWSTR lpServiceName, + LPWSTR lpPassword) { SC_HANDLE hSCManager; SC_HANDLE hSc; SC_LOCK scLock; BOOL bRet = FALSE; - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_LOCK); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_LOCK); if (hSCManager) { scLock = LockServiceDatabase(hSCManager); if (scLock) { - hSc = OpenService(hSCManager, - lpServiceName, - SERVICE_CHANGE_CONFIG); + hSc = OpenServiceW(hSCManager, + lpServiceName, + SERVICE_CHANGE_CONFIG); if (hSc) { - if (ChangeServiceConfig(hSc, - pServiceConfig->dwServiceType, - pServiceConfig->dwStartType, - pServiceConfig->dwErrorControl, - pServiceConfig->lpBinaryPathName, - pServiceConfig->lpLoadOrderGroup, - pServiceConfig->dwTagId ? &pServiceConfig->dwTagId : NULL, - pServiceConfig->lpDependencies, - pServiceConfig->lpServiceStartName, - lpPassword, - pServiceConfig->lpDisplayName)) + if (ChangeServiceConfigW(hSc, + pServiceConfig->dwServiceType, + pServiceConfig->dwStartType, + pServiceConfig->dwErrorControl, + pServiceConfig->lpBinaryPathName, + pServiceConfig->lpLoadOrderGroup, + pServiceConfig->dwTagId ? &pServiceConfig->dwTagId : NULL, + pServiceConfig->lpDependencies, + pServiceConfig->lpServiceStartName, + lpPassword, + pServiceConfig->lpDisplayName)) { bRet = TRUE; } @@ -131,35 +131,35 @@ SetServiceConfig(LPQUERY_SERVICE_CONFIG pServiceConfig, return bRet; } -LPTSTR -GetServiceDescription(LPTSTR lpServiceName) +LPWSTR +GetServiceDescription(LPWSTR lpServiceName) { SC_HANDLE hSCManager = NULL; SC_HANDLE hSc = NULL; - SERVICE_DESCRIPTION *pServiceDescription = NULL; - LPTSTR lpDescription = NULL; + SERVICE_DESCRIPTIONW *pServiceDescription = NULL; + LPWSTR lpDescription = NULL; DWORD BytesNeeded = 0; DWORD dwSize; - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_ENUMERATE_SERVICE); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_ENUMERATE_SERVICE); if (hSCManager == NULL) { GetError(); return NULL; } - hSc = OpenService(hSCManager, - lpServiceName, - SERVICE_QUERY_CONFIG); + hSc = OpenServiceW(hSCManager, + lpServiceName, + SERVICE_QUERY_CONFIG); if (hSc) { - if (!QueryServiceConfig2(hSc, - SERVICE_CONFIG_DESCRIPTION, - NULL, - 0, - &BytesNeeded)) + if (!QueryServiceConfig2W(hSc, + SERVICE_CONFIG_DESCRIPTION, + NULL, + 0, + &BytesNeeded)) { if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) { @@ -169,23 +169,23 @@ GetServiceDescription(LPTSTR lpServiceName) if (pServiceDescription == NULL) goto cleanup; - if (QueryServiceConfig2(hSc, - SERVICE_CONFIG_DESCRIPTION, - (LPBYTE)pServiceDescription, - BytesNeeded, - &BytesNeeded)) + if (QueryServiceConfig2W(hSc, + SERVICE_CONFIG_DESCRIPTION, + (LPBYTE)pServiceDescription, + BytesNeeded, + &BytesNeeded)) { if (pServiceDescription->lpDescription) { - dwSize = _tcslen(pServiceDescription->lpDescription) + 1; + dwSize = wcslen(pServiceDescription->lpDescription) + 1; lpDescription = HeapAlloc(ProcessHeap, 0, - dwSize * sizeof(TCHAR)); + dwSize * sizeof(WCHAR)); if (lpDescription) { - StringCchCopy(lpDescription, - dwSize, - pServiceDescription->lpDescription); + StringCchCopyW(lpDescription, + dwSize, + pServiceDescription->lpDescription); } } } @@ -207,8 +207,8 @@ cleanup: } BOOL -SetServiceDescription(LPTSTR lpServiceName, - LPTSTR lpDescription) +SetServiceDescription(LPWSTR lpServiceName, + LPWSTR lpDescription) { SC_HANDLE hSCManager; SC_HANDLE hSc; @@ -216,24 +216,24 @@ SetServiceDescription(LPTSTR lpServiceName, SERVICE_DESCRIPTION ServiceDescription; BOOL bRet = FALSE; - hSCManager = OpenSCManager(NULL, - NULL, - SC_MANAGER_LOCK); + hSCManager = OpenSCManagerW(NULL, + NULL, + SC_MANAGER_LOCK); if (hSCManager) { scLock = LockServiceDatabase(hSCManager); if (scLock) { - hSc = OpenService(hSCManager, - lpServiceName, - SERVICE_CHANGE_CONFIG); + hSc = OpenServiceW(hSCManager, + lpServiceName, + SERVICE_CHANGE_CONFIG); if (hSc) { ServiceDescription.lpDescription = lpDescription; - if (ChangeServiceConfig2(hSc, - SERVICE_CONFIG_DESCRIPTION, - &ServiceDescription)) + if (ChangeServiceConfig2W(hSc, + SERVICE_CONFIG_DESCRIPTION, + &ServiceDescription)) { bRet = TRUE; } diff --git a/reactos/base/applications/mscutils/servman/servman.c b/reactos/base/applications/mscutils/servman/servman.c index 7db77487219..5be470f8a00 100644 --- a/reactos/base/applications/mscutils/servman/servman.c +++ b/reactos/base/applications/mscutils/servman/servman.c @@ -13,29 +13,30 @@ HINSTANCE hInstance; HANDLE ProcessHeap; +HWND g_hProgDlg; int WINAPI -_tWinMain(HINSTANCE hThisInstance, +wWinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, - LPTSTR lpCmdLine, + LPWSTR lpCmdLine, int nCmdShow) { - LPTSTR lpAppName; + LPWSTR lpAppName; HWND hMainWnd; MSG Msg; int Ret = 1; INITCOMMONCONTROLSEX icex; switch (GetUserDefaultUILanguage()) - { - case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): - SetProcessDefaultLayout(LAYOUT_RTL); - break; + { + case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): + SetProcessDefaultLayout(LAYOUT_RTL); + break; + + default: + break; + } - default: - break; - } - hInstance = hThisInstance; ProcessHeap = GetProcessHeap(); @@ -57,13 +58,14 @@ _tWinMain(HINSTANCE hThisInstance, if (hMainWnd != NULL) { /* pump the message queue */ - while( GetMessage( &Msg, NULL, 0, 0 ) ) + while (GetMessageW( &Msg, NULL, 0, 0 ) ) { //if ( !hProgDlg || !IsWindow(hProgDlg) || !IsDialogMessage(hProgDlg, &Msg) ) - //{ + //if (!IsDialogMessage(g_hProgDlg, &Msg)) + { TranslateMessage(&Msg); - DispatchMessage(&Msg); - //} + DispatchMessageW(&Msg); + } } Ret = 0;