News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Discussion about Demo of old style controls on a normal window.

Started by jj2007, March 01, 2017, 09:42:44 PM

Previous topic - Next topic

jj2007

Does it require a new version of the 64-bit SDK?
An include \masm32\include64\GdiPlus.inc solves many of the errors below, but for example, invoke button,hInstance chokes because button is undefined.

Microsoft (R) Windows (R) Resource Compiler Version 6.1.7600.16385
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: controls.asm
controls.asm(33) : error A2006:undefined symbol : GdiplusStartup
procedure_call(19): Macro Called From
  invoke(1): Macro Called From
   GdiPlusBegin(9): Macro Called From
    controls.asm(33): Main Line Code
controls.asm(44) : error A2006:undefined symbol : GdiplusShutdown
procedure_call(11): Macro Called From
  invoke(1): Macro Called From
   GdiPlusEnd(1): Macro Called From
    controls.asm(44): Main Line Code
controls.asm(167) : error A2006:undefined symbol : button
procedure_call(41): Macro Called From
  invoke(1): Macro Called From
   controls.asm(167): Main Line Code
... etc

hutch--

This is the build I get using the same files.

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: controls.asm
Microsoft (R) Incremental Linker Version 14.10.24930.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Volume in drive K is disk3_k
Volume Serial Number is 68C7-4DBB

Directory of K:\asm64\asm2\controls

03/01/2017  08:03 PM             8,899 controls.asm
03/01/2017  10:30 PM            13,312 controls.exe
03/01/2017  10:30 PM             9,978 controls.obj
03/01/2017  08:05 PM            13,445 controls.zip
               4 File(s)         45,634 bytes
               0 Dir(s)  972,839,194,624 bytes free
Press any key to continue . . .

Have you modified anything at all in the setup ?

See if you have these 2 macros at the end of the macros file.

    GdiPlusBegin MACRO ;;;; token
      .data
        gdii GdiplusStartupInput <>
        GDItoken@@@@ dq ?
      .code
      mov gdii.GdiplusVersion, 1
      mov gdii.DebugEventCallback, 0
      mov gdii.SuppressBackgroundThread, 0
      mov gdii.SuppressExternalCodecs, 0
      invoke GdiplusStartup,ADDR GDItoken@@@@,ADDR gdii,0
    ENDM

    GdiPlusEnd MACRO ;;;; token
      invoke GdiplusShutdown,GDItoken@@@@        ; cleanup on exit
    ENDM


The attachment will update the missing files. Latest macro file and all of the current library modules.

jj2007

Quote from: hutch-- on March 01, 2017, 10:32:34 PMHave you modified anything at all in the setup ?

I just downloaded the latest SDK64 from http://masm32.com/board/index.php?topic=5631.0 and installed it, still the same issues. Will try the macros now.

EDIT: Opened the attachment above, overwrote all m64lib files and macros, and now it builds but doesn't show any controls. Perhaps you should mention that the SDK is out of date.

hutch--

> Perhaps you should mention that the SDK is out of date.

It tends to be unfinished. I am surprised about the controls, the modules are in the library code and they are called in the supplied source. Its a reasonably tedious task to make temporary installations so I have not madly hurried at producing them.

I just checked, the macro file was posted at this URL.

http://masm32.com/board/index.php?topic=5918.0

Its the same one as in the zip file above.

jj2007

Quote from: jj2007 on March 01, 2017, 10:55:12 PMit builds but doesn't show any controls.

The exe in controls.zip in your initial post above shows various controls. The rc, however, has only the menu and the VCB. And there are only two CreateWindowEx (main win, static) in the source...

P.S.:          .case 300
          int 3
            invoke MsgboxI,hWin, \
                   "Using the old style windows controls.", \
                   "About Window Controls Demo",MB_OK,10


The int 3 is triggered, so the command is being executed, but the MsgBox doesn't show :(

hutch--

The controls are in the library I posted in this thread. button, listbox etc ...

jj2007

That's the one I am using :(

With ...
int 3
        invoke button,hInstance,hWin,"Button1",blft,btop,bwid,bhgt,601
nop


