-Sorry for my bad english...-
this is my source code
i think, it seems nothing wrong
but, when i run it with program.exe
it crashed
i have no idea, why imported functions from kernel library pointed wrong address...
i need help!!!
---entry.dll(that loads thread_entry_point)------
.model FLAT
extern __imp__LoadLibraryExA@12 : DWORD
extern __imp__GetProcAddress@8 : DWORD
extern __imp__CreateThread@24 : DWORD
extern __imp__CloseHandle@4 : DWORD
.data
PluginMain BYTE "tf/addons/plugin_main.dll",0
entry_point_name BYTE "_thread_entry_point@0",0
DLL_PROCESS_ATTACH = 1
DONT_RESOLVE_DLL_REFERENCES = 1
.code
_entry PROC
push ebp
mov ebp, esp
mov al, [ebp+4+8]
cmp al, DLL_PROCESS_ATTACH
jne exit
push DONT_RESOLVE_DLL_REFERENCES
push 0
push offset [PluginMain]
call [__imp__LoadLibraryExA@12]
test eax, eax
jz exit
push offset [entry_point_name]
push eax
call [__imp__GetProcAddress@8]
push 0 ;lpThreadId
push 0 ;dwCreationFlags
push 0 ;lpParameter
push eax ;lpStartAddress
push 0 ;dwStackSize
push 0 ;lpThreadAttributes
call [__imp__CreateThread@24]
push eax
call [__imp__CloseHandle@4]
exit:
xor eax, eax
pop ebp
ret 12
_entry ENDP
END _entry
----plugin_main.dll(thread_entry_point)------
.model FLAT
extern __imp__FindFirstFileA@8 : DWORD
extern __imp__FindClose@4 : DWORD
.data
plugins_folder_path BYTE "tf/addons/plugins*"
INVALID_HANDLE_VALUE = 0FFFFFFFFh
.code
thread_entry_point PROC STDCALL EXPORT
push ebp
mov ebp, esp
sub esp, 328
lea eax, [ebp-4]
push eax
push offset [plugins_folder_path]
call [__imp__FindFirstFileA@8]
cmp eax, INVALID_HANDLE_VALUE
je continue
push eax
call [__imp__FindClose@4]
add esp, 328
continue:
think:
jmp think
thread_entry_point ENDP
END