Resources getting deleted when trying to add at run time

Hi All,
When i am trying to add resources to another file at run time, some of the earlier resources are getting deleted. Please find the source code below:
void CResourceIncludeSampleDlg::OnBnClickedButton1()
CString strInputFile = _T("C:\\SampleData\\FileToInsert.zip"); // This File is 100 MB
HANDLE hFile = CreateFile(strInputFile, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD FileSize = GetFileSize(hFile, NULL);
BYTE *pBuffer = new BYTE[FileSize];
DWORD dwBytesRead;
ReadFile(hFile, pBuffer, FileSize, &dwBytesRead, NULL);
for (int iIndex = 1; iIndex <= 4; iIndex++)
InsertResource(FileSize, iIndex, pBuffer);
CloseHandle(hFile);
void CResourceIncludeSampleDlg::InsertResource(DWORD FileSize, int iIndex, BYTE *pBuffer)
CString strOutputFile = _T("C:\\SampleData\\ResourceIncludeSample_Source.exe");
int iResourceID = 300 + iIndex;
HANDLE hResource = BeginUpdateResource(strOutputFile, FALSE);
if (INVALID_HANDLE_VALUE != hResource)
if (UpdateResource(hResource, _T("VIDEOBIN"), MAKEINTRESOURCE(iResourceID), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
(LPVOID)pBuffer, FileSize) == TRUE)
EndUpdateResource(hResource, FALSE);
After completion of the execution, i am expecting output as 301, 302, 303 and 304 added under "VIDEOBIN" category. But only 2 (sometimes 3) resources are present. One resource
is always deleted.
Could you please let me know what could be wrong or any fix for the same ?
Any help or sample source code is greatly appreciated.
Thanks and Regards,
Kishor Reddy
 

Make sure that all precautions mentioned in the
docum are met.
"Before you call this function, make sure all file handles other than the one returned by
BeginUpdateResource are closed." and also regarding LN and MUI files.
-- pa

Similar Messages

  • Getting error when trying to add authorzation in ERM (AC 5.3_SP,)

    Hi Experts,
    I have created a role in ERM and successfully saved it, when trying to add authorization by selecting the functional area->selected the functional are(procurement dept.) -> next i clicked on the authorization data-> aded one row ->when searching for the function id from the description field, it's searching for some time and after that, getting the follwing error .
    "Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (503) Service Unavailable. The requested URL was:"http://xiserver.ep.in:50000/VirsaCCFunction5_0Service/Config1?wsdl&style=document"
    Please do help.
    Best Reagrds,
    Gurugobinda
    Edited by: gurugobinda harichandan parida on Sep 10, 2009 6:29 PM

    Hi Alpesh and Zaher,
    Thanks a lot for all your help and support.
    After applying the note 1279722 my error got resolved, but after that when I am going to the next step to maintain PFCG it is giving me the error as: "Unhandled error; Function template PRGN_CHECK_ROLE_EXISTScould not be retrieved from CPD".
    Please do suggest.
    Regards,
    Gurugobinda

  • When trying to add music to a slide show from my PC to TV through Apple Tv the photos are fine but I get an error message that says the music cannot be downloaded.

    When trying to add music to a slide show from my PC to TV through Apple Tv the photos are fine but I get an error message that says the music cannot be downloaded.

    Because the location for each song in your library is on your hard drive.  If the hard drive isn't there, how can iTunes play it?
    You'll have to move/copy the music from your hard drive to your computer's hard drive.
    Basically, EASIEST way to do all this, if you don't care about your play counts, etc...
    -Delete EVERYTHING from iTunes, so that your library is now empty.
    -Go to "Advanced" inside of the "Preferences" window, found in the "Edit" drop-down.  You can also access Preferences by pressing Ctrl+, (Press Ctrl and the comma key)
    -Change your iTunes Media Folder Location to something simple, but on your computer. I use C:/iTunes.  Make sure "Keep iTunes Media Folder Organized" and "Copy files to...." are both checked.  You can close Preferences now.
    -Now, drag and drop your music from your hard drive into your iTunes library.  iTunes will automatically add the music to your library, as you would expect, and also creates a copy of each file to place into that iTunes Media Folder you just created.
    Shouldn't have any more problems...

  • I am getting an error when trying to add a caption.

    I get the following error when trying to add a caption to a photo.   "An error occurred while reading files or writing files to disc.  The disc may be full or there may be a problem with the source media."    I am running Windows 7 Pro.   The files are located on my c:.   The drive has 274 GB Free so space isn't an issue.   I have tried deleting a file and readding it to the same catalog and still the same problem.   I have copied the file to the desktop and cataloged it from there and the error went away.  
    If i check on the folder attibutes it is set to read-only but the desktop folder is as well.   If i try to remove the read only it only resets itelf to read only again.   Once i get the error another file shows up with the image name plus -edTM P-1 and it has the caption on it.  

    I was able to get it to work.  The root folder which held the pictures had a lock on it through windows 7.   Even though the drive was shared, I still had to go into the folder properties and share it with everyone.   Once i got the lock off and rebooted I was able to add captions again.

  • When trying to add Facebook account to my iPhoto 11 (9.3.1) I get this error message "Facebook didn't recognize your email password combination"

    When trying to add Facebook account to my iPhoto 11 (9.3.1) I get this error message "Facebook didn't recognize your email password combination". Email and passwords are correct.  Problems are even with veryfication code which I am asked to use instead of password.

    In the iPhoto preferences ==> accounts delete the account and re-enter it
    Or
    iMHO the better solution is to set mail as your email client in the iPhoto preferences
    LN

  • I get error message when trying to add key tags

    I get error message when trying to add key tags

    You should always backup your iPad before ever doing anything major that coould result in a catastrophic loss is something goes wrong. You can then usually restore from the backup when your iPad has recovered.
    You should also be sure to have transfered any new purchases directly to your iPad to the iTunes app on your computer on a regular basis.

  • I am trying to connect my fathers ipod touch to itunes on my computer, how can i sync itunes on my machine with the ipod such that his songs don't get deleted and i could add new songs to it (mp3 on my computer)

    I am trying to connect my fathers ipod touch to itunes on my computer, how can i sync itunes on my machine with the ipod such that his songs don't get deleted and i could add new songs to it (mp3 on my computer)

    You cannot merge accounts.  Frequently asked questions about Apple ID - http://support.apple.com/kb/HE37
    One computer using multiple iTunes Store authorizations - http://support.apple.com/kb/HT1206

  • I continue to get an error message when trying to add Header

    I continue to get an error message when trying to add Header & Footer.  Therefore I am unable to add page numbers to my pdf.  Help!!

    Sounds like the PDF has an issue. You can try to save it, close, and reopen to see if that fixes it. If there are no tags or other markup, you could print it to a new PDF and try on the new file.

  • Getting Error -9672 when trying to add printer wirelessly

    Hi,
    I seem to be getting an error -9672 when trying to add my HP PSC 1410 wirelessly to my airport network. I've tried on my intel iMac and my mac book but I'm getting the same error. Any suggestions on how to solve this?
    ANY help is much appreciated.
    Matt.

    Unfortunately, not all USB printers are compatible with AirPort base stations. A quick look at the iFelix Unofficial AirPort Printer Compatibility List doesn't show this particular model. This doesn't necessarily mean it won't work, but simply that it has not been verified. iFelix also provides the following workaround for printers not on the list that would certainly be worth a try.
    Also, you may find the following Apple article helpful.

  • Get the following error when trying to add a new user - Error of type eDSSchemaError (-14142) on line 1235 of /SourceCache/WorkgroupManager/WorkgroupManager-421/PMMUGMainView.mm

    Get the following error when trying to add a new user on Mac OS Server 10.5 - Error of type eDSSchemaError (-14142) on line 1235 of /SourceCache/WorkgroupManager/WorkgroupManager-421/PMMUGMainView.mm

    How come Leopard let me use the WGM in standard mode?
    While SA complains that it won't work in Standard Configuration, WGM does not. There is some fault in the logic of this for which I don't have an explanation.
    If I want to get control on Dock, selection of Home folder, config of Proxy... which I think are basic things, do I really need the advanced mode?
    If you wish to have complete control of all client settings, yes. There really is no disadvantage of using an Advanced configuration other than the learning curve.
    So if I switch to advanced mode, there is good chance I won't get this error message anymore, right?
    Yes.

  • HT2480 hi i am getting message that CANNOT GET MAIL  THE CONNECTION TO THE SERVER FAILED when trying to add official mail to Exchange in IPHONE 5

    hi i am getting message that CANNOT GET MAIL  THE CONNECTION TO THE SERVER FAILED when trying to add official mail to Exchange in IPHONE 5

    Talk to your IT department...
    Or if you're at University, talk to the computer team.
    Most Uni's are using outlook.com as the server connection not mail.youruniversity.edu

  • Get an error when trying to add a new object!

    Post Author: zhaodifan
    CA Forum: Administration
    I was trying to add a new object from central management console and I got the following error:
    Retrieve Error
    There was an error while retrieving data from the server: Failed to read data from report file C:\WINNT\Temp\pres_report.rpt. Reason: Operation not yet implemented. File C:\WINNT\TEMP\tmpreport\~ci226c521bf2923e0.rpt.
    The report I am trying to add was running on a Linux box with the same version BusinessObjects Cyrstal 11 running. I want to move it to a Windows box... The report itself shouldn't have problems because it was running fine on the linux box...
    Also want you let you know that I don't know too much about Crystal Report and our Crystal Report admin quited his job last week! I will be very appreciated if anybody can give me any advice. Thank you!
    Difan

    If this is a Gmail account you might need to unlock by going here: https://accounts.google.com/DisplayUnlockCaptcha.

  • Error  message when trying to add new user

    Hello,
    Customer is working on 2005B (2005B 7.40.252 SP00 PL39).
    They are working on this database since 2009.
    No upgrade was recently done.
    when trying to add a new user they get athe following error:
    "A user was added outsite the application. Delet it, or preform'Restore Numbering' [Message 3512-7]"
    Could you please advice.
    Regards,
    Maya

    Hi Maya......
    Go to Administration--> Utility and select the restore no. series.
    Update this and try to add User.
    But do it first in your test DB.....
    Regards,
    Rahul

  • The current user has insufficient permissions to perform this operation when trying to add Term stored managed navigation.

    Hi,
    i am getting this error "The current user has insufficient permissions to perform this operation." when trying to add the Term store managed navigation like the following screen shot. i am the Farm
    administrator and as well managed services account. also noticed, cannot delete the service application, saying you don't have enough permission to delete the db. but using this account i was able to do everything before in my environment. is anyone already
    face this kind of error, so what will be the way to resolve this?
    Appreciated!

    event though its a farm admin,It should provide the access to MMS.please find the below link for more details and the solution for the issue.
    Go to SharePoint Central Administration Site –> Application Management –> [Service Applications] –> Manage service applications
    2.   Highlight the Managed Metadata Service that your web application is associated with. (Do not click on the link, just click somewhere else on that row to highlight it)
    3.   Click on Permissions button in the ribbon area.
    4.   Add the application pool account used by your web application and give it  ‘full Access to Term Store’
    5.   Click OK.
    http://expertsharepoint.blogspot.de/2014/08/managed-metadata-service-or-connection.html
    Anil Avula[MCP,MCSE,MCSA,MCTS,MCITP,MCSM] See Me At: http://expertsharepoint.blogspot.de/

  • Error: "client-error-request-value-too-long" when trying to add printer

    After installing the 10.4.9 Combo update, my HP 1350 All-in-One printer was not recognized. I reinstalled the driver, but now I can't add the printer. I get the error message "client-error-request-value-too-long" when trying to add the printer. Has anyone else experienced a similar problem.
    Thanks in advance

    Well, I tried all of that and I'm still getting the error message. I've also repaired disk permissions and run Disk Warrior. When I repaired disk permissions, many HP printer items showed up in the list.

Maybe you are looking for

  • Oracle 10.2.0.4 with OFS 3.3.4 - MSCS -Failsafe Manager

    Hi, Prior to our production upgrade of Oracle 9.2.0.6 to 10.2.0.4 for SAP 4.7 / Windows / Itanium (IA64), I had been trying a trial "Oracle only" upgrade with MSCS in virtual server environment.  Added complexity is a Standby Database. I have reprodu

  • NTP design questions !

    Hi Few questions on NTP design what value is added by configuring multiple ntp servers apart from redundancy e.g. ntp server 1.1.1.1 ntp server 2.2.2.2 ntp server 3.3.3.3 what value is added by configuring multiple ntp peer apart from redundancy e.g.

  • Transfer the account balance

    hi, i want to make a "staff training loan" account a recon account. but there is a balance in that account. therefore system is not letting me to make this account a recon account. can't I transfer the balance to different account??and them make "sta

  • Certain sites not loading on Win7 Ultimate x64 desktop

    I'm at the end of my troubleshooting rope with this one so any help would be appreciated. A few days ago specific sites stopped working on my custom build Windows 7 Ultimate x64 desktop. Since building it nearly two years ago I have had zero browsing

  • Seemingly random freezes and general sluggishness.

    Since I have updated to Snow Leopard my 20" iMac seems to be having some issues. various applications stall (iTunes, FireFox, iPhoto) or completely freeze seemingly at random. Not enough to prohibit use of the machine but often enough to cause concer