... I can see this in the debugger:0000000140001461 | CC                                   | int3                                          |
0000000140001462 | 48 8B 0D B7 27 00 00                 | mov rcx, qword ptr ds:[140003C20]             |
0000000140001469 | 48 8B 55 10                          | mov rdx, qword ptr ss:[rbp+10]                |
000000014000146D | 4C 8B 05 64 1D 00 00                 | mov r8, qword ptr ds:[1400031D8]              | 1400031D8:&"Button1"
0000000140001474 | 49 C7 C1 19 00 00 00                 | mov r9, 19                                    |
000000014000147B | 48 C7 44 24 20 14 00 00 00           | mov qword ptr ss:[rsp+20], 14                 |
0000000140001484 | 48 C7 44 24 28 6E 00 00 00           | mov qword ptr ss:[rsp+28], 6E                 | 6E:'n'
000000014000148D | 48 C7 44 24 30 19 00 00 00           | mov qword ptr ss:[rsp+30], 19                 |
0000000140001496 | 48 C7 44 24 38 59 02 00 00           | mov qword ptr ss:[rsp+38], 259                | [rsp+38]:UpdateLayeredWindowIndirect+2B9
000000014000149F | E8 1C 08 00 00                       | call 140001CC0                                |
00000001400014A4 | 90                                   | nop                                           |


Result is 0, error_bad_exe_format

This is on Win7-64.

hutch--

Win 7 64bit Ultimate.


Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: controls.asm
Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Volume in drive M is disk4_m
Volume Serial Number is BE9E-CF66

Directory of M:\controls

03/01/2017  09:03 PM             8,899 controls.asm
03/02/2017  01:44 AM            13,312 controls.exe
03/02/2017  01:44 AM             9,966 controls.obj
03/01/2017  09:05 PM            13,445 controls.zip
               4 File(s)         45,622 bytes
               0 Dir(s)  987,018,883,072 bytes free
Press any key to continue . . .

hutch--

I have no way of determining how your machine is set up so its nearly impossible to diagnose why builds on your machine don't work.

TWell

i just missed 0064.zip

jj2007

Quote from: hutch-- on March 02, 2017, 01:52:46 AM
I have no way of determining how your machine is set up so its nearly impossible to diagnose why builds on your machine don't work.

It builds fine now, but under the hood of "button" the CreateWindowExA fails with the above mentioned error.

hutch--

There is something going on that I fail to understand here. Below is a very ordinary API code that builds perfectly and runs normally.

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    include \masm32\include64\masm64rt.inc

    .code

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

button proc instance:QWORD,hparent:QWORD,text:QWORD,topx:QWORD,topy:QWORD,wid:QWORD,hgt:QWORD,idnum:QWORD

    invoke CreateWindowEx,WS_EX_LEFT,"BUTTON",text, \
                          WS_CHILD or WS_VISIBLE,\
                          topx,topy,wid,hgt,hparent,idnum,instance,0
    ret

button endp

; ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    end

jj2007

Quote from: hutch-- on March 02, 2017, 10:14:37 AM
There is something going on that I fail to understand here.

Me too. I've compared the original exe (which shows controls) to the ones I built here using PEview - see attachment. Code sections are absolutely identical, but the .rdata sections look different.

I've modified the code so that the About menu entry shows the 601 MessageBox instead. Well, should show...
0000000140001397 | CC                                   | int3                                          |
0000000140001398 | 48 8B 4D 10                          | mov rcx, qword ptr ss:[rbp+10]                |
000000014000139C | 48 8B 15 7F 1D 00 00                 | mov rdx, qword ptr ds:[140003122]             | 140003122:&"Howdy Howdy Howdy"
00000001400013A3 | 4C 8B 05 8E 1D 00 00                 | mov r8, qword ptr ds:[140003138]              | 140003138:&"Button1"
00000001400013AA | 49 C7 C1 00 00 00 00                 | mov r9, 0                                     |
00000001400013B1 | FF 15 1D 26 00 00                    | call qword ptr ds:[<&MessageBoxA>]            |


Parameters look ok: rcx=0, r9=0, rdx is "howdy" and r8 is "button1". It returns error_success but it doesn't show ::)

I have created an equivalent MsgBox which works:include \Masm32\MasmBasic\Res\JBasic.inc ; ## console demo, builds in 32- or 64-bit mode with ML, AsmC, JWasm, HJWasm ##
Init ; OPT_64 1 ; put 0 for 32 bit, 1 for 64 bit assembly
  MsgBox 0, "Wow, it works!!!!", "Hi", MB_OK or MB_SETFOREGROUND
EndOfCode


I followed both versions in the debugger down to the call to MessageBoxTimeoutW. Everything identical except that one shows, the other doesn't. Even handle zero for both MsgBoxes shows the same difference, so hWin is not the culprit.

This is mysterious: Two MessageBoxA calls, with good parameters, one shows up, the other doesn't; both show ERROR_SUCCESS :dazzled:

@Tim: Does your version work?

hutch--

JJ,

See if this simple MessageBox builds OK in your 64 bit MASM setup. It may help to track down why your builds are not working.

TWell

Worked here in Windows 7
smaller
12,5 KB (12 800 bytes)
than original
13,0 KB (13 312 bytes)

so 2015 version put some odd code to it.

EDIT: test was made using version 10 tools.