msctf: Maintain context reference in ranges.
[wine.git] / dlls / userenv / userenv_main.c
blob87ace7d5c113e92676db9c44131925178e9273d8
1 /*
2 * Implementation of userenv.dll
4 * Copyright 2006 Mike McCormack for CodeWeavers
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.
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.
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
21 #include <stdarg.h>
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 "winnls.h"
30 #include "sddl.h"
31 #include "objbase.h"
32 #include "userenv.h"
34 #include "wine/debug.h"
36 WINE_DEFAULT_DEBUG_CHANNEL( userenv );
38 static BOOL get_reg_value(WCHAR *env, HKEY hkey, const WCHAR *name, WCHAR *val, DWORD size)
40 DWORD type, res_size=0;
42 if (RegQueryValueExW(hkey, name, 0, &type, NULL, &res_size) != ERROR_SUCCESS)
43 return FALSE;
45 if (type == REG_SZ)
47 if (res_size > size)
48 return FALSE;
50 return RegQueryValueExW(hkey, name, 0, NULL, (BYTE*)val, &size) == ERROR_SUCCESS;
52 else if (type == REG_EXPAND_SZ)
54 UNICODE_STRING us_buf, us_expanded;
55 WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, res_size);
56 if (!buf)
57 return FALSE;
59 if (RegQueryValueExW(hkey, name, 0, NULL, (BYTE*)buf, &res_size) != ERROR_SUCCESS)
61 HeapFree(GetProcessHeap(), 0, buf);
62 return FALSE;
65 RtlInitUnicodeString(&us_buf, buf);
66 us_expanded.Buffer = val;
67 us_expanded.MaximumLength = size;
68 if (RtlExpandEnvironmentStrings_U(env, &us_buf, &us_expanded, &size) != STATUS_SUCCESS)
70 HeapFree(GetProcessHeap(), 0, buf);
71 return FALSE;
74 HeapFree(GetProcessHeap(), 0, buf);
75 return TRUE;
78 return FALSE;
81 static void set_env_var( WCHAR **env, const WCHAR *name, const WCHAR *val )
83 UNICODE_STRING nameW, valW;
85 RtlInitUnicodeString( &nameW, name );
86 RtlInitUnicodeString( &valW, val );
87 RtlSetEnvironmentVariable( env, &nameW, &valW );
90 static void set_registry_variables(WCHAR **env, HKEY hkey, DWORD type, BOOL set_path)
92 UNICODE_STRING us_name, us_value;
93 WCHAR name[1024], value[1024];
94 DWORD ret, index, size;
96 for (index = 0; ; index++)
98 size = ARRAY_SIZE(name);
99 ret = RegEnumValueW(hkey, index, name, &size, NULL, NULL, NULL, NULL);
100 if (ret != ERROR_SUCCESS)
101 break;
103 if (!wcsicmp(name, L"SystemRoot")) continue;
104 if (!wcsicmp(name, L"SystemDrive")) continue;
106 RtlInitUnicodeString(&us_name, name);
107 us_value.Buffer = value;
108 us_value.MaximumLength = sizeof(value);
109 if (!wcsicmp(name, L"PATH") &&
110 !RtlQueryEnvironmentVariable_U(*env, &us_name, &us_value))
112 if (!set_path)
113 continue;
115 size = lstrlenW(value)+1;
116 if (!get_reg_value(*env, hkey, name, value+size,
117 sizeof(value)-size*sizeof(WCHAR)))
118 continue;
120 value[size] = ';';
121 set_env_var(env, name, value);
122 continue;
125 if (get_reg_value(*env, hkey, name, value, sizeof(value)) && value[0])
126 set_env_var(env, name, value);
130 static void set_wow64_environment(WCHAR **env)
132 WCHAR buf[64];
133 HKEY hkey;
134 BOOL is_win64 = (sizeof(void *) > sizeof(int));
135 BOOL is_wow64;
137 IsWow64Process( GetCurrentProcess(), &is_wow64 );
139 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion",
140 0, KEY_READ|KEY_WOW64_64KEY, &hkey))
141 return;
143 /* set the ProgramFiles variables */
145 if (get_reg_value(*env, hkey, L"ProgramFilesDir", buf, sizeof(buf)))
147 if (is_win64 || is_wow64) set_env_var(env, L"ProgramW6432", buf);
148 if (is_win64 || !is_wow64) set_env_var(env, L"ProgramFiles", buf);
150 if (get_reg_value(*env, hkey, L"ProgramFilesDir (x86)", buf, sizeof(buf)))
152 if (is_win64 || is_wow64) set_env_var(env, L"ProgramFiles(x86)", buf);
153 if (is_wow64) set_env_var(env, L"ProgramFiles", buf);
156 /* set the CommonProgramFiles variables */
158 if (get_reg_value(*env, hkey, L"CommonFilesDir", buf, sizeof(buf)))
160 if (is_win64 || is_wow64) set_env_var(env, L"CommonProgramW6432", buf);
161 if (is_win64 || !is_wow64) set_env_var(env, L"CommonProgramFiles", buf);
163 if (get_reg_value(*env, hkey, L"CommonFilesDir (x86)", buf, sizeof(buf)))
165 if (is_win64 || is_wow64) set_env_var(env, L"CommonProgramFiles(x86)", buf);
166 if (is_wow64) set_env_var(env, L"CommonProgramFiles", buf);
169 RegCloseKey(hkey);
172 BOOL WINAPI CreateEnvironmentBlock( LPVOID* lpEnvironment,
173 HANDLE hToken, BOOL bInherit )
175 static const WCHAR env_keyW[] = L"System\\CurrentControlSet\\Control\\Session Manager\\Environment";
176 static const WCHAR profile_keyW[] = L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList";
178 WCHAR *env, buf[UNICODE_STRING_MAX_CHARS], profiles_dir[MAX_PATH];
179 DWORD len;
180 HKEY hkey, hsubkey;
182 TRACE("%p %p %d\n", lpEnvironment, hToken, bInherit );
184 if (!lpEnvironment)
185 return FALSE;
187 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, env_keyW, 0, KEY_READ, &hkey) != ERROR_SUCCESS)
188 return FALSE;
190 if (RtlCreateEnvironment(bInherit, &env) != STATUS_SUCCESS)
192 RegCloseKey(hkey);
193 return FALSE;
196 if (!GetEnvironmentVariableW(L"SystemRoot", buf, UNICODE_STRING_MAX_CHARS))
198 if (!get_reg_value(env, hkey, L"SystemRoot", buf, UNICODE_STRING_MAX_CHARS))
200 buf[0] = 0;
201 WARN("SystemRoot variable not set\n");
204 set_env_var(&env, L"SystemRoot", buf);
206 if (!GetEnvironmentVariableW(L"SystemDrive", buf, UNICODE_STRING_MAX_CHARS))
208 if (!get_reg_value(env, hkey, L"SystemDrive", buf, UNICODE_STRING_MAX_CHARS))
210 buf[0] = 0;
211 WARN("SystemDrive variable not set\n");
214 set_env_var(&env, L"SystemDrive", buf);
216 set_registry_variables(&env, hkey, REG_SZ, !bInherit);
217 set_registry_variables(&env, hkey, REG_EXPAND_SZ, !bInherit);
219 if (RegOpenKeyExW(hkey, L"Environment", 0, KEY_READ, &hsubkey) == ERROR_SUCCESS)
221 set_registry_variables(&env, hsubkey, REG_SZ, !bInherit);
222 set_registry_variables(&env, hsubkey, REG_EXPAND_SZ, !bInherit);
223 RegCloseKey(hsubkey);
226 if (RegOpenKeyExW(hkey, L"Volatile Environment", 0, KEY_READ, &hsubkey) == ERROR_SUCCESS)
228 set_registry_variables(&env, hsubkey, REG_SZ, !bInherit);
229 set_registry_variables(&env, hsubkey, REG_EXPAND_SZ, !bInherit);
230 RegCloseKey(hsubkey);
232 RegCloseKey(hkey);
234 if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, profile_keyW, 0, KEY_READ, &hkey) == ERROR_SUCCESS)
236 if (get_reg_value(env, hkey, L"ProfilesDirectory", profiles_dir, MAX_PATH - sizeof(WCHAR)))
238 len = lstrlenW(profiles_dir);
239 if (profiles_dir[len-1] != '\\')
241 profiles_dir[len++] = '\\';
242 profiles_dir[len] = '\0';
245 if (get_reg_value(env, hkey, L"Public", buf, UNICODE_STRING_MAX_CHARS))
246 set_env_var(&env, L"ALLUSERSPROFILE", buf);
248 else
250 profiles_dir[0] = 0;
253 RegCloseKey(hkey);
256 len = ARRAY_SIZE(buf);
257 if (GetComputerNameW(buf, &len))
258 set_env_var(&env, L"COMPUTERNAME", buf);
260 set_wow64_environment(&env);
262 if (!hToken)
264 if (profiles_dir[0])
266 len = lstrlenW(profiles_dir);
267 if (len * sizeof(WCHAR) + sizeof(L"Default") < sizeof(buf))
269 wcscpy(buf, profiles_dir);
270 wcscat(buf, L"Default");
271 set_env_var(&env, L"USERPROFILE", buf);
275 wcscpy(buf, L".Default");
277 else
279 TOKEN_USER *token_user = NULL;
280 SID_NAME_USE use;
281 WCHAR *sidW;
282 DWORD size, tmp=0;
284 if (GetTokenInformation(hToken, TokenUser, NULL, 0, &len) ||
285 GetLastError()!=ERROR_INSUFFICIENT_BUFFER ||
286 !(token_user = HeapAlloc(GetProcessHeap(), 0, len)) ||
287 !GetTokenInformation(hToken, TokenUser, token_user, len, &len) ||
288 !ConvertSidToStringSidW(token_user->User.Sid, &sidW))
290 HeapFree(GetProcessHeap(), 0, token_user);
291 RtlDestroyEnvironment(env);
292 return FALSE;
295 len = lstrlenW(profiles_dir);
296 memcpy(buf, profiles_dir, len*sizeof(WCHAR));
298 size = UNICODE_STRING_MAX_CHARS-len;
299 if (LookupAccountSidW(NULL, token_user->User.Sid,
300 buf+len, &size, NULL, &tmp, &use))
302 set_env_var(&env, L"USERNAME", buf+len);
303 if (len) set_env_var(&env, L"USERPROFILE", buf);
306 HeapFree(GetProcessHeap(), 0, token_user);
307 lstrcpyW(buf, sidW);
308 LocalFree(sidW);
311 if (RegOpenKeyExW(HKEY_USERS, buf, 0, KEY_READ, &hkey) == ERROR_SUCCESS)
313 if (RegOpenKeyExW(hkey, L"Environment", 0, KEY_READ, &hsubkey) == ERROR_SUCCESS)
315 set_registry_variables(&env, hsubkey, REG_SZ, !bInherit);
316 set_registry_variables(&env, hsubkey, REG_EXPAND_SZ, !bInherit);
317 RegCloseKey(hsubkey);
320 if (RegOpenKeyExW(hkey, L"Volatile Environment", 0, KEY_READ, &hsubkey) == ERROR_SUCCESS)
322 set_registry_variables(&env, hsubkey, REG_SZ, !bInherit);
323 set_registry_variables(&env, hsubkey, REG_EXPAND_SZ, !bInherit);
324 RegCloseKey(hsubkey);
326 RegCloseKey(hkey);
329 *lpEnvironment = env;
330 return TRUE;
333 BOOL WINAPI DestroyEnvironmentBlock(LPVOID lpEnvironment)
335 NTSTATUS r;
337 TRACE("%p\n", lpEnvironment);
338 r = RtlDestroyEnvironment(lpEnvironment);
339 if (r == STATUS_SUCCESS)
340 return TRUE;
341 return FALSE;
344 BOOL WINAPI ExpandEnvironmentStringsForUserA( HANDLE hToken, LPCSTR lpSrc,
345 LPSTR lpDest, DWORD dwSize )
347 BOOL ret;
349 TRACE("%p %s %p %d\n", hToken, debugstr_a(lpSrc), lpDest, dwSize);
351 ret = ExpandEnvironmentStringsA( lpSrc, lpDest, dwSize );
352 TRACE("<- %s\n", debugstr_a(lpDest));
353 return ret;
356 BOOL WINAPI ExpandEnvironmentStringsForUserW( HANDLE hToken, LPCWSTR lpSrc,
357 LPWSTR lpDest, DWORD dwSize )
359 BOOL ret;
361 TRACE("%p %s %p %d\n", hToken, debugstr_w(lpSrc), lpDest, dwSize);
363 ret = ExpandEnvironmentStringsW( lpSrc, lpDest, dwSize );
364 TRACE("<- %s\n", debugstr_w(lpDest));
365 return ret;
368 BOOL WINAPI GetDefaultUserProfileDirectoryA( LPSTR lpProfileDir, LPDWORD lpcchSize )
370 FIXME("%p %p\n", lpProfileDir, lpcchSize );
371 return FALSE;
374 BOOL WINAPI GetDefaultUserProfileDirectoryW( LPWSTR lpProfileDir, LPDWORD lpcchSize )
376 FIXME("%p %p\n", lpProfileDir, lpcchSize );
377 return FALSE;
380 BOOL WINAPI GetUserProfileDirectoryA( HANDLE hToken, LPSTR lpProfileDir,
381 LPDWORD lpcchSize )
383 BOOL ret;
384 WCHAR *dirW = NULL;
386 TRACE( "%p %p %p\n", hToken, lpProfileDir, lpcchSize );
388 if (!lpProfileDir || !lpcchSize)
390 SetLastError( ERROR_INVALID_PARAMETER );
391 return FALSE;
393 if (!(dirW = HeapAlloc( GetProcessHeap(), 0, *lpcchSize * sizeof(WCHAR) )))
394 return FALSE;
396 if ((ret = GetUserProfileDirectoryW( hToken, dirW, lpcchSize )))
397 WideCharToMultiByte( CP_ACP, 0, dirW, *lpcchSize, lpProfileDir, *lpcchSize, NULL, NULL );
399 HeapFree( GetProcessHeap(), 0, dirW );
400 return ret;
403 BOOL WINAPI GetUserProfileDirectoryW( HANDLE hToken, LPWSTR lpProfileDir,
404 LPDWORD lpcchSize )
406 TOKEN_USER *t;
407 WCHAR *userW = NULL, *dirW = NULL;
408 DWORD len, dir_len, domain_len;
409 SID_NAME_USE use;
410 BOOL ret = FALSE;
412 TRACE( "%p %p %p\n", hToken, lpProfileDir, lpcchSize );
414 if (!lpcchSize)
416 SetLastError( ERROR_INVALID_PARAMETER );
417 return FALSE;
420 len = 0;
421 GetTokenInformation( hToken, TokenUser, NULL, 0, &len );
422 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) return FALSE;
423 if (!(t = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE;
424 if (!GetTokenInformation( hToken, TokenUser, t, len, &len )) goto done;
426 len = domain_len = 0;
427 LookupAccountSidW( NULL, t->User.Sid, NULL, &len, NULL, &domain_len, NULL );
428 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
429 if (!(userW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) goto done;
430 if (!LookupAccountSidW( NULL, t->User.Sid, userW, &len, NULL, &domain_len, &use )) goto done;
432 dir_len = 0;
433 GetProfilesDirectoryW( NULL, &dir_len );
434 if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) goto done;
435 if (!(dirW = HeapAlloc( GetProcessHeap(), 0, (dir_len + 1) * sizeof(WCHAR) ))) goto done;
436 if (!GetProfilesDirectoryW( dirW, &dir_len )) goto done;
438 len += dir_len + 2;
439 if (*lpcchSize < len)
441 SetLastError( ERROR_INSUFFICIENT_BUFFER );
442 *lpcchSize = len;
443 goto done;
445 lstrcpyW( lpProfileDir, dirW );
446 lstrcatW( lpProfileDir, L"\\" );
447 lstrcatW( lpProfileDir, userW );
448 *lpcchSize = len;
449 ret = TRUE;
451 done:
452 HeapFree( GetProcessHeap(), 0, t );
453 HeapFree( GetProcessHeap(), 0, userW );
454 HeapFree( GetProcessHeap(), 0, dirW );
455 return ret;
458 static const char ProfileListA[] = "Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList";
460 BOOL WINAPI GetProfilesDirectoryA( LPSTR lpProfilesDir, LPDWORD lpcchSize )
462 static const char ProfilesDirectory[] = "ProfilesDirectory";
463 LONG l;
464 HKEY key;
465 BOOL ret = FALSE;
466 DWORD len = 0, expanded_len;
467 LPSTR unexpanded_profiles_dir = NULL;
469 TRACE("%p %p\n", lpProfilesDir, lpcchSize );
471 if (!lpProfilesDir || !lpcchSize)
473 SetLastError(ERROR_INVALID_PARAMETER);
474 return FALSE;
477 l = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ProfileListA, 0, KEY_READ, &key);
478 if (l)
480 SetLastError(l);
481 return FALSE;
483 l = RegQueryValueExA(key, ProfilesDirectory, NULL, NULL, NULL, &len);
484 if (l)
486 SetLastError(l);
487 goto end;
489 unexpanded_profiles_dir = HeapAlloc(GetProcessHeap(), 0, len);
490 if (!unexpanded_profiles_dir)
492 SetLastError(ERROR_OUTOFMEMORY);
493 goto end;
495 l = RegQueryValueExA(key, ProfilesDirectory, NULL, NULL,
496 (BYTE *)unexpanded_profiles_dir, &len);
497 if (l)
499 SetLastError(l);
500 goto end;
502 expanded_len = ExpandEnvironmentStringsA(unexpanded_profiles_dir, NULL, 0);
503 /* The returned length doesn't include the NULL terminator. */
504 if (*lpcchSize < expanded_len - 1)
506 *lpcchSize = expanded_len - 1;
507 SetLastError(ERROR_INSUFFICIENT_BUFFER);
508 goto end;
510 *lpcchSize = expanded_len - 1;
511 /* The return value is also the expected length. */
512 ret = ExpandEnvironmentStringsA(unexpanded_profiles_dir, lpProfilesDir,
513 expanded_len) - 1;
514 end:
515 HeapFree(GetProcessHeap(), 0, unexpanded_profiles_dir);
516 RegCloseKey(key);
517 return ret;
520 BOOL WINAPI GetProfilesDirectoryW( LPWSTR lpProfilesDir, LPDWORD lpcchSize )
522 LONG l;
523 HKEY key;
524 BOOL ret = FALSE;
525 DWORD len = 0, expanded_len;
526 LPWSTR unexpanded_profiles_dir = NULL;
528 TRACE("%p %p\n", lpProfilesDir, lpcchSize );
530 if (!lpcchSize)
532 SetLastError(ERROR_INVALID_PARAMETER);
533 return FALSE;
536 l = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
537 L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
538 0, KEY_READ, &key);
539 if (l)
541 SetLastError(l);
542 return FALSE;
544 l = RegQueryValueExW(key, L"ProfilesDirectory", NULL, NULL, NULL, &len);
545 if (l)
547 SetLastError(l);
548 goto end;
550 unexpanded_profiles_dir = HeapAlloc(GetProcessHeap(), 0, len);
551 if (!unexpanded_profiles_dir)
553 SetLastError(ERROR_OUTOFMEMORY);
554 goto end;
556 l = RegQueryValueExW(key, L"ProfilesDirectory", NULL, NULL,
557 (BYTE *)unexpanded_profiles_dir, &len);
558 if (l)
560 SetLastError(l);
561 goto end;
563 expanded_len = ExpandEnvironmentStringsW(unexpanded_profiles_dir, NULL, 0);
564 /* The returned length doesn't include the NULL terminator. */
565 if (*lpcchSize < expanded_len - 1 || !lpProfilesDir)
567 *lpcchSize = expanded_len - 1;
568 SetLastError(ERROR_INSUFFICIENT_BUFFER);
569 goto end;
571 *lpcchSize = expanded_len - 1;
572 /* The return value is also the expected length. */
573 ret = ExpandEnvironmentStringsW(unexpanded_profiles_dir, lpProfilesDir,
574 expanded_len) - 1;
575 end:
576 HeapFree(GetProcessHeap(), 0, unexpanded_profiles_dir);
577 RegCloseKey(key);
578 return ret;
581 BOOL WINAPI GetAllUsersProfileDirectoryA( LPSTR lpProfileDir, LPDWORD lpcchSize )
583 FIXME("%p %p\n", lpProfileDir, lpcchSize);
584 return FALSE;
587 BOOL WINAPI GetAllUsersProfileDirectoryW( LPWSTR lpProfileDir, LPDWORD lpcchSize )
589 FIXME("%p %p\n", lpProfileDir, lpcchSize);
590 return FALSE;
593 BOOL WINAPI GetProfileType( DWORD *pdwFlags )
595 FIXME("%p\n", pdwFlags );
596 *pdwFlags = 0;
597 return TRUE;
600 BOOL WINAPI LoadUserProfileA( HANDLE hToken, LPPROFILEINFOA lpProfileInfo )
602 FIXME("%p %p\n", hToken, lpProfileInfo );
603 lpProfileInfo->hProfile = HKEY_CURRENT_USER;
604 return TRUE;
607 BOOL WINAPI LoadUserProfileW( HANDLE hToken, LPPROFILEINFOW lpProfileInfo )
609 FIXME("%p %p\n", hToken, lpProfileInfo );
610 lpProfileInfo->hProfile = HKEY_CURRENT_USER;
611 return TRUE;
614 BOOL WINAPI RegisterGPNotification( HANDLE event, BOOL machine )
616 FIXME("%p %d\n", event, machine );
617 return TRUE;
620 BOOL WINAPI UnregisterGPNotification( HANDLE event )
622 FIXME("%p\n", event );
623 return TRUE;
626 BOOL WINAPI UnloadUserProfile( HANDLE hToken, HANDLE hProfile )
628 FIXME("(%p, %p): stub\n", hToken, hProfile);
629 return FALSE;
632 HANDLE WINAPI EnterCriticalPolicySection(BOOL bMachine)
634 FIXME("(%x)\n", bMachine);
635 SetLastError(ERROR_ACCESS_DENIED);
636 return NULL;
639 BOOL WINAPI LeaveCriticalPolicySection(HANDLE hSection)
641 FIXME("(%p)\n", hSection);
642 return TRUE;
645 DWORD WINAPI GetAppliedGPOListW(DWORD dwFlags, LPCWSTR pMachineName, PSID pSidUser, GUID *pGuidExtension,
646 PGROUP_POLICY_OBJECTW *ppGPOList)
648 FIXME("(%x %s %p %s %p)\n", dwFlags, debugstr_w(pMachineName), pSidUser, debugstr_guid(pGuidExtension), ppGPOList);
649 return ERROR_ACCESS_DENIED;
652 /******************************************************************************
653 * USERENV.138
655 * Create .lnk file
657 * PARAMETERS
658 * int csidl [in] well-known directory location to create link in
659 * LPCSTR lnk_dir [in] directory (relative to directory specified by csidl) to create link in
660 * LPCSTR lnk_filename [in] filename of the link file without .lnk extension
661 * LPCSTR lnk_target [in] file/directory pointed to by link
662 * LPCSTR lnk_iconfile [in] link icon resource filename
663 * DWORD lnk_iconid [in] link icon resource id in file referred by lnk_iconfile
664 * LPCSTR work_directory [in] link target's work directory
665 * WORD hotkey [in] link hotkey (virtual key id)
666 * DWORD win_state [in] initial window size (SW_SHOWMAXIMIZED to start maximized,
667 * SW_SHOWMINNOACTIVE to start minimized, everything else is default state)
668 * LPCSTR comment [in] comment - link's comment
669 * LPCSTR loc_filename_resfile [in] resource file which holds localized filename for this link file
670 * DWORD loc_filename_resid [in] resource id for this link file's localized filename
672 * RETURNS
673 * TRUE: Link file was successfully created
674 * FALSE: Link file was not created
676 BOOL WINAPI USERENV_138( int csidl, LPCSTR lnk_dir, LPCSTR lnk_filename,
677 LPCSTR lnk_target, LPCSTR lnk_iconfile, DWORD lnk_iconid,
678 LPCSTR work_directory, WORD hotkey, DWORD win_state, LPCSTR comment,
679 LPCSTR loc_filename_resfile, DWORD loc_filename_resid)
681 FIXME("(%d,%s,%s,%s,%s,%d,%s,0x%x,%d,%s,%s,%d) - stub\n", csidl, debugstr_a(lnk_dir),
682 debugstr_a(lnk_filename), debugstr_a(lnk_target), debugstr_a(lnk_iconfile),
683 lnk_iconid, debugstr_a(work_directory), hotkey, win_state,
684 debugstr_a(comment), debugstr_a(loc_filename_resfile), loc_filename_resid );
686 return FALSE;