News:

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

DLL crashing

Started by bozo, February 08, 2008, 04:02:27 PM

Previous topic - Next topic

bozo

After assembling a couple of DLL files using MASM and running them in a program, it seems that if it is loaded more than once, it crashes.
This is, i believe due to memory access (couldn't debug yet)

Has anyone here experienced this problem before, and if so, how was it resolved?

BogdanOntanu

NO, nobody on this forum has ever experienced a bug before.

If this impossible thing would ever happen to our programs then we would never use a debugger, never use log output from our program and never use our brain to check out the program logic for possible problems.

Instead we would ask on this forum and because everybody here can telepathically read minds somebody will know what the problem is and will fix it for us remotely.

All you have to do is to ask a vague question here and then sit and wait in front of your source code editor and the bug will fix itself.

Please never explain the problem and the context in great details because it is never needed for telepathic mind readers.
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

zooba

You can't load a DLL more than once - they are reference counted.

I had a problem like this once, and it was resolved by fixing the bug in the DLL.

Seriously, a little more information would be helpful.  :wink

Cheers,

Zooba :U

hutch--

YEAH,

Telepathy is a highly esoteric debugging tool driven by pure imagination. More info please.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

bozo

The DLL is a plugin.
The software that runs it is protected executable.

It was a simple question, lads.
You can close the fucking account, Hutch - because this forum is fucking useless to me anyway.

None of you know the answer, simple as that.

hutch--

Kernel,

Actually look at the question you asked. An unknown DLL run by an unknown EXE with unknown code, what are we suposed to be, masters in extra sensory perception.

> None of you know the answer, simple as that.

Its even worse than that, you don't know what question to ask, simple as that.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Quote from: Kernel_Gaddafi on February 09, 2008, 05:07:11 AM
You can close the fucking account, Hutch - because this forum is fucking useless to me anyway.
Hmmm... imho the real Gaddafi has much better manners. :boohoo:

ecube

Quote from: jj2007 on February 09, 2008, 03:20:57 PM
Quote from: Kernel_Gaddafi on February 09, 2008, 05:07:11 AM
You can close the fucking account, Hutch - because this forum is fucking useless to me anyway.
Hmmm... imho the real Gaddafi has much better manners. :boohoo:

no, kernel asked a fair question, it was general and without much detail but it still didn't require a sarcastic and degrading response by BogdanOntanu.  This is an elite community,consisting of mature and intelligent individuals, which makes it a shame when even moderators are messing up its harmony.

NightWare

Quote from: E^cube on February 10, 2008, 12:25:00 AM
This is an elite community,consisting of mature and intelligent individuals
:eek? since when ? for info, it's just a forum where people have a common interrest, the members are not all mature, intelligence is a very relative thing, and it's definitly not an elite community (read some topics)...  :P you should live in the real world...

donkey

Quote from: Kernel_Gaddafi on February 08, 2008, 04:02:27 PM
After assembling a couple of DLL files using MASM and running them in a program, it seems that if it is loaded more than once, it crashes.
This is, i believe due to memory access (couldn't debug yet)

Has anyone here experienced this problem before, and if so, how was it resolved?

Hi Kernel_Gaddafi,

What crashes, the app or the dll, you should be able to see details of the crash using the DrWatson dump file regardless of which module crashed. You can check to see what your JIT debugger is in the registry key "SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug"

As a general rule I find that this type of thing can happen in DLL's when I create a deadlock condition in DLLMain, this is normally caused by dependencies from API calls. For example if you make a call to a USER32 function and it calls another DLL that has not yet been loaded because the load order has changed. There can be no guarantee of load order with the exception that Kernel32 will always be present when DLLMain is called. I have also run into problems with unpreserved registers that have caused this problem though those are more easily found and I assume you have checked for them.

As for the comments, I found them hilarious and they should be taken as just a funny bit of sarcasm, smile, life's too short to get pissed off all the time ;)

This is a good document to read for DLL best practices...

http://www.microsoft.com/whdc/driver/kernel/DLL_bestprac.mspx

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

ecube

Quote from: NightWare on February 10, 2008, 03:04:50 AM
Quote from: E^cube on February 10, 2008, 12:25:00 AM
This is an elite community,consisting of mature and intelligent individuals
:eek? since when ? for info, it's just a forum where people have a common interrest, the members are not all mature, intelligence is a very relative thing, and it's definitly not an elite community (read some topics)...  :P you should live in the real world...


This is an elite community... as every other ASM community is dead or near extinction. Not only that but this forum *does consist of HIGHLY intelligent, mature individuals, such as lingo,donkey,vortex,ghirai,jibz,hutch,michealw,james, etc... so before you insult anyone else take a look around and appreciate the quality members that are still here, as they don't have to be.

also Kernel_Gaddafi i've found creating a new thread seems to help overcome issues


DllEntry proc hInstance:HINSTANCE, reason:DWORD, reserved1:DWORD
.if reason==DLL_PROCESS_ATTACH
invoke CreateThread, NULL, 0, addr newthread, 0, 0, 0
invoke CloseHandle, eax
.endif
mov eax,TRUE
ret
DllEntry endp

newthread proc
etc...

newthread endp


Also the stackprobe macro here somewhere on the forum is great to use with proc's.

bozo

QuoteIts even worse than that, you don't know what question to ask, simple as that.

it was a general question about problems encountered when loading a DLL (created with masm) more than once into a process space.
if i could debug the program easily, i wouldn't have asked anything..there are obviously some masm parameters missing when assembling the dll.

i'll take a look at the dll document, donkey - thanks
and thanks e^cube for the code.

sinsi

Quoteit seems that if it is loaded more than once, it crashes.
Does this mean you are loading the DLL from your EXE more than once, or running your EXE more than once?
QuoteAfter assembling a couple of DLL files using MASM
Can you isolate it to just one DLL?

As for the comments, my thoughts are -
  - the original question was a little vague, but then again so are many posts here
  - some people seem to have taken BogdanOntanu's reply as "setting the tone" and copied it with a smartarse remark
  - "an elite community", that gave me the best laugh I've had for a few days...sometimes this forum is a little narrow-focus and a little prima-donna-ish  :(
Light travels faster than sound, that's why some people seem bright until you hear them.

jj2007

Quote from: jj2007 on February 09, 2008, 03:20:57 PM
Quote from: Kernel_Gaddafi on February 09, 2008, 05:07:11 AM
You can close the fucking account, Hutch - because this forum is fucking useless to me anyway.
Hmmm... imho the real Gaddafi has much better manners. :boohoo:

"this forum is fucking useless" is not something that I consider appropriate language, therefore my sarcastic answer.

ToutEnMasm


Be cool,
Nobodies is perfect.
More informations and perhaps sources code will be welcome to solve the problem.