Rufus code might be of interest when it comes to format/chkdsk.
See format.c .
About chkdsk, it may be that we dont call the same parameters (compared to windows).
typedef VOID (__stdcall *PCHKDSK)( PWCHAR DriveRoot,
PWCHAR Format,
BOOL CorrectErrors,
BOOL Verbose,
BOOL CheckOnlyIfDirty,
BOOL ScanDrive,
PVOID Unused2,
PVOID Unused3,
PFMIFSCALLBACK Callback );
edit : side note, have you tried the x32 and the x64 version of clonedisk on your x64 os? do they have the same behavior?
OK, here's some results - 64 bit Clone Disk (by the way the Outlook-style right-navigation pane is curiously buggy in the x64 build only [highlights for buttons are off-rectangle, in addition to the control looking almost completely different from its 32-bit version]; it works fine in the 32 bit build):
Starting Check Disk for C:
C:\ Volume Label: Spectrum SSD, File System: NTFS
Volume label is Spectrum SSD.
Stage 1: Examining basic file system structure ...
1633280 file records processed.
File verification completed.
40217 large file records processed.
0 bad file records processed.
Stage 2: Examining file name linkage ...
1940140 index entries processed.
Index verification completed.
Stage 3: Examining security descriptors ...
Security descriptor verification completed.
153431 data files processed.
CHKDSK is verifying Usn Journal...
39998368 USN bytes processed.
Usn Journal verification completed.
The master file table's (MFT) BITMAP attribute is incorrect.
The Volume Bitmap is incorrect.
Windows has checked the file system and found problems.
Please run chkdsk /scan to find the problems and queue them for repair.
249708543 KB total disk space.
226421912 KB in 1419544 files.
2770328 KB in 153432 indexes.
Check Disk Callback: 26
1750923 KB in use by the system.
65536 KB occupied by the log file.
18765380 KB available on disk.
4096 bytes in each allocation unit.
62427135 total allocation units on disk.
4691345 allocation units available on disk.
Check Disk: Finished OK
!!! Check Disk Found Problems with C:
Here's the 32 bit CloneDisk result:
Starting Check Disk for C:
C:\ Volume Label: Spectrum SSD, File System: NTFS
Volume label is Spectrum SSD.
Stage 1: Examining basic file system structure ...
1633280 file records processed.
File verification completed.
40217 large file records processed.
0 bad file records processed.
Stage 2: Examining file name linkage ...
Index entry ~backup.pst.tmp in index $I30 of file 88699 is incorrect.
Index entry ~BACKU~1.TMP in index $I30 of file 88699 is incorrect.
Index entry 7742MBXS.txt in index $I30 of file 88946 is incorrect.
1940142 index entries processed.
Index verification completed.
Errors found. CHKDSK cannot continue in read-only mode.
Check Disk Callback: 32
Check Disk: Unable to Finish
!!! Check Disk Found Problems with C:
With both tests, scan drive and correct errors are un-checked.
Here's the 64-bit Magenta demo app result: [non-verbose mode, no drive surface scan, no error correction]
Starting Check Disk for C:
C:\ Volume Label: Spectrum SSD, File System: NTFS
Volume label is Spectrum SSD.
Stage 1: Examining basic file system structure ...
Attribute record (128, "") from file record segment 1134134
is corrupt.
1633280 file records processed.
File verification completed.
40217 large file records processed.
Errors found. CHKDSK cannot continue in read-only mode.
Check Disk Callback: 32
Check Disk: Unable to Finish
!!! Check Disk Found Problems with C:
And, 32 bit Magenta output:
Starting Check Disk for C:
C:\ Volume Label: Spectrum SSD, File System: NTFS
Volume label is Spectrum SSD.
Stage 1: Examining basic file system structure ...
1633280 file records processed.
File verification completed.
40217 large file records processed.
0 bad file records processed.
Stage 2: Examining file name linkage ...
Index entry ~backup.pst.tmp in index $I30 of file 88699 is incorrect.
Index entry ~BACKU~1.TMP in index $I30 of file 88699 is incorrect.
Index entry L1ISLAF4.txt in index $I30 of file 88946 is incorrect.
Index entry 969252ce11249fdd.customDestinations-ms in index $I30 of file 95233 is incorrect.
Index entry 969252~1.CUS in index $I30 of file 95233 is incorrect.
Index entry recovery.bak in index $I30 of file 95282 is incorrect.
Index entry recovery.js in index $I30 of file 95282 is incorrect.
1940142 index entries processed.
Index verification completed.
Errors found. CHKDSK cannot continue in read-only mode.
Check Disk Callback: 32
Check Disk: Unable to Finish
!!! Check Disk Found Problems with C:
In my own testing cases, I also use the non-verbose mode, and no surface scan, and no error correction. So I am at a loss to understand what the issue(s) might be. Some points for consideration?
1) Are you using a separate thread for the operation? Callbacks happening on the main VCL thread may be problematic.
2) Maybe one needs to manually invoke VSS to create a volume snapshot before scanning - to ensure changes made to disk in the interim do not result in false positive errors?
3) Last but not least, the ChkDskEx API, which fails spectacularly if called with the same parameters, may already be creating a volume snapshot and/or accounting for whatever is changed in Windows 8.x. Does anyone have any information or details on what is changed in this API so we can call it properly?
Thoughts?