One of the benifits of using USES ESI EDI EBX is that this will not happen :)


Much better, IMHO, always have one and only one return.
At least in that simple proc.
Posted on 2002-08-17 06:29:47 by Four-F
There is some incomprehensible differences between names of some structures's members.
For ex CREATESTRUCT:

windows.inc:
CREATESTRUCTA STRUCT

. . . . . .
[B]hWndParent[/B] DWORD ?
. . . . . .
ly DWORD ?
lx DWORD ?
. . . . . .
[B]ExStyle[/B] DWORD ?
CREATESTRUCTA ENDS

Microsoft's winuser.h:
typedef struct tagCREATESTRUCT { // cs  

. . . . . .
HWND [B]hwndParent[/B];
. . . . . .
int cy;
int cx;
. . . . . .
DWORD [B]dwExStyle[/B];
} CREATESTRUCT;

It's clear in case of reserverd words such as mask, cx, size etc.
But i can't see any reason why hwndParent converted to hWndParent and dwExStyle to ExStyle.

I'm not shure it's good idea to change it as it should be because of backward compatibility,
but how annoying to get assembler errors only bacause of field's names disparity.
Posted on 2002-08-18 01:30:51 by Four-F
Imo it would be better to follow the microsoft naming convention... old masm32-style source can be easily fixed up, most stuff could probably be fixed with global search+replace.
Posted on 2002-08-18 03:20:09 by f0dder
MASM cannot follow the standard naming conventions in many cases due to register names and keywords name conflicts. When I converted data for the original version of windows.inc, some of the names were not in the case that they were at the time in WIN32.HLP but the problem is that hundreds of thousands of programs have been written using windows.inc and to modify it when its a name difference and not an error would break a lot of code for no purpose.

What will work is a number of equates like,

hWnd equ <hwnd>

I have been tempted to do this with windows.inc but I have not done a service pack for some time now because of bandwidth limitations.

Regards,

hutch@movsd.com
Posted on 2002-08-18 10:09:59 by hutch--
Four-F,

Thanks for finding this bug but it has been found some time ago. I have not done a service pack since but the best way to handle the problem is to jump to the end before the register is restored so it balances the stack properly.

Regards,

hutch@movsd.com

Here is the fix below.


; #########################################################################

; ---------------------------------------------------------------
; This procedure was originally written by Tim Roberts
;
; Part of this code has been optimised by Alexander Yackubtchik
; ---------------------------------------------------------------

.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive

.code

; #########################################################################

dwtoa proc dwValue:DWORD, lpBuffer:DWORD

; -------------------------------------------------------------
; convert DWORD to ascii string
; dwValue is value to be converted
; lpBuffer is the address of the receiving buffer
; EXAMPLE:
; invoke dwtoa,edx,ADDR buffer
;
; Uses: eax, ecx, edx.
; -------------------------------------------------------------

push ebx
push esi
push edi

mov eax, dwValue
mov edi, [lpBuffer]

or eax,eax
jnz sign

zero:
mov word ptr [edi],30h
jmp dw2asc

sign:
jns pos
mov byte ptr [edi],'-'
neg eax
inc edi

pos:
mov ecx,429496730
mov esi, edi

.while (eax > 0)
mov ebx,eax
mul ecx
mov eax,edx
lea edx,[edx*4+edx]
add edx,edx
sub ebx,edx
add bl,'0'
mov [edi],bl
inc edi
.endw

mov byte ptr [edi], 0 ; terminate the string

; We now have all the digits, but in reverse order.

.while (esi < edi)
dec edi
mov al, [esi]
mov ah, [edi]
mov [edi], al
mov [esi], ah
inc esi
.endw

dw2asc:

pop edi
pop esi
pop ebx

ret

dwtoa endp

; #########################################################################

Posted on 2002-08-18 10:16:42 by hutch--
LV_COLUMN structure looks a bit different in API reference.
SDK :
typedef struct _LV_COLUMN {
UINT mask;
int fmt;
int cx;
LPTSTR pszText;
int cchTextMax;
int iSubItem;
} LV_COLUMN;

windows.inc:
LV_COLUMN STRUCT
imask DWORD ?
fmt DWORD ?
lx DWORD ?
pszText DWORD ?
cchTextMax DWORD ?
iSubItem DWORD ?
iImage DWORD ?
iOrder DWORD ?
LV_COLUMN ENDS
There are a couple of new members and cx is lx instead. I guess you can't use cx, because it's a register name. What about the 2 new members? I'm on win98se.
Posted on 2002-09-09 15:20:52 by Vaxon
The API reference cannot be confused with the SDK as the API reference seems to date back to the days of windows 95. The actual declaration of the LVCOLUMN (Note: Not LV_COLUMN) stuct:


