hi
i have a question with update the dialog in any exe with resource file *.res to exe
in the Resource.RES have i only a dialog for the target exe
invoke _UpdateResource,CTEXT ("Resource.RES"),CTEXT ("Target.exe"),1000
_UpdateResource proc lpszAddFile:dword,lpszToFile:dword,lpszResId:dword
LOCAL hAddFile:DWORD
LOCAL dwFileSize:DWORD
LOCAL dwBytesRead:DWORD
LOCAL ReadPtr:DWORD
LOCAL hUpdateRes:DWORD
LOCAL dwValue:BYTE
pushad
mov dwValue,0
invoke CreateFile,lpszAddFile, GENERIC_READ,0,NULL,OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL
cmp eax,INVALID_HANDLE_VALUE
jz @ret
mov hAddFile,eax
invoke GetFileSize,hAddFile,NULL
mov dwFileSize,eax
invoke GlobalAlloc,NULL,dwFileSize
mov ReadPtr,eax
invoke ReadFile,hAddFile,ReadPtr,dwFileSize,ADDR dwBytesRead,NULL
invoke BeginUpdateResource,lpszToFile,FALSE
or eax,eax
jz @F
mov hUpdateRes,eax
invoke UpdateResource,eax, RT_DIALOG,lpszResId,LANG_NEUTRAL,ReadPtr,dwFileSize
or eax, eax
jz @F
invoke EndUpdateResource,hUpdateRes,FALSE
or eax, eax
jz @F
mov dwValue, 1
@@:
invoke GlobalFree,ReadPtr
invoke CloseHandle,hAddFile
@ret:
popad
movzx eax,dwValue ;return: 1=success 0=failed
ret
_UpdateResource endp
can your help me please?
greets,
ragdog
GENERIC_WRITE
hi
this CreateFile is only for read the .res
why i add GENERIC_WRITE by createfile?
greets
because UpdateResource writes the data back to the file, thus if you don't have the file open with the GENERIC_WRITE it will fail (open it with GENERIC_READ + GENERIC_WRITE)....
i have added GENERIC_READ + GENERIC_WRITE this works not!
works this ever updateresource with add res to exe?
i think this works only with add icon or data!