All pastes #179662 Raw Edit

lithium

public text v1 · immutable
#179662 ·published 2006-09-22 11:57 UTC
rendered paste body
/*
This is how cryptui_prompt_recipients() works in C:

static void
show_chooser_dialog (CryptUIKeyset *keyset)
{
    gchar **recipients, **k;
    gchar *signer;

    recipients = cryptui_prompt_recipients (keyset, "Choose Recipients", &signer);

    if (recipients) {
        for (k = recipients; *k; k++)
            g_print ("RECIPIENT: %s\n", *k);
        g_strfreev (recipients);
        g_print ("SIGNER: %s\n", signer);
        g_free (signer);
    }
}
*/

using System;
using System.Runtime.InteropServices;
using Gtk;

class Test
{
	public static unsafe void Main()
	{
        Application.Init();
        
        // This works
		IntPtr keyset = cryptui_keyset_new("openpgp");
		
		// This doesn't
		IntPtr signer = IntPtr.Zero;
		IntPtr recipients = cryptui_prompt_recipients(keyset, "Choose Recipient Keys", &signer);
		
        Application.Run();
	}

    [DllImport("cryptui")]
 // CryptUIKeyset* cryptui_keyset_new (const gchar *keytype);
    private static extern IntPtr cryptui_keyset_new(string keytype);

    [DllImport("cryptui")]
 // gchar** cryptui_prompt_recipients (CryptUIKeyset *keyset, const gchar *title, gchar **signer);
    private static unsafe extern IntPtr cryptui_prompt_recipients(IntPtr keyset, string title, IntPtr *signer);
}