hi all,

sorry for stressing again about NT compatibility.
I didn't really understand these 2 points:

1) is there a rule that always work to make an app. to be NT compatible ?
(now i'm always preserving ebx esi edi in every procedure. Is it necessary or i only need to preserve them in WndProc ?)

2) i've released a little prog to a friend that use NT. He has saved it in a folder and launched some executions of this little application. Now everytime he do a 'Save As' operation in explorer, in the Save As dialog box the HD icon is replaced from the icon of my Application ! (He told me my prog. written in asm is a virus... :( ). Fortunately this happen until my application is deleted from HD. Hope you've understand... Is it a bug of NT or is my app. not completely compatible ?

If someone would help... always THX B7
Posted on 2002-01-26 07:46:22 by Bit7
You must preserve the registers in callbacks. WndProc, DlgProc,
and enumwindowproc are samples of callbacks. If you do register
preservation in ie wndproc, you don't really need to do preservation
in all subfunctions. But remember that windows can trash the registers
whenever you call an API.

It also helps to fill out structures completely (start by zerofilling them,
set cbSize parameter, fill out everything that platformsdk says you
have to fill out) before passing them to APIs. Don't ignore api parameters
unless the platformsdk says they're optional.

Remember returning 0 in DlgProc if you don't process the message.
Don't depend on too much undocumented stuff.
Posted on 2002-01-26 08:05:44 by f0dder
1. Preserve them in any function that is called by windows. If they are your own functions, it's your own choice but I recommend doing the same for those.
Making a program NT compatible isn't really a problem, just stick to the windows rules and don't use dirty stuff (most of which do work in win9x). Some APIs have small differences between 9x and NT, but they are rare.
The best method is to develop on a win2k machine (or winxp if you can stand the colors :) ) if one's available.

2. Hmm I don't think compatibity issues can cause such a thing, what kind of program was it?

Thomas
Posted on 2002-01-26 08:08:12 by Thomas
thanks for the answers..

Thomas,
program i was talking is my "newtime" program, little utility attached.

B7
Posted on 2002-01-26 10:40:35 by Bit7
Bit7, sorry to say that but it works very badly on my win2000 box...
The Window is "transparent" in some parts, and when i click on select file(s), I can't close the "Open file" dlg that appears...

The window doesn't have titlebar, also...
Posted on 2002-01-26 11:11:50 by JCP
Readiosys,

thx for info... i really don't know... i will look into the code..
Posted on 2002-01-26 13:20:01 by Bit7
Hi, Bit7

I had same problem something like u, if i modify ebx, or esi before
call windows callback function(such as DefWinProc).

Other registers doesn't matter, only ebx, esi does, I think.
(I don't know why is this, tell me anyone.)

and i modify your TASM src to MASM.
(I don't know TASM yet.)

1. In your src, i found something you forgot.
======================================
DlgProc proc uses ebx esi edi, hDlg:DWORD, wmsg:DWORD, wparam:DWORD, lparam:DWORD

cmp wmsg,WM_INITDIALOG
je InitDlg
cmp wmsg,WM_PAINT
je Paint
cmp wmsg,WM_COMMAND
je Command
cmp wmsg,WM_DESTROY
je Destroy
cmp wmsg,WM_CLOSE
je Destroy

xor eax, eax ;;; inserted code

ret

========================================
2. After call "wsprintf" your code restore stack frame,
"add esp, 0ch"

in case masm, "invoke" restores stack frame automatic,
but "call" doesn't, as i understand.

as TASM, i don't know about this.
if "call" does not restore it, you are right.
but you must delete these codes.

3.
i modified below.

;;;;;;;;;;;;;;;;;;;;;;;;mov lvcol.pszText, offset ebx
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
mov lvcol.pszText, ebx ;;;;;; modified code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Posted on 2002-01-28 02:10:46 by muzidowa
muzidowa ,

infinite thanks for the time you've spent on my trouble.

Now i'm @job. When back @ home i will modify everything as you
suggest. About esp, seems the 'call' instr don't restore the stack frame, so i have to add 12 to esp.
Posted on 2002-01-28 03:09:46 by Bit7
Hi,

spending several days just to understand using ebx and Co. or not I found this piece of s**t:

#pragma aux __cdecl "_*" \
parm caller [] \
value struct float struct routine \
modify

which is used as calling convention in M$ API.

That means any (Windows) API function can trash eax ecx and edx but it assumes that ebx edi and esi will have the same value after each call. That way if Windows calls your proc() you have to save ebx.

Just for info: clearing ebx in a timer callback proc
will shut down your machine immediately.

Bye Miracle
Posted on 2002-01-28 03:32:36 by miracle
muzidowa,

i've checked better everithing...

about

LV_ITEM's member name
;;; Label "Normal" to "NormalXX"
;;; WNDCLASSEX's member name
;;; OpenDialog : hInst -> hInstance
;;; OPENFILENAME's member name

i've used different names couse in tasm if i duplicate some name in different structures i get compiling error, so this is the reason i've changed some structures member names in non standard names, but that shouldn't be a problem for proper working of the exe.

about adding esp,12, for "call" instruction it is right. If i take it away i got soon a stack error. Responsability to pop parameters out of the stack is of my application.

you're right about
mov lvcol.pszText,offset ebx => mov lvcol.pszText,
i've soon corrected it.
but the mistery is "why it was working" in wrong form ?????

I've also ZEROED all the structures before filling them, as f0dder suggested.

I will try it soon on NT.
THANKS muzidowa, you spent too much time to convert my prog into masm...
THANKS again to all.

PS: i'm going to install windows 2K. If i develope an app in 2K, is it then compatible in 95/98 ? And in NT ?
Posted on 2002-01-28 15:21:50 by Bit7

PS: i'm going to install windows 2K. If i develope an app in 2K, is it then compatible in 95/98 ? And in NT ?

More or less. If you don't use any of the NT-specific calls, I can't think
of any reason an app that runs under 2k would fail on any of the
other versions.
Posted on 2002-01-28 15:26:53 by f0dder
f0dder,

this is a very good notice.

Now i can switch to 2K with more happines ... i'm so excited..

Tomorrow if i find 2 hours.....

BYE & THX
Posted on 2002-01-28 15:47:51 by Bit7