Hossa

my first try with Dll`s and direct some questions ;-)

I want to start my server.dll when client.exe starts with this command:

wminit:
call LoadLibraryA,offset DllName ;DllName db "server.dll",0
test eax,eax
je ErrorOpenDll
mov Libhnd,eax
call GetProcAddress,Libhnd,offset StartServer ;- StartServer db "StartUp",0 (in server.dll is "StartUp Proc" )
call eax ; eax=StartUp so i "call StartUp" in the server.dll
call FreeLibrary,Libhnd ;...

and now the Server.exe works fine but Client.exe is invisible :-(
How can i start my server.dll from the client.exe and let client.exe visible ?
;*************************
i use in the dll:

.386
.MODEL FLAT,STDCALL
locals
jumps

.DATA


.CODE

EntryPoint proc DLLinst:DWORD, Reason:DWORD, Reserved1:DWORD <-- dont know exactly for what this is ,found in dll code snipped
mov eax,1
ret
EntryPoint endp

PUBLICDLL StartUp <---- the proc i want to call from client.exe

Main:


call GetModuleHandleA,0
mov Han2dle, eax

push 0 <-- dont know exactly for what this is ,found in dll code snipped
push 0
push eax
pop eax
pop eax
pop eax
mov eax, 01
ret 0ch



StartUp proc <---- the proc i want to call from client.exe

Create_the_Window:
call RegisterClassA,offset wc ;wc WNDCLASS <0,MainWndProc,0,0,0,0,0,2,0,szClassName>
push 0
push
push 0
push 0
push 0
push 0
push 0
push 0
push 0
push offset szDisplayName
push offset szClassName
push 00040000h
call CreateWindowExA
mov Main2Hwnd, eax
msg_loop:
call GetMessageA,offset msgbuffer,0,0,0
or eax,eax
je end_loop
call DispatchMessageA,offset msgbuffer
jmp msg_loop

end_loop:
call ExitProcess,0
ret

StartUp proc <---- the proc i want to call from client.exe



MainWndProc Proc <-- ------- the program stuff
ARG Hw2nd:dword, Msg:dword, Wparam:dword, Lparam:dword




EndP



End Main
End Start
End Entrypoint
;*************************

if i start the dll not with the client.exe all works fine and i can work with booth files.
also im wondering why the start of my server.dll has a effect to my client.exe.

can someone please explain me this ?

Thanks
Posted on 2002-01-15 08:25:29 by Max
hm it seems that you forgot to use


invoke ShowWindow, hwnd,SW_SHOWNORMAL
invoke UpdateWindow, hwnd

after you create your window... correct me if i'm wrong...
btw... why do you use dll's ? wouldn't it be better if you
only have one single file? hm... i don't like dll's :)
Posted on 2002-01-15 09:41:47 by mob
Thanks for the help !

why i use dll ?
im not familiar with network and i use the send file function from another client/server source i found.
if i open my voice client i also need to execute the server.exe ,when i close client.exe i need also to close server.exe ,so i try to insert the server.exe in server.dll
maybe when i have more time ,i learn more about network and code booth files to one.
for now id like to see it finish quick to talk some lines :-)

so i try your tip out and hope thats it ;-)
but i dont understand why the "visible" client window
become invisible after i load the dll.
for what is it ?
Posted on 2002-01-15 09:56:40 by Max
max, go to icz's site and read his winsock tutorial... it's
very good i think... i don't think that your method is fast
enough for real-time talking... coding with sockets is very
easy... you can code a programm that is able to be server
and client in one... that way would be very comfortable
coz one part of your prog would listen for incomming data
sequenzes and the other part would send data if you're
connected to some other "server"... the advantage is that
you're not bound to protocolls that would be good for
Other purposes but bad for your voice-transfer, like tcp/ip
with port 80 (html file transfer)... you can define your own
or use a raw-plain-data one... when using sockets you also
have more control... for example you get a window-
message if the connection is broken or if the other user
disconnects you...
Posted on 2002-01-15 10:14:18 by mob
Thanks again for the helpfull tips !

when i use the client/server source i found ,i think its impossible to make the file transfer and the functions over one socket.
i think so because the author of the source i use ,open another socket for the file transfer.
the communication for server and client goes over another socket.
so i have 1 socket in client and 2 in server ,thats finaly 3 in the ready tool.
too much for me to handle at this time :-)
please remember that i had the idea for the voice messenger when i read 4oh4 code snippet for recording wav.
i start searching tips and coding before i think what i need to code by meaning a its a easy thing..........now i had learned thats its important to make a plan first and start then coding :-)

sounds lame.....yep
Posted on 2002-01-15 10:30:34 by Max
you can use as much sockets as you desire... if you want
open one for listening and anotherone for data-transfer...
...so much time passed... i used sockets a year ago...
let's assume we've got two chat clients that want to
exchange data (text...)



+--------------+
I PC_1 I
I I
I 1066 LISTEN I<--+
I TRANSFERI---I--+
+--------------+ I I
I I
+--------------+ I I
I PC_2 I I I
I I I I
I 1066 LISTEN I<--I--+
I TRANSFERI---+
+--------------+

PC_2 is Connected with PC_1 (on PORT 1066)
PC_1 is Connected with PC_2 (on PORT 1066)
1.) PC_2 sends data to PC_1[port:1066]
2.) PC_1 GETS a FD_READ MSG AND IS NOW ABLE TO
HANDLE THIS DATA
3.) PC_1 CAN ALSO SEND DATA TO PC_2[port:1066]
COZ PC_2 IS ALSO LISTENING FOR INCOMMING
DATA ON PORT 1066 (HE'LL GET A FD_READ, TOO)


everything's done with one port...
Posted on 2002-01-15 10:58:08 by mob
This looks very clear now to me :-)
first i think totaly stupid........if i take one second to open my mind i had to know that if i use a browser......he do all the stuff on one socket.
*lol* thats the newbies way i go........

but again i would very happy if someone can explain me why my tool become invisible.
its hard to understand for me that if i use a tool ,lets say client.exe and when i load from this file a command in a dll this file client.exe become invisible ,not the dll.

so as all say ,a dll is good to make plugins im wondering how they use it when its normal that the used file become invisible.
it looks normal to me because noone say anything to this ,or is it so easy and noone like to point me on my misstake ?

when i use updatewin.. i see the window of the server only.
also if i use a taskmonitor i dont find the client.exe handlename after i call the dll.
so where is my client.exe gone ?

last.....all this looks for me that i can not use a dll as full program.
so a dll is only for small procs i can call from another tool ?

when browsing google on dlls i found enough keyloggers and so on......but not a reason to my problem.

whats wrong ?
Posted on 2002-01-16 06:18:53 by Max