Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2786964d
Commit
2786964d
authored
Mar 16, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Mar 16, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct registering shell folders (values in Shell Folders key weren't
getting written).
parent
ecb33f23
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
19 deletions
+46
-19
shellpath.c
dlls/shell32/shellpath.c
+46
-19
No files found.
dlls/shell32/shellpath.c
View file @
2786964d
...
@@ -1202,6 +1202,8 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
...
@@ -1202,6 +1202,8 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
if
(
!
RegQueryValueExW
(
userShellFolderKey
,
value
,
NULL
,
&
dwType
,
if
(
!
RegQueryValueExW
(
userShellFolderKey
,
value
,
NULL
,
&
dwType
,
(
LPBYTE
)
path
,
&
dwPathLen
)
&&
(
dwType
==
REG_EXPAND_SZ
||
dwType
==
REG_SZ
))
(
LPBYTE
)
path
,
&
dwPathLen
)
&&
(
dwType
==
REG_EXPAND_SZ
||
dwType
==
REG_SZ
))
{
{
LONG
ret
;
path
[
dwPathLen
/
sizeof
(
WCHAR
)]
=
'\0'
;
path
[
dwPathLen
/
sizeof
(
WCHAR
)]
=
'\0'
;
if
(
dwType
==
REG_EXPAND_SZ
&&
path
[
0
]
==
'%'
)
if
(
dwType
==
REG_EXPAND_SZ
&&
path
[
0
]
==
'%'
)
{
{
...
@@ -1210,8 +1212,11 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
...
@@ -1210,8 +1212,11 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
_SHExpandEnvironmentStrings
(
path
,
szTemp
);
_SHExpandEnvironmentStrings
(
path
,
szTemp
);
strncpyW
(
path
,
szTemp
,
MAX_PATH
);
strncpyW
(
path
,
szTemp
,
MAX_PATH
);
}
}
RegSetValueExW
(
shellFolderKey
,
value
,
0
,
REG_SZ
,
(
LPBYTE
)
path
,
ret
=
RegSetValueExW
(
shellFolderKey
,
value
,
0
,
REG_SZ
,
(
LPBYTE
)
path
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
ret
!=
ERROR_SUCCESS
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
else
hr
=
S_OK
;
hr
=
S_OK
;
}
}
else
else
...
@@ -1267,7 +1272,8 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
...
@@ -1267,7 +1272,8 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
}
}
else
else
{
{
FIXME
(
"(%d,%s), LoadString failed, missing translation?
\n
"
,
folder
,
debugstr_w
(
pszPath
));
FIXME
(
"(%d,%s), LoadString failed, missing translation?
\n
"
,
folder
,
debugstr_w
(
pszPath
));
hr
=
E_FAIL
;
hr
=
E_FAIL
;
}
}
}
}
...
@@ -1762,21 +1768,21 @@ HRESULT WINAPI SHGetFolderPathA(
...
@@ -1762,21 +1768,21 @@ HRESULT WINAPI SHGetFolderPathA(
}
}
/* For each folder in folders, if its value has not been set in the registry,
/* For each folder in folders, if its value has not been set in the registry,
* call _SHGetUserProfilePath or _SHGetAllUsersProfilePath (depending on the
* call
s
_SHGetUserProfilePath or _SHGetAllUsersProfilePath (depending on the
* folder's type) to get the unexpanded value first.
* folder's type) to get the unexpanded value first.
* This will create the expanded value in the Shell Folders key, and
* Writes the unexpanded value to User Shell Folders, and queries it with
* return the unexpanded value.
* SHGetFolderPathW to force the creation of the directory if it doesn't
* Write the unexpanded value to User Shell Folders, and query it with
* already exist. SHGetFolderPathW also returns the expanded value, which
* SHGetFolderPath to force the creation of the directory if it doesn't
* this then writes to Shell Folders.
* already exist.
*/
*/
static
HRESULT
_SHRegisterFolders
(
HKEY
hRootKey
,
HANDLE
hToken
,
static
HRESULT
_SHRegisterFolders
(
HKEY
hRootKey
,
HANDLE
hToken
,
LPCWSTR
szUserShellFolderPath
,
const
UINT
folders
[],
UINT
foldersLen
)
LPCWSTR
szUserShellFolderPath
,
LPCWSTR
szShellFolderPath
,
const
UINT
folders
[],
UINT
foldersLen
)
{
{
UINT
i
;
UINT
i
;
WCHAR
path
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
];
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
HKEY
hKey
=
NULL
;
HKEY
h
UserKey
=
NULL
,
h
Key
=
NULL
;
DWORD
dwDisp
,
dwType
,
dwPathLen
;
DWORD
dwDisp
,
dwType
,
dwPathLen
;
LONG
ret
;
LONG
ret
;
...
@@ -1784,13 +1790,20 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
...
@@ -1784,13 +1790,20 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
debugstr_w
(
szUserShellFolderPath
),
folders
,
foldersLen
);
debugstr_w
(
szUserShellFolderPath
),
folders
,
foldersLen
);
ret
=
RegCreateKeyExW
(
hRootKey
,
szUserShellFolderPath
,
0
,
NULL
,
0
,
ret
=
RegCreateKeyExW
(
hRootKey
,
szUserShellFolderPath
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
hUserKey
,
&
dwDisp
);
if
(
ret
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
else
{
ret
=
RegCreateKeyExW
(
hRootKey
,
szShellFolderPath
,
0
,
NULL
,
0
,
KEY_ALL_ACCESS
,
NULL
,
&
hKey
,
&
dwDisp
);
KEY_ALL_ACCESS
,
NULL
,
&
hKey
,
&
dwDisp
);
if
(
ret
)
if
(
ret
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
hr
=
HRESULT_FROM_WIN32
(
ret
);
}
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
foldersLen
;
i
++
)
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
foldersLen
;
i
++
)
{
{
dwPathLen
=
MAX_PATH
*
sizeof
(
WCHAR
);
dwPathLen
=
MAX_PATH
*
sizeof
(
WCHAR
);
if
(
RegQueryValueExW
(
hKey
,
CSIDL_Data
[
folders
[
i
]].
szValueName
,
NULL
,
if
(
RegQueryValueExW
(
h
User
Key
,
CSIDL_Data
[
folders
[
i
]].
szValueName
,
NULL
,
&
dwType
,
(
LPBYTE
)
path
,
&
dwPathLen
)
||
(
dwType
!=
REG_SZ
&&
&
dwType
,
(
LPBYTE
)
path
,
&
dwPathLen
)
||
(
dwType
!=
REG_SZ
&&
dwType
!=
REG_EXPAND_SZ
))
dwType
!=
REG_EXPAND_SZ
))
{
{
...
@@ -1804,17 +1817,26 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
...
@@ -1804,17 +1817,26 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
hr
=
E_FAIL
;
hr
=
E_FAIL
;
if
(
*
path
)
if
(
*
path
)
{
{
ret
=
RegSetValueExW
(
h
Key
,
CSIDL_Data
[
folders
[
i
]].
szValueName
,
ret
=
RegSetValueExW
(
h
UserKey
,
0
,
REG_EXPAND_SZ
,
(
LPBYTE
)
path
,
CSIDL_Data
[
folders
[
i
]].
szValueName
,
0
,
REG_EXPAND_SZ
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
(
LPBYTE
)
path
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
ret
)
if
(
ret
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
hr
=
HRESULT_FROM_WIN32
(
ret
);
else
else
{
hr
=
SHGetFolderPathW
(
NULL
,
folders
[
i
]
|
CSIDL_FLAG_CREATE
,
hr
=
SHGetFolderPathW
(
NULL
,
folders
[
i
]
|
CSIDL_FLAG_CREATE
,
hToken
,
SHGFP_TYPE_DEFAULT
,
NULL
);
hToken
,
SHGFP_TYPE_DEFAULT
,
path
);
ret
=
RegSetValueExW
(
hKey
,
CSIDL_Data
[
folders
[
i
]].
szValueName
,
0
,
REG_SZ
,
(
LPBYTE
)
path
,
(
strlenW
(
path
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
ret
)
hr
=
HRESULT_FROM_WIN32
(
ret
);
}
}
}
}
}
}
}
if
(
hUserKey
)
RegCloseKey
(
hUserKey
);
if
(
hKey
)
if
(
hKey
)
RegCloseKey
(
hKey
);
RegCloseKey
(
hKey
);
...
@@ -1839,8 +1861,8 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
...
@@ -1839,8 +1861,8 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
CSIDL_COOKIES
,
CSIDL_COOKIES
,
CSIDL_HISTORY
,
CSIDL_HISTORY
,
};
};
WCHAR
userShellFolderPath
[
MAX_PATH
];
WCHAR
userShellFolderPath
[
MAX_PATH
]
,
shellFolderPath
[
MAX_PATH
]
;
LPCWSTR
pUserShellFolderPath
;
LPCWSTR
pUserShellFolderPath
,
pShellFolderPath
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
HKEY
hRootKey
;
HKEY
hRootKey
;
HANDLE
hToken
;
HANDLE
hToken
;
...
@@ -1854,16 +1876,21 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
...
@@ -1854,16 +1876,21 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
PathAddBackslashW
(
userShellFolderPath
);
PathAddBackslashW
(
userShellFolderPath
);
strcatW
(
userShellFolderPath
,
szSHUserFolders
);
strcatW
(
userShellFolderPath
,
szSHUserFolders
);
pUserShellFolderPath
=
userShellFolderPath
;
pUserShellFolderPath
=
userShellFolderPath
;
strcpyW
(
shellFolderPath
,
DefaultW
);
PathAddBackslashW
(
shellFolderPath
);
strcatW
(
shellFolderPath
,
szSHFolders
);
pShellFolderPath
=
shellFolderPath
;
}
}
else
else
{
{
hToken
=
NULL
;
hToken
=
NULL
;
hRootKey
=
HKEY_CURRENT_USER
;
hRootKey
=
HKEY_CURRENT_USER
;
pUserShellFolderPath
=
szSHUserFolders
;
pUserShellFolderPath
=
szSHUserFolders
;
pShellFolderPath
=
szSHFolders
;
}
}
hr
=
_SHRegisterFolders
(
hRootKey
,
hToken
,
pUserShellFolderPath
,
hr
=
_SHRegisterFolders
(
hRootKey
,
hToken
,
pUserShellFolderPath
,
folders
,
sizeof
(
folders
)
/
sizeof
(
folders
[
0
]));
pShellFolderPath
,
folders
,
sizeof
(
folders
)
/
sizeof
(
folders
[
0
]));
TRACE
(
"returning 0x%08lx
\n
"
,
hr
);
TRACE
(
"returning 0x%08lx
\n
"
,
hr
);
return
hr
;
return
hr
;
}
}
...
@@ -1884,7 +1911,7 @@ static HRESULT _SHRegisterCommonShellFolders(void)
...
@@ -1884,7 +1911,7 @@ static HRESULT _SHRegisterCommonShellFolders(void)
TRACE
(
"
\n
"
);
TRACE
(
"
\n
"
);
hr
=
_SHRegisterFolders
(
HKEY_LOCAL_MACHINE
,
NULL
,
szSHUserFolders
,
hr
=
_SHRegisterFolders
(
HKEY_LOCAL_MACHINE
,
NULL
,
szSHUserFolders
,
folders
,
sizeof
(
folders
)
/
sizeof
(
folders
[
0
]));
szSHFolders
,
folders
,
sizeof
(
folders
)
/
sizeof
(
folders
[
0
]));
TRACE
(
"returning 0x%08lx
\n
"
,
hr
);
TRACE
(
"returning 0x%08lx
\n
"
,
hr
);
return
hr
;
return
hr
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment