some time ago i started coding an mp3Player on my win98 system. i want to upgrade to winXP, but some tests showed me, that it doesn't run under winXP. the ownerdrawn windows and button appear, but the window itself is transparent (i can "see" throuh it). i cant move it and no button has a label. also, no button has any function (i.e nothing happens if i click on it). currently i use the mci-system to play the music.
before i used fmod for playing - on starting my mp3Player winXP just spits out this message:


"diese anwendung ist keine zul?ssige Win32-Anwendung"

(translation)
"this application is not a valid Win32-application"

so, what the hell? winXP doesnt even allow me to start my prog?! but that happens to almost every assebler-application i wrote and i get.
is there any security-option activated which prevents to launch such "minimalist"-applics?
almost same to SoftIceNT - but thats another story...

greets, hartyl
Posted on 2003-01-19 04:55:02 by hartyl
maybe the PE alignement is too low... try to recompile using default settings.
Posted on 2003-01-19 04:58:55 by JCP
May not be exactly the same issue but just in case...

I had a similar problem when i tried to run an app on XP - worked fine on 98 but then the windows became transparent running on XP. These were windows with their own dialog proc...

Adding XOR eax,eax to the end of the dialog proc stopped them from becoming see thru
Posted on 2003-01-19 10:33:04 by MurkyT
nah! i just wanted to copy RadASM (my standard ide) on winXP to work there - but what the heck? same error? invalid win32-application? i can't get winXP!
@MurkyT: i'll try to add the xor eax,eax
@Readiosys: i'm used to use the default settings. any special options with the assembler of the masmv6-package?
Posted on 2003-01-19 11:10:47 by hartyl
I think readiosys is right here, it seems win98 doesn't care about file alignment as NT systems do...
May you try to recompile it and even add garbage as padding ?
Posted on 2003-01-19 16:23:02 by Axial

I think readiosys is right here, it seems win98 doesn't care about file alignment as NT systems do...
May you try to recompile it and even add garbage as padding ?

This must be related to XP systems not 2K/NT, because I have 2K and I use
small file alignment all the time. The smallest exe with a message-box I created
were about 720Bytes and it runs like a charm on 2K. I always thougt it was W/9X
systems wich didnt like alignment?
Posted on 2003-01-19 19:32:28 by natas
filealign... has changed alot over 9x and NT versions. some 9x allow small align, some NT. just use 512 and you'll be alright.

hartyl, do you use a non-standard linker or settings? i didn't run XP long before switching back to 2k, but I didn't have any problems with asm apps, as long as I didn't play around too much with the PE header.

