flat assembler
Message board for the users of flat assembler.

Index > Windows > DLL bug?

Author
Thread Post new topic Reply to topic
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001 12 Apr 2012, 15:39
when assembled with 'relc' fixups,
this dll crashes on LoadLibraryW.

when removed 'relc' fixups,
this dll cannot be loaded to other address but have to be loaded to its IMAGEBASE.

how to fix this?
did some homework:
not the empty section bug, the size of section 'relc' is not zero.

any help is appreciated.


Description:
Download
Filename: build.asm
Filesize: 538 Bytes
Downloaded: 331 Time(s)

Description:
Download
Filename: cxrt4win.asm
Filesize: 6.2 KB
Downloaded: 350 Time(s)

Post 12 Apr 2012, 15:39
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 12 Apr 2012, 16:54
At DllMain you have " mov ebx,GenerateIncFile", what is this for? It doesn't look like you can take any benefit out of it and at the same time you are violating the stdcall convention so you may be causing the caller of DllMain to crash.

[edit]I get no crash here, and I must say I'm a bit surprised considering the code hits an int3. I have Windows 7 64-bit Home Premium[/edit]
Post 12 Apr 2012, 16:54
View user's profile Send private message Reply with quote
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001 13 Apr 2012, 06:05
LocoDelAssembly wrote:
At DllMain you have " mov ebx,GenerateIncFile", what is this for? It doesn't look like you can take any benefit out of it and at the same time you are violating the stdcall convention so you may be causing the caller of DllMain to crash.

[edit]I get no crash here, and I must say I'm a bit surprised considering the code hits an int3. I have Windows 7 64-bit Home Premium[/edit]


at first, i tried to export the address of GenerateIncFile out of the DllMain,
but it doesn't work,you can delete that line.

see the screenshot.


Description:
Filesize: 36.23 KB
Viewed: 2816 Time(s)

FASM_DLL_CRASH_ON_SEC_FIXUPS.png


Post 13 Apr 2012, 06:05
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 13 Apr 2012, 15:55
Does the example that comes with fasm work? I don't know what could be the source of complain.

Try using canonical names for the sections to see if there is any improvement (i.e. '.idata' for imports, '.reloc' for fixups, etc.).
Post 13 Apr 2012, 15:55
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.