News:

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

problem with mmsystem.inc

Started by dancho, July 08, 2006, 12:46:21 PM

Previous topic - Next topic

dancho

I am doing some research about directshow and directshow filters,and I want to programming
some examples ( basic stuff like play avi , play wav etc )...
In oder to do that I converted dshow.h ( header file from DirectX SDK required for all
directshow applications ) and all header files point by dshow.h to masm inc and lib...
I used h2incx and inc2l tools ,
and that conversions went fine without any errors...
There are 2 library files that directshow use:
-one is quartz.lib ( already in masm/inc and masm/lib )
-second is strmiidsd.lib ( Exports class identifiers (CLSIDs) and interface identifiers (IIDs) ),
and I need to convert this library to inc file...

Now I tried with l2inc,it cant convert,
and with lib2def,def2inc , it cant convert...

This is download link for strmiids.lib ...
Download-Link: http://rapidshare.de/files/25277421/strmiids.7z.html

Hope that someone can help me with my problem...
Thx
---------------------------------------------------------------------------------------------

THY very much Vortex,your tool lib2inc did conversation without any errors...

:clap: :U :green2




dancho

There isnt big reason for starting a new thread,
so I will use this one...
I have problems with mmsystem include file...
I used h2incx to convert mmsystem.h to mmsystem.inc and then inc2l to
convert to mmsystem.lib,
all that went wihout any errors...
I placed them in /include and /lib folders...
But after assembling Masm repotrs this errors...

QuoteC:\Masm32\Include\mmsystem.inc(64) : error A2163: non-benign structure redefinition: incorrect initializers : MMTIME
C:\Masm32\Include\mmsystem.inc(64) : error A2164: non-benign structure redefinition: too few initializers : MMTIME
C:\Masm32\Include\mmsystem.inc(80) : error A2164: non-benign structure redefinition: too few initializers : MMTIME
C:\Masm32\Include\mmsystem.inc(81) : fatal error A1010: unmatched block nesting

MSDN informs that MMTIME structure looks like this:

Quotetypedef struct mmtime_tag {
  UINT wType;
  union {
    DWORD ms;
    DWORD sample;
    DWORD cb;
    DWORD ticks;
    struct {
      BYTE hour;
      BYTE min;
      BYTE sec;
      BYTE frame;
      BYTE fps;
      BYTE dummy;
      BYTE pad[2]
    } smpte;
    struct {
      DWORD songptrpos;
    } midi;
  } u;
} MMTIME;

and this is MMTIME structure in mmsystem.inc:

QuoteMMTIME   struct
wType   DWORD   ?
union u
ms   DWORD   ?
sample   DWORD   ?
cb   DWORD   ?
ticks   DWORD   ?
struct smpte
hour   BYTE   ?
min   BYTE   ?
sec   BYTE   ?
frame   BYTE   ?
fps   BYTE   ?
dummy   BYTE   ?
ifdef _WIN32
pad   BYTE 2 dup (?)
endif
ends
struct midi
songptrpos   DWORD   ?
ends
ends
MMTIME   ends

I just dont understand why Masm reprts errors...
This is link for mmsystem.h and mmsystem.inc I used...

Download-Link: http://rapidshare.de/files/25448937/mmsystem.7z.html

Thx...








dancho

I just download Win32Inc.zip file from http://www.japheth.de/ to try his
mmsystem.inc...
Same errors...

Ian_B

Try simplifying the definition, and removing the nested definitions which complicate things. The midi "struct" of a single DWORD is somewhat pointless as the name isn't needed to refer to it, in fact unless those structs are used outside this one you might as well "flatten" the whole thing and keep the names as comments to help you rather than trying to copy the overly complex C definition slavishly. I don't know whether the IFDEF is valid in the middle, but since you're programming in MASM and therefore in Windows, and structures are best aligned internally by DWORDs, it'd be easier to add the padding and not qualify it. Indentation always helps the reader (and often the writer) too...  :bg

I am confused, though, by the union definition. My understanding was that all the elements stated to be in a union should be the same size - clearly eight bytes (the length of the smpte struct) are not the same length as a DWORD (any of the preceding unioned entries or the midi struct).

Try this:


SMPTE struct
   hour        BYTE ?
   min         BYTE ?
   sec         BYTE ?
   frame       BYTE ?
   fps         BYTE ?
   dummy       BYTE ?
   pad         BYTE 2 dup (?)
SMPTE ends

MMTIME struct
   wType       DWORD ?
   UNION
       ms          DWORD ?
       sample      DWORD ?
       cb          DWORD ?
       ticks       DWORD ?
                   SMPTE <>        ; SMPTE entry
       songptrpos  DWORD ?         ; MIDI entry
   ENDS
MMTIME ends


Ian_B

dancho

this is how windows.inc see MMTIME structure:

