I had a conversation on how to debug a Win32/Win64 application, with regards to MaxLoaderThreads, and loader snaps.
First, ensure you have the Windows SDK installed, and that you have cdb.exe and gflags, like this:
To remove MaxLoaderThreads (and hence enable parallel DLL loading), run the following:
reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /f reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /f /reg:32
To turn on loader snaps for the application we're debugging (bds.exe). This enables loader snaps for both the 32-bit and 64-bit app.
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\gflags.exe" /i bds.exe +sls "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\gflags.exe" /i bds.exe +sls
To turn off loader snaps for the application we're debugging (bds.exe), use the same command, but with -sls instead. The following disables loader snaps for both the 32-bit and 64-bit app.
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\gflags.exe" /i bds.exe -sls "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\gflags.exe" /i bds.exe -sls
To debug the application we're working on:
"C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\cdb.exe" -g -G -logo C:\temp\snaps-1.log "C:\Program Files (x86)\Embarcadero\Studio\37.0\bin\bds.exe"
To enable parallel DLL loading, by adding MaxLoaderThreads:
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /t REG_DWORD /d 1 /f reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\bds.exe" /v MaxLoaderThreads /t REG_DWORD /d 1 /f /reg:32
Learn why the map is cool in Go!