SpiceNamedPipe* spice_win32_user_pipe_new (gchar *name, GError **error) { SECURITY_ATTRIBUTES sa; SECURITY_DESCRIPTOR sd; PACL dacl = NULL; HANDLE pipe; SpiceNamedPipe *np = NULL; g_return_val_if_fail (name != NULL, NULL); g_return_val_if_fail (error != NULL, NULL); if (!get_user_security_attributes (&sa, &sd, &dacl)) return NULL; pipe = CreateNamedPipe (name, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | /* FIXME: why is FILE_FLAG_FIRST_PIPE_INSTANCE needed for WRITE_DAC * (apparently needed by SetSecurityInfo). This will prevent * multiple pipe listener....?! */ FILE_FLAG_FIRST_PIPE_INSTANCE | WRITE_DAC, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITED_INSTANCES, DEFAULT_PIPE_BUF_SIZE, DEFAULT_PIPE_BUF_SIZE, 0, &sa); if (pipe == INVALID_HANDLE_VALUE) { int errsv = GetLastError (); gchar *emsg = g_win32_error_message (errsv); g_set_error (error, G_IO_ERROR, g_io_error_from_win32_error (errsv), "Error CreateNamedPipe(): %s", emsg); g_free (emsg); goto end; } /* lower integrity on Vista/Win7+ */ if ((LOBYTE (g_win32_get_windows_version()) > 0x05 || LOWORD (g_win32_get_windows_version()) > 0x0105) && !spice_win32_set_low_integrity (pipe, error)) goto end; np = SPICE_NAMED_PIPE (g_initable_new (SPICE_TYPE_NAMED_PIPE, NULL, error, "handle", pipe, NULL)); end: LocalFree (dacl); return np; }
static void bug_information_generate_message(GtkTextBuffer * buffer) { int i; gchar *temp; GtkTextIter iter; GtkTextTag *bold_tag, *larger_tag; GtkTextTagTable *table; /* get buffer's tag table */ table = gtk_text_buffer_get_tag_table(buffer); /* Create bold tag */ bold_tag = gtk_text_tag_new("bold"); g_object_set(G_OBJECT(bold_tag), "weight", PANGO_WEIGHT_BOLD, NULL); /* add bold_tag to tag table */ gtk_text_tag_table_add(table, bold_tag); /* Create bold tag */ larger_tag = gtk_text_tag_new("larger"); g_object_set(G_OBJECT(larger_tag), "scale", PANGO_SCALE_X_LARGE, NULL); /* add larger_tag to tag table */ gtk_text_tag_table_add(table, larger_tag); /* Get the start */ gtk_text_buffer_get_start_iter(buffer, &iter); /* insert program name */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Gnome Music Player Client\n", -1, bold_tag, larger_tag, NULL); /* insert copyright */ gtk_text_buffer_insert_with_tags(buffer, &iter, GMPC_COPYRIGHT "\n\n", -1, bold_tag, NULL); /* insert tagline */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Tagline:\t", -1, bold_tag, NULL); gtk_text_buffer_insert(buffer, &iter, GMPC_TAGLINE "\n", -1); /* insert version */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Version:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i.%i.%i\n", GMPC_MAJOR_VERSION, GMPC_MINOR_VERSION, GMPC_MICRO_VERSION); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* insert revision */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Revision:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%s\n", revision); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /** support libs */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nSupport libraries:\n", -1, bold_tag, larger_tag, NULL); /* libmpd */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Libmpd:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i.%i.%i\n", LIBMPD_MAJOR_VERSION, LIBMPD_MINOR_VERSION, LIBMPD_MICRO_VERSION); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* gtk+-2.0 */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Compile time Gtk+-2.0:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i.%i.%i\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); gtk_text_buffer_insert_with_tags(buffer, &iter, "Runtime Gtk+-2.0:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i.%i.%i\n", gtk_major_version, gtk_minor_version, gtk_micro_version); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* glib-2.0 */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Glib-2.0:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i.%i.%i\n", GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* glib-2.0 */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Runtime sqlite3:\t", -1, bold_tag, NULL); gtk_text_buffer_insert(buffer, &iter, sqlite3_libversion(), -1); gtk_text_buffer_insert_with_tags(buffer, &iter, "\nCompile time sqlite3:\t", -1, bold_tag, NULL); gtk_text_buffer_insert(buffer, &iter, SQLITE_VERSION, -1); #ifdef HAVE_UNIQUE gtk_text_buffer_insert_with_tags(buffer, &iter, "\nLibunique:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%s\n", UNIQUE_VERSION_S); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); #endif /* platform */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nPlatform:\t", -1, bold_tag, NULL); #ifdef WIN32 gtk_text_buffer_insert(buffer, &iter, "Windows\n", -1); gtk_text_buffer_insert_with_tags(buffer, &iter, "Windows version:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i\n", g_win32_get_windows_version()); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); #else #ifdef OSX gtk_text_buffer_insert(buffer, &iter, "Mac OsX\n", -1); #else gtk_text_buffer_insert(buffer, &iter, "*nix\n", -1); #endif #endif /** compile flags*/ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nCompile flags:\n", -1, bold_tag, larger_tag, NULL); gtk_text_buffer_insert_with_tags(buffer, &iter, "\nNLS Support:\t", -1, bold_tag, NULL); #ifdef ENABLE_NLS gtk_text_buffer_insert(buffer, &iter, "Enabled", -1); #else gtk_text_buffer_insert(buffer, &iter, "Disabled", -1); #endif gtk_text_buffer_insert_with_tags(buffer, &iter, "\nMultimedia Keys:\t", -1, bold_tag, NULL); #ifdef ENABLE_MMKEYS gtk_text_buffer_insert(buffer, &iter, "Enabled", -1); #else gtk_text_buffer_insert(buffer, &iter, "Disabled", -1); #endif gtk_text_buffer_insert_with_tags(buffer, &iter, "\nAppIndicator Support:\t", -1, bold_tag, NULL); #ifdef HAVE_APP_INDICATOR gtk_text_buffer_insert(buffer, &iter, "Enabled", -1); #else gtk_text_buffer_insert(buffer, &iter, "Disabled", -1); #endif gtk_text_buffer_insert_with_tags(buffer, &iter, "\nLibspiff support:\t", -1, bold_tag, NULL); #ifdef SPIFF gtk_text_buffer_insert(buffer, &iter, "Enabled", -1); #else gtk_text_buffer_insert(buffer, &iter, "Disabled", -1); #endif gtk_text_buffer_insert_with_tags(buffer, &iter, "\nLibunique support:\t", -1, bold_tag, NULL); #ifdef HAVE_UNIQUE gtk_text_buffer_insert(buffer, &iter, "Enabled", -1); #else gtk_text_buffer_insert(buffer, &iter, "Disabled", -1); #endif /** Plugins */ if (num_plugins > 0) { gtk_text_buffer_insert_with_tags(buffer, &iter, "\n\nExternal Plugins:\n", -1, bold_tag, larger_tag, NULL); for (i = 0; i < num_plugins; i++) { if (!gmpc_plugin_is_internal(plugins[i])) { const gchar *name = gmpc_plugin_get_name(plugins[i]); const int *version = gmpc_plugin_get_version(plugins[i]); if(gmpc_plugin_get_enabled(plugins[i])) { gtk_text_buffer_insert(buffer, &iter, "☑ ", -1); }else { gtk_text_buffer_insert(buffer, &iter, "☐ ", -1); } gtk_text_buffer_insert_with_tags(buffer, &iter, name, -1, bold_tag, NULL); temp = g_strdup_printf("\t%i.%i.%i\n", version[0], version[1], version[2]); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); } } } if (num_plugins > 0) { gtk_text_buffer_insert_with_tags(buffer, &iter, "\n\nMetadata Plugins:\n", -1, bold_tag, larger_tag, NULL); for (i = 0; i < num_plugins; i++) { if (gmpc_plugin_is_metadata(plugins[i])) { const gchar *name = gmpc_plugin_get_name(plugins[i]); const int *version = gmpc_plugin_get_version(plugins[i]); if(gmpc_plugin_get_enabled(plugins[i])) { gtk_text_buffer_insert(buffer, &iter, "☑ ", -1); }else { gtk_text_buffer_insert(buffer, &iter, "☐ ", -1); } gtk_text_buffer_insert_with_tags(buffer, &iter, name, -1, bold_tag, NULL); temp = g_strdup_printf("\t%i.%i.%i\n", version[0], version[1], version[2]); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); } } } if (mpd_check_connected(connection)) { gchar **handlers; /** Plugins */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nMusic Player Daemon:\n", -1, bold_tag, larger_tag, NULL); /* Version */ gtk_text_buffer_insert_with_tags(buffer, &iter, "Version:\t", -1, bold_tag, NULL); temp = mpd_server_get_version(connection); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* total songs */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nSongs:\t", -1, bold_tag, NULL); temp = g_strdup_printf("%i", mpd_stats_get_total_songs(connection)); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); /* hostname */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nHostname:\t", -1, bold_tag, NULL); temp = connection_get_hostname(); gtk_text_buffer_insert(buffer, &iter, temp, -1); /* handlers */ gtk_text_buffer_insert_with_tags(buffer, &iter, "\nUrl handlers:\t", -1, bold_tag, NULL); handlers = mpd_server_get_url_handlers(connection); if (handlers) { temp = g_strjoinv(",", handlers); g_strfreev(handlers); handlers = NULL; } else temp = g_strdup("N/A"); gtk_text_buffer_insert(buffer, &iter, temp, -1); g_free(temp); } }
static VALUE rg_s_version(VALUE self) { return UINT2NUM(g_win32_get_windows_version()); }
static void init_win32_paths(void) { char *home_dir = NULL; HMODULE hModule; DWORD dWord; char *dirname; char *sBuffer; // Init the path for the Windows version by getting the // executable location. hModule = GetModuleHandle("tilp.exe"); sBuffer = (char *) malloc(4096 * sizeof(char)); dWord = GetModuleFileName(hModule, sBuffer, 4096); dirname = g_dirname(sBuffer); // MinGW Option, allows Windows Users to run on a Linux File Hierarhcy #ifdef __MINGW32__ #define MINGW_REL "share\\tilp2" char *basename; basename = g_path_get_basename(dirname); // Will replace /target/bin with /target/share/tilp2 in MinGW/MSYS if ((strlen(basename) == 3) && !g_strcasecmp(basename, "bin")) { gchar *token; dirname = g_realloc(dirname, strlen(dirname) + strlen(MINGW_REL) + 1); token = dirname + strlen(dirname) - 3; strcpy(token, MINGW_REL); } #endif inst_paths.base_dir = g_strconcat(dirname, "\\", NULL); g_free(dirname); free(sBuffer); inst_paths.pixmap_dir = g_strconcat(inst_paths.base_dir, "pixmaps\\", NULL); inst_paths.icon_dir = g_strconcat(inst_paths.base_dir, "icons\\", NULL); inst_paths.help_dir = g_strconcat(inst_paths.base_dir, "help\\", NULL); inst_paths.manpage_dir = g_strconcat(inst_paths.base_dir, "", NULL); inst_paths.glade_dir = g_strconcat(inst_paths.base_dir, "glade\\", NULL); #ifdef __MINGW32__ inst_paths.home_dir = g_get_current_dir(); #else if((g_win32_get_windows_version() & 255) > 5) { // Windows Vista inst_paths.home_dir = g_strconcat(g_get_home_dir(), G_DIR_SEPARATOR_S, "Documents", G_DIR_SEPARATOR_S, _("My TI Files"), NULL); g_mkdir(inst_paths.home_dir, 0); } else { // Windows XP inst_paths.home_dir = g_strconcat(inst_paths.base_dir, "My TI files\\", NULL); g_mkdir(inst_paths.home_dir, 0); } #endif #ifdef ENABLE_NLS inst_paths.locale_dir = g_strconcat(inst_paths.base_dir, "locale\\", NULL); #endif /* */ }