Share via


ISpObjectToken::RemoveStorageFileName (Windows Embedded CE 6.0)

1/6/2010

This method removes the object token file name.

Syntax

HRESULT RemoveStorageFileName(
  REFCLSID clsidCaller,
  const WCHAR* pszKeyName,
  BOOL fDeleteFile
);

Parameters

  • clsidCaller
    [in] GUID of the calling object.
  • pszKeyName
    [in] Pointer to a null-terminated string specifying the registry key name.
  • fDeleteFile
    [in] Value specifying if the method should delete the file. Set this value to TRUE to delete the file, and to FALSE otherwise.

Return Value

The following table shows the possible return values.

Value Description

S_OK

Function completed successfully.

E_INVALIDARG

pszKeyName is invalid or bad.

SPERR_UNINITIALIZED

Either the data key or token delegate interface is not initialized.

SPERR_TOKEN_DELETED

Key has been deleted.

FAILED(hr)

Appropriate error message.

Example

The following code snippet creates a test file, removes it, and manually deletes it. It may also be deleted automatically by setting fDeleteFile to TRUE.

HRESULT hr;
GUID guid0;
CComPtr cpSpObjectToken;
CComPtr cpSpObjectWithToken;
CSpCoTaskMemPtr cpFileName;
hr = SpGetDefaultTokenFromCategoryId(SPCAT_VOICES, &cpSpObjectToken);
//Check return value
ZeroStruct(guid0);
// Create subkeys and value item to be deleted
hr = cpSpObjectToken->GetStorageFileName(
guid0, L"test file", NULL, CSIDL_FLAG_CREATE|CSIDL_APPDATA, &cpFileName
);
if (SUCCEEDED(hr))
{
  hr = cpSpObjectToken->RemoveStorageFileName(guid0, L"test file", false);
  //Check return value
  cpFileName.Clear();
}

Requirements

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpObjectToken
SAPI Interfaces