Filesystem services: Difference between revisions

Ootulp (talk | contribs)
mNo edit summary
Ootulp (talk | contribs)
 
(7 intermediate revisions by 3 users not shown)
Line 16: Line 16:
Takes a type-0x19 input buffer containing a [[#FspPath]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]].
Takes a type-0x19 input buffer containing a [[#FspPath]] and an input [[NCM_services#ProgramId|ProgramId]]. Returns an [[#IFileSystem]].


[10.0.0+] This now takes an additional type-0x1A output buffer.
[10.0.0+] Now takes an additional type-0x1A output buffer.


[16.0.0+] This now takes an additional input [[#ContentAttributes]].
[16.0.0+] Now takes an additional input [[#ContentAttributes]].


[17.0.0+] This now takes a type-0x6 output buffer instead of a type-0x1A output buffer.
[17.0.0+] Now takes a type-0x6 output buffer instead of a type-0x1A output buffer.
 
[20.0.0+] Now no longer takes a type-0x19 input buffer containing a [[#FspPath]] and instead takes an input [[NCM_services#StorageId|StorageId]].


== IsArchivedProgram ==
== IsArchivedProgram ==
Line 45: Line 47:


== RegisterProgram ==
== RegisterProgram ==
Takes a [[NCM_services#StorageId|StorageId]], an u64 ProcessId, a [[NCM_services#ProgramId|ProgramId]], a 0x1C type-A buffer for the [[NPDM#FS_Access_Header| FS Access Header]], and a 0x2C type-A buffer for the [[NPDM#FS_Access_Control| FS Access Control]]
Takes an input [[NCM_services#StorageId|StorageId]], an input u64 ProcessId, an input [[NCM_services#ProgramId|ProgramId]], a type-0x5 input buffer containing an [[NPDM#ACID|ACID]] [[NPDM#FsAccessControl|FsAccessControl]], and a type-0x5 input buffer containing an [[NPDM#ACI0|ACI0]] [[NPDM#FsAccessControl|FsAccessControl]].


Final FS permissions are stored as (ACI0_perms & ACID_perms). Will panic(svcBreak) when buffer sizes from ipc-rawdata are invalid.
Final FS permissions are stored as (ACI0_perms & ACID_perms). Will panic(svcBreak) when buffer sizes from ipc-rawdata are invalid.
[20.0.0+] Now takes an additional input [[#FsAccessControlRestrictionMode]].


== UnregisterProgram ==
== UnregisterProgram ==
Takes a pid. Removes registered FS permissions for that PID.
Takes an input u64 ProcessId. No output.
 
Removes registered FS permissions for that PID.


== SetEnabledProgramVerification ==
== SetEnabledProgramVerification ==
Seems to sets a global flag to inputval & 1.
Takes an input bool. No output.


When the flag is zero, it will set ret=0 instead of ret={error} when verifying the fixed-key [[NPDM]] ACID signature fails. This also skips verifying the [[NCA_Format|NCA Header]] signature using the ACID key. Note that if verifying the fixed-key ACID signature is successful, and verifying the ACID-key NCA header signature fails, it will throw an error and abort.
When the flag is zero, it will set ret=0 instead of ret={error} when verifying the fixed-key [[NPDM]] ACID signature fails. This also skips verifying the [[NCA_Format|NCA Header]] signature using the ACID key. Note that if verifying the fixed-key ACID signature is successful, and verifying the ACID-key NCA header signature fails, it will throw an error and abort.
Line 125: Line 131:
|-
|-
| 37 || [14.0.0+] CreateSaveDataFileSystemWithCreationInfo2
| 37 || [14.0.0+] CreateSaveDataFileSystemWithCreationInfo2
|-
| 38 || [20.0.0+] DetachSdCard
|-
|-
| 51 || [[#OpenSaveDataFileSystem]]
| 51 || [[#OpenSaveDataFileSystem]]
Line 209: Line 217:
|-
|-
| 501 || [[#OpenGameCardDetectionEventNotifier]]
| 501 || [[#OpenGameCardDetectionEventNotifier]]
|-
| 502 || [20.0.0+] OpenSdCardAwakenReadyEventNotifier
|-
|-
| 503 || [19.0.0+] OpenGameCardAwakenReadyEventNotifier
| 503 || [19.0.0+] OpenGameCardAwakenReadyEventNotifier
Line 341: Line 351:


Note that the functions check whether or not at least one bit is set in the mask. This means that, you don't need to set 0xFFFFFFFFFFFFFFFF to get all permissions: it suffices to set 0x8000000000000000.
Note that the functions check whether or not at least one bit is set in the mask. This means that, you don't need to set 0xFFFFFFFFFFFFFFFF to get all permissions: it suffices to set 0x8000000000000000.
If nn::spl::IsDebugMode() is disabled (retail behavior), the FS sysmodule masks the permission descriptor with 0x3FFFFFFFFFFFFFFF upon process registration.


If the code were to request an invalid input type, panic. But this never happens.
If the code were to request an invalid input type, panic. But this never happens.
Line 439: Line 451:
| [6.0.0+] 0x2B || CanMountRegisteredUpdatePartition || 0x8000000000010000 || R- || [[#OpenRegisteredUpdatePartition]]
| [6.0.0+] 0x2B || CanMountRegisteredUpdatePartition || 0x8000000000010000 || R- || [[#OpenRegisteredUpdatePartition]]
|-
|-
| [7.0.0+] 0x2C || CanOpenSaveDataInternalStorage || 0x8000000000000000 || RW || [[#OpenSaveDataInternalStorageFileSystem]]
| [7.0.0+] 0x2C || CanOpenSaveDataInternalStorage || [-19.0.0] 0x8000000000000000 [20.0.0+] 0x8000000000000020 || RW || [[#OpenSaveDataInternalStorageFileSystem]]
|-
|-
| [7.0.0+] 0x2D || CanMountTemporaryDirectory || 0xC000000000000000 || RW ||  
| [7.0.0+] 0x2D || CanMountTemporaryDirectory || 0xC000000000000000 || RW ||  
Line 571: Line 583:
| [6.0.0-19.0.0] 0x31 [20.0.0+] 0x3A || CanOpenGameCardDetectionEventNotifier || 0x8000000080000110 || [[#OpenGameCardDetectionEventNotifier]]
| [6.0.0-19.0.0] 0x31 [20.0.0+] 0x3A || CanOpenGameCardDetectionEventNotifier || 0x8000000080000110 || [[#OpenGameCardDetectionEventNotifier]]
|-
|-
| [20.0.0+] 0x3B || || 0x8000000080000110 ||
| [20.0.0+] 0x3B || CanOpenGameCardAwakenReadyEventNotifier || 0x8000000080000110 || OpenGameCardAwakenReadyEventNotifier
|-
|-
| [6.0.0-19.0.0] 0x32 [20.0.0+] 0x3C || CanOpenSystemDataUpdateEventNotifier || 0x8000000000100008 || OpenSystemDataUpdateEventNotifier
| [6.0.0-19.0.0] 0x32 [20.0.0+] 0x3C || CanOpenSystemDataUpdateEventNotifier || 0x8000000000100008 || OpenSystemDataUpdateEventNotifier
Line 781: Line 793:


Returns a [[IPC_Marshalling#Domain_message|domain object ID]] implementing the [[#IStorage]] interface for data archives.
Returns a [[IPC_Marshalling#Domain_message|domain object ID]] implementing the [[#IStorage]] interface for data archives.
[[NCA|PublicData]] is exempt from the [[#Permissions|permissions]] check.


== OpenDataFileSystemWithProgramIndex ==
== OpenDataFileSystemWithProgramIndex ==
Line 1,092: Line 1,106:
|-
|-
| 6 || [17.0.0+] [[#GetSdCardHostControllerStatus]]
| 6 || [17.0.0+] [[#GetSdCardHostControllerStatus]]
|-
| 7 || [20.0.0+] SetSdCardActivationMode
|-
| 8 || [20.0.0+] TryGetSdCardInfo
|-
|-
| 100 || [[#GetMmcCid]]
| 100 || [[#GetMmcCid]]
Line 1,112: Line 1,130:
|-
|-
| 117 || [17.0.0+] [[#EraseMmcWithRange]]
| 117 || [17.0.0+] [[#EraseMmcWithRange]]
|-
| 118 || [20.0.0+] MarkBeforeEraseMmcPartitionUserData
|-
| 119 || [20.0.0+] CheckAfterEraseMmcPartitionUserData
|-
|-
| 200 || [[#IsGameCardInserted]]
| 200 || [[#IsGameCardInserted]]
Line 1,162: Line 1,184:
|-
|-
| 224 || [19.0.0+] [[#GetGameCardApplicationIdList]]
| 224 || [19.0.0+] [[#GetGameCardApplicationIdList]]
|-
| 225 || [20.0.0+] RegisterGameCardConfigurationData
|-
| 226 || [20.0.0+] GetGameCardDetailedErrorReportInfo
|-
|-
| 300 || [[#SetSpeedEmulationMode]]
| 300 || [[#SetSpeedEmulationMode]]
Line 1,168: Line 1,194:
|-
|-
| 302 || [18.0.0+] [[#SetApplicationStorageSpeed]]
| 302 || [18.0.0+] [[#SetApplicationStorageSpeed]]
|-
| 303 || [20.0.0+] SetGameCardClockRateForSpeedEmulation
|-
| 304 || [20.0.0+] ClearGameCardClockRateForSpeedEmulation
|-
|-
| 400 || [5.0.0+] [[#SuspendSdmmcControl]]
| 400 || [5.0.0+] [[#SuspendSdmmcControl]]
Line 1,551: Line 1,581:
|-
|-
| 16 || [[#SetKeySeedPackage]]
| 16 || [[#SetKeySeedPackage]]
|-
| 17 || [20.0.0+] SetLocalKeySeedPackage
|-
|-
| 32 || [[#OpenSaveDataExporter]]
| 32 || [[#OpenSaveDataExporter]]
Line 1,644: Line 1,676:
|-
|-
| 74 || [18.0.0+] [[#GetKeySeed]]
| 74 || [18.0.0+] [[#GetKeySeed]]
|-
| 75 || [20.0.0+] GetLocalKeySeedPackage
|-
|-
| 80 || [6.0.0+] [[#GetImportInitialDataAad]]
| 80 || [6.0.0+] [[#GetImportInitialDataAad]]
Line 3,148: Line 3,182:
= InitialDataVersion2 =
= InitialDataVersion2 =
This is a 0x8210-byte struct used by [[#ISaveDataTransferManagerWithDivision]].
This is a 0x8210-byte struct used by [[#ISaveDataTransferManagerWithDivision]].
= FsAccessControlRestrictionMode =
This is "nn::fs::FsAccessControlRestrictionMode".
{| class="wikitable" border="1"
|-
! Value || Name
|-
| 0 ||
|}


[[Category:Services]]
[[Category:Services]]