SetLogFileSizeWithPolicy function

Adds or deletes containers from a log based on the state of the installed policies.

Syntax

CLFSUSER_API BOOL SetLogFileSizeWithPolicy(
  IN HANDLE      hLog,
  IN PULONGLONG  pDesiredSize,
  OUT PULONGLONG pResultingSize
);

Parameters

hLog

A handle to a log.

pDesiredSize

A pointer to a value that specifies the requested log size, expressed as one of the following values. For the actual resultant size, refer to the pResultingSize parameter.

Value Meaning
0
Enforce the minimum size policy.

If a minimum size policy is not installed, one of the following occurs:

  • If the log has fewer than two containers, the log will be expanded to a size of two containers.
  • If the log has two or more containers, no changes are made and the function call succeeds.

If a minimum size policy is installed, one of the following occurs:

  • If the log has fewer than the minimum number of containers specified by the minimum size policy, the log expands to the policy-specified minimum number of containers.
  • If the log has a number of containers greater than or equal to the minimum number of containers specified by the minimum size policy, no changes are made and the function call succeeds with no error.

For more information, see InstallLogPolicy.

1
Not a valid value; the function call fails with ERROR_INVALID_PARAMETER.
2–1023
The desired size of the log, expressed as the number of containers.

If this number is smaller than the minimum number of containers specified by the installed policy, the function call fails with ERROR_COULD_NOT_RESIZE_LOG.

If this number is larger than the maximum number of containers specified by the installed policy, the log expands only as far as the policy-specified maximum number of containers, and the function succeeds with no error.

1024–MAXULONGLONG
If no maximum size policy is installed, the function call fails with ERROR_LOG_POLICY_CONFLICT.

If a maximum size policy is installed, the log expands to the maximum number of containers specified by the maximum size policy and the function succeeds with no error.

pResultingSize

A pointer to a valid ULONGLONG data variable, receives the number of containers in the resized log upon success.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call the GetLastError function.

Remarks

Containers are created using the same security attributes as the .blf file and are created within the context of the application, not the context of the owner of the .blf file. For more information about .blf files, see Log Types. If containers are deleted, they are deleted using the security context of the calling application.

Examples

For an example that uses this function, see Creating a Log File.

Requirements

   
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header clfsmgmtw32.h
Library Clfsw32.lib
DLL Clfsw32.dll

See Also

Creating a Log File

InstallLogPolicy

Log Types