/* OBJECT CALLBACKS **********************************************************/
NTSTATUS
-APIENTRY
+NTAPI
IntWinStaObjectDelete(
_In_ PVOID Parameters)
{
}
NTSTATUS
-APIENTRY
+NTAPI
IntWinStaObjectParse(
_In_ PVOID Parameters)
{
NTSTATUS
NTAPI
-IntWinstaOkToClose(
+IntWinStaOkToClose(
_In_ PVOID Parameters)
{
PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS OkToCloseParameters = Parameters;
* lpSecurity
* Security descriptor
*
- * Unknown3, Unknown4, Unknown5
+ * Unknown3, Unknown4, Unknown5, Unknown6
* Unused
*
* Return Value
* 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
*/
ppi = PsGetCurrentProcessWin32Process();
/* Reference the new window station */
- if(hWindowStation !=NULL)
+ if (hWindowStation != NULL)
{
Status = IntValidateWindowStationHandle(hWindowStation,
UserMode,
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);
}
ppi->W32PF_flags &= ~W32PF_READSCREENACCESSGRANTED;
}
- if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO) )
+ if (NewWinSta && !(NewWinSta->Flags & WSS_NOIO))
{
ppi->W32PF_flags |= W32PF_IOWINSTA;
}
_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;
if (!NT_SUCCESS(Status))
{
ExFreePoolWithTag(WindowStation->psidUser, USERTAG_SECURITY);
- WindowStation->psidUser = 0;
+ WindowStation->psidUser = NULL;
goto Leave;
}
/*
- * 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>
/*
* @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)
{
dwDesiredAccess,
lpsa);
- /* Free the string, if it was allocated */
+ /* Free the string if it was allocated */
if (lpwinsta) RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta;
/*
* @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;
&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,
return Ret;
}
-
/* For W->A conversion */
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;
/*
* Common code for EnumDesktopsA and EnumWindowStationsA
*/
-BOOL FASTCALL
+BOOL
+FASTCALL
EnumNamesA(HWINSTA WindowStation,
NAMEENUMPROCA EnumFunc,
LPARAM Context,
/*
* @implemented
*/
-BOOL WINAPI
-EnumWindowStationsA(WINSTAENUMPROCA EnumFunc,
- LPARAM Context)
+BOOL
+WINAPI
+EnumWindowStationsA(
+ IN WINSTAENUMPROCA EnumFunc,
+ IN LPARAM Context)
{
return EnumNamesA(NULL, EnumFunc, Context, FALSE);
}
/*
* @implemented
*/
-BOOL WINAPI
-EnumWindowStationsW(WINSTAENUMPROCW EnumFunc,
- LPARAM Context)
+BOOL
+WINAPI
+EnumWindowStationsW(
+ IN WINSTAENUMPROCW EnumFunc,
+ IN LPARAM Context)
{
return EnumNamesW(NULL, EnumFunc, Context, FALSE);
}
/*
* @unimplemented on Win32k side
*/
-BOOL WINAPI
+BOOL
+WINAPI
GetWinStationInfo(PVOID pUnknown)
{
return (BOOL)NtUserCallOneParam((DWORD_PTR)pUnknown, ONEPARAM_ROUTINE_GETWINSTAINFO);
/*
* @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)
{
fInherit,
dwDesiredAccess);
- /* Free the string, if it was allocated */
+ /* Free the string if it was allocated */
if (lpszWinSta) RtlFreeUnicodeString(&WindowStationNameU);
return hWinSta;
/*
* @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))
{
&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;
}
*/
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;