[Wine-patches] [eter-1.0.12] shell32: Put the temp directory inside the user profile directory.

Alexander Morozov amorozov на etersoft.ru
Пт Июл 22 21:40:39 MSD 2011


----------- следующая часть -----------
From 82a16fcce3649bd41c5113498342bacc283447a8 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard на winehq.org>
Date: Thu, 28 Jan 2010 14:53:28 +0100
Subject: [eter-1.0.12] shell32: Put the temp directory inside the user
 profile directory.

---
 dlls/shell32/shellpath.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c
index 2434e9a..b511007 100644
--- a/dlls/shell32/shellpath.c
+++ b/dlls/shell32/shellpath.c
@@ -2251,6 +2251,42 @@ static void _SHCreateSymbolicLinks(void)
     }
 }
 
+/******************************************************************************
+ * create_extra_folders  [Internal]
+ *
+ * Create some extra folders that don't have a standard CSIDL definition.
+ */
+static HRESULT create_extra_folders(void)
+{
+    static const WCHAR environW[] = {'E','n','v','i','r','o','n','m','e','n','t',0};
+    static const WCHAR TempW[]    = {'T','e','m','p',0};
+    static const WCHAR TEMPW[]    = {'T','E','M','P',0};
+    static const WCHAR TMPW[]     = {'T','M','P',0};
+    WCHAR path[MAX_PATH+5];
+    HRESULT hr;
+    HKEY hkey;
+    DWORD type, size, ret;
+
+    ret = RegCreateKeyW( HKEY_CURRENT_USER, environW, &hkey );
+    if (ret) return HRESULT_FROM_WIN32( ret );
+
+    /* FIXME: should be under AppData, but we don't want spaces in the temp path */
+    hr = SHGetFolderPathAndSubDirW( 0, CSIDL_PROFILE | CSIDL_FLAG_CREATE, NULL,
+                                    SHGFP_TYPE_DEFAULT, TempW, path );
+    if (SUCCEEDED(hr))
+    {
+        size = sizeof(path);
+        if (RegQueryValueExW( hkey, TEMPW, NULL, &type, (LPBYTE)path, &size ))
+            RegSetValueExW( hkey, TEMPW, 0, REG_SZ, (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR) );
+        size = sizeof(path);
+        if (RegQueryValueExW( hkey, TMPW, NULL, &type, (LPBYTE)path, &size ))
+            RegSetValueExW( hkey, TMPW, 0, REG_SZ, (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR) );
+    }
+    RegCloseKey( hkey );
+    return hr;
+}
+
+
 /* Register the default values in the registry, as some apps seem to depend
  * on their presence.  The set registered was taken from Windows XP.
  */
@@ -2269,6 +2305,8 @@ HRESULT SHELL_RegisterShellFolders(void)
         hr = _SHRegisterUserShellFolders(FALSE);
     if (SUCCEEDED(hr))
         hr = _SHRegisterCommonShellFolders();
+    if (SUCCEEDED(hr))
+        hr = create_extra_folders();
     return hr;
 }
 
-- 
1.7.5.4



Подробная информация о списке рассылки Wine-patches