Trust No Program

Inject Dll


InjectDll is a sandbox setting in Sandboxie Ini. It tells Sandboxie to "inject" some DLL into every program in the sandbox. "Inject" means the DLL is

   .
   .
   .
   [DefaultBox]
   InjectDll=c:\Program Files\Sandboxie Utilities\Sample.dll
			

You should specify a full path to the DLL. If the DLL file itself resides within the sandbox, specify the full path inside the sandbox.

Note: The InjectDll setting specifies 32-bit DLLs, and will be ignored in a 64-bit process on 64-bit Windows. Use the InjectDll64 setting to specify 64-bit DLLs.


The order of DLLs loaded into the sandboxed program is thus:

Ntdll.dll
KernelBase.dll (only on Windows 7)
Kernel32.dll
SbieDll.dll (on 64-bit Windows, this can be either the 64-bit SbieDll or the 32-bit SbieDll)
InjectDlls (loaded in the order specified in Sandboxie.ini)
Optionally, ShimEng (or AppHelp on Windows 7) and related DLLs
All statically-linked DLLs

The behavior described above applies to Sandboxie version 3.46 and later. Earlier versions of Sandboxie implemented a different behavior which is described below:

The injected DLL is loaded into the sandboxed process (or program) after all the statically-linked DLLs are loaded and initialized, but before the program itself begins to execute at its entry point.


If the DLL exports the symbol InjectDllMain or InjectDllMain@8, Sandboxie will call this procedure after the DLL is loaded, and pass the address of the SbieDll module. Declare InjectDllMain in your code:

   __declspec(dllexport) void __stdcall InjectDllMain(
      HINSTANCE hSbieDll, ULONG_PTR UnusedParameter);
			

It is recommended to use the hSbieDll parameter as the module instance handle for SbieDll.Dll, instead of relying on GetModuleHandle("SbieDll.dll"). This makes it possible for the injected DLL to interact with SbieDll.dll regardless of the actual name used for SbieDll.dll. However, using LoadLibrary or GetModuleHandle to look up SbieDll by name is also fine.


At this time, this setting cannot be manipulated from Sandboxie Control. You have to manually edit it into Sandboxie Ini.

See also: InjectDll64, SBIE DLL API, Start Command Line.

Jump to
Sandboxie Ini
setting:


Global Settings:

ByteOrderMark

AlertProcess

ForceDisableSeconds
ForceDisableAdminOnly

EditAdminOnly
EditPassword
MonitorAdminOnly

ActivationPrompt


Enabled

FileRootPath
IpcRootPath
KeyRootPath

AutoDelete
NeverDelete
DeleteCommand

AutoRecover
AutoRecoverIgnore
RecoverFolder

AutoExec

BoxNameTitle
BorderColor
Description

CopyLimitKb
CopyLimitSilent

ForceFolder
ForceProcess
LingerProcess
LeaderProcess

NotifyInternetAccessDenied
NotifyStartRunAccessDenied

BlockDrivers
BlockFakeInput
BlockPassword
BlockSysParam
BlockWinHooks

BlockPort

DropAdminRights

OpenFilePath
OpenPipePath
ReadFilePath
WriteFilePath
ClosedFilePath

OpenKeyPath
ReadKeyPath
WriteKeyPath
ClosedKeyPath

OpenIpcPath
ClosedIpcPath

OpenWinClass
OpenClsid
OpenProtectedStorage
OpenCredentials

InjectDll
InjectDll64

ProcessLimit1
ProcessLimit2


See also:

Expandable VariablesShell FoldersProgram Name PrefixDeprecated Settings

Top

Sandboxie is Copyright © 2004-2017 by Sandboxie Holdings, LLC.  All rights reserved.
Sandboxie.com | Contact Author