Specifying files and registry entries in a package project file
Because files and registry entries are a key component of each object in a package, it is important to understand how files and registry entries are specified in package project files.
Files
To include a file, use the File element, which is a child of the Files element. The following XML example shows the schema definition of the File element.
<xs:complexType name="fileType">
<xs:attribute name="Name" type="xs:string" use="optional"/>
<xs:attribute name="Source" type="xs:string" use="required"/>
<xs:attribute name="DestinationDir" type="DevicePathType" use="optional"/>
<xs:attribute name="Attributes" type="attributesType" use="optional" />
<xs:attribute name="EmbeddedSigningCategory" type="xs:string" use="optional" />
</xs:complexType>
This element has the following attributes.
Attribute | Definition |
---|---|
Source |
Required. Specifies the source path of the file to be included in to the package. This path can be an absolute or relative path. It is also valid to use macro references within the path.
Note
The file must exist, or package generation will fail. |
DestinationDir |
Optional. Specifies the destination folder on the device for the specified file. This path must start with a globally defined macro for a folder. If this attribute is not specified, the default location depends on the owned object. |
Name |
Optional. Specifies the name for this file on the device. If a name is not specified, the file name in the source path is used. |
Attributes |
Optional. Specifies the file system attributes for this file on the device. This value can be a combination of the following separated by a space character
When not specified, a predefined default value is used.
Note
Although the above attributes can be specified, the file system might not support all of them. |
EmbeddedSigningCategory |
Optional. Specifies the type of code signing that should be used for the file during package generation. The string that is provided for EmbeddedSigningCategory is passed unchanged to the sign.cmd tool that is used in package generation. For info on the available signing options for sign.cmd, see Sign binaries and packages. For example, to specify that HAL binaries should be signed using the –oem and –hal option, add the EmbeddedSigningCategory attribute as shown.
For general information about code signing, see Code signing. |
Registry keys and values
InWindows 10 Mobile, registry keys are instead specified in the package project XML file by using the RegKey element.
The RegKey element has only one required attribute, KeyName, which is the full path of the registry key. KeyName must start with a globally defined macro, but it does not require the trailing slash at the end of the key name.
Under the RegKey element can be zero or more RegValue elements. Each of these elements represents a value under the registry key. The RegValue element has the following attributes.
Note
The MUI_SZ registry key type has been replaced with the REG_SZ or REG_EXPAND_SZ type. Developers should use either of these and change the code to use the RegLoadMUIString function to do the same. The format of the value is "@[path]\dllname,-strID" and an example would be "@%SystemRoot%\System32\msxml3r.dll,-2". This change occurred because the Windows kernel does not support a MUI_SZ type.
Attribute | Definition |
---|---|
Name |
Required. String that specifies the name of the value. The symbol “@” can be used to specify the default value. Additionally, macros can be used in the attribute value. |
Value |
Required. String that represents the value of the key. This attribute is dependent on the value type. |
Type |
Required. The type of the value. The following list shows the possible type values and the required format for the paired Value attribute.
Type valueDefinitionValue attribute
REG_SZ
A plain text string.
“test value”
Note
A NULL terminator character is appended to the end of this string automatically. If for some reason you don’t want the null terminator, you must use REG_HEX with a raw hex dump.
REG_MULTI_SZMultiple text strings separated by ‘;’. *See note.“value1;value2;value3”
REG_DWORD32-bit number represented in hex format, with no “0x” prefix.“1234ABCD”
REG_QWORD64-bit number in hex format, with no “0x” prefix.“1234ABCD1234ABCD”
REG_BINARYByte array in hex format, separated by ‘,’, with no “0x” prefix.“1A,2B,3D”
REG_EXPAND_SZSame as REG_SZ.
REG_HEXA byte array (same as REG_BINARY) with a type prefix in the form of “hex(x):” where x is the hex number for the type.“hex(7):1A,2B,3D”
Note
* Given that the ‘;’ character is the delimiter for REG_MULTI_SZ, the ‘;’ character cannot be used inside the string because it would be parsed as the separator of two strings. A workaround for this is to use the REG_HEX type instead and specify the string with the hex dump, e.g.: “hex(7):<exact hex dump of the string>”. |
File and registry key groups, language/resolution expansion, and CPU filtering
For most objects, File and RegKey elements cannot be directly specified. Instead, they must be grouped under the Files and RegKeys elements. A Files or RegKeys element must have at least one File or RegKey element, respectively.
Both Files and RegKeys have some special attributes used for language/resolution expansion and CPU filtering.
Attribute | Definition |
---|---|
CpuFilter |
Optional. Restricts the elements (File or RegKey) to a specific CPU architecture. Currently this attribute supports the following two values:
The attribute is case sensitive and values must be specified in uppercase letters.
Note
This attribute can be used along with the Language or Resolution attribute. |
Language |
Optional. Indicates to the package generator that the contents under this group are language specific and must be distributed to the corresponding language package. This attribute can be specified with the following values:
Note
This attribute can be used along with the CpuFilter, but it cannot be used at the same time as Resolution. |
Resolution |
Optional. This attribute is similar in usage to the Language attribute, with the exception that it requires the use of a resolution identifier instead of a language identifier. A resolution identifier is in the form of “<width>x<height>”, for example “320x240”. A built-in macro $(RESID) is available for the use of all child elements.
Note
This attribute can be used along with the CpuFilter, but it cannot be used at the same time as Language. |