Skip to main content

Change user home directory in Windows 10

· One min read
  • Open Windows Registry
  • Located at “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\”
  • Find your user SID (such as S-x-x-xxxxxxxxxxxx)
  • Change the value of "ProfileImagePath"

About the "Desktop Heap Size" limit when running C++MFC application in a Windows Container

· 2 min read
<code class="bat"># escape=`
FROM {imageRegistry}/mcr.microsoft.com/windows/servercore:10.0.19041.928

COPY runtime C:\runtime
COPY tools C:\tools

# 1. Change Windows Registry, implement Windows Container Graceful Shutdown
# Change Windows Registry, to increase Windows Desktop Heap Size from 1024,20480,768 to 20480,20480,20480
# 2. Install Chocolatey package manager and vim
# 3. Install Telnet client
# 4. Install [Microsoft Visual C++ 2005 Redistributable Package]
# 5. Install [Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package MFC Security Update]
# https://www.microsoft.com/en-us/download/details.aspx?id=26347
# 6. Install [Microsoft Visual C++ 2005 Service Pack 1 Redistributable Package ATL Security Update]
# https://www.microsoft.com/en-us/download/details.aspx?id=14431
# 7. Install [Microsoft Visual C++ 2015, 2017, 2019 Redistributable Package]
# 8. Install [.net core runtime 3.1.6 x64]
# 8. Install [.net core runtime 3.1.6 x86]
# 10. Install [.net framework 4.8 runtime x86 and x84]

RUN reg add hklm\system\currentcontrolset\services\cexecsvc /v ProcessShutdownTimeoutSeconds /t REG_DWORD /d 3600 && `
reg add hklm\system\currentcontrolset\control /v WaitToKillServiceTimeout /t REG_SZ /d 3600000 /f && `
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\SubSystems" /v Windows /t REG_EXPAND_SZ /d "%SystemRoot%\system32\csrss.exe ObjectDirectory=\Windows SharedSection=20480,20480,20480 Windows=On SubSystemType=Windows ServerDll=basesrv,1 ServerDll=winsrv:UserServerDllInitialization,3 ServerDll=sxssrv,4 ProfileControl=Off MaxRequestThreads=16" /f && `
# powershell -Command "Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression;choco install -y vim winrar;" && `
powershell -Command "Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression;choco install -y vim;" && `
setx PATH "%PATH%;C:\tools;C:\ProgramData\chocolatey\bin;C:\Program Files\WinRAR" && `
dism /online /Enable-Feature /FeatureName:TelnetClient /Quiet && `
C:\runtime\vcredist_2005_x86.exe /Q && `
C:\runtime\vcredist_2005_sp1_mfc_zh-cn_x86.exe /Q && `
C:\runtime\vcredist_2005_sp1_atl_zh-cn_x86.exe /Q && `
C:\runtime\vc_redist_2015-2017-2019.x86.exe /install /quiet && `
C:\runtime\windowsdesktop-runtime-3.1.6-win-x64.exe /install /quiet /norestart && `
C:\runtime\windowsdesktop-runtime-3.1.6-win-x86.exe /install /quiet /norestart && `
C:\runtime\ndp48-x86-x64-allos-enu.exe /q /norestart && `
rmdir /S /Q C:\runtime
ClustrMaps