SBIE DLL API

This page describes the callable entrypoints in the SbieDll.dll dynamically-linked library (DLL). These entrypoints expose some functionality of Sandboxie that can be accessed programmatically, that is, through other programs rather than through a person interacting with Sandboxie.

There are three aspects to using Sandboxie programmatically:

The entrypoints described here are all exported by SbieDll.dll. To access an entrypoint, you should dynamically load this DLL into your program, and get the address of the desired entrypoint. For example,

        __declspec(dllexport) void __stdcall InjectDllMain(HINSTANCE hSbieDll, ULONG_PTR UnusedParameter)
	{
		//
	        // locate the address of SbieDll_Hook in SbieDll.dll
	        //	

	        typedef void *(__stdcall *P_SbieDll_Hook)(
	                const char *ApiName, void *ApiFunc, void *NewFunc);	

	        P_SbieDll_Hook p_SbieDll_Hook = GetProcAddress(hSbieDll, "SbieDll_Hook");	

		//
	        // invoke SbieDll_Hook through the function pointer
	        //	

	        p_SbieDll_Hook(...);
	}	

Note the use of InjectDllMain (see Inject Dll) to get a handle to the loaded instance of SbieDll. That is the recommended approach. However, using LoadLibrary or GetModuleHandle to look up SbieDll by name is also fine.


Enumerate Sandbox Names

        WCHAR name[34];
        int index = -1;
        while (1) {
                index = SbieApi_EnumBoxes(index, name);
                if (index == -1)
                    break;
                SandboxNames_StringArray.add(name);
        }

Query Sandbox Paths by Sandbox Name


Query Sandbox Paths by Process ID


Enumerate Running Processes


Query Process Information


Terminate a Single Sandboxed Process


Terminate All Sandboxed Processes


Query Configuration from Sandboxie.ini


Update Configuration in Sandboxie.ini


Reload Configuration from Sandboxie.ini


Hook a User-Mode Entrypoint


Register for DLL Load/Unload Callbacks

       typedef BOOLEAN *(__stdcall *P_SbieDll_RegisterDllCallback)(
		       P_DllCallback pCallback);
       The ImageName (first) parameter to the callback function
       specifies the UNICODE name string for the DLL that was loaded
       or unloaded.  The name string does not include a path.
       The ImageBase (second) parameter to the callback function
       specifies the load base address for the DLL, when the callback
       function is invoked to notify of a DLL load.  When the callback
       function is invoked to notify of a DLL unload, this parameter
       is set to zero.

Get Sandboxie Home Folder