switchbrew / libnx

Library for Switch Homebrew

Home Page:https://switchbrew.github.io/libnx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pmdmnt calls do not seem to work

ckurtz22 opened this issue · comments

Right now I'm trying to use pmdmnt stuff to get application process ID. pmdmntGetApplicationPid seems to be returning garbage (right now it just put 0x4f434653 in it). pmdmntGetTitlePid seems to be returning the title ID it was passed in instead of the process ID for the title. I've made sure to run pmdmntInitialize, and I am checking the initialize for errors as well.

Just tried pmdmntEnableDebugForApplication/TitleId, both of those are having similar issues. The returned debug handle when used with svcGetProcessId, returns a junk PID (c61b478)

I guess it is worth mentioning I am on 6.2.0 FW and I've been using the latest commit of atmosphere.

Code? What libnx build?

I'm using the latest master commit of libnx as of last night. Here is the code I was using for pmdmntGetTitlePid:

     Result rc;
     rc = pmdmntInitialize();
     if (R_FAILED(rc)) fatalSimple(rc);
     rc = pmdmntGetTitlePid(&pid, 0x0100e95004038000);
     if (R_FAILED(rc)) fatalSimple(rc);
     pmdmntExit();

This would just set pid to 0x0x0100e95004038000. If I replaced pmdmntGetTitlePid with pmdmntGetApplicationPid then it would put what seemed to be random garbage in pid.

What is this running from? A normal app?

A sysmodule. Going to make a basic sysmodule and application that just uses this and test both to make sure

If you're overriding __appInit you're probably missing this: https://github.com/switchbrew/libnx/blob/master/nx/source/runtime/init.c#L112

Awesome, it works now!