News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

prog works under W98 but not under XP

Started by BBalazs, November 17, 2006, 08:53:53 PM

Previous topic - Next topic

BBalazs

Hi, I am new to this forum, but I have been programming assembly for a longer time.

I have written a small prog, that controls the mixer. I have experienced, it works under w98 but not under XP.
It drived me mad, because I was absolutely sure, that my program is correct. It gave me error 1 - invalid ID.

The solution was: The address of structures NEED to be aligned to 4 under XP, but it is not neccessary under w98.

Did anybody else face this problem?

Is it general to any API or selective for winmm under XP? (Until this point I had not the slightest idea about it, because I just wrote programs for W98).



remus2k

hi BBalazs

i hope it continue to help to you
I have only this example unfortunately

remus2k

[attachment deleted by admin]

BBalazs

Hi Remus2k,

Thanks, but I have already solved my problem, just was curious, whether anybody else met this 'feature' or it is a unique one?

I am afraid, this prog attached failed to work anyhow. Just puts a list window and does nothing...


remus2k

I do not point like I to you still further to help could
if you want can you your source post then could I that look at itself

hutch--

BBalazs,

There are usually a couple of things that effect which OS an app runs on, slight changes to how the OS implements an API call or in some cases incorrectly preserved registers that did not effect win9x but do effect later versions.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

BBalazs

Thanks, Hutch, this is what I was afraid of...

Remus2K, here is the code, the Szamot_Betesz proc is just for debugging, displays the error code returning from API.
Other variables are also for test only.
Prog sets the mixer element with control ID 9 to 1
In this form, it works under both OSs. Displays a 00000 and sets the control (you can check it by opening the entire list of sound controllers). Just remove or add a zero to the line with db and see what happens under XP. It gives you 00001 error message, that means there is no such an ID.


.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\winmm.inc

includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\winmm.lib

Szamot_Betesz proto :DWORD

.data
osztok dd 1000000000,100000000,10000000,1000000,100000,10000,1000,100,10,1,0
fejlece db 'Ezafejlec',0,0,0

.data
mixerControlDetails_unsigned MIXERCONTROLDETAILS_UNSIGNED <0>           
mixerControlDetails MIXERCONTROLDETAILS <0>           
szepite db 0
szam32cim db "0000000000",0,0,0,0
szamcim db "00000000",0
foszam dd 0
hMixer dd 0

.data?
hahah dd ?

.code

start:
invoke mixerOpen,addr hMixer,NULL,NULL,NULL,NULL

mov mixerControlDetails.cbStruct, sizeof MIXERCONTROLDETAILS
mov mixerControlDetails.dwControlID, 9
mov mixerControlDetails.cChannels,1
mov mixerControlDetails.cMultipleItems,0
mov mixerControlDetails.paDetails, offset mixerControlDetails_unsigned
mov mixerControlDetails.cbDetails, sizeof mixerControlDetails_unsigned
invoke mixerGetControlDetails, hMixer, addr mixerControlDetails, MIXER_GETCONTROLDETAILSF_VALUE
    invoke Szamot_Betesz, eax
    invoke MessageBox, NULL, addr szam32cim, addr fejlece, MB_OK
        mov mixerControlDetails_unsigned.dwValue,1
invoke mixerSetControlDetails, hMixer, addr mixerControlDetails, MIXER_GETCONTROLDETAILSF_VALUE

invoke mixerClose,hMixer
xor eax,eax
invoke ExitProcess, eax
ret

Szamot_Betesz proc szam:DWORD
        LOCAL eloszor:BYTE
pushad
mov eax,szam
mov eloszor,0
mov ecx,10
mov esi,0
mov edi,0
   dsp32:
xor edx,edx
mov ebx,osztok[esi]
div ebx
add al,'0'
cmp szepite,1
jne dsp33
cmp al,'0'
jne dsp34
cmp eloszor,1
je dsp33
cmp ecx,1
je dsp33
mov al,' '
jmp short dsp33
    dsp34:
mov eloszor,1
   dsp33:
mov szam32cim[edi],al
inc edi
add esi,4
mov eax,edx
loop dsp32
popad
mov eax,offset szam32cim
ret
Szamot_Betesz endp

end start


remus2k

by me work this prog I point as I to you further to help could!

I still few id's added


.const
wave                     = 1
wave_mute            = 2
wave_output          = 3
wave_output_mute = 4
midi_output            = 5
midi_output_mute   = 6
mono_in                 = 7
mono_in_mute        = 8
micro                     = 9
micro_mute            = 10
cd                         = 11
cd_mute                = 12
aux_in                   = 13
aux_mute              = 14
line_in                   = 15
line_in_mute          = 16

....
........

........................

.code

start:
invoke mixerOpen,addr hMixer,NULL,NULL,NULL,NULL

mov mixerControlDetails.cbStruct, sizeof MIXERCONTROLDETAILS
mov mixerControlDetails.dwControlID, offset wave
mov mixerControlDetails.cChannels,1
mov mixerControlDetails.cMultipleItems,0

BBalazs

Remus2k,

do you use a German/English translator program? Your order of words similar to German sentences.
Please, try to remove a null (0) from the line 'fejlece db blahblah,0,0,0'
Or insert a line with 'haha db 0' between the '.data' and 'mixerControlDeitals...'
In that case, the program won't work on computers with XP. I have checked it on the computers available around me.
I suppose it does not work under XP (gives a 00001 error).

Anyway, I would like to thank you for your care.
Danke sehr   :wink

donkey

Hi BBalazs,

Whether someone has had this problem is pretty much hit and miss, Windows98 was introduced at the start of the SIMD (MMX/SSE) period and did not use that instruction set extensively (actually I think it was switrchable at the OS level), XP does make extensive use of it, especially in multimedia APIs. The consequence of that change is that the SIMD instructions sometimes require specific alignment where the Von Neuman instructions used in earlier versions did not. The advanatage is ofcourse a significant increase in performance, the price is the breaking of some code in a way that is easily fixed.

Donkey
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

BBalazs

#9
Donkey,

Thank you for your comment.
So, it needs a huge effort to adapt my programs to XP in the future.


dsouza123

If you are going to use SSE/SSE2 use align 16 on the data,
then you can get a speedup by using the aligned versions of the transfer instructions.

BBalazs