53 WCHAR wszDriveLetter[6], wszSystemDrv[6];
55 wszDriveLetter[0] = pContext->
Drive +
L'A';
61 if (!
_wcsicmp(wszDriveLetter, wszSystemDrv))
75 if (TotalNumberOfBytes->
QuadPart <= (16 * 1024 * 1024))
77 else if (TotalNumberOfBytes->
QuadPart <= (32 * 1024 * 1024))
79 else if (TotalNumberOfBytes->
QuadPart <= (64 * 1024 * 1024))
81 else if (TotalNumberOfBytes->
QuadPart <= (128 * 1024 * 1024))
83 else if (TotalNumberOfBytes->
QuadPart <= (256 * 1024 * 1024))
85 else if (TotalNumberOfBytes->
QuadPart <= (512 * 1024 * 1024))
87 else if (TotalNumberOfBytes->
QuadPart <= (1024 * 1024 * 1024))
89 else if (TotalNumberOfBytes->
QuadPart <= (2048LL * 1024LL * 1024LL))
91 else if (TotalNumberOfBytes->
QuadPart <= (4096LL * 1024LL * 1024LL))
98 if (TotalNumberOfBytes->
QuadPart <= (64 * 1024 * 1024))
100 else if (TotalNumberOfBytes->
QuadPart <= (128 * 1024 * 1024))
102 else if (TotalNumberOfBytes->
QuadPart <= (256 * 1024 * 1024))
104 else if (TotalNumberOfBytes->
QuadPart <= (8192LL * 1024LL * 1024LL))
106 else if (TotalNumberOfBytes->
QuadPart <= (16384LL * 1024LL * 1024LL))
108 else if (TotalNumberOfBytes->
QuadPart <= (32768LL * 1024LL * 1024LL))
115 if (TotalNumberOfBytes->
QuadPart <= (16 * 1024 * 1024))
117 else if (TotalNumberOfBytes->
QuadPart <= (32 * 1024 * 1024))
119 else if (TotalNumberOfBytes->
QuadPart <= (64 * 1024 * 1024))
121 else if (TotalNumberOfBytes->
QuadPart <= (128 * 1024 * 1024))
123 else if (TotalNumberOfBytes->
QuadPart <= (256 * 1024 * 1024))
125 else if (TotalNumberOfBytes->
QuadPart <= (8192LL * 1024LL * 1024LL))
127 else if (TotalNumberOfBytes->
QuadPart <= (16384LL * 1024LL * 1024LL))
129 else if (TotalNumberOfBytes->
QuadPart <= (32768LL * 1024LL * 1024LL))
136 if (TotalNumberOfBytes->
QuadPart <= (512 * 1024 * 1024))
138 else if (TotalNumberOfBytes->
QuadPart <= (1024 * 1024 * 1024))
140 else if (TotalNumberOfBytes->
QuadPart <= (2048LL * 1024LL * 1024LL))
182 CComPtr<IDataObject> pDataObj;
187 CComObject<CDrvDefExt> *pDrvDefExt =
NULL;
189 CDataObjectHIDA cida(pDataObj);
195 if (
SUCCEEDED(DataObject_GetOffset(pDataObj, &
pt)))
198 rcPosition.
top =
pt.y;
206 ERR(
"StubWindow32 creation failed\n");
217 HRESULT hr = CComObject<CDrvDefExt>::CreateInstance(&pDrvDefExt);
220 pDrvDefExt->AddRef();
226 ERR(
"AddPages failed\n");
230 ERR(
"Initialize failed\n");
243 pDrvDefExt->Release();
245 stub.DestroyWindow();
264 pData->pwszDrive = pwszDrive;
274 pData->pStream->Release();
284 WCHAR wszBuf[100] = {0};
285 WCHAR wszDefaultSize[100] = {0};
287 WCHAR szDrive[] =
L"C:\\";
302 szDrive[0] = pContext->
Drive +
L'A';
310 pwszFsSizeLimit =
L"4GB";
314 pwszFsSizeLimit =
L"32GB";
318 pwszFsSizeLimit =
L"1GB/32GB";
322 pwszFsSizeLimit =
L"256TB";
326 pwszFsSizeLimit =
L"32TB";
330 pwszFsSizeLimit =
L"16EB";
343 TRACE(
"%S is not supported on drive larger than %S, current size: %lu\n", wszBuf, pwszFsSizeLimit, TotalNumberOfBytes.
QuadPart);
361 for (lIndex = 0; lIndex < 4; lIndex++)
390 FIXME(
"Unknown filesystem: %ls\n", wszBuf);
400 WCHAR szDrive[] =
L"C:\\";
404 DWORD dwIndex, dwDefault;
405 UCHAR uMinor, uMajor;
407 HWND hwndFileSystems;
413 szDrive[0] = pContext->
Drive +
L'A';
466 ERR(
"no filesystem providers\n");
490 Progress = (
PDWORD)ActionInfo;
505 FIXME(
"Unsupported command in FormatExCB\n");
518 WCHAR szDrive[4] = {
L'C',
':',
'\\', 0 };
519 WCHAR szFileSys[40] = {0};
520 WCHAR szLabel[40] = {0};
530 szDrive[0] = pContext->
Drive +
L'A';
537 ERR(
"Unable to get file system selection\n");
543 ERR(
"Unable to get file system selection\n");
549 szFileSys[
_countof(szFileSys)-1] =
L'\0';
556 ERR(
"Unable to get volume label\n");
560 szLabel[(
sizeof(szLabel)/
sizeof(
WCHAR))-1] =
L'\0';
763 TRACE(
"SHFormatDrive(): The provided drive for format is a system volume! Aborting...\n");
#define shell32_hInstance
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void shell(int argc, const char *argv[])
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
#define GetEnvironmentVariableW(x, y, z)
BOOLEAN NTAPI QueryAvailableFileSystemFormat(IN DWORD Index, IN OUT PWCHAR FileSystem, OUT UCHAR *Major, OUT UCHAR *Minor, OUT BOOLEAN *LatestVersion)
#define FAILED_UNEXPECTEDLY(hr)
BOOL WINAPI GetDiskFreeSpaceExW(IN LPCWSTR lpDirectoryName OPTIONAL, OUT PULARGE_INTEGER lpFreeBytesAvailableToCaller, OUT PULARGE_INTEGER lpTotalNumberOfBytes, OUT PULARGE_INTEGER lpTotalNumberOfFreeBytes)
UINT WINAPI GetDriveTypeW(IN LPCWSTR lpRootPathName)
BOOL WINAPI GetVolumeInformationW(IN LPCWSTR lpRootPathName, IN LPWSTR lpVolumeNameBuffer, IN DWORD nVolumeNameSize, OUT LPDWORD lpVolumeSerialNumber OPTIONAL, OUT LPDWORD lpMaximumComponentLength OPTIONAL, OUT LPDWORD lpFileSystemFlags OPTIONAL, OUT LPWSTR lpFileSystemNameBuffer OPTIONAL, IN DWORD nFileSystemNameSize)
HRESULT WINAPI CoMarshalInterThreadInterfaceInStream(REFIID riid, LPUNKNOWN pUnk, LPSTREAM *ppStm)
HRESULT WINAPI CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid, LPVOID *ppv)
BOOL CALLBACK AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
void WINAPI SHFree(LPVOID pv)
LPVOID WINAPI SHAlloc(SIZE_T len)
HRESULT WINAPI SHStrDupW(LPCWSTR src, LPWSTR *dest)
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
static HWND FormatDrvDialog
EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj)
struct FORMAT_DRIVE_CONTEXT * PFORMAT_DRIVE_CONTEXT
static BOOLEAN NTAPI FormatExCB(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
BOOL SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject *pDataObj)
HPROPSHEETPAGE SH_CreatePropertySheetPage(LPCSTR resname, DLGPROC dlgproc, LPARAM lParam, LPWSTR szTitle)
static DWORD WINAPI ShowDrivePropThreadProc(LPVOID pParam)
static INT_PTR CALLBACK FormatDriveDlg(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static BOOL GetDefaultClusterSize(LPWSTR szFs, PDWORD pClusterSize, PULARGE_INTEGER TotalNumberOfBytes)
VOID FormatDrive(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
struct _DRIVE_PROP_PAGE DRIVE_PROP_PAGE
static BOOL IsSystemDrive(PFORMAT_DRIVE_CONTEXT pContext)
static VOID InitializeFormatDriveDlg(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
DWORD WINAPI SHFormatDrive(HWND hwnd, UINT drive, UINT fmtID, UINT options)
static unsigned __stdcall DoFormatDrive(void *args)
static VOID InsertDefaultClusterSizeForFs(HWND hwndDlg, PFORMAT_DRIVE_CONTEXT pContext)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
TCHAR szTitle[MAX_LOADSTRING]
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
struct _PSP * HPROPSHEETPAGE
_In_ ULONG _In_ ULONG _In_ ULONG Length
const GUID IID_IDataObject
BOOL(CALLBACK * LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM)
struct _PROPSHEETHEADERW PROPSHEETHEADERW
_CRTIMP uintptr_t __cdecl _beginthreadex(_In_opt_ void *_Security, _In_ unsigned _StackSize, _In_ unsigned(__stdcall *_StartAddress)(void *), _In_opt_ void *_ArgList, _In_ unsigned _InitFlag, _Out_opt_ unsigned *_ThrdAddr)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
#define MAX_PROPERTY_SHEET_PAGE
#define IDS_FORMAT_COMPLETE
#define IDS_NO_FORMAT_TITLE
#define IDS_FORMAT_WARNING
#define IDS_DEFAULT_CLUSTER_SIZE
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
#define DRIVE_NO_ROOT_DIR
#define HKEY_CLASSES_ROOT
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HMENU WINAPI GetSystemMenu(_In_ HWND, _In_ BOOL)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetWindowTextW(_In_ HWND, _In_opt_ LPCWSTR)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HWND WINAPI GetWindow(_In_ HWND, _In_ UINT)
#define MB_ICONINFORMATION
#define MAKEINTRESOURCEW(i)
BOOL WINAPI EnableMenuItem(_In_ HMENU, _In_ UINT, _In_ UINT)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define IID_PPV_ARG(Itype, ppType)