Skip to content

Commit

Permalink
Fix environment block creation
Browse files Browse the repository at this point in the history
  • Loading branch information
nathpete-msft authored Aug 25, 2020
1 parent 4aecbf3 commit 7ad3284
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/types/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "precomp.h"
#include "inc/Environment.hpp"
#include "wil/token_helpers.h"

using namespace ::Microsoft::Console::Utils;

Expand All @@ -14,7 +15,8 @@ using namespace ::Microsoft::Console::Utils;
EnvironmentBlockPtr Microsoft::Console::Utils::CreateEnvironmentBlock()
{
void* newEnvironmentBlock{ nullptr };
if (!::CreateEnvironmentBlock(&newEnvironmentBlock, GetCurrentProcessToken(), FALSE))
auto processToken{ wil::open_current_access_token(TOKEN_QUERY | TOKEN_DUPLICATE) };
if (!::CreateEnvironmentBlock(&newEnvironmentBlock, processToken.get(), FALSE))
{
return nullptr;
}
Expand Down

0 comments on commit 7ad3284

Please sign in to comment.