[WIN32SS:USER] Code formatting only.

This commit is contained in:
Hermès Bélusca-Maïto 2018-06-16 19:43:40 +02:00
parent e90316aeaa
commit 9bf7fb6f42
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 95 additions and 84 deletions

View file

@ -941,7 +941,7 @@ DriverEntry(
CalloutData.DesktopOkToCloseProcedure = IntDesktopOkToClose;
CalloutData.DesktopCloseProcedure = IntDesktopObjectClose;
CalloutData.DesktopDeleteProcedure = IntDesktopObjectDelete;
CalloutData.WindowStationOkToCloseProcedure = IntWinstaOkToClose;
CalloutData.WindowStationOkToCloseProcedure = IntWinStaOkToClose;
// CalloutData.WindowStationCloseProcedure = NULL;
CalloutData.WindowStationDeleteProcedure = IntWinStaObjectDelete;
CalloutData.WindowStationParseProcedure = IntWinStaObjectParse;

View file

@ -96,7 +96,7 @@ UserCreateWinstaDirectory(VOID)
/* OBJECT CALLBACKS **********************************************************/
NTSTATUS
APIENTRY
NTAPI
IntWinStaObjectDelete(
_In_ PVOID Parameters)
{
@ -117,7 +117,7 @@ IntWinStaObjectDelete(
}
NTSTATUS
APIENTRY
NTAPI
IntWinStaObjectParse(
_In_ PVOID Parameters)
{
@ -183,7 +183,7 @@ IntWinStaObjectParse(
NTSTATUS
NTAPI
IntWinstaOkToClose(
IntWinStaOkToClose(
_In_ PVOID Parameters)
{
PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
@ -370,7 +370,7 @@ CheckWinstaAttributeAccess(ACCESS_MASK DesiredAccess)
* lpSecurity
* Security descriptor
*
* Unknown3, Unknown4, Unknown5
* Unknown3, Unknown4, Unknown5, Unknown6
* 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.
*
* Todo
* Correct the prototype to match the Windows one (with 7 parameters
* on Windows XP).
*
* Status
* @implemented
*/
@ -940,7 +936,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
ppi = PsGetCurrentProcessWin32Process();
/* Reference the new window station */
if(hWindowStation !=NULL)
if (hWindowStation != NULL)
{
Status = IntValidateWindowStationHandle(hWindowStation,
UserMode,
@ -960,13 +956,13 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
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) */
if(hwinstaOld != ppi->hwinsta)
if (hwinstaOld != ppi->hwinsta)
{
ObCloseHandle(hwinstaOld, UserMode);
}
@ -991,7 +987,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation)
ppi->W32PF_flags &= ~W32PF_READSCREENACCESSGRANTED;
}
if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO) )
if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO))
{
ppi->W32PF_flags |= W32PF_IOWINSTA;
}
@ -1529,8 +1525,8 @@ NtUserSetWindowStationUser(
_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;
@ -1544,7 +1540,7 @@ NtUserSetWindowStationUser(
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
WindowStation->psidUser = 0;
WindowStation->psidUser = NULL;
goto Leave;
}

View file

@ -84,18 +84,18 @@ NTAPI
UserCreateWinstaDirectory(VOID);
NTSTATUS
APIENTRY
NTAPI
IntWinStaObjectDelete(
_In_ PVOID Parameters);
NTSTATUS
APIENTRY
NTAPI
IntWinStaObjectParse(
_In_ PVOID Parameters);
NTSTATUS
NTAPI
IntWinstaOkToClose(
IntWinStaOkToClose(
_In_ PVOID Parameters);
NTSTATUS

View 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>
@ -15,14 +13,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(winsta);
/*
* @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;
UNICODE_STRING WindowStationNameU;
if (lpwinsta)
{
@ -39,7 +39,7 @@ CreateWindowStationA(LPCSTR lpwinsta,
dwDesiredAccess,
lpsa);
/* Free the string, if it was allocated */
/* Free the string if it was allocated */
if (lpwinsta) RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta;
@ -49,30 +49,32 @@ CreateWindowStationA(LPCSTR lpwinsta,
/*
* @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;
NTSTATUS Status;
HWINSTA hwinsta;
/* 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);
if(!NT_SUCCESS(Status))
if (!NT_SUCCESS(Status))
{
ERR("Failed to open WindowStations directory\n");
return NULL;
@ -85,27 +87,28 @@ CreateWindowStationW(LPCWSTR lpwinsta,
&WindowStationName,
OBJ_CASE_INSENSITIVE,
hWindowStationsDir,
0);
NULL);
/* Check if the handle should be inheritable */
if (lpsa && lpsa->bInheritHandle)
{
{
ObjectAttributes.Attributes |= OBJ_INHERIT;
}
hwinsta = NtUserCreateWindowStation(&ObjectAttributes,
hWinSta = NtUserCreateWindowStation(&ObjectAttributes,
dwDesiredAccess,
0, 0, 0, 0, 0);
NtClose(hWindowStationsDir);
return hwinsta;
return hWinSta;
}
/*
* Common code for EnumDesktopsA/W and EnumWindowStationsA/W
*/
BOOL FASTCALL
BOOL
FASTCALL
EnumNamesW(HWINSTA WindowStation,
NAMEENUMPROCW EnumFunc,
LPARAM Context,
@ -174,7 +177,6 @@ EnumNamesW(HWINSTA WindowStation,
return Ret;
}
/* 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
*/
BOOL CALLBACK
BOOL
CALLBACK
EnumNamesCallback(LPWSTR Name, LPARAM Param)
{
PENUMNAMESASCIICONTEXT Context = (PENUMNAMESASCIICONTEXT) Param;
@ -247,7 +250,8 @@ EnumNamesCallback(LPWSTR Name, LPARAM Param)
/*
* Common code for EnumDesktopsA and EnumWindowStationsA
*/
BOOL FASTCALL
BOOL
FASTCALL
EnumNamesA(HWINSTA WindowStation,
NAMEENUMPROCA EnumFunc,
LPARAM Context,
@ -264,9 +268,11 @@ EnumNamesA(HWINSTA WindowStation,
/*
* @implemented
*/
BOOL WINAPI
EnumWindowStationsA(WINSTAENUMPROCA EnumFunc,
LPARAM Context)
BOOL
WINAPI
EnumWindowStationsA(
IN WINSTAENUMPROCA EnumFunc,
IN LPARAM Context)
{
return EnumNamesA(NULL, EnumFunc, Context, FALSE);
}
@ -275,9 +281,11 @@ EnumWindowStationsA(WINSTAENUMPROCA EnumFunc,
/*
* @implemented
*/
BOOL WINAPI
EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
LPARAM Context)
BOOL
WINAPI
EnumWindowStationsW(
IN WINSTAENUMPROCW EnumFunc,
IN LPARAM Context)
{
return EnumNamesW(NULL, EnumFunc, Context, FALSE);
}
@ -286,7 +294,8 @@ EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
/*
* @unimplemented on Win32k side
*/
BOOL WINAPI
BOOL
WINAPI
GetWinStationInfo(PVOID pUnknown)
{
return (BOOL)NtUserCallOneParam((DWORD_PTR)pUnknown, ONEPARAM_ROUTINE_GETWINSTAINFO);
@ -296,13 +305,15 @@ GetWinStationInfo(PVOID pUnknown)
/*
* @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;
UNICODE_STRING WindowStationNameU;
if (lpszWinSta)
{
@ -318,7 +329,7 @@ OpenWindowStationA(LPCSTR lpszWinSta,
fInherit,
dwDesiredAccess);
/* Free the string, if it was allocated */
/* Free the string if it was allocated */
if (lpszWinSta) RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta;
@ -328,27 +339,29 @@ OpenWindowStationA(LPCSTR lpszWinSta,
/*
* @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;
NTSTATUS Status;
HWINSTA hwinsta;
/* 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))
{
@ -363,18 +376,19 @@ OpenWindowStationW(LPCWSTR lpszWinSta,
&WindowStationName,
OBJ_CASE_INSENSITIVE,
hWindowStationsDir,
0);
NULL);
if(fInherit)
/* Check if the handle should be inheritable */
if (fInherit)
{
ObjectAttributes.Attributes |= OBJ_INHERIT;
}
hwinsta = NtUserOpenWindowStation(&ObjectAttributes, dwDesiredAccess);
hWinSta = NtUserOpenWindowStation(&ObjectAttributes, dwDesiredAccess);
NtClose(hWindowStationsDir);
return hwinsta;
return hWinSta;
}
@ -383,10 +397,11 @@ OpenWindowStationW(LPCWSTR lpszWinSta,
*/
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;