oleaut32: Rewrite RollUdate to be easier to change and to support more conversions.
[wine] / dlls / userenv / userenv_main.c
1 /*
2  * Implementation of userenv.dll
3  *
4  * Copyright 2006 Mike McCormack for CodeWeavers
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winreg.h"
28 #include "winternl.h"
29 #include "userenv.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL( userenv );
34
35 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
36 {
37     TRACE("%p %d %p\n", hinstDLL, fdwReason, lpvReserved);
38
39     switch (fdwReason)
40     {
41     case DLL_WINE_PREATTACH:
42         return FALSE;  /* prefer native version */
43     case DLL_PROCESS_ATTACH:
44         DisableThreadLibraryCalls(hinstDLL);
45         break;
46     case DLL_PROCESS_DETACH:
47         break;
48     }
49     return TRUE;
50 }
51
52 BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment,
53                      HANDLE hToken, BOOL bInherit )
54 {
55     NTSTATUS r;
56
57     TRACE("%p %p %d\n", lpEnvironment, hToken, bInherit );
58
59     if (!lpEnvironment)
60         return FALSE;
61
62     r = RtlCreateEnvironment(bInherit, (WCHAR **)lpEnvironment);
63     if (r == STATUS_SUCCESS)
64         return TRUE;
65     return FALSE;
66 }
67
68 BOOL WINAPI DestroyEnvironmentBlock(LPVOID lpEnvironment)
69 {
70     NTSTATUS r;
71
72     TRACE("%p\n", lpEnvironment);
73     r = RtlDestroyEnvironment(lpEnvironment);
74     if (r == STATUS_SUCCESS)
75         return TRUE;
76     return FALSE;
77 }
78
79 BOOL WINAPI ExpandEnvironmentStringsForUserA( HANDLE hToken, LPCSTR lpSrc,
80                      LPSTR lpDest, DWORD dwSize )
81 {
82     BOOL ret;
83
84     TRACE("%p %s %p %d\n", hToken, debugstr_a(lpSrc), lpDest, dwSize);
85
86     ret = ExpandEnvironmentStringsA( lpSrc, lpDest, dwSize );
87     TRACE("<- %s\n", debugstr_a(lpDest));
88     return ret;
89 }
90
91 BOOL WINAPI ExpandEnvironmentStringsForUserW( HANDLE hToken, LPCWSTR lpSrc,
92                      LPWSTR lpDest, DWORD dwSize )
93 {
94     BOOL ret;
95
96     TRACE("%p %s %p %d\n", hToken, debugstr_w(lpSrc), lpDest, dwSize);
97
98     ret = ExpandEnvironmentStringsW( lpSrc, lpDest, dwSize );
99     TRACE("<- %s\n", debugstr_w(lpDest));
100     return ret;
101 }
102
103 BOOL WINAPI GetUserProfileDirectoryA( HANDLE hToken, LPSTR lpProfileDir,
104                      LPDWORD lpcchSize )
105 {
106     FIXME("%p %p %p\n", hToken, lpProfileDir, lpcchSize );
107     return FALSE;
108 }
109
110 BOOL WINAPI GetUserProfileDirectoryW( HANDLE hToken, LPWSTR lpProfileDir,
111                      LPDWORD lpcchSize )
112 {
113     FIXME("%p %p %p\n", hToken, lpProfileDir, lpcchSize );
114     return FALSE;
115 }
116
117 BOOL WINAPI GetProfilesDirectoryA( LPSTR lpProfilesDir, LPDWORD lpcchSize )
118 {
119     FIXME("%p %p\n", lpProfilesDir, lpcchSize );
120     return FALSE;
121 }
122
123 BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
124 {
125     FIXME("%p %p\n", lpProfilesDir, lpcchSize );
126     return FALSE;
127 }
128
129 BOOL WINAPI GetAllUsersProfileDirectoryA( LPSTR lpProfileDir, LPDWORD lpcchSize )
130 {
131     FIXME("%p %p\n", lpProfileDir, lpcchSize);
132     return FALSE;
133 }
134
135 BOOL WINAPI GetAllUsersProfileDirectoryW( LPWSTR lpProfileDir, LPDWORD lpcchSize )
136 {
137     FIXME("%p %p\n", lpProfileDir, lpcchSize);
138     return FALSE;
139 }
140
141 BOOL WINAPI GetProfileType( DWORD *pdwFlags )
142 {
143     FIXME("%p\n", pdwFlags );
144     *pdwFlags = 0;
145     return TRUE;
146 }
147
148 BOOL WINAPI LoadUserProfileA( HANDLE hToken, LPPROFILEINFOA lpProfileInfo )
149 {
150     FIXME("%p %p\n", hToken, lpProfileInfo );
151     lpProfileInfo->hProfile = HKEY_CURRENT_USER;
152     return TRUE;
153 }
154
155 BOOL WINAPI LoadUserProfileW( HANDLE hToken, LPPROFILEINFOW lpProfileInfo )
156 {
157     FIXME("%p %p\n", hToken, lpProfileInfo );
158     lpProfileInfo->hProfile = HKEY_CURRENT_USER;
159     return TRUE;
160 }
161
162 BOOL WINAPI RegisterGPNotification( HANDLE event, BOOL machine )
163 {
164     FIXME("%p %d\n", event, machine );
165     return TRUE;
166 }
167
168 BOOL WINAPI UnregisterGPNotification( HANDLE event )
169 {
170     FIXME("%p\n", event );
171     return TRUE;
172 }
173
174 BOOL WINAPI UnloadUserProfile( HANDLE hToken, HANDLE hProfile )
175 {
176     FIXME("(%p, %p): stub\n", hToken, hProfile);
177     return FALSE;
178 }