Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 963
  • Last Modified:

EndUpdateResource .. failed to add resource to a file but no error was returned.

When I call beginupdateresource updateresource. endupdateresource to add several large data (some times over 400.000.000 bytes)
   1. each uses it's own resource id number
   2. use the same szType
   to  myfile.exe
The finished product does not always contain all the resources. Some time it will missing some resource
but there is no error ever generated when the resource is building.
Just wonder is there a limit on the resource file size ?
Is it possible to break up the data into smaller chuck but can still be read and share the same resource id ?


the szType is defined as "resfiles"
 
      hUpdateRes = BeginUpdateResource("myfile.exe", FALSE);
	if (hUpdateRes == NULL) 
	{ 
		error =GetLastError());
		return FALSE;
	}
	result = UpdateResource(hUpdateRes,			// update resource handle 
		szType,			// resource type to change
		MAKEINTRESOURCE(nID),			// resource id to change
		MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),  // neutral language
		srcData,                   // ptr to resource info 
		dwSize); // size of resource info.
 
	if (result == FALSE) 
	{ 
		error =GetLastError());
		return FALSE;
	}		
	
	if (!EndUpdateResource(hUpdateRes, FALSE))
	{ 	error =GetLastError()); 
		return FALSE;		
	}

Open in new window

0
willywillycat
Asked:
willywillycat
  • 5
1 Solution
 
itsmeandnobodyelseCommented:
MSDN says for UpdateResource:

---------------------------------------------
lpData
Pointer to the resource data to be inserted into the executable file. If the resource is one of the predefined types, the data must be valid and properly aligned. Note that this is the raw binary data stored in the executable file, not the data provided by LoadIcon,LoadString, or other resource-specific load functions. All data containing strings or text must be in Unicode format; lpData must not point to ANSI data.
----------------------------------------------

I wonder whether your texts added were UNICODE as required. I also wonder whether it is zero-terminated strings as it was required as well.

Can you tell why you need to store data in the resource part of an executable? Actually the UpdateResource wasn't made for runtime-updates but for editing the resources of an executable after built, e. g. for language customization, not needing to relink the executable.
0
 
willywillycatAuthor Commented:
The files that I am trying to add are 2 zip files. 1 with size of 280000kb and the other 405000kb which are all binary format.
On both of my test machines which has 2 G memory and 30G empty disk space won't.
No idea as why. I defreg my machines and increased page size to 4096Kb and still not being able to.
Seems the endupdateresource will add only 1 file for me,  and the 2nd file will not. No error message were returned for getlasterror() and return value of function indicating a success.
0
 
willywillycatAuthor Commented:
problem not resolved.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
willywillycatAuthor Commented:
problem not resolved
0
 
willywillycatAuthor Commented:
problem not resolved
0
 
willywillycatAuthor Commented:
problem not resolved
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now