1
mirror of https://github.com/rapid7/metasploit-payloads synced 2025-01-08 14:36:22 +01:00
metasploit-payloads/c/meterpreter/source/metsrv/thread.h
OJ 4ffe127f04
Begin removing the delay-load dependency
The 'common' library has been removed. The only project that actually
used it was metsrv, so the code that metsrv required from common is now
directly compiled in as part of that project.

The common folder now contains files that are importanta cross all of
the projects, with a primary focus on the new "API" style function. What
this means is that MetSrv has an API that it exposes through a function
pointer that is passed to the extension when it's initialised. This
pointer references a structure with all the API functions wired in. This
means that:

* Extensions don't need to know anything about metsrv at compile time.
* The delay loading code can be removed, which was one of the last
  instances of "metsrv.dll" as a string.
* Metsrv.dll no longer exports any functions.

More to come.
2020-04-22 13:06:40 +10:00

70 lines
1.8 KiB
C

#ifndef _METERPRETER_METSRV_THREAD_H
#define _METERPRETER_METSRV_THREAD_H
#include "common_thread.h"
/*****************************************************************************************/
// Win32/64 specific definitions...
typedef struct __OBJECT_ATTRIBUTES
{
ULONG Length;
HANDLE RootDirectory;
_PUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} _OBJECT_ATTRIBUTES, * _POBJECT_ATTRIBUTES;
typedef struct __CLIENT_ID
{
PVOID UniqueProcess;
PVOID UniqueThread;
} _CLIENT_ID, * _PCLIENT_ID;
typedef HANDLE (WINAPI * OPENTHREAD)( DWORD, BOOL, DWORD ); // kernel32!OpenThread
typedef DWORD (WINAPI * NTOPENTHREAD)( PHANDLE, ACCESS_MASK, _POBJECT_ATTRIBUTES, _PCLIENT_ID ); // ntdll!NtOpenThread
/*****************************************************************************************/
LOCK * lock_create( VOID );
VOID lock_destroy( LOCK * lock );
VOID lock_acquire( LOCK * lock );
VOID lock_release( LOCK * lock );
/*****************************************************************************************/
EVENT * event_create( VOID );
BOOL event_destroy( EVENT * event );
BOOL event_signal( EVENT * event );
BOOL event_poll( EVENT * event, DWORD timeout );
/*****************************************************************************************/
THREAD * thread_open( VOID );
THREAD * thread_create( THREADFUNK funk, LPVOID param1, LPVOID param2, LPVOID param3 );
void disable_thread_error_reporting(void);
BOOL thread_run( THREAD * thread );
BOOL thread_sigterm( THREAD * thread );
BOOL thread_kill( THREAD * thread );
BOOL thread_join( THREAD * thread );
BOOL thread_destroy( THREAD * thread );
/*****************************************************************************************/
#endif