News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Dialog don't show

Started by Amadeus, April 19, 2021, 01:30:51 AM

Previous topic - Next topic

Amadeus

Hello all,
i started using ml.exe and link.exe version 12

but compiled dialogs not showing.

As you can see, everything gets compiled without any errors.

If i compile it with old ml.exe and link.exe the dialog is visible!

Any help is much appreciated


rc /v "DlgMain.Rc"
Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385

Copyright (C) Microsoft Corporation.  All rights reserved.


Creating DlgMain.res

Using codepage 1252 as default

DlgMain.Rc.
Writing DIALOG:1000, lang:0x409, size 66.
Writing 24:1, lang:0x409, size 612.
Writing RCDATA:5000, lang:0x409, size 54553

ml /c /coff /Cp "DlgMain.Asm"
Assembling: DlgMain.Asm

***********
ASCII build
***********

Microsoft (R) Macro Assembler Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.


link /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /OUT:"DlgMain.exe" "DlgMain.obj"  "DlgMain.res"
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

Deleted: DlgMain.obj
Deleted: DlgMain.res

Make done.

Executing:
"DlgMain.exe"


p.s.:
i use RadAsm, maybe its only a compiler switch that i am missing?

Vortex

Hi Amadeus,

Here is a simple dialog box example. Try to compare it with your project, maybe you can catch the error.

Amadeus

Hi Vortex,

thanks for your example.

Same game, compiling with your Make.bat working
compiling through RadAsm using older version of link exe also working.
Compiling through RadAsm using v12 link.exe still nothing is shown!

I am really out of ideas

here the project options under RadAsm
https://i.imgur.com/MC0k7Kn.png

TouEnMasm

perhaps the linker isn't really up to date,actual 14.28.29914.0
Try /VERBOSE (link) to see if there is problems.
Fa is a musical note to play with CL

Vortex

Quote from: TouEnMasm on April 19, 2021, 02:54:13 AM

perhaps the linker isn't really up to date,actual 14.28.29914.0

The linker supplied with the Masm32 package, Version 5.12.8078 can be used for general purpose programming.

jj2007

Quote from: Amadeus on April 19, 2021, 01:30:51 AM
If i compile it with old ml.exe and link.exe the dialog is visible!

Please zip both versions and post them here. It's probably a trivial problem.

Amadeus

i managed it to compile with simple DLG
apparently the issue is when a picture is placed on the DLG.
I suppose it have to do with a used library.

tia for your help

in attachement is the project and included are both ML.exe, LINK.exe and RC.exe in Ver. 5 and 12


[sorry could not make attach the other file they exceed allowed filesize]

jj2007

Sorry, what I meant is attach your two executables - the one that works fine, and the other one that doesn't.

Amadeus

ah i missunderstood, sorry

here they are.



jj2007

The exe assembled with v12 has a heap corruption problem (->critical error c0000374).

Even with a debugger, this problem is difficult to chase. Until call <jmp.&user32.DialogBoxParamA>, both executables are identical. Then one of them misbehaves on freeing some memory... no idea what causes that. Have you tried with different images?

In case you have MasmBasic installed, there is a handy program at \Masm32\MasmBasic\Res\DebugHeap.exe; if you drag your exe over DebugHeap.exe, it will run fine but display ## Critical error detected c0000374, which means heap corruption. Check in particular line 57 of gdiplusLoadBitmapFromResource.inc, maybe allocating some bytes more solves the problem.

Amadeus

thanks JJ2007

i made this change, removed the Local var and made it global.


.data?
hbuffer dd ? ; <<<<<<<<

.code
gdiplusLoadBitmapFromResource proc hInst:HMODULE, lpName:LPSTR, lpType:LPSTR, pBitmapFromStream:DWORD

local rcRes:HRSRC
local hResData:HRSRC
local pResData:HANDLE
local sizeOfRes:DWORD
; local hbuffer:HANDLE          ;  <<<<<<<<<
local pbuffer:DWORD
local pIStream:DWORD


the effect now is, if i run the v12 compiled exe in a debugger
all runs fine, DLG appears with the picture on it.
Out of the debugger nothings change.

jj2007

Quote from: Amadeus on April 19, 2021, 07:50:10 AM
i made this change, removed the Local var and made it global.

That can be an issue if it's a WndProc callback, but not here: hbuffer gets set once, and used only inside the proc.

I attach my adapted version, tested with MASM 6.15 and 14.x versions. No problems detected...

Amadeus

hi JJ2007,

thanks for your example.

Well seems i have to use 6.15
problem of corrupted heap still persist.

Will do tomorrow another try, its past 1 a.m, and i am a bit tired.


jj2007

Hi Amadeus,

This bug is very atypical. Usually \Masm32\MasmBasic\Res\DebugHeap.exe signals that heap memory is being accessed beyond the allocated number of bytes, here it just complains about corruption.

Tomorrow is another day. AFAICS you have no errors in your code...

Amadeus

Hello JJ2007,

i think that this error occurs due the fact of using old libraries. (the ones that comes with masm 6.x)

Anyway it was worth a try.

Thanks for your help
Amadeus