Solved

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

Posted on 2008-10-06
6
790 Views
Last Modified: 2013-11-26
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
Comment
Question by:willywillycat
  • 5
6 Comments
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 22664786
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
 

Author Comment

by:willywillycat
ID: 22689352
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
 

Accepted Solution

by:
willywillycat earned 0 total points
ID: 22797044
problem not resolved.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:willywillycat
ID: 22797049
problem not resolved
0
 

Author Comment

by:willywillycat
ID: 22797050
problem not resolved
0
 

Author Comment

by:willywillycat
ID: 22797077
problem not resolved
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to use laptop or pad camera in vb.net windows application 2 70
ASP.NET MVC 2 31
.NET 2008 VB and C# 6 27
VB.Net - MemoryMappedFiles - Confirm receipt 2 18
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question