Hacking Crashing on curl_easy_setup?

QuarkTheAwesome

🦊
OP
Member
Joined
Apr 19, 2015
Messages
1,023
Trophies
1
Location
Stuck in the PowerPC
Website
heyquark.com
XP
3,915
Country
Australia
Hey everyone!

I'm writing a little program for the WiiU and it needs to grab some files with cURL (similar to what the ELF loader does) It's all going well, up until the call to curl_easy_setup - where the system crashes. The majority of the cURL code (basically everything but the write callback) is copied from the ELF loader, so it should work, but it just doesn't. I'd really appreciate any help you guys have because I'm watching the exact same code working fine for someone else, just not for me!

Code:
Code:
    uint32_t nn_ac_handle, nsysnet_handle, libcurl_handle, nn_startupid;
    OSDynLoad_Acquire("nn_ac.rpl", &nn_ac_handle);
    OSDynLoad_Acquire("nsysnet", &nsysnet_handle);
    OSDynLoad_Acquire("nlibcurl", &libcurl_handle);

    int  (*ACInitialize)(void);
    int  (*ACGetStartupId)(uint32_t *id);
    int  (*ACConnectWithConfigId)(uint32_t id);
    int  (*socket_lib_init)(void);
    int  (*curl_global_init)(int opts);
    void*(*curl_easy_init)(void);
    void (*curl_easy_cleanup)(void *handle);

    OSDynLoad_FindExport(nn_ac_handle, 0, "ACInitialize", &ACInitialize);
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACGetStartupId", &ACGetStartupId); 
    OSDynLoad_FindExport(nn_ac_handle, 0, "ACConnectWithConfigId",&ACConnectWithConfigId);
    OSDynLoad_FindExport(nsysnet_handle, 0, "socket_lib_init", &socket_lib_init);
    OSDynLoad_FindExport(libcurl_handle, 0, "curl_global_init", &curl_global_init);
    OSDynLoad_FindExport(libcurl_handle, 0, "curl_easy_init", &curl_easy_init);
    OSDynLoad_FindExport(libcurl_handle, 0, "curl_easy_cleanup", &curl_easy_cleanup);

    ACInitialize();
    ACGetStartupId(&nn_startupid);
    ACConnectWithConfigId(nn_startupid);
    socket_lib_init();
    curl_global_init(CURL_GLOBAL_ALL);

    void *curl_handle = curl_easy_init(); //System crashes here.
    //Everything below this point isn't executed.
    if(!curl_handle) OSFatal("cURL not initialized");

    curl_download_file(curl_handle, url); //I've already set up the URL above
    curl_easy_cleanup(curl_handle);
Yeah, as you can tell, it's basically all the same as the ELF loader. I'm running a 5.5.1 WiiU using libstagefright and self-hosting the ELF loader which then loads my program (~50k). I can run most other userspace homebrews just fine.
Thanks in advance!

Edit: I've been thinking about it and it might be because I'm running out of RAM? Don't hold me to that.
 
Last edited by QuarkTheAwesome,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://youtu.be/sg0D1PpgCXs?si=rnzM6Df7jeL6FiPz