CreateEnvironmentBlock

[DllImport("userenv.dll", SetLastError = true)]
public static extern bool CreateEnvironmentBlock(
   out IntPtr lpEnvironment,
   IntPtr hToken,
   bool bInherit
);

Microsoft documentation: Link

Last updated