مشکل در محدودیت سایز فایل بعنوان ریسورس در updateresource function
با سلام
من از کد زیر برای اضافه کردن یک ریسورس به یک فایل اجرایی استفاده کردم
تا وقتی که اندازه فایل ریسورس کمتر از 4 کیلوبایت باشه درست کار میکنه ، ولی همینکه بیشتر باشه فایل اجرایی coruppted میشه ، کسی میدونه مشکل چیه ؟ ( در ضمن در محیط ویندوز ویستا کد مینویسم ، اینو گفتم چون مایکروسافته یک آپدیت واسه kernel32 در محیط اکس داده واسه همین مشکل
When you use the following functions to remove a resource from an application binary file on Microsoft Windows XP or on Microsoft Windows 2000, the binary file may become corrupted:
)
Uses Classes, Windows, SysUtils, Dialogs;
Type
TBuffer = Array[0..0] of Byte;
PBuffer = ^TBuffer;
Var
FS : TFileStream;
ResourceHandle : THandle;
DataLength : DWord;
Data : PBuffer;
Ok : Boolean;
Begin
ResourceHandle := BeginUpdateResource(pChar('d:\someexefile.exe'), False);
IF (ResourceHandle <> 0) Then
Begin
FS := TFileStream.Create('d:\somebitmap.bmp', fmOpenRead);
FS.Seek(0, soFromBeginning);
DataLength := FS.Size;
GetMem(Data, DataLength);
FS.Read(Data^, DataLength);
FS.Free;
Ok := True;
IF (not UpdateResource(ResourceHandle, RT_RCDATA, pChar('MyNewResource'), LANG_SYSTEM_DEFAULT{MakeLangID(LANG_NEUTRAL, SUBLANG_NEUTRAL)}, Data, DataLength)) Then Ok := False;
IF (not EndUpdateResource(ResourceHandle, False)) Then Ok := False;
IF (Ok) Then ShowMessage('Update of resources successful!')
Else ShowMessage('Update of resources failed!');
FreeMem(Data);
End;
End.
نقل قول: مشکل در محدودیت سایز فایل بعنوان ریسورس در updateresource function
ایول بابا یکی پیدا نشد جواب مارو بده