<div class="content"><p>The BackupWithPasswd method backs up the <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_086b13f2-2715-4000-a16c-6acc3d59cc19" data-linktype="relative-path">metabase</a> using a supplied
password to encrypt all secure data.</p><dl>
<dd>
<div><pre> HRESULT BackupWithPasswd(
   [unique, in, string] LPCWSTR pszMDBackupName,
   [in] DWORD dwMDVersion,
   [in] DWORD dwMDFlags,
   [unique, in, string] LPCWSTR pszPasswd
 );
</pre></div>
</dd></dl><p><b>pszMDBackupName: </b>The name of the backup that
is being created.</p><p><b>dwMDVersion: </b>An integer value specifying
either the specific version number to be used for the backup or one of the
following flag values. If the version number is an explicit version number, it
SHOULD be less than MD_BACKUP_MAX_VERSION (9999).</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th>
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>MD_BACKUP_HIGHEST_VERSION</p>
  <p>0xFFFFFFFE</p>
  </td>
  <td>
  <p>Use the highest existing backup version for the backup
  name specified.</p>
  </td>
 </tr><tr>
  <td>
  <p>MD_BACKUP_NEXT_VERSION</p>
  <p>0xFFFFFFFF</p>
  </td>
  <td>
  <p>Use the highest existing backup version number plus
  one for the backup name specified.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>dwMDFlags: </b>An integer value containing the bit
flags to alter backup functionality. The flags can be zero or one or more of
the following values.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Value</p>
   </th>
   <th colspan="2">
   <p>Meaning</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>MD_BACKUP_FORCE_BACKUP</p>
  <p>0x00000004</p>
  </td>
  <td>
  <p>Force the backup even if the <a href="11d7ab23-ecd4-4764-8aa8-765564e8501d" data-linktype="relative-path">SaveData</a> operation
  specified by MD_BACKUP_SAVE_FIRST fails.</p>
  <p>This flag is only specified if MD_BACKUP_SAVE_FIRST is
  specified.</p>
  </td>
  <td><p> </p></td>
 </tr><tr>
  <td>
  <p>MD_BACKUP_OVERWRITE</p>
  <p>0x00000001</p>
  </td>
  <td colspan="2">
  <p>Back up even if a backup of the same name and version
  exists in the specified backup location, overwriting it if necessary.</p>
  </td>
 </tr><tr>
  <td>
  <p>MD_BACKUP_SAVE_FIRST</p>
  <p>0x00000002</p>
  </td>
  <td colspan="2">
  <p>Perform a SaveData operation before the backup.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>pszPasswd: </b>A password string used to encrypt
the secure properties in the metabase backup. If a password is not supplied,
this method functions exactly the same as the <a href="94e71123-2b82-4d36-ad7c-a1fa030d9e52" data-linktype="relative-path">Backup</a> method.</p><p><b>Return Values: </b>A signed 32-bit value that
indicates return status. If the method returns a negative value, it failed. If
the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a
Win32 error code in the lower 16 bits. Zero or positive values indicate
success, with the lower 16 bits in positive nonzero values containing warnings
or flags defined in the method implementation. For more information about Win32
error codes and <a href="../ms-dtyp/a9046ed2-bfb2-4d56-a719-2824afce59ac" data-linktype="relative-path">HRESULT</a>
values, see <a href="../ms-erref/1bc92ddf-b79e-413c-bbaa-99a5281a6c90" data-linktype="relative-path">[MS-ERREF]</a>.</p><dl>
<dd>
<table><thead>
  <tr>
   <th>
   <p>Return value/code</p>
   </th>
   <th>
   <p>Description</p>
   </th>
  </tr>
 </thead><tbody><tr>
  <td>
  <p>0x00000000</p>
  <p>S_OK</p>
  </td>
  <td>
  <p>The call was successful.</p>
  </td>
 </tr><tr>
  <td>
  <p>0x80070057</p>
  <p>E_INVALIDARG</p>
  </td>
  <td>
  <p>One or more arguments are invalid.</p>
  </td>
 </tr></tbody></table>
</dd></dl><p><b>Exceptions Thrown:</b> No exceptions are thrown
beyond those thrown by the underlying <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_8a7f6700-8311-45bc-af10-82e10accd331" data-linktype="relative-path">RPC</a> protocol <a href="../ms-rpce/290c38b1-92fe-4229-91e6-4fc376610c15" data-linktype="relative-path">[MS-RPCE]</a>.</p><p>The <a href="1243ba70-74ca-44f9-be0b-dfd6697010b4#gt_e127848e-c66d-427d-b3aa-9f904fa4ada7" data-linktype="relative-path">opnum</a>
field value for this method is 34.</p><p>When processing this call, the server MUST do the following:</p><ul><li><p><span><span> 
</span></span>Check the <i>pszMDBackupName</i> parameter. If the length of the
string is 100 characters or more, or if it contains any characters in the
following set (&#39;/&#39;, &#39;\&#39;, &#39;*&#39;, &#39;.&#39;, &#39;?&#39;, &#39;&#34;&#39;, &#39;&amp;&#39;, &#39;!&#39;, &#39;@&#39;, &#39;#&#39;, &#39;$&#39;,
&#39;%&#39;, &#39;^&#39;, &#39;(&#39;, &#39;)&#39;, &#39;=&#39;, &#39;+&#39;, &#39;|&#39;, &#39;`&#39;, &#39;~&#39;), return E_INVALIDARG.</p>
</li><li><p><span><span> 
</span></span>Check the version parameter. If it is greater than the maximum
allowed version number and is not MD_BACKUP_HIGHEST_VERSION or
MD_BACKUP_NEXT_VERSION, return E_INVALIDARG.</p>
</li><li><p><span><span> 
</span></span>If the parameter flags have the MD_BACKUP_SAVE_FIRST bit set,
flush the in-memory configuration data first. If this operation fails, check
the MD_BACKUP_FORCE_BACKUP bit. If this bit is reset, return an error,
otherwise continue the operation.</p>
</li><li><p><span><span> 
</span></span>Check the MD_BACKUP_OVERWRITE bit. If it is reset, check whether
a backup with the target version exists. If it is true, return an error;
otherwise, overwrite the existing backup.</p>
</li><li><p><span><span> 
</span></span>If the <i>pszMDBackupName</i> parameter is an empty string, the
server uses a default name for the backup.</p>
</li><li><p><span><span> 
</span></span>The server saves the persisted data using the backup location and
version number as a key so that the data can be restored later.</p>
</li><li><p><span><span> 
</span></span>Any encrypted data MUST be stored encrypted with the password the
client has provided. If no password is provided, the function behaves exactly
as the Backup method.</p>
</li></ul></div>