1 /* $Id: winsta.c,v 1.15 2004/04/09 20:03:14 navaraf Exp $
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS user32.dll
5 * FILE: lib/user32/misc/winsta.c
6 * PURPOSE: Window stations
7 * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
9 * 04-06-2001 CSH Created
20 CloseWindowStation(HWINSTA hWinSta
)
22 return(NtUserCloseWindowStation(hWinSta
));
30 CreateWindowStationA(LPSTR lpwinsta
,
32 ACCESS_MASK dwDesiredAccess
,
33 LPSECURITY_ATTRIBUTES lpsa
)
35 ANSI_STRING WindowStationNameA
;
36 UNICODE_STRING WindowStationNameU
;
41 RtlInitAnsiString(&WindowStationNameA
, lpwinsta
);
42 RtlAnsiStringToUnicodeString(&WindowStationNameU
, &WindowStationNameA
,
47 RtlInitUnicodeString(&WindowStationNameU
, NULL
);
50 hWinSta
= CreateWindowStationW(WindowStationNameU
.Buffer
,
55 RtlFreeUnicodeString(&WindowStationNameU
);
65 CreateWindowStationW(LPWSTR lpwinsta
,
67 ACCESS_MASK dwDesiredAccess
,
68 LPSECURITY_ATTRIBUTES lpsa
)
70 UNICODE_STRING WindowStationName
;
72 RtlInitUnicodeString(&WindowStationName
, lpwinsta
);
74 return NtUserCreateWindowStation(&WindowStationName
,
84 EnumWindowStationsA(WINSTAENUMPROCA lpEnumFunc
,
96 EnumWindowStationsW(WINSTAENUMPROCW lpEnumFunc
,
101 ULONG dwRequiredSize
;
102 ULONG CurrentEntry
, EntryCount
;
104 Buffer
= HeapAlloc(GetProcessHeap(), 0, 200);
109 Status
= NtUserBuildNameList(0, 200, Buffer
, &dwRequiredSize
);
110 if (Status
== STATUS_BUFFER_TOO_SMALL
)
112 Buffer
= HeapReAlloc(GetProcessHeap(), 0, Buffer
, dwRequiredSize
);
117 Status
= NtUserBuildNameList(0, dwRequiredSize
, Buffer
, &dwRequiredSize
);
119 if (Status
!= STATUS_SUCCESS
)
121 HeapFree(GetProcessHeap(), 0, Buffer
);
124 EntryCount
= *((DWORD
*)Buffer
);
125 Buffer
+= sizeof(DWORD
) / sizeof(WCHAR
);
126 for (CurrentEntry
= 0; CurrentEntry
< EntryCount
; ++CurrentEntry
)
128 (*lpEnumFunc
)(Buffer
, lParam
);
129 Buffer
+= wcslen(Buffer
) + 1;
139 GetProcessWindowStation(VOID
)
141 return NtUserGetProcessWindowStation();
149 OpenWindowStationA(LPSTR lpszWinSta
,
151 ACCESS_MASK dwDesiredAccess
)
153 ANSI_STRING WindowStationNameA
;
154 UNICODE_STRING WindowStationNameU
;
157 if (lpszWinSta
!= NULL
)
159 RtlInitAnsiString(&WindowStationNameA
, lpszWinSta
);
160 RtlAnsiStringToUnicodeString(&WindowStationNameU
, &WindowStationNameA
,
165 RtlInitUnicodeString(&WindowStationNameU
, NULL
);
168 hWinSta
= OpenWindowStationW(WindowStationNameU
.Buffer
,
172 RtlFreeUnicodeString(&WindowStationNameU
);
182 OpenWindowStationW(LPWSTR lpszWinSta
,
184 ACCESS_MASK dwDesiredAccess
)
186 UNICODE_STRING WindowStationName
;
188 RtlInitUnicodeString(&WindowStationName
, lpszWinSta
);
190 return NtUserOpenWindowStation(&WindowStationName
, dwDesiredAccess
);
198 SetProcessWindowStation(HWINSTA hWinSta
)
200 return NtUserSetProcessWindowStation(hWinSta
);
209 SetWindowStationUser(
216 return NtUserSetWindowStationUser(Unknown1
, Unknown2
, Unknown3
, Unknown4
);
225 LockWindowStation(HWINSTA hWinSta
)
227 return NtUserLockWindowStation(hWinSta
);
236 UnlockWindowStation(HWINSTA hWinSta
)
238 return NtUserUnlockWindowStation(hWinSta
);