Quotesmpte STRUCT
  hour      BYTE      ?
  minute    BYTE      ?
  sec       BYTE      ?
  frame     BYTE      ?
  fps       BYTE      ?
  dummy     BYTE      ?
  pad       BYTE      2 dup(?)
smpte ENDS

midi STRUCT
  songptrpos  DWORD      ?
midi ENDS

MMUNION UNION
  ms        DWORD ?
  sample    DWORD ?
  cb        DWORD ?
  ticks     DWORD ?
  smp       smpte <>
  midi1     midi <>
MMUNION ENDS

MMTIME STRUCT
  wType     DWORD      ?
  u         MMUNION <>
MMTIME ENDS

I did try to replace mmsystem definition with this one,
but errors are here too...



Casper

Your problem is caused by the fact that MMTIME already exists in windows.inc, that is what is meant by the clue word 'redefinition' in your error message.  REM it out in windows.inc as it is very different and you will be good to go.

Paul

dancho

QuoteYour problem is caused by the fact that MMTIME already exists in windows.inc, that is what is meant by the clue word 'redefinition' in your error message.  REM it out in windows.inc as it is very different and you will be good to go.

well good thing is Masm dont report errors about MMTIME ,
but instead I have 64 new different errors...

:green


P1

Quote from: dancho on July 10, 2006, 06:04:20 PMwell good thing is Masm dont report errors about MMTIME ,
but instead I have 64 new different errors...
Sixty-four events of error on the list, Sixty-four events of error, cross one off and test for the rest.  Sixty-three events of error on the list, .... ( hum to 99 bottles of beer. )   :green2

Regards,  P1  :8)

Casper

P1, you are a very funny man.  :wink

dancho, that is normal, work your way through them, if you have errors you cannot solve, just report them.  By the way, I hope you did not rem out windows.inc, just the structure within.  It is difficult (and no fun) to work blind, like this.

Paul

dancho

QuoteBy the way, I hope you did not rem out windows.inc, just the structure within.

I rem MMTIME structure inside windows.inc...
Thx for your time and replies...


Ian_B

Quote from: Ian_B on July 10, 2006, 04:51:17 PMI am confused, though, by the union definition. My understanding was that all the elements stated to be in a union should be the same size - clearly eight bytes (the length of the smpte struct) are not the same length as a DWORD (any of the preceding unioned entries or the midi struct).

Can one of you worthies comment on this, please?

P1

Quote from: Ian_B on July 10, 2006, 09:16:06 PMCan one of you worthies comment on this, please?
You can union what ever you want, unless there are alignment issues involved.  Then there is just some padded bytes to account for.  But if you define your members properly and use their labels.  I do not see where member size is an issue.

I can see that the 64/128bit alignment on 64byte boundaries maybe a interesting developement issue later for the 64bit uPs/OSes in software. 

Regards,  P1  :8)

Ian_B

I was just wondering what the size of the struct will be, if say you were arraying it - if one possible union member is a DWORD and the other is a QWORD in length. But I guess that the size reported and reserved is that of the largest union member, and the "padding" of smaller members is taken care of. It's just not as tidy as I like...  ::)

dancho

After reming all structure in windows.inc that was defined in mmsystem too,
this is kind of errors I am getting now ( a lot of )...

Quoteproto_DRVCALLBACK typedef proto stdcall :HDRVR,:DWORD,:DWORD,:DWORD,:DWORDC:\Masm32\Include\mmsystem.inc(295) :

error A2006: undefined symbol : HDRVR
C:\Masm32\Include\mmsystem.inc(295) : error A2195: parameter or local cannot have void type
C:\Masm32\Include\mmsystem.inc(295) : error A2129: VARARG parameter must be last parameter

it is a strange because line before is ok ( HDRVR symbol ) ...

Quoteproto_DefDriverProc typedef proto stdcall :DWORD, :HDRVR, :DWORD, :LPARAM, :LPARAM

and errors like this:

Quoteproto_mmioClose typedef proto stdcall :HMMIO, :DWORD

C:\Masm32\Include\mmsystem.inc(2728) : error A2006: undefined symbol : HMMIO
C:\Masm32\Include\mmsystem.inc(2728) : error A2195: parameter or local cannot have void type
C:\Masm32\Include\mmsystem.inc(2728) : error A2129: VARARG parameter must be last parameter

and Masm now reports some errors in stdio.inc  :boohoo:

I just dont belive this mess,
and all I wanted was to code some examples from Directshow ...
What can I do about this errors??!!

any help would be greatly appreciated...
thx...


dancho

#14
After copy/paste all include files from Win32Inc.zip ( http://www.japheth.de/ ) to masm\include folder
I dont get any errors from masm about mmtime and others mm structure,but
I have reports about errors in user32.inc file,like this:

QuoteC:\Masm32\Include\user32.inc(13) : error A2005: symbol redefinition : _imp__ActivateKeyboardLayout@8

it is strange to me because after searching include folder only file where
ActivateKeyboardLayout is user32.inc... :eek  :dazzled: