[misc] refactoring and cleanup - part 2

* add GetResource() function call to handle resource loading and
  revert 98ff7a931a
* add separate BootCheck() call
* better handling of passes tooltip
* remove superfluous backslashes
* fix standalone EFI support
* add GPL v3 license file and update README.txt
This commit is contained in:
Pete Batard 2013-01-25 01:38:10 +00:00
parent bba1772940
commit 647d9f18ad
12 changed files with 860 additions and 233 deletions

View file

@ -231,6 +231,40 @@ out:
return ret;
}
unsigned char* GetResource(HMODULE module, char* name, char* type, const char* desc, DWORD* len, BOOL duplicate)
{
HGLOBAL res_handle;
HRSRC res;
unsigned char* p = NULL;
res = FindResourceA(module, name, type);
if (res == NULL) {
uprintf("Unable to locate resource '%s': %s\n", desc, WindowsErrorString());
goto out;
}
res_handle = LoadResource(module, res);
if (res_handle == NULL) {
uprintf("Unable to load resource '%s': %s\n", desc, WindowsErrorString());
goto out;
}
*len = SizeofResource(module, res);
if (duplicate) {
p = (unsigned char*)malloc(*len);
if (p == NULL) {
uprintf("Unable to allocate ldlinux.sys resource\n");
goto out;
}
memcpy(p, LockResource(res_handle), *len);
} else {
p = (unsigned char*)LockResource(res_handle);
}
out:
return p;
}
/*
* Set or restore a Local Group Policy DWORD key indexed by szPath/SzPolicy
*/