![]() |
![]() |
![]() |
Home | BoxedApp SDK | Download | Buy now! | Support | Forum | Testimonials | Blog ![]() |
|
What is BoxedApp SDK? BoxedApp SDK is a DLL that provides a set of functions for emulating a file system and a system registry for an application. Using these functions, you can create virtual files, fake registry entries, keys and values.
Why and when is it useful?
Just a quick example: suppose, your application uses a Flash ActiveX player to display a Flash movie or video. The end users would need a Flash player ActiveX to allow your application work properly. Also, keep in mind that Flash player is not capable of loading files directly from memory. That exposes two major problems: first, you would have to install a Flash player ActiveX, and second, you would have to have the movie in a file. BoxedApp SDK solves these problems: you simply create a virtual file that contains the flash movie, another virtual file that contains the Flash player ActiveX DLL, and virtual registry entries that point to that virtual file. That's it. Now the application "thinks" that that the Flash player ActiveX is actually installed, so the Flash player works just as if the movie file was actually there. In other words, you can now embed all DLL and content files, all ActiveX and OCX components, which your application uses, into a single EXE file. BoxedApp SDK doesn't unpack these files to disk; it doesn't use temporary files either. Would like to see BoxedApp SDK in action? Download the demo right now! It includes many examples:
Features
Creating Virtual Files Here's an example of how to create a virtual file: [ C++ ]
HANDLE hVirtualFile =
BoxedAppSDK_CreateVirtualFile(
_T("C:\\1.swf"),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
CREATE_NEW,
0,
NULL);
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);
DWORD dwTemp;
WriteFile(hVirtualFile, lpData, dwSize, &dwTemp, NULL);
CloseHandle(hVirtualFile);
Back to top | Ask a question
Creating Virtual Registry Keys Here's an example of how to create a virtual registry entry: [ C++ ]
// Create hKey_Classes to work well even under registry reflection
HKEY hKey_Classes;
RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), &hKey_Classes);
HKEY hVirtualKey;
DWORD dwDisposition;
LONG lResult =
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey,
&dwDisposition
);
HKEY hVirtualKey__10;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10,
&dwDisposition
);
TCHAR buf[1024] = _T("Shockwave Flash");
RegSetValueEx(hVirtualKey__10, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
Back to top | Ask a question
Embedding DLL Here's an example of how to embed a DLL and use it: [ C++ ]
HANDLE hFile__DLL1 =
BoxedAppSDK_CreateVirtualFile(
_T("Z:\\DLL1.dll"),
GENERIC_WRITE,
FILE_SHARE_READ,
NULL,
CREATE_NEW,
0,
NULL
);
DWORD dwTemp;
WriteFile(hFile__DLL1, pBuffer, dwSize, &dwTemp, NULL);
CloseHandle(hFile__DLL1);
// ...
HMODULE hModule = LoadLibrary(_T("Z:\\DLL1.dll"));
typedef void (WINAPI *P_Function)();
P_Function pFunction = (P_Function)GetProcAddress(hModule, "Function");
pFunction();
FreeLibrary(hModule);
Back to top | Ask a question
Embedding ActiveX / OCX Here's an example of how to embed an ActiveX into application (click on "expand source" to view the sources): [ C++ ]
void CreateVirtualFlashOCX()
{
{
LPVOID pBuffer;
DWORD dwSize;
LoadResourceHelper(MAKEINTRESOURCE(IDR_BIN_FLASH_OCX), _T("BIN"), pBuffer, dwSize);
HANDLE hVirtualFile1 =
BoxedAppSDK_CreateVirtualFile(
_T("C:\\Flash9e.ocx"),
GENERIC_READ,
FILE_SHARE_READ,
NULL,
CREATE_NEW,
0,
NULL);
DWORD dwTemp;
WriteFile(hVirtualFile1, pBuffer, dwSize, &dwTemp, NULL);
CloseHandle(hVirtualFile1);
}
{
HKEY hVirtualKey;
DWORD dwDisposition;
LONG lResult =
BoxedAppSDK_CreateVirtualRegKey(
HKEY_CLASSES_ROOT,
_T("CLSID\\{D27CDB6E-AE6D-11cf-96B8-444553540000}"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey,
&dwDisposition
);
{
TCHAR buf[1024] = _T("Shockwave Flash Object");
RegSetValueEx(hVirtualKey, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__Control;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("Control"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__Control,
&dwDisposition
);
HKEY hVirtualKey__InprocServer32;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("InprocServer32"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__InprocServer32,
&dwDisposition
);
{
TCHAR buf[1024] = _T("C:\\Flash9e.ocx");
RegSetValueEx(hVirtualKey__InprocServer32, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
{
TCHAR buf[1024] = _T("Apartment");
RegSetValueEx(hVirtualKey__InprocServer32, _T("ThreadingModel"), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__MiscStatus;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("MiscStatus"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__MiscStatus,
&dwDisposition
);
{
TCHAR buf[1024] = _T("0");
RegSetValueEx(hVirtualKey__MiscStatus, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__MiscStatus_1;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey__MiscStatus,
_T("1"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__MiscStatus_1,
&dwDisposition
);
{
DWORD dwValue = 131473;
RegSetValueEx(hVirtualKey__MiscStatus_1, _T(""), 0, REG_DWORD, (CONST BYTE*)&dwValue, sizeof(dwValue));
}
HKEY hVirtualKey__ProgID;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("ProgID"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__ProgID,
&dwDisposition
);
{
TCHAR buf[1024] = _T("ShockwaveFlash.ShockwaveFlash.9");
RegSetValueEx(hVirtualKey__ProgID, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__Programmable;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("Programmable"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__Programmable,
&dwDisposition
);
HKEY hVirtualKey__TypeLib;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("TypeLib"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__TypeLib,
&dwDisposition
);
{
TCHAR buf[1024] = _T("{D27CDB6B-AE6D-11cf-96B8-444553540000}");
RegSetValueEx(hVirtualKey__TypeLib, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__Version;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("Version"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__Version,
&dwDisposition
);
{
TCHAR buf[1024] = _T("1.0");
RegSetValueEx(hVirtualKey__Version, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__VersionIndependentProgID;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey,
_T("VersionIndependentProgID"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__VersionIndependentProgID,
&dwDisposition
);
{
TCHAR buf[1024] = _T("ShockwaveFlash.ShockwaveFlash");
RegSetValueEx(hVirtualKey__VersionIndependentProgID, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
}
{
// Create hKey_Classes to work well even under registry reflection
HKEY hKey_Classes;
RegOpenKey(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), &hKey_Classes);
HKEY hVirtualKey;
DWORD dwDisposition;
LONG lResult =
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey,
&dwDisposition
);
HKEY hVirtualKey__10;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10,
&dwDisposition
);
{
TCHAR buf[1024] = _T("Shockwave Flash");
RegSetValueEx(hVirtualKey__10, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__10_0;
lResult =
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0\\0"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10_0,
&dwDisposition
);
HKEY hVirtualKey__10_FLAGS;
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0\\FLAGS"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10_FLAGS,
&dwDisposition
);
HKEY hVirtualKey__10_HELPDIR;
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0\\HELPDIR"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10_HELPDIR,
&dwDisposition
);
{
TCHAR buf[1024] = _T("C:\\");
RegSetValueEx(hVirtualKey__10_HELPDIR, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__10_0_win32;
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("Typelib\\{D27CDB6B-AE6D-11CF-96B8-444553540000}\\1.0\\0\\win32"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__10_0_win32,
&dwDisposition
);
{
TCHAR buf[1024] = _T("C:\\Flash9e.ocx");
RegSetValueEx(hVirtualKey__10_0_win32, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__2;
BoxedAppSDK_CreateVirtualRegKey(
hKey_Classes,
_T("ShockwaveFlash.ShockwaveFlash.9"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__2,
&dwDisposition
);
{
TCHAR buf[1024] = _T("Shockwave Flash Object");
RegSetValueEx(hVirtualKey__2, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
HKEY hVirtualKey__3;
BoxedAppSDK_CreateVirtualRegKey(
hVirtualKey__2,
_T("CLSID"),
0,
NULL,
REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS,
NULL,
&hVirtualKey__3,
&dwDisposition
);
{
TCHAR buf[1024] = _T("{D27CDB6E-AE6D-11cf-96B8-444553540000}");
RegSetValueEx(hVirtualKey__3, _T(""), 0, REG_SZ, (CONST BYTE*)buf, (lstrlen(buf) + 1) * sizeof(TCHAR));
}
}
}
Back to top | Ask a question
|
|
Copyright © 2004 – 2008 Softanics. All rights reserved. BoxedApp is a trademark of Softanics Designed by SoftFacade |