lpBuffer is a pointer to the first byte of a (binary)resource. How can I execute it straight away without dumping it to a temporary file?
HMODULE hLibrary;
HRSRC hResource;
HGLOBAL hResourceLoaded;
LPBYTE lpBuffer;
hLibrary = LoadLibrary("C:\\xyz.exe");
if (NULL != hLibrary)
{
hResource = FindResource(hLibrary, MAKEINTRESOURCE(104), RT_RCDATA);
if (NULL != hResource)
{
hResourceLoaded = LoadResource(hLibrary, hResource);
if (NULL != hResourceLoaded)
{
lpBuffer = (LPBYTE) LockResource(hResourceLoaded);
if (NULL != lpBuffer)
{
// do something with lpBuffer here
}
}
}
FreeLibrary(hLibrary);
}