{
char *if_name;
-#ifdef WIN32
+#ifdef _WIN32
/*
* We cannot assume that the interface name doesn't contain a space;
* some names on Windows OT do.
return;
}
-#ifdef WIN32
+#ifdef _WIN32
/* ANSI C doesn't say whether "rename()" removes the target if it
exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so.
* code in tcpdump, to avoid those sorts of problems, and that was
* picked up by tcpdump.org tcpdump.
*/
-#if !defined(WIN32) && !defined(__APPLE__)
+#if !defined(_WIN32) && !defined(__APPLE__)
#ifndef AVOID_DNS_TIMEOUT
#define AVOID_DNS_TIMEOUT
#endif
# include <adns.h>
#endif
-#if defined(WIN32) && defined(INET6)
+#if defined(_WIN32) && defined(INET6)
# include <ws2tcpip.h>
#endif
/* list of hooks to be called when init_protocols is done */
GHookList dcerpc_hooks_init_protos;
-#ifdef WIN32
+#ifdef _WIN32
int ResolveWin32UUID(e_uuid_t if_id, char *UUID_NAME, int UUID_NAME_MAX_LEN)
{
char REG_UUID_NAME[MAX_PATH];
tvbuff_t *volatile stub_tvb;
volatile guint auth_pad_len;
volatile int auth_pad_offset;
-#ifdef WIN32
+#ifdef _WIN32
char UUID_NAME[MAX_PATH];
#endif
proto_tree_add_boolean_hidden(dcerpc_tree, hf_dcerpc_unknown_if_id,
tvb, offset, 0, TRUE);
if (check_col (pinfo->cinfo, COL_INFO)) {
-#ifdef WIN32
+#ifdef _WIN32
if(ResolveWin32UUID(info->call_data->uuid, UUID_NAME, MAX_PATH))
col_append_fstr (pinfo->cinfo, COL_INFO, " [%s] UUID: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x rpcver: %u",
UUID_NAME, info->call_data->uuid.Data1, info->call_data->uuid.Data2, info->call_data->uuid.Data3, info->call_data->uuid.Data4[0],
char uuid_str[DCERPC_UUID_STR_LEN];
int uuid_str_len;
dcerpc_auth_info auth_info;
-#ifdef WIN32
+#ifdef _WIN32
char UUID_NAME[MAX_PATH];
#endif
if (uuid_str_len >= DCERPC_UUID_STR_LEN)
memset(uuid_str, 0, DCERPC_UUID_STR_LEN);
-#ifdef WIN32
+#ifdef _WIN32
if(ResolveWin32UUID(if_id, UUID_NAME, MAX_PATH))
iface_item = proto_tree_add_string_format (ctx_tree, hf_dcerpc_cn_bind_if_id, tvb,
offset, 16, uuid_str, "Interface [%s] UUID: %s", UUID_NAME, uuid_str);
if ((value = g_hash_table_lookup(dcerpc_uuids, &key)))
col_append_fstr(pinfo->cinfo, COL_INFO, " UUID: %s", value->name);
else
-#ifdef WIN32
+#ifdef _WIN32
if(ResolveWin32UUID(if_id, UUID_NAME, MAX_PATH))
col_append_fstr(pinfo->cinfo, COL_INFO, " [%s] UUID: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x ver %u.%u",
UUID_NAME, if_id.Data1, if_id.Data2, if_id.Data3,
# define netsnmp_ds_set_int ds_set_int
#endif
-#ifdef WIN32
+#ifdef _WIN32
# include <epan/filesystem.h>
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Define values "sprint_realloc_value()" expects.
if (mib_modules != NULL) {
tmp_mib_modules = g_strconcat("MIBS=", mib_modules, NULL);
-#ifdef WIN32
+#ifdef _WIN32
_putenv(tmp_mib_modules);
#else
putenv(tmp_mib_modules);
-#endif /*WIN32*/
+#endif /*_WIN32*/
} else {
-#ifdef WIN32
+#ifdef _WIN32
_putenv("MIBS");
#else
putenv("MIBS");
-#endif /* WIN32 */
+#endif /* _WIN32 */
}
/*
void
proto_register_snmp(void)
{
-#if defined(WIN32) && defined(HAVE_SOME_SNMP)
+#if defined(_WIN32) && defined(HAVE_SOME_SNMP)
char *mib_path;
#define MIB_PATH_APPEND "snmp\\mibs"
#endif
#ifdef HAVE_SOME_SNMP
-#ifdef WIN32
+#ifdef _WIN32
/* Set MIBDIRS so that the SNMP library can find its mibs. */
/* XXX - Should we set MIBS or MIBFILES as well? */
_putenv(mib_path);
g_free(mib_path);
-#endif /* WIN32 */
+#endif /* _WIN32 */
/*
* Suppress warnings about unknown tokens - we aren't initializing
#include <direct.h> /* to declare "mkdir()" on Windows */
#endif
-#ifndef WIN32
+#ifndef _WIN32
#include <pwd.h>
#endif
{
char *separator;
-#ifdef WIN32
+#ifdef _WIN32
char c;
/*
const char *
get_datafile_dir(void)
{
-#ifdef WIN32
+#ifdef _WIN32
char prog_pathname[_MAX_PATH+2];
char *dir_end;
size_t datafile_dir_len;
const char *
get_systemfile_dir(void)
{
-#ifdef WIN32
+#ifdef _WIN32
return get_datafile_dir();
#else
return "/etc";
* Name of directory, under the user's home directory, in which
* personal configuration files are stored.
*/
-#ifdef WIN32
+#ifdef _WIN32
#define PF_DIR "Ethereal"
#else
/*
static const char *
get_persconffile_dir(void)
{
-#ifdef WIN32
+#ifdef _WIN32
char *appdatadir;
char *userprofiledir;
#else
if (pf_dir != NULL)
return pf_dir;
-#ifdef WIN32
+#ifdef _WIN32
/*
* Use %APPDATA% or %USERPROFILE%, so that configuration files are
* stored in the user profile, rather than in the home directory.
create_persconffile_dir(char **pf_dir_path_return)
{
const char *pf_dir_path;
-#ifdef WIN32
+#ifdef _WIN32
char *pf_dir_path_copy, *pf_dir_parent_path;
size_t pf_dir_parent_path_len;
#endif
pf_dir_path = get_persconffile_dir();
if (stat(pf_dir_path, &s_buf) != 0 && errno == ENOENT) {
-#ifdef WIN32
+#ifdef _WIN32
/*
* Does the parent directory of that directory
* exist? %APPDATA% may not exist even though
return ret;
}
-#ifdef WIN32
+#ifdef _WIN32
/*
* Returns the user's home directory on Win32.
*/
*/
char *
get_persconffile_path(const char *filename, gboolean for_writing
-#ifndef WIN32
+#ifndef _WIN32
_U_
#endif
)
{
char *path;
-#ifdef WIN32
+#ifdef _WIN32
struct stat s_buf;
char *old_path;
#endif
strlen(filename) + 2);
sprintf(path, "%s" G_DIR_SEPARATOR_S "%s", get_persconffile_dir(),
filename);
-#ifdef WIN32
+#ifdef _WIN32
if (!for_writing) {
if (stat(path, &s_buf) != 0 && errno == ENOENT) {
/*
/* Return value is malloced so the caller should g_free() it. */
const char *get_plugins_global_dir(const char *plugin_dir)
{
-#ifdef WIN32
+#ifdef _WIN32
char *install_plugin_dir;
/*
/* The file being saved is a temporary file from a live
capture, so it doesn't need to stay around under that name;
first, try renaming the capture buffer file to the new name. */
-#ifndef WIN32
+#ifndef _WIN32
if (rename(cf->filename, fname) == 0) {
/* That succeeded - there's no need to copy the source file. */
from_filename = NULL;
return;
}
-#ifdef WIN32
+#ifdef _WIN32
/* ANSI C doesn't say whether "rename()" removes the target if it
exists; the Win32 call to rename files doesn't do so, which I
infer is the reason why the MSVC++ "rename()" doesn't do so.
*/
if (if_dlg_data->pch) {
if(pcap_stats(if_dlg_data->pch, &stats) >= 0) {
-#ifdef WIN32
+#ifdef _WIN32
diff = stats.ps_recv - if_dlg_data->last_packets;
if_dlg_data->last_packets = stats.ps_recv;
#else
row = 0;
-#ifndef WIN32
+#ifndef _WIN32
+ /*
+ * On Windows, device names are generally not meaningful - NT 5
+ * uses long blobs with GUIDs in them, for example - so we don't
+ * bother showing them.
+ */
if_lb = gtk_label_new("Device");
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_lb, 0, 1, row, row+1);
#endif
/* device name */
if_dlg_data->device_lb = gtk_label_new(if_info->name);
if_dlg_data->device = if_info->name;
-#ifndef WIN32
+#ifndef _WIN32
gtk_misc_set_alignment(GTK_MISC(if_dlg_data->device_lb), 0.0, 0.5);
gtk_table_attach_defaults(GTK_TABLE(if_tb), if_dlg_data->device_lb, 0, 1, row, row+1);
#endif
gtk_button_box_set_layout (GTK_BUTTON_BOX(button_hbox), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(button_hbox), 5);
-#if !WIN32 && GTK_MAJOR_VERSION >= 2
+/* GTK+ 1.3 and later - on Win32, we use 1.3[.x] or 2.x, not 1.2[.x] */
+#if !defined(_WIN32) && GTK_MAJOR_VERSION >= 2
/* beware: sequence of buttons are important! */
/* XXX: this can be implemented more elegant of course, but it works as it should */
/* trim filename, so gtk_file_chooser_set_current_folder() likes it, see below */
if (filename[filename_len -1] == G_DIR_SEPARATOR
-#ifdef WIN32
+#ifdef _WIN32
&& filename_len > 3) /* e.g. "D:\" */
#else
&& filename_len > 1) /* e.g. "/" */
#endif
{
new_filename = g_strdup(filename);
- new_filename[filename_len-1] = '\0';
+ new_filename[filename_len-1] = '\0';
} else {
new_filename = g_strdup(filename);
}
#include <gtk/gtkbindings.h>
#include <gtk/gtkdnd.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <gdk/win32/gdkwin32.h>
#else
#include <gdk/gdkx.h>
#include <epan/packet.h>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
}
-#ifdef WIN32
+#ifdef _WIN32
#define NAME_BUFFER_LEN 32
}
#endif /* GTK_MAJOR_VERSION */
-#endif /* WIN32 */
+#endif /* _WIN32 */
void font_init(void)
gchar *bold_font_name;
#endif
-#ifdef WIN32
+#ifdef _WIN32
#if GTK_MAJOR_VERSION >= 2
/* try to load the application font for GTK2 */
try_to_get_windows_font_gtk2();
*/
extern fa_ret_t user_font_apply(void);
-#ifdef WIN32
+#ifdef _WIN32
#if GTK_MAJOR_VERSION < 2
/** Init the application font (GTK1 only).
*
#include "getopt.h"
#endif
-#ifdef WIN32 /* Needed for console I/O */
+#ifdef _WIN32 /* Needed for console I/O */
#include <fcntl.h>
#include <conio.h>
#endif
#ifdef HAVE_LIBPCAP
#include "pcap-util.h"
#endif
-#ifdef WIN32
+#ifdef _WIN32
#include "capture-wpcap.h"
#endif
GString *comp_info_str, *runtime_info_str;
gchar *ethereal_path = NULL;
-#ifdef WIN32
+#ifdef _WIN32
static gboolean has_console; /* TRUE if app has console */
/*static void create_console(void);*/
static void destroy_console(void);
static void
show_version(void)
{
-#ifdef WIN32
+#ifdef _WIN32
create_console();
#endif
}
#endif
-#if defined WIN32 || GTK_MAJOR_VERSION < 2 || ! defined USE_THREADS
+#if defined(_WIN32) || GTK_MAJOR_VERSION < 2 || ! defined USE_THREADS
/*
Once every 3 seconds we get a callback here which we use to update
the tap extensions. Since Gtk1 is single threaded we dont have to
void
protect_thread_critical_region(void)
{
-#if ! defined WIN32 && GTK_MAJOR_VERSION >= 2 && defined USE_THREADS
+#if !defined(_WIN32) && GTK_MAJOR_VERSION >= 2 && defined USE_THREADS
g_static_mutex_lock(&update_thread_mutex);
#endif
}
void
unprotect_thread_critical_region(void)
{
-#if ! defined WIN32 && GTK_MAJOR_VERSION >= 2 && defined USE_THREADS
+#if !defined(_WIN32) && GTK_MAJOR_VERSION >= 2 && defined USE_THREADS
g_static_mutex_unlock(&update_thread_mutex);
#endif
}
extern char *optarg;
gboolean arg_error = FALSE;
-#ifdef WIN32
+#ifdef _WIN32
WSADATA wsaData;
-#endif /* WIN32 */
+#endif /* _WIN32 */
char *rf_path;
int rf_open_errno;
#define OPTSTRING_INIT "a:b:B:c:f:Hhi:klLm:nN:o:pP:Qr:R:Ss:t:T:w:vy:z:"
#ifdef HAVE_LIBPCAP
-#ifdef WIN32
+#ifdef _WIN32
#define OPTSTRING_CHILD "W:Z:"
#else
#define OPTSTRING_CHILD "W:"
-#endif /* WIN32 */
+#endif /* _WIN32 */
#else
#define OPTSTRING_CHILD ""
#endif /* HAVE_LIBPCAP */
ethereal_path = argv[0];
-#ifdef WIN32
+#ifdef _WIN32
/* Arrange that if we have no console window, and a GLib message logging
routine is called to log a message, we pop up a console window.
handle_dashG_option(argc, argv, "ethereal");
/* multithread support currently doesn't seem to work in win32 gtk2.0.6 */
-#if ! defined WIN32 && GTK_MAJOR_VERSION >= 2 && defined G_THREADS_ENABLED && defined USE_THREADS
+#if !defined(_WIN32) && GTK_MAJOR_VERSION >= 2 && defined(G_THREADS_ENABLED) && defined USE_THREADS
{
GThread *ut;
g_thread_init(NULL);
ut=g_thread_create(update_thread, NULL, FALSE, NULL);
g_thread_set_priority(ut, G_THREAD_PRIORITY_LOW);
}
-#else /* WIN32 || GTK1.2 || !G_THREADS_ENABLED || !USE_THREADS */
+#else /* _WIN32 || GTK1.2 || !G_THREADS_ENABLED || !USE_THREADS */
/* this is to keep tap extensions updating once every 3 seconds */
gtk_timeout_add(3000, (GtkFunction)update_cb,(gpointer)NULL);
-#endif /* !WIN32 && GTK2 && G_THREADS_ENABLED */
+#endif /* !_WIN32 && GTK2 && G_THREADS_ENABLED */
#if HAVE_GNU_ADNS
gtk_timeout_add(750, (GtkFunction) host_name_lookup_process, NULL);
init_cap_file(&cfile);
-#ifdef WIN32
+#ifdef _WIN32
/* Load wpcap if possible. Do this before collecting the run-time version information */
load_wpcap();
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
-#endif /* WIN32 */
+#endif /* _WIN32 */
/* Assemble the compile-time version information string */
comp_info_str = g_string_new("Compiled ");
break;
case 'v': /* Show version and exit */
show_version();
-#ifdef WIN32
+#ifdef _WIN32
destroy_console();
#endif
exit(0);
epan_cleanup();
g_free(rc_file);
-#ifdef WIN32
+#ifdef _WIN32
/* Shutdown windows sockets */
WSACleanup();
return 0; /* not reached */
}
-#ifdef WIN32
+#ifdef _WIN32
/* We build this as a GUI subsystem application on Win32, so
"WinMain()", not "main()", gets called.
tooltips = gtk_tooltips_new();
-#ifdef WIN32
+#ifdef _WIN32
#if GTK_MAJOR_VERSION < 2
/* has to be done, after top_level window is created */
app_font_gtk1_init(top_level);
normalized_cf_name = g_strdup(cf_name);
-#ifdef WIN32
- /* replace all slashes by backslashes */
- g_strdelimit(normalized_cf_name, "/", '\\');
+#ifdef _WIN32
+ /* replace all slashes by backslashes */
+ g_strdelimit(normalized_cf_name, "/", '\\');
#endif
/* get the submenu container item */
* already in the list or
* this element is above maximum count (too old), remove it */
if (!widget_cf_name ||
-#ifdef WIN32
- /* do a case insensitive compare on win32 */
+#ifdef _WIN32
+ /* do a case insensitive compare on win32 */
#if GLIB_MAJOR_VERSION < 2
- g_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
+ g_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
#else
- g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
+ g_ascii_strncasecmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
#endif
-#else /* WIN32 */
- /* do a case sensitive compare on unix */
+#else /* _WIN32 */
+ /* do a case sensitive compare on unix */
strncmp(widget_cf_name, normalized_cf_name, 1000) == 0 ||
#endif
cnt >= prefs.gui_recent_files_count_max) {
#include "prefs-int.h"
#ifdef HAVE_LIBPCAP
-#ifdef WIN32
+#ifdef _WIN32
#include "capture-wpcap.h"
#endif /* _WIN32 */
#endif /* HAVE_LIBPCAP */
static void rtt_delete_unack_from_list (struct unack ** , struct unack * );
static void rtt_make_elmtlist (struct graph * );
static void rtt_toggle_seq_origin (struct graph * );
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__MINGW32__)
static int rint (double ); /* compiler template for Windows */
#endif
+/* XXX - what about OS X? */
static char helptext[] =
-#ifndef WIN32
+#ifndef _WIN32
"Here's what you can do:\n\
- Left Mouse Button selects segment in ethereal's packet list\n\
- Middle Mouse Button zooms in\n\
- 's' toggles relative/absolute sequence numbers\n\
- 't' toggles time origin\n\
";
-#else /* WIN32 */
+#else /* _WIN32 */
"Here's what you can do:\n\
- <ctrl>-Left Mouse Button selects segment in ethereal's packet list\n\
- Left Mouse Button zooms in\n\
g->grab.y = (int )rint (event->y) - g->geom.y;
g->grab.grabbed = TRUE;
}
-#ifdef WIN32
+#ifdef _WIN32
/* Windows mouse control: */
/* [<ctrl>-left] - select packet */
/* [left] - zoom in */
if (event->state & GDK_CONTROL_MASK) {
graph_select_segment (g, (int)event->x, (int)event->y);
} else {
-#else /* WIN32 */
+#else /* _WIN32 */
} else if (event->button == 2) {
#endif
int cur_width = g->geom.width, cur_height = g->geom.height;
update_zoom_spins (g);
if (g->cross.draw)
cross_draw (g, (int) event->x, (int) event->y);
-#ifndef WIN32
+#ifndef _WIN32
} else if (event->button == 1) {
graph_select_segment (g, (int )event->x, (int )event->y);
-#else /* WIN32 */
+#else /* _WIN32 */
}
#endif
}
g->x_axis->min = 0;
}
-#if defined(WIN32) && !defined(__MINGW32__)
+#if defined(_WIN32) && !defined(__MINGW32__)
/* replacement of Unix rint() for Windows */
static int rint (double x)
{
static void
window_icon_realize_cb (GtkWidget *win, gpointer data _U_)
{
-#ifndef WIN32
+#ifndef _WIN32
static GdkPixmap *icon_pmap = NULL;
static GdkBitmap *icon_mask = NULL;
GtkStyle *style;
#include "pcap-util.h"
#include "pcap-util-int.h"
-#ifndef WIN32
+#ifndef _WIN32
#include <netinet/in.h>
#endif
static char *asn1_filename = NULL;
static char *old_default_asn1_filename = NULL;
#define OLD_DEFAULT_ASN1FILE "asn1" G_DIR_SEPARATOR_S "default.tt"
-#ifdef WIN32
+#ifdef _WIN32
#define BAD_SEPARATOR_OLD_DEFAULT_ASN1FILE "asn1/default.tt"
static char *bad_separator_old_default_asn1_filename = NULL;
#endif
* separator.
*/
if ((strcmp(filename, old_default_asn1_filename) != 0
-#ifdef WIN32
+#ifdef _WIN32
&& strcmp(filename, bad_separator_old_default_asn1_filename) != 0
#endif
) || errno != ENOENT)
get_values();
g_node_destroy(asn1_nodes); asn1_nodes = 0;
-#ifndef WIN32 /* tvb_free not yet exported to plugins... */
+#ifndef _WIN32 /* tvb_free not yet exported to plugins... */
tvb_free(asn1_desc);
#endif
asn1_desc = 0;
&asn1_desegment);
old_default_asn1_filename = get_datafile_path(OLD_DEFAULT_ASN1FILE);
-#ifdef WIN32
+#ifdef _WIN32
bad_separator_old_default_asn1_filename = get_datafile_path(BAD_SEPARATOR_OLD_DEFAULT_ASN1FILE);
#endif
prefs.gui_hex_dump_highlight_style = 1;
prefs.filter_toolbar_show_in_statusbar = FALSE;
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
-#ifdef WIN32
+#ifdef _WIN32
prefs.gui_font_name1 = g_strdup("-*-lucida console-medium-r-*-*-*-100-*-*-*-*-*-*");
prefs.gui_font_name2 = g_strdup("Lucida Console 10");
#else
}
static char *tmpdir = NULL;
-#ifdef WIN32
+#ifdef _WIN32
static char *temp = NULL;
#endif
static char *E_tmpdir;
if (!initialized) {
if ((dir = getenv("TMPDIR")) != NULL)
tmpdir = setup_tmpdir(dir);
-#ifdef WIN32
+#ifdef _WIN32
if ((dir = getenv("TEMP")) != NULL)
temp = setup_tmpdir(dir);
#endif
return fd;
}
-#ifdef WIN32
+#ifdef _WIN32
if (temp != NULL) {
fd = try_tempfile(namebuf, namebuflen, temp, pfx);
if (fd != -1)
void
get_runtime_version_info(GString *str)
{
-#if defined(WIN32)
+#if defined(_WIN32)
OSVERSIONINFO info;
#elif defined(HAVE_SYS_UTSNAME_H)
struct utsname name;
get_runtime_pcap_version(str);
g_string_append(str, "on ");
-#if defined(WIN32)
+#if defined(_WIN32)
info.dwOSVersionInfoSize = sizeof info;
if (!GetVersionEx(&info)) {
/*
#endif
#ifndef LIBXML_DLL_IMPORT
-#if defined(WIN32) && !defined(STATIC)
+#if defined(_WIN32) && !defined(STATIC)
#define LIBXML_DLL_IMPORT __declspec(dllimport)
#else
#define LIBXML_DLL_IMPORT
typedef unsigned char xmlChar;
-#ifndef WIN32
+#ifndef _WIN32
#ifndef CHAR
#define CHAR xmlChar
#endif
XML_EXTERN XML_STUB XmlStub;
XML_EXTERN int XmlStubInitialized;
-#ifdef WIN32
+#ifdef _WIN32
/* We're in windows, use the windows filename */
#define XML_LIBRARY "libxml2.dll"
#else