things to remembre on NT: register preservation is even more important than on 9x (though you wont get BSODs from not following it). stack must be 4-byte aligned (not a problem unless you're *messing* with the stack). and you must return 0 ("xor eax, eax") in dlgproc if you don't handle the message. none of these should cause a "invalid win32 app" peldr messagebox though.
Posted on 2003-01-20 03:34:18 by f0dder

I think readiosys is right here, it seems win98 doesn't care about file alignment as NT systems do...
May you try to recompile it and even add garbage as padding ?
Right. Additionally, an important thing I've not read anywhere is that on NT systems all data pointers you pass to the API must be DWORD aligned. This maybe wasn't documented explicitly because is no problem in C/C++, since the compiler takes care of it, but in asm it's an issue.

Generally, the problem happens when one defines some structures in his/her source, and those structures aren't made DWORD aligned. A more common problem than it may seem.
Posted on 2003-01-20 05:44:44 by Maverick
it seems to me that i'd be easier and better if i chose win2k? i also thought about it too, not only because i usually can't stand winXP... but i gave it a try. i'll get win2k tomorrow and set it up - i'll tell you my results

greets, hartyl
Posted on 2003-01-20 13:24:49 by hartyl
2k == NT5.0, XP == NT5.1.
Shouldn't differ much. XP is just somewhat uglier.
Posted on 2003-01-20 13:28:36 by f0dder

2k == NT5.0, XP == NT5.1.
Shouldn't differ much. XP is just somewhat uglier.

They created XP for the people who care more about how a computer
looks! instead of how a computer works! Atleast that is my opinion.
I still have W/2K with the same old blue original background color. ( :grin: )
Posted on 2003-01-20 18:14:12 by natas
Originally posted by natas
They created XP for the people who care more about how a computer
looks! instead of how a computer works! Atleast that is my opinion.
I still have W/2K with the same old blue original background color. ( :grin: )
:stupid: Agreed.. and Mine is still the blue original background:grin:
Posted on 2003-01-21 03:03:07 by roticv
I have a nice homemade background. http://f0dder.oldleetos.net/m_a_m.png at the moment.

XP has some kernel improvement and stuff, but... any advantage seems to be gobbled up by the atrocious new GUI. and even in "?berclassic" mode with all the crap turned off, there's some stuff left. as it is now, I see no reason to upgrade to XP. win2k works fine.
Posted on 2003-01-21 03:47:28 by f0dder

I have a nice homemade background. http://f0dder.oldleetos.net/m_a_m.png at the moment.

XP has some kernel improvement and stuff, but... any advantage seems to be gobbled up by the atrocious new GUI. and even in "?berclassic" mode with all the crap turned off, there's some stuff left. as it is now, I see no reason to upgrade to XP. win2k works fine.

I especially liked this little fine reading: http://f0dder.oldleetos.net/xp-onering.txt ( :grin: )
Posted on 2003-01-21 04:17:48 by natas
unfortunately I can't claim credit for that text - if it had been written by me, there would probably have been some differences too. XP isn't that bad, really, as long as you have corporate version, block out sa.windows.com in your firewall, and aren't stupid enough to run the devilsown cdkey :)

Ohbtw, I have a legal copy of Office XP for small business here. We ordered some old version of wordperfect, but got OXP instead. There was also a note, "packed by mohamed". *giggle*
Posted on 2003-01-21 04:21:12 by f0dder
You really cannot imagine how much I can second that!

I've also had that problem so many times: asm app runs fine under
9x/ME, but won't run under XP and sometimes 2K, although they're
dealing with the API functions quite nicely and don't do any dirty stuff.

You cannot create a toolhelpsnapshot of a suspended process,
you can't use non-dword aligned structs in API funcs, you have to restore
all the registers' contents in a DlgProc before leaving it (or the app crahses
if you're not lucky), ... you just CANT program asm for XP! But everything
of the above works fine on 9x/ME
... so it's nothing more than one big
chicanery under the excuse of "security?" ... HA! Nothing of it is mentioned
in the msdn or other dev help files.

The above list grows and grows for every app I create, it's ridicolous.
We just want to code win32asm. Why do they make it so hard for us?!
What it really causes is that I don't have much time for creativity in designing
or programming ... because all of my time is wasted by searching for solutions
to make my apps work on 2k/xp.

My current problem is that my app that displays information about ShellLinks
and also can save them to new link files. Guess what? Calling IPersistFile::Save
fails under XP with some error code which I can't find any explanation for.

Oh, not to mention my other app, where I just want to set up winsock and send
some UDP data to some server... but I'm not even coming that far: socket() fails
with WSAEPROVIDERFAILEDINIT but it works fine under 9x/ME ... already tried
thousands of other ways (and I mean it!) to do it, but it just won't work!

Oh, and I recently got the error "not a valid Win32 application" on XP after loading
an exe into a hex editor and cut off all NULLs at the end of the file (except one, which
was a string terminator). It worked under 9x though.

Another thing is that some of my apps use usual MessageBoxes and on XP the
msgboxes are looking weird: no caption, no border. I tried to find the problem by
building a basic app displaying a msgbox and adding stuff until the problem occurs.
But it didnt!

Now I know what they meant when they told me that asm was hard ...

:mad: :mad: :mad: :mad:

After all, I'm kinda 'glad' that it's not only me who suffers of XP.


aweX <-
Posted on 2003-01-21 04:32:26 by aweX
naweX, stuff like having to align on 4-byte boundary isn't really that bad, is it? especially considering you get poor performance on non-aligned data. ok, so MSDN doesn't really talk about this, nor about register preservation. MSDN was written for C programmers, and C compilers handle the tedious stuff of alignment and preservation. I guess they could have devoted a single chapter to this stuff, though (and perhaps they have some info somewhere - haven't searched for it).

You don't have to restore all register contents in Dlg/WndProcs, just the standard ones. And only if used. And of course you have to return zer0 in your DlgProc if you don't handle the message - just like PSDK tells you to. That it works without this on 9x is your luck, not well-defined behaviour.

I've had no problem with winsock coding under neither 9x nor NT. And NT even provides raw sockets. 95%, it's you doing something wrong.

Not a valid win32 application? You messed with the file in a hex editor. Like it or not, but PEs should be padded to FileAlign. There isn't really *any* use of not doing this, as filesize will be a multiple of cluster size anyway, and these tend to be 4k, while filealign is normally either 4k or 512.

MsgBoxes showing up all weird? sounds like your stack isn't 4byte aligned. been pushing word-sized data or manually messing with esp? you do *not* want a non-4byte aligned stack pointer.

code clean and you will have less problems.
Posted on 2003-01-21 04:45:33 by f0dder
...and one shall come, to free us all, from the claws of terror,
he will be the great penguin, that will defeat the evil lord,
and the shadow of darkness will be eternally gone...

:grin:

-Stealth
Posted on 2003-01-21 04:46:38 by Stealth
hah
Posted on 2003-01-21 04:48:31 by f0dder
f0dder, I was just wondering why XP restricts operations in an unnecessary way!
Does the CPU not allow access on non-dword-aligned mem addresses?
Of course it does ... and I really give a damn if it's a bit slower,because you wouldn't
really notice it anyways.
And the other two issues I mentioned are OS-related. They don't work on XP, but
work on 9x/ME. So please don't tell us that "MSDN was written for C programmers".
You can't snapshot a suspended process, no matter if you program in C or ASM or
Brainf*ck (anyone know this language? ;) ) ...

Also, I didn't say it's hard to dword align my data. The problem is all the time I had to
spend for searching for the origin of those errors... Now that I know about
them, I will avoid them.

But, well try to find the bug in this small code...



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

include \MASM32\INCLUDE\windows.inc
include \MASM32\INCLUDE\kernel32.inc
include \MASM32\INCLUDE\user32.inc
include \MASM32\INCLUDE\wsock32.inc

includelib \MASM32\LIB\kernel32.lib
includelib \MASM32\LIB\user32.lib
includelib \MASM32\LIB\wsock32.lib

.data?

hSock dd ?
wsadata WSADATA <>
saddr sockaddr_in <>

.data

szData db "somedata", 0
szIP db "127.0.0.1", 0

.code

start:
invoke WSAStartup, 101h, ADDR wsadata
invoke socket, AF_INET, SOCK_DGRAM, IPPROTO_UDP
mov hSock, eax

invoke RtlZeroMemory, ADDR saddr, SIZEOF saddr
mov saddr.sin_family, AF_INET
invoke inet_addr, ADDR szIP
mov saddr.sin_addr.S_un.S_addr, eax
invoke htons, 12121
mov saddr.sin_port, ax

invoke sendto, hSock, ADDR szData, SIZEOF szData, NULL, ADDR saddr, SIZEOF saddr
invoke WSACleanup

invoke ExitProcess,1

end start


... it will generate an ERROR_MOD_NOT_FOUND at the sendto-invoke.

I also tried "bind". That won't change a thing though :(


aweX <-
Posted on 2003-01-23 09:42:58 by aweX