@@ -494,6 +494,36 @@ static int ftp_custom_cmd_TRMT(void* userdata, const char* data, char* msg_buf,
494494 return code ;
495495}
496496
497+ static int ftp_custom_cmd_ACC (void * userdata , const char * data , char * msg_buf , unsigned msg_buf_len ) {
498+ Result rc ;
499+ int code = FTP_DEFAULT_ERROR_CODE ;
500+ AccountUid uid ;
501+ AccountProfile profile ;
502+ AccountProfileBase profilebase ;
503+
504+ // Initialize account service
505+ if (R_FAILED (rc = accountInitialize (AccountServiceType_Application ))) {
506+ snprintf (msg_buf , msg_buf_len , "Failed: accountInitialize() 0x%08X" , rc );
507+ return code ;
508+ }
509+
510+ // Get the last opened user
511+ if (R_SUCCEEDED (rc = accountGetLastOpenedUser (& uid ))) {
512+ // Get profile for the user
513+ if (R_SUCCEEDED (rc = accountGetProfile (& profile , uid ))) {
514+ // Get profile base data
515+ if (R_SUCCEEDED (rc = accountProfileGet (& profile , NULL , & profilebase ))) {
516+ code = 200 ;
517+ snprintf (msg_buf , msg_buf_len , "%016lX %016lX %s" , uid .uid [0 ], uid .uid [1 ], profilebase .nickname );
518+ }
519+ accountProfileClose (& profile );
520+ }
521+ }
522+
523+ accountExit ();
524+ return code ;
525+ }
526+
497527const struct FtpSrvCustomCommand CUSTOM_COMMANDS [] = {
498528 // reboot console
499529 { "REBT" , ftp_custom_cmd_REBT , NULL , 1 , 0 },
@@ -509,6 +539,8 @@ const struct FtpSrvCustomCommand CUSTOM_COMMANDS[] = {
509539 { "TIDS" , ftp_custom_cmd_TIDS , NULL , 1 , 0 },
510540 // terminate tid
511541 { "TRMT" , ftp_custom_cmd_TRMT , NULL , 1 , 1 },
542+ // get current user account
543+ { "ACC" , ftp_custom_cmd_ACC , NULL , 1 , 0 },
512544};
513545
514546const unsigned CUSTOM_COMMANDS_SIZE = sizeof (CUSTOM_COMMANDS ) / sizeof (CUSTOM_COMMANDS [0 ]);
0 commit comments