From 8dc0d0aaa3fd621b43a5ffea6ec60e338a734b87 Mon Sep 17 00:00:00 2001 From: Daniel Collins Date: Sun, 11 Nov 2012 14:01:09 +0000 Subject: [PATCH] Removed ipxrouter program. --- Makefile | 7 +- icons/ipxrouter-16.png | Bin 180 -> 0 bytes icons/ipxrouter-32.png | Bin 263 -> 0 bytes icons/ipxrouter.ico | Bin 5430 -> 0 bytes icons/ipxrouter.rc | 1 - src/router-exe.c | 229 ----------------------------------------- 6 files changed, 2 insertions(+), 235 deletions(-) delete mode 100644 icons/ipxrouter-16.png delete mode 100644 icons/ipxrouter-32.png delete mode 100644 icons/ipxrouter.ico delete mode 100644 icons/ipxrouter.rc delete mode 100644 src/router-exe.c diff --git a/Makefile b/Makefile index 585757b..8c125a0 100644 --- a/Makefile +++ b/Makefile @@ -46,10 +46,10 @@ SRC_FILES := changes.txt license.txt Makefile mkstubs.pl readme.txt src/config.h include/dplay.h include/dplaysp.h include/dplobby.h include/wsnwlink.h directplay-win32.reg \ directplay-win64.reg -all: ipxwrapper.dll wsock32.dll mswsock.dll ipxconfig.exe dpwsockx.dll ipxrouter.exe +all: ipxwrapper.dll wsock32.dll mswsock.dll ipxconfig.exe dpwsockx.dll clean: - rm -f ipxwrapper.dll wsock32.dll mswsock.dll ipxconfig.exe dpwsockx.dll ipxrouter.exe + rm -f ipxwrapper.dll wsock32.dll mswsock.dll ipxconfig.exe dpwsockx.dll rm -f src/*.o src/*_stubs.s version.o Makefile.dep dist: all @@ -83,9 +83,6 @@ ipxconfig.exe: src/ipxconfig.cpp icons/ipxconfig.o dpwsockx.dll: src/directplay.o src/log.o src/dpwsockx_stubs.o src/common.o $(CC) $(CFLAGS) -Wl,--enable-stdcall-fixup -shared -o dpwsockx.dll src/directplay.o src/log.o src/common.o src/dpwsockx_stubs.o src/dpwsockx.def -lwsock32 -ipxrouter.exe: src/router-exe.o src/router.o src/interface.o src/common.o src/log.o icons/ipxrouter.o src/config.o src/addr.o - $(CC) $(CFLAGS) -static-libgcc -mwindows -o ipxrouter.exe $^ -lws2_32 -liphlpapi - src/ipxwrapper_stubs.s: src/ipxwrapper_stubs.txt perl mkstubs.pl src/ipxwrapper_stubs.txt src/ipxwrapper_stubs.s 0 diff --git a/icons/ipxrouter-16.png b/icons/ipxrouter-16.png deleted file mode 100644 index ce899a2fa7e26194a53a0bd32a29b437f26ada3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 180 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`)t)YnAr`%RCk1jHP~dUC{803| zb6NYFx+9_D-G?F^F1YuupK e)9==73^8x))Lp?G`X(Ld3ujP)Z3^jxUxF6L@9JnX$M0ZglKMRgv_xBbeTvtIt?o5a{JGDs`X%R3{JHh( zo*TS%*T?+Y<9rQ$SQwf-|H72) zMywCB8NUMMXVhilB%HUtKa8Jm`27C#+!h>90=>N%s`BXV`8xW{@iaW#ItymdISNmlY^;Ruosru=C#MYnmb@jb^;Hi3VZiSor z=3mMNxqjXrMrV0n;xxx{rDEnvj@+XUFnHkb66ZY(dG?Ycah(GXUgjl+9*n`j)iJop n%Xp?ezwvtfAj(@5EDI&YTMC7nI|?sP6rRtbKc#SeG{(OHeuL6J diff --git a/icons/ipxrouter.rc b/icons/ipxrouter.rc deleted file mode 100644 index 881f6df..0000000 --- a/icons/ipxrouter.rc +++ /dev/null @@ -1 +0,0 @@ -50 ICON "ipxrouter.ico" diff --git a/src/router-exe.c b/src/router-exe.c deleted file mode 100644 index 05bd637..0000000 --- a/src/router-exe.c +++ /dev/null @@ -1,229 +0,0 @@ -/* ipxwrapper - Standalone router executable - * Copyright (C) 2011 Daniel Collins - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#include -#include -#include - -#include "router.h" -#include "common.h" -#include "config.h" - -main_config_t main_config; - -#define APPWM_TRAY (WM_APP+1) -#define MNU_EXIT 101 - -static void die(const char *fmt, ...); -static void init_ui(); -static LRESULT CALLBACK tray_wproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp); -static void show_menu(HWND hwnd); - -int main(int argc, char **argv) { - log_open("ipxrouter.log"); - - main_config = get_main_config(); - - WSADATA wsdata; - int err = WSAStartup(MAKEWORD(2,0), &wsdata); - if(err) { - die("Failed to initialize winsock: %s", w32_error(err)); - } - - struct router_vars *router = router_init(TRUE); - if(!router) { - die("Error while initializing router, check ipxrouter.log"); - } - - HANDLE worker = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&router_main, router, 0, NULL); - if(!worker) { - die("Failed to create router thread: %s", w32_error(GetLastError())); - } - - init_ui(); - - MSG msg; - - while(GetMessage(&msg, NULL, 0, 0) > 0) { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - - EnterCriticalSection(&(router->crit_sec)); - - router->running = FALSE; - WSASetEvent(router->wsa_event); - - LeaveCriticalSection(&(router->crit_sec)); - - if(WaitForSingleObject(worker, 3000) == WAIT_TIMEOUT) { - log_printf(LOG_WARNING, "Router thread didn't exit in 3 seconds, terminating"); - TerminateThread(worker, 0); - } - - CloseHandle(worker); - router_destroy(router); - - WSACleanup(); - - log_close(); - - return 0; -} - -static void die(const char *fmt, ...) { - va_list argv; - char msg[512]; - - va_start(argv, fmt); - vsnprintf(msg, sizeof(msg), fmt, argv); - va_end(argv); - - MessageBox(NULL, msg, "Fatal error", MB_OK | MB_TASKMODAL); - exit(1); -} - -static void init_ui() { - WNDCLASS wclass; - - wclass.style = 0; - wclass.lpfnWndProc = &tray_wproc; - wclass.cbClsExtra = 0; - wclass.cbWndExtra = 0; - wclass.hInstance = GetModuleHandle(NULL); - wclass.hIcon = NULL; - wclass.hCursor = LoadCursor(NULL, IDC_ARROW); - wclass.hbrBackground = NULL; - wclass.lpszMenuName = NULL; - wclass.lpszClassName = "ipxrouter_tray"; - - if(!RegisterClass(&wclass)) { - die("RegisterClass: %s", w32_error(GetLastError())); - } - - HWND window = CreateWindow( - "ipxrouter_tray", - "IPX Router", - 0, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - NULL, - NULL, - GetModuleHandle(NULL), - NULL - ); - - if(!window) { - die("CreateWindow: ", w32_error(GetLastError())); - } - - HICON icon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(50), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); - if(!icon) { - die("Error loading icon: ", w32_error(GetLastError())); - } - - NOTIFYICONDATA tray; - - tray.cbSize = sizeof(tray); - tray.hWnd = window; - tray.uID = 1; - tray.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; - tray.uCallbackMessage = APPWM_TRAY; - tray.hIcon = icon; - strcpy(tray.szTip, "IPXWrapper Router"); - - if(!Shell_NotifyIcon(NIM_ADD, &tray)) { - die("Shell_NotifyIcon failed"); - } -} - -static LRESULT CALLBACK tray_wproc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { - switch(msg) { - case WM_CLOSE: { - DestroyWindow(hwnd); - break; - } - - case WM_DESTROY: { - PostQuitMessage(0); - break; - } - - case APPWM_TRAY: { - if(lp == WM_LBUTTONUP || lp == WM_RBUTTONUP) { - show_menu(hwnd); - } - - break; - } - - case WM_COMMAND: { - if(wp == MNU_EXIT) { - if(MessageBox(NULL, "If the router is stopped any existing sockets will become invalid.\nAre you sure you want to exit?", "IPXWrapper", MB_YESNO) == IDNO) { - return 0; - } - - NOTIFYICONDATA tray; - tray.cbSize = sizeof(tray); - tray.hWnd = hwnd; - tray.uID = 1; - tray.uFlags = 0; - - Shell_NotifyIcon(NIM_DELETE, &tray); - DestroyWindow(hwnd); - } - - break; - } - - default: { - return DefWindowProc(hwnd, msg, wp, lp); - } - } - - return 0; -} - -static void show_menu(HWND hwnd) { - POINT cursor_pos; - - GetCursorPos(&cursor_pos); - - SetForegroundWindow(hwnd); - - HMENU menu = CreatePopupMenu(); - if(!menu) { - die("CreatePopupMenu: %s", w32_error(GetLastError())); - } - - InsertMenu(menu, -1, MF_BYPOSITION | MF_STRING, MNU_EXIT, "Exit"); - - SetMenuDefaultItem(menu, MNU_EXIT, FALSE); - - SetFocus(hwnd); - - TrackPopupMenu( - menu, - TPM_LEFTALIGN | TPM_BOTTOMALIGN, - cursor_pos.x, cursor_pos.y, - 0, - hwnd, - NULL - ); - - DestroyMenu(menu); -}