flat assembler
Message board for the users of flat assembler.

Index > Windows > 0xc000007b

Author
Thread Post new topic Reply to topic
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
Some one handed be a project before that showed me how to make DLLs in C and FASM and how to call them in fasm and c. The problem is that the code is way over my head, still. I tried to make a dll in c, and did. The code is below.

Code:
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>

void __stdcall printint(int a);
void __stdcall printstring(char *string);
void __stdcall printbin(char a);
void test();

BOOL APIENTRY DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    return TRUE;
}

void __stdcall printint(int a){
        printf("%i", a);
        return; }

void __stdcall printstring(char *string){
        printf(string);
        return; }

void __stdcall printbin(char a){
        for(unsigned __int8 key=128; key; key=key>>1)
                if (a&key)
                        printf("1");
                else
                        printf("0");
        return; }

void test(){
        printf("TEST");
        return; }    


Then i tried modifying the code in the DLL example that comes with FASM, and made it is below.

Code:
format PE CONSOLE

db "This program was made by Kohlrak ([REMOVED REAL NAME]). This is an edit of an example in fasm. It is not entire of my own "
db "creation. "

entry start

include 'K:\ASM\INCLUDE\win32a.inc' ;you must specify a full path name on my computer to prevent error

section '.code' code readable executable

  start:
        invoke  tessst,3 ;test is a label (it appears), so i added 2 Ss in the middle
        invoke  ExitProcess,0

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          printfdll,'BLAR.dll'

  import kernel,\
         ExitProcess,'ExitProcess'

  import printfdll,\
         tessst,'test'    


As you can see, the code wasn't edited that much. Right now, i'm using visual studio's "internal assembler" (masm) to get output with my code, but i'd like to get away from using visual studio and start relying on a DLL to print my stuff so that i can put it on my jump drive and work with things where visual studio isn't install. I'm not sure which code the error is in, so i included them both. Could some one please help me find the error? Thanks in advance.
Post 11 Dec 2006, 03:20
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
yes, test is an asm instruction. the dll's test function does not take an argument, why do you do 'invoke tessst,3'? when you test with visual studio app does it output the text?

ps. for the include path you can setup a environment variable or add a line in fasmw.ini (if youre using fasmw) to not have to hardcode the path to include files. do a quick search here or check fasm manual to see how
Post 11 Dec 2006, 03:51
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
ooooooooops lol I erased it.

And yes, when i tested it in visual studio by calling it with a C++ app, it worked. Erasing that 3 didn't fix it. I'm guessing that it's the ASM application, but i put the C one there just to be sure.

EDIT: Problem solved. Not exactly sure what it was, but when i put it in another compiler with a fresh project, the DLL came out fine and worked.
Post 11 Dec 2006, 03:57
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.