News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

UpdateResource is not updating

Started by georgek01, March 25, 2008, 01:24:54 PM

Previous topic - Next topic

georgek01

Hello!

I'm trying to update a string resource in an EXE. The code looks as follows:


invoke BeginUpdateResource,addr ListBuffer,FALSE
.if eax == NULL
   invoke ErrMsg,hMain,1,101,NULL
   mov eax,1
   ret 
.endif

mov hResource,eax

invoke MultiByteToWideChar,CP_ACP,MB_PRECOMPOSED,addr ListBuffer,sizeof ListBuffer,addr buffer,sizeof buffer

invoke UpdateResource,hResource,RT_STRING,addr szContent,LANG_ENGLISH,addr buffer,sizeof buffer
.if eax == 0
   invoke ErrMsg,hMain,2,101,NULL
   mov eax,1
   ret 
.endif

invoke EndUpdateResource,hResource,FALSE
.if eax == 0
   invoke ErrMsg,hMain,6,101,NULL
   mov eax,1
   ret 
.endif


No errors occur and the resource is not updated. Any ideas perhaps why?
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

evlncrn8


georgek01

This is the error display procedure.


ErrMsg proc hW:HWND, icode:DWORD, itype:DWORD, phead:DWORD

local lbuffer:DWORD
local mbuffer[256]:BYTE
local dwError:DWORD

.if itype == 0
invoke GetLastError
.else
invoke GetLastError
.endif

mov dwError,eax

lea eax, [lbuffer]
invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER + FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0
invoke wsprintf,addr mbuffer,addr szErrorFormat,[dwError],[lbuffer],icode
invoke MessageBox,hW,addr mbuffer,addr szApp,MB_ICONERROR+MB_OK
invoke LocalFree,[lbuffer]

xor eax, eax
ret
ErrMsg endp


If an error occurs, invoke ErrMsg,hMain,6,101,NULL calls the procedure that then displays the appropriate error message.

At all check points, eax contains the required return value (either !=NULL or !=0).

What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

Kernel

Quote from: georgek01 on March 25, 2008, 01:24:54 PMinvoke UpdateResource,hResource,RT_STRING,addr szContent,LANG_ENGLISH,addr buffer,sizeof buffer
Sry, if it doesn't help, and I don't remember when and what,
coz some months went by since I played with updating resources.
But try SUBLANG_ENGLISH_US instead of LANG_ENGLISH.