News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Bass.dll problem

Started by ragdog, December 03, 2017, 03:34:32 AM

Previous topic - Next topic

ragdog

Hello

I playing with the Bass.dll from un4seen.com all works fine if i run my code in a (exe project)
If i run my code in a (Dll project) it does not works.

I have debug my code LoadLibrary and GetProcadress all works fine it have a poblem with BASS_Init procedur
And can not debug this Proc.

Has any same problem?



.data?
hBassDll dd ?
pBASS_Init dd ?
pBASS_StreamCreateFile dd ?
pBASS_ChannelPlay dd ?

invoke LoadLibrary, chr$("bass24100.dll")
.if (eax)
mov hBassDll,eax
invoke GetProcAddress,hBassDll,chr$("BASS_Init")
.if (eax)
mov pBASS_Init,eax
push 0
push hWnd
push 0
push 44100
push -1
call dword ptr [pBASS_Init] ;<<<<<<<<<<<<<
.if (eax)
invoke GetProcAddress,hBassDll,chr$("BASS_StreamCreateFile")
.if (eax)
mov pBASS_StreamCreateFile,eax
push 0
push dword ptr [qwSize+4]
push dword ptr [qwSize]
push dword ptr [qwSize+4]
push dword ptr [qwSize]
push chr$ ("music.mp3")
push FALSE
call dword ptr [pBASS_StreamCreateFile]
.if (eax)
mov ebx,eax
invoke GetProcAddress,hBassDll,chr$("BASS_ChannelPlay")
.if (eax)
mov pBASS_ChannelPlay,eax

push 0
push ebx
call dword ptr [pBASS_ChannelPlay]
.endif
.endif
.endif
.endif
.endif
.endif

felipe

 :idea:

Maybe you need to put more information here for get help. I mean you can't debug the proc, but where is the source code of the proc?


If not available maybe you need to get information from that proc (assuming is a proc from the Bass.dll) with some tool.


fearless

Is the resource (music file) stored in the compiled dll? if so then you probably need to use findresource, lockresource etc to use it when loading it from the dll itself, otherwise resources loaded will use the hInstance of the main program that uses the dll, and look for the resource in the main program and not in the dll resources. I think.

ragdog

Hi thanks for trying to help

QuoteMaybe you need to put more information here for get help. I mean you can't debug the proc, but where is the source code of the proc?


If not available maybe you need to get information from that proc (assuming is a proc from the Bass.dll) with some tool.

This is my source code of the proc i cannot debug this bass dll correctly in hangs in bass_init by directsound and my debugger works any more.


@fear
i use not a resource file i load from a path.
The music file load ok but before i load the music must i initialize the bass with BASS_Init
If i have a  exe project works all fine but not by a dll project.

aw27

I don't see any procedure. I see sparse code.
If that sparse code is called in the entry point it is guaranteed to freeze.

ragdog

The code works fine i have make test in a exe aplication
and it give not any procdur or should I now make a procdedur like xyz

xyz proc
Bass int code
and play mp3
xyz endp

I said allready in my exe project and test works fine but not in a dll project Bass_init is fail.

nidud

#6
deleted

ragdog

Yes works fine in WinMain proc oder DlgMain Proc called by DialogBoxParam
But my dll call this in a DllEntry

The sdk help from Bass say

QuoteBOOL BASS_Init(
    int device,
    DWORD freq,
    DWORD flags,
    HWND win,
    GUID *clsid

win The application's main window... 0 = the desktop window (use this for console applications). 
);

i have change in Bass_Init remove hWnd to NULL for desktop
push 0
push    0;hWnd  <<
push 0
push 44100
push -1
call dword ptr [pBASS_Init] ;<<<<<<<<<<<<<


but is same fail

ps: nidud
is this a hjwasm code?

nidud

#8
deleted

aw27

Quote from: ragdog on December 03, 2017, 07:46:52 AM
The code works fine i have make test in a exe aplication
and it give not any procdur or should I now make a procdedur like xyz

xyz proc
Bass int code
and play mp3
xyz endp

I said allready in my exe project and test works fine but not in a dll project Bass_init is fail.

You did not get the point of my comment.
I said that if you call that in the entry point it will freeze. So, you are calling that in the entry point of the DLL and believe it is absolutely normal and should work.  :badgrin:
It will never work.

ragdog

QuoteYou did not get the point of my comment.
I said that if you call that in the entry point it will freeze. So, you are calling that in the entry point of the DLL and believe it is absolutely normal and should work.  :badgrin:
It will never work.

Why?

The dll is loaded when the Main.exe window is created (WM_INITDIALOG)

Or give a better soulution?

aw27

Quote from: ragdog on December 03, 2017, 06:47:30 PM
Or give a better soulution?

You were expected to know it  :dazzled:
Quoting Microsoft:
"The entry-point function should perform only simple initialization or termination tasks. It must not call the LoadLibrary or LoadLibraryEx function (or a function that calls these functions), because this may create dependency loops in the DLL load order. This can result in a DLL being used before the system has executed its initialization code."





ragdog

I forgot

But i use now a Procedur for this code and call it with GetProcAdress

example:

invoke LoadLibrary, chr$("Player.dll")
invoke GetProcAddress,eax,chr$("Player_Init")
call  eax

Player_Init proc

invoke LoadLibrary, chr$("bass24100.dll")
.if (eax)
mov hBassDll,eax
invoke GetProcAddress,hBassDll,chr$("BASS_Init")
.if (eax)
mov pBASS_Init,eax
push 0
pushNULL
push 0
push 44100
push -1
call dword ptr [pBASS_Init] ;<<<<<<<<<<<<<
                    .endif
           .endif
Player_Init endp


is the same problem with Bass_init

aw27

OK, what I have seen so far is that you forget the basics so bugs can happen anywhere. Since we are too lazy to do it, may be someone would bother to reconstructed a demo from your sparse snippets, and check it.

nidud

#14
deleted