IVssBackupComponents::DisableWriterClasses method

The DisableWriterClasses method prevents a specific class of writers from receiving any events.


HRESULT DisableWriterClasses(
  [inconst VSS_ID *rgWriterClassId,
  [in]       UINT   cClassId


rgWriterClassId [in]

An array containing one or more writer class identifiers.

cClassId [in]

The number of entries in the rgWriterClassId array.

Return value

The following are the valid return codes for this method.


The writer class has been successfully disabled.


The caller does not have sufficient backup privileges or is not an administrator.


The caller is out of memory or other system resources.


The backup components object is not initialized, this method has been called during a restore operation, or this method has not been called within the correct sequence.


Unexpected error. The error code is logged in the error log file. For more information, see Event and Error Handling Under VSS.

Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP:  This value is not supported until Windows Server 2008 R2 and Windows 7. E_UNEXPECTED is used instead.



If you have multiple running copies of the same writer, they will all have the same writer class identifier, but they will have different writer instance identifiers. Disabling a writer class causes all of the writer's instances to be disabled.

If the DisableWriterClasses method and the IVssBackupComponents::EnableWriterClasses method are never called, all writer classes are enabled.

After the first call to DisableWriterClasses returns, the writer classes that were specified in the rgWriterClassId array are disabled, and all other writer classes are enabled.

If you call DisableWriterClasses more than once, each call adds the writers in the rgWriterClassId array to the list of disabled writers.

If you call DisableWriterClasses one or more times and then call EnableWriterClasses, the first call to EnableWriterClasses cancels the effect of the calls to DisableWriterClasses and enables only the writers in the rgWriterClassId array.

If you call DisableWriterClasses, you must do so before calling the IVssBackupComponents::GatherWriterMetadata method. If you call GatherWriterMetadata first and then call DisableWriterClasses, the call to DisableWriterClasses has no effect. If you need to call GatherWriterMetadata first, to determine which writer classes to disable, you must call it from a different instance of the IVssBackupComponents interface.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]


VsBackup.h (include VsBackup.h, Vss.h, or VsWriter.h)



See also