// This is an MSVC specific way of linking stuff; if you're using another compiler, you'll have to link manually #pragma comment(lib, "laserjesus.lib") #pragma comment(lib, "user32.lib") #undef UNICODE #include // The settings structure passed to register_settings struct settings { DWORD name_offset; // A pointer to a null terminated string containing the name of your plugin DWORD timer_delay; // Every timer_delay milliseconds, laserjesus will call event_timer }; // Laserjesus imports and exports using C linkage extern "C" { // Laserjesus API functions DWORD __stdcall console_message(DWORD context, DWORD module_id, DWORD p_message, DWORD style); DWORD __stdcall create_send_header(DWORD context, DWORD p_packet, DWORD size_packet, DWORD packet_type, DWORD isserver); DWORD __stdcall crypt_packet(DWORD p_packet); DWORD __stdcall drop_packet(DWORD context, DWORD isserver); DWORD __stdcall nexus_memory_access(DWORD context, DWORD baseaddr, DWORD sourceaddr, DWORD sizeofsource, DWORD access_type); DWORD __stdcall queue_packet(DWORD context, DWORD p_packet, DWORD size_packet, DWORD isserver); DWORD __stdcall register_settings(DWORD module_id, DWORD p_settings); DWORD __stdcall send_keys(DWORD context, DWORD p_buff_or_key, DWORD is_buff); DWORD __stdcall send_queue(DWORD context, DWORD isserver, DWORD flush); // Prototypes for the exported event functions __declspec(dllexport) DWORD event_close(DWORD context, DWORD module_id); __declspec(dllexport) DWORD event_initialize(DWORD context, DWORD module_id); __declspec(dllexport) DWORD event_options(DWORD context, DWORD module_id, DWORD message, DWORD var1, DWORD var2); __declspec(dllexport) DWORD event_packet(DWORD context, DWORD module_id, DWORD packetbuffer, DWORD packet_size, DWORD isserver); __declspec(dllexport) DWORD event_timer(DWORD context, DWORD module_id); } DWORD event_close(DWORD context, DWORD module_id) { return 0; } DWORD event_initialize(DWORD context, DWORD module_id) { settings s; s.name_offset = (DWORD)"test"; s.timer_delay = 0; // Never call event_timer // Register our settings register_settings(module_id, (DWORD)&s); console_message(context, module_id, (DWORD)"Hello, world!", 0); return 0; } DWORD event_options(DWORD context, DWORD module_id, DWORD message, DWORD var1, DWORD var2) { switch(message) { case 1: // The plugin options button was pressed MessageBox(0, "Sorry, no options for now!", "Notice", MB_OK); break; case 2: // A console command was issued -- var1 poitns to a null terminated string that is the command console_message(context, module_id, (DWORD)"Sorry, no commands supported for now!", 0); break; } return 0; } DWORD event_packet(DWORD context, DWORD module_id, DWORD packetbuffer, DWORD packet_size, DWORD isserver) { return 0; } DWORD event_timer(DWORD context, DWORD module_id) { return 0; }