On Mon, Jul 30, 2018 at 2:45 AM, Armin Novak via FreeRDP-devel
<freerdp-devel@lists.sourceforge.net> wrote:
> client/X11/xf_client.c implements the callbacks (RdpClientEntry function)
>
>
> Go through the different callbacks in xfreerdp_client_new to get an idea
> of setting up and cleaning up a session.
>
>
> P.s. Sorry, documentation is sparse, still trying to clean up the API
> too much (internal) stuff exported :/
>

Thanks, I stumbled across that code last night. I had no idea about
the callbacks though - I will check them. I found I had to call
freerdp_connect on my own for some reason, but this does seem to work
properly.

Can you provide any hints for accessing the screen's bitmap data? I
looked in freerdp/graphics.h but only see prototype structures in the
bitmap structure. The graphics structure itself does not contain
anything promising itself, either.

The callbacks in the rdpBitmap which is called Bitmap_Prototype are
all unset save for New by default. Attempting to set them appears to
do nothing. The code below is rather sparse. Waiting 10 seconds change
anything, I suspected perhaps a full frame had not appeared.

I am passing only a username and host IP using the xfreerdp command
line syntax. Is it reasonable to expect to see the login screen?

Cheers,
    R0b0t1


---


#include <stdio.h>

#include <freerdp/freerdp.h>
#include <freerdp/api.h>
#include <freerdp/client.h>
#include <freerdp/settings.h>
#include <freerdp/client/cmdline.h>

BOOL rdpuppet_global_init();
void rdpuppet_global_uninit();
BOOL rdpuppet_client_new(freerdp *instance, rdpContext *context);
void rdpuppet_client_free(freerdp *instance, rdpContext *context);
int rdpuppet_client_start(rdpContext *context);
int rdpuppet_client_stop(rdpContext *context);

BOOL rdpuppet_context_new(freerdp *instance, rdpContext *context);
void rdpuppet_context_free(freerdp *instance, rdpContext *context);

BOOL rdpuppet_preconnect(freerdp *instance);
BOOL rdpuppet_postconnect(freerdp *instance);
void rdpuppet_postdisconnect(freerdp *instance);
BOOL rdpuppet_authenticate(
    freerdp *instance,
    char **username, char **password, char **domain
);

BOOL rdpuppet_bitmap_paint(rdpContext *context, rdpBitmap *bitmap);
BOOL rdpuppet_bitmap_setsurface(rdpContext *context, rdpBitmap
*bitmap, BOOL primary);

int main(int argc, char *argv[])
{
    int r = 0;
    // This should be FREERDP_CLIENT_ENTRY_POINTS but the type resolves
    // erroneously to int (not defined?).
    struct rdp_client_entry_points_v1 fcep = {
        .Size = sizeof(struct rdp_client_entry_points_v1),
        .Version = 1,

        .GlobalInit = rdpuppet_global_init,
        .GlobalUninit = rdpuppet_global_uninit,

        .ContextSize = sizeof(rdpContext),
        .ClientNew = rdpuppet_client_new,
        .ClientFree = rdpuppet_client_free,
        .ClientStart = rdpuppet_client_start,
        .ClientStop = rdpuppet_client_stop
    };
    rdpContext *rdc;
    rdpSettings *rds;
    rdpGraphics *rdg;
    freerdp *rdi;

    rdc = freerdp_client_context_new(&fcep);
    rds = rdc->settings;
    rdg = rdc->graphics;
    rdi = rdc->instance;

    if ((r = freerdp_client_settings_parse_command_line(rds, argc, argv, 0)))
        printf("freerdp_client_settings_parse_command_line\n");
    freerdp_client_settings_command_line_status_print(rds, r, argc, argv);

    //rdg->Bitmap_Prototype->Paint = rdpuppet_bitmap_paint;
    //rdg->Bitmap_Prototype->SetSurface = rdpuppet_bitmap_setsurface;

    rdi->ContextNew = rdpuppet_context_new;
    rdi->ContextFree = rdpuppet_context_free;
    rdi->PreConnect = rdpuppet_preconnect;
    rdi->PostConnect = rdpuppet_postconnect;
    rdi->PostDisconnect = rdpuppet_postdisconnect;
    rdi->Authenticate = rdpuppet_authenticate;

    freerdp_client_start(rdc);
    freerdp_connect(rdi);

    printf("New: %p\n", rdg->Bitmap_Prototype->New);
    printf("Free: %p\n", rdg->Bitmap_Prototype->Free);
    printf("Paint: %p\n", rdg->Bitmap_Prototype->Paint);
    printf("Decompress: %p\n", rdg->Bitmap_Prototype->Decompress);
    printf("SetSurface: %p\n", rdg->Bitmap_Prototype->SetSurface);

    //usleep(10000000);

    freerdp_disconnect(rdi);
    freerdp_client_context_free(rdc);
    return 0;
}

BOOL rdpuppet_global_init()
{
    printf("rdpuppet_global_init\n");
    return 1;
}

void rdpuppet_global_uninit()
{
    printf("rdpuppet_global_uninit\n");
}

BOOL rdpuppet_client_new(freerdp *instance, rdpContext *context)
{
    printf("rdpuppet_client_new\n");
    return 1;
}

void rdpuppet_client_free(freerdp *instance, rdpContext *context)
{
    printf("rdpuppet_client_free\n");
}

int rdpuppet_client_start(rdpContext *context)
{
    printf("rdpuppet_client_start\n");
    return 0;
}

int rdpuppet_client_stop(rdpContext *context)
{
    printf("rdpuppet_client_stop\n");
    return 0;
}

BOOL rdpuppet_context_new(freerdp *instance, rdpContext *context)
{
    printf("rdpuppet_context_new\n");
    return 1;
}

void rdpuppet_context_free(freerdp *instance, rdpContext *context)
{
    printf("rdpuppet_context_free\n");
}

BOOL rdpuppet_preconnect(freerdp *instance)
{
    printf("rdpuppet_preconnect\n");
    return 1;
}

BOOL rdpuppet_postconnect(freerdp *instance)
{
    printf("rdpuppet_postconnect\n");
    return 1;
}

void rdpuppet_postdisconnect(freerdp *instance)
{
    printf("rdpuppet_postdisconnect\n");
}

BOOL rdpuppet_authenticate(
    freerdp *instance,
    char **username, char **password, char **domain
)
{
    printf("rdpuppet_authenticate\n");
    return 1;
}

BOOL rdpuppet_bitmap_paint(rdpContext *context, rdpBitmap *bitmap)
{
    printf("rdpuppet_bitmap_paint\n");
    return 1;
}

BOOL rdpuppet_bitmap_setsurface(rdpContext *context, rdpBitmap
*bitmap, BOOL primary)
{
    printf("rdpuppet_bitmap_setsurface\n");
    return 1;
}

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
FreeRDP-devel mailing list
FreeRDP-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freerdp-devel

Reply via email to