typedef struct _LVCOLUMN {
UINT mask;
int fmt;
int cx;
LPTSTR pszText;
int cchTextMax;
int iSubItem;
#if (_WIN32_IE >= 0x0300)
int iImage;
int iOrder;
#endif
} LVCOLUMN, *LPLVCOLUMN;
Posted on 2002-09-09 23:27:34 by huh
typedef struct tagTCITEM {  

UINT mask;
#if (_WIN32_IE >= 0x0300)
DWORD dwState;
DWORD dwStateMask;
#else
UINT lpReserved1;
UINT lpReserved2;
#endif
LPTSTR pszText;
int cchTextMax;
int iImage;
LPARAM lParam;
} TCITEM, FAR *LPTCITEM;


Above structure definition is from CommCtrl.h.
I guess we all code for windows with IE >= 3.0.

TC_ITEM STRUCT

imask DWORD ?

[B]dwState DWORD ?[/B] ; not defined in windows.inc
[B]dwStateMask DWORD ?[/B] ; not defined in windows.inc

lpReserved1 DWORD ?
lpReserved2 DWORD ?
pszText DWORD ?
cchTextMax DWORD ?
iImage DWORD ?
lParam DWORD ?
TC_ITEM ENDS
Posted on 2002-09-10 06:46:27 by Four-F
Oops! Sorry. Sad mistake.
Actually TC_ITEM should be:

TC_ITEM STRUCT

imask DWORD ?
[B]dwState DWORD ?[/B] ; lpReserved1
[B]dwStateMask DWORD ?[/B] ; lpReserved2
pszText DWORD ?
cchTextMax DWORD ?
iImage DWORD ?
lParam DWORD ?
TC_ITEM ENDS


No new members, simply:
lpReserved1 -> dwState
lpReserved2 -> dwStateMask
Posted on 2002-09-11 11:03:53 by Four-F
hi,

looking for these

SBT_TOOLTIPS where are these?
PBS_SMOOTH
PBS_VERTICAL
UDS_HOTTRACK
HDS_HOTTRACK
HDS_DRAGDROP
HDS_FULLDRAG
TCS_HOTTRACK
TCS_MULTISELECT
TCS_VERTICAL
TCS_SCROLLOPPOSITE
TCS_FLATBUTTONS
TVS_INFOTIP
TVS_FULLROWSELECT
TVS_NOHSCROLL
TVS_NOSCROLL
TVS_NONEVENHEIGHT
TVS_SINGLEEXPAND
TVS_TRACKSELECT
TVS_CHECKBOXES
TVS_RTLREADING
MCS_ Month Calendar Control Styles

also
BS_ICON listed twice

thanks
Posted on 2002-09-18 15:17:00 by X05
X05, take a look at this.
Common Control Macro Library
Most of the symbols you are requested are defined there.
Posted on 2002-09-20 06:22:12 by Four-F
thanks..

macros.. demos.. (nice!) and windows .hlp file!

now to get the ACM audio structs...

X05
Posted on 2002-09-20 08:41:56 by X05
Excuse me for importunity, Steve.
This bug can already be known too.
Or vkim already has informed you about it via email,
as it was found out by me during testing vkdebug.

.386

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\masm32.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\masm32.lib

.data?
acBuffer1 CHAR 16 dup(?)
acBuffer2 CHAR 16 dup(?)

.code
start:
mov ecx, 80000000h
invoke dwtoa, ecx, addr acBuffer1
mov ecx, 0AABBCCDDh
invoke dwtoa, ecx, addr acBuffer2
invoke MessageBox, NULL, addr acBuffer1, addr acBuffer2, MB_OK
ret
end start


80000000h -> "-214748365."
0AABBCCDDh -> "-143053290/"

I begin to be afraid to use m32lib.
Posted on 2002-09-21 03:45:09 by Four-F
Four-F,

You will have to forgive me but I did not write it. Tim Roberts wrote it and Alex did some optimisation on it and it seems both missed the problem that was pointed out with a RET that did not rebalance the stack. Below is the current version I have that fixed that problem.

I don't class my maths as good enough these days so if anyone has a very reliable, thoroughly tested algo to replace it, I will use it in the next service pack but I don't want to be stuck with testing stuff that is not documented or commented properly.

Regards,

hutch@movsd.com



; #########################################################################

; ---------------------------------------------------------------
; This procedure was originally written by Tim Roberts
;
; Part of this code has been optimised by Alexander Yackubtchik
; ---------------------------------------------------------------

