<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>BoxedApp Blog &#187; BoxedApp Packer Release</title>
	<atom:link href="http://boxedapp.com/blog/category/boxedapp-packer-release/feed/" rel="self" type="application/rss+xml" />
	<link>http://boxedapp.com/blog</link>
	<description>BoxedApp: Tips'n'Tricks, Examples, Use Cases etc.</description>
	<pubDate>Mon, 03 May 2010 17:36:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>BoxedApp SDK 2.1, BoxedApp Packer 2.2</title>
		<link>http://boxedapp.com/blog/2009/06/16/boxedapp-sdk-21-boxedapp-packer-22/</link>
		<comments>http://boxedapp.com/blog/2009/06/16/boxedapp-sdk-21-boxedapp-packer-22/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 15:31:51 +0000</pubDate>
		<dc:creator>Artem A. Razin</dc:creator>
		
		<category><![CDATA[BoxedApp Packer]]></category>

		<category><![CDATA[BoxedApp Packer Release]]></category>

		<category><![CDATA[BoxedApp SDK]]></category>

		<category><![CDATA[BoxedApp SDK Release]]></category>

		<category><![CDATA[C++]]></category>

		<category><![CDATA[Delphi]]></category>

		<category><![CDATA[examples]]></category>

		<category><![CDATA[use cases]]></category>

		<guid isPermaLink="false">http://boxedapp.com/blog/?p=14</guid>
		<description><![CDATA[Released new versions of products of the BoxedApp series: BoxedApp SDK 2.1, BoxedApp Packer 2.2.
[ Download demo versions ]


Briefly on what has been done:

Virtual registry editor in BoxedApp Packer
API for intercepting functions
Minor improvements


Virtual registry editor in BoxedApp Packer
Formerly, all virtual registry operations were carried out in users’ plugins. If it was required to create even [...]]]></description>
			<content:encoded><![CDATA[<p>Released new versions of products of the BoxedApp series: BoxedApp SDK 2.1, BoxedApp Packer 2.2.<br />
<a href = "/download.html" target = "_blank"><b>[ Download demo versions ]</b></a><br />
<a name = "post_begin"></a><br />
<span id="more-14"></span><br />
Briefly on what has been done:</p>
<ul>
<li><a href = "#virtual_registry_editor">Virtual registry editor in BoxedApp Packer</a></li>
<li><a href = "#hooks">API for intercepting functions</a></li>
<li><a href = "#minor_changes">Minor improvements</a></li>
</ul>
<p><a name = "virtual_registry_editor"></a><br />
<h2>Virtual registry editor in BoxedApp Packer</h2>
<p>Formerly, all virtual registry operations were carried out in users’ plugins. If it was required to create even a single virtual registry key, one needed to create a plugin, which would use <a href = "http://boxedapp.com/boxedapppacker/help/index/plugin_api.html" target = "_blank">the BoxedApp SDK functions</a>.</p>
<p>Now BoxedApp Packer contains a full-fledged virtual registry editor. Literally with a couple of mouse clicks you can create the virtual keys you need and specify the parameter values.</p>
<p><small><a href = "#post_begin">[ back to top ]</a></small><br />
<a name = "hooks"></a><br />
<h2>API for intercepting functions</h2>
<p>To create a virtual file system / registry, BoxedApp SDK (this, by the way, is exactly what applications created with BoxedApp Packer use) uses the interception of system functions technique. A number of original ideas have allowed us to create an interception system compatible with any environment, and now the part of SDK that is in charge of the interception has become accessible to developers – SDK users.</p>
<p>Now BoxedApp SDK can be considered as a full-value alternative to <a href = "http://research.microsoft.com/en-us/projects/detours/" target = "_blank">Microsoft’s Detours</a>.</p>
<p>Be reminded that BoxedApp SDK supports 32-bit and 64-bit environments and also can be statically linked to applications that use VC++ / Delphi of any versions. And, of course, SDK can be used in any development environment that supports the use of DLL.</p>
<p>A couple of examples in C++ and Delphi that disable creating and opening the file named &#8220;1.txt&#8221;:</p>
<pre name="code" class="cpp" cols="35" rows="10">
typedef HANDLE (WINAPI *P_CreateFileW)(
	LPCWSTR lpFileName,
	DWORD dwDesiredAccess,
	DWORD dwShareMode,
	LPSECURITY_ATTRIBUTES lpSecurityAttributes,
	DWORD dwCreationDisposition,
	DWORD dwFlagsAndAttributes,
	HANDLE hTemplateFile);
P_CreateFileW g_pCreateFileW;

HANDLE WINAPI My_CreateFileW(
	LPCWSTR lpFileName,
	DWORD dwDesiredAccess,
	DWORD dwShareMode,
	LPSECURITY_ATTRIBUTES lpSecurityAttributes,
	DWORD dwCreationDisposition,
	DWORD dwFlagsAndAttributes,
	HANDLE hTemplateFile)
{
	if (0 == lstrcmpiW(lpFileName, L"1.txt"))
	{
		SetLastError(ERROR_FILE_EXISTS);
		return INVALID_HANDLE_VALUE;
	}
	else
		return g_pCreateFileW(
				lpFileName,
				dwDesiredAccess,
				dwShareMode,
				lpSecurityAttributes,
				dwCreationDisposition,
				dwFlagsAndAttributes,
				hTemplateFile);
}
...
BoxedAppSDK_Init();

PVOID pCreateFileW = GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "CreateFileW");

HANDLE hHook__CreateFileW = BoxedAppSDK_HookFunction(pCreateFileW, &#038;My_CreateFileW, TRUE);

g_pCreateFileW = (P_CreateFileW)BoxedAppSDK_GetOriginalFunction(hHook__CreateFileW);

FILE* f = fopen("1.txt", "r");

// f is NULL
...

BoxedAppSDK_UnhookFunction(hHook__CreateFileW);
</pre>
<p>Delphi version of the same idea:</p>
<pre name="code" class="delphi" cols="35" rows="10">
type
TCreateFileW = 
   function(lpFileName: PWideChar;
            dwDesiredAccess, dwShareMode: Integer;
            lpSecurityAttributes: PSecurityAttributes;
            dwCreationDisposition, dwFlagsAndAttributes: DWORD;
            hTemplateFile: THandle): THandle; stdcall;

var
   OriginalCreateFileW: TCreateFileW;

function My_CreateFileW(
         lpFileName: PWideChar;
         dwDesiredAccess, dwShareMode: Integer;
         lpSecurityAttributes: PSecurityAttributes;
         dwCreationDisposition, dwFlagsAndAttributes: DWORD;
         hTemplateFile: THandle): THandle; stdcall;
begin
   if 0 = lstrcmpiW(lpFileName, '1.txt') then
   begin
      Result := INVALID_HANDLE_VALUE;
      SetLastError(ERROR_ALREADY_EXISTS);
   end
   else
      Result := 
        OriginalCreateFileW(
           lpFileName, 
           dwDesiredAccess,
           dwShareMode, 
           lpSecurityAttributes, 
           dwCreationDisposition, 
           dwFlagsAndAttributes, 
           hTemplateFile);
end;

var
   pCreateFileW: Pointer;
   hHook__CreateFileW: THandle;

begin
  Application.Initialize;

  BoxedAppSDK_Init;

  pCreateFileW := GetProcAddress(GetModuleHandle('kernel32.dll'), 'CreateFileW');
  hHook__CreateFileW := BoxedAppSDK_HookFunction(pCreateFileW, @My_CreateFileW, TRUE);
  OriginalCreateFileW := BoxedAppSDK_GetOriginalFunction(hHook__CreateFileW);

  // This line produces an exception because we prevent creating / opening '1.txt'
  TFileStream.Create('1.txt', fmCreate or fmOpenRead);

  BoxedAppSDK_UnhookFunction(hHook__CreateFileW);
end.
</pre>
<p><small><a href = "#post_begin">[ back to top ]</a></small><br />
<a name = "minor_changes"></a><br />
<h2>Minor improvements</h2>
<ul>
<li>Added support for the FILE_FLAG_DELETE_ON_CLOSE flag for virtual files</li>
<li>Fixed minor problems with launching virtual executable files created with Delphi</li>
<li>Created a more flexible system for storing virtual files in the memory</li>
</ul>
<p><small><a href = "#post_begin">[ back to top ]</a></small></p>
<p><a href = "/download.html" target = "_blank"><b>[ Download demo versions ]</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://boxedapp.com/blog/2009/06/16/boxedapp-sdk-21-boxedapp-packer-22/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Launching .NET Applications From Memory</title>
		<link>http://boxedapp.com/blog/2009/04/10/launching-net-applications-from-memory/</link>
		<comments>http://boxedapp.com/blog/2009/04/10/launching-net-applications-from-memory/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 12:38:01 +0000</pubDate>
		<dc:creator>Artem A. Razin</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[BoxedApp Packer]]></category>

		<category><![CDATA[BoxedApp Packer Release]]></category>

		<category><![CDATA[BoxedApp SDK]]></category>

		<category><![CDATA[BoxedApp SDK Release]]></category>

		<category><![CDATA[C++]]></category>

		<category><![CDATA[examples]]></category>

		<category><![CDATA[use cases]]></category>

		<guid isPermaLink="false">http://boxedapp.com/blog/?p=12</guid>
		<description><![CDATA[We&#8217;ve issued new update of the BoxedApp SDK and BoxedApp Packer, which includes new function BoxedAppSDK_ExecuteDotNetApplication:

DWORD BoxedAppSDK_ExecuteDotNetApplication(LPCTSTR szPath, LPCTSTR szArgs);

[ Download demo version ]
You can launch .net applications from a virtual location (from a real file too, of course). One customer needed to launch FxCop from a memory. We&#8217;ve fixed a issue related with FxCop [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve issued new update of the BoxedApp SDK and BoxedApp Packer, which includes <span id="more-12"></span>new function <a href = "http://boxedapp.com/boxedappsdk/help/index/functions/boxedappsdk_executedotnetapplication.html" target = "_blank">BoxedAppSDK_ExecuteDotNetApplication</a>:</p>
<pre name="code" class="cpp" cols="35" rows="10">
DWORD BoxedAppSDK_ExecuteDotNetApplication(LPCTSTR szPath, LPCTSTR szArgs);
</pre>
<p><a href = "/download.html" target = "_blank"><b>[ Download demo version ]</b></a></p>
<p>You can launch .net applications from a virtual location (from a real file too, of course). <a href = "http://boxedapp.com/forum/viewtopic.php?f=3&#038;t=41" target = "_blank">One customer needed</a> to launch <a href = "http://www.microsoft.com/downloads/details.aspx?familyid=3389F7E4-0E55-4A4D-BC74-4AEABB17997B&#038;displaylang=en" target = "_blank">FxCop</a> from a memory. We&#8217;ve fixed a issue related with FxCop and&#8230; and we decided to provide a special function that runs a .net application within current process, BoxedAppSDK_ExecuteDotNetApplication.</p>
<p>Here a simple example of how to launch FxCop from a virtual location in C++:</p>
<pre name="code" class="cpp" cols="35" rows="10">
   BoxedAppSDK_Init();

   HANDLE
   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\FxCop.exe"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\" #name ,\
"Z:\\FxCop\\" #name , FALSE);
   DEF_COPY(CustomDictionary.xml);
   DEF_COPY(FxCop.exe);
   DEF_COPY(FxCop.exe.config);
   DEF_COPY(FxCopCmd.exe);
   DEF_COPY(FxCopCmd.exe.config);
   DEF_COPY(FxCopCommon.dll);
   DEF_COPY(FxCopSdk.dll);
   DEF_COPY(FxCopUI.dll);
   DEF_COPY(Microsoft.Cci.dll);
   DEF_COPY(MSSp3en.lex);
   DEF_COPY(MSSp3ena.lex);
   DEF_COPY(MSSpell3.dll);

   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\Engines\\IntrospectionAnalysisEngine.dll"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) \ 
CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\Engines\\" #name ,\
 "Z:\\FxCop\\Engines\\" #name , FALSE);
   DEF_COPY(IntrospectionAnalysisEngine.dll);
   DEF_COPY(IntrospectionForms.dll);

   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\Repository\\system32.bin"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) \
CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\Repository\\" #name ,\
 "Z:\\FxCop\\Repository\\" #name , FALSE);
   DEF_COPY(system32.bin);

   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\Repository\\Compatibility\\Desktop2.0.xml"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) \
CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\Repository\\Compatibility\\" #name ,\
 "Z:\\FxCop\\Repository\\Compatibility\\" #name , FALSE);
   DEF_COPY(Desktop2.0.xml);
   DEF_COPY(Desktop2.0SP1.xml);
   DEF_COPY(Desktop2.0SP2.xml);
   DEF_COPY(Desktop3.0.xml);
   DEF_COPY(Desktop3.0SP1.xml);
   DEF_COPY(Desktop3.0SP2.xml);
   DEF_COPY(Desktop3.5.xml);
   DEF_COPY(Desktop3.5SP1.xml);

   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\Rules\\DesignRules.dll"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) \
CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\Rules\\" #name , "Z:\\FxCop\\Rules\\" #name , FALSE);
   DEF_COPY(DesignRules.dll);
   DEF_COPY(GlobalizationRules.dll);
   DEF_COPY(InteroperabilityRules.dll);
   DEF_COPY(MobilityRules.dll);
   DEF_COPY(NamingRules.dll);
   DEF_COPY(PerformanceRules.dll);
   DEF_COPY(PortabilityRules.dll);
   DEF_COPY(SecurityRules.dll);
   DEF_COPY(UsageRules.dll);

   hFile = 
   BoxedAppSDK_CreateVirtualFile( 
      _T("Z:\\FxCop\\Xml\\CodeAnalysisReport.xsl"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_ALWAYS, 
      0, 
      NULL 
   );
#define DEF_COPY(name) \
CopyFileA("C:\\Program Files\\Microsoft FxCop 1.36\\Xml\\" #name , "Z:\\FxCop\\Xml\\" #name , FALSE);
   DEF_COPY(CodeAnalysisReport.xsl);
   DEF_COPY(FxCopReport.xsd);
   DEF_COPY(FxCopReport.xsl);
   DEF_COPY(FxCopReportExcludes.xsl);
   DEF_COPY(FxCopRichConsoleOutput.xsl);
   DEF_COPY(VSConsoleOutput.xsl);

BoxedAppSDK_ExecuteDotNetApplication(_T("Z:\\FxCop\\FxCopCmd.exe"), _T("/o:out.txt /p:FxCopProject.FxCop"));
</pre>
<p><a href = "/download.html" target = "_blank"><b>[ Download demo version ]</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://boxedapp.com/blog/2009/04/10/launching-net-applications-from-memory/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BoxedApp SDK 2.0.1, BoxedApp Packer 2.1.1</title>
		<link>http://boxedapp.com/blog/2009/01/31/boxedapp-sdk-201-boxedapp-packer-211/</link>
		<comments>http://boxedapp.com/blog/2009/01/31/boxedapp-sdk-201-boxedapp-packer-211/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 11:29:58 +0000</pubDate>
		<dc:creator>Artem A. Razin</dc:creator>
		
		<category><![CDATA[BoxedApp Packer]]></category>

		<category><![CDATA[BoxedApp Packer Release]]></category>

		<category><![CDATA[BoxedApp SDK]]></category>

		<category><![CDATA[BoxedApp SDK Release]]></category>

		<guid isPermaLink="false">http://boxedapp.com/blog/?p=11</guid>
		<description><![CDATA[We&#8217;ve tested BoxedApp under new Windows from MS, Windows 7. A few issues found and fixed.
[FIXED] ShellExecute doesn&#8217;t run virtual EXE under Windows 7
[FIXED] ActiveX registering in a virtual registry may not work properly under Windows 7
A small fix for all Windows:
[FIXED] Launching a lot of child processes cause memory and handles leak
New feature of [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve tested BoxedApp under new Windows from MS, Windows 7. A few issues found and fixed.</p>
<p>[FIXED] ShellExecute doesn&#8217;t run virtual EXE under Windows 7<br />
[FIXED] ActiveX registering in a virtual registry may not work properly under Windows 7</p>
<p>A small fix for all Windows:</p>
<p>[FIXED] Launching a lot of child processes cause memory and handles leak</p>
<p>New feature of the BoxedApp Packer:</p>
<p>[NEW] <a href = "/boxedapppacker/help/index/overview/virtual_path.html" target = "_blank">Environment variables are supported in a virtual path.</a></p>
<p><a href = "/download.html" target = "_blank"><b>[ Download demo version ]</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://boxedapp.com/blog/2009/01/31/boxedapp-sdk-201-boxedapp-packer-211/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BoxedApp SDK 2.0, BoxedApp Packer 2.1</title>
		<link>http://boxedapp.com/blog/2009/01/28/boxedapp-sdk-20-boxedapp-packer-21/</link>
		<comments>http://boxedapp.com/blog/2009/01/28/boxedapp-sdk-20-boxedapp-packer-21/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 14:19:20 +0000</pubDate>
		<dc:creator>Artem A. Razin</dc:creator>
		
		<category><![CDATA[BoxedApp Packer]]></category>

		<category><![CDATA[BoxedApp Packer Release]]></category>

		<category><![CDATA[BoxedApp SDK]]></category>

		<category><![CDATA[BoxedApp SDK Release]]></category>

		<guid isPermaLink="false">http://boxedapp.com/blog/?p=10</guid>
		<description><![CDATA[Finally, we have made available the new releases with two extremely interesting features:

launching a virtual file-based process
shared virtual file system for several processes



Launching a virtual file-based process
Briefly, having created a virtual file with an embedded exe, you can launch a process upon that file:

BoxedAppSDK_Init();

HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, _T("BIN1"), _T("BIN"));
HGLOBAL hResData = LoadResource(hModule, [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, we have made available the new releases with two extremely interesting features:</p>
<ul>
<li><a href = "#virtual_process">launching a virtual file-based process</a></li>
<li><a href = "#shared_env">shared virtual file system for several processes</a></li>
</ul>
<p><span id="more-10"></span></p>
<p><a name = "virtual_process"></a></p>
<h3>Launching a virtual file-based process</h3>
<p>Briefly, having created a virtual file with an embedded exe, you can launch a process upon that file:</p>
<pre name="code" class="cpp" cols="35" rows="10">
BoxedAppSDK_Init();

HMODULE hModule = GetModuleHandle(NULL);
HRSRC hResInfo = FindResource(hModule, _T("BIN1"), _T("BIN"));
HGLOBAL hResData = LoadResource(hModule, hResInfo);
LPVOID lpData = LockResource(hResData);
DWORD dwSize = SizeofResource(hModule, hResInfo);

HANDLE hFile = 
   BoxedAppSDK_CreateVirtualFile(
      _T("app1.exe"), 
      GENERIC_WRITE, 
      FILE_SHARE_READ, 
      NULL, 
      CREATE_NEW, 
      0, 
      NULL);

DWORD temp;
WriteFile(hFile, lpData, dwSize, &#038;temp, NULL);

CloseHandle(hFile);

ShellExecute(NULL, NULL, _T("app1.exe"), NULL, NULL, SW_SHOW);
</pre>
</p>
<p><a name = "shared_env"></a></p>
<h3>Shared virtual file system for several processes</h3>
<p>Prior to this, BoxedApp SDK was limited by a single process; however, we have received numerous requests, the summarized idea of which was to allow third-party applications to access the virtual files created in the original process.</p>
<p>We have improved BoxedApp, by having added the <a href = "http://boxedapp.com/boxedappsdk/help/index/functions/boxedappsdk_attachtoprocess.html" target = "_blank">BoxedAppSDK_AttachToProcess</a> function, which embeds BoxedApp in the process. Once has been embedded, the process can see all virtual files, which have been or are being created in the main process. It can modify them, etc. In other words, the both processes have the full access to the shared virtual file system. BoxedAppSDK_AttachToProcess can be called for several processes at once, and all of them would have the same file system.</p>
<p>Besides that, we have added the DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES option, which specifies whether or not BoxedApp is to be embedded in each child process (<b>by default this option is disabled</b>) created in the application:</p>
<pre name="code" class="cpp" cols="35" rows="10">
// yes, embed in child processes
BoxedAppSDK_EnableOption(DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES, TRUE);
...
// no, do not embed in child processes
BoxedAppSDK_EnableOption(DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES, FALSE);
</pre>
</p>
<p><a href = "/download.html" target = "_blank"><b>[ Download the DEMO versions ]</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://boxedapp.com/blog/2009/01/28/boxedapp-sdk-20-boxedapp-packer-21/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
