[misc] add arbitrary buffer allocation to GetResource()

* If duplicate is TRUE and len is non-zero, then a buffer of len size,
  padded with zeroes, is allocated for the resource.
This commit is contained in:
Pete Batard 2020-02-19 12:41:13 +00:00
parent 841b79f45d
commit b8579c04da
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
6 changed files with 27 additions and 12 deletions

View file

@ -2,7 +2,7 @@
*
* Copyright 2003 Lars Munch Christensen - All Rights Reserved
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
* Copyright 2012-2018 Pete Batard
* Copyright 2012-2020 Pete Batard
*
* Based on the Linux installer program for SYSLINUX by H. Peter Anvin
*
@ -185,6 +185,7 @@ BOOL InstallSyslinux(DWORD drive_index, char drive_letter, int file_system)
} else {
for (i=0; i<2; i++) {
static_sprintf(tmp, "%s.%s", ldlinux, ldlinux_ext[i]);
syslinux_ldlinux_len[i] = 0;
syslinux_ldlinux[i] = GetResource(hMainInstance, resource[use_v5?1:0][i],
_RT_RCDATA, tmp, &syslinux_ldlinux_len[i], TRUE);
if (syslinux_ldlinux[i] == NULL)