https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e4f70e5434af2b6dfaac02f39f2afad2bb5a997a

commit e4f70e5434af2b6dfaac02f39f2afad2bb5a997a
Author:     Bișoc George <[email protected]>
AuthorDate: Sun Apr 26 14:14:17 2020 +0200
Commit:     GitHub <[email protected]>
CommitDate: Sun Apr 26 14:14:17 2020 +0200

    [UTILMAN] Properly annotate some variables (#2561)
    
    Previously the code had a mixture of 'sz', 'wsz', 'lp' and 'lpwsz' 
Hungarian annotation prefixes which could bring confusions about the nature of 
the annotated variables. From now on all of these variables have a well defined 
annotation. Furthermore, add a missing argument annotation to LaunchProcess().
---
 base/applications/utilman/umandlg/about.c    |  6 +++---
 base/applications/utilman/umandlg/process.c  | 22 +++++++++----------
 base/applications/utilman/umandlg/registry.c | 32 ++++++++++++++--------------
 base/applications/utilman/umandlg/umandlg.c  | 14 ++++++------
 base/applications/utilman/umandlg/umandlg.h  | 32 ++++++++++++++--------------
 base/applications/utilman/utilman.c          | 14 ++++++------
 6 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/base/applications/utilman/umandlg/about.c 
b/base/applications/utilman/umandlg/about.c
index 84615679c09..ea66987296a 100644
--- a/base/applications/utilman/umandlg/about.c
+++ b/base/applications/utilman/umandlg/about.c
@@ -43,11 +43,11 @@ INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT Msg, WPARAM 
wParam, LPARAM lParam)
     {
         case WM_INITDIALOG:
         {
-            WCHAR wszAppPath[MAX_BUFFER];
+            WCHAR szAppPath[MAX_BUFFER];
 
             /* Extract the icon resource from the executable process */
-            GetModuleFileNameW(NULL, wszAppPath, _countof(wszAppPath));
-            Globals.hIcon = ExtractIconW(Globals.hInstance, wszAppPath, 0);
+            GetModuleFileNameW(NULL, szAppPath, _countof(szAppPath));
+            Globals.hIcon = ExtractIconW(Globals.hInstance, szAppPath, 0);
 
             /* Set the icon within the dialog's title bar */
             if (Globals.hIcon)
diff --git a/base/applications/utilman/umandlg/process.c 
b/base/applications/utilman/umandlg/process.c
index c5444ff2883..ab3403ffa39 100644
--- a/base/applications/utilman/umandlg/process.c
+++ b/base/applications/utilman/umandlg/process.c
@@ -16,14 +16,14 @@
  *
  * Returns the process executable ID based on the given executable name.
  *
- * @param[in]   lpProcessName
+ * @param[in]   lpszProcessName
  *     The name of the executable process.
  *
  * @return
  *      Returns the ID number of the process, otherwise 0.
  *
  */
-DWORD GetProcessID(IN LPCWSTR lpProcessName)
+DWORD GetProcessID(IN LPCWSTR lpszProcessName)
 {
     PROCESSENTRY32W Process;
 
@@ -41,7 +41,7 @@ DWORD GetProcessID(IN LPCWSTR lpProcessName)
     {
         do
         {
-            if (_wcsicmp(Process.szExeFile, lpProcessName) == 0)
+            if (_wcsicmp(Process.szExeFile, lpszProcessName) == 0)
             {
                 /* The names match, return the process ID we're interested */
                 CloseHandle(hSnapshot);
@@ -60,7 +60,7 @@ DWORD GetProcessID(IN LPCWSTR lpProcessName)
  *
  * Checks if a process is running.
  *
- * @param[in]   lpProcessName
+ * @param[in]   lpszProcessName
  *     The name of the executable process.
  *
  * @return
@@ -68,13 +68,13 @@ DWORD GetProcessID(IN LPCWSTR lpProcessName)
  *     FALSE otherwise.
  *
  */
-BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
+BOOL IsProcessRunning(IN LPCWSTR lpszProcessName)
 {
     DWORD dwReturn, dwProcessID;
     HANDLE hProcess;
 
     /* Get the process ID */
-    dwProcessID = GetProcessID(lpProcessName);
+    dwProcessID = GetProcessID(lpszProcessName);
     if (dwProcessID == 0)
     {
         return FALSE;
@@ -114,7 +114,7 @@ BOOL IsProcessRunning(IN LPCWSTR lpProcessName)
  *     FALSE otherwise.
  *
  */
-BOOL LaunchProcess(LPCWSTR lpProcessName)
+BOOL LaunchProcess(IN LPCWSTR lpszProcessName)
 {
     STARTUPINFOW si;
     PROCESS_INFORMATION pi;
@@ -123,7 +123,7 @@ BOOL LaunchProcess(LPCWSTR lpProcessName)
     WCHAR ExpandedCmdLine[MAX_PATH];
 
     /* Expand the process path string */
-    ExpandEnvironmentStringsW(lpProcessName, ExpandedCmdLine, 
ARRAYSIZE(ExpandedCmdLine));
+    ExpandEnvironmentStringsW(lpszProcessName, ExpandedCmdLine, 
ARRAYSIZE(ExpandedCmdLine));
 
     ZeroMemory(&pi, sizeof(pi));
     ZeroMemory(&si, sizeof(si));
@@ -181,7 +181,7 @@ BOOL LaunchProcess(LPCWSTR lpProcessName)
  *
  * Closes a process.
  *
- * @param[in]   lpProcessName
+ * @param[in]   lpszProcessName
  *     The name of the executable process.
  *
  * @return
@@ -189,13 +189,13 @@ BOOL LaunchProcess(LPCWSTR lpProcessName)
  *     FALSE otherwise.
  *
  */
-BOOL CloseProcess(IN LPCWSTR lpProcessName)
+BOOL CloseProcess(IN LPCWSTR lpszProcessName)
 {
     HANDLE hProcess;
     DWORD dwProcessID;
 
     /* Get the process ID */
-    dwProcessID = GetProcessID(lpProcessName);
+    dwProcessID = GetProcessID(lpszProcessName);
     if (dwProcessID == 0)
     {
         return FALSE;
diff --git a/base/applications/utilman/umandlg/registry.c 
b/base/applications/utilman/umandlg/registry.c
index bd96d3592a4..f00d8948221 100644
--- a/base/applications/utilman/umandlg/registry.c
+++ b/base/applications/utilman/umandlg/registry.c
@@ -34,7 +34,7 @@ REGISTRY_SETTINGS Settings;
  * @param[in]   hPredefinedKey
  *     The predefined key (e.g. HKEY_CLASSES_ROOT).
  *
- * @param[in]   lpwszSubKey
+ * @param[in]   lpszSubKey
  *      The path to the sub key to be created.
  *
  * @param[out]   phKey
@@ -49,14 +49,14 @@ REGISTRY_SETTINGS Settings;
  *
  */
 BOOL InitAppRegKey(IN HKEY hPredefinedKey,
-                   IN LPCWSTR lpwszSubKey,
+                   IN LPCWSTR lpszSubKey,
                    OUT PHKEY phKey,
                    OUT LPDWORD lpdwDisposition)
 {
     LONG lResult;
 
     lResult = RegCreateKeyExW(hPredefinedKey,
-                              lpwszSubKey,
+                              lpszSubKey,
                               0,
                               NULL,
                               0,
@@ -66,7 +66,7 @@ BOOL InitAppRegKey(IN HKEY hPredefinedKey,
                               lpdwDisposition);
     if (lResult != ERROR_SUCCESS)
     {
-        DPRINT("InitAppRegKey(): Failed to create the following key (or open 
the key) of path \"%S\". The error code is \"%li\".\n", lpwszSubKey, lResult);
+        DPRINT("InitAppRegKey(): Failed to create the following key (or open 
the key) of path \"%S\". The error code is \"%li\".\n", lpszSubKey, lResult);
         return FALSE;
     }
 
@@ -81,10 +81,10 @@ BOOL InitAppRegKey(IN HKEY hPredefinedKey,
  * @param[in]   hKey
  *     A handle to a key.
  *
- * @param[in]   lpwszSubKey
+ * @param[in]   lpszSubKey
  *      The path to a sub-key.
  *
- * @param[in]   lpwszRegValue
+ * @param[in]   lpszRegValue
  *      The registry value where we need to get the data from.
  *
  * @param[out]   ReturnedData
@@ -101,8 +101,8 @@ BOOL InitAppRegKey(IN HKEY hPredefinedKey,
  *
  */
 BOOL QueryAppSettings(IN HKEY hKey,
-                      IN LPCWSTR lpwszSubKey,
-                      IN LPCWSTR lpwszRegValue,
+                      IN LPCWSTR lpszSubKey,
+                      IN LPCWSTR lpszRegValue,
                       OUT PVOID ReturnedData,
                       IN OUT LPDWORD lpdwSizeData)
 {
@@ -110,25 +110,25 @@ BOOL QueryAppSettings(IN HKEY hKey,
     HKEY hKeyQueryValue;
 
     lResult = RegOpenKeyExW(hKey,
-                            lpwszSubKey,
+                            lpszSubKey,
                             0,
                             KEY_READ,
                             &hKeyQueryValue);
     if (lResult != ERROR_SUCCESS)
     {
-        DPRINT("QueryAppSettings(): Failed to open the key of path \"%S\". The 
error code is \"%li\".\n", lpwszSubKey, lResult);
+        DPRINT("QueryAppSettings(): Failed to open the key of path \"%S\". The 
error code is \"%li\".\n", lpszSubKey, lResult);
         return FALSE;
     }
 
     lResult = RegQueryValueExW(hKeyQueryValue,
-                               lpwszRegValue,
+                               lpszRegValue,
                                NULL,
                                NULL,
                                (LPBYTE)&ReturnedData,
                                lpdwSizeData);
     if (lResult != ERROR_SUCCESS)
     {
-        DPRINT("QueryAppSettings(): Failed to query the data from value 
\"%S\". The error code is \"%li\".\n", lpwszRegValue, lResult);
+        DPRINT("QueryAppSettings(): Failed to query the data from value 
\"%S\". The error code is \"%li\".\n", lpszRegValue, lResult);
         RegCloseKey(hKeyQueryValue);
         return FALSE;
     }
@@ -145,7 +145,7 @@ BOOL QueryAppSettings(IN HKEY hKey,
  * @param[in]   hKey
  *     A handle to a key.
  *
- * @param[in]   lpwszRegValue
+ * @param[in]   lpszRegValue
  *      The path to the sub key where the value needs to be created.
  *
  * @param[out]   dwRegType
@@ -165,7 +165,7 @@ BOOL QueryAppSettings(IN HKEY hKey,
  *
  */
 BOOL SaveAppSettings(IN HKEY hKey,
-                     IN LPCWSTR lpwszRegValue,
+                     IN LPCWSTR lpszRegValue,
                      IN DWORD dwRegType,
                      IN PVOID Data,
                      IN DWORD cbSize)
@@ -185,14 +185,14 @@ BOOL SaveAppSettings(IN HKEY hKey,
     }
 
     lResult = RegSetValueExW(hKeySetValue,
-                             lpwszRegValue,
+                             lpszRegValue,
                              0,
                              dwRegType,
                              (LPBYTE)&Data,
                              cbSize);
     if (lResult != ERROR_SUCCESS)
     {
-        DPRINT("SaveAppSettings(): Failed to set the \"%S\" value with data, 
the error code is \"%li\"!\n", lpwszRegValue, lResult);
+        DPRINT("SaveAppSettings(): Failed to set the \"%S\" value with data, 
the error code is \"%li\"!\n", lpszRegValue, lResult);
         RegCloseKey(hKeySetValue);
         return FALSE;
     }
diff --git a/base/applications/utilman/umandlg/umandlg.c 
b/base/applications/utilman/umandlg/umandlg.c
index 694ae06c030..0902f3b972f 100644
--- a/base/applications/utilman/umandlg/umandlg.c
+++ b/base/applications/utilman/umandlg/umandlg.c
@@ -65,7 +65,7 @@ VOID InitUtilsList(BOOL bInitGui)
         /* Add the utilities in the listbox */
         for (i = 0; i < _countof(EntriesList); ++i)
         {
-            bIsRunning = IsProcessRunning(EntriesList[i].lpProgram);
+            bIsRunning = IsProcessRunning(EntriesList[i].lpszProgram);
             EntriesList[i].bState = bIsRunning;
 
             /* Load the string and append the utility's name to the format */
@@ -99,7 +99,7 @@ BOOL DlgInitHandler(IN HWND hDlg)
     INT PosX, PosY;
     RECT rc;
     WCHAR szAboutDlg[MAX_BUFFER];
-    WCHAR wszAppPath[MAX_BUFFER];
+    WCHAR szAppPath[MAX_BUFFER];
     HMENU hSysMenu;
 
     /* Save the dialog handle */
@@ -112,8 +112,8 @@ BOOL DlgInitHandler(IN HWND hDlg)
     SetWindowPos(hDlg, 0, PosX, PosY, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
 
     /* Extract the icon resource from the executable process */
-    GetModuleFileNameW(NULL, wszAppPath, _countof(wszAppPath));
-    Globals.hIcon = ExtractIconW(Globals.hInstance, wszAppPath, 0);
+    GetModuleFileNameW(NULL, szAppPath, _countof(szAppPath));
+    Globals.hIcon = ExtractIconW(Globals.hInstance, szAppPath, 0);
 
     /* Set the icon within the dialog's title bar */
     if (Globals.hIcon)
@@ -213,7 +213,7 @@ INT ListBoxRefreshContents(VOID)
     for (i = 0; i < _countof(EntriesList); ++i)
     {
         /* Check the utility's state */
-        bIsRunning = IsProcessRunning(EntriesList[i].lpProgram);
+        bIsRunning = IsProcessRunning(EntriesList[i].lpszProgram);
         if (bIsRunning != EntriesList[i].bState)
         {
             /* The utility's state has changed, save it */
@@ -315,11 +315,11 @@ INT_PTR APIENTRY DlgProc(
                 }
 
                 case IDC_START:
-                    
LaunchProcess(EntriesList[Globals.iSelectedIndex].lpProgram);
+                    
LaunchProcess(EntriesList[Globals.iSelectedIndex].lpszProgram);
                     break;
 
                 case IDC_STOP:
-                    
CloseProcess(EntriesList[Globals.iSelectedIndex].lpProgram);
+                    
CloseProcess(EntriesList[Globals.iSelectedIndex].lpszProgram);
                     break;
 
                 default:
diff --git a/base/applications/utilman/umandlg/umandlg.h 
b/base/applications/utilman/umandlg/umandlg.h
index d90b8520e26..6705761239b 100644
--- a/base/applications/utilman/umandlg/umandlg.h
+++ b/base/applications/utilman/umandlg/umandlg.h
@@ -44,7 +44,7 @@ typedef struct
 
 typedef struct _UTILMAN_STATE
 {
-    LPCWSTR lpProgram;
+    LPCWSTR lpszProgram;
     UINT    uNameId;
     WCHAR   szResource[MAX_BUFFER];
     BOOL    bState;
@@ -53,15 +53,15 @@ typedef struct _UTILMAN_STATE
 typedef struct _REGISTRY_SETTINGS
 {
     /* Accessibility Registry settings */
-    LPCWSTR wszAppPath;
+    LPCWSTR lpszAppPath;
     DWORD dwAppType;
     DWORD dwClientControlCode;
-    LPCWSTR wszAppName;
-    LPCWSTR wszErrorOnLaunch;
+    LPCWSTR lpszAppName;
+    LPCWSTR lpszErrorOnLaunch;
     BOOL bHideClient;
     BOOL bStartWithUtilman;
     BOOL bStartWithROS;
-    LPCWSTR wszHungRespondAction;
+    LPCWSTR lpszHungRespondAction;
     DWORD dwHungTimeOut;
 
     /* Utility Manager Registry settings */
@@ -71,12 +71,12 @@ typedef struct _REGISTRY_SETTINGS
 typedef struct _REGISTRY_DATA
 {
     /* On-Screen Keyboard Registry data */
-    LPCWSTR lpwsOskPath;
-    LPCWSTR lpwszOskDisplayName;
+    LPCWSTR lpszOskPath;
+    LPCWSTR lpszOskDisplayName;
 
     /* Magnify Registry data */
-    LPCWSTR lpwszMagnifyPath;
-    LPCWSTR lpwszMagnifyDisplayName;
+    LPCWSTR lpszMagnifyPath;
+    LPCWSTR lpszMagnifyDisplayName;
 } REGISTRY_DATA, *PREGISTRY_DATA;
 
 /* ENUMERATIONS 
***************************************************************/
@@ -97,19 +97,19 @@ VOID CheckUtilityState(BOOL bUtilState);
 BOOL WINAPI UManStartDlg(VOID);
 
 /* process.c */
-DWORD GetProcessID(IN LPCWSTR lpProcessName);
-BOOL IsProcessRunning(IN LPCWSTR lpProcessName);
-BOOL LaunchProcess(LPCWSTR lpProcessName);
-BOOL CloseProcess(IN LPCWSTR lpProcessName);
+DWORD GetProcessID(IN LPCWSTR lpszProcessName);
+BOOL IsProcessRunning(IN LPCWSTR lpszProcessName);
+BOOL LaunchProcess(IN LPCWSTR lpszProcessName);
+BOOL CloseProcess(IN LPCWSTR lpszProcessName);
 
 /* about.c */
 VOID ShowAboutDlg(HWND hDlgParent);
 INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM 
lParam);
 
 /* registry.c */
-BOOL InitAppRegKey(IN HKEY hPredefinedKey, IN LPCWSTR lpwszSubKey, OUT PHKEY 
phKey, OUT LPDWORD lpdwDisposition);
-BOOL QueryAppSettings(IN HKEY hKey, IN LPCWSTR lpwszSubKey, IN LPCWSTR 
lpwszRegValue, OUT PVOID ReturnedData, IN OUT LPDWORD lpdwSizeData);
-BOOL SaveAppSettings(IN HKEY hKey, IN LPCWSTR lpwszRegValue, IN DWORD 
dwRegType, IN PVOID Data, IN DWORD cbSize);
+BOOL InitAppRegKey(IN HKEY hPredefinedKey, IN LPCWSTR lpszSubKey, OUT PHKEY 
phKey, OUT LPDWORD lpdwDisposition);
+BOOL QueryAppSettings(IN HKEY hKey, IN LPCWSTR lpszSubKey, IN LPCWSTR 
lpszRegValue, OUT PVOID ReturnedData, IN OUT LPDWORD lpdwSizeData);
+BOOL SaveAppSettings(IN HKEY hKey, IN LPCWSTR lpszRegValue, IN DWORD 
dwRegType, IN PVOID Data, IN DWORD cbSize);
 
 /* Struct variable declaration */
 extern UTILMAN_GLOBALS Globals;
diff --git a/base/applications/utilman/utilman.c 
b/base/applications/utilman/utilman.c
index a857b51eaa3..a99899e63b6 100644
--- a/base/applications/utilman/utilman.c
+++ b/base/applications/utilman/utilman.c
@@ -38,9 +38,9 @@ INT WINAPI wWinMain(IN HINSTANCE hInstance,
                     IN INT nCmdShow)
 {
     HMODULE hModule;
-    WCHAR wszFormat[MAX_BUFFER];
-    WCHAR wszFailLoad[MAX_BUFFER];
-    WCHAR wszTitle[MAX_BUFFER];
+    WCHAR szFormat[MAX_BUFFER];
+    WCHAR szFailLoad[MAX_BUFFER];
+    WCHAR szTitle[MAX_BUFFER];
     EXECDLGROUTINE UManStartDlg;
 
     UNREFERENCED_PARAMETER(hPrevInstance);
@@ -51,11 +51,11 @@ INT WINAPI wWinMain(IN HINSTANCE hInstance,
     hModule = LoadLibraryW(L"UManDlg.dll");
     if (!hModule)
     {
-        LoadStringW(hInstance, IDS_FAIL_INIT, wszFormat, _countof(wszFormat));
-        LoadStringW(hInstance, IDS_FAIL_INIT_TITLE, wszTitle, 
_countof(wszTitle));
+        LoadStringW(hInstance, IDS_FAIL_INIT, szFormat, _countof(szFormat));
+        LoadStringW(hInstance, IDS_FAIL_INIT_TITLE, szTitle, 
_countof(szTitle));
 
-        StringCchPrintfW(wszFailLoad, _countof(wszFailLoad), wszFormat, 
GetLastError());
-        MessageBoxW(GetDesktopWindow(), wszFailLoad, wszTitle, MB_ICONERROR | 
MB_OK);
+        StringCchPrintfW(szFailLoad, _countof(szFailLoad), szFormat, 
GetLastError());
+        MessageBoxW(GetDesktopWindow(), szFailLoad, szTitle, MB_ICONERROR | 
MB_OK);
         return -1;
     }
 

Reply via email to