[WIN32SS:USER] Code formatting only.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sat, 16 Jun 2018 17:43:40 +0000 (19:43 +0200)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 22 Jul 2018 17:26:50 +0000 (19:26 +0200)
win32ss/user/ntuser/main.c
win32ss/user/ntuser/winsta.c
win32ss/user/ntuser/winsta.h
win32ss/user/user32/misc/winsta.c

index f9aed03..c10e482 100644 (file)
@@ -941,7 +941,7 @@ DriverEntry(
     CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
     CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
     CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
     CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
     CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
     CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
-    CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
+    CalloutData.WindowStationOkToCloseProcedure = IntWinStaOkToClose;
     // CalloutData.WindowStationCloseProcedure = NULL;
     CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
     CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
     // CalloutData.WindowStationCloseProcedure = NULL;
     CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
     CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;
index d9ca3ca..e999ba8 100644 (file)
@@ -96,7 +96,7 @@ UserCreateWinstaDirectory(VOID)
 /* OBJECT CALLBACKS  **********************************************************/
 
 NTSTATUS
 /* OBJECT CALLBACKS  **********************************************************/
 
 NTSTATUS
-APIENTRY
+NTAPI
 IntWinStaObjectDelete(
     _In_ PVOID Parameters)
 {
 IntWinStaObjectDelete(
     _In_ PVOID Parameters)
 {
@@ -117,7 +117,7 @@ IntWinStaObjectDelete(
 }
 
 NTSTATUS
 }
 
 NTSTATUS
-APIENTRY
+NTAPI
 IntWinStaObjectParse(
     _In_ PVOID Parameters)
 {
 IntWinStaObjectParse(
     _In_ PVOID Parameters)
 {
@@ -183,7 +183,7 @@ IntWinStaObjectParse(
 
 NTSTATUS
 NTAPI
 
 NTSTATUS
 NTAPI
-IntWinstaOkToClose(
+IntWinStaOkToClose(
     _In_ PVOID Parameters)
 {
     PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
     _In_ PVOID Parameters)
 {
     PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
@@ -370,7 +370,7 @@ CheckWinstaAttributeAccess(ACCESS_MASK DesiredAccess)
  *    lpSecurity
  *       Security descriptor
  *
  *    lpSecurity
  *       Security descriptor
  *
- *    Unknown3, Unknown4, Unknown5
+ *    Unknown3, Unknown4, Unknown5, Unknown6
  *       Unused
  *
  * Return Value
  *       Unused
  *
  * Return Value
@@ -379,10 +379,6 @@ CheckWinstaAttributeAccess(ACCESS_MASK DesiredAccess)
  *    exists, the function succeeds and returns a handle to the existing
  *    window station. If the function fails, the return value is NULL.
  *
  *    exists, the function succeeds and returns a handle to the existing
  *    window station. If the function fails, the return value is NULL.
  *
- * Todo
- *    Correct the prototype to match the Windows one (with 7 parameters
- *    on Windows XP).
- *
  * Status
  *    @implemented
  */
  * Status
  *    @implemented
  */
@@ -940,7 +936,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
     ppi = PsGetCurrentProcessWin32Process();
 
     /* Reference the new window station */
     ppi = PsGetCurrentProcessWin32Process();
 
     /* Reference the new window station */
-    if(hWindowStation !=NULL)
+    if (hWindowStation != NULL)
     {
         Status = IntValidateWindowStationHandle(hWindowStation,
                                                 UserMode,
     {
         Status = IntValidateWindowStationHandle(hWindowStation,
                                                 UserMode,
@@ -960,13 +956,13 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
     hwinstaOld = PsGetProcessWin32WindowStation(ppi->peProcess);
 
     /* Dereference the previous window station */
     hwinstaOld = PsGetProcessWin32WindowStation(ppi->peProcess);
 
     /* Dereference the previous window station */
-    if(OldWinSta != NULL)
+    if (OldWinSta != NULL)
     {
         ObDereferenceObject(OldWinSta);
     }
 
     /* Check if we have a stale handle (it should happen for console apps) */
     {
         ObDereferenceObject(OldWinSta);
     }
 
     /* Check if we have a stale handle (it should happen for console apps) */
-    if(hwinstaOld != ppi->hwinsta)
+    if (hwinstaOld != ppi->hwinsta)
     {
         ObCloseHandle(hwinstaOld, UserMode);
     }
     {
         ObCloseHandle(hwinstaOld, UserMode);
     }
@@ -991,7 +987,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
         ppi->W32PF_flags &= ~W32PF_READSCREENACCESSGRANTED;
     }
 
         ppi->W32PF_flags &= ~W32PF_READSCREENACCESSGRANTED;
     }
 
-    if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO) )
+    if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO))
     {
         ppi->W32PF_flags |= W32PF_IOWINSTA;
     }
     {
         ppi->W32PF_flags |= W32PF_IOWINSTA;
     }
@@ -1529,8 +1525,8 @@ NtUserSetWindowStationUser(
 
     _SEH2_TRY
     {
 
     _SEH2_TRY
     {
-        ProbeForRead( psid, size, 1);
-        ProbeForRead( pluid, sizeof(LUID), 1);
+        ProbeForRead(psid, size, 1);
+        ProbeForRead(pluid, sizeof(LUID), 1);
 
         RtlCopyMemory(WindowStation->psidUser, psid, size);
         WindowStation->luidUser = *pluid;
 
         RtlCopyMemory(WindowStation->psidUser, psid, size);
         WindowStation->luidUser = *pluid;
@@ -1544,7 +1540,7 @@ NtUserSetWindowStationUser(
     if (!NT_SUCCESS(Status))
     {
         ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
     if (!NT_SUCCESS(Status))
     {
         ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
-        WindowStation->psidUser = 0;
+        WindowStation->psidUser = NULL;
         goto Leave;
     }
 
         goto Leave;
     }
 
index 6ac08cf..b41834e 100644 (file)
@@ -84,18 +84,18 @@ NTAPI
 UserCreateWinstaDirectory(VOID);
 
 NTSTATUS
 UserCreateWinstaDirectory(VOID);
 
 NTSTATUS
-APIENTRY
+NTAPI
 IntWinStaObjectDelete(
     _In_ PVOID Parameters);
 
 NTSTATUS
 IntWinStaObjectDelete(
     _In_ PVOID Parameters);
 
 NTSTATUS
-APIENTRY
+NTAPI
 IntWinStaObjectParse(
     _In_ PVOID Parameters);
 
 NTSTATUS
 NTAPI
 IntWinStaObjectParse(
     _In_ PVOID Parameters);
 
 NTSTATUS
 NTAPI
-IntWinstaOkToClose(
+IntWinStaOkToClose(
     _In_ PVOID Parameters);
 
 NTSTATUS
     _In_ PVOID Parameters);
 
 NTSTATUS
index b3b8887..11d4bb5 100644 (file)
@@ -1,11 +1,9 @@
 /*
 /*
- * COPYRIGHT:       See COPYING in the top level directory
- * PROJECT:         ReactOS user32.dll
- * FILE:            win32ss/user/user32/misc/winsta.c
- * PURPOSE:         Window stations
- * PROGRAMMER:      Casper S. Hornstrup (chorns@users.sourceforge.net)
- * UPDATE HISTORY:
- *      04-06-2001  CSH  Created
+ * PROJECT:     ReactOS user32.dll
+ * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE:     Window stations
+ * COPYRIGHT:   Copyright 2001-2018 Casper S. Hornstrup (chorns@users.sourceforge.net)
+ *              Copyright 2011-2018 Giannis Adamopoulos
  */
 
 #include <user32.h>
  */
 
 #include <user32.h>
@@ -15,14 +13,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(winsta);
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-HWINSTA WINAPI
-CreateWindowStationA(LPCSTR lpwinsta,
-                     DWORD dwReserved,
-                     ACCESS_MASK dwDesiredAccess,
-                     LPSECURITY_ATTRIBUTES lpsa)
+HWINSTA
+WINAPI
+CreateWindowStationA(
+    IN LPCSTR lpwinsta OPTIONAL,
+    IN DWORD dwReserved,
+    IN ACCESS_MASK dwDesiredAccess,
+    IN LPSECURITY_ATTRIBUTES lpsa OPTIONAL)
 {
 {
-    UNICODE_STRING WindowStationNameU;
     HWINSTA hWinSta;
     HWINSTA hWinSta;
+    UNICODE_STRING WindowStationNameU;
 
     if (lpwinsta)
     {
 
     if (lpwinsta)
     {
@@ -39,7 +39,7 @@ CreateWindowStationA(LPCSTR lpwinsta,
                                    dwDesiredAccess,
                                    lpsa);
 
                                    dwDesiredAccess,
                                    lpsa);
 
-    /* Free the string, if it was allocated */
+    /* Free the string if it was allocated */
     if (lpwinsta) RtlFreeUnicodeString(&WindowStationNameU);
 
     return hWinSta;
     if (lpwinsta) RtlFreeUnicodeString(&WindowStationNameU);
 
     return hWinSta;
@@ -49,30 +49,32 @@ CreateWindowStationA(LPCSTR lpwinsta,
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-HWINSTA WINAPI
-CreateWindowStationW(LPCWSTR lpwinsta,
-                     DWORD dwReserved,
-                     ACCESS_MASK dwDesiredAccess,
-                     LPSECURITY_ATTRIBUTES lpsa)
+HWINSTA
+WINAPI
+CreateWindowStationW(
+    IN LPCWSTR lpwinsta OPTIONAL,
+    IN DWORD dwReserved,
+    IN ACCESS_MASK dwDesiredAccess,
+    IN LPSECURITY_ATTRIBUTES lpsa OPTIONAL)
 {
 {
+    NTSTATUS Status;
+    HWINSTA hWinSta;
     UNICODE_STRING WindowStationName;
     UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\\Windows\\WindowStations");
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hWindowStationsDir;
     UNICODE_STRING WindowStationName;
     UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\\Windows\\WindowStations");
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hWindowStationsDir;
-    NTSTATUS Status;
-    HWINSTA hwinsta;
 
     /* Open WindowStations directory */
     InitializeObjectAttributes(&ObjectAttributes,
                                &WindowStationsDir,
                                OBJ_CASE_INSENSITIVE,
 
     /* Open WindowStations directory */
     InitializeObjectAttributes(&ObjectAttributes,
                                &WindowStationsDir,
                                OBJ_CASE_INSENSITIVE,
-                               0,
-                               0);
+                               NULL,
+                               NULL);
 
 
-    Status = NtOpenDirectoryObject(&hWindowStationsDir, 
-                                   DIRECTORY_CREATE_OBJECT, 
+    Status = NtOpenDirectoryObject(&hWindowStationsDir,
+                                   DIRECTORY_CREATE_OBJECT,
                                    &ObjectAttributes);
                                    &ObjectAttributes);
-    if(!NT_SUCCESS(Status))
+    if (!NT_SUCCESS(Status))
     {
         ERR("Failed to open WindowStations directory\n");
         return NULL;
     {
         ERR("Failed to open WindowStations directory\n");
         return NULL;
@@ -85,27 +87,28 @@ CreateWindowStationW(LPCWSTR lpwinsta,
                                &WindowStationName,
                                OBJ_CASE_INSENSITIVE,
                                hWindowStationsDir,
                                &WindowStationName,
                                OBJ_CASE_INSENSITIVE,
                                hWindowStationsDir,
-                               0);
+                               NULL);
 
     /* Check if the handle should be inheritable */
     if (lpsa && lpsa->bInheritHandle)
 
     /* Check if the handle should be inheritable */
     if (lpsa && lpsa->bInheritHandle)
-    { 
+    {
         ObjectAttributes.Attributes |= OBJ_INHERIT;
     }
 
         ObjectAttributes.Attributes |= OBJ_INHERIT;
     }
 
-    hwinsta = NtUserCreateWindowStation(&ObjectAttributes,
+    hWinSta = NtUserCreateWindowStation(&ObjectAttributes,
                                         dwDesiredAccess,
                                         0, 0, 0, 0, 0);
 
     NtClose(hWindowStationsDir);
 
                                         dwDesiredAccess,
                                         0, 0, 0, 0, 0);
 
     NtClose(hWindowStationsDir);
 
-    return hwinsta;
+    return hWinSta;
 }
 
 /*
  * Common code for EnumDesktopsA/W and EnumWindowStationsA/W
  */
 }
 
 /*
  * Common code for EnumDesktopsA/W and EnumWindowStationsA/W
  */
-BOOL FASTCALL
+BOOL
+FASTCALL
 EnumNamesW(HWINSTA WindowStation,
            NAMEENUMPROCW EnumFunc,
            LPARAM Context,
 EnumNamesW(HWINSTA WindowStation,
            NAMEENUMPROCW EnumFunc,
            LPARAM Context,
@@ -174,7 +177,6 @@ EnumNamesW(HWINSTA WindowStation,
     return Ret;
 }
 
     return Ret;
 }
 
-
 /* For W->A conversion */
 typedef struct tagENUMNAMESASCIICONTEXT
 {
 /* For W->A conversion */
 typedef struct tagENUMNAMESASCIICONTEXT
 {
@@ -186,7 +188,8 @@ typedef struct tagENUMNAMESASCIICONTEXT
  * Callback used by Ascii versions. Converts the Unicode name to
  * Ascii and then calls the user callback
  */
  * Callback used by Ascii versions. Converts the Unicode name to
  * Ascii and then calls the user callback
  */
-BOOL CALLBACK
+BOOL
+CALLBACK
 EnumNamesCallback(LPWSTR Name, LPARAM Param)
 {
     PENUMNAMESASCIICONTEXT Context = (PENUMNAMESASCIICONTEXT) Param;
 EnumNamesCallback(LPWSTR Name, LPARAM Param)
 {
     PENUMNAMESASCIICONTEXT Context = (PENUMNAMESASCIICONTEXT) Param;
@@ -247,7 +250,8 @@ EnumNamesCallback(LPWSTR Name, LPARAM Param)
 /*
  * Common code for EnumDesktopsA and EnumWindowStationsA
  */
 /*
  * Common code for EnumDesktopsA and EnumWindowStationsA
  */
-BOOL FASTCALL
+BOOL
+FASTCALL
 EnumNamesA(HWINSTA WindowStation,
            NAMEENUMPROCA EnumFunc,
            LPARAM Context,
 EnumNamesA(HWINSTA WindowStation,
            NAMEENUMPROCA EnumFunc,
            LPARAM Context,
@@ -264,9 +268,11 @@ EnumNamesA(HWINSTA WindowStation,
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-BOOL WINAPI
-EnumWindowStationsA(WINSTAENUMPROCA EnumFunc,
-                    LPARAM Context)
+BOOL
+WINAPI
+EnumWindowStationsA(
+    IN WINSTAENUMPROCA EnumFunc,
+    IN LPARAM Context)
 {
     return EnumNamesA(NULL, EnumFunc, Context, FALSE);
 }
 {
     return EnumNamesA(NULL, EnumFunc, Context, FALSE);
 }
@@ -275,9 +281,11 @@ EnumWindowStationsA(WINSTAENUMPROCA EnumFunc,
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-BOOL WINAPI
-EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
-                    LPARAM Context)
+BOOL
+WINAPI
+EnumWindowStationsW(
+    IN WINSTAENUMPROCW EnumFunc,
+    IN LPARAM Context)
 {
     return EnumNamesW(NULL, EnumFunc, Context, FALSE);
 }
 {
     return EnumNamesW(NULL, EnumFunc, Context, FALSE);
 }
@@ -286,7 +294,8 @@ EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
 /*
  * @unimplemented on Win32k side
  */
 /*
  * @unimplemented on Win32k side
  */
-BOOL WINAPI
+BOOL
+WINAPI
 GetWinStationInfo(PVOID pUnknown)
 {
     return (BOOL)NtUserCallOneParam((DWORD_PTR)pUnknown, ONEPARAM_ROUTINE_GETWINSTAINFO);
 GetWinStationInfo(PVOID pUnknown)
 {
     return (BOOL)NtUserCallOneParam((DWORD_PTR)pUnknown, ONEPARAM_ROUTINE_GETWINSTAINFO);
@@ -296,13 +305,15 @@ GetWinStationInfo(PVOID pUnknown)
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-HWINSTA WINAPI
-OpenWindowStationA(LPCSTR lpszWinSta,
-                   BOOL fInherit,
-                   ACCESS_MASK dwDesiredAccess)
+HWINSTA
+WINAPI
+OpenWindowStationA(
+    IN LPCSTR lpszWinSta,
+    IN BOOL fInherit,
+    IN ACCESS_MASK dwDesiredAccess)
 {
 {
-    UNICODE_STRING WindowStationNameU;
     HWINSTA hWinSta;
     HWINSTA hWinSta;
+    UNICODE_STRING WindowStationNameU;
 
     if (lpszWinSta)
     {
 
     if (lpszWinSta)
     {
@@ -318,7 +329,7 @@ OpenWindowStationA(LPCSTR lpszWinSta,
                                  fInherit,
                                  dwDesiredAccess);
 
                                  fInherit,
                                  dwDesiredAccess);
 
-    /* Free the string, if it was allocated */
+    /* Free the string if it was allocated */
     if (lpszWinSta) RtlFreeUnicodeString(&WindowStationNameU);
 
     return hWinSta;
     if (lpszWinSta) RtlFreeUnicodeString(&WindowStationNameU);
 
     return hWinSta;
@@ -328,27 +339,29 @@ OpenWindowStationA(LPCSTR lpszWinSta,
 /*
  * @implemented
  */
 /*
  * @implemented
  */
-HWINSTA WINAPI
-OpenWindowStationW(LPCWSTR lpszWinSta,
-                   BOOL fInherit,
-                   ACCESS_MASK dwDesiredAccess)
+HWINSTA
+WINAPI
+OpenWindowStationW(
+    IN LPCWSTR lpszWinSta,
+    IN BOOL fInherit,
+    IN ACCESS_MASK dwDesiredAccess)
 {
 {
+    NTSTATUS Status;
+    HWINSTA hWinSta;
     UNICODE_STRING WindowStationName;
     UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\\Windows\\WindowStations");
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hWindowStationsDir;
     UNICODE_STRING WindowStationName;
     UNICODE_STRING WindowStationsDir = RTL_CONSTANT_STRING(L"\\Windows\\WindowStations");
     OBJECT_ATTRIBUTES ObjectAttributes;
     HANDLE hWindowStationsDir;
-    NTSTATUS Status;
-    HWINSTA hwinsta;
 
     /* Open WindowStations directory */
     InitializeObjectAttributes(&ObjectAttributes,
                                &WindowStationsDir,
                                OBJ_CASE_INSENSITIVE,
 
     /* Open WindowStations directory */
     InitializeObjectAttributes(&ObjectAttributes,
                                &WindowStationsDir,
                                OBJ_CASE_INSENSITIVE,
-                               0,
-                               0);
+                               NULL,
+                               NULL);
 
 
-    Status = NtOpenDirectoryObject(&hWindowStationsDir, 
-                                   DIRECTORY_TRAVERSE, 
+    Status = NtOpenDirectoryObject(&hWindowStationsDir,
+                                   DIRECTORY_TRAVERSE,
                                    &ObjectAttributes);
     if(!NT_SUCCESS(Status))
     {
                                    &ObjectAttributes);
     if(!NT_SUCCESS(Status))
     {
@@ -363,18 +376,19 @@ OpenWindowStationW(LPCWSTR lpszWinSta,
                                &WindowStationName,
                                OBJ_CASE_INSENSITIVE,
                                hWindowStationsDir,
                                &WindowStationName,
                                OBJ_CASE_INSENSITIVE,
                                hWindowStationsDir,
-                               0);
+                               NULL);
 
 
-    if(fInherit)
+    /* Check if the handle should be inheritable */
+    if (fInherit)
     {
         ObjectAttributes.Attributes |= OBJ_INHERIT;
     }
 
     {
         ObjectAttributes.Attributes |= OBJ_INHERIT;
     }
 
-    hwinsta = NtUserOpenWindowStation(&ObjectAttributes, dwDesiredAccess);
+    hWinSta = NtUserOpenWindowStation(&ObjectAttributes, dwDesiredAccess);
 
     NtClose(hWindowStationsDir);
 
 
     NtClose(hWindowStationsDir);
 
-    return hwinsta;
+    return hWinSta;
 }
 
 
 }
 
 
@@ -383,10 +397,11 @@ OpenWindowStationW(LPCWSTR lpszWinSta,
  */
 BOOL
 WINAPI
  */
 BOOL
 WINAPI
-SetWindowStationUser(HWINSTA hWindowStation,
-                     PLUID pluid,
-                     PSID psid,
-                     DWORD size)
+SetWindowStationUser(
+    IN HWINSTA hWindowStation,
+    IN PLUID pluid OPTIONAL,
+    IN PSID psid,
+    IN DWORD size)
 {
     BOOL Success;
 
 {
     BOOL Success;