Jump to content

  • Log In with Google      Sign In   
  • Create Account


Resource DLL problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 LancerSolurus   Members   -  Reputation: 480

Like
0Likes
Like

Posted 17 February 2012 - 01:08 AM

I am currently trying to add strings to an empty dll using the BeginUpdateResource, UpdateResource & EndUpdateResource without any luck. I've been hunting the web for several hours but all of the examples simply change an existing resource string, which is not what I need to do.

Using:
VC 2005 SP1
Win 7/Vista
C++ with MFC

HANDLE hdll;
DWORD dsz;
BOOL rv;
size_t osz,csz,nsz;
wchar_t *data;
CString d1,d2,tmp;
// set up data to test with
tmp="Test data.";
osz=(size_t)tmp.GetLength()+1;
csz=0;
nsz=osz*2;
data = new wchar_t [nsz];
mbstowcs_s(&csz,data,osz,tmp,_TRUNCATE);
dsz=sizeof(data);
// copy and paste blank.dll
d1=WorkFldr+"Blank.dll";
d2=WorkFldr+"Generated.dll";
DBFIO.CopyFiles(d1,d2);	 // make copy of empty dll
// update resource entry
hdll=BeginUpdateResource(d2,FALSE);
if(hdll==NULL) {
	 AfxMessageBox("BeginUpdateResource failed");
	 goto ex;
}
rv=UpdateResource(hdll,
	 RT_STRING,
	 MAKEINTRESOURCE(2),
	 MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),
	 &data,
	 dsz);
if(rv==FALSE) {
	 AfxMessageBox("UpdateResource failed");
	 goto ex;
}
rv=EndUpdateResource(hdll,FALSE);
if(rv==FALSE) {
	 AfxMessageBox("EndUpdateResource failed");
	 goto ex;
}
ex:
delete [] data;

Any c++ example code would be appreciated. I does create a "101" resource but not a "2" resource. The "101" is blank though.

******************************************************************************************
Youtube Channel


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS