DosSetVerify

Sets write verification.

Syntax
DosSetVerify (fVerifySetting)

Parameters

 * fVerifySetting (BOOL32) - input: The state of verify mode.
 * Possible values are shown in the list below:
 * FALSE Verify mode is not active.
 * TRUE Verify mode is active.

Return Code

 * ulrc (APIRET) - returns:DosSetVerify returns one of the following values:
 * 0 NO_ERROR
 * 118 ERROR_INVALID_VERIFY_SWITCH

Remarks
When verify mode is active, the operating system verifies that data written to the disk is recorded correctly, even though disk recording errors are rare.

Example Code
This example enables disk write verification. It creates a file named "VERIFY.DAT" and writes the critical data to it. After this is done, it restores the original settings. 
 * 1) define INCL_DOSFILEMGR         /* File Manager values */
 * 2) define INCL_DOSERRORS          /* DOS Error values    */
 * 3) include 
 * 4) include 
 * 5) include 

int main(VOID) { UCHAR uchFileName[20]  = "VERIFY.DAT",     /* Name of file to use      */ uchFileData[10] = "SampleData";     /* Stuff to put in file     */ HFILE hfFileHandle   = 0L;                 /* Handle for user file     */ BOOL32 fUserVerify   = 0;                  /* User Verify flag setting */ ULONG ulAction       = 0,                  /* Action done by DosOpen   */ ulWritten     = 0;                  /* Number of bytes written  */ APIRET rc            = NO_ERROR;           /* Return code              */

rc = DosQueryVerify(&fUserVerify);    /* Get current setting of VERIFY */ if (rc != NO_ERROR) { printf("DosQueryVerify error: return code = %u\n", rc); return 1; } else { printf ("Original setting of Verify=%s\n",(fUserVerify) ? "On" : "Off"); } /* endif */

rc = DosSetVerify(1);                 /* Set VERIFY=ON                 */ if (rc != NO_ERROR) { printf("DosSetVerify error: return code = %u\n", rc); return 1; }

/* Open the file VERIFY.DAT for read/write. Create it if necessary */

rc = DosOpen(uchFileName, &hfFileHandle, &ulAction,               10L, FILE_NORMAL,                OPEN_ACTION_CREATE_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,                OPEN_SHARE_DENYNONE  | OPEN_ACCESS_READWRITE, 0L);

if (rc != NO_ERROR) { printf("DosOpen error: return code = %u\n", rc); return 1; }

/* Write critical data to the file */

rc = DosWrite (hfFileHandle, (PVOID) uchFileData,                 sizeof(uchFileData), &ulWritten); if (rc == NO_ERROR) { printf ("%u bytes written to file %s with Verify=On\n",              ulWritten,uchFileName); }

rc = DosSetVerify(fUserVerify);        /* Restore user's verify value */ if (rc != NO_ERROR) { printf("DosSetVerify error: return code = %u\n", rc); return 1; }  rc = DosClose(hfFileHandle);            /* Close the file              */

return NO_ERROR; } 

Related Functions

 * DosQueryVerify