update for HEAD-2003091401
[reactos.git] / lib / user32 / misc / winsta.c
1 /* $Id$
2  *
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)
8  * UPDATE HISTORY:
9  *      04-06-2001  CSH  Created
10  */
11 #include <windows.h>
12 #include <user32.h>
13 #include <debug.h>
14
15
16 /*
17  * @implemented
18  */
19 WINBOOL STDCALL
20 CloseWindowStation(HWINSTA hWinSta)
21 {
22   return(NtUserCloseWindowStation(hWinSta));
23 }
24
25
26 /*
27  * @implemented
28  */
29 HWINSTA STDCALL
30 CreateWindowStationA(LPSTR lpwinsta,
31                      DWORD dwReserved,
32                      ACCESS_MASK dwDesiredAccess,
33                      LPSECURITY_ATTRIBUTES lpsa)
34 {
35   ANSI_STRING WindowStationNameA;
36   UNICODE_STRING WindowStationNameU;
37   HWINSTA hWinSta;
38   
39   if (lpwinsta != NULL) 
40     {
41       RtlInitAnsiString(&WindowStationNameA, lpwinsta);
42       RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, 
43                                    TRUE);
44     } 
45   else 
46     {
47       RtlInitUnicodeString(&WindowStationNameU, NULL);
48     }
49
50   hWinSta = CreateWindowStationW(WindowStationNameU.Buffer,
51                                  dwReserved,
52                                  dwDesiredAccess,
53                                  lpsa);
54
55   RtlFreeUnicodeString(&WindowStationNameU);
56   
57   return hWinSta;
58 }
59
60
61 /*
62  * @implemented
63  */
64 HWINSTA STDCALL
65 CreateWindowStationW(LPWSTR lpwinsta,
66                      DWORD dwReserved,
67                      ACCESS_MASK dwDesiredAccess,
68                      LPSECURITY_ATTRIBUTES lpsa)
69 {
70   UNICODE_STRING WindowStationName;
71   
72   RtlInitUnicodeString(&WindowStationName, lpwinsta);
73   
74   return NtUserCreateWindowStation(&WindowStationName,
75                                    dwDesiredAccess,
76                                    lpsa, 0, 0, 0);
77 }
78
79
80 /*
81  * @unimplemented
82  */
83 WINBOOL STDCALL
84 EnumWindowStationsA(ENUMWINDOWSTATIONPROCA lpEnumFunc,
85                     LPARAM lParam)
86 {
87   UNIMPLEMENTED;
88   return FALSE;
89 }
90
91
92 /*
93  * @unimplemented
94  */
95 WINBOOL STDCALL
96 EnumWindowStationsW(ENUMWINDOWSTATIONPROCW lpEnumFunc,
97                     LPARAM lParam)
98 {
99   UNIMPLEMENTED;
100   return FALSE;
101 }
102
103
104 /*
105  * @implemented
106  */
107 HWINSTA STDCALL
108 GetProcessWindowStation(VOID)
109 {
110   return NtUserGetProcessWindowStation();
111 }
112
113
114 /*
115  * @implemented
116  */
117 HWINSTA STDCALL
118 OpenWindowStationA(LPSTR lpszWinSta,
119                    WINBOOL fInherit,
120                    ACCESS_MASK dwDesiredAccess)
121 {
122   ANSI_STRING WindowStationNameA;
123   UNICODE_STRING WindowStationNameU;
124   HWINSTA hWinSta;
125   
126   if (lpszWinSta != NULL) 
127     {
128       RtlInitAnsiString(&WindowStationNameA, lpszWinSta);
129       RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, 
130                                    TRUE);
131     } 
132   else 
133     {
134       RtlInitUnicodeString(&WindowStationNameU, NULL);
135     }
136   
137   hWinSta = OpenWindowStationW(WindowStationNameU.Buffer,
138                                fInherit,
139                                dwDesiredAccess);
140   
141   RtlFreeUnicodeString(&WindowStationNameU);
142
143   return hWinSta;
144 }
145
146
147 /*
148  * @implemented
149  */
150 HWINSTA STDCALL
151 OpenWindowStationW(LPWSTR lpszWinSta,
152                    WINBOOL fInherit,
153                    ACCESS_MASK dwDesiredAccess)
154 {
155   UNICODE_STRING WindowStationName;
156
157   RtlInitUnicodeString(&WindowStationName, lpszWinSta);
158
159   return NtUserOpenWindowStation(&WindowStationName, dwDesiredAccess);
160 }
161
162
163 /*
164  * @implemented
165  */
166 WINBOOL STDCALL
167 SetProcessWindowStation(HWINSTA hWinSta)
168 {
169   return NtUserSetProcessWindowStation(hWinSta);
170 }
171
172 /* EOF */
173