次の方法で共有


FormatStore (Compact 2013)

3/26/2014

This function performs the equivalent of a clean format of the storage volume, which removes all partition information in the store.

Syntax

BOOL WINAPI FormatStore(
  HANDLE hStore
);

Parameters

  • hStore
    [in] Handle to the store returned by the OpenStore function.

Return Value

Returns TRUE if successful; otherwise, returns FALSE. To retrieve extended error information, call GetLastError.

If the device has a volume boot record in sector zero, GetLastError will return ERROR_NOT_SUPPORTED.

Remarks

This function writes a new master boot record to sector zero of the storage device, which deletes all existing partitions.

This function does not write a file system format. To write a file system format, such as FATFS, call FormatVolume.

Note

Removable media that was formatted on a personal computer is unpartitioned; that is, it has a volume boot record in sector zero. To keep removable media compatible with a personal computer, this function will not overwrite a volume boot record. You can use FormatPartition to write a new volume boot record on removable media.

Important

If you intend to format a storage device, you need to add a registry key that specifies the type of partition that needs to be added for each storage profile. If the registry key is missing, the storage device may not be formatted correctly and will fail to mount on a subsequent reboot.
For example, to set the partition type of a USBHDProfile storage profile to use hybrid partitions that consist of both primary and extended types, add the following:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\USBHDProfile\MSPART]
"HybridPart"=dword:1

To set the partition type of a USBHDProfile storage profile so that all partitions are the primary partition type, add the following:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\USBHDProfile\MSPART]
"PrimaryPart"=dword:1

Requirements

Header

storemgr.h

Library

storeapi.lib

See Also

Reference

Storage Manager Functions
OpenStore