mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 04:21:58 +00:00
[WINLOGON] Restore saved connections on session opening
This avoids using a nasty hack in MPR. CORE-15310
This commit is contained in:
parent
8b0a126445
commit
4cf87fdb2c
1 changed files with 67 additions and 0 deletions
|
@ -508,6 +508,70 @@ Cleanup:
|
||||||
return bSuccess;
|
return bSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
VOID
|
||||||
|
RestoreAllConnections(PWLSESSION Session)
|
||||||
|
{
|
||||||
|
DWORD dRet;
|
||||||
|
HANDLE hEnum;
|
||||||
|
LPNETRESOURCE lpRes;
|
||||||
|
DWORD dSize = 0x1000;
|
||||||
|
DWORD dCount = -1;
|
||||||
|
LPNETRESOURCE lpCur;
|
||||||
|
BOOL UserProfile;
|
||||||
|
|
||||||
|
UserProfile = (Session && Session->UserToken);
|
||||||
|
if (!UserProfile)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ImpersonateLoggedOnUser(Session->UserToken))
|
||||||
|
{
|
||||||
|
ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dRet = WNetOpenEnum(RESOURCE_REMEMBERED, RESOURCETYPE_DISK, 0, NULL, &hEnum);
|
||||||
|
if (dRet != WN_SUCCESS)
|
||||||
|
{
|
||||||
|
ERR("Failed to open enumeration: %lu\n", dRet);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
lpRes = HeapAlloc(GetProcessHeap(), 0, dSize);
|
||||||
|
if (!lpRes)
|
||||||
|
{
|
||||||
|
ERR("Failed to allocate memory\n");
|
||||||
|
WNetCloseEnum(hEnum);
|
||||||
|
goto quit;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
dSize = 0x1000;
|
||||||
|
dCount = -1;
|
||||||
|
|
||||||
|
memset(lpRes, 0, dSize);
|
||||||
|
dRet = WNetEnumResource(hEnum, &dCount, lpRes, &dSize);
|
||||||
|
if (dRet == WN_SUCCESS || dRet == WN_MORE_DATA)
|
||||||
|
{
|
||||||
|
lpCur = lpRes;
|
||||||
|
for (; dCount; dCount--)
|
||||||
|
{
|
||||||
|
WNetAddConnection(lpCur->lpRemoteName, NULL, lpCur->lpLocalName);
|
||||||
|
lpCur++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (dRet != WN_NO_MORE_ENTRIES);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, lpRes);
|
||||||
|
WNetCloseEnum(hEnum);
|
||||||
|
|
||||||
|
quit:
|
||||||
|
RevertToSelf();
|
||||||
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
BOOL
|
BOOL
|
||||||
HandleLogon(
|
HandleLogon(
|
||||||
|
@ -570,6 +634,9 @@ HandleLogon(
|
||||||
|
|
||||||
AllowWinstaAccess(Session);
|
AllowWinstaAccess(Session);
|
||||||
|
|
||||||
|
/* Connect remote resources */
|
||||||
|
RestoreAllConnections(Session);
|
||||||
|
|
||||||
if (!StartUserShell(Session))
|
if (!StartUserShell(Session))
|
||||||
{
|
{
|
||||||
//WCHAR StatusMsg[256];
|
//WCHAR StatusMsg[256];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue