:pserver:cvsanon@mok.lvcm.com:/CVS/ReactOS reactos
[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 WINBOOL STDCALL
17 CloseWindowStation(HWINSTA hWinSta)
18 {
19   return(NtUserCloseWindowStation(hWinSta));
20 }
21
22 HWINSTA STDCALL
23 CreateWindowStationA(LPSTR lpwinsta,
24                      DWORD dwReserved,
25                      ACCESS_MASK dwDesiredAccess,
26                      LPSECURITY_ATTRIBUTES lpsa)
27 {
28   ANSI_STRING WindowStationNameA;
29   UNICODE_STRING WindowStationNameU;
30   HWINSTA hWinSta;
31   
32   if (lpwinsta != NULL) 
33     {
34       RtlInitAnsiString(&WindowStationNameA, lpwinsta);
35       RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, 
36                                    TRUE);
37     } 
38   else 
39     {
40       RtlInitUnicodeString(&WindowStationNameU, NULL);
41     }
42
43   hWinSta = CreateWindowStationW(WindowStationNameU.Buffer,
44                                  dwReserved,
45                                  dwDesiredAccess,
46                                  lpsa);
47
48   RtlFreeUnicodeString(&WindowStationNameU);
49   
50   return hWinSta;
51 }
52
53 HWINSTA STDCALL
54 CreateWindowStationW(LPWSTR lpwinsta,
55                      DWORD dwReserved,
56                      ACCESS_MASK dwDesiredAccess,
57                      LPSECURITY_ATTRIBUTES lpsa)
58 {
59   UNICODE_STRING WindowStationName;
60   
61   RtlInitUnicodeString(&WindowStationName, lpwinsta);
62   
63   return NtUserCreateWindowStation(&WindowStationName,
64                                    dwDesiredAccess,
65                                    lpsa, 0, 0, 0);
66 }
67
68 WINBOOL STDCALL
69 EnumWindowStationsA(ENUMWINDOWSTATIONPROC lpEnumFunc,
70                     LPARAM lParam)
71 {
72   return FALSE;
73 }
74
75 WINBOOL STDCALL
76 EnumWindowStationsW(ENUMWINDOWSTATIONPROC lpEnumFunc,
77                     LPARAM lParam)
78 {
79   return FALSE;
80 }
81
82 HWINSTA STDCALL
83 GetProcessWindowStation(VOID)
84 {
85   return NtUserGetProcessWindowStation();
86 }
87
88 HWINSTA STDCALL
89 OpenWindowStationA(LPSTR lpszWinSta,
90                    WINBOOL fInherit,
91                    ACCESS_MASK dwDesiredAccess)
92 {
93   ANSI_STRING WindowStationNameA;
94   UNICODE_STRING WindowStationNameU;
95   HWINSTA hWinSta;
96   
97   if (lpszWinSta != NULL) 
98     {
99       RtlInitAnsiString(&WindowStationNameA, lpszWinSta);
100       RtlAnsiStringToUnicodeString(&WindowStationNameU, &WindowStationNameA, 
101                                    TRUE);
102     } 
103   else 
104     {
105       RtlInitUnicodeString(&WindowStationNameU, NULL);
106     }
107   
108   hWinSta = OpenWindowStationW(WindowStationNameU.Buffer,
109                                fInherit,
110                                dwDesiredAccess);
111   
112   RtlFreeUnicodeString(&WindowStationNameU);
113   
114   return hWinSta;
115 }
116
117 HWINSTA STDCALL
118 OpenWindowStationW(LPWSTR lpszWinSta,
119                    WINBOOL fInherit,
120                    ACCESS_MASK dwDesiredAccess)
121 {
122   UNICODE_STRING WindowStationName;
123
124   RtlInitUnicodeString(&WindowStationName, lpszWinSta);
125
126   return NtUserOpenWindowStation(&WindowStationName, dwDesiredAccess);
127 }
128
129 WINBOOL STDCALL
130 SetProcessWindowStation(HWINSTA hWinSta)
131 {
132   return NtUserSetProcessWindowStation(hWinSta);
133 }
134
135 /* EOF */
136