.386
.model flat, stdcall ; 32 bit memory model
option casemap :none ; case sensitive

.code

; #########################################################################

dwtoa proc dwValue:DWORD, lpBuffer:DWORD

; -------------------------------------------------------------
; convert DWORD to ascii string
; dwValue is value to be converted
; lpBuffer is the address of the receiving buffer
; EXAMPLE:
; invoke dwtoa,edx,ADDR buffer
;
; Uses: eax, ecx, edx.
; -------------------------------------------------------------

push ebx
push esi
push edi

mov eax, dwValue
mov edi, [lpBuffer]

or eax,eax
jnz sign

zero:
mov word ptr [edi],30h
jmp dw2asc

sign:
jns pos
mov byte ptr [edi],'-'
neg eax
inc edi

pos:
mov ecx,429496730
mov esi, edi

.while (eax > 0)
mov ebx,eax
mul ecx
mov eax,edx
lea edx,[edx*4+edx]
add edx,edx
sub ebx,edx
add bl,'0'
mov [edi],bl
inc edi
.endw

mov byte ptr [edi], 0 ; terminate the string

; We now have all the digits, but in reverse order.

.while (esi < edi)
dec edi
mov al, [esi]
mov ah, [edi]
mov [edi], al
mov [esi], ah
inc esi
.endw

dw2asc:

pop edi
pop esi
pop ebx

ret

dwtoa endp

; #########################################################################

end
Posted on 2002-09-21 08:00:00 by hutch--
No claims to you, Steve.
We know who wrote it and who "optimized".
Now nobody understand who is guilty.
Posted on 2002-09-21 09:09:04 by Four-F
Posted on 2002-09-25 05:21:49 by Four-F
Here's one that should be in there. I can't imagine why it's not, maybe I have an older include file

TBBUTTONINFO STRUCT
cbSize DWORD ?
dwMask DWORD ?
idCommand DWORD ?
iImage DWORD ?
fsState BYTE ?
fsStyle BYTE ?
lx WORD ?
lParam DWORD ?
pszText DWORD ?
cchText DWORD ?
TBBUTTONINFO ends

Donkey
Posted on 2002-10-26 02:15:48 by donkey
donkey,

Thanks for this one, its checked with MSDN and added to the reference version.

Regards,

hutch@movsd.com
Posted on 2002-10-27 08:33:24 by hutch--
Hi Hutch ... dunno if this thread is still valid but here goes anyway.

Over the weekend I did some work on my WinSock server using IO Completion Ports. I found at least 2 functions that weren't included and had to link them at runtime (obviously painful :() ... I know a few of them should have existed since NT 3.51 but some are for Win2k and above. If you have a separate INC that you have constructed for Win2K please let me know, I'd be greatful as a few new useful features of Completion Ports were added! I have done a search in the Masm32 directory and in the community for mention of these API's and found none ... you will however find them on MSDN.

BindIoCompletionCallback

Couldn't get the MSDN link for this one ... will try again later ... the Threading section seems to be down!

BOOL BindIoCompletionCallback(
HANDLE FileHandle,
LPOVERLAPPED_COMPLETION_ROUTINE Function,
ULONG Flags
);

Requirements
Windows NT/2000/XP: Included in Windows 2000 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.

CreateIoCompletionPort

MSDN Link

HANDLE CreateIoCompletionPort(
HANDLE FileHandle,
HANDLE ExistingCompletionPort,
ULONG_PTR CompletionKey,
DWORD NumberOfConcurrentThreads
);

Requirements
Windows NT/2000/XP: Included in Windows NT 3.5 and later.
Windows 95/98/Me: Unsupported.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.


The first one is not so important to me because I'm not gonna use it, but the second one is very important, it is used in conjuction with API's such as GetQueuedCompletionStatus and PostQueuedCompletionStatus which you have already included in MASM32. In fact, this is the API that creates IO Completion Ports! If at all I've missed this API somewhere, or you've already added it a newer copy of MASM32 than what I have, my appologies!
Could you possibly give me an ETA on adding these 2 if you plan to as well, would be much appreciated!

Best Regards
Posted on 2002-12-09 00:10:43 by SubEvil
Hi,

I'm currently implementing ISAPI interface in my little httpd. For this I missed most definitions in windows.inc.
They are not at all specific to Win2k or WinXP, but in my opinion it is not a good idea to put them in windows.inc, a separate header should be better. They're attached.

japheth

B.T.W: Why is it invalid to attach a .INC file? I had to rename it to httpext.asm :mad:
Posted on 2002-12-11 02:17:24 by japheth