mirror of
https://github.com/pbatard/rufus.git
synced 2025-05-24 19:54:25 -04:00
[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:
parent
bba1772940
commit
647d9f18ad
12 changed files with 860 additions and 233 deletions
34
src/stdfn.c
34
src/stdfn.c
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue