Changes

Jump to navigation Jump to search
7,124 bytes added ,  02:51, 8 January 2017
Line 21: Line 21:  
|-
 
|-
 
| 0x00060084
 
| 0x00060084
| ?
+
| <nowiki>(u32 Size0, u32 Size1, ((Size0<<4) | 10), Buf0, ((Size1<<4) | 10), Buf1)</nowiki> This writes the content of the input buffers into files "bossdb:/%s_CL" and "bossdb:/%s_CLK", where "%s" is generated from the programID.
 
|-
 
|-
 
| 0x00070000
 
| 0x00070000
Line 27: Line 27:  
|-
 
|-
 
| 0x00080002
 
| 0x00080002
| ?
+
| Used for sending a handle. This is used with a table of programIDs etc with a maximum of 5 entries.
 
|-
 
|-
 
| 0x00090040
 
| 0x00090040
Line 54: Line 54:  
|-
 
|-
 
| 0x00110102
 
| 0x00110102
| ?
+
| [[BOSS:GetNsDataIdList1|GetNsDataIdList1]]
 
|-
 
|-
 
| 0x00120102
 
| 0x00120102
| ?
+
| [[BOSS:GetNsDataIdList2|GetNsDataIdList2]]
 
|-
 
|-
 
| 0x00130102
 
| 0x00130102
| ?
+
| [[BOSS:GetNsDataIdList3|GetNsDataIdList3]]
 
|-
 
|-
 
| 0x00140082
 
| 0x00140082
Line 138: Line 138:  
|-
 
|-
 
| 0x002D0040
 
| 0x002D0040
| unknown...
+
| (u32 NsDataId) Writes an output u64 to cmdreply[2-3], from the content file in extdata.
 
|-
 
|-
 
| 0x002E0040
 
| 0x002E0040
| GetErrorCode
+
| [[BOSS:GetErrorCode|GetErrorCode]]
 
|-
 
|-
 
| 0x002F0140
 
| 0x002F0140
Line 159: Line 159:  
|-
 
|-
 
| 0x00340042
 
| 0x00340042
| ?
+
| [[BOSS:GetTaskProperty0|GetTaskProperty0]]
 
|-
 
|-
 
| 0x003500C2
 
| 0x003500C2
Line 165: Line 165:  
|-
 
|-
 
| 0x00360084
 
| 0x00360084
| unknown...
+
| <nowiki>(u32 TaskID_Size, u32 BufSize, ((TaskID_Size<<4) | 10), TaskID_buf, ((BufSize<<4) | 10), Buf)</nowiki> BufSize must match 0x60.
 
|-
 
|-
 
| 0x00370084
 
| 0x00370084
| ?
+
| <nowiki>(u32 TaskID_Size, u32 BufSize, ((TaskID_Size<<4) | 10), TaskID_buf, ((BufSize<<4) | 10), Buf)</nowiki> BufSize must match 0x60.
 
|}
 
|}
   Line 176: Line 176:  
!  Command Header
 
!  Command Header
 
!  Description
 
!  Description
 +
|-
 +
| 0x04010082
 +
| [[BOSSP:InitializeSessionPrivileged|InitializeSessionPrivileged]]
 
|-
 
|-
 
| 0x04040080
 
| 0x04040080
Line 196: Line 199:  
|-
 
|-
 
| 0x040D0182
 
| 0x040D0182
| unknown...
+
| [[BOSSP:GetNsDataIdListPrivileged|GetNsDataIdListPrivileged]]
 +
|-
 +
| 0x040E0182
 +
| [[BOSSP:GetNsDataIdListPrivileged1|GetNsDataIdListPrivileged1]]
 
|-
 
|-
 
| 0x04130082
 
| 0x04130082
Line 255: Line 261:     
==BOSS Service "boss:M"==
 
==BOSS Service "boss:M"==
 +
 +
==programIDs==
 +
BOSS uses programIDs raw without any handling for the New3DS programID-low bitmask. For example, attempting a NsDataId listing with the New3DS bitmask set will fail, if BOSS is only setup for that programID with the New3DS bitmask clear.
 +
 +
When [[BOSSU:InitializeSession|initializing]] BOSS with the default programID, the New3DS programID-low bitmask is always clear for New3DS titles since that's how it was originally registered with [[Filesystem_services|FS]]. Hence, the programID in the [[SpotPass|BOSS-container]] must always have the New3DS bitmask clear. This also means everything using the BOSSP commands with the raw programIDs loaded from AM title-listing are broken with New3DS titles, for example [[Extended_Banner]].
    
==Content Data Storage==
 
==Content Data Storage==
SpotPass content for each application is stored under the extdata specified by [[BOSS:SetStorageInfo]]. That command and others verify that the PID associated with the current service session has access to the specified extdata by using [[FS:CheckAuthorityToAccessExtSaveData]], returning an error on failure. This basically renders SpotPass unusable under user-processes(when initialized under those processes) which don't have access to any SD extdata(unless NAND extdata is used instead).
+
SpotPass content for each application is stored under the extdata specified by [[BOSS:SetStorageInfo]]. Certain commands verify that the PID associated with the current service session has access to the specified extdata by using [[FS:CheckAuthorityToAccessExtSaveData]], returning an error on failure. This basically renders SpotPass unusable under user-processes(when initialized under those processes) which don't have access to any SD extdata(unless NAND extdata is used instead).
 +
 
 +
All of these commands using [[FS:CheckAuthorityToAccessExtSaveData]] are: [[BOSS:SetStorageInfo]] and RegisterStorageEntry, for both BOSSU and BOSSP.
 +
 
 +
BOSS-container content is stored in the extdata registered for the programID specified in the BOSS-container, what task it's associated with / what title registered it is irrelevant with BOSS-container data storage.
 +
 
 +
==Custom SpotPass content==
 +
SpotPass supports raw content download without using the encrypted+signed SpotPass container(raw content is used by [[Home Menu]] SpotPass VersionList for example). However, this is incompatible with the data-loading method used with SpotPass-container content(NsData commands can't be used with it).
 +
 
 +
When writing the raw content, it firsts deletes and creates the "<taskID>" file under the data-storage extdata with normal extdata(not the separate boss archive). Once successful, the final filename specified by the task config will be deleted if needed, then the "<taskID>" file will be renamed to the final filename. Afterwards, the user-process can access the final file just like any other extdata file.
 +
 
 +
For using custom content with the SpotPass container(like official titles), the only known ways to do so is: "CFW" / ARM11-kernelhax with the sigchecks for this patched, or some sort of BOSS-sysmodule exploit if there's any vulns to begin with.
 +
 
 +
==HTTP upload==
 +
SpotPass tasks can be used for uploading data via HTTP POST. The exact method varies, but the main one is a [[HTTPC:SendPOSTDataRawTimeout|raw]] POST.
 +
 
 +
The content data is loaded from the following path: snprintf(outpath, outpathsize, "%s/%s%02x.up", archivepath, taskidstr_probably, unk);
 +
 
 +
The archivepath can be either "bossdb:"(BOSS-sysmodule NAND savedata) or the content-data-storage extdata. Certain other paths in the BOSS savedata can be used too.
    
==BOSS Tasks==
 
==BOSS Tasks==
The TaskID is a 8-byte buffer containing a string(normally including NUL-terminator).
+
The TaskID is a 8-byte buffer containing a string including NUL-terminator(taskIDs are compared with: strncmp(str0, str1, 7)).
    
When disabling SpotPass, applications use [[BOSSU:CancelTask]] then [[BOSSU:UnregisterTask]], to delete each task.
 
When disabling SpotPass, applications use [[BOSSU:CancelTask]] then [[BOSSU:UnregisterTask]], to delete each task.
 +
 +
Each process can only access tasks which it created, not other processes' tasks(even when using bossP with [[BOSSP:InitializeSessionPrivileged|init_programID]]=0).
 +
 +
After registration, tasks will not automatically run until they are started using one of the start-task commands.
    
==NsDataId==
 
==NsDataId==
Line 268: Line 301:     
==NsDataHeaderInfo==
 
==NsDataHeaderInfo==
 +
When the input type is not one of the below or when the specified output size doesn't match the expected size for this type, an error is returned.
 +
 +
===Type0===
 +
Total size is 0x8-bytes.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset
 +
!  Size
 +
!  Description
 +
|-
 +
| 0x0
 +
| 0x8
 +
| programID
 +
|}
 +
 +
===Type1===
 +
Total size is 0x4-bytes.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset
 +
!  Size
 +
!  Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| ?
 +
|}
 +
 +
===Type2===
 +
Total size is 0x4-bytes.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset
 +
!  Size
 +
!  Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| Content data-type, originally from the [[SpotPass|BOSS-container]].
 +
|}
 +
 
===Type3===
 
===Type3===
 
Total size is 0x4-bytes.
 
Total size is 0x4-bytes.
Line 280: Line 357:  
| 0x4
 
| 0x4
 
| Content size
 
| Content size
 +
|}
 +
 +
===Type4===
 +
Total size is 0x4-bytes.
 +
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Offset
 +
!  Size
 +
!  Description
 +
|-
 +
| 0x0
 +
| 0x4
 +
| ?
 
|}
 
|}
   Line 307: Line 398:  
| 0x0
 
| 0x0
 
| 0x8
 
| 0x8
| programID
+
| programID. Same data as Type0.
 
|-
 
|-
 
| 0x8
 
| 0x8
| 0x18
+
| 0x4
 +
| Same data as Type1.
 +
|-
 +
| 0xC
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x10
 +
| 0x4
 +
| Same data as Type3.
 +
|-
 +
| 0x14
 +
| 0xC
 
| ?
 
| ?
 
|}
 
|}
Line 323: Line 426:  
| 0x0
 
| 0x0
 
| 0x1
 
| 0x1
| Unknown. Usually 0x7D?
+
| Unknown. Example values used by official titles: 0x7D, 0xAA, ...
 
|-
 
|-
 
| 0x1
 
| 0x1
Line 339: Line 442:  
| 0x4
 
| 0x4
 
| 0x4
 
| 0x4
| Duration, ~1 = infinite. 0x1 can be used for running the task just once.
+
| Duration(?), ~0 = infinite. 0x1 can be used for running the task just once. Usually set to 0x64(100). When not set to ~0 this is decreased by 1 each time the task runs(or at least when it fails). Task processing is skipped when the current state value is already 0x0.
 
|-
 
|-
 
| 0x5
 
| 0x5
 
| 0x1
 
| 0x1
 
| Unknown. Usually 0x2?
 
| Unknown. Usually 0x2?
 +
|-
 +
| 0x6
 +
| 0x1
 +
| ?
 
|-
 
|-
 
| 0x7
 
| 0x7
 
| 0x200
 
| 0x200
 
| URL
 
| URL
 +
|-
 +
| 0x8
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x9
 +
| 0x1
 +
| ?
 +
|-
 +
| 0xA
 +
| 0x100
 +
| ?
 +
|-
 +
| 0xB
 +
| 0x200
 +
| ?
 
|-
 
|-
 
| 0xC
 
| 0xC
 
|  
 
|  
| [[BOSSU:SendPropertyHandle]] is used for this. This property is only setup for HTTP uploads?
+
| [[BOSSU:SendPropertyHandle]] is used for this. This property is only setup for HTTP uploads? This can be used with [[BOSSU:SendProperty]] too but that's not the intended use.
 
|-
 
|-
 
| 0xD
 
| 0xD
 
| 0x360
 
| 0x360
 
| Contains additional HTTP headers to send in the request, otherwise this is all-zero. This is an array of 3 entries: +0x0 size 0x20 is the header name, and +0x20 size 0x100 is the header value. Example: header-name "Content-Type" at 0x0, with header-value "application/octet-stream" at offset 0x20.
 
| Contains additional HTTP headers to send in the request, otherwise this is all-zero. This is an array of 3 entries: +0x0 size 0x20 is the header name, and +0x20 size 0x100 is the header value. Example: header-name "Content-Type" at 0x0, with header-value "application/octet-stream" at offset 0x20.
 +
|-
 +
| 0xE
 +
| 0x4
 +
| This u32 is passed directly as an u32 certID for [[HTTPC:SetClientCertDefault]](without masking to u8), even when this field is set to 0.
 +
|-
 +
| 0xF
 +
| 0xC
 +
| 3 words. Last word is unknown, normally 0(non-zero doesn't seem to affect any HTTPC commands). [[HTTPC:AddDefaultCert]] is called twice for each of the first two words which are used as certIDs(not masked to u8).
 +
|-
 +
| 0x10
 +
| 0x1
 +
| When non-zero this enables loading the client cert+privk from FS, requires the filepaths to be actually set.
 +
|-
 +
| 0x11
 +
| 0x1
 +
| When non-zero this enables loading a trusted rootCA cert DER from FS, requires the filepath to be actually set.
 +
|-
 +
| 0x12
 +
| 0x1
 +
| ?
 +
|-
 +
| 0x13
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x14
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x15
 +
| 0x40
 +
| ?
 +
|-
 +
| 0x16
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x18
 +
| 0x1
 +
| ?
 +
|-
 +
| 0x19
 +
| 0x1
 +
| ?
 +
|-
 +
| 0x1A
 +
| 0x1
 +
| ?
 +
|-
 +
| 0x1B
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x1C
 +
| 0x4
 +
| ?
 
|-
 
|-
 
| 0x35
 
| 0x35
Line 364: Line 543:  
| 0x400
 
| 0x400
 
| List of TaskIDs. [[BOSSU:GetTaskIdList]] is used before [[BOSSU:ReceiveProperty|reading]] this.
 
| List of TaskIDs. [[BOSSU:GetTaskIdList]] is used before [[BOSSU:ReceiveProperty|reading]] this.
 +
|-
 +
| 0x3B
 +
| 0x4
 +
| ?
 +
|-
 +
| 0x3E
 +
| 0x200
 +
| ?
 +
|-
 +
| 0x3F
 +
| 0x1
 +
| ?
 +
|}
 +
 +
The only valid PropertyIDs for [[BOSSU:SendProperty]] are the ones listed above, except 0x35 and 0x36. If the specified size for the command is larger than the property size, it will use the actual property size instead. When the specified size is less than the actual property size, all of the property data that won't be written to is cleared.
 +
 +
==TaskStatus==
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Value
 +
!  Description
 +
|-
 +
| 0x0
 +
| Last task run was successful?
 +
|-
 +
| 0x2
 +
| Task started.
 +
|-
 +
| 0x5
 +
| Task not started(also the initial state immediately after task creation).
 +
|-
 +
| 0x6
 +
| Unknown
 +
|-
 +
| 0x7
 +
| Task processing failed(such as network error).
 +
|}
 +
 +
This u8 is returned by [[BOSSU:GetTaskState]].
 +
 +
==Errors==
 +
{| class="wikitable" border="1"
 +
|-
 +
!  Error-code
 +
!  Description
 +
|-
 +
| 0xC8A0F833
 +
| taskID not found.
 +
|-
 +
| 0xC8A0F836
 +
| taskID already exists, for task creation.
 +
|-
 +
| 0xC8A0F842
 +
| The specified programID is not setup for BOSS.
 +
|-
 +
| 0xC8A0F843
 +
| The specified NsDataId was not found.
 
|}
 
|}

Navigation menu